(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1297],{93344:e=>{e.exports={}},7727:e=>{e.exports={"tv-spinner__container-rotate":"tv-spinner__container-rotate-aLqboHuu"}},33633:e=>{e.exports={container:"container-B8mkOfAH",inner:"inner-B8mkOfAH","border-left":"border-left-B8mkOfAH","border-right":"border-right-B8mkOfAH","border-top":"border-top-B8mkOfAH","border-bottom":"border-bottom-B8mkOfAH","top-right-radius":"top-right-radius-B8mkOfAH","top-left-radius":"top-left-radius-B8mkOfAH","bottom-right-radius":"bottom-right-radius-B8mkOfAH","bottom-left-radius":"bottom-left-radius-B8mkOfAH"}},66316:e=>{e.exports={screen:"screen-otjoFNF2",fade:"fade-otjoFNF2",screenfade:"screenfade-otjoFNF2"}},27437:e=>{e.exports={}},25313:e=>{e.exports={css_value_currency_label_radius:"4",css_wrapper_margin:"4",css_row_left_right_padding:"3",css_fade_height:"10","price-axis-currency-label-wrapper":"price-axis-currency-label-wrapper-y5H41VPj",hidden:"hidden-y5H41VPj","price-axis-currency-label":"price-axis-currency-label-y5H41VPj",row:"row-y5H41VPj",expanded:"expanded-y5H41VPj","price-axis-currency-label-arrow-down":"price-axis-currency-label-arrow-down-y5H41VPj","price-axis-currency-label-text":"price-axis-currency-label-text-y5H41VPj"}},11710:e=>{e.exports={}},8406:e=>{e.exports={}},53473:e=>{e.exports={"css-value-chart-controls-bar-height-with-border":"39px","css-value-chart-controls-bar-border":"1px"}},61442:e=>{e.exports={}},32160:e=>{e.exports={}},23524:e=>{e.exports={"common-tooltip":"common-tooltip-EJBD96zX","common-tooltip--hidden":"common-tooltip--hidden-EJBD96zX","common-tooltip--horizontal":"common-tooltip--horizontal-EJBD96zX","common-tooltip--farther":"common-tooltip--farther-EJBD96zX","common-tooltip--vertical":"common-tooltip--vertical-EJBD96zX","common-tooltip-farther":"common-tooltip-farther-EJBD96zX","common-tooltip--direction_normal":"common-tooltip--direction_normal-EJBD96zX","common-tooltip__body":"common-tooltip__body-EJBD96zX","common-tooltip__button-container":"common-tooltip__button-container-EJBD96zX","common-tooltip__body--no-buttons":"common-tooltip__body--no-buttons-EJBD96zX","common-tooltip__button":"common-tooltip__button-EJBD96zX","common-tooltip--direction_reversed":"common-tooltip--direction_reversed-EJBD96zX","common-tooltip__ear-holder":"common-tooltip__ear-holder-EJBD96zX","common-tooltip__ear-holder--below":"common-tooltip__ear-holder--below-EJBD96zX","common-tooltip__ear-holder--above":"common-tooltip__ear-holder--above-EJBD96zX","common-tooltip__ear-holder--before":"common-tooltip__ear-holder--before-EJBD96zX","common-tooltip__ear-holder--after":"common-tooltip__ear-holder--after-EJBD96zX","common-tooltip__body--with-hotkey":"common-tooltip__body--with-hotkey-EJBD96zX","common-tooltip__body--width_wide":"common-tooltip__body--width_wide-EJBD96zX","common-tooltip__body--width_narrow":"common-tooltip__body--width_narrow-EJBD96zX","common-tooltip__body--no-padding":"common-tooltip__body--no-padding-EJBD96zX",
"common-tooltip__hotkey-block":"common-tooltip__hotkey-block-EJBD96zX","common-tooltip__hotkey-block--divider":"common-tooltip__hotkey-block--divider-EJBD96zX","common-tooltip__hotkey-text":"common-tooltip__hotkey-text-EJBD96zX","common-tooltip__hotkey-button":"common-tooltip__hotkey-button-EJBD96zX","common-tooltip__plus-sign":"common-tooltip__plus-sign-EJBD96zX"}},3343:(e,t,i)=>{"use strict";i.d(t,{Hardcode:()=>s,Modifiers:()=>o,hashFromEvent:()=>l,hashShiftPlusEnter:()=>c,hotkeyHashToAriaKeyshortcuts:()=>m,humanReadableHash:()=>p,humanReadableModifiers:()=>h,isMacKeyboard:()=>n,modifiersFromEvent:()=>a});var s,r=i(5325);!function(e){e[e.KeyCode=255]="KeyCode",e[e.Control=256]="Control",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Meta=2048]="Meta"}(s||(s={}));const n=r.isMac||r.isIOS;var o;function a(e){let t=0;return e.shiftKey&&(t+=1024),e.altKey&&(t+=512),e.ctrlKey&&(t+=256),e.metaKey&&(t+=2048),t}function l(e){return a(e)|e.keyCode}!function(e){e[e.None=0]="None",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Mod=n?2048:256]="Mod",e[e.Control=256]="Control",e[e.Meta=2048]="Meta"}(o||(o={}));const c=1037;function h(e,t=!n){let i="";return 256&e&&(i+=_(n?"^":"Ctrl",t)),512&e&&(i+=_(n?"⌥":"Alt",t)),1024&e&&(i+=_(n?"⇧":"Shift",t)),2048&e&&(i+=_(n?"⌘":"Win",t)),i}const d={9:"⇥",13:"↵",27:"Esc",8:n?"⌫":"Backspace",32:"Space",35:"End",36:"Home",37:"←",38:"↑",39:"→",40:"↓",45:"Ins",46:"Del",188:",",191:"/"},u={9:"Tab",13:"Enter",27:"Esc",8:"Backspace",32:"Space",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Ins",46:"Del",188:",",191:"/"};for(let e=1;e<=16;e++)d[e+111]=`F${e}`,u[e+111]=`F${e}`;function p(e){let t=h(e);const i=255&e;return t+=i in d?d[i]:String.fromCharCode(i),t}function _(e,t){return`${e}${t?" + ":n?" ":""}`}function m(e){const t=[];256&e&&t.push("Ctrl"),512&e&&t.push("Alt"),1024&e&&t.push("Shift"),2048&e&&t.push("Meta");const i=255&e;return i in d?t.push(d[i]):t.push(String.fromCharCode(i)),t.join("+")}},54717:(e,t,i)=>{"use strict";i.d(t,{isNativeUIInteraction:()=>n,isTextEditingField:()=>r});var s=i(3343);function r(e){if("INPUT"===e.tagName){const t=e.type;return"text"===t||"email"===t||"number"===t||"password"===t||"search"===t||"tel"===t||"url"===t}return"TEXTAREA"===e.tagName||e.isContentEditable}function n(e,t){if(!t)return!1;const i=255&e;if(27===i||i>>>4==7)return!1;switch(e^i){case s.Modifiers.Alt:return(38===i||40===i)&&"SELECT"===t.tagName||r(t);case s.Modifiers.Alt+s.Modifiers.Shift:return r(t);case s.Modifiers.Mod:if(67===i||!s.isMacKeyboard&&45===i){const e=t.ownerDocument&&t.ownerDocument.getSelection();if(e&&!e.isCollapsed)return!0}return r(t);case s.Modifiers.Mod+s.Modifiers.Shift:return i>=33&&i<=40&&r(t);case s.Modifiers.Shift:case 0:return 9===i?!(!t.ownerDocument||t===t.ownerDocument.body||t===t.ownerDocument.documentElement):(!function(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){const t=e.type;if("submit"===t||"button"===t||"reset"===t||"checkbox"===t||"radio"===t)return!0}return!1
}(t)||13===i||32===i||9===i)&&("form"in t||t.isContentEditable)}return!1}},5325:(e,t,i)=>{"use strict";i.d(t,{isAndroid:()=>_,isAnyMobile:()=>y,isBlackBerry:()=>m,isChrome:()=>a,isEdge:()=>c,isFF:()=>l,isIOS:()=>g,isIPad:()=>v,isLinux:()=>p,isMac:()=>d,isOperaMini:()=>f,isSafari:()=>h,isWindows:()=>u,mobiletouch:()=>n,touch:()=>o});const s="undefined"!=typeof window&&"undefined"!=typeof navigator,r=s&&"ontouchstart"in window,n=s&&r&&"onorientationchange"in window,o=s&&(r||!!navigator.maxTouchPoints),a=s&&window.chrome&&window.chrome.runtime,l=s&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,c=s&&/\sEdge\/\d\d\b/.test(navigator.userAgent),h=s&&Boolean(navigator.vendor)&&navigator.vendor.indexOf("Apple")>-1&&-1===navigator.userAgent.indexOf("CriOS")&&-1===navigator.userAgent.indexOf("FxiOS"),d=s&&/mac/i.test(navigator.platform),u=s&&/Win32|Win64/i.test(navigator.platform),p=s&&/Linux/i.test(navigator.platform),_=s&&/Android/i.test(navigator.userAgent),m=s&&/BlackBerry/i.test(navigator.userAgent),g=s&&/iPhone|iPad|iPod/.test(navigator.platform),f=s&&/Opera Mini/i.test(navigator.userAgent),v=s&&("MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||/iPad/.test(navigator.platform)),y=_||m||g||f},7029:(e,t,i)=>{"use strict";i.d(t,{t:()=>s});const s=i.i18next},19625:(e,t,i)=>{"use strict";i.r(t),i.d(t,{colorsPalette:()=>d,findHexColorByName:()=>h,getHexColorByName:()=>u});var s=i(23420),r=i(579),n=i(50151);const o={...s,...r},a={},l=Object.keys(o).length,c=/^#(([a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i;function h(e,t=[],i=o){const s=i[e];if(!s)return null;if(c.test(s))return s;const r=s;return t.push(e),-1!==t.indexOf(r)?(console.warn("Colors definitions cycled"),s):t.length>l?(console.warn("Too many variables-link in HEX-color search: "+t[0]),null):h(r,t,i)}Object.keys(o).forEach((e=>{const t=h(e);a[e]=(0,n.ensureNotNull)(t)}));const d=a;function u(e,t=d){const i=t[e];if(!i){if(c.test(e))return e;throw new Error("No such color "+e)}return i}},74991:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>n,dur:()=>s,easingFunc:()=>r});const s=350,r={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};class n{constructor(e,t,i,s){this._mX1=e,this._mY1=t,this._mX2=i,this._mY2=s}easingFunc(e){return this._mX1===this._mY1&&this._mX2===this._mY2?e:this._calcBezier(this._getTForX(e))}_a(e,t){return 1-3*t+3*e}_b(e,t){return 3*t-6*e}_c(e){return 3*e}_calcBezier(e){return((this._a(this._mY1,this._mY2)*e+this._b(this._mY1,this._mY2))*e+this._c(this._mY1))*e}_getSlope(e){return 3*this._a(this._mX1,this._mX2)*e*e+2*this._b(this._mX1,this._mX2)*e+this._c(this._mX1)}_getTForX(e){let t=e;for(let i=0;i<4;++i){const i=this._getSlope(t);if(0===i)return t;t-=(this._calcBezier(t)-e)/i}return t
}}},58096:(e,t,i)=>{"use strict";i.d(t,{DEFAULT_SIZE:()=>s,spinnerSizeMap:()=>r});const s="large",r={mini:"xsmall",xxsmall:"xxsmall",xsmall:"xsmall",small:"small",medium:"medium",large:"large"}},76460:(e,t,i)=>{"use strict";function s(e){return 0===e.detail}i.d(t,{isKeyboardClick:()=>s})},94194:(e,t,i)=>{"use strict";i.d(t,{getTooltipData:()=>r,setTooltipData:()=>n});const s=new WeakMap;function r(e,t){const i=s.get(e);return i instanceof Function?i(t):i&&i[t]}function n(e,t,i){if(i instanceof Function)return void s.set(e,i);const r=s.get(e),n=void 0===r||r instanceof Function?{}:r;n[t]=i,s.set(e,n)}},61814:(e,t,i)=>{"use strict";i.d(t,{hotKeyDeserialize:()=>n,hotKeySerialize:()=>r});var s=i(49406);function r(e){return(0,s.htmlEscape)(JSON.stringify(e))}function n(e){return JSON.parse((0,s.decodeHTMLEntities)(e))}},38780:(e,t,i)=>{"use strict";i.d(t,{hide:()=>q,show:()=>j,showOnElement:()=>U});var s=i(32563),r=i(50151),n=i(4741);let o=0,a=0,l=0;function c(){clearTimeout(o),clearTimeout(a),clearTimeout(l)}function h(e,t){o=setTimeout(e,t)}const d="tooltip-root-element";let u;function p(){const e=document.getElementById(d);e?u=e:(u=document.createElement("div"),u.id=d,document.body.appendChild(u))}function _(){u&&(u.innerHTML="")}"interactive"===document.readyState?p():document.addEventListener("DOMContentLoaded",p);var m=i(49481),g=i(63273),f=(i(21251),i(14729)),v=i(9859),y=i(49483);const S={default:"",white:"theme-white",chart:"theme-chart","round-shadow":"theme-round-shadow"},b=Object.keys(S);var w,C=i(94194),P=i(61814),x=i(23524);function T(e){const t=function(e){const t=e.hasAttribute("data-tooltip")?e.getAttribute("data-tooltip"):e.getAttribute("title");return t&&((0,C.setTooltipData)(e,"text",t),e.removeAttribute("title")),(0,C.getTooltipData)(e,"text")||""}(e),i=e.getBoundingClientRect(),s={h:i.height,w:i.width,x:i.left,y:i.top},r=e.getAttribute("data-color-theme")||"",n=e.classList.contains("common-tooltip-html"),o=parseInt(e.getAttribute("data-tooltip-delay")||""),a=parseInt(e.getAttribute("data-tooltip-debounce")||"");let l={type:"none"};return t&&(l={type:n?"html":"text",data:t}),{above:e.classList.contains("common-tooltip-above"),below:e.classList.contains("common-tooltip-below"),otl:e.classList.contains("common-tooltip-otl"),otr:e.classList.contains("common-tooltip-otr"),vertical:e.classList.contains("common-tooltip-vertical"),hotkey:e.getAttribute("data-tooltip-hotkey"),narrow:e.classList.contains("common-tooltip-narrow"),wide:e.classList.contains("common-tooltip-wide"),colorTheme:r,tooltipDelay:o,tooltipDebounce:a,rect:s,content:l,target:e}}function I(e){const t=(0,r.ensureNotNull)(V).cloneNode(!0),i=N(t),{content:s}=e;switch(s.type){case"element":i.innerHTML="",i.appendChild(s.data);break;case"html":i.innerHTML=s.data;break;case"text":if(e.hotkey){const e=(0,r.ensureNotNull)(R).cloneNode(!0);e.innerText=s.data,i.appendChild(e)}else i.innerText=s.data}if(e.hotkey){const t="none"!==s.type,n=(0,r.ensureNotNull)(B).cloneNode(!0),o=(0,
P.hotKeyDeserialize)(e.hotkey),a=o.keys.map((e=>`${e}`));n.innerHTML=function(e,t){const i=/{\d}|{hotkey_\d}/gi;return e.replace(i,(e=>{const i=Number(e.match(/\d/));return t[i]}))}(o.text,a).replace(/\s\+\s/g,`+`),i.classList.add(x["common-tooltip__body--with-hotkey"]),t&&n.classList.add(x["common-tooltip__hotkey-block--divider"]),i.appendChild(n)}return t.addEventListener("contextmenu",f.preventDefault),t}function M(e,t){const i=t.rect;if(!i)return;!function(e,t){const i=b.includes(t)?S[t]:"";e.classList.remove(...b.map((e=>S[e])).filter((e=>!!e))),i&&!e.classList.contains(i)&&e.classList.add(i)}(e,t.colorTheme||"default"),t.addClass&&e.classList.add(t.addClass);const s=N(e),r=e.querySelector(`.${x["common-tooltip__button-container"]}`);s.classList.toggle(x["common-tooltip__body--width_wide"],Boolean(t.wide)),s.classList.toggle(x["common-tooltip__body--no-padding"],Boolean(t.noPadding)),s.classList.toggle(x["common-tooltip__body--width_narrow"],Boolean(t.narrow)),s.classList.toggle(x["common-tooltip__body--no-buttons"],!0),s.style.left=L(0),s.style.width=L(s.clientWidth+(Boolean(t.noPadding)?0:2));const n=document.body.clientWidth,o=y.CheckMobile.iOS()||y.CheckMobile.Android()||(0,y.supportTouch)()&&(0,y.isMac)()?window.innerHeight:document.body.clientHeight,a=t.vertical,l=t.extendMargin||a&&i.w<20||!a&&i.h<20;e.classList.toggle(x["common-tooltip--farther"],l),e.classList.toggle(x["common-tooltip--vertical"],a),e.classList.toggle(x["common-tooltip--horizontal"],!a);const c=function(e){return e.querySelector(`.${x["common-tooltip__ear-holder"]}`)}(e),h=e.offsetHeight;if(a){const a=10,l=o-10,d=12,u=a+d,p=l-d,_=(0,v.clamp)(i.y+i.h/2,u,p)-h/2,m=_+h;e.style.left=L(i.x+i.w),e.style.top=L(_),_l&&(s.style.top=r.style.top=L(l-m));const{right:f}=(e.querySelector(":last-child")||s).getBoundingClientRect(),y=f+10>n;e.classList.toggle(x["common-tooltip--direction_reversed"],y),e.classList.toggle(x["common-tooltip--direction_normal"],!y);let S=y?"after":"before";(0,g.isRtl)()?(S=t.otr?"after":S,S=t.otl?"before":S):(S=t.otr?"before":S,S=t.otl?"after":S),c.classList.toggle(x["common-tooltip__ear-holder--before"],"before"===S),c.classList.toggle(x["common-tooltip__ear-holder--after"],"after"===S),"after"===S&&(e.style.left="auto",e.style.right=L(n-i.x))}else{const a=i.x-(s.offsetWidth-i.w)/2,l=n-e.offsetWidth-20<=0?(n-e.offsetWidth)/2:10,d=n-l-e.offsetWidth,u=Math.max(l,Math.min(a,d));e.style.left=L(u);const p=d\n\t\t\n\t\t\n\t\n`,D=`\n\t\n`,E=`\n\t\n`,V=(0,m.parseHtmlElement)(k),B=(0,m.parseHtmlElement)(D),R=(0,m.parseHtmlElement)(E);function N(e){return e.querySelector(`.${x["common-tooltip__body"]}`)}function O(e,t){return 10+e{H&&(H.destroy(),H=null)};for(const t of r){if("buttons"in e){if(1&e.buttons)continue}else if(1===e.which)continue;const i=()=>U(t);if(i()){const e=e=>s(null,!0),s=(r,n=!1)=>{t.removeEventListener("common-tooltip-update",i),t.removeEventListener("mouseleave",s),t.removeEventListener("mousedown",s),document.removeEventListener("scroll",e,{capture:!0}),o(),q(n)};t.addEventListener("common-tooltip-update",i),t.addEventListener("mouseleave",s),t.addEventListener("mousedown",s),document.addEventListener("scroll",e,{capture:!0}),null===H&&(H=(0,n.createGroup)({desc:"Tooltip"}),H.add({desc:"Hide",hotkey:27,handler:s}));break}}}),!0);const z=new MutationObserver((()=>{if(W&&W.options.target){let e;e="isConnected"in W.options.target?W.options.target.isConnected:document.body.contains(W.options.target),e||q()}})),U=(e,t={})=>{const{content:i,...s}=Y(t),r=T(e),n=Object.assign(r,s);return"none"!==i.type&&(n.content=i),!("none"===n.content.type&&!n.hotkey)&&(n.target=e,j(n),!0)},j=e=>{const t=Y(e),i=I(t);var s;if(W={options:t,element:i},s=i,_(),u&&u.appendChild(s),c(),!F)return A(i),void h((()=>$(i)),function(e){return"number"!=typeof e.tooltipDelay||isNaN(e.tooltipDelay)?500:e.tooltipDelay}(t));const{tooltipDebounce:r}=e;"number"!=typeof r||isNaN(r)?$(i):h((()=>$(i)),r)};function G(){_(),F=!1,W=null}const q=(e,t)=>{if(c(),(0,r.ensureNotNull)(z).disconnect(),!W)return;if(!e&&!F)return;const{element:i,options:s}=W,n=()=>{i.removeEventListener("mouseleave",n),A(i),e?G():l=setTimeout((()=>{G()}),250),null==t||t()};var o,h;s.tooltipHideDelay?(o=()=>{i.querySelector(":hover")?i.addEventListener("mouseleave",n):n()},h=s.tooltipHideDelay,a=setTimeout(o,h)):n()}
;function $(e){const{options:t}=(0,r.ensureNotNull)(W);if(M(e,t),function(e){e.classList.toggle(x["common-tooltip--hidden"],!1)}(e),(0,r.ensureNotNull)(z).observe(document,{childList:!0,subtree:!0}),F=!0,t.forceHideOnMove){const e=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("touchmove",e),q()};document.addEventListener("mousemove",e),document.addEventListener("touchmove",e)}}function K(e){return e&&(e.nodeType===Node.ELEMENT_NODE?e:null)}function Y(e){if(function(e){return"content"in e}(e))return e;const{inner:t,html:i,text:s,...r}=e;let n={type:"none"};return t&&(n={type:"element",data:t}),s&&(n={type:i?"html":"text",data:s}),{content:n,...r}}},31940:(e,t,i)=>{"use strict";i.d(t,{ResizerDetacherState:()=>n});var s=i(50151),r=i(64147);class n{constructor(e){this._alive=new r.WatchedValue,this._container=new r.WatchedValue,this._width=new r.WatchedValue,this._height=new r.WatchedValue,this._fullscreen=new r.WatchedValue,this._detachable=new r.WatchedValue,this._fullscreenable=new r.WatchedValue,this._visible=new r.WatchedValue,this._availWidth=new r.WatchedValue,this._availHeight=new r.WatchedValue,this._owner=new r.WatchedValue,this._ownersStack=[],this.owner=this._owner.readonly(),this._bridge={alive:this._alive.readonly(),container:this._container.readonly(),width:this._width.readonly(),height:this._height.readonly(),fullscreen:this._fullscreen.readonly(),detachable:this._detachable.readonly(),fullscreenable:this._fullscreenable.readonly(),visible:this._visible.readonly(),availWidth:this._availWidth.readonly(),availHeight:this._availHeight.readonly(),remove:()=>{const e=this._owner.value();e&&e.remove&&e.remove()},negotiateWidth:e=>{const t=this._owner.value();t&&t.negotiateWidth&&t.negotiateWidth(e)},negotiateHeight:e=>{const t=this._owner.value();t&&t.negotiateHeight&&t.negotiateHeight(e)},requestFullscreen:()=>{const e=this._owner.value();e&&e.requestFullscreen&&e.requestFullscreen()},exitFullscreen:()=>{const e=this._owner.value();e&&e.exitFullscreen&&e.exitFullscreen()},detach:e=>{const t=this._owner.value();t&&t.detach&&t.detach(e)},attach:()=>{const e=this._owner.value();e&&e.attach&&e.attach()}},e&&this.pushOwner(e)}bridge(){return this._bridge}pushOwner(e){if(!e.alive.value())return;for(const e of this._ownersStack)this._unsubscribeOwner(e);const t={owner:e};this._ownersStack.push(t),this._subscribeOwner(t)}_subscribeOwner(e){const t=e.owner;if(e.deathWatcher||(this._alive.setValue(!0),e.deathWatcher=t.alive.spawn(),e.deathWatcher.subscribe((t=>{t||this._deadHandler(e)}))),this._owner.setValue(t),!e.subscriptions){const i=e.subscriptions=[];this._visible.setValue(!1);const s=(e,t)=>{if(e){const s=e.spawn();i.push(s),s.subscribe((e=>{t.setValue(e)}),{callWithLast:!0})}else t.deleteValue()};s(t.container,this._container),s(t.width,this._width),s(t.height,this._height),s(t.fullscreen,this._fullscreen),s(t.detachable,this._detachable),s(t.fullscreenable,this._fullscreenable),s(t.availWidth,this._availWidth),s(t.availHeight,this._availHeight),s(t.visible,this._visible)}}
_unsubscribeOwner(e,t){if(e.subscriptions){for(const t of e.subscriptions)t.unsubscribe();e.subscriptions=null}t&&e.deathWatcher&&(e.deathWatcher.unsubscribe(),e.deathWatcher=null)}_deadHandler(e){const t=this._ownersStack.indexOf(e);(0,s.assert)(-1!==t,"sanitized owner should be in stack");for(let e=this._ownersStack.length-1;e>=t;e--)this._unsubscribeOwner(this._ownersStack[e],!0);this._ownersStack.length=t,t>0?this._subscribeOwner(this._ownersStack[t-1]):(this._alive.setValue(!1),this._owner.deleteValue())}}},32112:(e,t,i)=>{"use strict";function s(e,t){const i=e.dataSourceForId(t);if(null===i)throw new Error(`Chart has no study or shape with id "${t}"`);return i}i.d(t,{SelectionApi:()=>r});class r{constructor(e){this._model=e}add(e){Array.isArray(e)?this._model.selectionMacro((t=>{e.map(s.bind(null,this._model)).forEach((e=>t.addSourceToSelection(e)))})):this.add([e])}canBeAddedToSelection(e){const t=s(this._model,e);return this._model.selection().canBeAddedToSelection(t)}set(e){Array.isArray(e)?this._model.selectionMacro((t=>{t.clearSelection(),e.map(s.bind(null,this._model)).forEach((e=>t.addSourceToSelection(e)))})):this.set([e])}remove(e){Array.isArray(e)?this._model.selectionMacro((t=>{e.map(s.bind(null,this._model)).forEach((e=>t.removeSourceFromSelection(e)))})):this.remove([e])}contains(e){const t=s(this._model,e);return this._model.selection().isSelected(t)}allSources(){return this._model.selection().dataSources().map((e=>e.id()))}isEmpty(){return this._model.selection().isEmpty()}clear(){this._model.selectionMacro((e=>{e.clearSelection()}))}onChanged(){return this._model.onSelectedSourceChanged()}}},152:(e,t,i)=>{"use strict";i.d(t,{getStudyInputsInfo:()=>r});var s=i(11542);function r(e){return void 0===e.inputs?[]:e.inputs.map((e=>({...e,id:e.id,localizedName:void 0!==e.name?s.t(e.name,{context:"input"},i(32856)):""})))}},70120:(e,t,i)=>{"use strict";i.d(t,{getStudyStylesInfo:()=>r});var s=i(27788);function r(e){const t={};if(e.defaults){const i=(0,s.default)(e.defaults);t.defaults=i}return void 0!==e.plots&&(t.plots=(0,s.default)(e.plots)),void 0!==e.styles&&(t.styles=(0,s.default)(e.styles)),void 0!==e.bands&&(t.bands=(0,s.default)(e.bands)),void 0!==e.filledAreas&&(t.filledAreas=(0,s.default)(e.filledAreas)),void 0!==e.palettes&&(t.palettes=(0,s.default)(e.palettes)),t}},23024:(e,t,i)=>{"use strict";i.d(t,{getChartStorage:()=>n});var s=i(64289);let r=null;async function n(){const e=(0,s.getCustomAdapter)();if(null===r)if(null!==e){const{ChartStorageExternalAdapter:t}=await i.e(8313).then(i.bind(i,33047));r=new t(e)}else{const{ChartStorageHttpLibrary:e}=await i.e(6124).then(i.bind(i,11777));r=new e}return null===r&&(r=new ChartStorageHttp),r}},38881:(e,t,i)=>{"use strict";i.d(t,{ChunkLoader:()=>r});var s=i(14051);class r{constructor(){this._retries=5,this._cache=null,this._tryLoad=(e,t)=>{this._retries=this._retries-1;this._startLoading(e).then(t,0!==this._retries?i=>{(0,s.isAbortError)(i)||setTimeout((()=>this._tryLoad(e,t)),3e3)}:void 0)}}load(e){
return this._cache||(this._cache=new Promise(this._tryLoad.bind(this,null!=e?e:null))),this._cache}}},65446:(e,t,i)=>{"use strict";i.d(t,{copyToClipboard:()=>r,writeImpl:()=>n,writePromiseUsingApi:()=>a});var s=i(93352);function r(e){return n(e,null)}function n(e,t){const i=e.files&&e.files.length>0;if(!i&&t&&t.eventPhase>0)return o(t,e),Promise.resolve();if(!i){let t=!1;const i=i=>{i.stopImmediatePropagation(),o(i,e),t=!0};try{document.addEventListener("copy",i,!0),document.execCommand("copy")}finally{document.removeEventListener("copy",i,!0)}if(t)return Promise.resolve()}return async function(e){const t=(0,s.getClipboard)();if(!t||!t.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");const i={};for(const t of e.files||[])i[t.type]=t;e.text&&(i["text/plain"]=e.text);e.html&&(i["text/html"]=e.html);return t.write([new window.ClipboardItem(i)])}(e)}function o(e,t){e.preventDefault();const i=e.clipboardData;t.text&&i.setData("text/plain",t.text),t.html&&i.setData("text/html",t.html)}async function a(e,t){const i=(0,s.getClipboard)();if("text/plain"===t&&!i.write){const t=await e;return i.writeText(await t.text())}if(!i||!i.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");let r=null;try{r=new window.ClipboardItem({[t]:e})}catch(i){r=new window.ClipboardItem({[t]:await e})}if(r)return i.write([r]);throw new Error("ClipboardApi is not supported")}},5370:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return null;const t=e.match(/(delayed_streaming)_(\d+)/);return null===t?null:{mode:t[1],interval:parseInt(t[2])}}function r(e){const t=s(e.update_mode);return null===t||(e.update_mode=t.mode,e.update_mode_seconds=t.interval),e}i.r(t),i.d(t,{normalizeUpdateMode:()=>r,parseUpdateMode:()=>s})},84917:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{Months:()=>r,WeekDays:()=>s}),function(e){e[e.SUNDAY=1]="SUNDAY",e[e.MONDAY=2]="MONDAY",e[e.TUESDAY=3]="TUESDAY",e[e.WEDNESDAY=4]="WEDNESDAY",e[e.THURSDAY=5]="THURSDAY",e[e.FRIDAY=6]="FRIDAY",e[e.SATURDAY=7]="SATURDAY"}(s||(s={})),function(e){e[e.JANUARY=0]="JANUARY",e[e.FEBRUARY=1]="FEBRUARY",e[e.MARCH=2]="MARCH",e[e.APRIL=3]="APRIL",e[e.MAY=4]="MAY",e[e.JUNE=5]="JUNE",e[e.JULY=6]="JULY",e[e.AUGUST=7]="AUGUST",e[e.SEPTEMBER=8]="SEPTEMBER",e[e.OCTOBER=9]="OCTOBER",e[e.NOVEMBER=10]="NOVEMBER",e[e.DECEMBER=11]="DECEMBER"}(r||(r={}))},80007:(e,t,i)=>{"use strict";i.d(t,{preventDefault:()=>r,preventScrollByWheelClick:()=>o,wrapHandlerWithPreventEvent:()=>n});var s=i(49483);function r(e){e.cancelable&&e.preventDefault()}function n(e){return t=>{r(t),e()}}function o(e){s.isChrome&&e.addEventListener("mousedown",(e=>{if(1===e.button)return e.preventDefault(),!1}))}},93352:(e,t,i)=>{"use strict";function s(){return navigator.clipboard}i.d(t,{getClipboard:()=>s})},56186:(e,t,i)=>{"use strict";function s(e){if(e instanceof Error)return e.stack||e.message;try{return e.outerHTML.slice(0,1024)}catch(e){}try{if(void 0!==e)return JSON.stringify(e).slice(0,1024)}catch(e){}return String(e)}
function r(){window.__tv_js_errors||(window.__tv_js_errors=[]),window.addEventListener("error",(e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(`${t} ${e.message||"JS error"}. ${e.filename||""}, line ${e.lineno}, col ${e.colno}.\nError: ${s(e.error)}`)}),!1),window.addEventListener("unhandledrejection",(e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(`${t} Unhandled rejection.\nReason: ${s(e.reason)}`)}),!1),document.addEventListener("securitypolicyviolation",(e=>{if(String(e.sourceFile).startsWith("https://securepubads.g.doubleclick.net")&&String(e.blockedURI).startsWith("https://adservice.google."))return;const t=(new Date).toISOString(),i="report"===e.disposition?"CSP report-only":"CSP violation";window.__tv_js_errors.push(`${t} ${i}: ${e.violatedDirective||e.effectiveDirective}. ${e.sourceFile||""}, line ${e.lineNumber}, col ${e.columnNumber}.\nBlocked URI: ${e.blockedURI}\nSample: ${e.sample}\nTarget: ${s(e.target)}`)}),!1)}i.d(t,{install:()=>r})},76422:(e,t,i)=>{"use strict";i.r(t),i.d(t,{emit:()=>u,emitOnce:()=>p,on:()=>c,subscribe:()=>h,subscribeToAll:()=>d,unsubscribe:()=>a,unsubscribeAll:()=>l});var s=i(52033);const r={},n=[],o={};function a(e,t,i){r[e].unsubscribe(i,t)}function l(e,t){r[e].unsubscribeAll(t)}function c(e,t,i){h(e,t,i)}function h(e,t,i,n){r.hasOwnProperty(e)||(r[e]=new s.Delegate),o[e]?t.call(i):r[e].subscribe(i,t,n)}function d(e){n.push(e)}function u(e,...t){const i=[e].concat(t);n.forEach((e=>{e.apply(null,i)})),r.hasOwnProperty(e)&&r[e].fire.apply(r[e],t)}function p(e){o[e]&&console.warn(`Something went wrong: emitOnce called multiple times with same event (${e})`),o[e]=!0,u.apply(null,arguments)}},4741:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Modifiers:()=>r.Modifiers,createGroup:()=>p,keyboardPressedKeysState:()=>u,pressedKeys:()=>d,registerWindow:()=>_,unregisterWindow:()=>m});var s=i(91679),r=i(3343),n=i(54717);class o{constructor(e,t){this.modifiers=e,this.code=t}altOrOptionCode(){return"AltLeft"===this.code||"AltRight"===this.code}controlOrMetaCode(){return r.isMacKeyboard?"MetaLeft"===this.code||"MetaRight"===this.code||"OSLeft"===this.code||"OSRight"===this.code:"ControlLeft"===this.code||"ControlRight"===this.code}}class a extends s.WatchedValue{setValue(e,t){const i=this.value();(t||void 0===i||i.code!==e.code||i.modifiers!==e.modifiers)&&super.setValue(e)}}class l{constructor(e,t){this._group=e;const{hotkey:i,handler:s,desc:r,isDisabled:n,element:o=null,isRepeatAccepted:a=!1}=t;this.hotkey=i,this.handler=s,this.desc=r,this.element=o,this.isRepeatAccepted=a,this.isDisabled=n?"function"==typeof n?n:()=>!0:()=>!1}destroy(){this._group&&(this._group.remove(this),this._group=null)}}class c{constructor(e,t){this._actions=new Map,this._manager=e,this.modal=!(!t||!t.modal),t&&(this.desc=t.desc),t&&t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1,this._manager.registerGroup(this)}add(e){let t=this._actions.get(e.hotkey);t||(t=[],this._actions.set(e.hotkey,t))
;const i=new l(this,e);return t.push(i),i}remove(e){const t=this._actions.get(e.hotkey);if(!t)return;const i=t.findIndex((t=>t===e));i>=0&&(1===t.length?this._actions.delete(e.hotkey):t.splice(i,1))}handleHotkey(e,t){const i=this._actions.get(e);if(!i)return!1;for(const s of i)if((!s.element||t.target&&s.element.contains(t.target))&&!s.isDisabled())return t.repeat&&!s.isRepeatAccepted||(s.handler(t),this._callMatchedHotkeyHandler(e)),t.preventDefault(),!0;return!1}promote(){this._manager.promoteGroup(this)}destroy(){for(const[,e]of this._actions)for(const t of e)t.destroy();this._actions.clear(),this._manager.unregisterGroup(this)}static setMatchedHotkeyHandler(e){c._matchedHotkeyHandler=e}_callMatchedHotkeyHandler(e){c._matchedHotkeyHandler&&c._matchedHotkeyHandler(e)}}const h=new class{constructor(){this._groups=[],this._pressedKeys=new s.WatchedValue(0),this._keyboardPressedKeysState=new a(new o(0)),this._keyDownListener=e=>{if(e.defaultPrevented)return;const t=(0,r.hashFromEvent)(e);if(this._pressedKeys.setValue(t),this._keyboardPressedKeysState.setValue(new o((0,r.modifiersFromEvent)(e),e.code)),!(0,n.isNativeUIInteraction)(t,e.target))for(let i=this._groups.length;i-- >0;){const s=this._groups[i];if(!s.isDisabled()){if(s.handleHotkey(t,e))return;if(s.modal)return}}},this._keyUpListener=e=>{const t=(0,r.hashFromEvent)(e);this._pressedKeys.setValue(t),this._keyboardPressedKeysState.setValue(new o((0,r.modifiersFromEvent)(e),""))},this._blurEvent=()=>{this._pressedKeys.setValue(0),this._keyboardPressedKeysState.setValue(new o(0,""))},this._mouseEvent=e=>{var t;const i=(0,r.modifiersFromEvent)(e),s=255&(null!==(t=this._pressedKeys.value())&&void 0!==t?t:0);this._pressedKeys.setValue(i|s)}}listen(e){e.addEventListener("keydown",this._keyDownListener),e.addEventListener("keyup",this._keyUpListener),e.addEventListener("blur",this._blurEvent),e.addEventListener("mousemove",this._mouseEvent)}unlisten(e){e.removeEventListener("keydown",this._keyDownListener),e.removeEventListener("keyup",this._keyUpListener),e.removeEventListener("blur",this._blurEvent),e.removeEventListener("mousemove",this._mouseEvent)}registerGroup(e){this._groups.push(e)}unregisterGroup(e){for(let t=this._groups.length;t--;)this._groups[t]===e&&this._groups.splice(t,1)}promoteGroup(e){let t=this._groups.length-1;for(let i=this._groups.length;i--;){if(this._groups[i]===e)return void(i!==t&&(this._groups.splice(i,1),this._groups.splice(t,0,e)));this._groups[i].modal&&(t=i-1)}}pressedKeys(){return this._pressedKeys.readonly()}keyboardPressedKeysState(){return this._keyboardPressedKeysState.readonly()}},d=h.pressedKeys(),u=h.keyboardPressedKeysState();function p(e){return new c(h,e)}function _(e){h.listen(e)}function m(e){h.unlisten(e)}var g=i(51768);_(window),c.setMatchedHotkeyHandler((e=>{(0,g.trackEvent)("Keyboard Shortcuts",(0,r.humanReadableHash)(e))}))},68335:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Hardcode:()=>s.Hardcode,Modifiers:()=>s.Modifiers,hashFromEvent:()=>s.hashFromEvent,hashShiftPlusEnter:()=>s.hashShiftPlusEnter,
hotkeyHashToAriaKeyshortcuts:()=>s.hotkeyHashToAriaKeyshortcuts,humanReadableHash:()=>s.humanReadableHash,humanReadableModifiers:()=>s.humanReadableModifiers,isMacKeyboard:()=>s.isMacKeyboard,modifiersFromEvent:()=>s.modifiersFromEvent});var s=i(3343)},35749:(e,t,i)=>{"use strict";i.d(t,{isNativeUIInteraction:()=>s.isNativeUIInteraction,isTextEditingField:()=>s.isTextEditingField});var s=i(54717)},71382:(e,t,i)=>{"use strict";i.d(t,{isTouchEvent:()=>r});var s=i(32563);function r(e){const t=e.sourceCapabilities;let i=t&&t.firesTouchEvents;return void 0===i&&(i=s.touch),i}},82992:(e,t,i)=>{"use strict";i.d(t,{linking:()=>m});var s=i(12481),r=i(50151),n=i(64147),o=(i(56570),i(85049)),a=i(68805),l=i(31955),c=i(42989),h=i(69109);const d=(0,l.getLogger)("Linking");var u,p;!function(e){e[e.NotBound=0]="NotBound",e[e.BoundToWidget=1]="BoundToWidget",e[e.BoundToModel=2]="BoundToModel"}(u||(u={})),function(e){e[e.Symbol=0]="Symbol",e[e.Resolution=1]="Resolution"}(p||(p={}));class _{constructor(e,t,i){this.watchedSymbol=new n.WatchedValue,this.seriesShortSymbol=new n.WatchedValue,this.proSymbol=new n.WatchedValue,this.ensuredProSymbol=new n.WatchedValue,this.watchedInterval=new n.WatchedValue,this.watchedIntraday=new n.WatchedValue,this.watchedSeconds=new n.WatchedValue,this.watchedTicks=new n.WatchedValue,this.watchedDataFrequencyResolution=new n.WatchedValue,this.watchedRange=new n.WatchedValue,this.watchedSupportedResolutions=new n.WatchedValue,this.watchedSupportedChartStyles=new n.WatchedValue,this.symbolNamesList=new n.WatchedValue,this._chartWidgetCollection=null,this._chartWidgetBindingState=0,this._activeChartWidget=null,this._linkingGroupCharts=null,this._boundChartWidget=null,this._watchedSymbolListenerBound=this._watchedSymbolListener.bind(this),this._watchedIntervalListenerBound=this._watchedIntervalListener.bind(this),this._muted=!1,this.updateBoundChartWidget=()=>{const e=this._chartToBind();e!==this._boundChartWidget&&(null===e?this.unbindFromChartWidget():this.bindToChartWidget(e))},this._updateAllGroupChartWidgets=()=>{var e;null===(e=this._destroySymbolIntervalPropertySubscriptions)||void 0===e||e.call(this);const t=(0,r.ensureNotNull)(this._linkingGroupCharts).value(),i=[],s=[];for(const e of t){const t=e.symbolWV().spawn(),r=e.resolutionWV().spawn();t.subscribe(this._updateSymbolByProperty.bind(this,e)),r.subscribe(this._updateIntervalByProperty.bind(this,e)),i.push(t),s.push(r)}this._destroySymbolIntervalPropertySubscriptions=()=>{i.forEach((e=>e.destroy())),s.forEach((e=>e.destroy())),this._destroySymbolIntervalPropertySubscriptions=void 0};const n=this.watchedSymbol.value();t.length>1&&this._needApplySymbol(n)&&!this._muted&&this._setGroupSymbol(n);const o=this.watchedInterval.value();t.length>1&&this._needApplyInterval(o)&&!this._muted&&this._setGroupInterval(o),this.updateBoundChartWidget()},this._groupIndex=e;const s=(e,t)=>{e.subscribe((e=>{i()===this&&t.setValue(e)}),{callWithLast:!0})};s(this.watchedSymbol,t.watchedSymbol),s(this.seriesShortSymbol,t.seriesShortSymbol),s(this.proSymbol,t.proSymbol),
s(this.ensuredProSymbol,t.ensuredProSymbol),s(this.watchedInterval,t.watchedInterval),s(this.watchedIntraday,t.watchedIntraday),s(this.watchedSeconds,t.watchedSeconds),s(this.watchedTicks,t.watchedTicks),s(this.watchedDataFrequencyResolution,t.watchedDataFrequencyResolution),s(this.watchedRange,t.watchedRange),s(this.watchedSupportedResolutions,t.watchedSupportedResolutions),s(this.watchedSupportedChartStyles,t.watchedSupportedChartStyles),s(this.symbolNamesList,t.symbolNamesList),this.watchedSymbol.subscribe((e=>{this._boundChartWidget&&this._boundChartWidget.hasModel()&&this._mainSeries().symbolSameAsCurrent(e)||this.proSymbol.setValue(e)}),{callWithLast:!0})}mute(e){this._muted=e}bindToChartWidgetCollection(e){this.unbindFromChartWidgetCollection(),this._chartWidgetCollection=e,this._activeChartWidget=e.activeChartWidget.spawn(),this._activeChartWidget.subscribe(this.updateBoundChartWidget),this._linkingGroupCharts=e.linkingGroupsCharts(this._groupIndex).spawn(),this._linkingGroupCharts.subscribe(this._updateAllGroupChartWidgets),this.updateBoundChartWidget(),this._updateAllGroupChartWidgets()}unbindFromChartWidgetCollection(){var e,t,i;this.unbindFromChartWidget(),this._chartWidgetCollection=null,null===(e=this._activeChartWidget)||void 0===e||e.destroy(),this._activeChartWidget=null,null===(t=this._linkingGroupCharts)||void 0===t||t.destroy(),this._linkingGroupCharts=null,null===(i=this._destroySymbolIntervalPropertySubscriptions)||void 0===i||i.call(this)}bindToChartWidget(e){if(this.unbindFromChartWidget(),this._boundChartWidget=e,e.hasModel())return void this._onChartModelCreated(e.model());e.modelCreated().subscribe(this,this._onChartModelCreated,!0),this._chartWidgetBindingState=1;const t=e.properties().childs().mainSeriesProperties.childs();this.watchedSymbol.setValue(t.symbol.value()),this.watchedInterval.setValue(t.interval.value()),this._boundChartWidget.linkingGroupIndex().subscribe(this.updateBoundChartWidget)}unbindFromChartWidget(){const e=this._boundChartWidget;if(null!==e){switch(this._chartWidgetBindingState){case 1:e.modelCreated().unsubscribeAll(this);break;case 2:this.watchedSymbol.unsubscribe(this._watchedSymbolListenerBound);const t=this._mainSeries().dataEvents();t.symbolResolved().unsubscribeAll(this),t.symbolError().unsubscribeAll(this),this.watchedInterval.unsubscribe(this._watchedIntervalListenerBound),delete this.watchedSymbol.writeLock}e.linkingGroupIndex().unsubscribe(this.updateBoundChartWidget),this._boundChartWidget=null,this._chartWidgetBindingState=0}}boundChartWidget(){return this._boundChartWidget}_mainSeries(){if(!this._boundChartWidget)throw new Error("ChartWidget is undefined");return this._boundChartWidget.model().mainSeries()}_watchedSymbolListener(e){this._needApplySymbol(e)&&!this._muted&&this._setGroupSymbol(e)}_updateSymbolByProperty(e,t){const i=this._symbolLock();i&&this._needApplySymbol(t)&&!this._muted&&this._setGroupSymbol(t),(i||e===this._boundChartWidget)&&this.watchedSymbol.setValue(t)}_watchedIntervalListener(e){const t=o.Interval.normalize(e)
;t&&this._needApplyInterval(t)&&!this._muted&&this._setGroupInterval(t)}_updateIntervalByProperty(e,t){const i=this._intervalLock(),s=o.Interval.normalize(t);i&&s&&this._needApplyInterval(s)&&!this._muted&&this._setGroupInterval(s),(i||e===this._boundChartWidget)&&this.watchedInterval.setValue(null!=s?s:t)}_sendSnowplowAnalytics(){if(!window.user.do_not_track)throw new Error("unsupported")}_updateSeriesSymbolInfo(){this.seriesShortSymbol.setValue((0,r.ensureNotNull)(this._boundChartWidget).getSymbol(!0));const e=this._mainSeries().symbolInfo();if(e){const t=e.pro_name||!1;this.proSymbol.setValue(t||this.watchedSymbol.value()),this.ensuredProSymbol.setValue(this.proSymbol.value()),e.aliases&&this.symbolNamesList.setValue(e.aliases);{const t=e.supported_resolutions;t?this.watchedSupportedResolutions.setValue(t):this.watchedSupportedResolutions.setValue(void 0)}let i=(0,c.allChartStyles)();(0,a.isCloseBasedSymbol)(e)&&(i=i.filter((e=>(0,a.isSingleValueBasedStyle)(e)))),this.watchedSupportedChartStyles.setValue(i),this.watchedIntraday.setValue(!!e.has_intraday),this.watchedSeconds.setValue(!!e.has_seconds),this.watchedTicks.setValue(!(0,a.isCloseBasedSymbol)(e)&&!!e["is-tickbars-available"]),this.watchedRange.setValue(!(0,a.isCloseBasedSymbol)(e));const s=e.data_frequency?e.data_frequency:void 0;this.watchedDataFrequencyResolution.setValue(s)}else this.watchedIntraday.setValue(!1),this.watchedSeconds.setValue(!1),this.watchedTicks.setValue(!1),this.watchedRange.setValue(!1),this._mainSeries().isFailed()&&this.ensuredProSymbol.setValue(this.proSymbol.value())}_onChartModelCreated(e){if(!this._boundChartWidget)throw new Error("ChartWidget is undefined");this._chartWidgetBindingState=2,this.watchedSymbol.setValue(this._boundChartWidget.symbolWV().value()),this.watchedSymbol.subscribe(this._watchedSymbolListenerBound);const t=e.mainSeries().dataEvents();t.symbolResolved().subscribe(this,this._updateSeriesSymbolInfo),t.symbolError().subscribe(this,this._updateSeriesSymbolInfo),this._updateSeriesSymbolInfo(),this.watchedInterval.setValue(this._boundChartWidget.resolutionWV().value()),this.watchedInterval.subscribe(this._watchedIntervalListenerBound),this._boundChartWidget.readOnly()&&(this.watchedSymbol.writeLock=!0)}_chartToBind(){const e=this._chartWidgetCollection;return null===e?null:e.activeChartWidget.value()}_symbolLock(){var e;return!!(null===(e=this._chartWidgetCollection)||void 0===e?void 0:e.lock.symbol.value())}_intervalLock(){var e;return!!(null===(e=this._chartWidgetCollection)||void 0===e?void 0:e.lock.interval.value())}_chartsForLock(e){return(0===e?this._symbolLock():this._intervalLock())?(0,r.ensureNotNull)(this._linkingGroupCharts).value():this._boundChartWidget?[this._boundChartWidget]:[]}_setGroupSymbol(e){this.mute(!0),this._symbolLock()?(0,r.ensureNotNull)(this._chartWidgetCollection).setSymbol(e,this._groupIndex):(0,r.ensureNotNull)(this._boundChartWidget).setSymbol(e),this.mute(!1)}_needApplySymbol(e){
const t=this._chartsForLock(0),i=t.find((t=>t.hasModel()&&t.model().mainSeries().symbolInfo()&&t.model().mainSeries().symbolSameAsResolved(e)));if(i){const e=i.model().mainSeries();if(t.every((t=>e.symbolSameAsResolved(t.symbolWV().value()))))return!1}return t.some((t=>t.symbolWV().value()!==e))}_setGroupInterval(e){this.mute(!0),(0,r.ensureNotNull)(this._chartWidgetCollection).setResolution(e,this._groupIndex).finally((()=>{if(this._boundChartWidget){const t=this._boundChartWidget.resolutionWV().value();o.Interval.isEqual(t,e)||this.watchedInterval.setValue(t)}})),this.mute(!1)}_needApplyInterval(e){return this._chartsForLock(1).some((t=>!o.Interval.isEqual(t.resolutionWV().value(),e)))}}const m=new class{constructor(){this._watchedSymbol=new n.WatchedValue,this._seriesShortSymbol=new n.WatchedValue,this._proSymbol=new n.WatchedValue,this._ensuredProSymbol=new n.WatchedValue,this._watchedInterval=new n.WatchedValue,this._watchedIntraday=new n.WatchedValue,this._watchedSeconds=new n.WatchedValue,this._watchedTicks=new n.WatchedValue,this._watchedDataFrequencyResolution=new n.WatchedValue,this._watchedRange=new n.WatchedValue,this._watchedSupportedResolutions=new n.WatchedValue,this._watchedSupportedChartStyles=new n.WatchedValue([]),this._symbolNamesList=new n.WatchedValue,this._chartWidgetCollection=null,this._onSymbolLinkBound=this._onSymbolLink.bind(this),this._searchCharts=null,this._searchChartsLoadDebounced=null,this._selfEmit=!1,this._preventFeedBySymbol=!1,this._feedBySymbolDebounceCounter=0,this._linkingGroups=new Map,this._activeLinkingGroup=new n.WatchedValue,this._activeLinkingGroupIndex=null,this._updateLinkingGroups=()=>{(0,r.ensureNotNull)(this._chartWidgetCollection).allLinkingGroups().value().forEach((e=>this._linkingGroup(e))),this._linkingGroups.forEach((e=>e.updateBoundChartWidget()))},this._activeLinkingGroup.setValue(this._linkingGroup(null));const e=(e,t)=>{e.subscribe((e=>t().setValue(e)),{callWithLast:!0})};e(this._watchedSymbol,(()=>this._activeLinkingGroup.value().watchedSymbol)),e(this._seriesShortSymbol,(()=>this._activeLinkingGroup.value().seriesShortSymbol)),e(this._proSymbol,(()=>this._activeLinkingGroup.value().proSymbol)),e(this._ensuredProSymbol,(()=>this._activeLinkingGroup.value().ensuredProSymbol)),e(this._watchedInterval,(()=>this._activeLinkingGroup.value().watchedInterval)),e(this._watchedIntraday,(()=>this._activeLinkingGroup.value().watchedIntraday)),e(this._watchedSeconds,(()=>this._activeLinkingGroup.value().watchedSeconds)),e(this._watchedTicks,(()=>this._activeLinkingGroup.value().watchedTicks)),e(this._watchedDataFrequencyResolution,(()=>this._activeLinkingGroup.value().watchedDataFrequencyResolution)),e(this._watchedRange,(()=>this._activeLinkingGroup.value().watchedRange)),e(this._watchedSupportedResolutions,(()=>this._activeLinkingGroup.value().watchedSupportedResolutions)),e(this._watchedSupportedChartStyles,(()=>this._activeLinkingGroup.value().watchedSupportedChartStyles)),e(this._symbolNamesList,(()=>this._activeLinkingGroup.value().symbolNamesList));const t=e=>{
this._watchedSymbol.setValue(e.watchedSymbol.value()),this._seriesShortSymbol.setValue(e.seriesShortSymbol.value()),this._proSymbol.setValue(e.proSymbol.value()),this._ensuredProSymbol.setValue(e.ensuredProSymbol.value()),this._watchedInterval.setValue(e.watchedInterval.value()),this._watchedIntraday.setValue(e.watchedIntraday.value()),this._watchedSeconds.setValue(e.watchedSeconds.value()),this._watchedTicks.setValue(e.watchedTicks.value()),this._watchedDataFrequencyResolution.setValue(e.watchedDataFrequencyResolution.value()),this._watchedRange.setValue(e.watchedRange.value()),this._watchedSupportedResolutions.setValue(e.watchedSupportedResolutions.value()),this._watchedSupportedChartStyles.setValue(e.watchedSupportedChartStyles.value()),this._symbolNamesList.setValue(e.symbolNamesList.value())};this._activeLinkingGroup.subscribe(t),t(this._activeLinkingGroup.value()),(0,h.setMuteLinkingGroup)(((e,t)=>{this._linkingGroup(e).mute(t)}))}get symbol(){return this._watchedSymbol}get proSymbol(){return this._proSymbol.readonly()}get ensuredProSymbol(){return this._ensuredProSymbol.readonly()}get symbolNamesList(){return this._symbolNamesList.readonly()}get seriesShortSymbol(){return this._seriesShortSymbol.readonly()}get interval(){return this._watchedInterval}get intraday(){return this._watchedIntraday.readonly()}get seconds(){return this._watchedSeconds.readonly()}get ticks(){return this._watchedTicks.readonly()}get range(){return this._watchedRange.readonly()}get supportedResolutions(){return this._watchedSupportedResolutions.readonly()}get supportedChartStyles(){return this._watchedSupportedChartStyles.readonly()}get preventFeedBySymbol(){return this._preventFeedBySymbol}get dataFrequencyResolution(){return this._watchedDataFrequencyResolution.readonly()}activeLinkingGroup(){return this._activeLinkingGroup.readonly()}getChartWidget(){return this.activeLinkingGroup().value().boundChartWidget()}bindToChartWidgetCollection(e){var t;null===(t=this._chartWidgetCollection)||void 0===t||t.onAboutToBeDestroyed.unsubscribeAll(this),this._unbindFromChartWidgetCollection(),this._chartWidgetCollection=e,this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(this,this._unbindFromChartWidgetCollection),this._chartWidgetCollection.allLinkingGroups().subscribe(this._updateLinkingGroups),this._updateLinkingGroups(),this._activeLinkingGroupIndex=e.activeLinkingGroup().spawn(),this._activeLinkingGroupIndex.subscribe((e=>{this._activeLinkingGroup.setValue(this._linkingGroup(e))}),{callWithLast:!0}),this._linkingGroups.forEach((t=>t.bindToChartWidgetCollection(e)))}bindToSearchCharts(e){this.unbindFromSearchCharts(),this._searchCharts=e,e.onSearchBySymbol.subscribe(this,this._onSearchBySymbol),e.loadingSymbol.subscribe((e=>{!1===e&&(this._feedBySymbolDebounceCounter=0)})),this._watchedSymbol.subscribe(this._onSymbolLinkBound)}unbindFromSearchCharts(){this._searchCharts&&(this._searchCharts.onSearchBySymbol.unsubscribe(this,this._onSearchBySymbol),this._watchedSymbol.unsubscribe(this._onSymbolLinkBound),this._searchCharts=null)}
setPreventFeedBySymbol(e){this._preventFeedBySymbol=e}setSymbolAndLogInitiator(e,t,i){(this.symbol.value()!==e||i)&&(d.logInfo(`Change linking symbol to ${e}, initiator: ${t}`),this.symbol.setValue(e,i))}_onSearchBySymbol(e){if(!e.resolved_symbol)throw new Error("no resolved_symbol");this._selfEmit=!0,this._watchedSymbol.setValue(e.resolved_symbol),this._selfEmit=!1}_onSymbolLink(e){if(!this._selfEmit){if(!this._searchCharts){const e="No search charts defined";throw d.logError(e),new Error(e)}this._preventFeedBySymbol||this._loadSearchCharts(e)}}_loadSearchCharts(e){if(!this._searchCharts){const e="No search charts defined";throw d.logError(e),new Error(e)}if(this._searchChartsLoadDebounced)return void(this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced(e)));const t=e=>this._searchCharts?(!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchChartsLoadDebounced=null,this._searchCharts.feedBySymbol.call(this._searchCharts,e)):()=>{};!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchCharts.feedBySymbol(e)}_linkingGroup(e){e=null;let t=this._linkingGroups.get(e);if(void 0===t){const i={watchedSymbol:this._watchedSymbol,seriesShortSymbol:this._seriesShortSymbol,proSymbol:this._proSymbol,ensuredProSymbol:this._ensuredProSymbol,watchedInterval:this._watchedInterval,watchedIntraday:this._watchedIntraday,watchedSeconds:this._watchedSeconds,watchedTicks:this._watchedTicks,watchedDataFrequencyResolution:this._watchedDataFrequencyResolution,watchedRange:this._watchedRange,watchedSupportedResolutions:this._watchedSupportedResolutions,watchedSupportedChartStyles:this._watchedSupportedChartStyles,symbolNamesList:this._symbolNamesList};t=new _(e,i,(()=>this._activeLinkingGroup.value())),this._linkingGroups.set(e,t),this._chartWidgetCollection&&t.bindToChartWidgetCollection(this._chartWidgetCollection)}return t}_unbindFromChartWidgetCollection(){var e;null!==this._chartWidgetCollection&&(null===(e=this._activeLinkingGroupIndex)||void 0===e||e.destroy(),this._activeLinkingGroupIndex=null,this._linkingGroups.forEach((e=>e.unbindFromChartWidgetCollection())),this._chartWidgetCollection.allLinkingGroups().unsubscribe(this._updateLinkingGroups),this._chartWidgetCollection=null)}};window.TradingViewApi||(window.TradingViewApi={linking:m})},11417:(e,t,i)=>{"use strict";const{getLogger:s}=i(31955),r=s("TVLocalStorage");var n=function(){try{this.isAvailable=!0,this.localStorage=window.localStorage,this.localStorage.setItem("tvlocalstorage.available","true")}catch(e){delete this.isAvailable,delete this.localStorage}this._updateLength();try{this._report()}catch(e){}};n.prototype._report=function(){if(this.isAvailable){const e=10,t=[]
;for(let e=0;et.length-e.length));const i=t.slice(0,e);t.sort(((e,t)=>t.key.length-e.key.length));const s=t.slice(0,e);r.logNormal(`Total amount of keys in Local Storage: ${this.length}`),r.logNormal(`Top ${e} keys with longest values: ${JSON.stringify(i)}`),r.logNormal(`Top ${e} longest key names: ${JSON.stringify(s)}`);try{navigator.storage.estimate().then((e=>{r.logNormal(`Storage estimate: ${JSON.stringify(e)}`)}))}catch(e){}}},n.prototype.length=0,n.prototype.isAvailable=!1,n.prototype.localStorage={"tvlocalstorage.available":"false"},n.prototype._updateLength=function(){if(this.isAvailable)this.length=this.localStorage.length;else{var e,t=0;for(e in this.localStorage)this.localStorage.hasOwnProperty(e)&&t++;this.length=t}},n.prototype.key=function(e){return this.isAvailable?this.localStorage.key(e):Object.keys(this.localStorage)[e]},n.prototype.getItem=function(e){return this.isAvailable?this.localStorage.getItem(e):void 0===this.localStorage[e]?null:this.localStorage[e]},n.prototype.setItem=function(e,t){this.isAvailable?this.localStorage.setItem(e,t):this.localStorage[e]=t,this._updateLength()},n.prototype.removeItem=function(e){this.isAvailable?this.localStorage.removeItem(e):delete this.localStorage[e],this._updateLength()},n.prototype.clear=function(){this.isAvailable?this.localStorage.clear():this.localStorage={},this._updateLength()};var o=function(e){this.storage=e};o.prototype.getItem=function(e){return Promise.resolve(this.storage.getItem(e))},o.prototype.setItem=function(e,t){return Promise.resolve(this.storage.setItem(e,t))},window.TVLocalStorage=new n,window.TVLocalStorageAsync=new o(window.TVLocalStorage),e.exports={TVLocalStorage:window.TVLocalStorage,TVLocalStorageAsync:window.TVLocalStorageAsync}},84015:(e,t,i)=>{"use strict";function s(e,t=!1){return!1}function r(e,t=!1){return e}i.d(t,{isOnMobileAppPage:()=>s,urlWithMobileAppParams:()=>r})},69109:(e,t,i)=>{"use strict";let s;function r(e,t){null==s||s(e,t)}function n(e){s=e}i.d(t,{muteLinkingGroup:()=>r,setMuteLinkingGroup:()=>n})},19334:(e,t,i)=>{"use strict";i.d(t,{addPerfMark:()=>c,perfMeasureOperation:()=>h});var s=i(92184);function r(){}const n=console.timeStamp?console.timeStamp.bind(console):r,o=window.performance&&performance.mark?performance.mark.bind(performance):r,a=window.performance&&performance.measure?performance.measure.bind(performance):r,l=window.performance&&performance.clearMarks?performance.clearMarks.bind(performance):r;function c(e){n(e),o(e)}async function h(e,t){const i=`measure-${e}-${(0,s.randomHash)()}`;o(i);try{return await t()}finally{a(e,i),l(i)}}},16216:(e,t,i)=>{"use strict";i.d(t,{hasService:()=>o,registerService:()=>n,service:()=>a});const s={},r=new Map;function n(e,t){if(o(e))throw new Error("Service already registered");s[e.id]=t;const i=r.get(e.id);void 0!==i&&(r.delete(e.id),i.resolve(t))}function o(e){return void 0!==s[e.id]}function a(e){const t=s[e.id]
;if(void 0===t)throw new Error("ServiceLocator: Service "+e.id+" not found");return t}},56840:(e,t,i)=>{"use strict";e=i.nmd(e),i(49483);i(67580).fetch;var s=i(66800).regExpEscape,r=i(21097).TVXWindowEvents,n=i(11417).TVLocalStorage,o=i(52033).Delegate,a=i(56570),l=["s.tradingview.com","betacdn.tradingview.com"],c=a.enabled("use_localstorage_for_settings"),h=window.TVSettings=function(){var e=!1,t=null;function i(){return!t&&c}try{e=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(e){}if(e){var d={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},u=function(e,t,i){var s=d[e];return null==s?t:s},p=function(){};return{loaded:!1,loadedModel:!1,getValue:u,getJSON:u,getBool:u,getFloat:u,getInt:u,setValue:p,setJSON:p,remove:p,keys:function(){return Object.keys(d)},keysMask:function(){return[]},sync:p,onSync:{subscribe:function(){}}}}window.environment;var _,m=TradingView.onWidget()?"tradingview-widget":"tradingview",g=m+".",f={},v=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^chart\.favoriteLibraryIndicators$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/,/^trading\.orderWidgetMode\./,/^symbolWatermark$/,/^pinereference\.size$/,/^pinereference\.position$/,/^hint\.+/,/^ChartDrawingToolbarWidget\.visible/];function y(e){return g+e}function S(e){return e.substring(g.length)}function b(e,t){var i=f[e];return null==i?t:i}function w(e,t,i){i=i||{};var s=""+t;return f[e]!==s&&(f[e]=s,P(e)),i.forceFlush&&!_&&(_=setTimeout((function(){_=void 0,x()}),10)),h}function C(e,t){return t=t||{},null!=f[e]&&(delete f[e],P(e)),t.forceFlush&&x(),h}function P(e){if(t)null==f[e]?t.removeValue(e):t.setValue(e,f[e]);else if(i())try{null==f[e]?n.removeItem(y(e)):n.setItem(y(e),f[e])}catch(e){}else 0;r.emit("settings",JSON.stringify({key:e,value:f[e]}))}function x(e){}function T(){return Object.keys(f)}function I(e){for(var t=0;t=0;n--)e.test(i[n])&&r.push(i[n]),e.lastIndex=0;return r},sync:function(e){null!==e?(t?A(t.initialSettings||{}):i()?(function(){if(TradingView.onWidget()&&l.includes(window.location.host))for(var e="tradingview.",t=n.length;t--;){var i=n.key(t);if(0===i.indexOf(e)){var s=i.replace(e,m+".");n.setItem(s,n.getItem(i)),n.removeItem(i)}}}(),function(){f={};for(var e=!a.enabled("save_chart_properties_to_local_storage"),t=n.length;t--;){var i=n.key(t);if(i&&M(i)){var s=i.substring(g.length);e&&!I(s)||(f[s]=n.getItem(i))}}}()):A(e||{}),L.fire()):!0},onSync:L,setSettingsAdapter:function(e){t=e}}}();e&&e.exports&&(e.exports=h)},88145:(e,t,i)=>{"use strict";function s(e){return void 0!==e&&e.includes("crypto")}function r(e){var t;return Boolean(null===(t=e.typespecs)||void 0===t?void 0:t.includes("yield"))}function n(e){var t;return null!==(t=null==e?void 0:e.includes("discontinued"))&&void 0!==t&&t}i.d(t,{hasCryptoTypespec:()=>s,isSymbolDelisted:()=>n,isYield:()=>r})},26843:(e,t,i)=>{"use strict";i.d(t,{StdTheme:()=>a.StdTheme,getStdChartTheme:()=>m,getStdThemeNames:()=>_,isStdTheme:()=>f,overrideStdTheme:()=>d,restoreStdThemes:()=>u,translateThemeName:()=>g});var s=i(24377),r=i(11542)
;const n=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#131722","lineColor":"rgba(42, 46, 57, 0)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"horzGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#ffffff","backgroundGradientStartColor":"#ffffff","backgroundGradientEndColor":"#ffffff","separatorColor":"#E0E3EB"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7"}}}},"mainSourceProperties":{"baseLineColor":"#B2B5BE","prevClosePriceLineColor":"#555555","priceLineColor":"","highLowAvgPrice":{"highLowPriceLinesColor":"","averagePriceLineColor":""},"bidAsk":{"bidLineColor":"#2962FF","askLineColor":"#F7525F"},"prePostMarket":{"preMarketColor":"#FB8C00","postMarketColor":"#2962FF"},"candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"volCandlesStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"haStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"hollowCandleStyle":{"upColor":"#089981","downColor":"#F23645","borderColor":"#378658","borderUpColor":"#089981","borderDownColor":"#F23645","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645"},"barStyle":{"downColor":"#F23645","upColor":"#089981"},"pnfStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"baselineStyle":{"baselineColor":"#758696","topFillColor1":"rgba(8, 153, 129, 0.28)","topFillColor2":"rgba(8, 153, 129, 0.05)","bottomFillColor1":"rgba(242, 54, 69, 0.05)","bottomFillColor2":"rgba(242, 54, 69, 0.28)","topLineColor":"#089981","bottomLineColor":"#F23645"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF"},"hiloStyle":{"color":"#2962FF","borderColor":"#2962FF","labelColor":"#2962FF"},"columnStyle":{"upColor":"rgba(8, 153, 129, 0.5)","downColor":"rgba(242, 54, 69, 0.5)"},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF"},"lineWithMarkersStyle":{"color":"#2962FF"},"steplineStyle":{"color":"#2962FF"},"kagiStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"pbStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae"},"rangeStyle":{"upColor":"#089981","downColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"tpoStyle":{"color":"#2962ff","tpo":{"colors":{"gradientColors":["#e91e63","#00c853","#00bcd4","#651FFF"]}},"volumeProfile":{"valuesColor":"#089981","vah":{"color":"#3179F5"},"val":{"color":"#3179F5"},"poc":{"color":"#F23645"},"volumeColor":"rgba(41, 98, 255, 0.3)","valueAreaColor":"rgba(41, 98, 255, 0.7)"}}}}}'),o=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#B2B5BE","lineColor":"rgba(240, 243, 250, 0)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"horzGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#131722","backgroundGradientStartColor":"#181C27","backgroundGradientEndColor":"#131722","backgroundType":"gradient","separatorColor":"#2A2E39"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7"}}}},"mainSourceProperties":{"baseLineColor":"#5d606b","prevClosePriceLineColor":"#555555","priceLineColor":"","highLowAvgPrice":{"highLowPriceLinesColor":"","averagePriceLineColor":""},"bidAsk":{"bidLineColor":"#2962FF","askLineColor":"#F7525F"},"prePostMarket":{"preMarketColor":"#FB8C00","postMarketColor":"#2962FF"},"candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"volCandlesStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"haStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"hollowCandleStyle":{"upColor":"#089981","downColor":"#F23645","borderColor":"#378658","borderUpColor":"#089981","borderDownColor":"#F23645","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645"},"barStyle":{"downColor":"#F23645","upColor":"#089981"},"pnfStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#336854","downColorProjection":"#7f323f"},"baselineStyle":{"baselineColor":"#758696","topFillColor1":"rgba(8, 153, 129, 0.28)","topFillColor2":"rgba(8, 153, 129, 0.05)","bottomFillColor1":"rgba(242, 54, 69, 0.05)","bottomFillColor2":"rgba(242, 54, 69, 0.28)","topLineColor":"#089981","bottomLineColor":"#F23645"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF"},"hiloStyle":{"color":"#2962FF","borderColor":"#2962FF","labelColor":"#2962FF"},"columnStyle":{"upColor":"rgba(8, 153, 129, 0.5)","downColor":"rgba(242, 54, 69, 0.5)"},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF"},"lineWithMarkersStyle":{"color":"#2962FF"},"steplineStyle":{"color":"#2962FF"},"kagiStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#336854","downColorProjection":"#7f323f"},"pbStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f"},"rangeStyle":{"upColor":"#089981","downColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f"},"tpoStyle":{"color":"#2962ff","tpo":{"colors":{"gradientColors":["#e91e63","#00c853","#00bcd4","#651FFF"]}},"volumeProfile":{"valuesColor":"#089981","vah":{"color":"#3179F5"},"val":{"color":"#3179F5"},"poc":{"color":"#F23645"},"volumeColor":"rgba(41, 98, 255, 0.3)","valueAreaColor":"rgba(41, 98, 255, 0.7)"}}}}}')
;var a=i(24633);let l=n,c=o;function h(e,t){const i={...e};for(const s in t)"object"!=typeof e[s]||null===e[s]||Array.isArray(e[s])?void 0!==t[s]&&(i[s]=t[s]):i[s]=h(e[s],t[s]);return i}function d(e,t){switch(e){case a.StdTheme.Light:l=h(l,t);break;case a.StdTheme.Dark:c=h(c,t)}}function u(){l=JSON.parse(JSON.stringify(n)),c=JSON.parse(JSON.stringify(o))}function p(){return{[a.StdTheme.Light]:JSON.parse(JSON.stringify(l)),[a.StdTheme.Dark]:JSON.parse(JSON.stringify(c))}}function _(){return[a.StdTheme.Light,a.StdTheme.Dark]}function m(e){return p()[e]}function g(e){return{[a.StdTheme.Light]:r.t(null,{context:"colorThemeName"},i(96870)),[a.StdTheme.Dark]:r.t(null,{context:"colorThemeName"},i(85119))}[e]||e}function f(e){const t=p();return _().some((i=>v(t[i],e)))}function v(e,t){let i=e.content===t.content;return function(e,t){try{y(null!=e?e:{},[],t)}catch(e){return}}(e.content,((e,r)=>{const n=function(e,t){let i=null!=t?t:{};for(let t=0;t{"use strict";var s;i.d(t,{StdTheme:()=>s}),function(e){e.Light="light",e.Dark="dark"}(s||(s={}))},85662:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEFAULT_THEME:()=>h,extractThemeFromModel:()=>V,getCurrentTheme:()=>g,getStdTheme:()=>T,getStdThemeNames:()=>P,getStdThemedValue:()=>I,getTheme:()=>w,getThemeNames:()=>C,getThemedColor:()=>f,isPublicTheme:()=>m,isStdTheme:()=>E,isStdThemeName:()=>x,isStdThemedDefaultValue:()=>M,isThemeExist:()=>k,loadTheme:()=>v,removeTheme:()=>L,restoreTheme:()=>y,saveTheme:()=>A,savedThemeName:()=>S,syncTheme:()=>b,themes:()=>_,translateStdThemeName:()=>D});var s=i(24377),r=i(35039),n=i(56840);function o(){return(0,n.getValue)("current_theme.name")||null}const a=i(64289);var l=i(26843),c=i(45345);const h="light";var d=i(11542),u=i(20913),p=i(19625);const _={[l.StdTheme.Light]:{name:l.StdTheme.Light,label:()=>d.t(null,{context:"colorThemeName"},i(96870)),order:2,getThemedColor:e=>(0,p.getHexColorByName)(e)},[l.StdTheme.Dark]:{name:l.StdTheme.Dark,label:()=>d.t(null,{context:"colorThemeName"},i(85119)),order:1,getThemedColor:e=>{const t=u[e]||e;return(0,p.getHexColorByName)(t)}}};function m(e){return!e.isPrivate}function g(){return _[c.watchedTheme.value()]||_[h]}function f(e){return g().getThemedColor(e)}async function v(e,t){const{themeName:i,standardTheme:s,syncState:n=!0,noUndo:o=!1,applyOverrides:a=!1,onlyActiveChart:l=!1}=t,c=await(s?Promise.resolve(T(i)):w(i)),h=!s;if(void 0!==c.content){const t=!s||l;a&&(void 0!==(d=c.content).chartProperties&&(0,
r.applyDefaultsOverrides)(d.chartProperties),void 0!==d.mainSourceProperties&&(0,r.applyDefaultsOverrides)(d.mainSourceProperties,void 0,!0,"mainSeriesProperties")),await e.applyTheme({theme:c.content,onlyActiveChart:t,restoreNonThemeDefaults:h,themeName:i,standardTheme:s,syncState:n,noUndo:o})}var d;return c}function y(){(0,c.setTheme)(o()||h)}function S(){return o()}function b(){var e;e=g().name,(0,n.setValue)("current_theme.name",e,{forceFlush:!0})}function w(e){return a.loadTheme(e)}function C(){return a.loadThemes()}function P(){return l.getStdThemeNames()}function x(e){return P().includes(e)}function T(e){return l.getStdChartTheme(e)||{content:void 0}}function I(e,t){const i=t||g().name,s=l.getStdChartTheme(i),r=0!==e.length&&e.split(".");return s&&s.content&&r?r.reduce(((e,t)=>e[t]),s.content):null}function M(e,t,i){const r=I(e,i);return null!==r&&(0,s.areEqualRgba)((0,s.parseRgba)(r),(0,s.parseRgba)(String(t)))}function A(e,t){return a.saveTheme(e,t)}function L(e){return a.removeTheme(e)}function k(e){return a.isThemeExist(e)}function D(e){return l.translateThemeName(e)}function E(e){return l.isStdTheme(e)}function V(e){var t,i;return{content:{chartProperties:{paneProperties:e.model().properties().childs().paneProperties.state(),scalesProperties:e.model().properties().childs().scalesProperties.state()},sessions:null!==(i=null===(t=e.model().sessions().state())||void 0===t?void 0:t.properties)&&void 0!==i?i:(0,r.factoryDefaults)("sessions"),mainSourceProperties:e.model().mainSeries().properties().state(),version:e.model().version()}}}},45345:(e,t,i)=>{"use strict";i.d(t,{setTheme:()=>o,watchedTheme:()=>n});var s,r=i(64147);!function(e){e.ThemeClassPrefix="theme-"}(s||(s={}));const n=new r.WatchedValue;function o(e){n.setValue(e)}n.subscribe((e=>{!function(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)}(e,window)}))},51768:(e,t,i)=>{"use strict";i.d(t,{disableTrackingEvents:()=>c,trackEvent:()=>l});var s=i(76422),r=i(56570);const n=(0,i(31955).getLogger)("Common.TrackEvent"),o=[/Study_(Drawing)_(.*)/,/(Study)_(.*)@tv-basicstudies/,/(Study)_(.*)/,/(Chart Style) (.*)/];let a=!1;const l=(e,t,i)=>{if(a)return;if(r.enabled("charting_library_base"))return void((e,t,i)=>{t=t||e||i||"";let r="";for(let e=0;e{"use strict";i.d(t,{TVXWindowEvents:()=>o});i(21251);var s=i(31955),r=i(11417);const n=(0,s.getLogger)("XWindowEvents");var o;!function(e){const t="tvxwevents.",i={};let s;window.BroadcastChannel?(s=new BroadcastChannel("tvxwevents"),s.addEventListener("message",(function(e){const{data:{event:t,value:s}}=e;i[t]&&i[t].forEach((e=>{e(s)}))})),function(){const e=[],i=performance.now();for(let i=0;i{t(e.newValue)}));r.TVLocalStorage.removeItem(n)})),e.on=function(e,t){i[e]||(i[e]=[]),i[e].push(t)},e.off=function(e,t){if(!i[e])return;const s=i[e].indexOf(t);-1!==s&&(1===i[e].length?delete i[e]:i[e].splice(s,1))},e.emit=function(e,i=Date.now()){try{s?s.postMessage({event:e,value:i}):r.TVLocalStorage.setItem(t+e,i.toString())}catch(e){n.logError(e.message)}}}(o||(o={}))},58473:(e,t,i)=>{"use strict";i.d(t,{activateKeyPressHandler:()=>m,showDialog:()=>g});const s=[];let r=null;function n(e){for(let t=0;t=0&&!0!==s[t].func(e);t--);}window.addEventListener("keypress",o,!1);var a=i(79652),l=i(56570),c=i(86235),h=i(86001),d=i(50340),u=i(51768);let p=null;function _(e){if(!(0,a.globalKeypressMatches)(e))return!1;e.preventDefault();const t=String.fromCharCode(e.charCode);return l.enabled("show_interval_dialog_on_key_press")&&function(e){return/[1-9]/.test(e)}(t)?(0,c.showChangeIntervalDialogAsync)({initVal:t}):l.enabled("symbol_search_hot_key")&&(g({defaultValue:t,selectSearchOnInit:!1,source:"keyboard",trackResultsOptions:{trackResults:!1,emptySearchType:"empty_result__supercharts"}}),(0,u.trackEvent)("GUI","SS","hotkey")),!0}function m(){(0,h.loadChangeIntervalDialog)(),function(e,t){const i={name:e,func:t},r=n(i.name)
;r>-1&&s.splice(r,1),s.unshift(i)}("symbolEdit",_)}function g(e){const t=p=(0,d.loadNewSymbolSearch)().then((i=>{t===p&&i.showDefaultSearchDialog(e)}));return t}},78136:(e,t,i)=>{"use strict";let s;function r(){return s}function n(e){s=e}i.d(t,{getSearchRequestDelay:()=>r,setSearchRequestDelay:()=>n})},52092:(e,t,i)=>{"use strict";i.d(t,{CLOSE_POPUPS_AND_DIALOGS_COMMAND:()=>s});const s="CLOSE_POPUPS_AND_DIALOGS_COMMAND";var r;!function(e){e[e.Mobile=0]="Mobile",e[e.TabletSmall=480]="TabletSmall",e[e.Tablet=768]="Tablet",e[e.TabletLarge=1024]="TabletLarge",e[e.DesktopSmall=1280]="DesktopSmall",e[e.Desktop=1440]="Desktop",e[e.DesktopLarge=1920]="DesktopLarge"}(r||(r={}))},42120:(e,t,i)=>{"use strict";i.d(t,{CompareDialogRenderer:()=>n});var s=i(29280);var r=i(76422);class n extends s.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){this._load().then((t=>{var i,s;null===(i=this._dialog)||void 0===i||i.hide(),null===(s=this._dialog)||void 0===s||s.visible().unsubscribe(this._subscribe),this._dialog=t,t.visible().subscribe(this._subscribe),t.show(e),r.emit("compare_add")}))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}_load(){return Promise.all([Promise.all([i.e(4040),i.e(7271)]).then(i.bind(i,56217)),Promise.all([i.e(6703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(5546),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(2208),i.e(3538),i.e(2227),i.e(3443),i.e(6014),i.e(361),i.e(2079),i.e(3098),i.e(2751),i.e(731)]).then(i.bind(i,14283))]).then((([e,t])=>{const i=new e.CompareModel(this._chartWidgetCollection);return t.getCompareDialogRenderer(i)}))}}},3615:(e,t,i)=>{"use strict";async function s(e,t){const s=await Promise.all([i.e(877),i.e(3060),i.e(7528),i.e(6246),i.e(2248),i.e(6625),i.e(55),i.e(4392),i.e(8073),i.e(8722),i.e(7092),i.e(2227),i.e(6014),i.e(4804),i.e(8890)]).then(i.bind(i,70493));return s.showSimpleDialog(e,s.renameModule,t)}async function r(e,t){const s=await Promise.all([i.e(877),i.e(3060),i.e(7528),i.e(6246),i.e(2248),i.e(6625),i.e(55),i.e(4392),i.e(8073),i.e(8722),i.e(7092),i.e(2227),i.e(6014),i.e(4804),i.e(8890)]).then(i.bind(i,70493));return s.showSimpleDialog(e,s.confirmModule,t)}async function n(e,t){const s=await Promise.all([i.e(877),i.e(3060),i.e(7528),i.e(6246),i.e(2248),i.e(6625),i.e(55),i.e(4392),i.e(8073),i.e(8722),i.e(7092),i.e(2227),i.e(6014),i.e(4804),i.e(8890)]).then(i.bind(i,70493));return s.showSimpleDialog(e,s.warningModule,t)}i.d(t,{showConfirm:()=>r,showRename:()=>s,showWarning:()=>n})},14881:(e,t,i)=>{"use strict";i.d(t,{hideStateChange:()=>n});var s,r=i(52033);!function(e){e.Drawings="drawings",e.Indicators="indicators",e.Positions="positions",e.All="all"}(s||(s={}));const n=new r.Delegate},90995:(e,t,i)=>{"use strict";i.d(t,{getHideModeStateValue:()=>u,getHideOptions:()=>h,getSavedHideMode:()=>p,toggleHideMode:()=>d});var s=i(50151),r=i(11542),n=i(56840),o=i(79320),a=i(928),l=i(14881)
;let c=null;function h(){if(null!==c)return c;const e=(0,o.tradingService)();return c=new Map([["drawings",{label:r.t(null,void 0,i(3217)),dataName:"hide-drawing-tools",tooltip:{active:r.t(null,void 0,i(85891)),inactive:r.t(null,void 0,i(52563))},getBoxedValue:()=>(0,a.hideAllDrawings)(),trackLabel:"hide drawings"}],["indicators",{label:r.t(null,void 0,i(72351)),dataName:"hide-indicators",tooltip:{active:r.t(null,void 0,i(98753)),inactive:r.t(null,void 0,i(78525))},getBoxedValue:()=>(0,a.hideAllIndicators)(),trackLabel:"hide indicators"}],["positions",{label:r.t(null,void 0,i(92226)),dataName:"hide-positions-and-orders",tooltip:{active:r.t(null,void 0,i(20506)),inactive:r.t(null,void 0,i(42164))},getBoxedValue:()=>(0,s.ensureNotNull)(e).showTradedSources,inverted:!0,trackLabel:"hide positions"}],["all",{label:r.t(null,void 0,i(47074)),dataName:"hide-all",tooltip:{active:e?r.t(null,void 0,i(86738)):r.t(null,void 0,i(25881)),inactive:e?r.t(null,void 0,i(18216)):r.t(null,void 0,i(90763))},trackLabel:"hide all"}]]),e||c.delete("positions"),c}function d(e){e?n.setValue("ChartToolsHideMode",e):e=p();const t=_();let i=!t;return"all"===e?(m(((e,t,s)=>{e.setValue(s?!i:i)})),l.hideStateChange.fire({hideMode:e,isActive:i}),i):(m(((s,r,n)=>{if(r===e){const e=t?!n:!s.value();s.setValue(e),i=n?!e:e}else s.setValue(Boolean(n))})),l.hideStateChange.fire({hideMode:e,isActive:i}),i)}function u(e){if("all"===e)return _();const t=(0,s.ensureDefined)(h().get(e)),i=(0,s.ensureDefined)(t.getBoxedValue)().value();return t.inverted?!i:i}function p(){const e=n.getValue("ChartToolsHideMode","drawings");return h().has(e)?e:"drawings"}function _(){let e=!0;return m(((t,i,s)=>{const r=t.value();e=e&&(s?!r:r)})),e}function m(e){h().forEach(((t,i)=>{var s;const r=null===(s=t.getBoxedValue)||void 0===s?void 0:s.call(t);r&&e(r,i,t.inverted)}))}},13323:(e,t,i)=>{"use strict";i.d(t,{GeneralChartPropertiesRenderer:()=>r});var s=i(29280);class r extends s.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){const t=this._chartWidgetCollection,s=t.activeChartWidget.value();return s.generalPropertiesDefinitions().then((r=>Promise.all([i.e(2257),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6107),i.e(6665),i.e(4447),i.e(8065),i.e(3762),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(1398),i.e(8596),i.e(2038),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),i.e(7078)]).then(i.bind(i,56080)).then((i=>{var n,o;const a=new i.GeneralChartPropertiesDialogRenderer({chartWidgetCollection:t,propertyPages:r,activePageId:this._activePageId,model:s.model()});return null===(n=this._dialog)||void 0===n||n.hide(),null===(o=this._dialog)||void 0===o||o.visible().unsubscribe(this._subscribe),this._dialog=a,
a.visible().subscribe(this._subscribe),a.show(e),this._activePageId=void 0,a}))))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}isVisible(){return this.visible().value()}focusOnText(){}setActivePage(e){this._activePageId=e}}},25812:(e,t,i)=>{"use strict";var s;i.d(t,{ToolboxType:()=>s}),function(e){e[e.Delete=0]="Delete"}(s||(s={}))},59064:(e,t,i)=>{"use strict";i.d(t,{globalCloseDelegate:()=>s,globalCloseMenu:()=>r});const s=new(i(52033).Delegate);function r(){s.fire()}},76384:e=>{e.exports={"css-value-header-toolbar-height":"38px"}},75162:e=>{e.exports={chartsSplitter:"chartsSplitter-L0xapso5",hovered:"hovered-L0xapso5","i-active":"i-active-L0xapso5"}},80747:e=>{e.exports={"css-value-pane-controls-padding-left":"1px","css-value-pane-controls-padding-right":"4px"}},37702:e=>{e.exports={paneSeparator:"paneSeparator-uqBaC1Ki",handle:"handle-uqBaC1Ki",hovered:"hovered-uqBaC1Ki",active:"active-uqBaC1Ki"}},64176:e=>{e.exports={priceScaleModeButtons:"priceScaleModeButtons-PEm49B2T",priceScaleModeButtons__buttonWrapper:"priceScaleModeButtons__buttonWrapper-PEm49B2T",priceScaleModeButtons__button:"priceScaleModeButtons__button-PEm49B2T",priceScaleModeButtons__button_activated:"priceScaleModeButtons__button_activated-PEm49B2T"}},7507:(e,t,i)=>{"use strict";i.d(t,{getLineToolsSynchronizerClass:()=>o,loadLineToolsSynchronizer:()=>n});var s=i(56570);let r=null;async function n(){if(s.enabled("saveload_separate_drawings_storage")){const e=await i.e(7129).then(i.bind(i,49053));return r=e.LineToolsSynchronizer,!0}return!1}function o(){if(!r)throw new Error("LineToolsSynchronizer Class not loaded");return r}},79437:(e,t,i)=>{"use strict";var s=i(37265).declareClassAsPureInterface;function r(){}TradingView.WEB_SOCKET_WAS_CONNECTED=!1,r.prototype.defaultResolutions=function(){},r.prototype.availableCurrencies=function(){},r.prototype.availableUnits=function(){},r.prototype.supportedSymbolsTypes=function(){},r.prototype.symbolsGrouping=function(){},r.prototype.quoteCreateSession=function(e){},r.prototype.quoteDeleteSession=function(e){},r.prototype.quoteSetFields=function(e,t){},r.prototype.quoteAddSymbols=function(e,t){},r.prototype.quoteRemoveSymbols=function(e,t){},r.prototype.quoteFastSymbols=function(e,t){},r.prototype.depthCreateSession=function(e,t,i){},r.prototype.depthDeleteSession=function(e){},r.prototype.depthSetSymbol=function(e,t){},r.prototype.depthClearSymbol=function(e){},r.prototype.depthSetScale=function(e,t){},r.prototype.chartCreateSession=function(e,t){},r.prototype.chartDeleteSession=function(e){},r.prototype.createSession=function(e,t){},r.prototype.removeSession=function(e){},r.prototype.connected=function(){},r.prototype.connect=function(){},r.prototype.disconnect=function(){},r.prototype.switchTimezone=function(e,t){},r.prototype.resolveSymbol=function(e,t,i,s){},r.prototype.createSeries=function(e,t,i,s,r,n,o,a){},r.prototype.removeSeries=function(e,t,i){},r.prototype.modifySeries=function(e,t,i,s,r,n,o){},r.prototype.requestMoreData=function(e,t,i,s){},
r.prototype.requestMetadata=function(e){},r.prototype.canCreateStudy=function(e,t,i){},r.prototype.createStudy=function(e,t,i,s,r,n,o,a){},r.prototype.getStudyCounter=function(e){},r.prototype.getFundamentalCounter=function(e){},r.prototype.removeStudy=function(e,t){},r.prototype.modifyStudy=function(e,t,i,s,r){},r.prototype.createPointset=function(e,t,i,s,r,n,o){},r.prototype.modifyPointset=function(e,t,i,s,r){},r.prototype.removePointset=function(e,t,i){},r.prototype.requestMoreTickmarks=function(e,t,i,s){},r.prototype.requestFirstBarTime=function(e,t,i,s){},r.prototype._sendRequest=function(e,t){},r.prototype._onMessage=function(e){},r.prototype._dispatchNotification=function(e){},r.prototype._invokeNotificationHandler=function(e,t,i){},r.prototype._notifySessions=function(e){},r.prototype.unpack=function(e){},r.prototype.searchSymbols=function(e,t,i,s,r,n,o,a,l,c){},r.prototype.getMarks=function(e,t,i,s,r){},r.prototype.getTimescaleMarks=function(e,t,i,s,r){},s(r,"ChartApiInterface"),e.exports.ChartApiInterface=r},64289:(e,t,i)=>{"use strict";i.r(t),i.d(t,{favorStandardStudyTemplate:()=>D,favorStudyTemplate:()=>k,getChartContent:()=>P,getCharts:()=>b,getChartsCount:()=>S,getCustomAdapter:()=>f,getDrawingTemplates:()=>R,getStandardStudyTemplateById:()=>E,getStorageURL:()=>m,getStudyTemplateById:()=>I,getStudyTemplatesList:()=>A,initialize:()=>v,invalidateStudyTemplatesList:()=>L,isThemeExist:()=>j,loadChart:()=>x,loadDrawingTemplate:()=>N,loadTheme:()=>W,loadThemes:()=>H,removeChart:()=>w,removeDrawingTemplate:()=>O,removeStudyTemplate:()=>T,removeTheme:()=>U,renameStudyTemplate:()=>V,replaceStudyTemplate:()=>B,saveChart:()=>C,saveDrawingTemplate:()=>F,saveStudyTemplate:()=>M,saveTheme:()=>z,setCustomAdapter:()=>g,updateUser:()=>y});var s=i(76422),r=i(31955),n=i(14712),o=i(56840);const a=(0,r.getLogger)("Chart.SaveloadAdapter.Library"),l={error:""};let c,h,d,u,p=null,_=null;function m(e){return`${d}/${encodeURIComponent(u)}/${e}?client=${encodeURIComponent(c)}&user=${encodeURIComponent(h)}`}function g(e){p=e}function f(){return p}function v(e,t,i,s){c=e,h=t,d=i,u=s}function y(e){h=e}function S(e,t){throw new Error("Not implemented")}async function b(){const e=e=>e.map((e=>({id:e.id,name:e.name,image_url:String(e.id),modified_iso:e.timestamp,short_symbol:e.symbol,interval:e.resolution})));if(p)return p.getAllCharts().then(e);try{const t=await fetch(`${m("charts")}`,{credentials:"same-origin"});if(!t.ok)throw new Error(`Getting chart content response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Get chart content request failed: "+i.message);return e(i.data)}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function w(e){if(p)return p.removeChart(e);try{const t=await fetch(`${m("charts")}&chart=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin"});if(!t.ok)throw new Error(`Remove chart response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Remove drawing template request failed: "+i.message)
}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function C(e,t,i,s,r){var o;const l=r.id.value(),c={name:e,content:JSON.stringify(s),symbol:t,resolution:i};try{if(p){return{result:await p.saveChart({...c,id:l,timestamp:Math.round(Date.now()/1e3)})}}const e=new FormData;for(const t in c)e.append(t,c[t]);let t=m("charts");null!=l&&(t+=`&chart=${encodeURIComponent(l)}`);const i=await fetch(t,{credentials:"same-origin",method:"POST",body:e});if(!i.ok)throw new Error(`Saving chart content response was not OK. Status: ${i.status}.`);const s=await i.json();if("ok"!==s.status)throw new Error("Saving chart content request failed: "+s.message);return{result:(null!==(o=s.id)&&void 0!==o?o:l).toString(),response:i}}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function P(e){const t=t=>{const i=JSON.parse(t);return i.uid=e.id,i};if(p)return p.getChartContent(e.id).then((e=>t(e)));try{const i=await fetch(`${m("charts")}&chart=${encodeURIComponent(e.id)}`,{credentials:"same-origin"});if(!i.ok)throw new Error(`Getting chart content response was not OK. Status: ${i.status}.`);const s=await i.json();if("ok"!==s.status)throw new Error("Get chart content request failed: "+s.message);return t(s.data.content)}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}function x(e){P(e).then((e=>{s.emit("chart_load_requested",e)}),(()=>{a.logWarn("Error loading chart")}))}async function T(e){try{const t=G().filter((t=>t!==e));if(p)return q(t),p.removeStudyTemplate({name:e});const i=await fetch(`${m("study_templates")}&template=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin"});if(!i.ok)throw new Error(`Remove study template response was not OK. Status: ${i.status}.`);const s=await i.json();if("ok"!==s.status)throw new Error("Remove study template request failed: "+s.message);q(t)}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function I(e){try{if(p){return{content:await p.getStudyTemplateContent({name:e})}}const t=await fetch(`${m("study_templates")}&template=${encodeURIComponent(e)}`,{credentials:"same-origin"});if(!t.ok)throw new Error(`Get study template response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Get study template request failed: "+i.message);return i.data}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function M(e){try{if(p)return p.saveStudyTemplate(e).then((()=>({error:""}))).catch((e=>({error:null!=e?(0,n.errorToString)(e):"error"})));const t=new FormData;t.append("name",e.name),t.append("content",e.content);const i=await fetch(m("study_templates"),{method:"POST",body:t,credentials:"same-origin"});if(!i.ok)throw new Error(`Save study template response was not OK. Status: ${i.status}.`);const s=await i.json();return{error:"ok"===s.status?"":s.status}}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function A(){try{if(_)return _;_=[];const e=e=>(_=e.map((e=>{const t=G().indexOf(e.name);return{id:e.name,is_default:!1,name:e.name,favorite_date:-1!==t?t:null}})),_);if(p)return p.getAllStudyTemplates().then(e)
;const t=await fetch(m("study_templates"),{method:"GET",credentials:"same-origin"});if(!t.ok)throw new Error(`Study templates list response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Study templates list request failed: "+i.message);return e(i.data)}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}function L(){_=null}function k(e,t,i){const s=G();q(t?[...s,e]:s.filter((t=>t!==e))),null==i||i(null)}function D(e,t,i){k(e,t,i)}function E(e,t){throw new Error("Not implemented")}function V(e,t,i){throw new Error("Not implemented")}function B(e,t,i){throw new Error("Not implemented")}async function R(e){throw new Error("Not implemented")}async function N(e,t){throw new Error("Not implemented")}async function O(e,t){throw new Error("Not implemented")}async function F(e,t,i){throw new Error("Not implemented")}function W(e){if(null!==p)return p.getChartTemplateContent(e);throw new Error("Not implemented")}function H(){return null!==p?p.getAllChartTemplates():Promise.resolve([])}async function z(e,t){if(null!==p)try{return await p.saveChartTemplate(e,t),l}catch(e){return console.error(e),{error:e instanceof Error?e.message:e.toString()}}throw new Error("Not implemented")}async function U(e){if(null!==p)try{return await p.removeChartTemplate(e),l}catch(e){return console.error(e),{error:e instanceof Error?e.message:e.toString()}}throw new Error("Not implemented")}function j(e){return W(e).then((e=>Boolean(e.content)))}function G(){return o.getJSON("StudyTemplates.quicks",[])}function q(e){o.setJSON("StudyTemplates.quicks",e)}},51243:(e,t,i)=>{"use strict";var s=i(50151).ensureNotNull,r=i(50151).ensureDefined,n=i(14381),o=i(85049).Interval,a=i(80359),l=i(6058),c=i(79437).ChartApiInterface,h=i(18278).HandlerInfo,d=i(37265).requireFullInterfaceImplementation,u=i(31955).getLogger("Chart.ChartApiLocal"),p=i(82783).TIMEFRAMETYPE,_=i(53388).createDwmAligner;TradingView.STUDY_COUNT_LIMIT=210;function m(e,t){return`${e}__${t}`}JSServer.ChartApi=function(e){this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._metadataRequestNextNumber=1,this._connected=!1,this._enabled=!1,this._studyEngine=new a(e),this._callbacks={},this._serverTimeOffset=0;var t=this;this._studyEngine.on("configuration_received",(function(){t._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",(function(e){var i={time:e.value[0]/1e3,open:e.value[1],high:e.value[2],low:e.value[3],close:e.value[4],volume:e.value[5]};t._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={},this._studySpecs=new Map,this._isNonCountedStudy=()=>!0},JSServer.ChartApi.prototype.destroy=function(){this._studyEngine.destroy(),this._studyEngine=null},JSServer.ChartApi.prototype.purgeCache=function(e){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache()},JSServer.ChartApi.prototype.defaultResolutions=function(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]},
JSServer.ChartApi.prototype.availableCurrencies=function(){var e=this._studyEngine.supportedCurrencies().map((function(e){return"string"==typeof e?{id:e,code:e}:e}));return Promise.resolve(e)},JSServer.ChartApi.prototype.availableUnits=function(){return Promise.resolve(this._studyEngine.supportedUnits())},JSServer.ChartApi.prototype.availablePriceSources=function(e){return this._studyEngine.supportedPriceSources(e)},JSServer.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()},JSServer.ChartApi.prototype.symbolsGrouping=function(){return this._studyEngine.symbolsGrouping()},JSServer.ChartApi.prototype.start=function(){this._enabled=!0,this._fireEvent("start_enabled")},JSServer.ChartApi.prototype.unsubscribe=function(e,t){var i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)},JSServer.ChartApi.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},JSServer.ChartApi.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){var s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(var r=0;rn||(TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(t,i,m,n,a,c),l&&setTimeout(l,0))}}}if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*r))m();else{var g=TradingView.ChartapiMessagerInstances[e].beforeSeriesCompleted,f=TradingView.ChartapiMessagerInstances[e].seriesError;void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=setTimeout(function(){delete this._setVisibleRangeTimeout[e],g.subscribe(null,v,!0),f.subscribe(null,y,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*r)}.bind(this),0)}function v(e,s){e===t&&s===i&&(g.unsubscribe(null,v),f.unsubscribe(null,y),m())}function y(e,s){e===t&&s===i&&g.unsubscribe(null,v)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,s,r){var a,l,c={},h=!0;if(r.type===p.PeriodBack){var d=this._studyEngine.getSeriesLastBarTime(e,i);if(null===d)return;l=d/1e3;var u=o.parse(r.value),m=this._studyEngine.getSeriesSymbolInfo(e,i);a=n.alignPeriodsBackForVisibleRange(m.session,m.session_holidays,m.corrections,u.letter(),u.multiplier(),1,d)/1e3;var g=_(this._studyEngine.getSeriesInterval(e,i),m);null!==g&&(l=g.timeToExchangeTradingDay(1e3*l)/1e3,a=g.timeToExchangeTradingDay(1e3*a)/1e3),c={applyDefaultRightMargin:!0},h=!1}else a=r.from,l=r.to;this.setVisibleTimeRange(e,i,s,a,l,h,c,void 0,r)},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){var l=this;this._notificationHandlers[e][t]=new h((function(r){"series_completed"===r.method&&null!==o&&(l._applyTimeFrame(e,s,t,i,o),o=null),a(r)}),t),this._studyEngine.modifySeries(e,t,s,r,i,n)},JSServer.ChartApi.prototype.requestMoreData=function(e,t){this._studyEngine.extendSeriesRange(e,t)},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(){return new Promise(((e,t)=>{const i=this.studiesAccessController.getEnabledTools();e({method:"studies_metadata",params:[this._makeNextRequestId(),{errors:[],hash:"",metainfo:i,migrations:[]}]})}))
},JSServer.ChartApi.prototype._makeNextRequestId=function(){return"metadata_"+this._metadataRequestNextNumber++},JSServer.ChartApi.prototype.setIsNonCountedStudyFn=function(e){this._isNonCountedStudy=e},JSServer.ChartApi.prototype.canCreateStudy=function(e,t,i){return this._isNonCountedStudy(t.id)||this.studyCounter{"use strict";var s=i(52033).Delegate,r=function(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new s,this.seriesError=new s};r.prototype.onSymbolResolved=function(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})},r.prototype.onSymbolError=function(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})},r.prototype.onStudyError=function(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})},r.prototype.onSeriesLoading=function(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})},r.prototype.onSeriesCompleted=function(e,t,i){this.beforeSeriesCompleted.fire(e,t),this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})},r.prototype.onSeriesError=function(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)},r.prototype.onStudyCompleted=function(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})},r.prototype.onStudyLoading=function(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})},r.prototype.onTickmarksUpdated=function(e,t){var i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleUpdate=function(e,t){var i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleCompleted=function(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})},r.prototype.onSeriesTimeframeUpdate=function(e,t,i,s,r,n){var o={method:"series_timeframe",
params:[this._session,e,t,i,s,n||null,!0,r]};this._server.receiveLocalResponse(o)},r.prototype.onPointsetDataUpdate=function(e,t,i){this.onDataUpdate(e,t,i,null)},r.prototype._prepareDataUpdateObjects=function(e){var t={};return e.forEach((function(e){t[e.objId]={series:e.data,turnaround:e.turnaround},e.nonSeriesData&&(e.nonSeriesData.data?t[e.objId].nonseries={d:JSON.stringify(e.nonSeriesData.data),indexes:e.nonSeriesData.indexes}:t[e.objId].nonseries={d:"",indexes:[]})})),t},r.prototype.onDataUpdate=function(e,t,i,s){var r={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})},r.prototype.onDepthData=function(e){this._server.receiveLocalResponse({method:"dd",params:e})},r.prototype.onDepthUpdate=function(e){this._server.receiveLocalResponse({method:"dpu",params:e})},r.prototype.onClearData=function(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})},TradingView.ChartapiMessagerInstances=[],e.exports=r},47282:(e,t,i)=>{"use strict";i.d(t,{DatafeedRequestsCachedProcessor:()=>m});var s,r=i(50151),n=i(85049),o=i(29981),a=i(56570),l=i(14381),c=i(53388),h=i(69748),d=(i(21251),i(85541));function u(e,t){return e.ticker+(e.currency_code?"_#_"+e.currency_code:"")+(e.unit_id?"_#_"+e.unit_id:"")+(e.subsession_id?"_#_"+e.subsession_id:"")+"_#_"+t}function p(e){return new Date(e).toISOString()}!function(e){e.ThreadKeySeparator="_#_"}(s||(s={})),function(e){e[e.MaxEmptyResponsesInARow=50]="MaxEmptyResponsesInARow",e[e.ResetCacheTimePeriod=1e4]="ResetCacheTimePeriod"}(s||(s={}));class _{constructor(e,t,i,s,r,o){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._nextTime=null,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._destroyed=!1,this._emptyResponsesCount=0,this._firstDataRequest=!0,this._datafeed=e,this._symbolInfo=t,this._interval=n.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=r,this._serverTimeOffsetGetter=s,this._resetCacheTimePeriod=void 0===o?1e4:o,this._sessionSpec=new h.SessionSpec(t.timezone,t.session,t.session_holidays,t.corrections),this._updateDatesFromExpirationDate()}destroy(){0!==this._subscribers.length&&this._logWarning("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed,this._destroyed=!0}addSubscription(e,t,i){const s=this._getNextSubscriptionId();this._pendingSubscribers.push({key:s,range:e,onHistoryCallback:t,onErrorCallback:i}),n.Interval.isDWM(this._resolution)&&void 0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&this._logWarning(`Internal error: invalid date for DWM resolution ${p(e.to)}, expected time without a time part`),this._clearResetCacheTimeout();return setTimeout((()=>{
this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)));this._logWarning("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}_logMessage(e,t){(a.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logWarning(e){console.warn(`${this._logMessagePrefix()}${e}`)}_logError(e){console.error(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(new Date).toISOString()} FEED [${this._symbolInfo.name}|${this._resolution}${e?"|"+e:""}${t?"|"+t:""}]: `}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._firstDataRequest=!0,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,r.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,o.lowerbound)(this._cache.bars,i,((e,t)=>e.time{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${p(t.to)}`);!(null===this._leftDate||t.to{
const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),u(this._symbolInfo,this._resolution),(()=>{this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null===e||a.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})})),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(u(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),p(s.bars[0].time),p(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,this._endOfData&&null!==this._leftDate&&i.to<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)}_createBarsetForRange(e){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,o.lowerbound)(this._cache.bars,t,((e,t)=>e.time{if(!this._destroyed)if(a)this._logMessage("getBars callback is already called before",!0);else{if(a=!0,e.length>0){const t=` [${p(e[0].time)} ... ${p(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${o}`)}else this._logMessage(`Receiving bars: barset is empty, requested range: ${o}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(a?this._logMessage("getBars callback is already called before",!0):(a=!0,this._requesting=!1,this._errorMessage=e||null,this._processPendingSubscribers()))}))}_processBars(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?(this._emptyResponsesCount=0,this._processFullBarset(e,t)):(this._emptyResponsesCount+=1,this._processEmptyBarset(t)),this._processPendingSubscribers()}_processEmptyBarset(e){e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(p(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?(this._logMessage("EOD received"),this._setEndOfData()):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned"),50===this._emptyResponsesCount&&(this._logMessage("EOD detected due 50 empty responses in a row"),this._setEndOfData())}_setEndOfData(){this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._dealignTime(this._cache.bars[0].time))}_processFullBarset(e,t){this._putToCache(e)?null!==this._leftDate&&0!==this._cache.bars.length&&(this._interval.isTicks()?this._leftDate=this._dealignTime(this._cache.bars[0].time):this._leftDate=Math.min(this._leftDate,this._dealignTime(this._cache.bars[0].time))):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?this._logWarning("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&this._logWarning("noData should be set when there is no data in the requested period and earlier only")}_getNextSubscriptionId(){return this._nextSubscriptionId++}_checkBars(e,t=!1){
if(a.enabled("charting_library_debug_mode"))for(let i=1;i"number"!=typeof e[i][t]||!isFinite(e[i][t])))&&this._logError("Wrong bars values: all OHLC values should be numbers")}}_putToCache(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||st.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}subscribe(e,t,i,s,r){const n=u(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,r)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void this._logWarning("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):this._logWarning("Data thread doesnt exist: "+e)}_createThread(e,t){return new _(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,c.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}_logWarning(e){console.warn(`${(new Date).toISOString()} FEED: ${e}`)}}},9447:(e,t,i)=>{"use strict";i.d(t,{barTimeToEndOfPeriod:()=>r,endOfPeriodToBarTime:()=>n});var s=i(83910);function r(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t)
;if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(s.SessionStage.LASTBAR_SESSION)/1e3}function n(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return t=e.startOfBar(0)/1e3}},30328:(e,t,i)=>{"use strict";i.d(t,{replaceGraphicsTimesWithTimePointIndexIndex:()=>n});const s=new Map([["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["backgrounds",e=>[e.start,e.stop]]]),r=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);function n(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,n=new Set;s.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data){const t=e(s);for(const e of t)i.set(e,-1),n.add(e)}}));const o=Array.from(n).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),r.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data)e(s,i)})),o}},9001:(e,t,i)=>{"use strict";var s=i(56570);window.onload=function(){location.hostname.indexOf(".")>=0&&!function(){try{return/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(e){return!1}}()&&setTimeout((function(){try{var e=function(){var e=0;return JSON.parse(urlParams.logo).image&&(e="C",s.enabled("link_to_tradingview")||(e="D")),e}();window.ga&&(0!==e&&window.ga("send","event","s",e),urlParams.utm||window.ga("send","event","l"))}catch(e){}}),3e4)}},2060:(e,t,i)=>{"use strict";var s,r=i(14381),n={};e.exports=function(e,t,i){var o,a,l,c,h={},d=n[i]||"out_of_session",u=!1,p=i,_=t,m=null,g=null;function f(){var e={};e.symbolname=p,e.status="ok",e.values={},e.values.current_session=d,n[p]=d,TradingView.ChartapiMessagerInstances[_].onQuotesData([_].concat([e]))}function v(){if(o)if(c)d="out_of_session";else{var e=(new Date).getTime(),t=r.isTradingNow(e,o)?"market":"out_of_session";a&&r.isTradingNow(e,a)?t="pre_market":l&&r.isTradingNow(e,l)&&(t="post_market"),t!==d&&(d=t)}}return e(i,null,(function(e){u||function(e){o=new r.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),c=e.expired,e.subsession_id&&e.subsessions?e.subsessions.forEach((t=>{switch(t.id){case"regular":
o=new r.SessionInfo(e.timezone,e.session,e.session_holidays,t["session-correction"]||e["session-correction"]||e.corrections);break;case"premarket":a=new r.SessionInfo(e.timezone,t.session,e.session_holidays,t["session-correction"]||e["session-premarket-correction"]||e.corrections);break;case"postmarket":l=new r.SessionInfo(e.timezone,t.session,e.session_holidays,t["session-correction"]||e["session-postmarket-correction"]||e.corrections)}})):(a=void 0,l=void 0);const t=60-new Date(Date.now()).getSeconds();s&&s?.ticker===e.ticker||(s={ticker:e.ticker,timer:t},clearTimeout(s.timeout)),g=setTimeout((()=>{m=setInterval((()=>{v(),f()}),6e4),v(),f()}),1e3*s.timer),s&&void 0!==s?.timeout||(s.timeout=g),v(),f()}(e)}),(function(){})),h.stop=function(){u=!0,m&&clearInterval(m),g&&clearInterval(g)},h.marketStatus=function(){return d},h}},85541:(e,t,i)=>{"use strict";i.d(t,{BarSet:()=>s});class s{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){const t=this.bars[e];if(void 0===t)throw new Error(`BarSet has no value at index ${e}`);return t}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);const s=e,r=this.bars,n=r.length,o=s.time,a=0===n?NaN:r[n-1].time;0===n||a{"use strict";i.r(t),i.d(t,{DataFeed:()=>P,setupFeed:()=>S,unsubscribeUnused:()=>b});var s=i(50151),r=i(85049);class n{constructor(){this._listeners=[]}listenersCount(){return this._listeners.reduce(((e,t)=>e+(t?1:0)),0)}addListener(e,t){this._listeners.push({dataListener:e,onErrorCallback:t}),this._barset&&e(this._barset),this._errorMsg&&t(this._errorMsg)}removeListener(e){const t=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;const i=this._listeners.indexOf(t[0]);delete this._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";const t=this._listeners,i=t.length;for(let s=0;s{throw new Error("BarBuildItem scripts should not need to access any input values")},recalc:(e,t)=>{this._recalc(t)},out:(e,t)=>{this._out(e,t)},nonseriesOut:(e,t)=>{
this._nonseriesOut(e,t)},setNoMoreData:()=>{this._barset&&(this._barset.endOfData=!0)},onErrorCallback:e=>{this.listeners.onError(e)}})}stop(){this.engine?this.engine.stop():console.error("Internal library error 0x1")}_recalc(e){this._isRecalculated&&console.error("recalc called twice!"),this._barset||(this._barset=new l.BarSet(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){var i,s;const r=Object.assign({},t);r.nonseries=!0,r.data=t.bars,delete r.bars,r.barsetSize=this._barset?this._barset.count():0,r.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,"number"==typeof t.projectionTime&&(r.lastBar||(r.lastBar={}),null!==(i=(s=r.lastBar).projectionTime)&&void 0!==i||(s.projectionTime=t.projectionTime)),this.listeners.fire(r,!0)}_out(e,t){const i=t[0];if(isNaN(i))return;const r={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},n=t[7];this._barset||(this._barset=new l.BarSet((0,s.ensureDefined)(e.info,"bar builder item output symbol info")));const o=t[8],a=t[9];if(o instanceof Array&&a)for(let e=0;e{r&&e.regular_session&&(e.session=e.regular_session),this._subs=this._host.subscribe(e,s,a,(e=>{this.listeners.fire(e)}),(e=>{this.listeners.onError(e)}))}),(e=>{this.listeners.onError(e)}))}stop(){this._subs&&this._host.unsubscribe(this._subs)}}var g=i(60656),f=i(14381),v=i(40644);class y{constructor(e,t){this._period=e,this._generateEmptyBars=!!t}init(e){this._bb=(0,f.newBarBuilder)(this._period,e.symbol.session,null),this._bbEmptyBars=this._generateEmptyBars?(0,f.newBarBuilder)(this._period,e.symbol.session,null):void 0,e.setMinimumAdditionalDepth(0)}main(e){const t=(0,
s.ensureDefined)(this._bb,"bar builder study bar builder"),i=e.symbol.time,r=t.alignTime(i),n=e.new_var(r),o=h.Std.na(r),a=n.get(1),l=h.Std.na(a)?1:h.Std.neq(r,a),c=e.new_var(),d=e.new_var(),u=e.new_var(),p=e.new_var(),_=c.get(1),m=d.get(1),g=u.get(1),f=p.get(1),v=o?NaN:l?h.Std.open(e):_,y=o?NaN:l?h.Std.high(e):h.Std.max(h.Std.high(e),m),S=o?NaN:l?h.Std.low(e):h.Std.min(h.Std.low(e),g),b=o?NaN:h.Std.close(e),w=o?NaN:l?h.Std.volume(e):h.Std.volume(e)+f,C=o?NaN:i,P=e.symbol.isBarClosed&&t.isLastBar(0,i),x=this._generateEmptyBars&&l?this._extrapolate(a,r):void 0,T=e.new_var(h.Std.close(e)).get(1),I=x instanceof Array?T:NaN;return c.set(v),d.set(y),u.set(S),p.set(w),[r,v,y,S,b,w,C,P,x,I]}_extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:(0,v.extrapolateBarsFrontToTime)((0,s.ensureDefined)(this._bbEmptyBars,"bar builder study empty bar builder"),e,t,Number.MAX_SAFE_INTEGER,!0).times}}const S=e=>{P.instance=new P(e),(0,g.setupFeed)(P.instance)},b=()=>{P.instance.removeUnused()},w=e=>{console.error(e),h.Std.error(e)},C=r.Interval.parse("1M").inMilliseconds(0);class P{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,r,n,o,a,l,c,h){const d=l(o),u=((e,t,i,s,r,n,o,a,l)=>n+e+s+(t||"")+(i||"")+(l||"")+(r.has_empty_bars?"_":"")+"_"+o.countBack+"_"+o.to+"_"+Boolean(a))(e,t,i,s,o,a,d,c,h);let p=this._getCache(u);return p||(p=this._createItem(e,t,i,s,o,d,a,c,h),this._putCache(u,p)),p.listeners.addListener(r,n),{key:u,listener:r}}unsubscribe(e){const t=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){const e=[],t=e=>!!this._cache[e];for(const i in this._cache)if(t(i)){0===(0,s.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(let t=0;t{"use strict";let s;function r(e,t,i,r){var n;return null!==(n=null==s?void 0:s(e,t,i,r))&&void 0!==n?n:e}function n(e){s=e}i.d(t,{getVolumeProfileResolutionForPeriod:()=>r,overwriteVolumeProfileResolutionForPeriodGetter:()=>n})},67153:(e,t,i)=>{"use strict";i.d(t,{findSuitableResolutionToBuildFrom:()=>o});var s=i(85049);function r(e,t){const i=t.multiplier();for(let s=e.length-1;s>=0;s--){const r=Number(e[s]);if(i%r==0)return{error:!1,resolution:`${r}${t.letter()}`}}return{error:!0,errorMessage:n(t.value())}}function n(e){return`Misconfiguration error: it is trying to request ${e} but we cannot build it from lower resolution`}function o(e,t){const i=s.Interval.parse(e);if((i.isWeeks()||i.isMonths())&&t.has_weekly_and_monthly){let e=["1"];i.isWeeks()&&void 0!==t.weekly_multipliers&&(e=t.weekly_multipliers),i.isMonths()&&void 0!==t.monthly_multipliers&&(e=t.monthly_multipliers);const s=r(e,i);if(!s.error)return s}if(i.isDWM()&&(void 0===t.has_daily||t.has_daily))return i.isDays()&&void 0!==t.daily_multipliers?r(t.daily_multipliers,i):void 0===t.daily_multipliers||t.daily_multipliers.includes("1")?{error:!1,resolution:"1D"}:{error:!0,errorMessage:"Misconfiguration error: it is trying to request a resolution but symbol does not support it"};if(i.isDWM())return{error:!0,errorMessage:n(i.value())};if(i.isMinutes()&&!t.has_intraday)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request intraday resolution but symbol does not support it"};if(i.isSeconds()&&!t.has_seconds)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request seconds resolution but symbol does not support it"};if(i.isTicks())return!t["is-tickbars-available"]||i.multiplier()>1?{error:!0,errorMessage:`Misconfiguration error: it is trying to request ${i.multiplier()} ticks resolution but symbol does not support it`}:{error:!1,resolution:"1T"};const o=i.isSeconds()?t.seconds_multipliers:t.intraday_multipliers;return void 0===o?{error:!1,resolution:i.value()}:r(o,i)}},60656:(e,t,i)=>{"use strict";i.d(t,{ScriptRunner:()=>C,setupFeed:()=>w});var s=i(50151),r=i(85049),n=i(73698),o=i(2740),a=i(42217),l=i(69748),c=i(14381),h=i(91007),d=i(50335);class u{constructor(e,t,i,s,o,l,c){this.periodBase="";const h=(0,n.decodeExtendedSymbol)(e),d="string"==typeof h.symbol?h:h.symbol;if((0,n.isStudySymbol)(d))throw new Error(`Unexpected nested study symbol: ${e}`)
;const u="string"==typeof h.symbol?h.symbol:h.symbol.symbol;this.ticker=u,this.currencyCode=i||d["currency-id"],this.unitId=s||d["unit-id"],this.subsessionId=c||d.session;const p=d["currency-id"]!==this.currencyCode||d["unit-id"]!==this.unitId;d["currency-id"]=this.currencyCode,d["unit-id"]=this.unitId,p&&(e=(0,n.encodeExtendedSymbolOrGetSimpleSymbolString)(h)),this.tickerid=e;const _=r.Interval.parse(t);this.resolution=_.letter(),this.interval=_.multiplier(),this.period=_.value(),this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN,this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.minTick=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.isFirstBar=!1,this.isLastBar=!1,this.session=new a.SessionInfo("Etc/UTC","24x7"),this.regularSubsession=null,this.preMarketSubsession=null,this.postMarketSubsession=null,this.script=o,this.projectionTime=NaN,this.isAdditionalDepthAllowed=!(0,n.isStudySymbol)(h)||h.type.includes("BarSetHeikenAshi"),l&&this.set_symbolinfo(l)}set_symbolinfo(e){if(e||console.error("WARN: symbolinfo isn't defined for "+this.tickerid),this.info=e,this.minTick=e.minmov/e.pricescale,this.currencyCode=e.currency_code,this.unitId=e.unit_id,this.subsessionId=e.subsession_id,this.timezone=o.get_timezone(e.timezone),this.session.init(e.timezone,e.session,e.session_holidays,e.corrections),void 0!==e.subsessions){const t=e.subsessions.find((e=>e.id===h.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===h.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===h.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new l.SessionSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new l.SessionSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new l.SessionSpec(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=(0,c.newBarBuilder)(this.period,e,t)}bartime(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0,s.ensureDefined)(this.timezone,"symbol instrument timezone"),i=o.utc_to_cal(t,e);return this.session.spec.correctTradingDay(i),o.cal_to_utc(t,i)}lastbar(e){if(isNaN(e.time))return;let t=e.time;this.dwm_aligner&&(this.dwm_aligner.moveTo(t),t=this.dwm_aligner.startOfBar(0));const i=this.time!==t;i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=(0,d.isNumber)(e.volume)&&e.volume>=0?e.volume:NaN,this.updatetime=e.updatetime||NaN,this.isNewBar=i,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.projectionTime=e.projectionTime||NaN,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}var p=i(29981),_=i(73772);class m{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){
return this.get(0)}get(e){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=_.Std.max(this.mindepth,e),NaN)}set(e){this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){let e=_.Std.na(this.mindepth)?_.Std.max_series_default_size:_.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new g(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new f(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}function v(e){
return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}class y{constructor(e,t,i,s,r,n,o,a,l,c,h){this._body=n,this._symbols=[],this._runner=r,this._inputCallback=a,this._out=o,this._nonseriesOut=l,this._ctx=new f(this.add_sym(e,t,i,s,c,h)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);var r;if(null!=s)if(null===(r=s)||Array.isArray(r)||"composite"!==r.type)this._processResult(s);else for(let e=0;e1&&this._runner.host.enableDwmAligning&&o.enable_dwm_aligning(this._symbols[0].session,o.session),o}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){var e;this._symbols=null,null===(e=this._ctx)||void 0===e||e.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;var i;this._out&&e&&(!isNaN(t.symbol.time)||v(e))&&(v(e)?(i=e,Array.isArray(i)||"projection"!==i.type||(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):!function(e){return!Array.isArray(e)&&("non_series_bars"===e.type||"projection"===e.type)}(e)?this._out(t.symbol,e):e.bars.forEach((e=>{this._out(t.symbol,e)})))}}var S=i(53388),b=i(1452);function w(e){C.feed=e}class C{constructor(e){this._nonseriesUpdate=null,this._script=null,this._symbols=[],this._barsets=[],this._subscription=[],this.host=e,this._isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,r,n,o){const a=new u(e,t,i,s,r,n,o);return this._symbols.push(a),a}get_sym(e){return this._symbols[e]}out(e,t){if(this._nonseriesUpdate){const i=Object.assign({},this._nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;const e=this.host,t=new y(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);this._script=t;const i=[],n=this._symbols,o=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+this._script.maxAdditionalDepth()}),a=n[0],l=(t,s,r)=>{i.push(C.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))},c=(t,i)=>{"series"===(i.nonseries?"nonseries":"series")?this.update(t,i):i.lastBar?(this._nonseriesUpdate=i,i.lastBar.isLastBar=!0,this._symbols[0].lastbar(i.lastBar),this._nonseriesUpdate=null):e.nonseriesOut(n[0],i)},h=()=>o;l(a,h,(e=>{!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&(e=>{function i(i,r){let n=(0,S.createTimeToBarTimeAligner)(i,r)(e);const o=(0,S.createDwmAligner)(i,r);return null!==o&&(n=o.timeToExchangeTradingDay(n)),{to:n,countBack:(0,s.ensureNotNull)(t,"script runner script").maxAdditionalDepth()}}for(let e=1;e=0;t--){const i=e[t],s=this._barsets[t],r=s.count();for(let e=0;ee.endOfData));t&&this.host.setNoMoreData(),this.host.recalc(this,{endOfData:t,firstLoadedTimeMs:this._barsets[0].firstLoadedTimeMs,emptyBarCount:this._barsets[0].emptyBarCount()})}catch(e){if(!(e instanceof b.StudyError))throw e;this.host.onErrorCallback(e.message)}}}C.feed={subscribe(){throw console.error("must be initialized with setupFeed"),new Error("must be initialized with setupFeed")},unsubscribe(){throw console.error("must be initialized with setupFeed"),new Error("must be initialized with setupFeed")}}},23863:(e,t,i)=>{"use strict";const s=i(56570),r=i(19625).getHexColorByName;var n=i(73772).Std;i(42924);var o=i(69146).pivotPointsStandardStudyItem,a=i(24018).volumeProfileVisibleRangeStudyItem,l=i(92245).volumeProfileFixedRangeVbPStudyItem,c=i(92245).volumeProfileFixedRangeBSStudyItem,h=i(68563).spreadStudyItem,d=i(15497).ratioStudyItem,u=i(65498).regressionTrendStudyItem,p=i(46367).anchoredVWAPStudyItem;const _=r("color-ripe-red-400"),m=r("color-minty-green-400"),g=s.enabled("secondary_series_extend_time_scale");JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#9C27B0"}},inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol",isHidden:!0}],id:"Compare@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(1),n.period(this._context))},this.main=function(e,t){
this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),r=n[t(0)](this._context),o=this._context.new_unlimited_var(r);return this._context.select_sym(0),[o.adopt(s,i,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},inputs:{symbol:"",extendTimeScale:!1}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{title:"Open"},high:{title:"High"},low:{title:"Low"},close:{title:"Close"}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0},{id:"extendTimeScale",name:"extendTimeScale",defval:!1,type:"boolean",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4},canExtendTimeScale:!0},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(0),n.period(this._context))},this.main=function(e,t){this._context=e;var i=!g||!0!==t(1),s=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),o=this._context.new_unlimited_var(n.open(this._context)),a=this._context.new_unlimited_var(n.high(this._context)),l=this._context.new_unlimited_var(n.low(this._context)),c=this._context.new_unlimited_var(n.close(this._context));return i?(this._context.select_sym(0),[o.adopt(r,s,1),a.adopt(r,s,1),l.adopt(r,s,1),c.adopt(r,s,1)]):[o.get(0),a.get(0),l.get(0),c.get(0)]}}},{name:"Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:50,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"}},palettes:{volumePalette:{colors:{0:{color:_,width:1,style:0},1:{color:m,width:1,style:0}}}},inputs:{showMA:!1,length:20,col_prev_close:!1,symbol:"",smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"},{id:"smoothedMA",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0},smoothedMA:{title:"Smoothed MA",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Falling"},1:{name:"Growing"}}}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"showMA",name:"show MA",defval:!1,type:"bool",isHidden:!0},{id:"length",name:"MA Length",defval:20,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["vol_ma"]},{defval:!1,id:"col_prev_close",name:"Color based on previous close",type:"bool"},{id:"smoothingLine",name:"Smoothing Line",
defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Volume@tv-basicstudies-1",format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),n.period(this._context))},this.f_0=function(e,t){return n.gt(e,t)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=n.volume(this._context),s=n.open(this._context),r=n.close(this._context),o=this._context.new_var(this._context.symbol.time),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(this._input(2)+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=this._context.new_var(n.volume(this._context)),d=this._context.new_var(n.open(this._context)),u=this._context.new_var(n.close(this._context));i=h.adopt(c,o,1),s=d.adopt(c,o,1),r=u.adopt(c,o,1),this._context.select_sym(0)}var p,_,m=this._context.new_var(i),g=n.sma(m,this._input(2),this._context),f=this._context.new_var(g),v=this._context.new_var(r);return p=v.get(1)&&this._input(3)?this.f_0(v.get(1),r):this.f_0(s,r),"EMA"===a?_=n.ema(f,l,this._context):"WMA"===a?_=n.wma(f,l,this._context):"SMA"===a&&(_=n.sma(f,l,this._context)),[i,p,g,_]}}},{name:"ZigZag",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Zig Zag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"float",min:.001,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),r=i/100,o=Math.ceil(s/2);return[n.zigzag(r,o,this._context),n.zigzagbars(r,o,this._context)]}}},{name:"Sessions",metainfo:{_metainfoVersion:52,defaults:{graphics:{vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}},backgrounds:{preMarket:{color:"#FF9800",transparency:92,visible:!0},postMarket:{color:"#2196F3",transparency:92,visible:!0}}},linkedToSeries:!0},description:"Sessions",graphics:{vertlines:{sessBreaks:{name:"Session Break",halign:"left"}},backgrounds:{preMarket:{name:"Pre market"},postMarket:{name:"Post market"}}},id:"Sessions@tv-basicstudies-1",inputs:[],is_hidden_study:!0,is_price_study:!0,name:"Sessions@tv-basicstudies",palettes:{},plots:[],shortDescription:"Sessions",format:{type:"inherit"}},constructor:function(){function e(e,t){return{id:e,index:e,extendBottom:!0,extendTop:!0}}function t(e){return{id:e.start,start:e.start,stop:e.stop}}this.init=function(){this._times=[]
},this._getVerticalLineData=function(t){return n.selectSessionBreaks(t,this._times).map(e)},this._getPreAndPostMarketBackgroundsData=function(e){const i=n.selectPreAndPostMarketTimes(e,this._times);return{preMarket:i.preMarket.map(t),postMarket:i.postMarket.map(t)}},this.main=function(e,t){if(n.isdwm(e))return null;var i=n.time(e);if(isNaN(i))return null;var s=this._times.length;if(0!==s&&this._times[s-1]===i||this._times.push(i),!e.symbol.isLastBar||!e.symbol.isNewBar)return null;var r=this._getVerticalLineData(e),o=this._getPreAndPostMarketBackgroundsData(e);return 0===r.length&&0===o.preMarket.length&&0===o.postMarket?null:{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{vertlines:[{styleId:"sessBreaks",data:r}],backgrounds:[{styleId:"preMarket",data:o.preMarket},{styleId:"postMarket",data:o.postMarket}]},erase:[{action:"all"}]}}}}}},{name:"SuperTrend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:3,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_2:{linestyle:0,linewidth:3,plottype:"shape_arrow_up",trackPrice:!1,location:"BelowBar",transparency:35,visible:!0,color:"#00FF00"},plot_3:{linestyle:0,linewidth:3,plottype:"shape_arrow_down",trackPrice:!1,location:"AboveBar",transparency:35,visible:!0,color:"#FF0000"}},palettes:{palette_0:{colors:{0:{color:"#008000",width:3,style:0},1:{color:"#800000",width:3,style:0}}}},inputs:{in_0:10,in_1:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"},{id:"plot_2",type:"shapes"},{id:"plot_3",type:"shapes"}],styles:{plot_0:{title:"SuperTrend",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Up Arrow",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Down Arrow",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"SuperTrend",shortDescription:"SuperTrend",is_price_study:!0,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:100},{id:"in_1",name:"Factor",defval:3,type:"float",min:1,max:100}],id:"SuperTrend@tv-basicstudies-1",scriptIdPart:"",name:"SuperTrend",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0),s=t(1),[r,o]=n.supertrend(s,i,e),a=e.new_var(o).get(1);return[r,-1===o?0:1,-1===o&&a!==o?1:NaN,1===o&&a!==o?1:NaN]}}},o,a,l,c,h,d,u,p])},73772:(e,t,i)=>{"use strict";i.d(t,{Std:()=>h});var s=i(14381),r=i(2740);class n{constructor(e,t,i){var s,r;this._timezone=e,this._preMarketSessionEntries=null!==(s=null==t?void 0:t.entries())&&void 0!==s?s:[],this._postMarketSessionEntries=null!==(r=null==i?void 0:i.entries())&&void 0!==r?r:[]}getPreAndPostMarketTimes(e){if(0===e.length)return{preMarket:[],postMarket:[]};const t=[],i=[];let s=null,n=null,o=e[0],a=(0,r.utc_to_cal)(this._timezone,o);this._isInPreMarketSession(a)&&(n=o),this._isInPostMarketSession(a)&&(s=o);for(let l=1;le?1:0,h={};function d(e,t,i,s,r){let n=r,o=0;if(isNaN(e.get(t-1)))return{index:NaN,value:NaN};for(let i=0;ie.symbol.index+1,h.nz=(e,t=0)=>isFinite(e)?e:t,h.na=function(e){return 0===arguments.length?NaN:isNaN(e)?1:0},h.isZero=e=>Math.abs(e)<=1e-10?1:0,h.toBool=e=>isFinite(e)&&!h.isZero(e),h.eq=(e,t)=>h.isZero(e-t),h.neq=(e,t)=>c(!h.eq(e,t)),h.ge=(e,t)=>c(h.isZero(e-t)||e>t),h.gt=(e,t)=>c(!h.isZero(e-t)&&e>t),h.lt=(e,t)=>c(!h.isZero(e-t)&&ec(h.isZero(e-t)||eisNaN(e)||isNaN(t)?NaN:h.isZero(e)||h.isZero(t)?0:1,h.or=(e,t)=>isNaN(e)||isNaN(t)?NaN:h.isZero(e)&&h.isZero(t)?0:1,h.not=e=>isNaN(e)?NaN:h.isZero(e)?1:0,h.eps=()=>l,h.greaterOrEqual=(e,t,i)=>t-e<(i||l),h.lessOrEqual=(e,t,i)=>e-t<(i||l),h.equal=(e,t,i)=>Math.abs(e-t)<(i||l),h.greater=(e,t,i)=>e-t>(i||l),h.less=(e,t,i)=>t-e>(i||l),h.compare=(e,t,i)=>h.equal(e,t,i)?0:h.greater(e,t,i)?1:-1,h.max=Math.max,h.min=Math.min,h.pow=Math.pow,h.abs=Math.abs,h.log=Math.log,h.log10=e=>Math.log(e)/Math.LN10,h.sqrt=Math.sqrt,h.sign=e=>isNaN(e)?NaN:h.isZero(e)?0:e>0?1:-1,h.exp=Math.exp,h.sin=Math.sin,h.cos=Math.cos,h.tan=Math.tan,h.asin=Math.asin,h.acos=Math.acos,h.atan=Math.atan,h.floor=Math.floor,h.ceil=Math.ceil,h.round=Math.round,h.avg=(...e)=>{if(2===e.length)return(e[0]+e[1])/2;let t=0;for(let i=0;ie.symbol.open,h.high=e=>e.symbol.high,h.low=e=>e.symbol.low,h.close=e=>e.symbol.close,h.hl2=e=>(e.symbol.high+e.symbol.low)/2,h.hlc3=e=>(e.symbol.high+e.symbol.low+e.symbol.close)/3,h.ohlc4=e=>(e.symbol.open+e.symbol.high+e.symbol.low+e.symbol.close)/4,h.volume=e=>e.symbol.volume,h.updatetime=e=>e.symbol.updatetime,h.time=e=>e.symbol.bartime(),h.period=e=>e.symbol.period,h.tickerid=e=>e.symbol.tickerid,h.currencyCode=e=>e.symbol.currencyCode,h.unitId=e=>e.symbol.unitId,h.ticker=e=>e.symbol.ticker,h.interval=e=>e.symbol.interval,h.isdwm=e=>e.symbol.isdwm(),h.isintraday=e=>!e.symbol.isdwm(),h.isdaily=e=>"D"===e.symbol.resolution,h.isweekly=e=>"W"===e.symbol.resolution,h.ismonthly=e=>"M"===e.symbol.resolution,h.year=(e,t)=>h.timepart(e.symbol,r.YEAR,t),h.month=(e,t)=>h.timepart(e.symbol,r.MONTH,t),
h.weekofyear=(e,t)=>h.timepart(e.symbol,r.WEEK_OF_YEAR,t),h.dayofmonth=(e,t)=>h.timepart(e.symbol,r.DAY_OF_MONTH,t),h.dayofweek=(e,t)=>h.timepart(e.symbol,r.DAY_OF_WEEK,t),h.hour=(e,t)=>h.timepart(e.symbol,r.HOUR_OF_DAY,t),h.minute=(e,t)=>h.timepart(e.symbol,r.MINUTE,t),h.second=(e,t)=>h.timepart(e.symbol,r.SECOND,t),h.add_days_considering_dst=(e,t,i)=>r.add_days_considering_dst(r.get_timezone(e),t,i),h.add_years_considering_dst=(e,t,i)=>r.add_years_considering_dst(r.get_timezone(e),t,i),h.selectSessionBreaks=(e,t)=>{if(h.isdwm(e)||void 0===e.symbol.session.timezone)return[];const i=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null),r=[],n=t.length;if(i.moveTo(t[n-1]),1===n&&i.startOfBar(0)===t[0])r.push(t[0]);else{for(let e=n-2;e>=0;--e){const s=t[e];if(s>=i.startOfBar(0))continue;i.moveTo(s);const n=t[e+1];r.push(n)}r.reverse()}return r},h.selectPreAndPostMarketTimes=(e,t)=>{var i,s;if(h.isdwm(e)||void 0===e.symbol.session.timezone)return{preMarket:[],postMarket:[]};return new n(e.symbol.session.timezone,null!==(i=e.symbol.preMarketSubsession)&&void 0!==i?i:null,null!==(s=e.symbol.postMarketSubsession)&&void 0!==s?s:null).getPreAndPostMarketTimes(t)},h.iff=(e,t,i)=>h.not(e)?i:t,h.rising=(e,t)=>{for(let i=1;ie.get(0))return 0;return 1},h.falling=(e,t)=>{for(let i=1;i{const s=r.utc_to_cal(e.session.timezone,i||e.bartime());return r.get_part(s,t)},h.rsi=(e,t)=>h.isZero(t)?100:h.isZero(e)?0:100-100/(1+e/t),h.sum=(e,t,i)=>{const s=i.new_var(),r=h.nz(e.get())+h.nz(s.get(1))-h.nz(e.get(t));return s.set(r),r},h.sma=(e,t,i)=>{const s=h.sum(e,t,i);return h.na(e.get(t-1))?NaN:s/t},h.smma=(e,t,i)=>{const s=i.new_var(e),r=h.sma(s,t,i),n=i.new_var(),o=(n.get(1)*(t-1)+e)/t;return n.set(h.na(n.get(1))?r:o),n.get(0)},h.rma=(e,t,i)=>{const s=h.sum(e,t,i),r=t-1,n=e.get(r),o=i.new_var(),a=o.get(1),l=e.get(),c=h.na(n)?NaN:h.na(a)?s/t:(l+a*r)/t;return o.set(c),c},h.fixnan=(e,t)=>{const i=t.new_var();return isNaN(e)?i.get(1):(i.set(e),e)},h.tr=(e,t)=>{let i=t.new_var(h.close(t)).get(1);return e&&isNaN(i)&&(i=h.close(t)),h.max(h.max(h.high(t)-h.low(t),h.abs(h.high(t)-i)),h.abs(h.low(t)-i))},h.atr=(e,t)=>{const i=t.new_var(h.tr(void 0,t));return h.rma(i,e,t)},h.ema=(e,t,i)=>{const s=h.sum(e,t,i),r=i.new_var(),n=e.get(0),o=e.get(t-1),a=r.get(1),l=h.na(o)?NaN:h.na(a)?s/t:2*(n-a)/(t+1)+a;return r.set(l),l},h.wma=(e,t,i)=>{let s=0;for(let i=t=Math.round(t);i>=0;i--){s+=(t-i)*e.get(i)}return 2*s/(t*(t+1))},h.vwma=(e,t,i)=>{const s=i.new_var(h.volume(i)),r=i.new_var(e.get(0)*h.volume(i));return h.sma(r,t,i)/h.sma(s,t,i)},h.swma=(e,t)=>(e.get(0)+2*e.get(1)+2*e.get(2)+e.get(3))/6,h.supertrend=(e,t,i)=>{const s=h.atr(t,i),r=i.new_var(s).get(1),n=h.hl2(i);let o=n+s*e,a=n-s*e;const l=h.close(i),c=i.new_var(l).get(1),d=i.new_var(),u=h.nz(d.get(1)),p=i.new_var(),_=h.nz(p.get(1));a=h.gt(a,u)||h.lt(c,u)?a:u,d.set(a),o=h.lt(o,_)||h.gt(c,_)?o:_,p.set(o);let m=h.na();const g=i.new_var(),f=g.get(1);m=h.na(r)?1:f===_?l>o?-1:1:l-d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).index,h.lowest=(e,t,i)=>d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).value,h.highestbars=(e,t,i)=>-d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).index,h.highest=(e,t,i)=>d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).value,h.cum=(e,t)=>{const i=t.new_var(),s=h.nz(i.get(1))+e;return i.set(s),s},h.accdist=e=>{const t=h.high(e),i=h.low(e),s=h.close(e),r=h.volume(e);return h.cum(s===t&&s===i||t===i?0:r*(2*s-i-t)/(t-i),e)},h.correlation=(e,t,i,s)=>{const r=h.sma(e,i,s),n=h.sma(t,i,s),o=s.new_var(e.get()*t.get());return(h.sma(o,i,s)-r*n)/Math.sqrt(h.variance2(e,r,i)*h.variance2(t,n,i))},h.stoch=(e,t,i,s,r)=>{const n=h.highest(t,s,r),o=h.lowest(i,s,r);return h.fixnan(100*(e.get()-o)/(n-o),r)},h.tsi=(e,t,i,s)=>{const r=s.new_var(h.change(e)),n=s.new_var(h.abs(h.change(e))),o=s.new_var(h.ema(r,i,s)),a=s.new_var(h.ema(n,i,s));return h.ema(o,t,s)/h.ema(a,t,s)},h.cross=(e,t,i)=>{if(isNaN(e)||isNaN(t))return!1;const s=i.new_var((r=e-t)<0?-1:0===r?0:1);var r;return!isNaN(s.get(1))&&s.get(1)!==s.get()},h.linreg=(e,t,i)=>{let s=0,r=0,n=0,o=0;for(let i=0;i{const r=s.new_var(),n=s.new_var(),o=s.new_var(),a=h.high(s),l=h.low(s),c=h.close(s),d=s.new_var(a),u=s.new_var(l),p=s.new_var(c),_=s.new_var();let m=_.get(1),g=n.get(1),f=o.get(1);n.set(g),o.set(f);let v=!1;const y=u.get(1),S=u.get(2),b=d.get(1),w=d.get(2),C=p.get(),P=p.get(1);2===h.n(s)&&(h.greater(C,P)?(r.set(1),o.set(d.get()),m=y,f=d.get()):(r.set(-1),o.set(u.get()),m=b,f=u.get()),v=!0,n.set(e),g=e);let x=m+g*(f-m);return 1===r.get()?h.greater(x,u.get())&&(v=!0,r.set(-1),x=Math.max(d.get(),o.get()),o.set(u.get()),n.set(e)):h.less(x,d.get())&&(v=!0,r.set(1),x=Math.min(u.get(),o.get()),o.set(d.get()),n.set(e)),v||(1===r.get()?h.greater(d.get(),o.get())&&(o.set(d.get()),n.set(Math.min(n.get()+t,i))):h.less(u.get(),o.get())&&(o.set(u.get()),n.set(Math.min(n.get()+t,i)))),1===r.get()?(x=Math.min(x,y),h.n(s)>2&&(x=Math.min(x,S))):(x=Math.max(x,b),h.n(s)>2&&(x=Math.max(x,w))),_.set(x),x},h.alma=(e,t,i,s)=>{const r=Math.floor(i*(t-1)),n=t/s*(t/s),o=[];let a=0;for(let e=0;ee.get()-e.get(1),h.roc=(e,t)=>{const i=e.get(t);return 100*(e.get()-i)/i},h.dev=(e,t,i)=>{const s=h.sma(e,t,i);return h.dev2(e,t,s)},h.dev2=(e,t,i)=>{let s=0;for(let r=0;r{const s=h.variance(e,t,i);return h.sqrt(s)},h.variance=(e,t,i)=>{const s=h.sma(e,t,i);return h.variance2(e,s,t)},h.variance2=(e,t,i)=>{let s=0;for(let r=0;r{if(h.na(e.get(t-1)))return NaN;let i=0;const s=e.get();for(let r=1;r{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null);return e=>t.indexOfBar(e)===o.SessionStage.POST_SESSION&&(t.moveTo(e),!0)},h.createNthBarInSessionCheck=e=>{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null);return(e,i)=>(t.indexOfBar(e)===o.SessionStage.POST_SESSION&&t.moveTo(e),t.indexOfBar(e)===i)},h.error=e=>{throw new a.StudyError(e)},h.dmi=(e,t,i)=>{const s=i.new_var(h.high(i)),r=i.new_var(h.low(i)),n=h.change(s),o=-h.change(r),a=i.new_var(h.na(n)||h.na(o)?h.na():h.and(h.gt(n,o),h.gt(n,0))?n:0),l=i.new_var(h.na(o)?h.na():h.and(h.gt(o,n),h.gt(o,0))?o:0),c=h.atr(e,i),d=h.fixnan(100*h.rma(a,e,i)/c,i),u=h.fixnan(100*h.rma(l,e,i)/c,i);let p=d+u;h.isZero(p)&&(p+=1);const _=Math.abs(d-u)/p*100,m=i.new_var(_),g=h.rma(m,t,i),f=i.new_var(g);return[d,u,_,g,(f.get(0)+f.get(e-1))/2]},h.zigzag=(e,t,i)=>new m(e,t,i).lastPrice(),h.zigzagbars=(e,t,i)=>{const s=new m(e,t,i);return-1===s.lastIndex()?NaN:s.lastIndex()-h.n(i)};const u=0,p=1;class _{constructor(e,t,i,s,r){this._areaRight=e,this._areaLeft=t,this._pivotType=i,this._series=s,this._currentIndex=r.new_var(0),this._currentValue=r.new_var(NaN),this._pivotIndex=r.new_var(-1),this._index=h.n(r),this._isNewBar=r.symbol.isNewBar;const n=this._currentIndex.get(1),o=this._currentValue.get(1),a=this._pivotIndex.get(1);this._index>1&&(this._currentIndex.set(n),this._currentValue.set(o),this._pivotIndex.set(a))}isPivotFound(){return-1!==this._pivotIndex.get()}pivotIndex(){return this._pivotIndex.get()}currentValue(){return this._currentValue.get()}pivotType(){return this._pivotType}reset(){this._currentValue.set(NaN),this._currentIndex.set(0),this._pivotIndex.set(-1)}isRightSideOk(e){return e-this._currentIndex.get()===this._areaRight}isViolate(e,t){if(e<1||isNaN(this._currentValue.get()))return!0;const i=this._series.get(this._index-e);return!!isNaN(i)||(i===this._currentValue.get()?t:this._pivotType===p?i>this._currentValue.get():ithis._areaRight}update(){if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(-1===this._pivotIndex.get()){let e=!0;for(let t=0;t1&&this.addPivot(n,o,a),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}addPivot(e,t,i){this._lastIndex.set(e),this._lastVal.set(t),this._lastType.set(i)}updatePivot(e,t){this._lastIndex.set(e),this._lastVal.set(t)}lastPrice(){return this._lastVal.get()}lastIndex(){return this._lastIndex.get()}addPoint(e,t,i){if(isNaN(this._lastVal.get()))return void this.addPivot(e,t,i);const s=this._lastVal.get();if(this._lastType.get()===i){return void((i===p?t>s:tthis._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}},46367:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>o});const s={_metainfoVersion:51,description:"Anchored VWAP",shortDescription:"Anchored VWAP",format:{type:"inherit"},id:"AnchoredVWAP@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,defaults:{areaBackground:{backgroundColor:"#4caf50",fillBackground:!0,transparency:95},filledAreasStyle:{Background_1:{fillType:void 0,color:"#4caf50",transparency:95,visible:!0}},inputs:{start_time:0,"Bands Calculation Mode":"Standard Deviation",bands_multiplier:1,bands_multiplier_2:2,bands_multiplier_3:3,calculate_stDev:!0,calculate_stDev_2:!1,calculate_stDev_3:!1,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15},LowerBand:{display:15,color:"#4caf50",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},LowerBand_2:{display:15,color:"#808000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},LowerBand_3:{display:15,color:"#00897b",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand:{display:15,color:"#4caf50",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand_2:{display:15,color:"#808000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand_3:{display:15,color:"#00897b",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:Number.MAX_SAFE_INTEGER,min:-Number.MAX_SAFE_INTEGER,name:"Start time",type:"time"},{defval:"Standard Deviation",group:"Bands Settings",id:"Bands Calculation Mode",name:"Bands Calculation Mode",options:["Standard Deviation","Percentage"],tooltip:"Determines the units used to calculate the distance of the bands. When 'Percentage' is selected, a multiplier of 1 means 1%.",type:"text",display:15},{defval:!0,group:"Bands Settings",id:"calculate_stDev",inline:"band_1",name:" ",type:"bool",display:0},{defval:1,group:"Bands Settings",id:"bands_multiplier",inline:"band_1",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #1",step:.5,type:"float",display:15},{defval:!1,group:"Bands Settings",id:"calculate_stDev_2",inline:"band_2",name:" ",type:"bool",display:0},{defval:2,group:"Bands Settings",
id:"bands_multiplier_2",inline:"band_2",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #2",step:.5,type:"float",display:15},{defval:!1,group:"Bands Settings",id:"calculate_stDev_3",inline:"band_3",name:" ",type:"bool",display:0},{defval:3,group:"Bands Settings",id:"bands_multiplier_3",inline:"band_3",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #3",step:.5,type:"float",display:15},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"},{id:"UpperBand",type:"line"},{id:"LowerBand",type:"line"},{id:"UpperBand_2",type:"line"},{id:"LowerBand_2",type:"line"},{id:"UpperBand_3",type:"line"},{id:"LowerBand_3",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"},LowerBand:{histogramBase:0,title:"Lower Band #1"},LowerBand_2:{histogramBase:0,title:"Lower Band #2"},LowerBand_3:{histogramBase:0,title:"Lower Band #3"},UpperBand:{histogramBase:0,title:"Upper Band #1"},UpperBand_2:{histogramBase:0,title:"Upper Band #2"},UpperBand_3:{histogramBase:0,title:"Upper Band #3"}},filledAreas:[{title:"Background #1",id:"Background_1",objAId:"UpperBand",objBId:"LowerBand",type:"plot_plot"}],area:[{name:"UpperBand",visible:!0},{name:"LowerBand",visible:!0}]};var r=i(50151),n=i(73772);const o={name:"Anchored VWAP",metainfo:s,constructor:class{constructor(){this._isNewSession=null,this._firstBarTime=0}init(e,t){this._firstBarTime=t(0),this._isNewSession=null}main(e,t,i){if(void 0===i)return[NaN];(0,r.assert)(e.symbol.time===i.time);const s=i.time;if(s&&s{"use strict";i.d(t,{OHLCV:()=>r});var s=i(73772);class r{main(e){return[s.Std.open(e),s.Std.high(e),s.Std.low(e),s.Std.close(e),s.Std.volume(e),s.Std.updatetime(e),void 0,void 0,void 0,void 0]}}},69146:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>p});var s,r,n=i(85049),o=i(67153),a=i(73772);!function(e){e[e.TRADITIONAL=0]="TRADITIONAL",e[e.FIBONACCI=1]="FIBONACCI",e[e.WOODIE=2]="WOODIE",e[e.CLASSIC=3]="CLASSIC",e[e.DEMARK=4]="DEMARK",e[e.CAMARILLA=5]="CAMARILLA",e[e.FLOOR=6]="FLOOR"}(s||(s={})),function(e){e.AUTO="Auto",e.DAILY="Daily",e.WEEKLY="Weekly",e.MONTHLY="Monthly",e.YEARLY="Yearly"}(r||(r={}));class l{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,
this.startIndex__t=NaN,this.endIndex__t=NaN}}class c{constructor(){this.pivots=[]}}function h(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function d(e,t){if(a.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()=1&&t.multiplier()<=15?"1D":"1W";case n.ResolutionKind.Seconds:case n.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily":return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const p={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla","Floor"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:1,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN,this._mainSeriesTimes=new Set}init(e,t){const i=t(0),s=t(1),r=t(2),n=t(3);this._data=new c,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=n,this._pivTimeFrame=r,this._isValidResolution=function(e,t){return!(a.Std.isdaily(e)&&"Daily"===t||a.Std.isweekly(e)&&("Daily"===t||"Weekly"===t)||a.Std.ismonthly(e)&&("Daily"===t||"Weekly"===t||"Monthly"===t))}(e,this._pivTimeFrame),this._isValidResolution||a.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=u(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,o.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,
a.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),this._mainSeriesTimes=new Set,e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e,t,i){if(!this._isValidResolution)return null;if(e.is_main_symbol(i))return!isNaN(e.symbol.time)&&isNaN(e.symbol.projectionTime)&&this._mainSeriesTimes.add(e.symbol.time),isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const s=e.new_var(a.Std.open(e)),r=e.new_var(a.Std.high(e)),n=e.new_var(a.Std.low(e)),o=e.new_var(a.Std.close(e)),c=e.new_var(a.Std.time(e)),h=this._data,u=s.get(0),p=c.get(0),_=s.get(1),m=r.get(1),g=n.get(1),f=o.get(1),v=e.symbol.isLastBar;if(0!==h.pivots.length&&e.symbol.isNewBar){const e=h.pivots[h.pivots.length-1];e.endIndex__t!==p&&(e.endIndex__t=p)}if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const y=function(e,t,i,s,r,n,o,c){const h=new l;let d=NaN;const u=i-s;switch(c){case 0:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=2*d+(i-2*s),h.s3=2*d-(2*i-s),h.r4=3*d+(i-3*s),h.s4=3*d-(3*i-s),h.r5=4*d+(i-4*s),h.s5=4*d-(4*i-s);break;case 1:d=(i+s+r)/3,h.p=d,h.r1=d+.382*u,h.s1=d-.382*u,h.r2=d+.618*u,h.s2=d-.618*u,h.r3=d+u,h.s3=d-u;break;case 2:d=(i+s+2*e)/4,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=i+2*(d-s),h.s3=s-2*(i-d),h.r4=h.r3+u,h.s4=h.s3-u;break;case 3:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=d+2*u,h.s3=d-2*u,h.r4=d+3*u,h.s4=d-3*u;break;case 4:let n=NaN;n=a.Std.equal(t,r)?i+s+2*r:a.Std.greater(r,t)?2*i+s+r:2*s+i+r,d=n/4,h.p=d,h.r1=n/2-s,h.s1=n/2-i;break;case 5:d=(i+s+r)/3,h.p=d,h.r1=r+1.1*u/12,h.s1=r-1.1*u/12,h.r2=r+1.1*u/6,h.s2=r-1.1*u/6,h.r3=r+1.1*u/4,h.s3=r-1.1*u/4,h.r4=r+1.1*u/2,h.s4=r-1.1*u/2;break;case 6:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=d-h.s1+h.r2,h.s3=2*d-(2*i-s);break;default:throw new Error("Unknown kind")}return h.startIndex__t=n,h.endIndex__t=o,h}(u,_,m,g,f,p,d(e,p),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(h.pivots=[]),h.pivots.push(y),h.pivots.length>this._historicalPivotsToKeep&&h.pivots.shift(),v?this._createResponse():null}_createResponse(){if(0===this._data.pivots.length||this._mainSeriesTimes.size<=1)return null;if(this._mainSeriesTimes.size<=this._data.pivots.length)return null;const e=Array.from(this._mainSeriesTimes).sort(((e,t)=>e-t)),t=new c;let i=0;for(let s=0;s=r.endIndex__t)break;t>=r.startIndex__t&&(n=!0,o++),i++}if(n){let n=!0;if(s>0&&t.pivots.length>0){const i=t.pivots[t.pivots.length-1];if(i.endIndex__t===r.startIndex__t){const t=e.filter((e=>e>=i.startIndex__t&&e<=i.endIndex__t));1===o&&t[t.length-1]===r.startIndex__t&&(n=!1)}}n?t.pivots.push({...r}):i=a}else t.pivots.length>0&&(t.pivots[t.pivots.length-1].endIndex__t=r.endIndex__t)}
return 0===t.pivots.length&&a.Std.error("Not enough data to calculate all pivot points"),{nonseries:!0,type:"non_series_data",data:{data:t}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},15497:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(62473);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},65498:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(73772);function r(e,t,i){const r={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,r=0,n=0;for(let t=0;tn&&(n=u),u=d-i[s],u>o&&(o=u),u=e[s];const _=u-r.average,m=d-p;u-=d,a+=u*u,l+=_*_,c+=m*m,h+=_*m,d+=r.slope}r.stdDev=Math.sqrt(a/(0===u?1:u)),r.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),r.upDev=n,r.downDev=o}(e,t,i,r)),r}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){
const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),o=e.new_unlimited_var(s.Std.high(e)),a=e.new_unlimited_var(s.Std.low(e)),l=e.new_unlimited_var(s.Std[i](e));if(!e.symbol.isLastBar)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),p=t(4),_=t(5),m=n.indexOf(p),g=n.indexOf(_),f=[],v=[],y=[],S=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),y.push(a.get(e)),S.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(S,v,y)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,r,n,o,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*r:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=o}}}},62473:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>l,spreadRatioDefaults:()=>c,spreadRatioFilledAreas:()=>_,spreadRatioInputs:()=>h,spreadRatioPalettes:()=>p,spreadRatioPlots:()=>d,spreadRatioStyles:()=>u});var s=i(19625),r=i(94113),n=i(73772),o=i(19063);const a="rgba(0, 0, 0, 0)";class l{init(e,t){e.new_sym(t(1),n.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,s=n.Std[this._source](e);e.select_sym(1);const r=n.Std[this._source](e),o=e.new_unlimited_var(r),a=e.new_unlimited_var(e.symbol.time);if(e.select_sym(0),isNaN(i))return null;let l=a.indexOf(i);-1!==l&&a.get(l)!==i&&(l=-1);const c=l<0?NaN:o.get(l),h=this._doCalculation(this._scaleFactor1,s,this._scaleFactor2,c);return[h,0,n.Std.ge(h,0),n.Std.lt(h,0)]}}const c={styles:{plot1:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:35,color:"#800080",display:15},plotBaseline:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0,color:a,display:0}},palettes:{negativePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-ripe-red-500"),.5),style:0,width:0},{color:a,style:0,width:0}]},positivePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-minty-green-500"),.5),style:0,width:0},{color:a,style:0,width:0}]}},filledAreasStyle:{negativeFill:{color:"",transparency:0,visible:!0,fillType:void 0},positiveFill:{color:"",transparency:0,visible:!0,fillType:void 0}},precision:2,inputs:{source:"close",symbol2:""}},h=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],d=[{id:"plot1",type:"line"},{id:"plotBaseline",type:"line"},{id:"plotNegativeFill",type:"colorer",target:"negativeFill",palette:"negativePalette"},{id:"plotPositiveFill",type:"colorer",target:"positiveFill",palette:"positivePalette"}],u={plot1:{title:"Plot",histogramBase:0},plotBaseline:{title:"Baseline",isHidden:!0}},p={negativePalette:{
valToIndex:{0:0,1:1},colors:[{name:"Color"}]},positivePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]}},_=[{id:"negativeFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Negative fill",palette:"negativePalette",fillToIntersection:!0},{id:"positiveFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Positive fill",palette:"positivePalette",fillToIntersection:!0}]},68563:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(62473);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,palettes:s.spreadRatioPalettes,filledAreas:s.spreadRatioFilledAreas,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},56209:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(73772);class r{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},43789:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>g});var s=i(50151),r=i(9859),n=i(85049),o=i(41978);class a extends o.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t({index:e.index,offset:e.offset,level:e.level})))}}}class _ extends o.GraphicsObj{constructor(e,t,i,s,r=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(r,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}!function(e){e[e.AssertAccuracy=.05]="AssertAccuracy"}(l||(l={})),function(e){e[e.START=0]="START",e[e.END=1]="END"}(c||(c={}));class m{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class g{
constructor(e,t,i,r,n,o,a,l,c,d,u,p,_,g,f){this._freezedBoxes=new h.GraphicsList,this._freezedHists=new h.GraphicsList,this._freezedPocs=new h.GraphicsList,this._freezedVAHists=new h.GraphicsList,this._currentHistsGr=new h.GraphicsList,this._currentVAHistsGr=new h.GraphicsList,this._currentHists=[],this._currentHistsMap=new m,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),this._numOfSubHists=e,this._outHists=r,this._outBoxLines=n,this._outPocLines=o,this._extendPocLeftRight=a,this._outVAHists=l,this._vaVolumePercent=c,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=p,this._rightBoxTimeMutable=_,this._actualRightBoxTime=null!=f?f:_,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=d.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),
d.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,d.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),d.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)d.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):d.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const r=e[s];d.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new _(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),r=0,n=null;for(;d.Std.lessOrEqual(i+r,t)&&(i+=r,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,
-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEndthis._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],r=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new u(r,e)),i.push(new u(r,t)),i.push(new u(n,t)),i.push(new u(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc()),this._updateCurrentBox()}_applyUpdateToCurrentResults(e,t){t&&null!==this._prevRtBar&&this._addHistoryBarToHistogram(this._prevRtBar,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,-1),this._addHistoryBarToHistogram(e,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,1),this._updateLastBarTimeInHistogram(this._currentHists)}_addHistoryBarToHistogram(e,t,i,r,n){(0,
s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");const o=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,c=e.isUp,h=(0,s.ensureNotNull)(this._rowsLayout);h.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,o,a);const u=h.rowWidth();if(!d.Std.greater(u,0))return;h.calculate();const p=h.getIndexLowVbP(),_=h.getIndexHighVbP(),m=h.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*l,c,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,h=(t+1)*u+m,d=this._rowCoeff(s,h,o,a),p=d*l;e+=d,this._updateResult({start:s,end:h},n*p,c,i,r)}(0,s.assert)(d.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,r,n){const o=this._createRates(i,t);(0,s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),c=(0,s.ensureNotNull)(this._actualRightBoxTime);let h=n.get(e);if(void 0===h)h=new a(this,e.start,e.end,o,l,c),n.set(e,h),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(h),g._addInOrder(h,r,0,r.length,((e,t)=>{let i=d.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=d.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:d.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t0?g._addInOrder(e,t,o+1,s,n):t.splice(o,0,e)}}},7370:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>_,maxHHistItems:()=>u,numOfSubHists:()=>p});var s,r=i(56570),n=i(85049);!function(e){e[e.NumberOfRows=0]="NumberOfRows",e[e.TicksPerRow=1]="TicksPerRow"}(s||(s={}));class o{constructor(e,t){this._minTick=NaN,this._minPrice=NaN,this._maxPrice=NaN,this._low=NaN,this._high=NaN,this._startPrice=NaN,this._indexLowVbP=NaN,this._indexHighVbP=NaN,this._rowSize=e,this._type=t}init(e,t,i,s,r){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=r}getStartPrice(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){return this._type}}class a extends o{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class l extends o{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var c,h=i(73772),d=i(39692);function u(){return 6e3}function p(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:h.Std.error(`Invalid study argument value: ${e}`)}}!function(e){e.VolumeUpDown="Up/Down",e.VolumeTotal="Total",e.VolumeDelta="Delta",e.NumberOfRows="Number Of Rows",e.TicksPerRow="Ticks Per Row"}(c||(c={}));class _{findBasicResolutionForFromTo(e,t,i,s){const o=(0,d.getVolumeProfileResolutionForPeriod)(e.value(),t,i,s),a=n.Interval.parse(o);return r.enabled("charting_library_debug_mode")&&console.log(`${(new Date).toISOString()} Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&h.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new a(t):new l(t)}}},92245:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(50151),r=i(7370),n=i(94113),o=i(9233),a=i(85049),l=i(40878),c=i(45382),h=i(32569),d=i(61923),u=i(62628),p=i(56209),_=i(85904),m=i(43789);class g extends m.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(e,t,i,n,o,a,!1,l,c,(()=>h),d,s,r,!1,u),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function S(e){return{constructor:y,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:_.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"#37a6ef",transparency:94}}},inputs:{first_bar_time:0,last_bar_time:0,rows:24,rowsLayout:"Number Of Rows",subscribeRealtime:!0,vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:o.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:o.HHistLocation.Absolute,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}},polygons:{histBoxBg:{mouseTouchable:!1,name:"Histogram Box",showBorder:!1}}},inputs:[{defval:"Number Of Rows",id:"rowsLayout",name:"Rows Layout",
options:["Number Of Rows","Ticks Per Row"],type:"text"},{defval:24,id:"rows",max:1e6,min:1,name:"Row Size",type:"integer"},{defval:"Up/Down",id:"volume",name:"Volume",options:["Up/Down","Total","Delta"],type:"text"},{defval:0,id:"first_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"First Bar Time",type:"time"},{defval:0,id:"last_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last Bar Time",type:"time"},{defval:70,id:"vaVolume",max:100,min:0,name:"Value Area Volume",type:"integer"},{defval:!0,id:"subscribeRealtime",isHidden:!0,name:"SubscribeRealtime",type:"bool"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}},...e}}}const b=S({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=S({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},11694:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});var s=i(50151),r=i(29981);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,r.upperbound)(this._times,e,((e,t)=>e{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(50151),r=i(7370),n=i(9233),o=i(85049),a=i(40878),l=i(43789),c=i(61923);class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,h,d){super(e,t,i,n,new c.GraphicsList,o,!0,a,l,(()=>h),d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const v={constructor:f,name:"Volume Profile Visible Range",metainfo:{_metainfoVersion:51,id:"VbPVisible@tv-basicstudies-49",description:"Volume Profile Visible Range",shortDescription:"VPVR",format:{type:"volume"},is_price_study:!0,linkedToSeries:!0,palettes:{},inputs:[{id:"rowsLayout",name:"Rows Layout",defval:"Number Of Rows",options:["Number Of Rows","Ticks Per Row"],type:"text"},{id:"rows",name:"Row Size",defval:24,max:1e6,min:1,type:"integer"},{id:"volume",name:"Volume",defval:"Up/Down",options:["Up/Down","Total","Delta"],type:"text"},{id:"first_visible_bar_time",name:"First Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"last_visible_bar_time",name:"Last Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"vaVolume",name:"Value Area Volume",defval:70,max:100,min:0,type:"integer"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],graphics:{hhists:{histBars2:{location:n.HHistLocation.Relative,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:n.HHistLocation.Relative,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}}},defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:0,visible:!0,width:2}}},inputs:{first_visible_bar_time:0,last_visible_bar_time:0,rows:24,rowsLayout:"Number Of Rows",vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0}}},styles:{developingPoc:{histogramBase:0,
title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}}}}},20629:(e,t,i)=>{"use strict";i.d(t,{StudyEngine:()=>r});var s=i(60656);class r{constructor(e){this.runner=new s.ScriptRunner(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}},1452:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});class s extends Error{constructor(e){super(e),this.studyError=!0}}},32569:(e,t,i)=>{"use strict";var s;i.d(t,{EraseAll:()=>n,EraseObj:()=>r,GraphicsCmds:()=>o}),function(e){e.One="one",e.All="all"}(s||(s={}));class r{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class n{primitiveData(){return{action:"all"}}}class o{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},40878:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{constructor(){this._stable=[],this._variable=null,this._owner=null}addStable(e){e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},61923:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(41978),r=i(67908);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);return this._setCachedDataValid(!1),true}addAll(e){this.setOwner(e),this._items.push(...e._items);return this._setCachedDataValid(!1),true}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e)
;return this._setCachedDataValid(!1),true}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,r.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},41978:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(73772);class r{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class o extends r{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new r(e,t,this)}createDoubleField(e,t){return new r(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new o(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let r=0;r{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},62628:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>u});var s=i(32569);class r{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){
const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}var n,o=i(37265),a=i(67908);function l(e){return Boolean(e.isPosted)}!function(e){e[e.New=0]="New",e[e.Posted=1]="Posted",e[e.Erased=2]="Erased"}(n||(n={}));class c{isIgnoredObj(e,t){return c.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return c.isIgnoredObjNaNable(e);const i=e[t];return c.isIgnoredByGeneralRules(e,t)||c.isIgnoredObjNaNable(i)||c.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,a.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,o.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,a.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return l(e)&&e.isPosted()}static isIgnoredObjErased(e){return l(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,o.isArray)(i)&&0===i.length}}class h{isIgnoredObj(e,t){if(void 0===t)return c.isIgnoredObjDefault(e)||c.isIgnoredObjErased(e);const i=e[t];return c.isIgnoredObjDefault(e,t)||c.isIgnoredObjErased(i)}}class d{isIgnoredObj(e,t){if(void 0===t)return c.isIgnoredObjDefault(e)||c.isIgnoredObjErased(e)||c.isIgnoredObjPosted(e);const i=e[t];return c.isIgnoredObjDefault(e,t)||c.isIgnoredObjErased(i)||c.isIgnoredObjPosted(i)}}class u extends class extends class{constructor(e){this._dataObj=new r,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){this._dataObj.disable()}}{constructor(e){super(e),this._snapshotPredicate=new h,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}{constructor(e){super(e),this._updatePredicate=new d,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{
json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},45382:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n,StudyGraphicsData:()=>r});var s=i(50151);class r{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const r=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&r.push(i)}r.length>0&&(t[s]=r,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},42924:(e,t,i)=>{"use strict";const s=i(19625).getHexColorByName,r=i(73772).Std,n=s("color-ripe-red-100"),o=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return r.or(r.and(r.eq(e,t),r.eq(e,i)),r.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(r.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context));return[r.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},
description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(r.open(t)),s=t.new_var(r.high(t)),n=t.new_var(r.low(t)),o=t.new_var(r.close(t)),a=r.abs(s-o.get(1)),l=r.abs(n-o.get(1)),c=r.abs(s-n),h=r.abs(o.get(1)-i.get(1)),d=r.max(a,l),u=r.iff(a>=r.max(l,c),a-.5*l+.25*h,r.iff(l>=r.max(a,c),l-.5*a+.25*h,c+.25*h));return r.iff(0===u,0,(o-o.get(1)+.5*(o-i)+.25*(o.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return r.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return r.gt(e,t)},this.f_1=function(e,t){return r.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=this.f_1(r.close(this._context),r.open(this._context)),l=this._context.new_var(a),c=r.sum(l,i,this._context);return[this.f_2(o,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.alma(a,s,n,o)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,
trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.high(this._context),n=i+1,o=this._context.new_var(s),a=r.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.low(this._context),h=this._context.new_var(c),d=r.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.ohlc4(this._context)]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){var t=this._context.new_var(r.high(this._context)),i=r.change(t),s=this._context.new_var(r.low(this._context)),n=-r.change(s),o=this._context.new_var(r.tr(void 0,this._context)),a=r.rma(o,e,this._context),l=this._context.new_var(r.and(r.gt(i,n),r.gt(i,0))?i:0),c=r.fixnan(100*r.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.and(r.gt(n,i),r.gt(n,0))?n:0);return[c,r.fixnan(100*r.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){var i=this.f_0(e),s=i[0],n=i[1],o=s+n,a=this._context.new_var(r.abs(s-n)/(r.eq(o,0)?1:o));return[100*r.rma(a,t,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),
this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[r.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.change(h);return[c,this.f_1(d)]}}},{name:"Accelerator Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accelerator Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Accelerator Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Accelerator Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=r.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.change(u);return[d,this.f_1(p)]}}},{name:"Balance of Power",
metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0(r.close(this._context),r.open(this._context),r.high(this._context),r.low(this._context))]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c);return[a,this.f_1(a,h),this.f_2(a,h)]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],
filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return r.or(r.and(r.eq(e,t),r.eq(e,i)),r.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t
;var i=this._input(0),s=this.f_0(r.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.volume(this._context),l=this._context.new_var(a),c=r.sum(l,i,this._context);return[this.f_1(o,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.accdist(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{periods:10,rocLookback:10}},styles:{plot_0:{title:"Plot",zorder:1}},bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"rocLookback",type:"integer",name:"Rate of Change Lookback"}],format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.rocLookback=this._input(1)},this.main=function(e,t){this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this.period+this.rocLookback);var i=this._context.new_var(r.high(this._context)-r.low(this._context)),s=this._context.new_var(r.ema(i,this.period,this._context));return[r.roc(s,this.rocLookback)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",
histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:4999},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return e-t*i},this.f_1=function(e,t,i){return e+t*i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=r.high(this._context),a=this._context.new_var(o),l=r.highest(a,i,this._context),c=r.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.highest(_,n,this._context),g=this._context.new_var(p);return[r.lowest(g,n,this._context),m]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:2e3}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e){return r.ge(e,0)?e:0},this.f_1=function(e){return r.ge(e,0)?0:-e},this.f_2=function(e,t){return 100*e/t},this.f_3=function(e,t){return this.f_2(e-t,e+t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.sum(c,i,this._context),d=this._context.new_var(l),u=r.sum(d,i,this._context);return[this.f_3(h,u)]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:"#26C6DA",width:1,style:0},1:{color:"#43A047",width:1,style:0},2:{color:"#A5D6A7",width:1,style:0},3:{color:u,width:1,style:0},4:{color:"#D50000",width:1,style:0},5:{color:"#E91E63",width:1,style:0},6:{color:"#FF6D00",width:1,style:0},7:{color:"#FFB74D",width:1,style:0},8:{color:"#FDD835",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},
4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone",format:{precision:0,type:"price"}},constructor:function(){this.f_0=function(){var e=r.close(this._context),t=r.hlc3(this._context),i=this._context.new_var(r.high(this._context)),s=r.highest(i,30,this._context),n=r.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.sqrt(1+c*c),d=r.round(180*r.acos(1/h)/3.141592653589793),u=r.iff(r.gt(c,0),-d,d),p=r.and(r.gt(u,-2.14),r.le(u,-.71))?7:8,_=r.and(r.gt(u,-3.57),r.le(u,-2.14))?6:p,m=r.and(r.gt(u,-5),r.le(u,-3.57))?5:_,g=r.le(u,-5)?4:m,f=r.and(r.lt(u,2.14),r.ge(u,.71))?3:g,v=r.and(r.lt(u,3.57),r.ge(u,2.14))?2:f,y=r.and(r.lt(u,5),r.ge(u,3.57))?1:v;return[1,r.ge(u,5)?0:y]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return 100*r.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.atr(1,this._context),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.high(this._context),l=this._context.new_var(a),c=r.highest(l,i,this._context),h=r.low(this._context),d=this._context.new_var(h),u=r.lowest(d,i,this._context),p=r.log10(i);return[this.f_0(o,c,u,p)]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,smoothingLine:"SMA",
smoothingLength:20}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:2},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return(e-t)/(.015*i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.hlc3(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.sma(l,s,this._context),h=this._context.new_var(i),d=r.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.ema(p,o,this._context):"WMA"===n?a=r.wma(p,o,this._context):"SMA"===n&&(a=r.sma(p,o,this._context)),[u,a]}}},{name:"Connors RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:3,in_1:2,in_2:100}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"CRSI",histogramBase:0,joinPoints:!1,zorder:1}},description:"Connors RSI",shortDescription:"CRSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"RSI Length",defval:3,type:"integer",min:1},{id:"in_1",name:"UpDown Length",defval:2,type:"integer",min:1},{id:"in_2",name:"ROC Length",defval:100,type:"integer",min:1}],id:"Connors RSI@tv-basicstudies-1",scriptIdPart:"",name:"Connors RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){var e;this.f_1=function(e,t,i){var s=i.new_var(r.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.rma(s,t,i)},this.f_3=(e=0,function(t){var i=t.get(0),s=t.get(1);return e=i===s?0:i>s?r.nz(e)<=0?1:r.nz(e)+1:r.nz(e)>=0?-1:r.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){
this._context=e,this._input=t;var i=r.close(this._context),s=this._context.new_var(i),n=this._input(0),o=this._input(1),a=this._input(2);this._context.setMinimumAdditionalDepth(a);var l=r.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.roc(s,1)),u=r.percentrank(d,a);return[r.avg(l,h,u)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1e12,max:5e3},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:1,max:4999},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:1,max:4999}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e+t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+Math.max(s,n));var o=r.close(this._context),a=this._context.new_var(o),l=r.roc(a,s),c=this._context.new_var(o),h=r.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.wma(u,i,this._context)]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:"",in_1:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coefficient",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"sym",defval:"",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"",name:"Correlation Coeff",format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_unlimited_var(this._context.symbol.time),s=(this._input(0),r.period(this._context),r.close(this._context)),n=this._input(1);this._context.select_sym(1);var o=this._context.new_unlimited_var(this._context.symbol.time),a=r.close(this._context),l=this._context.new_unlimited_var(a);this._context.select_sym(0);var c=l.adopt(o,i,0),h=this._context.new_var(s),d=this._context.new_var(c);return[r.correlation(h,d,n,this._context)]}}},{name:"Correlation - Log",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Correlation - Log@tv-basicstudies-1",
scriptIdPart:"",name:"Correlation - Log",description:"Correlation - Log",shortDescription:"Correlation - Log",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{instrument:"",instrument2:"",periods:25}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"instrument",name:"Instrument 1",type:"symbol",defval:"",confirm:!0},{id:"instrument2",name:"Instrument 2",type:"symbol",defval:"",confirm:!0},{id:"periods",name:"Periods",type:"integer",defval:25}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.period(this._context)),this._context.new_sym(this._input(1),r.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=r.sma(e,i,s),o=r.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.sma(a,i,s)-n*o)/Math.sqrt(r.variance2(e,n,i)*r.variance2(t,o,i))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time);this._context.select_sym(2);var s=this._context.new_var(r.close(this._context)),n=this._context.new_var(r.log(s.get()/s.get(1))),o=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var a=this._context.new_var(this._context.symbol.time),l=this._context.new_var(r.close(this._context)),c=this._context.new_var(r.log(l.get()/l.get(1))),h=this._context.new_var(n.adopt(o,a,0)),d=this._context.new_var(this.correlationLog(c,h,this.period,this._context)),u=this._context.new_var(d.adopt(a,i,0)).get(),p=r.round(1e3*u)/1e3;return this._context.select_sym(0),[p]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1,is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1",bands:[{id:"hline_0",name:"Zero",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._input(1),i=Math.floor(e/2+1);this._context.setMinimumAdditionalDepth(e+i);var s=this._context.new_var(r.close(this._context)),n=this._context.new_var(r.sma(s,e,this._context)),o=this._context.new_var(r.close(this._context)).get(i)-n,a=r.close(this._context)-n.get(i);return[t?o:a,t?-i:0]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{
_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FFA726"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#ab47bc"}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"DX",histogramBase:0,joinPoints:!1},plot_3:{title:"ADX",histogramBase:0,joinPoints:!1},plot_4:{title:"ADXR",histogramBase:0,joinPoints:!1}},description:"Directional Movement",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:2e3},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1);return this._context.setMinimumAdditionalDepth(2*i+s),r.dmi(i,s,this._context)}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,offset:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e3,max:1e3}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.low(this._context),o=this._context.new_var(n);this._context.setMinimumAdditionalDepth(i+Math.max(s,0))
;var a=r.lowest(o,i,this._context),l=r.high(this._context),c=this._context.new_var(l),h=r.highest(c,i,this._context);return[{value:a,offset:s},{value:h,offset:s},{value:r.avg(h,a),offset:s}]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double EMA",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(2*i);var s=r.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context);return[this.f_0(o,l)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease Of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e9},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s,r){return e*t*(i-s)/r},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.hl2(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(i,a,r.high(this._context),r.low(this._context),r.volume(this._context)),c=this._context.new_var(l);return[r.sma(c,s,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Elder's Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:2e3}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.main=function(e,t){this._context=e,this._input=t
;var i=this._input(0),s=r.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o,r.volume(this._context)),l=this._context.new_var(a);return[r.ema(l,i,this._context)]}}},{name:"EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"EMA Cross",shortDescription:"EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context),h=a,d=c,u=r.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Envelopes",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",
name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r[this._input(4)](this._context)),s=r.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(r.close(this._context)),o=0,a=0,l=0;l0?1:3,i=r.change(this._context.new_var(e));return t-(r.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(2)](this._context),s=this._input(0),n=this._input(1),o=this._input(3);this._context.setMinimumAdditionalDepth(Math.max(s,n)+o);var a=this._context.new_var(i),l=r.ema(a,s,this._context),c=this._context.new_var(i),h=r.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.ema(u,o,this._context),_=this.f_0(d,p);return[_,d,p,this.f_1(_)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",
shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=r.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.ema(d,a,this._context):"WMA"===o?l=r.wma(d,a,this._context):"SMA"===o&&(l=r.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.wma(o,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",
name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n=this._context.new_var(r.close(this._context));return"Exponential"===this._input(2)?(i=r.ema(n,this._input(0),this._context),s=r.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.wma(n,this._input(0),this._context),s=r.wma(n,this._input(1),this._context)):(i=r.sma(n,this._input(0),this._context),s=r.sma(n,this._input(1),this._context)),[i,s]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n,o=this._context.new_var(r.close(this._context));return"Exponential"===this._input(3)?(i=r.ema(o,this._input(0),this._context),s=r.ema(o,this._input(1),this._context),n=r.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.wma(o,this._input(0),this._context),s=r.wma(o,this._input(1),this._context),n=r.wma(o,this._input(2),this._context)):(i=r.sma(o,this._input(0),this._context),s=r.sma(o,this._input(1),this._context),n=r.sma(o,this._input(2),this._context)),[i,s,n]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}
},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),o=r.stdev(t,i,this._context),a=r.log(n/e.get(i))/(o*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._context.new_var(r.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,r=1;r<=this.periods;++r){var n=Math.sin((1+r)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;sthis._context.new_var(s).get(1)?1:0,[100*r.sma(this._context.new_var(i),this.rollingPeriod,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume",format:{type:"volume"}},constructor:function(){
this.f_0=function(e,t,i){return r.gt(e,0)?t:r.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._context.new_var(i),n=r.change(s);return[this.f_0(n,r.volume(this._context),n)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.gt(e,0)?t:r.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(a,r.volume(this._context),a),c=r.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.ema(d,s,this._context):"WMA"===i?h=r.wma(d,s,this._context):"SMA"===i&&(h=r.sma(d,s,this._context)),[c,h]}}},{name:"Parabolic SAR",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:.02,in_1:.02,in_2:.2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);return[r.sar(i,s,n,this._context)]}}},{name:"Price Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},
inputs:{in_0:20,in_1:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Highprice Line",histogramBase:0,joinPoints:!1},plot_1:{title:"Lowprice Line",histogramBase:0,joinPoints:!1},plot_2:{title:"Centerprice Line",histogramBase:0,joinPoints:!1}},description:"Price Channel",shortDescription:"PC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Offset Length",defval:0,type:"integer",min:1,max:2e3}],id:"Price Channel@tv-basicstudies-1",scriptIdPart:"",name:"Price Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.high(this._context),s=this._context.new_var(i),n=r.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.highest(s,a,this._context),h=r.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.avg(c,h),offset:l}]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u}},inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:2e3}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t){return(e-t)/t*100},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.sma(l,n,this._context);return[this.f_0(a,c)]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend",format:{type:"volume"}},constructor:function(){this.f_0=function(){var e=this._context.new_var(r.close(this._context));return[r.cum(r.change(e)/e.get(1)*r.volume(this._context),this._context)]},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0()[0]]}}},{name:"Rate Of Change",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:9}},plots:[{id:"plot_0",
type:"line"}],styles:{plot_0:{title:"ROC",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Rate Of Change",shortDescription:"ROC",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"rate_of_change@tv-basicstudies-1",scriptIdPart:"",name:"Rate Of Change",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._input(0);return[100*(i.get(0)-i.get(s))/i.get(s)]}}},{name:"Relative Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70,zorder:-1.1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:50,zorder:-1.11},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30,zorder:-1.111}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{length:14,smoothingLine:"SMA",smoothingLength:14}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:2}},description:"Relative Strength Index",shortDescription:"RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_2",name:"MiddleLimit",zorder:-1.11},{id:"hline_1",name:"LowerLimit",zorder:-1.111}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"length",name:"Length",defval:14,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:14,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Relative Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Strength Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.max(e,0)},this.f_1=function(e){return-r.min(e,0)},this.f_2=function(e,t){return r.eq(e,0)?100:r.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.ema(f,o,this._context):"WMA"===n?a=r.wma(f,o,this._context):"SMA"===n&&(a=r.sma(f,o,this._context)),[{value:g},{value:a}]}}},{
name:"Relative Vigor Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"RVGI",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Relative Vigor Index",shortDescription:"RVGI",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Vigor Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Vigor Index",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.swma(n,this._context),a=this._context.new_var(o),l=r.sum(a,i,this._context),c=this.f_0(r.high(this._context),r.low(this._context)),h=this._context.new_var(c),d=r.swma(h,this._context),u=this._context.new_var(d),p=r.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.swma(m,this._context)]}}},{name:"Relative Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Relative Volatility Index",shortDescription:"RVI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Volatility Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return r.le(e,0)?0:t},this.f_1=function(e,t){return r.gt(e,0)?0:t},this.f_2=function(e,t){return e/(e+t)*100},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(i+12);var s=r.close(this._context),n=this._context.new_var(s),o=r.stdev(n,i,this._context),a=this._context.new_var(s),l=r.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.ema(p,14,this._context);return[this.f_2(d,_)]}}},{name:"SMI Ergodic Indicator/Oscillator",metainfo:{
_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_2:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:5,in_1:20,in_2:5}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Indicator",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1},plot_2:{title:"Oscillator",histogramBase:0,joinPoints:!1}},description:"SMI Ergodic Indicator/Oscillator",shortDescription:"SMIIO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:20,type:"integer",min:1,max:2e3},{id:"in_2",name:"siglen",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]}],id:"SMI Ergodic Indicator/Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"SMI Ergodic Indicator/Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.close(this._context),a=this._context.new_var(o),l=r.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.ema(c,n,this._context);return[l,h,this.f_0(l,h)]}}},{name:"Smoothed Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#673AB7"}},inputs:{in_0:7,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Smoothed Moving Average",shortDescription:"SMMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"smoothed_moving_average@tv-basicstudies-1",scriptIdPart:"",name:"Smoothed Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r[this._input(1)](this._context);return[r.smma(t,e,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Standard Deviation",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Standard Deviation@tv-basicstudies-1",scriptIdPart:"",name:"Standard Deviation",description:"Standard Deviation",shortDescription:"Standard Deviation",is_price_study:!1,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:u}},inputs:{periods:5,deviations:1}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"deviations",name:"Deviations",
type:"float"}],format:{precision:2,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._context.new_var(r.close(this._context));return[r.stdev(n,i,this._context)*s]}}},{name:"Stochastic",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:1,in_2:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic",shortDescription:"Stoch",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"%K Length",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"%K Smoothing",defval:1,type:"integer",min:1,max:1e4},{id:"in_2",name:"%D Smoothing",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.close(this._context),a=r.high(this._context),l=r.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.sma(m,n,this._context)]}}},{name:"Stochastic RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:14,in_2:3,in_3:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic RSI",shortDescription:"Stoch RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",
objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"lengthRSI",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"lengthStoch",defval:14,type:"integer",min:1,max:1e4},{id:"in_2",name:"smoothK",defval:3,type:"integer",min:1,max:1e4},{id:"in_3",name:"smoothD",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic RSI@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_1=function(e,t,i){var s=i.new_var(r.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3);e.setMinimumAdditionalDepth(s+n+o+a);var l=this._context.new_var(i),c=r.rsi(this.f_1(l,s,this._context),this.f_2(l,s,this._context)),h=this._context.new_var(c),d=this._context.new_var(c),u=this._context.new_var(c),p=r.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.sma(g,a,this._context)]}}},{name:"TRIX",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:18}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"TRIX",histogramBase:0,joinPoints:!1,zorder:1}},description:"TRIX",shortDescription:"TRIX",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:18,type:"integer",min:1,max:2e3}],id:"TRIX@tv-basicstudies-1",scriptIdPart:"",name:"TRIX",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.log(e)},this.f_1=function(e){return 1e4*e},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);e.setMinimumAdditionalDepth(3*i);var s=this.f_0(r.close(this._context)),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.ema(c,i,this._context),d=this._context.new_var(h),u=r.change(d);return[this.f_1(u)]}}},{name:"Triple EMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Triple EMA",shortDescription:"TEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Triple EMA@tv-basicstudies-1",scriptIdPart:"",name:"Triple EMA",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return 3*(e-t)+i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0)
;this._context.setMinimumAdditionalDepth(3*i);var s=r.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.ema(c,i,this._context);return[this.f_0(o,l,h)]}}},{name:"True Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:25,in_1:13,in_2:13}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"True Strength Index",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"True Strength Index",shortDescription:"True Strength Index",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"long",defval:25,type:"integer",min:1,max:4999},{id:"in_1",name:"short",defval:13,type:"integer",min:1,max:4999},{id:"in_2",name:"siglen",defval:13,type:"integer",min:1,max:4999,hideWhenPlotsHidden:["plot_1"]}],id:"True Strength Indicator@tv-basicstudies-1",scriptIdPart:"",name:"True Strength Index",format:{precision:4,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)+this._input(2));var o=r.close(this._context),a=this._context.new_var(o),l=r.tsi(a,s,i,this._context),c=this._context.new_var(l);return[l,r.ema(c,n,this._context)]}}},{name:"Trend Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Trend Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Trend Strength Index",description:"Trend Strength Index",shortDescription:"Trend Strength Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:14}},styles:{plot_0:{title:"Plot",histogramBase:0}},inputs:[{id:"periods",type:"integer",name:"Periods"}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.invertedPeriod=1/this.period,this.sumX=(this.period-1)*this.period/2,this.sumXX=(this.period-1)*this.period*(2*this.period-1)/6,this.invertedPeriodSumXSumX=this.invertedPeriod*this.sumX*this.sumX},this.trendStrengthIndex=function(){for(var e=this._context.new_var(r.close(this._context)),t=r.sum(e,this.period,this._context),i=0,s=0,n=0;n0?1:-1:a/(l=Math.sqrt(l))},this.main=function(e,t){
return this._context=e,this._input=t,[this.trendStrengthIndex()]}}},{name:"Typical Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"TypicalPrice@tv-basicstudies-1",scriptIdPart:"",name:"Typical Price",description:"Typical Price",shortDescription:"Typical Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.hlc3(this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Ultimate Oscillator",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){var s=this._context.new_var(e),n=this._context.new_var(t);return[r.sum(s,i,this._context)/r.sum(n,i,this._context)]},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),s=this._context.new_var(r.close(this._context)),n=r.max(r.high(this._context),s.get(1)),o=this._context.new_var(r.close(this._context)),a=r.min(r.low(this._context),o.get(1)),l=r.close(this._context)-a,c=n-a,h=this.f_0(l,c,e),d=this.f_0(l,c,t),u=this.f_0(l,c,i);return[100*(4*h[0]+2*d[0]+u[0])/7]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Volatility Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Close-to-Close",description:"Volatility Close-to-Close",shortDescription:"Volatility Close-to-Close",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",defval:10,min:2},{id:"daysPerYear",name:"Days Per Year",type:"integer",defval:252,min:1,max:366}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.stdev=function(e,t,i){var s=this.variance(e,t,i);return r.sqrt(s)},this.variance=function(e,t,i){var s=r.sma(e,t,i);return this.variance2(e,s,t)},
this.variance2=function(e,t,i){var s,r,n=0;for(s=0;s0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(r.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:10,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){if(r.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.close(this._context)),1===this.count)this.atr=r.high(this._context)-r.low(this._context),this.sic=r.close(this._context);else if(this.countthis.sic&&(this.sic=r.close(this._context))}else if(this.count===this.period){e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,
r.close(this._context)>this.sic&&(this.sic=r.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.close(this._context)s?(this.position="LONG",this.sic=r.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return r.weekofyear(e,t)!==r.weekofyear(e,i)||r.year(e,t)!==r.year(e,i)};case"Month":return function(t,i){return r.month(e,t)!==r.month(e,i)||r.year(e,t)!==r.year(e,i)};case"Quarter":return function(t,i){return Math.floor(r.month(e,t)/3)!==Math.floor(r.month(e,i)/3)||r.year(e,t)!==r.year(e,i)};case"Year":return function(t,i){return r.year(e,t)!==r.year(e,i)};case"Decade":return function(t,i){return Math.floor(r.year(e,t)/10)!==Math.floor(r.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(r.year(e,t)/100)!==Math.floor(r.year(e,i)/100)};default:return e=>this._isFirstBarInSession(e)}},this.init=function(e,t){this._input=t,this._isFirstBarInSession=null;const i=this._input(1)||"Session";this._anchorChecker=this.createAnchorChecker(e,i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var(),o=e.new_var();const a=r.time(this._context),l=this._context.new_unlimited_var(a).get(1);if(a){if(null===this._isFirstBarInSession){const t=r.createNthBarInSessionCheck(e);this._isFirstBarInSession=e=>t(e,0)}this._anchorChecker(a,l)&&(this.f_1(s),this.f_1(n),o.set(a))}return s.set(r.nz(s.get(1))+r[i](this._context)*r.volume(this._context)),n.set(r.nz(n.get(1))+r.volume(this._context)),r.na(o.get(0))?[NaN]:[s.get(0)/n.get(0)]}}},{name:"VWMA",metainfo:{
_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator",format:{precision:2,type:"percent"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.volume(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._context.new_var(r.low(this._context)),i=this._context.new_var(r.abs(r.high(this._context)-t.get(1))),s=r.sum(i,e,this._context),n=this._context.new_var(r.high(this._context)),o=this._context.new_var(r.abs(r.low(this._context)-n.get(1))),a=r.sum(o,e,this._context),l=this._context.new_var(r.atr(1,this._context)),c=r.sum(l,e,this._context)
;return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.high(this._context),n=this._context.new_var(s),o=r.highest(n,i,this._context),a=r.low(this._context),l=this._context.new_var(a),c=r.lowest(l,i,this._context);return[this.f_0(r.close(this._context),o,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,
this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=this._input(3),a=this._input(4),l=this._input(5),c=r.hl2(this._context);return[{value:r.smma(c,i,this._context),offset:o},{value:r.smma(c,s,this._context),offset:a},{value:r.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(r.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.and(i,r.lt(t.get(e-c),t.get(e))),s=r.and(s,r.lt(t.get(e+c),t.get(e))),n=r.and(n,r.and(r.le(t.get(e+1),t.get(e)),r.lt(t.get(e+c+1),t.get(e)))),o=r.and(o,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.lt(t.get(e+c+2),t.get(e))))),a=r.and(a,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.lt(t.get(e+c+3),t.get(e)))))),l=r.and(l,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.and(r.le(t.get(e+4),t.get(e)),r.lt(t.get(e+c+4),t.get(e)))))));var h=r.or(s,r.or(n,r.or(o,r.or(a,l)))),d=r.and(i,h),u=this._context.new_var(r.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.and(p,r.gt(u.get(e-c),u.get(e))),_=r.and(_,r.gt(u.get(e+c),u.get(e))),m=r.and(m,r.and(r.ge(u.get(e+1),u.get(e)),r.gt(u.get(e+c+1),u.get(e)))),g=r.and(g,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.gt(u.get(e+c+2),u.get(e))))),f=r.and(f,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.gt(u.get(e+c+3),u.get(e)))))),v=r.and(v,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.and(r.ge(u.get(e+4),u.get(e)),r.gt(u.get(e+c+4),u.get(e)))))));var y=r.or(_,r.or(m,r.or(g,r.or(f,v))));return[r.and(p,y),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,
traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer",hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{
id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=r.ema(i,s,this._context),d=r.ema(i,n,this._context),u=r.ema(i,o,this._context),p=r.ema(i,a,this._context),_=r.ema(i,l,this._context),m=r.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),y=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.ema(i,g,this._context),r.ema(i,f,this._context),r.ema(i,v,this._context),r.ema(i,y,this._context),r.ema(i,S,this._context),r.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==r.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){
this._symbolSupports1DResolution||r.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==r.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=r.time(this._context),o=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(r[i](this._context)),l=this._context.new_unlimited_var(r[s](this._context));if(o.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=r.add_years_considering_dst(this._context.symbol.info.timezone,new Date(n),-1),h=o.indexOf(c.getTime()),d=-1===h?NaN:r.highest(a,h,this._context),u=-1===h?NaN:r.lowest(l,h,this._context);if(isNaN(d)||isNaN(u))return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{erase:[{action:"all"}]}}};return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:d,extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:u,extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},91007:(e,t,i)=>{"use strict";var s;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},16426:(e,t,i)=>{"use strict";i.d(t,{PointsetsManager:()=>n});var s=i(85049);const r=(0,i(31955).getLogger)("ChartApi.PointsetsManager");class n{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,n){let o=this._pointsetsDataBySymbol.get(t);void 0===o&&(o=new Map,this._pointsetsDataBySymbol.set(t,o));const a=[];for(const t of s){const[i,s]=t;"number"!=typeof i||Number.isNaN(i)?r.logWarn(`Pointset time is invalid: id=${e}, ${i} of type ${typeof i}`):a.push({point:t,extrapolation:n.extrapolateTimeWithOffsetToTime(1e3*i,s)})}s.length===a.length&&o.set(e,{resolution:i,points:a})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(s.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const r=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const o=this._refreshPointsetData(e,t,i,s);null!==o&&r.set(n,o)})),r}_refreshPointsetData(e,t,i,n){if(s.Interval.isEqual(e.resolution,t))for(let t=0;t ${t}`),null;o.push({
index:i,value:[a.index,a.timeMs/1e3]})}return o}}},75683:(e,t,i)=>{"use strict";i.d(t,{SessionTimeScale:()=>y});var s=i(50151),r=i(56570),n=i(2740),o=i(29981),a=i(53388),l=i(50503),c=i(9447);function h(e){return 60*e*60*1e3}function d(e){return 60*e*1e3}const u=[{divisor:1,weight:18},{divisor:(p=1,1e3*p),weight:19},{divisor:d(1),weight:20},{divisor:d(5),weight:21},{divisor:d(30),weight:22},{divisor:h(1),weight:30},{divisor:h(3),weight:31},{divisor:h(6),weight:32},{divisor:h(12),weight:33}];var p,_;function m(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=u.length-1;e>=0;--e)if(Math.floor(i/u[e].divisor)!==Math.floor(s/u[e].divisor))return u[e].weight}return 18}function g(e,t,i=0){if(0===e.length)return[];let s=i,r=i;const n=[];for(;s=t.length?(n.push({old:s,new:l.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[r].timeMs?(s!==r&&n.push({old:s,new:r}),s++,r++):e[s].timeMs{if(e.new===t.new&&e.new===l.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===l.INVALID_TIME_POINT_INDEX)return-1;if(t.new===l.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function f(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}!function(e){e[e.FutureTickMarksLimit=1e3]="FutureTickMarksLimit"}(_||(_={}));const v=r.enabled("end_of_period_timescale_marks");class y{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[]}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,o.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let t=e;tf(e,i+t)));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;i=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return l.INVALID_TIME_POINT_INDEX;i=t.timeMs!==e?t.index+1:t.index}return(0,s.assert)(i>t,"data must have unique sorted times"),t=i,i}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=(0,o.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const a=this._updateTimeScalePointsTail(n)
;return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t){return this._setBarsTimes(e,t)}_setBarsTimes(e,t){const i=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),i&&this._cleanupPointsData(this._sortedTimePoints);const s=[];this._pointDataByTimePoint.forEach(((e,t)=>{s.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),s.sort(((e,t)=>e.timeMs-t.timeMs));const r=this._updateTimeScalePoints(s);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const r={index:0,instances:t};this._pointDataByTimePoint.set(i,r),null!==s&&s.push({timeMs:i,pointData:r})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==r.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=S(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=g(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===l.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{
const i=this._sortedTimePoints;let r=0;for(;t+r1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=m(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let t=e.pointsIndex;t{"use strict";var s=i(2060),r=i(20629).StudyEngine,n=i(3075).OHLCV,o=i(36802),a=i(1430).SymbolExtrapolator,l=i(75683).SessionTimeScale,c=i(16426).PointsetsManager,h=i(14381),d=i(53388).createDwmAligner,u=i(85049).Interval,p=i(76422),_=i(44843).visitObject,m=i(37265).isObject;i(42924),i(6058);var g=i(47282).DatafeedRequestsCachedProcessor,f=i(63950).timezoneIsAvailable,v=i(53388).isAlignmentEnabled,y=i(73698),S=y.isEncodedExtendedSymbol,b=y.decodeExtendedSymbol,w=i(68805).extractSymbolNameFromSymbolInfo,C=i(30328).replaceGraphicsTimesWithTimePointIndexIndex,P=i(56570),x=i(91007).SubsessionId,T=i(14381).getPeriodsBetweenDates,I=i(39692).overwriteVolumeProfileResolutionForPeriodGetter;const M="pre_post_market_sessions",A=P.enabled(M),L=P.enabled("pay_attention_to_ticker_not_symbol");function k(e,t,i,s){return[e,t,i,s].filter((e=>!!e)).join("|")}var D=-5e6;function E(e){
var t=e.findIndex((function(e){return e.index!==D}));return-1===t?[]:0===t?e:e.slice(t)}function V(e,t,i){if(e){if("string"==typeof e)return void F("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=e}t&&(i.provider_id=t,i.country=void 0)}function B(e,t){return e+"_"+t}function R(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]:null}}return null}function N(e){const t=b(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===x.Regular?void 0:i.session}]}var O=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&I((function(t,i,s,r){return e.getVolumeProfileResolutionForPeriod(t,i,s,r)})),this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,t._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),t._datafeedConfiguration=t._adoptConfigurationData(window.configurationData),t._fireEvent("configuration_received"),t._externalDatafeed.getServerTime&&t._externalDatafeed.getServerTime((function(e){t._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo=[],this._depthInfo=[],this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new g(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),o.setupFeed({resolve:function(e,i,s,r){t._resolveSymbolByName(e,i,s,r)},subscribe:function(e,i,s,r,n){return t._cachedDatafeed.subscribe(e,i,s,function(e,i,s){var r=new h.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=h.newBarBuilder(i,r,r);return function(e){if(e&&e.count()){var i=1e3*t.getCurrentUTCTime();n.moveTo(i),n.indexOfBar(i)>=0&&e.setLastBarClosed(!1)}s(e)}}(e,i,r),n)},unsubscribe:function(e){return t._cachedDatafeed.unsubscribe(e)}})};function F(e){console.warn(`${(new Date).toISOString()} ${e}`)}function W(e,t){return e+"_"+t}function H(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}O.prototype._getSymbolExtrapolator=function(e,t,i){var s=u.normalize(i),r=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s),n=this._symbolExtrapolators[r];return void 0===n&&(n=new a(t,s),this._symbolExtrapolators[r]=n),n},O.prototype._barsCoefficients=function(e,t){if(void 0===b(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},
O.prototype.destroy=function(){for(const e of Object.keys(this._quotesInfo))this._stopQuotesSubscription(e);this._cachedDatafeed.destroy(),this._externalDatafeed=null;for(const e of Object.keys(this._pointsetsManagers))this._pointsetsManagers[e].destroy();this._quotesInfo={},this._pointsetsManagers={}},O.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((function(e){this._timeScales[e].destroy()}),this),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((function(e){this._symbolExtrapolators[e].destroy()}),this),this._symbolExtrapolators={}},O.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},O.prototype._logMessage=function(e){P.enabled("charting_library_debug_mode")&&console.log(`${(new Date).toISOString()} ${e}`)},O.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},O.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r{this._resolveSymbolImpl(e,(e=>{t(e.price_sources)}),(e=>{i(e)}))}))},O.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},O.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},O.prototype._findStudyObject=function(e){e.endsWith("!")&&(e=e.slice(0,-1));var t=e.split("@")[0],i=JSServer.studyLibrary.filter((function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t}));return 0===i.length?null:i[0]},O.prototype.getMarks=function(e,t,i,s,r){var n={red:6,green:5,blue:4,yellow:3};if(this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks){this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var o=this;this._externalDatafeed.getMarks(e,t,i,(function(t){var i=t.map((function(e){return e.time=parseInt(e.time),e}))
;o._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(i)));var a=d(r,e),l=P.enabled("two_character_bar_marks_labels"),c=i.map((function(e){return e.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,e.direction=n[e.color],e.onClicked=function(){p.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},O.prototype.getTimescaleMarks=function(e,t,i,s,r){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var n=this;this._externalDatafeed.getTimescaleMarks(e,t,i,(function(t){n._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(t)));var i=d(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},O.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},O.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},O.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},O.prototype._getSeriesData=function(e,t){return this._objectsDataCache[W(e,t)]||null},O.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,h){var p=!0,_=[];null!==l&&(this._objectsDataCache[l]=null),this._timeScales[e].setCompleted(!1);var m=this._computeStudyCounter++;function g(e,t){if(e_[a].timeMs;l?_.push({index:g(s,_.length),value:[s/1e3].concat(r),timeMs:s
}):(_[a].index=g(s,a),_[a].value=[s/1e3].concat(r),_[a].timeMs=s),p||h.onRealtimeCallback([_[_.length-1]],l,_.length,f,i)}(e,t,i)},nonseriesOut:function(e,t){h.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){y=!0},recalc:function(e,s){p=!1,_.endOfData=y,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(S._objectsDataCache[l]=_),h.onDataReadyCallback(_,f,i,s))}});if(!S._studiesCache[e]||!S._studiesCache[e][n])throw Error("This should never happen");S._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;h.onErrorCallback(e.message)}}else h.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,C)},O.prototype._getDataRangeForStudy=function(e,t){var i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)};return this._studyCanExtendTimeScale(e,t)?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s},O.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){const o=l._studiesCache[s][r];if(o.completed=!0,e.length>0&&(o.firstLoadedTimeMs=e[0].timeMs),e=E(e),l._setEndOfData(s,r,n,!l._studyCanExtendTimeScale(s,r)||e.endOfData),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].setStudyBarsTimes(r,t);l._applyTimeScaleUpdate(s,i)}l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,t),TradingView.ChartapiMessagerInstances[s].onStudyCompleted(r,n),l._updateTimeScaleState(s)}function h(e){var t={};if(0!==e.size){var i={},n=l._studiesCache[s][r].metainfo;e.forEach((function(e,t){i[n.plots[t].id]=e})),t.data={offsets:i}}return t}this._studiesCache[s][r].completed=!1,a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n=0},O.prototype.ensureExtendedTo=function(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");var s=this;setTimeout((function(){
s._recreateSourcesForDataRange(t,{to:i})}),0)},O.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(u.isDWM(s.resolution)&&null!=s.symbolInfo){var r=d(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(B(e,s.symbolId)),o=this._barsCoefficients(n,s.resolution),a=o.barsCoefficient||1;if(!o.barsCoefficient){var l=this._getSeriesData(e,s.guid);null!==l&&(o.expectedBarsCount=l.length+t)}var c=this;setTimeout((function(){c._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}else this._logMessage("Nothing to extend - there is no points on time scale")},O.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},O.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},O.prototype._applyTimeScaleUpdate=function(e,t){if(null!==t){var i=[];for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if(r&&"study"===r.type){var n=this._studiesNonSeriesTimes[e][s];if(n){var o={indexes:this._timeScales[e].convertTimesToIndexes(n),data:{indexes_replace:!0}};i.push({objId:s,turnaround:r.turnaround,data:[],nonSeriesData:o})}}}TradingView.ChartapiMessagerInstances[e].onTimescaleUpdate(t,i),Promise.resolve().then(function(){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,i,this._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}.bind(this))}},O.prototype._updateMainTsBuilder=function(e){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}},O.prototype._updateTimeScaleState=function(e){var t=!0,i=!0;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];i=i&&this._isEndOfData(e,s,r.turnaround),t=t&&r.completed}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&TradingView.ChartapiMessagerInstances[e].onTimescaleCompleted(i))},O.prototype._mainSeriesRecord=function(e){var t=null,i=null;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if("series"===r.type&&(null===t&&(t=r),r.isMain)){i=r;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i},O.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},O.prototype._prepareSeriesNonSeriesData=function(e,t,i){var s=i.data[i.data.length-1],r=this._getSeriesData(e,t),n=null===r?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:n.map((function(e,t){return{time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],
factor:e[6],additionalPrice:e[6]}}))}},indexes:this._timeScales[e].convertTimesToIndexes(n.map((function(e){var t=e[0]||0;return t<0?r[r.length+t].timeMs:i.projectionTime+t})))}},O.prototype.createSeries=function(e,t,i,s,r,o,a){this._setEndOfData(e,t,i,!1);var l=new n;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],d=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||u.isEqual(h.resolution,r)&&h.symbolId===s)void 0!==o.countBack&&null!==c&&0!==c.length&&(o.to=c[0].timeMs),h&&null!=h.firstLoadedTimeMs?o.to=void 0!==o.to?Math.min(h.firstLoadedTimeMs,o.to):h.firstLoadedTimeMs:h||0===d||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===d)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_{V(e.logo_urls,e.exchange_logo,e)})),s(e)}))},O.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(B(e,t),i),this._resolvePromisesBySymbolId.set(B(e,t),new Promise((function(r,n){s._resolveSymbolImpl(i,(function(s){TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s),r({symbolInfo:s,requestedSymbol:i})}),(function(i){TradingView.ChartapiMessagerInstances[e].onSymbolError(t,i),n(i)}))})))},O.prototype._resolveSymbolImpl=function(e,t,i){var s;S(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(new Date).toISOString()} ${s}`));const[r,n]=N(e);this._resolveSymbolByName(r,n,t,i)},O.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=H(e,n,o,a);if(this._resolveRequests[l])r=this._resolveRequests[l];else{r=this._resolveSymbolInternal(e,n||void 0,o||void 0,a||void 0),this._resolveRequests[l]=r;var c=this;r.then((function(t){c._resolveRequests[H(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[H(w(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[H(w(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},O.prototype._resolveSymbolInternal=function(e,t,i,s){var r=this;return new Promise(function(n,o){const a=k(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(a));var l=!0;this._externalDatafeed.resolveSymbol(e,(function(e){
l&&F("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),r._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(a,JSON.stringify(e))),function(e){if(e.ticker||(e.ticker=e.symbol||e.name),e.full_name=L?e.ticker:`${e.exchange}:${e.name}`,e.pro_name=e.full_name,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions)for(var t=0;tthis._resolveSymbolByName(t,i,o,(s=>{F(`Error resolving for market status watcher ${k(t,i.currency,i.unit,i.session)}:\n${s}`),this.quoteRemoveSymbols(e,[r]),a(s)}))),e,r)}}},O.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},O.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},O.prototype._startQuotesSubscription=async function(e){var t={},i=this;const s=async e=>{const i=new Map,s=new Set;for(const r of e){const[e,n]=N(r),o=await new Promise((t=>this._resolveSymbolByName(e,n,(e=>t(e)),(()=>t(null)))));null!==o&&(t[o.ticker]=o,t[r]=o,s.add(o.ticker),o.ticker!==r&&(i.has(o.ticker)||i.set(o.ticker,[]),i.get(o.ticker).push(r)))}return[i,[...s]]},[r,n]=await s(this._quotesInfo[e].symbols),[o,a]=await s(this._quotesInfo[e].fastSymbols);function l(s){s.forEach((function(s){const n=s.n;if(r.has(n)||o.has(n)){const e=(r.get(n)??o.get(n)).map((e=>({...s,n:e})));setTimeout((()=>l(e)),0)}void 0!==t[s.n]&&null!==t[s.n]&&function(t,s){var r=i._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||r&&r.marketStatus(),t.values.pricescale=s.pricescale,t.values.minmov=s.minmov,t.values.minmove2=s.minmove2||0,t.values.fractional=s.fractional||!1,V(s.logo_urls,s.exchange_logo,t.values),r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}(s,t[s.n])}))}this._externalDatafeed.getQuotes&&!P.enabled("charting_library")?this._externalDatafeed.getQuotes(n,(function(t){i._quotesInfo[e]&&0!==i._quotesInfo[e].symbols.length&&(l(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(n,a,l,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&P.enabled("trading_terminal")&&setTimeout((()=>{l(this._quotesInfo[e].symbols.map((function(e){return{n:e,
s:"ok",v:{}}})))})),this._createMarketStatusWatchers(e,this._quotesInfo[e].symbols)},O.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},O.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},O.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},O.prototype.quoteSetFields=function(e,t){},O.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},O.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},O.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},O.prototype.quoteHibernateAll=function(e){},O.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},O.prototype._startDepthSubscription=function(e){var t=this,i=this._depthInfo[e].symbol;function s(e){return e.map((function(e){return{p:e.price,v:e.volume}}))}function r(e){var t={};return t.s=i,t.bids=s(e.bids),t.asks=s(e.asks),t}i&&this._externalDatafeed.subscribeDepth&&(t._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(i,(function(i){var s;t._depthInfo[e]&&((s=i).snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([r(s)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([r(s)])))})))},O.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},O.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},O.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},O.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},O.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},O.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},O.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},O.prototype.serverTimeOffset=function(){return this._serverTimeOffset},O.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},O.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},O.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},O.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo
;return void 0!==i&&(P.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||P.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=O},1430:(e,t,i)=>{"use strict";i.d(t,{SymbolExtrapolator:()=>h});var s,r=i(50151),n=i(29981),o=i(14381),a=i(40644),l=i(85049);function c(e,t){return e.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit"}(s||(s={}));class h{constructor(e,t,i=2e5){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=l.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,o.newBarBuilder)(t,new o.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],s=this._barsTimes[this._barsTimes.length-1],o=i>s?this._barsTimes.length:(0,n.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,r.assert)(-1!==this._projectionFirstIndex,"something went wrong"),s!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this._ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this._timeOfBarIndex(i.index+t);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&ðis._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0,n.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,r.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length)return null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs?{index:0,timeMs:(0,r.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,n.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){this._ensureExtrapolatedToFutureTime(e)}_setLastRealBarTime(e){const t=this._futureBarsCache.length,i=(0,n.upperbound_int)(this._futureBarsCache,e);0===i?this._extendFutureCacheToTimeFromLeft(e):(this._lastRealBarTimeMs=e,this._futureBarsCache=this._futureBarsCache.slice(i)),this._ensureExtrapolatedToFutureBar(Math.max(t,this._minFutureBarsCount))}_timeOfBarIndex(e){var t;if(e<0){const t=Math.abs(e);this._ensureExtrapolatedToHistoryBar(t);const i=this._historyBarsCache.length-t;return i<0?null:{timeMs:this._historyBarsCache[i],exact:!1}}if(0===e&&0===this._barsTimes.length)return{timeMs:(0,r.ensureNotNull)(null!==(t=this._firstRealBarTimeMs)&&void 0!==t?t:this._lastRealBarTimeMs),exact:!1};if(e>=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:e=e)return;if((0,r.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,a.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||c(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight(((t,i)=>(0,a.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times))}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||c(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight(((t,i)=>(0,a.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=e||c(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,a.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||c(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,a.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}},39076:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(64289)},18278:(e,t,i)=>{"use strict";i.d(t,{HandlerInfo:()=>s});class s{constructor(e,t,i){this.handler=e,this.customId=t,this.singleShot=i}}},82783:(e,t,i)=>{"use strict";var s,r,n,o;function a(e,t){return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}i.d(t,{TIMEFRAMETYPE:()=>o,areEqualTimeFrames:()=>a}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.Default="default",e.FullSingleSession="full_single_session"}(r||(r={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(n||(n={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(o||(o={}))},80437:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},
window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},62945:(e,t,i)=>{"use strict";i.r(t),i.d(t,{QUOTE_FIELDS:()=>n,QUOTE_FIELDS_CACHE:()=>o,QuoteCache:()=>r});var s=i(50151);class r{constructor(e){this._cache=new Map,this._fields=[...e.fields]}update(e,t,i){const r=(0,s.ensureDefined)(e.symbolname);if(this._cache.has(r)||this._cache.set(r,{symbolname:r,status:e.status,values:{}}),"error"===e.status)return;const n=(0,s.ensureDefined)(this._cache.get(r));n.status=e.status;for(const s of this._fields)t.has(s)&&(i||void 0!==e.values[s])&&(n.values[s]=e.values[s])}get(e){var t;return null!==(t=this._cache.get(e))&&void 0!==t?t:null}fields(){return this._fields}}
const n=new Set(["pro_name","base_name","logoid","currency-logoid","base-currency-logoid","source-logoid","short_name","web_site_url","pro_perm","timezone","current_session","last_price","lp_time","prev_close_price","open_price","high_price","low_price","price_52_week_high","price_52_week_low","ask","ask_size","bid","bid_size","rch","rchp","rtc","data_frequency","reference-last-period-start","business_description","web_site_url","figi","number_of_employees","float_shares_outstanding","earnings_release_next_calendar_date","root","description","exchange","listed_exchange","type","country_code","provider_id","sector","typespecs","visible-plots-set","industry","currency_id","last_price","fractional","minmov","minmove2","pricescale","variable_tick_size","change","change_percent","volume","average_volume","market_cap_basic","market_cap_calc","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","earnings_release_next_date","earnings_per_share_forecast_next_fq","earnings_publication_type_next_fq","earnings_release_date","earnings_per_share_fq","earnings_per_share_forecast_fq","forecast_raw","last_release_date","next_release_date","reference_last_period","fundamental_currency_code","number_of_employees","web_site_url","business_description","founded","ceo","float_shares_outstanding","total_shares_outstanding","dividend_payout_ratio_ttm","dividends_yield_current","dividend_ex_date_upcoming","dividend_amount_upcoming","dividend_amount_recent","dividend_ex_date_recent","total_revenue_fq_h","total_revenue_fy_h","net_income_fy_h","net_income_fq_h","total_assets_fy_h","total_assets_fq_h","total_liabilities_fy_h","total_liabilities_fq_h","cash_f_operating_activities_fy_h","cash_f_operating_activities_fq_h","cash_f_investing_activities_fy_h","cash_f_investing_activities_fq_h","cash_f_financing_activities_fy_h","cash_f_financing_activities_fq_h","fiscal_period_fy_h","fiscal_period_fq_h","fiscal_period_fh_h","earnings_release_date_fq_h","earnings_release_next_date_fq","earnings_per_share_forecast_next_fq","earnings_per_share_forecast_fq_h","earnings_per_share_fq_h","earnings_fiscal_period_fq_h","next_earnings_fiscal_period_fq","is_next_earnings_release_date_estimated","symbol-primaryname","currency_code","rates_mc","rates_fy","rates_ttm","measure","value_unit_id","value-unit-id","update_mode","language","local_description","short_description","source","source2","format","recommendation_mark","last_report_frequency","price_target_estimates_num","price_target_average","update_mode_seconds","recommendation_total","recommendation_buy","recommendation_over","recommendation_hold","recommendation_under","recommendation_sell","recommendation_total","price_target_high","price_target_low","rates_pt","rates_pt","total_revenue_fy_h","total_revenue_fq_h","total_revenue_fh_h","net_income_fy_h","net_income_fq_h","net_income_fh_h","total_assets_fy_h","total_assets_fq_h","total_assets_fh_h","total_liabilities_fy_h","total_liabilities_fq_h","total_liabilities_fh_h","cash_f_operating_activities_fy_h","cash_f_operating_activities_fq_h","cash_f_operating_activities_fh_h","cash_f_investing_activities_fy_h","cash_f_investing_activities_fq_h","cash_f_investing_activities_fh_h","cash_f_financing_activities_fy_h","cash_f_financing_activities_fq_h","cash_f_financing_activities_fh_h","fiscal_period_fy","fiscal_period_fq","fiscal_period_fh","earnings_release_date_fq_h","earnings_release_date_fy_h","earnings_release_date_fh_h","earnings_release_next_date_fq","earnings_release_next_date_fy","earnings_release_next_date_fh","earnings_release_next_time","earnings_release_time","is_next_earnings_release_date_estimated","earnings_per_share_forecast_next_fq","earnings_per_share_forecast_next_fy","earnings_per_share_forecast_next_fh","earnings_per_share_forecast_fq_h","earnings_per_share_forecast_fy_h","earnings_per_share_forecast_fh_h","earnings_per_share_fq_h","earnings_per_share_fy_h","earnings_per_share_fh_h","earnings_fiscal_period_fq_h","earnings_fiscal_period_fy_h","earnings_fiscal_period_fh_h","next_earnings_fiscal_period_fq","next_earnings_fiscal_period_fy","next_earnings_fiscal_period_fh","revenue_fq_h","revenue_fy_h","revenue_fh_h","revenue_forecast_fq_h","revenue_forecast_fy_h","revenue_forecast_fh_h","revenue_forecast_next_fq","revenue_forecast_next_fy","revenue_forecast_next_fh","revenue_seg_by_business_h","revenue_seg_by_region_h","dividend_payout_ratio_ttm","dividends_yield_current","dividend_ex_date_upcoming","dividend_amount_upcoming","dividend_amount_recent","dividend_ex_date_recent","dividend_amount_h","total_revenue_fy","total_revenue_fq","total_revenue_fh","gross_profit_fy","gross_profit_fq","gross_profit_fh","ebitda_fy","ebit_fy","net_income_fy","net_income_fq","net_income_fh","total_debt_fy_h","total_debt_fq_h","total_debt_fh_h","free_cash_flow_fy_h","free_cash_flow_fq_h","free_cash_flow_fh_h","cash_n_equivalents_fy_h","cash_n_equivalents_fq_h","cash_n_equivalents_fh_h","total_current_assets_fy","total_current_assets_fq","total_current_assets_fh","total_current_liabilities_fy","total_current_liabilities_fq","total_current_liabilities_fh","total_non_current_assets_fy","total_non_current_assets_fq","total_non_current_assets_fh","total_non_current_liabilities_fy","total_non_current_liabilities_fq","total_non_current_liabilities_fh","loans_net_fy","loans_net_fy_h","loans_net_fq_h","loans_net_fh_h","total_deposits_fy","total_deposits_fy_h","total_deposits_fq_h","total_deposits_fh_h","loan_loss_allowances_fy","loan_loss_allowances_fy_h","loan_loss_allowances_fq_h","loan_loss_allowances_fh_h","reserve_to_total_capital_fy_h","reserve_to_total_capital_fq_h","reserve_to_total_capital_fh_h","unearned_premium_to_total_capital_fy_h","unearned_premium_to_total_capital_fq_h","unearned_premium_to_total_capital_fh_h","insurance_reserves_fy_h","insurance_reserves_fq_h","insurance_reserves_fh_h","policy_claims_fy_h","policy_claims_fq_h","policy_claims_fh_h","premiums_earned_fy_h","premiums_earned_fq_h","premiums_earned_fh_h","price_earnings_fq_h","price_earnings_fy_h","price_earnings_fh_h","price_sales_fq_h","price_sales_fy_h","price_sales_fh_h","diluted_net_income_ttm","total_revenue_ttm","price_earnings_current","price_sales_current","isin-displayed","interest_income_fy_h","interest_income_fq_h","interest_income_fh_h","non_interest_income_fy_h","non_interest_income_fq_h","non_interest_income_fh_h","website","doc","explorer","sources","contracts","crypto_common_categories","crypto_asset","community","dividends_availability","earnings_availability","financials_availability","etf_asset_type_exposure","etf_region_exposure","top_holdings","unit-id","options-info","interest_income_fy","interest_income_fq","interest_income_fh","non_interest_income_fy","non_interest_income_fq","non_interest_income_fh","interest_expense_fy","interest_expense_fq","interest_expense_fh","loan_loss_provision_fy","loan_loss_provision_fq","loan_loss_provision_fh","non_interest_expense_fy","non_interest_expense_fq","non_interest_expense_fh","non_oper_income_fy","non_oper_income_fq","non_oper_income_fh","unusual_expense_inc_fy","unusual_expense_inc_fq","unusual_expense_inc_fh","pretax_income_fy","pretax_income_fq","pretax_income_fh","income_tax_fy","income_tax_fq","income_tax_fh","after_tax_other_income_fy","after_tax_other_income_fq","after_tax_other_income_fh","total_non_oper_income_fy","total_non_oper_income_fq","total_non_oper_income_fh","oper_income_fy","oper_income_fq","oper_income_fh","operating_expenses_fy","operating_expenses_fq","operating_expenses_fh","cost_of_goods_fy","cost_of_goods_fq","cost_of_goods_fh","equity_in_earnings_fy","equity_in_earnings_fq","equity_in_earnings_fh","minority_interest_exp_fy","minority_interest_exp_fq","minority_interest_exp_fh","discontinued_operations_fy","discontinued_operations_fq","discontinued_operations_fh","front_contract","pointvalue","unit_id","expiration","aum","asset_class","focus","expense_ratio","launch_date","issuer","brand","homepage","index_tracked","actively_managed","fund_view_mode","common_equity_tier1_ratio_fy_h","common_equity_tier1_ratio_fq_h","common_equity_tier1_ratio_fh_h","tier1_capital_ratio_fy_h","tier1_capital_ratio_fq_h","tier1_capital_ratio_fh_h","total_capital_ratio_fy_h","total_capital_ratio_fq_h","total_capital_ratio_fh_h","preferred_stock_carrying_value_fh","preferred_stock_carrying_value_fq","total_debt_fq","minority_interest_fh","minority_interest_fq","cash_n_short_term_invest_fq","cash_n_due_f_banks_fh","cash_n_due_f_banks_fq","enterprise_value_current","etf_holdings_count","contract-description","reference-last-period","all_time_high","all_time_high_day","all_time_low","all_time_low_day","outstanding_amount","nominal_value","denom_min","current_coupon","coupon_type_general","coupon_frequency","yield_to_maturity","maturity-date","days_to_maturity","bond_issuer","issue_date","bond_issuer_stock_symbol"]),o=new r({
fields:n})},90277:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>a,getQuoteSessionInstance:()=>o});var s=i(4097),r=i.n(s);const n={};function o(e="full"){return n[e]||function(e="full",t){n[e]=t}(e,new(r())(e)),n[e]}function a(){for(const e in n)if(n.hasOwnProperty(e)){const t=n[e];void 0!==t&&t.destroy(),delete n[e]}}},98525:(e,t,i)=>{"use strict";i.d(t,{QuoteSession:()=>r});var s=i(92184);class r{constructor(e,t=(0,s.randomHash)()){this._sessionstarted=!1,this._globalHandler=null,this._chartApi=e,this._sessionid="qs_"+t}destroy(){this._sessionstarted&&(this._chartApi.quoteDeleteSession(this._sessionid),this._sessionstarted=!1)}connected(){return this._chartApi.connected()}connect(e){this._globalHandler=e,this._chartApi.createSession(this._sessionid,this),this._chartApi.connect()}disconnect(){this._chartApi.disconnect()}quoteAddSymbols(e){this._chartApi.quoteAddSymbols(this._sessionid,e)}quoteRemoveSymbols(e){this._chartApi.quoteRemoveSymbols(this._sessionid,e)}quoteFastSymbols(e){this._chartApi.quoteFastSymbols(this._sessionid,e)}quoteSetFields(e){this._chartApi.quoteSetFields(this._sessionid,e)}onMessage(e){var t;switch(e.method){case"connected":this._sessionstarted||(this._chartApi.quoteCreateSession(this._sessionid),this._sessionstarted=!0);break;case"disconnected":this._sessionstarted=!1}null===(t=this._globalHandler)||void 0===t||t.call(this,e)}quoteHibernateAll(){this._chartApi.quoteHibernateAll(this._sessionid)}}window.TradingView.QuoteSession=r},4097:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(43370).default,r=i(12481).default,n=i(725).PriceFormatter;const{uniq:o}=i(97144);var a=i(92184);const{normalizeUpdateMode:l}=i(5370);var c=i(31054).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(62945);var u=i(52033).Delegate;var p;function _(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new u,this.onDisconnect=new u,this._quoteApi=new p(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=r(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}p=i(98525).QuoteSession,_.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},_.prototype.typeFields={},_.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","currency_id","base_currency_id","current_session","description","exchange","format","fractional","is_tradable","language","local_description","listed_exchange","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","typespecs","update_mode","volume","variable_tick_size","value_unit_id","unit_id","measure"],
_.prototype.typeFields.simpleDetailed=[].concat(_.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),_.prototype.typeFields.full=[],_.prototype.typeFields.watchlist=[].concat(_.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id"]),_.prototype.typeFields.portfolio=["pro_name","short_name","exchange","listed_exchange","description","local_description","language","sector","type","typespecs","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_calc","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm","format","value_unit_id","unit_id","measure"],_.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type","typespecs"],_.prototype.typeFields.estimates=["fundamental_data","type","typespecs","earnings_per_share_forecast_next_symbol_currency_fq","earnings_release_next_aligned_date","earnings_release_next_calendar_date","earnings_release_next_date"],_.prototype.typeFields.economic=["reference-last-period","lp","currency_code","value_unit_id","unit_id","measure"],_.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},_.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},_.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()),this.onConnect.fire()},_.prototype.setFields=function(){var e=_.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},_.prototype.onSymbolData=function(e){try{e.status&&h.update(e,d,!1)}catch(e){}var t=e.symbolname,i=this._throttledSymbolData[t];i||(i=this._throttledSymbolData[t]={fnDispatch:s(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?c(i.cache,e):i.cache=e,i.fnDispatch(t)},_.prototype._parseUpdateMode=function(e){l(e)},_.prototype.dipatchSymbolData=function(e){var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache
;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in c(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var r=this._subscriptions[s];r.has(e)&&[...r.get(e)].forEach((function(e){e(t,i)}))}},_.prototype.subscribe=function(e,t,i){this._subscriptions[e]=this._subscriptions[e]||new Map;var s=this._subscriptions[e];t=[].concat(t);var r=[];t.forEach((function(e){this._symbol_data[e]?s&&s.has(e)||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},r.push(e)),s.has(e)||s.set(e,[]),s.get(e).push(i),s.get(e).fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])}),this),r.length&&this._connected&&(this._quoteApi.quoteAddSymbols(r),this._delayUpdateFastSymbols())},_.prototype.unsubscribe=function(e,t,i){t=[].concat(t);for(var s=this._subscriptions[e],r=[],n=0;n{"use strict";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,n){return r(s(e,t,new Map),i,n)}function o(e,t,i,r,n){const o=s(e,t,new Map),a=s(o,i,new Map);return s(a,r,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>o});class a{constructor(){this._map=new Map,this._size=0}size(){return this._size}clear(){this._map.clear(),this._size=0}}},29981:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>v,indexOf:()=>f,intersect:()=>_,join:()=>m,lowerbound:()=>o,lowerboundExt:()=>n,lowerbound_int:()=>a,mapEntriesGenerator:()=>y,moveAfter:()=>u,moveBefore:()=>p,moveToHead:()=>d,nestedMapGenerator:()=>S,removeItemFromArray:()=>g,subtract:()=>h,upperbound:()=>l,upperbound_int:()=>c});var s=i(50151);function r(e,t){return e>1,o=s+r;i(e(o),t)?(s=o+1,n-=r+1):n=r}return s}function o(e,t,i,s=0,r=e.length){return n((t=>e[t]),t,i,s,r)}function a(e,t,i=0,s=e.length){return o(e,t,r,i,s)}function l(e,t,i,s=0,r=e.length){let n=r-s;for(;0>1,o=s+r;i(t,e[o])?n=r:(s=o+1,n-=r+1)}return s}function c(e,t,i=0,s=e.length){return l(e,t,r,i,s)}function h(e,t){return e.filter((e=>!t.includes(e)))}function d(e,t){const i=e.indexOf(t);return i<0?e.slice():[t].concat(e.slice(0,i)).concat(e.slice(i+1))}function u(e,t,i){const s=new Set(t),r=[],n=[],o=[];return e.forEach(((e,t)=>{s.has(e)?n.push(e):(r.push(e),o.push(t))})),i=i{s.has(e)?n.push(e):(r.push(e),o.push(t))})),i=i<=e.length-1?a(o,i):r.length,r.splice(i,0,...n),{newItems:r,movedItemsStartIndex:i}}function _(e,t){const i=new Set;return e.forEach((e=>{t.has(e)&&i.add(e)})),i}function m(e,t){const i=new Set(e);return t.forEach((e=>i.add(e))),i}function g(e,t){const i=e.indexOf(t);(0,s.assert)(-1!==i,"Item is not found"),e.splice(i,1)}function f(e,t){for(let i=0;i{"use strict";var s=i(84917),r=i(23998).tzData;let n;function o(e){this._name=e;var t=r[e];if(!t&&n&&(t=n.instance().getTimezoneData(e)),t||(t={time:[],offset:[]},this._invalid=!0),t.time.length!==t.offset.length&&(t={time:[],offset:[]},this._invalid=!0),!t.time_utc){for(var i=t.time,s=t.offset,o=i.length,a=new Array(o),l=0;lt){if((r=n-1)0&&e-t[s-1]<=r)return r;return 0},o.prototype.is_valid=function(){return!this._invalid},o._offset=function(e,t,i){var s=a(e,i);return-1===s?0:t[s]};var l=function(e){return 0|e},c=function(e){return 60*e*1e3},h=function(e,t){return d(e)-d(t)},d=function(e){return e<0?l(e/1e3)-(e%1e3!=0?1:0):l(e/1e3)};function u(e){return e%4==0&&(e%100!=0||e%400==0)}var p={0:0,1:31,2:59,3:90,4:120,5:151,6:181,7:212,8:243,9:273,10:304,11:334},_={...s.WeekDays,...s.Months,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,MINUTE:12,SECOND:13,minutesPerDay:1440,millisecondsPerDay:c(1440),get_minutes_from_hhmm:function(e){return-1!==e.indexOf(":")&&(e=e.split(":").join("")),e%100+60*l(e/100)},get_year:function(e){return e.getUTCFullYear()},get_month:function(e){return e.getUTCMonth()},get_hours:function(e){return e.getUTCHours()},get_minutes:function(e){return e.getUTCMinutes()},get_seconds:function(e){return e.getUTCSeconds()},get_day_of_month:function(e){return e.getUTCDate()},get_day_of_week:function(e){return e.getUTCDay()+1},get_day_of_year:function(e){var t=e.getUTCMonth(),i=p[t];return t>_.JANUARY+1&&u(e.getUTCFullYear())&&(i+=1),i+e.getUTCDate()},get_week_of_year:function(e){var t=new Date(Date.UTC(e.getUTCFullYear(),0,1)).getUTCDay(),i=0===t?1:8-t,s=_.get_day_of_year(e)-i;return Math.ceil(s/7)+1},get_minutes_from_midnight:function(e){return 60*_.get_hours(e)+_.get_minutes(e)},set_hms:function(e,t,i,s,r,n){e.setUTCHours(t),e.setUTCMinutes(i),e.setUTCSeconds(s),e.setUTCMilliseconds(r),void 0!==n&&_.correct_time(e,n)},correct_time:function(e,t){var i=e.getTime(),s=t.correction_loc(i);e.setTime(i+s)},add_days_considering_dst:function(e,t,i){var s=e.offset_utc(t),r=this.clone(t);this.add_date(r,i);var n=e.offset_utc(r);return r.setTime(r.getTime()+s-n),r},add_years_considering_dst:function(e,t,i){let s=t;for(let t=Math.abs(i);t>0;t--)s=this.add_days_considering_dst(e,s,this.get_days_per_year(s)*Math.sign(i));return s},add_date:function(e,t){e.setTime(e.getTime()+t*_.millisecondsPerDay)},add_minutes:function(e,t){e.setTime(e.getTime()+c(t))},clone:function(e){return new Date(e.getTime())},get_days_per_year:function(e){var t=e.getUTCFullYear();return this.days_per_year(t)},days_per_year:function(e){return u(e)?366:365},get_days_in_month:function(e,t){let i;switch(e){case 0:case 2:case 4:case 6:case 7:case 9:case 11:i=31;break;case 1:i=28,u(t)&&i++;break;default:i=30}return i},get_part:function(e,t){switch(t){case _.YEAR:
return _.get_year(e);case _.MONTH:return _.get_month(e);case _.DAY_OF_MONTH:return _.get_day_of_month(e);case _.WEEK_OF_YEAR:return _.get_week_of_year(e);case _.DAY_OF_WEEK:return _.get_day_of_week(e);case _.HOUR_OF_DAY:return _.get_hours(e);case _.MINUTE:return _.get_minutes(e);case _.DAY_OF_YEAR:return _.get_day_of_year(e);case _.SECOND:return _.get_seconds(e);default:return e.getTime()}},time_minutes:c,time_seconds:function(e){return 1e3*e},time_minutes_diff:function(e,t){return l(h(e,t)/60)},time_seconds_diff:h,utc_to_cal:function(e,t){return new Date(_.utc_to_cal_ts(e,t))},utc_to_cal_ts:function(e,t){return t+e.offset_utc(t)},get_cal:function(e,t,i,s,r,n,o){var a=new Date(Date.UTC(t,i,s,r||0,n||0,o||0)),l=e.offset_utc(+a);return new Date(a.valueOf()-l)},get_cal_from_unix_timestamp_ms:function(e,t){return new Date(t+e.offset_utc(t))},get_cal_utc:function(e,t,i){return new Date(Date.UTC(e,t,i))},cal_to_utc:function(e,t){var i=t.getTime();return i-e.offset_loc(i)},get_timezone:function(e){return new o(e)},shift_day:function(e,t){var i=e-1;return(i+=t)>6?i%=7:i<0&&(i=(7+i%7)%7),i+1},setCustomTimezones:function(e){n=e}};e.exports=_},51056:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LINESTYLE_DASHED:()=>n,LINESTYLE_DOTTED:()=>r,LINESTYLE_LARGE_DASHED:()=>o,LINESTYLE_SMALL_DASHED:()=>l,LINESTYLE_SOLID:()=>s,LINESTYLE_SPARSE_DOTTED:()=>a});const s=0,r=1,n=2,o=3,a=4,l=5},5201:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>o});var s,r=i(50151);function n(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}!function(e){e[e.CapacityFactor=1.3]="CapacityFactor"}(s||(s={}));class o{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&&(n(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){n(i);const e=(0,r.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&&(n(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,r.ensureNotNull)(this._firstItem);for(let i=0;i{"use strict";i.d(t,{combine:()=>o,combineWithFilteredUpdate:()=>n});var s=i(64147)
;function r(e,t,...i){let r=null;const n=(...t)=>e(...t.map((e=>e.value())),null==r?void 0:r.value()),o=r=new s.WatchedValue(n(...i)),a=()=>{t(...i.map((e=>e.value())))&&o.setValue(n(...i))},l=i.map((e=>e.spawn()));for(const e of l)e.subscribe(a);return o.readonly().spawn((()=>{l.forEach((e=>e.destroy())),i.forEach((e=>e.release()))}))}function n(e,t,...i){return r(e,t,...i)}function o(e,...t){return r(e,(()=>!0),...t)}},63950:(e,t,i)=>{"use strict";i.r(t),i.d(t,{availableTimezones:()=>l,timezoneIsAvailable:()=>u,timezoneIsSupported:()=>p,timezoneTitle:()=>_,updateAvailableTimezones:()=>d});var s=i(82112),r=i(11542);const n=[{id:"Etc/UTC",get title(){return r.t(null,void 0,i(1833))}},{id:"exchange",get title(){return r.t(null,void 0,i(86905))}}],o=[{id:"Africa/Cairo",get title(){return r.t(null,void 0,i(65736))},offset:0},{id:"Africa/Casablanca",get title(){return r.t(null,void 0,i(70409))},offset:0},{id:"Africa/Johannesburg",get title(){return r.t(null,void 0,i(39585))},offset:0},{id:"Africa/Lagos",get title(){return r.t(null,void 0,i(19931))},offset:0},{id:"Africa/Nairobi",get title(){return r.t(null,void 0,i(40977))},offset:0},{id:"Africa/Tunis",get title(){return r.t(null,void 0,i(21007))},offset:0},{id:"America/Anchorage",get title(){return r.t(null,void 0,i(42630))},offset:0},{id:"America/Argentina/Buenos_Aires",get title(){return r.t(null,void 0,i(25282))},offset:0},{id:"America/Bogota",get title(){return r.t(null,void 0,i(73905))},offset:0},{id:"America/Caracas",get title(){return r.t(null,void 0,i(30948))},offset:0},{id:"America/Chicago",get title(){return r.t(null,void 0,i(72452))},offset:0},{id:"America/El_Salvador",get title(){return r.t(null,void 0,i(55502))},offset:0},{id:"America/Juneau",get title(){return r.t(null,void 0,i(67560))},offset:0},{id:"America/Lima",get title(){return r.t(null,void 0,i(59444))},offset:0},{id:"America/Los_Angeles",get title(){return r.t(null,void 0,i(28733))},offset:0},{id:"America/Mexico_City",get title(){return r.t(null,void 0,i(73332))},offset:0},{id:"America/New_York",get title(){return r.t(null,void 0,i(40544))},offset:0},{id:"America/Phoenix",get title(){return r.t(null,void 0,i(14055))},offset:0},{id:"America/Santiago",get title(){return r.t(null,void 0,i(30231))},offset:0},{id:"America/Sao_Paulo",get title(){return r.t(null,void 0,i(91912))},offset:0},{id:"America/Toronto",get title(){return r.t(null,void 0,i(10095))},offset:0},{id:"America/Vancouver",get title(){return r.t(null,void 0,i(32838))},offset:0},{id:"US/Mountain",get title(){return r.t(null,void 0,i(27358))},offset:0},{id:"Asia/Almaty",get title(){return r.t(null,void 0,i(98128))},offset:0},{id:"Asia/Ashkhabad",get title(){return r.t(null,void 0,i(63627))},offset:0},{id:"Asia/Bahrain",get title(){return r.t(null,void 0,i(90594))},offset:0},{id:"Asia/Bangkok",get title(){return r.t(null,void 0,i(47045))},offset:0},{id:"Asia/Chongqing",get title(){return r.t(null,void 0,i(50349))},offset:0},{id:"Asia/Colombo",get title(){return r.t(null,void 0,i(10871))},offset:0},{id:"Asia/Dhaka",get title(){
return r.t(null,void 0,i(24959))},offset:0},{id:"Asia/Dubai",get title(){return r.t(null,void 0,i(23650))},offset:0},{id:"Asia/Ho_Chi_Minh",get title(){return r.t(null,void 0,i(34491))},offset:0},{id:"Asia/Hong_Kong",get title(){return r.t(null,void 0,i(48861))},offset:0},{id:"Asia/Jakarta",get title(){return r.t(null,void 0,i(14995))},offset:0},{id:"Asia/Jerusalem",get title(){return r.t(null,void 0,i(36057))},offset:0},{id:"Asia/Karachi",get title(){return r.t(null,void 0,i(70913))},offset:0},{id:"Asia/Kathmandu",get title(){return r.t(null,void 0,i(54533))},offset:0},{id:"Asia/Kolkata",get title(){return r.t(null,void 0,i(31561))},offset:0},{id:"Asia/Kuala_Lumpur",get title(){return r.t(null,void 0,i(38561))},offset:0},{id:"Asia/Kuwait",get title(){return r.t(null,void 0,i(76614))},offset:0},{id:"Asia/Manila",get title(){return r.t(null,void 0,i(48991))},offset:0},{id:"Asia/Muscat",get title(){return r.t(null,void 0,i(9865))},offset:0},{id:"Asia/Nicosia",get title(){return r.t(null,void 0,i(94600))},offset:0},{id:"Asia/Qatar",get title(){return r.t(null,void 0,i(28756))},offset:0},{id:"Asia/Riyadh",get title(){return r.t(null,void 0,i(37974))},offset:0},{id:"Asia/Seoul",get title(){return r.t(null,void 0,i(26820))},offset:0},{id:"Asia/Shanghai",get title(){return r.t(null,void 0,i(1852))},offset:0},{id:"Asia/Singapore",get title(){return r.t(null,void 0,i(77377))},offset:0},{id:"Asia/Taipei",get title(){return r.t(null,void 0,i(11034))},offset:0},{id:"Asia/Tehran",get title(){return r.t(null,void 0,i(6686))},offset:0},{id:"Asia/Tokyo",get title(){return r.t(null,void 0,i(69122))},offset:0},{id:"Asia/Yangon",get title(){return r.t(null,void 0,i(53168))},offset:0},{id:"Atlantic/Reykjavik",get title(){return r.t(null,void 0,i(13386))},offset:0},{id:"Australia/Adelaide",get title(){return r.t(null,void 0,i(426))},offset:0},{id:"Australia/Brisbane",get title(){return r.t(null,void 0,i(79336))},offset:0},{id:"Australia/Perth",get title(){return r.t(null,void 0,i(24436))},offset:0},{id:"Australia/Sydney",get title(){return r.t(null,void 0,i(31622))},offset:0},{id:"Europe/Amsterdam",get title(){return r.t(null,void 0,i(36485))},offset:0},{id:"Europe/Athens",get title(){return r.t(null,void 0,i(73702))},offset:0},{id:"Europe/Belgrade",get title(){return r.t(null,void 0,i(71797))},offset:0},{id:"Europe/Berlin",get title(){return r.t(null,void 0,i(64313))},offset:0},{id:"Europe/Bratislava",get title(){return r.t(null,void 0,i(70876))},offset:0},{id:"Europe/Brussels",get title(){return r.t(null,void 0,i(91499))},offset:0},{id:"Europe/Bucharest",get title(){return r.t(null,void 0,i(33672))},offset:0},{id:"Europe/Budapest",get title(){return r.t(null,void 0,i(20313))},offset:0},{id:"Europe/Copenhagen",get title(){return r.t(null,void 0,i(38917))},offset:0},{id:"Europe/Dublin",get title(){return r.t(null,void 0,i(79716))},offset:0},{id:"Europe/Helsinki",get title(){return r.t(null,void 0,i(48203))},offset:0},{id:"Europe/Istanbul",get title(){return r.t(null,void 0,i(78326))},offset:0},{id:"Europe/Lisbon",get title(){
return r.t(null,void 0,i(53375))},offset:0},{id:"Europe/London",get title(){return r.t(null,void 0,i(19439))},offset:0},{id:"Europe/Luxembourg",get title(){return r.t(null,void 0,i(81038))},offset:0},{id:"Europe/Madrid",get title(){return r.t(null,void 0,i(52066))},offset:0},{id:"Europe/Malta",get title(){return r.t(null,void 0,i(38365))},offset:0},{id:"Europe/Moscow",get title(){return r.t(null,void 0,i(64039))},offset:0},{id:"Europe/Oslo",get title(){return r.t(null,void 0,i(75722))},offset:0},{id:"Europe/Paris",get title(){return r.t(null,void 0,i(61879))},offset:0},{id:"Europe/Prague",get title(){return r.t(null,void 0,i(81248))},offset:0},{id:"Europe/Riga",get title(){return r.t(null,void 0,i(94022))},offset:0},{id:"Europe/Rome",get title(){return r.t(null,void 0,i(52961))},offset:0},{id:"Europe/Stockholm",get title(){return r.t(null,void 0,i(86716))},offset:0},{id:"Europe/Tallinn",get title(){return r.t(null,void 0,i(79995))},offset:0},{id:"Europe/Vienna",get title(){return r.t(null,void 0,i(23160))},offset:0},{id:"Europe/Vilnius",get title(){return r.t(null,void 0,i(60534))},offset:0},{id:"Europe/Warsaw",get title(){return r.t(null,void 0,i(5959))},offset:0},{id:"Europe/Zurich",get title(){return r.t(null,void 0,i(62859))},offset:0},{id:"Pacific/Auckland",get title(){return r.t(null,void 0,i(66103))},offset:0},{id:"Pacific/Chatham",get title(){return r.t(null,void 0,i(36549))},offset:0},{id:"Pacific/Fakaofo",get title(){return r.t(null,void 0,i(98549))},offset:0},{id:"Pacific/Honolulu",get title(){return r.t(null,void 0,i(79668))},offset:0},{id:"Pacific/Norfolk",get title(){return r.t(null,void 0,i(67891))},offset:0}];function a(e,t,i){const r=function(e){return e.map((e=>{const{id:t}=e,{string:i,offset:r}=(0,s.parseTzOffset)(t);return{id:t,offset:r,get title(){return`(${i}) ${e.title}`}}}))}(e),n=i.filter((({alias:e})=>Boolean(e))).map((e=>{const{alias:t,id:i}=e,{string:r,offset:n}=(0,s.parseTzOffset)(t);return{id:i,offset:n,get title(){return`(${r}) ${e.title}`},alias:t}})),o=function(e){return e.sort(((e,t)=>{const i=e.offset-t.offset;return 0!==i?i:e.title.localeCompare(t.title)}))}(r.concat(n));return t.concat(o)}const l=a(o,n,[]),c=new Map;l.forEach((e=>{c.set(e.id,!0)}));const h=new Map;n.concat(o).forEach((e=>{h.set(e.id,!0)}));const d=e=>{l.splice(0,l.length,...a(o,n,e)),l.forEach((e=>{c.set(e.id,!0)}))};function u(e){return c.has(e)}function p(e){return h.get(e)||!1}function _(e){for(const{id:t,title:i}of o)if(t===e){return`${i} (${(0,s.parseTzOffset)(e).string})`}for(const{id:t,title:i}of l)if(t===e)return`${i}`;return e}},52033:(e,t,i)=>{"use strict";i.d(t,{Delegate:()=>n});const s=(0,i(12168).getLogger)("Common.Delegate");function r(e){return!e.singleShot}class n{constructor(){this.fire=this._fireImpl.bind(this),this._listeners=[]}subscribe(e,t,i){this._listeners.push({object:e,member:t,singleShot:!!i,skip:!1})}unsubscribe(e,t){for(let i=0;i=0;--t){const i=this._listeners[t];i.object===e&&(i.skip=!0,this._listeners.splice(t,1))}}destroy(){this._listeners=[]}_fireImpl(...e){const t=this._listeners;this._listeners=this._listeners.filter(r);const i=t.length;for(let r=0;r{"use strict";i.d(t,{formatStudyError:()=>n,triesTranslateError:()=>r});var s=i(11542);function r(e){return o.get(e)||e}function n(e){return e.format({boldHighlightStart:"",boldHighlightEnd:""})}const o=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void 0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(69156))],["Runtime error",s.t(null,void 0,i(60630))],["Access error",s.t(null,void 0,i(77401))],["User-defined error",s.t(null,void 0,i(8580))],["Compilation error",s.t(null,void 0,i(12086))]])},19938:(e,t,i)=>{"use strict";i.d(t,{getImage:()=>n});const s=new Map;function r(e){e.crossOrigin="anonymous"}function n(e,t,i=r){let n=s.get(e);return void 0===n&&(n=new Promise(((e,s)=>{const r=new Image;r.onload=()=>{e(r),r.onload=null,r.onerror=null},r.onerror=()=>{s(),r.onload=null,r.onerror=null},i(r),r.src=t})),s.set(e,n)),n}},34776:(e,t,i)=>{"use strict";function s(e){const t=Object.create(e);return t.release=()=>{},t.ownership=()=>t,t}function r(e){const t=Object.create(e);return t.release=()=>e.destroy(),t.ownership=()=>t,t}i.d(t,{ownership:()=>r,weakReference:()=>s})},12168:(e,t,i)=>{"use strict";i.d(t,{LOGLEVEL:()=>n,getLogHistory:()=>b,getLogLevel:()=>g,getLogger:()=>C,getRawLogHistory:()=>y,isHighRateEnabled:()=>f,loggingOff:()=>T,loggingOn:()=>x,serializeLogHistoryEntry:()=>S,setLogLevel:()=>v});const s="undefined"!=typeof window?window:{};let r=!1;try{localStorage.getItem(""),r=!0}catch(e){}var n;!function(e){e[e.ERROR=1]="ERROR",e[e.WARNING=2]="WARNING",e[e.INFO=3]="INFO",e[e.NORMAL=4]="NORMAL",e[e.DEBUG=5]="DEBUG"}(n||(n={}));let o=0;const a="tv.logger.loglevel",l="tv.logger.logHighRate",c=[];let h=null,d=null,u=null,p=NaN,_=n.WARNING,m=!1;function g(){return _}function f(){return m}function v(e){e=Math.max(n.ERROR,Math.min(n.DEBUG,e)),_=e,I()}function y(e,t){let i=c.reduce(((e,t)=>e.concat(t)),[]);return i.sort(((e,t)=>e.id-t.id)),void 0!==t&&(i=i.filter((e=>e.subSystemId===t))),"number"==typeof e&&(i=i.slice(-e)),i}function S(e){return new Date(e.timestamp).toISOString()+":"+e.subSystemId+":"+e.message.replace(/"/g,"'")}
const b=s.lget=(e,t)=>function(e,t){let i,s=0,r=0;for(i=e.length-1;i>=1&&(s+=8*(1+encodeURIComponent(e[i]).length),!(i-1>0&&(r=8*(1+encodeURIComponent(e[i-1]).length),s+r>t)));i--);return e.slice(i)}(y(e,t).map(S),75497472);function w(e,t,i,s){if(t===d&&s.id===u)return;const r=new Date;if(e<=n.NORMAL&&function(e,t,i,s,r){"function"==typeof structuredClone&&(t=structuredClone(t));const n={id:o,message:t,subSystemId:s,timestamp:Number(e)};o+=1,i.push(n),void 0!==r&&i.length>r&&i.splice(0,1)}(r,t,i,s.id,s.maxCount),e<=_&&(!s.highRate||f())&&(!h||s.id.match(h))){const i=r.toISOString()+":"+s.id+":"+t;switch(e){case n.DEBUG:console.debug(i);break;case n.INFO:case n.NORMAL:s.color?console.log("%c"+i,"color: "+s.color):console.log(i);break;case n.WARNING:console.warn(i);break;case n.ERROR:console.error(i)}d=t,u=s.id,p&&clearTimeout(p),p=setTimeout((()=>{d=null,u=null,p=NaN}),1e3)}}function C(e,t={}){const i=[];c.push(i);const s=Object.assign(t,{id:e});function r(e){return t=>w(e,String(t),i,s)}return{logDebug:r(n.DEBUG),logError:r(n.ERROR),logInfo:r(n.INFO),logNormal:r(n.NORMAL),logWarn:r(n.WARNING)}}const P=C("logger"),x=s.lon=(e,t)=>{v(n.DEBUG),P.logNormal("Debug logging enabled"),m=Boolean(e),h=t||null,I()},T=s.loff=()=>{v(n.INFO),P.logInfo("Debug logging disabled")};function I(){try{r&&(localStorage.setItem(l,String(m)),localStorage.setItem(a,String(_)))}catch(e){P.logWarn(`Cannot save logger state (level: ${_}, high-rate: ${m}) to localStorage: ${e.message}`)}}!function(){m=!!r&&"true"===localStorage.getItem(l);let e=parseInt(r&&localStorage.getItem(a)||"");Number.isNaN(e)&&(e=n.WARNING),v(e),P.logNormal(`Init with settings - level: ${_}, high-rate: ${m}`)}(),s.performance&&s.performance.now?P.logNormal(`Sync logger and perf times, now is ${s.performance.now()}`):P.logWarn("Perf time is not available")},9859:(e,t,i)=>{"use strict";function s(e,t,i){return Math.min(Math.max(e,t),i)}function r(e){return e<0?-1:e>0?1:0}function n(e){if(e<0)return!1;if(e>1e18)return!0;for(let t=e;t>1;t/=10)if(t%10!=0)return!1;return!0}function o(e,t,i){return t-e<=i}function a(e,t,i){return Math.abs(e-t)t?1:0}function h(e,t=c){if(e.length<1)throw Error("array is empty");let i=e[0];for(let s=0;s0&&(i=e[s]);return i}function d(e){const t=Math.ceil(e);return t%2!=0?t-1:t}function u(e){return e>0?Math.floor(e):Math.ceil(e)}i.d(t,{ceiledEven:()=>d,clamp:()=>s,equal:()=>a,greaterOrEqual:()=>o,isBaseDecimal:()=>n,log10:()=>l,max:()=>h,sign:()=>r,toInt:()=>u})},82112:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>r});var s=i(2740);function r(e,t=Date.now()){const i=(0,s.get_timezone)(e).offset_utc(t);let r="";const n=i/1e3/60/60;n%1&&(r=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));let o="";return o=n>0?"+"+(n-n%1)+r:0===n?"":String(n-n%1+r),{offset:i,string:"UTC"+o}}},78954:(e,t,i)=>{"use strict";function s(e){return e.includes(":")?e.split(":"):["",e]}i.d(t,{splitSymbolName:()=>s})},4362:(e,t,i)=>{"use strict"
;function s(e,t){return!!(null==t?void 0:t.includes("cfd"))&&["commodity","futures","index","stock","fund"].includes(e)}i.d(t,{isCFDSymbol:()=>s})},13665:(e,t,i)=>{"use strict";var s=i(56570),r=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],n=function(){var e=[{pattern:"(",ctor:o},{pattern:")",ctor:a},{pattern:"+",ctor:c},{pattern:"-",ctor:h},{pattern:"*",ctor:d},{pattern:"/",ctor:u},{pattern:"^",ctor:p},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,ctor:f},{pattern:/\./,ctor:S},{pattern:s.enabled("charting_library_base")?/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&]*|'.+?'/:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!|:.&]*|'.+?'/,ctor:g},{pattern:/'[^']*/,ctor:y},{pattern:/[\0-\x20\s]+/,ctor:n}];function t(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function i(){}function n(e){this.value=e}function o(){}function a(){}function l(){}function c(){}function h(){}function d(){}function u(){}function p(){}i.prototype.toString=function(){return this.value},t(n,i),t(o,i),o.prototype.value="(",t(a,i),a.prototype.value=")",t(l,i),t(c,l),c.prototype.value="+",c.prototype.precedence=0,c.prototype.commutative=!0,t(h,l),h.prototype.value="-",h.prototype.precedence=0,h.prototype.commutative=!1,t(d,l),d.prototype.value="*",d.prototype.precedence=1,d.prototype.commutative=!0,t(u,l),u.prototype.value="/",u.prototype.precedence=1,u.prototype.commutative=!1,t(p,l),p.prototype.value="^",p.prototype.precedence=2,p.prototype.commutative=!1;var _=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,m=/[+\-/*]/;function g(e){this.value=e}function f(e){this.value=e}function v(e){this.value=e}function y(){g.apply(this,arguments)}function S(){f.apply(this,arguments)}t(g,i),g.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=m.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},g.prototype.parse=function(){var e=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},g.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(var e=function(e){return r.some((function(t){return t.t===e}))},t=2;t>=1;--t){var i=this._ticker.slice(0,t);if(e(i)){this._root=i,this._contract=this._ticker.slice(t);break}}},g.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._exchange;null==e?delete this._exchange:this._exchange=e+""},g.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null==e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},g.prototype.root=function(e){
if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},g.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},t(f,i),f.prototype.toString=function(){return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},f.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},v.prototype.toString=function(){return this.value},t(y,g),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},t(S,f),S.prototype.isIncomplete=!0;var b=new RegExp(e.map((function(e){return"("+("string"==typeof e.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");function w(t,i){var s,r=[];e:for(;s=b.exec(t);){for(var o=e.length;o--;)if(s[o+1]){if(e[o].ctor){var a=new e[o].ctor(s[o+1]);a._offset=s.index,r.push(a)}continue e}var l=new v(s[0]);l._offset=s.index,r.push(l)}if(i&&i.recover){var c;for(o=r.length;o--;){var h=r[o];if(h instanceof f||h instanceof g){if(void 0!==c){var d=new g(""),u=r.splice(o,c-o+1,d);d.value=u.map((function(e){return e.value})).join("")}c=o}else h instanceof n||(c=void 0)}}return r}function C(e){for(var t=[],i=0;in.precedence&&(s[s.length-1].minPrecedence=n.precedence);else if(n instanceof o)s.push(t={minPrecedence:1/0,openBraceIndex:r});else if(n instanceof a){var c=e[(t=s.pop()).openBraceIndex-1],h=e[r+1];h instanceof l&&!(h.precedence<=t.minPrecedence)||!(!(c instanceof l)||c.precedencet.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(r=i.length;r--;)e.splice(i[r],1);return e}function x(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return(e=w(e)).filter((function(e){return e instanceof g})).map((function(e){return e.exchange()})).filter((function(e){return e}))}function T(e){return 1!==(e=x(e)).length?null:e[0]}function I(e,t){return(e=x(e)).some((function(e){return t.includes((e||"").toUpperCase())}))}function M(e){return e.join("")}return{tokenize:w,validate:function(e){if(s.enabled("charting_library_base"))return{currentState:"var"};for(var t="init",i="var",r=t,c={warnings:[],errors:[],isEmpty:!0},h=[],d=0;d{"use strict";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)}}},23998:e=>{e.exports.tzData={"America/New_York":{time:[-2717668562,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1536530400,-1523224800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-76941e4,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-17762,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Los_Angeles":{
time:[-2717668378,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-769420800,-765410400,-687995940,-662680800,-620866800,-608162400,-589417200,-576108e3,-557967600,-544658400,-526518e3,-513208800,-495068400,-481759200,-463618800,-450309600,-431564400,-418255200,-400114800,-386805600,-368665200,-355356e3,-337215600,-323906400,-305766e3,-292456800,-273711600,-261007200,-242262e3,-226533600,-210812400,-195084e3,-179362800,-163634400,-147913200,-13158e4,-116463600,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-28378,-28800,-25200,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Chicago":{
time:[-2717668236,-1633298400,-1615154400,-1601848800,-1583704800,-1563746400,-1551650400,-1538949600,-1520200800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1067810400,-1045432800,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-769413600,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-21036,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]},"America/Phoenix":{time:[-2717670498,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-820540740,-812678340,-796867140,-84405600,-68680800,1924966800],offset:[-26898,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]},"America/Toronto":{
time:[-2366755200,-1632088800,-1615154400,-1601771400,-1583712e3,-1567375200,-1554681600,-1534716e3,-1524088800,-1503266400,-149238e4,-1471816800,-1460930400,-1440972e3,-1428876e3,-1409522400,-1397426400,-1378072800,-1365976800,-1346623200,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1188770400,-1176069600,-1157320800,-1144015200,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-880232400,-76941e4,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-634168800,-620863200,-602719200,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-19052,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Vancouver":{
time:[-2713910400,-1632088800,-1615154400,-880236e3,-769420800,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-386805600,-368661600,-355356e3,-337212e3,-323906400,-305762400,-292456800,-273708e3,-261007200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-29548,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Argentina/Buenos_Aires":{time:[-2372112e3,-1567468800,-1233446400,-1222992e3,-1205971200,-1194048e3,-117288e4,-1162512e3,-1141344e3,-1130976e3,-1109808e3,-109944e4,-1078272e3,-1067817600,-1046649600,-1036281600,-1015113600,-1004745600,-983577600,-973209600,-952041600,-941587200,-931046400,-900892800,-890352e3,-83376e4,-82728e4,-752284800,-733795200,-197337600,-190857600,-184204800,-164505600,-152668800,-132969600,-121132800,-101433600,-86832e3,-71107200,-54777600,-39052800,-23328e3,-7603200,128131200,136598400,596937600,605059200,624412800,636508800,656467200,667958400,687916800,699408e3,719366400,731462400,938908800,952041600,1198972800,1205625600,1224374400,1237075200,1924981200],offset:[-14028,-15408,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-10800,-10800,-7200,-10800,-7200,-10800]},"America/El_Salvador":{time:[-1546300800,546998400,559699200,578448e3,591148800,1924970400],offset:[-21408,-21600,-18e3,-21600,-18e3,-21600]},"America/Sao_Paulo":{
time:[-1767225600,-1206968400,-1191369600,-1175385600,-1159833600,-633830400,-622076400,-602294400,-59184e4,-570758400,-560217600,-539136e3,-53136e4,-195436800,-184204800,-155174400,-150076800,-128908800,-121132800,-99964800,-89596800,-68428800,-57974400,499737600,511228800,530582400,540259200,562118400,571190400,592963200,602035200,624412800,634694400,656467200,666748800,687916800,697593600,719971200,728438400,750816e3,761702400,782265600,793152e3,813715200,823996800,84456e4,856051200,876096e3,888710400,908064e3,919555200,938908800,951609600,970963200,982454400,1003017600,1013904e3,1036281600,1045353600,1066521600,1076803200,1099353600,1108857600,1129420800,1140307200,1162684800,1172361600,119232e4,1203206400,1224374400,1234656e3,1255824e3,1266710400,1287273600,129816e4,1318723200,1330214400,1350777600,1361059200,1382227200,1392508800,1413676800,1424563200,1445126400,1456012800,1476576e3,1487462400,1508025600,1518912e3,1541289600,1550361600,1924981200],offset:[-11188,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800]},"America/Bogota":{time:[-2707689600,-1739059200,704851200,729043200,1924974e3],offset:[-17776,-17776,-18e3,-14400,-18e3]},"America/Caracas":{time:[-2524521600,-1826755200,-157766400,1197169200,1462069800,1924977600],offset:[-16064,-16060,-16200,-14400,-16200,-14400]},"America/Anchorage":{
time:[-3225173303,-2188987200,-880236e3,-769428e3,-765410400,-86918400,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,438998400,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[50424,-35976,-36e3,-32400,-32400,-36e3,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-32400,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400]},"Europe/Moscow":{
time:[-2840140800,-1688256e3,-165681e4,-1641340800,-1627956e3,-1618700400,-1596416400,-1593804521,-1589846400,-1542416400,-1539478800,-1525305600,-1522713600,-1491177600,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1414288800,1925002800],offset:[9017,9017,9079,12679,9079,16279,12679,16279,14400,10800,14400,18e3,14400,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800]},"Europe/Athens":{time:[-2344636800,-1686095940,-1182988800,-1178150400,-906854400,-904867200,-85725e4,-844473600,-828230400,-812419200,-552355200,-541641600,166492800,186195600,198036e3,213764400,228880800,244090800,260330400,275457600,291805200,307418400,323395200,338947200,354682800,370411200,386132400,401860800,417582e3,433310400,449031600,465364800,481086e3,496814400,512535600,528264e3,543985200,559713600,575434800,591163200,606884400,622612800,638334e3,654667200,670388400,686116800,701838e3,717566400,733287600,749016e3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],
offset:[5692,5692,7200,10800,7200,10800,7200,3600,7200,3600,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Belgrade":{time:[-2713910400,-905821200,-85725e4,-844552800,-828219600,-812498400,-79677e4,-777938400,-766616400,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[4920,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Berlin":{
time:[-2422051200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-776556e3,-765925200,-761173200,-748476e3,-733266e3,-717627600,-714603600,-71037e4,-701902800,-684972e3,-670453200,-654127200,-639003600,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3208,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Bratislava":{
time:[-3786825600,-2469398400,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-746575200,-733352400,-728514e3,-72126e4,-716421600,-701902800,-684972e3,-670453200,-654213600,-639003600,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3464,3464,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Bucharest":{
time:[-2469398400,-1213142400,-1187049600,-1175468400,-1159747200,-1144018800,-1127692800,-1111964400,-1096243200,-1080514800,-1064793600,-1049065200,-1033344e3,-1017615600,-1001894400,-986166e3,-970444800,-954716400,296611200,307497600,323823600,338950800,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670377600,686106e3,701827200,717555600,733276800,749005200,764726400,780451200,796176e3,811900800,828230400,846374400,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[6264,6264,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Budapest":{
time:[-2498256e3,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1600466400,-1587243600,-1569708e3,-1555189200,-906771600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-778467600,-762649200,-749685600,-733269600,-717631200,-701902800,-686181600,-670453200,-654127200,-639003600,-492652800,-481161600,-461196e3,-449701200,-428536800,-418251600,-397087200,-386802e3,323827200,338950800,354672e3,370400400,386121600,40185e4,417571200,433299600,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[4580,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/London":{
time:[-3852662400,-1691964e3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034e3,-1570399200,-1552165200,-1538344800,-152253e4,-15075e5,-1490562e3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732e3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314e3,-1315778400,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-118998e4,-1175461200,-1159135200,-1143406800,-1126476e3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058e3,-1032127200,-1017608400,-1001282400,-986158800,-969228e3,-950475600,-942012e3,-904514400,-896043600,-875484e3,-864594e3,-844034400,-832539600,-812584800,-798066e3,-781048800,-772059600,-764802e3,-748476e3,-733352400,-719445600,-717026400,-706741200,-699483600,-687996e3,-668034e3,-654732e3,-636584400,-622072800,-605739600,-590623200,-57429e4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422e4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298e3,-306972e3,-291848400,-276732e3,-257979600,-245282400,-22653e4,-213228e3,-195080400,-182383200,-163630800,-150933600,-132181200,-119484e3,-100731600,-88034400,-68677200,-59004e3,-37238400,57726e3,69818400,89175600,101268e3,120625200,132717600,152074800,164167200,183524400,196221600,214974e3,227671200,246423600,259120800,278478e3,290570400,309927600,32202e4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676e3,543978e3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,733280400,751428e3,76473e4,782877600,796179600,814327200,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],
offset:[-75,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Luxembourg":{time:[-2069712e3,-1692493200,-1680476400,-1662339600,-165015e4,-1632002400,-1618693200,-1612656e3,-1604278800,-1585515600,-1574038800,-1552255200,-1539997200,-1520546400,-1507510800,-1490569200,-1473642e3,-1459116e3,-1444006800,-142767e4,-1411866e3,-1396220400,-1379293200,-1364770800,-1348448400,-1333321200,-1316394e3,-1301266800,-1284339600,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-1191189600,-1175461200,-1160344800,-1143406800,-1127685600,-1111957200,-1096840800,-1080507600,-1063576800,-1049058e3,-1033336800,-1017608400,-1002492e3,-986158800,-969228e3,-950475600,-942012e3,-935182800,-85725e4,-844552800,-828219600,-812498400,-797979600,-781048800,-766616400,-745452e3,-733266e3,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[1476,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Madrid":{time:[-2177453684,-1631926800,-1616886e3,-1601168400,-158535e4,-1442451600,-142767e4,-1379293200,-1364770800,-1348448400,-1333321200,-1316390400,-1301266800,-1284339600,-1269817200,-1026954e3,-1017615600,-1001898e3,-999478800,-986083200,-954111600,-940208400,-873075600,-862614e3,-842835600,-828313200,-811386e3,-796863600,-779936400,-765414e3,-748486800,-733964400,-652323600,-639010800,135126e3,150253200,166575600,181702800,196815600,212547600,22887e4,243997200,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[-884,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Paris":{time:[-2486592e3,-1855958400,-1689814800,-1680393600,-1665363600,-1648339200,-1635123600,-1616889600,-1604278800,-158544e4,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1470618e3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224e3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1253494800,-1238371200,-1221440400,-1206921600,-1191200400,-1175472e3,-1160355600,-1143417600,-1127696400,-1111968e3,-1096851600,-1080518400,-1063587600,-1049068800,-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942012e3,-932432400,-85725e4,-844552800,-828219600,-812498400,-800064e3,-796258800,-781048800,-766616400,196822800,212547600,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[561,561,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Prague":{time:[-3786825600,-2469398400,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-746575200,-733352400,-728514e3,-72126e4,-716421600,-701902800,-684972e3,-670453200,-654213600,-639003600,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3464,3464,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Rome":{
time:[-3252096e3,-2403562204,-1690761600,-168048e4,-1664755200,-1648944e3,-163512e4,-1616889600,-1604275200,-1585526400,-1571011200,-1555286400,-932428800,-85725e4,-844552800,-828219600,-812498400,-798066e3,-781048800,-76671e4,-750895200,-733352400,-719452800,-70191e4,-689205600,-670453200,-114048e3,-103161600,-81993600,-71708400,-50544e3,-40258800,-18489600,-8204400,1296e4,23245200,43804800,54694800,75859200,86749200,107913600,118198800,138758400,149648400,170812800,181098e3,202262400,212547600,233107200,243997200,265161600,276051600,296611200,307501200,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[2996,2996,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Vienna":{
time:[-2422051200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1569708e3,-1555794e3,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-780181200,-748476e3,-733266e3,-717631200,-701902800,-684972e3,-670453200,323827200,338947200,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3921,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Warsaw":{
time:[-2840140800,-1717027200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1600466400,-1587157200,-1501718400,-931730400,-85725e4,-844552800,-828219600,-812498400,-796600800,-778723200,-762652800,-748483200,-733266e3,-715212e3,-701902800,-684972e3,-670453200,-654127200,-639003600,-397090800,-386805600,-371084400,-355356e3,-334191600,-323301600,-307580400,-291852e3,-271292400,-260402400,-239842800,-228952800,-208393200,-197503200,-176338800,-166053600,228877200,244000800,260326800,276055200,291776400,307504800,323830800,338954400,354675600,370404e3,386125200,401853600,417574800,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978e3,559706400,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[5040,5040,3600,7200,3600,7200,3600,7200,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Istanbul":{
time:[-2840140800,-1869868800,-1693699200,-168048e4,-1570406400,-1552176e3,-1538352e3,-1522540800,-1507507200,-1490572800,-1440201600,-1428019200,-1409702400,-1396483200,-931046400,-922665600,-917827200,-892425600,-875836800,-764726400,-744336e3,-733795200,-716428800,-701913600,-684979200,-670464e3,-654134400,-639014400,-62208e4,-60696e4,-590025600,-575510400,-235612800,-194832e3,-177724800,-165715200,107917200,121226400,133927200,152676e3,164685600,184125600,196221600,215575200,228880800,245815200,260330400,267926400,428464800,433908e3,468122400,482806800,496720800,512528400,528256800,543978e3,559706400,575427600,591156e3,606877200,622605600,638326800,65466e4,670381200,686109600,701830800,717559200,733280400,749008800,764125200,780458400,796179600,811908e3,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301281200,1319947200,1332644400,1351396800,1364698800,1382846400,1396234800,1414296e3,1427598e3,1446955200,1459047600,1473206400,1925002800],offset:[6952,7016,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,10800,14400,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,10800]},"Europe/Zurich":{time:[-3675196800,-2385244800,-904431600,-891122400,-872982e3,-859672800,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[2048,1786,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Australia/Sydney":{time:[-2364076800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Australia/Brisbane":{time:[-2366755200,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,625629600,636519600,657079200,667969200,688528800,699418800,1925028e3],offset:[36728,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3]},"Australia/Adelaide":{
time:[-2364076800,-2230156800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,637729200,657079200,667969200,688528800,701233200,719978400,731473200,752032800,764132400,783482400,796186800,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,972784800,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[33260,32400,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800]},"Australia/ACT":{
time:[-2364076800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Asia/Almaty":{time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1709251200,192501e4],offset:[18468,18e3,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,21600,18e3,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,18e3]},"Asia/Ashkhabad":{
time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,192501e4],offset:[14012,14400,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,18e3,14400,18e3]},"Asia/Colombo":{time:[-2840140800,-2019686400,-883267200,-862617600,-764028e3,832982400,846289800,1145061e3,1925011800],offset:[19164,19172,19800,21600,23400,19800,23400,21600,19800]},"Asia/Dhaka":{time:[-2524521600,-891561600,-872035200,-862617600,-576115200,1245452400,1262303999,1925013600],offset:[21700,21200,23400,19800,23400,21600,25200,21600]},"Asia/Tokyo":{time:[-2587678861,-683769600,-672274800,-654739200,-640825200,-620265600,-609375600,-588816e3,-577926e3,1925024400],offset:[33539,32400,36e3,32400,36e3,32400,36e3,32400,36e3,32400]},"Asia/Taipei":{time:[-2335219200,-1017792e3,-766191600,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-639100800,-620784e3,-607564800,-589248e3,-576028800,-562896e3,-541728e3,-528681600,-510192e3,-497145600,-478656e3,-465609600,-449798400,-433987200,-418176e3,-402451200,-38664e4,-370915200,-355104e3,-339379200,-323568e3,-302486400,-291945600,-270950400,-260409600,134006400,149817600,165542400,181353600,299635200,307584e3,1925020800],offset:[29160,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Singapore":{time:[-2177452800,-2038176e3,-1167609600,-1073001600,-894153600,-879638400,-766972800,378689400,1925020800],offset:[24925,24925,25200,26400,26400,27e3,32400,27e3,28800]},"Asia/Karachi":{time:[-1988150400,-862617600,-764121600,-576115200,38793600,1018137600,1033862400,1212278400,1225497600,1239753600,1257033600,192501e4],offset:[16092,19800,23400,19800,18e3,18e3,21600,18e3,21600,18e3,21600,18e3]},"Asia/Manila":{time:[-3944678400,-2229292800,-1046649600,-1038700800,-873244800,-794188800,-496195200,-489283200,259372800,275184e3,1925020800],offset:[-57360,29040,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Shanghai":{time:[-2177452800,-1600646400,-1585872e3,-933638400,-922060800,-908841600,-888796800,-881020800,-767836800,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-649987200,515556e3,527047200,545191200,558496800,577245600,589946400,608695200,622000800,640144800,653450400,671594400,6849e5,1925020800],offset:[29143,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Seoul":{
time:[-1948752e3,-1830384e3,-767318400,-681177600,-672192e3,-654739200,-640828800,-623376e3,-609379200,-588816e3,-577929600,-498096e3,-462672e3,-451699200,-429753600,-418262400,-399513600,-387417600,-368064e3,-355968e3,-336614400,-324518400,-305164800,-293068800,-264902400,547610400,560919600,57906e4,592369200,1925024400],offset:[30472,30600,32400,32400,36e3,32400,36e3,32400,36e3,32400,36e3,32400,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,32400,36e3,32400,36e3,32400]},"Asia/Tehran":{time:[-1704153600,-1090454400,227833200,24624e4,259632e3,271126800,283996800,296611200,306547200,322444800,338515200,673228800,685497600,701222400,71712e4,732758400,748656e3,764294400,780192e3,795830400,811728e3,827366400,843264e3,858988800,874886400,890524800,906422400,922060800,937958400,953596800,969494400,985219200,1001116800,1016755200,1032652800,1048291200,1064188800,1079827200,1095724800,1111449600,1127347200,1206057600,1221955200,123768e4,1253577600,1269216e3,1285113600,1300752e3,1316649600,1332288e3,1348185600,1363910400,1379808e3,1395446400,1411344e3,1426982400,144288e4,1458518400,1474416e3,1490140800,1506038400,1521676800,1537574400,1553212800,1569110400,1584748800,1600646400,1616371200,1632268800,1647907200,1663804800,1925004600],offset:[12344,12344,12600,16200,14400,18e3,14400,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600]},"Asia/Dubai":{time:[-1577923200,1925006400],offset:[13272,14400]},"Asia/Kolkata":{time:[-3645216e3,-3155673600,-2019686400,-891561600,-872035200,-862617600,-764121600,1925011800],offset:[21208,21200,19270,19800,23400,19800,23400,19800]},"Asia/Hong_Kong":{time:[-2056663398,-900882e3,-891547200,-884217600,-761176800,-747878400,-728508600,-717021e3,-697059e3,-683757e3,-668028600,-654726600,-636579e3,-623277e3,-605129400,-591827400,-573679800,-559773e3,-541625400,-528323400,-510179400,-498083400,-478729800,-466633800,-446675400,-435184200,-415225800,-403129800,-383776200,-371680200,-352326600,-340230600,-320877e3,-308781e3,-288822600,-277331400,-257373e3,-245881800,-225923400,-213827400,-194473800,-182377800,-163024200,-148509e3,-132784200,-117059400,-101334600,-85609800,-69280200,-53555400,-37830600,-22105800,-6381e3,9343800,25068600,40793400,56518200,72243e3,88572600,104297400,120022200,126070200,151471800,167196600,182921400,198646200,214371e3,295414200,309324600,1925020800],
offset:[27402,28800,32400,30600,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Bangkok":{time:[-2840140800,-1570060800,1925017200],offset:[24124,24124,25200]},"Asia/Chongqing":{time:[-2177452800,-1600646400,-1585872e3,-933638400,-922060800,-908841600,-888796800,-881020800,-767836800,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-649987200,515556e3,527047200,545191200,558496800,577245600,589946400,608695200,622000800,640144800,653450400,671594400,6849e5,1925020800],offset:[29143,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Jerusalem":{time:[-2840140800,-1640995200,-933631200,-923086800,-919029600,-857336400,-844293600,-825800400,-812671200,-794178e3,-779839200,-762642e3,-748303200,-731106e3,-681948e3,-673214400,-667947600,-652312800,-636411600,-622072800,-608936400,-591832800,-572475600,-558568800,-542840400,-527724e3,-514414800,-490831200,-482965200,-459381600,-451515600,-428536800,-418251600,-400111200,-387406800,142387200,150854400,167184e3,178675200,334108800,337741200,452649600,46233e4,482284800,494380800,516758400,526435200,545443200,558489600,576633600,589334400,609897600,620784e3,638323200,651628800,669772800,683683200,701827200,715737600,733708800,747187200,765158400,778032e3,796608e3,810086400,826848e3,842832e3,858902400,874195200,890352e3,90504e4,923018400,936324e3,955677600,970794e3,986778e3,1001293200,1017363600,1033952400,1048813200,1065142800,1081299600,1095814800,1112320800,1128823200,1143770400,1159668e3,117522e4,1189908e3,1206669600,1223172e3,1238119200,1254016800,1269568800,1284256800,1301623200,1317520800,1333072800,1348365600,1364522400,1382839200,1395972e3,1414288800,1427421600,1445738400,1458871200,1477792800,1490320800,1509242400,1521770400,1540692e3,1553824800,1572141600,1585274400,1603591200,1616724e3,1635645600,1648173600,1667095200,1679623200,1698544800,1711677600,1729994400,1743127200,1761444e3,1774576800,1792893600,1806026400,1824948e3,1837476e3,1856397600,1868925600,1887847200,190098e4,1919296800,1932429600],
offset:[8454,8440,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,14400,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Asia/Kuala_Lumpur":{time:[-2177452800,-2038176e3,-1167609600,-1073001600,-894153600,-879638400,-766972800,378689400,1925020800],offset:[24406,24925,25200,26400,26400,27e3,32400,27e3,28800]},"Asia/Kuwait":{time:[-631152e3,1925002800],offset:[11516,10800]},"Asia/Muscat":{time:[-1577923200,1925006400],offset:[14064,14400]},"Asia/Nicosia":{time:[-1518912e3,166579200,182304e3,200966400,21384e4,228873600,243993600,260323200,276134400,291772800,307497600,323827200,338947200,354672e3,370396800,386121600,401846400,417571200,433296e3,449020800,465350400,481075200,4968e5,512524800,528249600,543974400,559699200,575424e3,591148800,606873600,622598400,638323200,654652800,670377600,686102400,701827200,717552e3,733276800,749001600,764726400,780451200,796176e3,811900800,828230400,843955200,85968e4,875404800,891129600,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[8008,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Asia/Qatar":{time:[-1577923200,76204800,1925002800],offset:[12368,14400,10800]},"Asia/Riyadh":{time:[-719625600,1925002800],offset:[11212,10800]},"Asia/Yangon":{
time:[-2840140800,-1577923200,-873244800,-778377600,1925015400],offset:[23087,23087,23400,32400,23400]},"Pacific/Auckland":{time:[-3192393600,-1330293600,-1320012e3,-1300658400,-1287352800,-1269208800,-1255903200,-1237759200,-1224453600,-1206309600,-1192399200,-117486e4,-1160949600,-1143410400,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-757382400,152676e3,162356400,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,510116400,530676e3,541566e3,562125600,573620400,59418e4,60507e4,623815200,637729200,655264800,669178800,686714400,700628400,718164e3,732682800,749613600,764132400,781063200,795582e3,812512800,827031600,844567200,858481200,876016800,889930800,907466400,921985200,938916e3,953434800,970365600,984884400,100242e4,1016334e3,1033869600,1047783600,1065319200,1079838e3,1096768800,1111287600,1128218400,1142737200,1159668e3,1174186800,1191117600,1207450800,1222567200,1238900400,1254016800,127035e4,1285466400,1301799600,1316916e3,1333249200,1348970400,1365303600,138042e4,1396753200,1411869600,1428202800,1443319200,1459652400,1474768800,1491102e3,1506218400,1522551600,1538272800,1554606e3,1569722400,1586055600,1601172e3,1617505200,1632621600,1648954800,1664071200,1680404400,1695520800,1712458800,1727575200,1743908400,1759024800,1775358e3,1790474400,1806807600,1821924e3,1838257200,1853373600,1869706800,1885428e3,1901761200,1916877600,1933210800],offset:[41944,41400,45e3,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800]},"Pacific/Chatham":{
time:[-3192393600,-757382400,152678700,162359100,183523500,195018300,215577900,226467900,247027500,257917500,278477100,289367100,309926700,320816700,341376300,352266300,372825900,384320700,404880300,415770300,436329900,447219900,467779500,478669500,499229100,510119100,530678700,541568700,562128300,573623100,594182700,605072700,623817900,637731900,655267500,669181500,686717100,700631100,718166700,732685500,749616300,764135100,781065900,795584700,812515500,827034300,844569900,858483900,876019500,889933500,907469100,921987900,938918700,953437500,970368300,984887100,1002422700,1016336700,1033872300,1047786300,1065321900,1079840700,1096771500,1111290300,1128221100,1142739900,1159670700,1174189500,1191120300,1207453500,1222569900,1238903100,1254019500,1270352700,1285469100,1301802300,1316918700,1333251900,1348973100,1365306300,1380422700,1396755900,1411872300,1428205500,1443321900,1459655100,1474771500,1491104700,1506221100,1522554300,1538275500,1554608700,1569725100,1586058300,1601174700,1617507900,1632624300,1648957500,1664073900,1680407100,1695523500,1712461500,1727577900,1743911100,1759027500,1775360700,1790477100,1806810300,1821926700,1838259900,1853376300,1869709500,1885430700,1901763900,1916880300,1933213500],offset:[44028,44100,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500]},"Pacific/Fakaofo":{time:[-2177452800,1325203200,1925038800],offset:[-41096,-39600,46800]},"Pacific/Honolulu":{time:[-2334139200,-1157320800,-1155470400,-880236e3,-769429800,-765410400,-712188e3,1924956e3],offset:[-37886,-37800,-34200,-37800,-34200,-34200,-37800,-36e3]},"America/Mexico_City":{time:[-1514763396,-1343091600,-1234828800,-1220317200,-1207180800,-1191369600,-975283200,-963187200,-917136e3,-907372800,-821923200,-810086400,-627523200,-613008e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,989114400,1001815200,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1175392800,1193536800,1207447200,1224986400,1238896800,1256436e3,1270346400,1288490400,1301796e3,131994e4,1333245600,1351389600,13653e5,1382839200,1396749600,1414288800,1428199200,1445738400,1459648800,1477792800,1491098400,1509242400,1522548e3,1540692e3,1554602400,1572141600,1586052e3,1603591200,1617501600,1635645600,1648951200,1667095200,1924970400],
offset:[-23796,-25200,-21600,-25200,-21600,-25200,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]},"Africa/Cairo":{time:[-2185401600,-929836800,-923097600,-906163200,-892857600,-875836800,-857779200,-844300800,-825811200,-812678400,-794188800,-779846400,-762652800,-399081600,-38664e4,-368323200,-355104e3,-336783600,-323643600,-305161200,-292021200,-273625200,-260485200,-242089200,-228949200,-210553200,-197413200,-178930800,-165790800,-147394800,-134254800,-115858800,-102632400,-84322800,-71096400,-52700400,-39474e3,-21164400,-7938e3,10371600,23598e3,41907600,55134e3,7353e4,86756400,105066e3,118292400,136602e3,149828400,168138e3,181364400,199760400,212986800,231296400,244522800,262832400,276058800,294368400,307594800,325990800,339217200,357526800,370753200,396406800,402289200,426819600,433825200,452221200,465447600,483757200,496983600,515293200,528519600,546829200,560055600,578451600,591678e3,610419600,623214e3,641523600,65475e4,673059600,686286e3,704682e3,717908400,736218e3,749444400,767754e3,780980400,799027200,812332800,830476800,843782400,861926400,875232e3,893376e3,906681600,925430400,938736e3,95688e4,970185600,988329600,1001635200,1019779200,1033084800,1051228800,1064534400,1083283200,1096588800,1114732800,1128038400,1146182400,1158883200,1177632e3,1189123200,1209081600,1219968e3,1240531200,1250812800,1272585600,1281484800,1284076800,1285891200,1400198400,1403827200,1406851200,1411689600,168264e4,1698364800,1714089600,1730419200,1745539200,1761868800,1776988800,1793318400,1809043200,1824768e3,1840492800,1856217600,1871942400,1887667200,1903392e3,1919721600,1934841600],offset:[7509,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Africa/Casablanca":{
time:[-1773014400,-956361600,-950486400,-942019200,-761184e3,-617241600,-605145600,-81432e3,-71107200,141264e3,147225600,199756800,207705600,231292800,244252800,265507200,271036800,448243200,504921600,1212278400,1220227200,1243814400,1250812800,1272758400,1281225600,1301788800,1312070400,1335664800,1342753200,1345428e3,1348974e3,1367114400,1373166e3,13761e5,1382842800,1396144800,1403924400,1406944800,1414292400,1427594400,1434250800,1437271200,1445742e3,1459044e3,1465095600,1468116e3,1477796400,1490493600,1495335600,1498960800,1509246e3,1521943200,1526180400,1529200800,1540695600,1557025200,1560045600,1587265200,1590890400,161811e4,1621130400,164835e4,1651975200,1679194800,1682215200,1710039600,171306e4,1740279600,1743904800,1771124400,1774144800,1801969200,1804989600,1832209200,1835834400,1863054e3,1866074400,1893294e3,1896919200,1924138800,1927159200],offset:[-1820,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Africa/Johannesburg":{time:[-2458166400,-2109283200,-860968800,-845244e3,-829519200,-813794400,1924999200],offset:[6720,5400,7200,10800,7200,10800,7200]},"Africa/Nairobi":{time:[-194616e4,-1309737600,-1261958400,-1041379200,-865296e3,1925002800],offset:[8836,9e3,10800,9e3,9900,10800]},"Africa/Tunis":{time:[-27972e5,-1855958400,-969238800,-950486400,-941936400,-891129600,-877824e3,-85725e4,-844552800,-842911200,-84222e4,-828223200,-812498400,-796262400,-781048800,-766627200,231206400,243910800,262828800,276051600,581126400,591152400,606873600,622602e3,64152e4,654656400,1114905600,1128045600,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1924995600],offset:[2444,561,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Asia/Kathmandu":{time:[-1577923200,504921600,1925012700],offset:[20476,19800,20700]},"US/Mountain":{
time:[-2717668796,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1538949600,-1534111200,-880236e3,-769417200,-765410400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-25196,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]},"Europe/Helsinki":{
time:[-2890252800,-1535932800,-875664e3,-859762800,354679200,370407600,386128800,401857200,417582e3,433310400,449031600,465364800,481086e3,496814400,512535600,528264e3,543985200,559713600,575434800,591163200,606884400,622612800,638334e3,654667200,670388400,686116800,701838e3,717566400,733287600,749016e3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5989,5989,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Stockholm":{time:[-2871676800,-2208988800,-1692493200,-1680476400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[4332,3614,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Copenhagen":{time:[-2524521600,-2398291200,-1692493200,-1680483600,-935107200,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-769381200,-747007200,-736376400,-715212e3,-706741200,-683157600,-675291600,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3020,3020,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Atlantic/Reykjavik":{
time:[-1956614400,-1668214800,-1647212400,-1636678800,-161343e4,-1605142800,-1581894e3,-1539565200,-153135e4,-968029200,-952293600,-942012e3,-920239200,-909961200,-888789600,-877906800,-857944800,-846457200,-826495200,-815007600,-795045600,-783558e3,-762991200,-752108400,-731541600,-717634800,-700092e3,-686185200,-668642400,-654735600,-636588e3,-623286e3,-605743200,-591836400,-573688800,-559782e3,-542239200,-528332400,-510789600,-496882800,-47934e4,-465433200,-447890400,-433983600,-415836e3,-401929200,-384386400,-370479600,-352936800,-33903e4,-321487200,-307580400,-290037600,-276130800,-258588e3,-244681200,-226533600,-212626800,-195084e3,-181177200,-163634400,-149727600,-132184800,-118278e3,-100735200,-86828400,-68680800,-54774e3,1924992e3],offset:[-5280,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0]},"Europe/Tallinn":{time:[-2840140800,-1638316800,-1632002400,-1618693200,-1593820800,-1535932800,-927936e3,-892944e3,-85725e4,-844552800,-828219600,-812498400,-797644800,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909288e3,92259e4,941342400,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5940,5940,3600,7200,3600,5940,7200,10800,7200,3600,7200,3600,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Riga":{
time:[-2840140800,-1632002400,-1618693200,-1601676e3,-1597266e3,-1377302400,-928022400,-899510400,-85725e4,-844552800,-828219600,-812498400,-79677e4,-795830400,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,843966e3,859690800,877838400,891140400,909288e3,92259e4,941342400,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5794,5794,9394,5794,9394,5794,7200,10800,7200,3600,7200,3600,7200,3600,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Vilnius":{time:[-2840140800,-1672531200,-1585094400,-1561248e3,-1553558400,-928195200,-900115200,-85725e4,-844552800,-828219600,-812498400,-802137600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891140400,909284400,922586400,941338800,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],
offset:[6076,5040,5736,3600,7200,3600,10800,7200,3600,7200,3600,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,7200,3600,7200,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"America/Lima":{time:[-2524521600,-1938556800,-1009843200,-1002067200,-986774400,-971049600,-955324800,-9396e5,504921600,512697600,536457600,544233600,631152e3,638928e3,757382400,765158400,1924974e3],offset:[-18492,-18516,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Santiago":{time:[-2524521600,-1892678400,-1688428800,-1619222400,-1593820800,-1336003200,-13176e5,-1304380800,-1286064e3,-1272844800,-1254528e3,-1241308800,-1222992e3,-1209772800,-1191369600,-1178150400,-870566400,-865296e3,-740534400,-736646400,-718070400,-713667600,-36633600,-23932800,-3369600,7516800,24451200,37756800,55900800,69206400,87955200,100656e3,118195200,132105600,150854400,163555200,182304e3,195609600,213753600,227059200,245203200,258508800,277257600,289958400,308707200,321408e3,340156800,353462400,371606400,384912e3,403056e3,416361600,434505600,447811200,46656e4,479260800,498009600,510710400,529459200,545184e3,560908800,574214400,592358400,605664e3,624412800,637113600,653443200,668563200,687312e3,700617600,718761600,732067200,750211200,763516800,781660800,794966400,813715200,826416e3,845164800,85968e4,876614400,88992e4,906854400,923184e3,939513600,952819200,971568e3,984268800,1003017600,1015718400,1034467200,1047168e3,1065916800,1079222400,1097366400,1110672e3,1128816e3,1142121600,1160870400,1173571200,119232e4,1206835200,1223769600,1237075200,1255219200,1270339200,1286668800,1304812800,1313884800,1335657600,1346544e3,1367107200,1378598400,1398556800,1410048e3,1463270400,1471132800,149472e4,1502582400,1526169600,1534032e3,1554595200,1567900800,1586044800,1599350400,1617494400,16308e5,1648944e3,1662854400,1680393600,1693699200,1712448e3,1725753600,1743897600,1757203200,1775347200,1788652800,1806796800,1820102400,1838246400,1851552e3,1870300800,1883001600,1901750400,1915056e3,19332e5],
offset:[-16965,-16965,-18e3,-16965,-14400,-16965,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-10800,-14400,-18e3,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800]},"Asia/Bahrain":{time:[-897868800,-820540800,76204800,1925002800],offset:[12140,12600,14400,10800]},"Asia/Jakarta":{time:[-3231273600,-1451693568,-117288e4,-876614400,-766022400,-683856e3,-620784e3,-189388800,1925017200],offset:[25632,25632,26400,27e3,32400,27e3,28800,27e3,25200]},"Africa/Lagos":{time:[-2035584e3,-1940889600,-1767225600,-1588464e3,1924995600],offset:[815,0,815,1800,3600]},"Pacific/Norfolk":{time:[-2177452800,-599616e3,152071200,162961200,1443924e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[40312,40320,41400,45e3,41400,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200]},"America/Juneau":{
time:[-3225169588,-2188987200,-880236e3,-769420800,-765410400,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,438998400,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[54139,-32261,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-28800,-28800,-25200,-28800,-25200,-28800,-25200,-32400,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400]},"Asia/Ho_Chi_Minh":{time:[-2004048e3,-1851552e3,-852080400,-782614800,-767836800,-718070400,-457743600,-315622800,171849600,1925017200],offset:[25590,25590,25200,28800,32400,25200,28800,25200,28800,25200]},"Australia/Perth":{time:[-2337897600,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,152071200,162961200,436327200,447217200,690343200,699418800,1165111200,1174791600,1193536800,1206846e3,1224986400,1238295600,1925020800],offset:[27804,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Europe/Malta":{
time:[-2403475200,-1690761600,-168048e4,-1664755200,-1648944e3,-163512e4,-1616889600,-1604275200,-1585526400,-1571011200,-1555286400,-932428800,-85725e4,-844552800,-828219600,-812584800,-798066e3,-781048800,-76671e4,-750895200,-733352400,-719452800,-70191e4,-689205600,-670453200,-114048e3,-103161600,-81993600,-71708400,-50544e3,-40258800,-18489600,-8204400,1296e4,23245200,43804800,54694800,75859200,86749200,102384e3,118112400,135734400,148525200,167191200,180496800,198640800,211946400,230090400,243396e3,26154e4,274845600,292989600,306295200,323316e3,338349600,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3484,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Amsterdam":{
time:[-4260211200,-1693699200,-168048e4,-1663452e3,-1650142800,-1633212e3,-1617483600,-1601157600,-1586034e3,-1569708e3,-1554584400,-1538258400,-1523134800,-15075e5,-1490562e3,-1470175200,-1459112400,-1443996e3,-1427662800,-1406671200,-1396213200,-1376949600,-1364763600,-1345413600,-1333314e3,-1313791200,-1301259600,-1282255200,-126981e4,-1250719200,-1238360400,-1219183200,-1206910800,-1186956e3,-1175461200,-1156024800,-1143406800,-1124488800,-1111957200,-1092952800,-1080507600,-1061330400,-1049058e3,-1029189600,-1025740800,-1017608400,-998258400,-986158800,-966722400,-954104400,-935020800,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-766616400,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[1172,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,4800,1200,4800,1200,4800,1200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Brussels":{
time:[-2840140800,-2450994150,-1740355200,-1693699200,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1613822400,-1604278800,-1585526400,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1473642e3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224e3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-1191189600,-1175461200,-1160344800,-1143406800,-1127685600,-1111957200,-1096840800,-1080507600,-1063576800,-1049058e3,-1033336800,-1017608400,-1002492e3,-986158800,-969228e3,-950475600,-942012e3,-934664400,-85725e4,-844552800,-828219600,-812498400,-798066e3,-781048800,-766616400,-745452e3,-733266e3,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[1050,1050,0,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Lisbon":{
time:[-1830386205,-1689555600,-1677798e3,-1667437200,-1647734400,-1635814800,-1616198400,-1604365200,-1584662400,-1572742800,-155304e4,-1541206800,-1521504e3,-1442451600,-1426809600,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1221440400,-1206921600,-1191200400,-1175472e3,-1127696400,-1111968e3,-1096851600,-1080518400,-1063587600,-1049068800,-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942022800,-922665600,-906944400,-891129600,-877309200,-873680400,-864e6,-857952e3,-845859600,-842835600,-831340800,-825897600,-81441e4,-810781200,-799891200,-794448e3,-782960400,-779331600,-768441600,-762998400,-749091600,-733363200,-717631200,-701902800,-686181600,-670453200,-654732e3,-639003600,-623282400,-607554e3,-591832800,-575499600,-559778400,-54405e4,-528328800,-512600400,-496879200,-481150800,-465429600,-449701200,-43398e4,-417646800,-401925600,-386197200,-370476e3,-354747600,-339026400,-323298e3,-307576800,-291848400,-276127200,-260398800,-244677600,-228344400,-212623200,-196894800,-181173600,-165445200,-149724e3,-133995600,-118274400,212547600,228268800,243997200,260323200,276051600,291772800,307504800,323222400,338954400,354675600,370404e3,386125200,401853600,417578400,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978e3,559706400,575427600,591156e3,606877200,622605600,638326800,65466e4,670381200,686109600,701830800,717559200,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],offset:[-2205,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,7200,3600,7200,3600,7200,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Dublin":{
time:[-2821651200,-1691964e3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034e3,-1570399200,-1552165200,-1538344800,-152253e4,-15075e5,-1490562e3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732e3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314e3,-1315778400,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-118998e4,-1175461200,-1159135200,-1143406800,-1126476e3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058e3,-1032127200,-1017608400,-1001282400,-986158800,-969228e3,-950475600,-942012e3,-733352400,-719445600,-699483600,-684972e3,-668034e3,-654732e3,-636584400,-622072800,-605739600,-590623200,-57429e4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422e4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298e3,-306972e3,-291848400,-276732e3,-257979600,-245282400,-22653e4,-213228e3,-195080400,-182383200,-163630800,-150933600,-132181200,-119484e3,-100731600,-88034400,-68677200,-59004e3,57726e3,69818400,89175600,101268e3,120625200,132717600,152074800,164167200,183524400,196221600,214974e3,227671200,246423600,259120800,278478e3,290570400,309927600,32202e4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676e3,543978e3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,733280400,751428e3,76473e4,782877600,796179600,814327200,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],offset:[-1521,-1521,2079,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Oslo":{
time:[-2366755200,-1691881200,-1680566400,-927507600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-340840800,-324507600,-308786400,-293058e3,-277336800,-261608400,-245887200,-230158800,-214437600,-198709200,-182988e3,-166654800,-147909600,-135205200,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[2580,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]}}},1640:(e,t,i)=>{"use strict";i.d(t,{Version:()=>r});var s=i(50151);class r{constructor(e,t){this._major=e,this._minor=t}major(){return this._major}minor(){return this._minor}isZero(){return 0===this._major&&0===this._minor}toString(){return this._major+"."+this._minor}compareTo(e){return this._majore._major?1:this._minore._minor?1:0}isLess(e){return this.compareTo(e)<0}isLessOrEqual(e){return this.compareTo(e)<=0}isEqual(e){return 0===this.compareTo(e)}isGreater(e){return this.compareTo(e)>0}isGreaterOrEqual(e){return this.compareTo(e)>=0}static parse(e){if(e instanceof r)return new r(e.major(),e.minor());if("number"==typeof e)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),new r(e,0);if("string"==typeof e){const t=e.split(".");if(1===t.length){const i=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),new r(i,0)}if(2===t.length){const i=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);const n=parseInt(t[1],10);return(0,
s.assert)(!isNaN(n),"Bad version string: "+e),new r(i,n)}throw new Error("Bad version string (one dot expected): "+e)}throw new Error("Bad version: "+e)}}r.ZERO=new r(0,0)},64147:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>o});var s=i(34776);const r=(0,i(12168).getLogger)("Common.WatchedValue");function n(e){r.logError(`${e&&(e.stack||e.message)}`)}class o{constructor(...e){this._listeners=[],e.length>0&&(this._value=e[0])}destroy(){this.unsubscribe()}value(){return this._owner?this._owner._value:this._value}setValue(e,t){const i=this._owner?this._owner:this;if("function"==typeof i.hook&&(e=i.hook(e)),i.writeLock)return;const s=i._value===e||Number.isNaN(i._value)&&Number.isNaN(e);if(!t&&s&&i.hasOwnProperty("_value"))return;i._value=e;const r=i._listeners.slice();let o=0;for(let t=0;tthis.spawn(e).readonly(),destroy:this.destroy.bind(this)};return this._readonlyInstance=e,e}spawn(e){return new a(this._owner||this,e)}when(e){!function(e,t,i){if(t(e.value()))return void i();const s=r=>{t(r)&&(e.unsubscribe(s),i())};e.subscribe(s,{callWithLast:!0})}(this,(e=>Boolean(e)),(()=>{try{e(this.value())}catch(e){n(e)}}))}assertNoSubscriptions(){0}ownership(){return(0,s.ownership)(this)}spawnOwnership(){return(0,s.ownership)(this.spawn())}weakReference(){return(0,s.weakReference)(this)}}class a extends o{constructor(e,t){super(),delete this._listeners,this._owner=e,this._onDestroy=t}destroy(){var e;try{null===(e=this._onDestroy)||void 0===e||e.call(this)}catch(e){n(e)}super.destroy()}readonly(){return super.readonly()}}},91676:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>o});var s=i(64147),r=i(37265);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){(t||!1===this._comparator(this.value(),e))&&super.setValue(e,t)}}},35474:(e,t,i)=>{"use strict";i.d(t,{AriaChartDescription:()=>l});var s=i(68805),r=i(68993),n=i(56570),o=i(72280),a=i(85049);class l{constructor(){this._ariaElement=null,this._customProvider=null,this._lastDescription=null,this._locale="en"}createElement(e){this._ariaElement=(0,
o.createAriaDescriptionElement)(e)}setCustomProvider(e){this._customProvider=e}setLocale(e){this._locale=e}async updateChartDescription(e,t,i){const s=function(e){var t;const i=r.layouts[e];return null!==(t=null==i?void 0:i.count)&&void 0!==t?t:1}(i),a=await this._buildChartContext(e,t,s);if(null===a)return;if(this._customProvider){const e=await this._customProvider(a);if(null!==e)return void this._setChartDescription(e)}if("en"!==this._locale)return;const l=function(e){const t=function(e){if(!n.enabled("aria_detailed_chart_descriptions")||!e.visibleData)return"";let t;try{t=function(e){let t=e.schema.findIndex((e=>"userTime"===e.type));t<0&&(t=e.schema.findIndex((e=>"time"===e.type)));if(t<0)throw new Error("Exported Data should contain `time`.");const i=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"close"===e.plotTitle),-1);if(i<0)throw new Error("Exported Data should contain `close`.");const s=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"low"===e.plotTitle),i),r=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"high"===e.plotTitle),i),n=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"open"===e.plotTitle),i),o=e.data.map((e=>({time:e[t],open:e[n],high:e[r],low:e[s],close:e[i]}))),a={start:o[0],close:o[o.length-1],low:o[0],high:o[0]};for(const e of o)e.high>a.high.high&&(a.high=e),e.low=0?s:i}l._instance=null},79612:(e,t,i)=>{"use strict";i.d(t,{AriaCrosshairPriceDescription:()=>r});var s=i(72280);class r{constructor(){this._ariaElement=null,this._nextAnnouncementTime=Date.now().valueOf(),this._latestDescription="",this._timeoutId=null,this._locale="en"}createElement(e){this._ariaElement=(0,s.createAriaDescriptionElement)(e)}setLocale(e){this._locale=e}async updateChartDescription(e,t,i,r){if("en"!==this._locale)return;let n=`Price ${e.formatter().format(t)}`;if(i){n+=` as of ${(0,s.formatDate)(i/1e3,r)}`}this._setChartDescription(n)}static getInstance(){return null===this._instance&&(this._instance=new r),this._instance}_setChartDescription(e){if(this._latestDescription=e,null!==this._timeoutId)return;const t=Date.now().valueOf();t{this._timeoutId=null,this._applyChartDescription()}),this._nextAnnouncementTime-t):this._applyChartDescription()}_applyChartDescription(){if(!this._ariaElement)return;this._ariaElement.textContent=this._latestDescription;const e=Date.now().valueOf();this._nextAnnouncementTime=e+2e3}}r._instance=null},72280:(e,t,i)=>{"use strict";function s(e){const t=e.querySelector("#chart-aria-description");if(null!==t)return t;const i=e.createElement("div");return i.id="chart-aria-description",i.tabIndex=-1,i.role="alert",i.ariaLive="assertive",e.body.appendChild(i),i}function r(e,t){const i={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:t?"2-digit":void 0,minute:t?"2-digit":void 0,hour12:!0};return new Date(1e3*e).toLocaleString(void 0,i)}i.d(t,{createAriaDescriptionElement:()=>s,formatDate:()=>r})},7047:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>o,initMouseClickAutoBlurHandler:()=>a});var s=i(95171),r=i(76460);const n="data-mouse-click-auto-blur";class o{constructor(){this._handler=e=>{document.activeElement instanceof HTMLElement&&((0,r.isKeyboardClick)(e)||e.target instanceof Element&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)}static attributes(e=!0){return e?{[n]:!0}:{}}}const a=(0,s.default)((()=>new o))},19291:(e,t,i)=>{"use strict";i.d(t,{
createScopedVisibleElementFilter:()=>h,getActiveElementSelectors:()=>d,mapKeyCodeToDirection:()=>c,navigationOrderComparator:()=>n,queryFocusableElements:()=>a,queryTabbableElements:()=>o,updateTabIndexes:()=>l});var s,r=i(63273);function n(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function o(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter(h(e))}function a(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""]), [tabindex]:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""])')).filter(h(e))}function l(){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}))}function c(e){const t=(0,r.isRtl)();switch(e){case 38:return"blockPrev";case 40:return"blockNext";case 37:return t?"inlineNext":"inlinePrev";case 39:return t?"inlinePrev":"inlineNext";default:return null}}function h(e){return t=>{let i=t;for(;i!==e&&null!==i;){const e=getComputedStyle(i);if("none"===e.display||"visible"!==e.visibility)return!1;i=i.parentElement}return!0}}function d(){return['button:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','input:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','select:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','[tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])'].join(", ")}!function(e){e.BlockPrev="blockPrev",e.BlockNext="blockNext",e.InlinePrev="inlinePrev",e.InlineNext="inlineNext"}(s||(s={}))},27235:(e,t,i)=>{"use strict";i.d(t,{TOOLBAR_WIDTH_COLLAPSED:()=>r,TOOLBAR_WIDTH_EXPANDED:()=>s});const s=52,r=5},6307:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>l});var s=i(56840),r=i(56570),n=i(64147);const o=!r.enabled("hide_left_toolbar_by_default"),a=s.getBool("ChartDrawingToolbarWidget.visible",o),l=new n.WatchedValue(a)},72894:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n,HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>r});var s=i(76384);const r=parseInt(s["css-value-header-toolbar-height"]),n=3},27514:(e,t,i)=>{"use strict";i.d(t,{shouldShowQuickSearchOnLib:()=>o});var s=i(49483),r=i(84015),n=i(56570);function o(){return!s.CheckMobile.any()&&!(0,r.isOnMobileAppPage)("any")&&!n.enabled("widget")&&n.enabled("header_quick_search")}},33388:(e,t,i)=>{"use strict";var s;i.d(t,{ACTION_ID:()=>s}),function(e){e.UnknownAction="UnknownAction",e.ChartChangeTimeZone="Chart.ChangeTimeZone",e.ChartLineToolPitchforkChangeTypeToInside="Chart.LineTool.Pitchfork.ChangeTypeToInside",e.ChartLineToolPitchforkChangeTypeToModifiedSchiff="Chart.LineTool.Pitchfork.ChangeTypeToModifiedSchiff",e.ChartLineToolPitchforkChangeTypeToOriginal="Chart.LineTool.Pitchfork.ChangeTypeToOriginal",e.ChartLineToolPitchforkChangeTypeToSchiff="Chart.LineTool.Pitchfork.ChangeTypeToSchiff",e.Loading="Loading"}(s||(s={}))},81199:(e,t,i)=>{
"use strict";i.d(t,{ActionWithStandardIcon:()=>n});var s=i(97702),r=i(67375);class n extends s.Action{constructor(e){var t,i;const{options:s,customActionOptions:n}=e;s.iconId&&(s.icon=null!==(t=s.icon)&&void 0!==t?t:r.icons.get(s.iconId)),n&&n.iconId&&(n.icon=null!==(i=n.icon)&&void 0!==i?i:r.icons.get(n.iconId)),super(e)}}},97702:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Action:()=>l,ActionSize:()=>s,Loader:()=>h,Separator:()=>c});var s,r=i(50151),n=i(52033),o=i(68335),a=i(92184);!function(e){e.Normal="normal",e.Big="big"}(s||(s={}));class l{constructor(e){this.type="action",this._destroyed=!1,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:s,customActionOptions:o,customActionOptionsLoader:c,id:h=a.guid()}=e;(0,r.assert)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new n.Delegate,this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=null!=s?s:null,this._loadOptionsGetter&&(this._options.loading=!0),o&&(this._customAction=new l({actionId:t,options:o,optionsLoader:c,id:h}))}custom(){return this._customAction}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){return this._options.label||""}getSubItems(){return this._options.subItems||[]}isDisabled(){return!0===this._options.disabled}isActive(){return!0===this._options.active}isCheckable(){return!0===this._options.checkable}isChecked(){return!0===this._options.checked}isLoading(){return!0===this._options.loading}loadOptions(){return this._loadOptionsPromise?this._loadOptionsPromise:this._loadOptionsGetter?(this._loadOptionsPromise=this._loadOptionsGetter().then((e=>this.update({...e,loading:!1}))),this._loadOptionsPromise):null}getSize(){var e;return null!==(e=this._options.size)&&void 0!==e?e:"normal"}getPayload(){return this._options.payload}update(e){this._destroyed||(this._unbindShortcut(),e.hotkeyHash&&(this._options.shortcutHint=(0,o.humanReadableHash)(e.hotkeyHash)),this._options=Object.assign(this._options,e),this._bindShortcut(),this._onUpdate.fire(this))}onUpdate(){return this._onUpdate}getState(){return this.loadOptions(),{actionId:this._options.actionId,label:this.getLabel(),styledLabel:this._options.styledLabel,disabled:this.isDisabled(),active:this.isActive(),subItems:this.getSubItems(),checkable:this.isCheckable(),checked:this.isChecked(),loading:this.isLoading(),size:this.getSize(),doNotCloseOnClick:this._options.doNotCloseOnClick||!1,shortcutHint:this._options.shortcutHint,hint:this._options.hint,icon:this._options.icon,iconId:this._options.iconId,iconChecked:this._options.iconChecked,toolbox:this._options.toolbox,showToolboxOnHover:this._options.showToolboxOnHover||!1,statName:this._options.statName,name:this._options.name,invisibleHotkey:this._options.invisibleHotkey,noInteractive:this._options.noInteractive,jsxLabel:"jsxLabel"in this._options?this._options.jsxLabel:void 0,isRepeatAccepted:this._options.isRepeatAccepted}}destroy(){var e,t,i;this._destroyed=!0,
this._onUpdate.destroy(),this._unbindShortcut(),null===(t=(e=this._options).onDestroy)||void 0===t||t.call(e),null===(i=this._customAction)||void 0===i||i.destroy()}options(){return this._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;const e="string"==typeof this._options.label?this._options.label:this._options.name;this._hotkeyAction=this._options.hotkeyGroup.add({hotkey:this._options.hotkeyHash,isRepeatAccepted:this._options.isRepeatAccepted,desc:e,handler:()=>this.execute(),isDisabled:()=>this.isDisabled()})}_unbindShortcut(){this._hotkeyAction&&(this._hotkeyAction.destroy(),delete this._hotkeyAction)}}class c{constructor(e){this.type="separator",this.id=a.guid(),this._hint=e}getHint(){return this._hint}}class h extends l{constructor(e){super({actionId:e,options:{}})}isLoading(){return!0}getSize(){return"big"}}},67375:(e,t,i)=>{"use strict";i.d(t,{icons:()=>v});var s,r=i(34369),n=i(39267),o=i(93544),a=i(84959),l=i(37924),c=i(77067),h=i(16911),d=i(25191),u=i(54190),p=i(6862),_=i(97874),m=i(2872),g=i(1457),f=i(93379);!function(e){e.ChartShowDataWindow="Chart.ShowDataWindow",e.ChartReset="Chart.Reset",e.PlatformColorTheme="Platform.ColorTheme",e.ChartRemoveSelectedObject="Chart.RemoveSelectedObject",e.Settings="Settings",e.ChartHide="Chart.Hide",e.ChartSymbolInfo="Chart.SymbolInfo",e.ChartFinancials="Chart.Financials",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertRestart="Alert.Restart",e.AlertStop="Alert.Stop",e.AlertEventsExport="Alert.EventsExport",e.ClearAll="Alert.Clear",e.ChartVisualOrder="Chart.VisualOrder",e.ChartShowObject="Chart.ShowObject",e.ChartPriceScale="Chart.PriceScale",e.ChartMove="Chart.Move",e.ChartApplyIndicator="Chart.ApplyIndicator",e.ChartUnlockObject="Chart.UnlockObject",e.ChartLockObject="Chart.LockObject",e.ChartClone="Chart.Clone",e.ChartAddHorzLine="Chart.AddHorzLine",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreateNew="Watchlist.CreateNew",e.TextNoteAdd="TextNote.Add",e.TradingSell="Trading.Sell",e.TradingBuy="Trading.Buy",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem"}(s||(s={}));const v=new Map([["Chart.Reset",n],["Chart.RemoveSelectedObject",o],["Settings",r],["Chart.Hide",a],["Chart.SymbolInfo",l],["Chart.VisualOrder",c],["Chart.ShowObject",h],["Chart.PriceScale",d],["Chart.Move",u],["Chart.ApplyIndicator",p],["Chart.UnlockObject",_],["Chart.LockObject",m],["Chart.Clone",g],["Chart.AddHorzLine",f]])},51330:(e,t,i)=>{"use strict";i.d(t,{ActionsProvider:()=>tt,createActionCopyPrice:()=>Ze,createActionToggleVisibilityDataSources:()=>Qe,createChangeIntervalsVisibilitiesAction:()=>Ye,createLinesAction:()=>Xe,createPasteAction:()=>$e,createSyncDrawingActions:()=>Je,createVisualOrderAction:()=>Ke,defaultContextMenuOptions:()=>qe});var s,r=i(50151),n=i(31955),o=(i(60521),i(37265)),a=i(11542),l=i(56570),c=i(97702),h=i(96152),d=i(19466),u=i(72708),p=(i(26023),i(25149)),_=i(28388),m=i(68335),g=(i(25812),
i(85604)),f=i(80387),v=i(86920),y=i(630),S=i(60074),b=i(34585),w=i(45126),C=(i(928),i(85049)),P=i(85719),x=i(10892),T=i(93352),I=i(65383),M=i(12988);!function(e){e.Value="ChartEventsSource"}(s||(s={}));var A=i(300),L=i(81199);(0,n.getLogger)("Chart.ActionsProvider");const k=new w.TranslatedString("change visibility",a.t(null,void 0,i(1924))),D=new w.TranslatedString("pin to scale {label}",a.t(null,void 0,i(81566))),E=new w.TranslatedString("pin to right scale",a.t(null,void 0,i(7495))),V=new w.TranslatedString("pin to left scale",a.t(null,void 0,i(78690))),B=(new w.TranslatedString("change earnings visibility",a.t(null,void 0,i(6819))),new w.TranslatedString("change dividends visibility",a.t(null,void 0,i(53929))),new w.TranslatedString("change splits visibility",a.t(null,void 0,i(47474))),new w.TranslatedString("change continuous contract switch visibility",a.t(null,void 0,i(18867))),new w.TranslatedString("change futures contract expiration visibility",a.t(null,void 0,i(85532))),new w.TranslatedString("change latest news and Minds visibility",a.t(null,void 0,i(50243))),new w.TranslatedString("show all ideas",a.t(null,void 0,i(13336)))),R=new w.TranslatedString("show ideas of followed users",a.t(null,void 0,i(91395))),N=new w.TranslatedString("show my ideas only",a.t(null,void 0,i(57460))),O=(new w.TranslatedString("change events visibility on chart",a.t(null,void 0,i(6119))),new w.TranslatedString("add this symbol to entire layout",a.t(null,void 0,i(79290)))),F=new w.TranslatedString("add this indicator to entire layout",a.t(null,void 0,i(96677))),W=(new w.TranslatedString("add this strategy to entire layout",a.t(null,void 0,i(58156))),new w.TranslatedString("add this financial metric to entire layout",a.t(null,void 0,i(67608))),new w.TranslatedString("apply drawing template",a.t(null,void 0,i(89720))),new w.TranslatedString("lock objects",a.t(null,void 0,i(18942)))),H=new w.TranslatedString("unlock objects",a.t(null,void 0,i(23230))),z=new w.TranslatedString("change visibility at current interval and above",a.t(null,void 0,i(45800))),U=new w.TranslatedString("change visibility at current interval and below",a.t(null,void 0,i(75645))),j=new w.TranslatedString("change visibility at current interval",a.t(null,void 0,i(84331))),G=new w.TranslatedString("change visibility at all intervals",a.t(null,void 0,i(57916))),q=(a.t(null,void 0,i(66823)),(0,b.appendEllipsis)(a.t(null,void 0,i(264))),
a.t(null,void 0,i(98334))),$=a.t(null,void 0,i(27298)),K=a.t(null,void 0,i(3564)),Y=a.t(null,void 0,i(94559)),Z=a.t(null,void 0,i(2165)),X=a.t(null,void 0,i(16986)),J=a.t(null,void 0,i(12645)),Q=a.t(null,void 0,i(44579)),ee=a.t(null,void 0,i(29436)),te=a.t(null,void 0,i(81054)),ie=a.t(null,void 0,i(32538)),se=a.t(null,void 0,i(72046)),re=a.t(null,void 0,i(90095)),ne=a.t(null,void 0,i(14115)),oe=a.t(null,void 0,i(33110)),ae=a.t(null,void 0,i(28280)),le=a.t(null,void 0,i(76150)),ce=a.t(null,void 0,i(94210)),he=a.t(null,void 0,i(60035)),de=a.t(null,void 0,i(10761)),ue=a.t(null,void 0,i(11254)),pe=a.t(null,void 0,i(35049)),_e=a.t(null,void 0,i(19271)),me=a.t(null,void 0,i(15512)),ge=a.t(null,void 0,i(46545)),fe=a.t(null,void 0,i(52160)),ve=a.t(null,void 0,i(17293)),ye=a.t(null,void 0,i(21973)),Se=a.t(null,void 0,i(55481)),be=a.t(null,void 0,i(71179)),we=a.t(null,void 0,i(4077)),Ce=a.t(null,void 0,i(54853)),Pe=a.t(null,void 0,i(20177)),xe=a.t(null,void 0,i(494)),Te=a.t(null,void 0,i(60668)),Ie=a.t(null,void 0,i(58026)),Me=a.t(null,void 0,i(56982)),Ae=((0,b.appendEllipsis)(a.t(null,void 0,i(35088))),(0,b.appendEllipsis)(a.t(null,void 0,i(2439))),(0,b.appendEllipsis)(a.t(null,void 0,i(32514)))),Le=(a.t(null,void 0,i(78358)),(0,b.appendEllipsis)(a.t(null,void 0,i(76266))),a.t(null,void 0,i(49680))),ke=a.t(null,void 0,i(12537)),De=(a.t(null,void 0,i(93553)),a.t(null,void 0,i(74975))),Ee=a.t(null,void 0,i(99894)),Ve=a.t(null,void 0,i(5837)),Be=(a.t(null,void 0,i(37113)),a.t(null,void 0,i(29449)),a.t(null,void 0,i(50849)),a.t(null,void 0,i(33158)),a.t(null,void 0,i(81465)),a.t(null,void 0,i(68112)),a.t(null,void 0,i(55418))),Re=a.t(null,void 0,i(10261)),Ne=a.t(null,void 0,i(44020)),Oe=((0,b.appendEllipsis)(a.t(null,void 0,i(32514))),a.t(null,void 0,i(97878)),a.t(null,void 0,i(39010))),Fe=a.t(null,void 0,i(26090)),We=(a.t(null,void 0,i(95754)),a.t(null,void 0,i(35679)),a.t(null,void 0,i(9140)),a.t(null,void 0,i(46607)),a.t(null,void 0,i(39079)),(0,b.appendEllipsis)(a.t(null,void 0,i(75594)))),He=(0,b.appendEllipsis)(a.t(null,void 0,i(88853))),ze=a.t(null,void 0,i(35140)),Ue=a.t(null,void 0,i(63553)),je=a.t(null,void 0,i(92957)),Ge=a.t(null,void 0,i(58764)),qe=(a.t(null,void 0,i(10996)),a.t(null,void 0,i(3061)),{general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0,studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1});function $e(e,t){return!t.isEmpty()&&l.enabled("datasource_copypaste")?new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.PasteSource",options:{label:ze.trim(),shortcutHint:(0,m.humanReadableHash)(m.Modifiers.Mod+86),statName:"Paste",onExecute:()=>e.chartWidgetCollection().clipboard.uiRequestPaste(t)}}):null}function Ke(e,t){const i=e.model(),s=i.availableZOrderOperations(t),r=[new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringToFront",options:{label:ve,statName:"BringToFront",disabled:!s.bringToFrontEnabled,onExecute:()=>i.bringToFront(t)}}),new L.ActionWithStandardIcon({
actionId:"Chart.Source.VisualOrder.SendToBack",options:{label:ye,statName:"SendToBack",disabled:!s.sendToBackEnabled,onExecute:()=>i.sendToBack(t)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringForward",options:{label:Se,statName:"BringForward",disabled:!s.bringForwardEnabled,onExecute:()=>i.bringForward(t)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendBackward",options:{label:be,statName:"SendBackward",disabled:!s.sendBackwardEnabled,onExecute:()=>i.sendBackward(t)}})];return new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder",options:{label:we,iconId:"Chart.VisualOrder",statName:"VisualOrder",subItems:r}})}function Ye(e,t){const i=e.model(),s=(e,s)=>{const r=C.Interval.parse(i.mainSeries().interval()),n=(0,x.getIntervalsVisibilitiesForMode)(r,e),o=[],a=[];t.forEach((e=>{const t=e.properties().intervalsVisibilities.childs();o.push(t.ticks),a.push(n.ticks),o.push(t.seconds),a.push(n.seconds),o.push(t.secondsFrom),a.push(n.secondsFrom),o.push(t.secondsTo),a.push(n.secondsTo),o.push(t.minutes),a.push(n.minutes),o.push(t.minutesFrom),a.push(n.minutesFrom),o.push(t.minutesTo),a.push(n.minutesTo),o.push(t.hours),a.push(n.hours),o.push(t.hoursFrom),a.push(n.hoursFrom),o.push(t.hoursTo),a.push(n.hoursTo),o.push(t.days),a.push(n.days),o.push(t.daysFrom),a.push(n.daysFrom),o.push(t.daysTo),a.push(n.daysTo),o.push(t.weeks),a.push(n.weeks),o.push(t.weeksFrom),a.push(n.weeksFrom),o.push(t.weeksTo),a.push(n.weeksTo),o.push(t.months),a.push(n.months),o.push(t.monthsFrom),a.push(n.monthsFrom),o.push(t.monthsTo),a.push(n.monthsTo),o.push(t.ranges),a.push(n.ranges)})),i.setProperties(o,a,s,(0,A.sourcesAffectState)(t))},r=[new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndAbove",options:{label:Pe,statName:"currentAndAboveIntervals",onExecute:()=>s(3,z)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndBelow",options:{label:xe,statName:"currentAndBelowIntervals",onExecute:()=>s(2,U)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.Current",options:{label:Te,statName:"currentInterval",onExecute:()=>s(1,j)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.All",options:{label:Ie,statName:"allIntervals",onExecute:()=>s(0,G)}})];return new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility",options:{label:Ce,statName:"IntervalsVisibility",subItems:r}})}function Ze(e,t){var i,s,r;const n=e.defaultPriceScale(),o=void 0!==t?n.coordinateToPrice(t,null!==(s=null===(i=e.mainDataSource())||void 0===i?void 0:i.firstValue())&&void 0!==s?s:0):e.model().mainSeries().lastValueData(4,!0,!0).price,a=null===(r=e.mainDataSource())||void 0===r?void 0:r.formatter();if(void 0===o||!a)return null;const l=a.format(o),c=a.format(o,{ignoreLocaleNumberFormat:!0});return new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopyPrice",options:{label:`${Ue} ${l}`,statName:"CopyPrice",onExecute:()=>(0,T.getClipboard)().writeText(c)}})}function Xe(e){
const t=e.actions(),i=[t.showPriceLine];return i.push(t.showHighLowPriceLines),l.enabled("show_average_close_price_line_and_label")&&i.push(t.showAverageClosePriceLine),new L.ActionWithStandardIcon({actionId:"Chart.Lines",options:{label:Me,statName:"Lines",subItems:i}})}function Je(e,t){return[]}function Qe(e,t){const i=t[0].properties().visible.value(),s=i?$:q,r=i?"Chart.Hide":"Chart.ShowObject",n=i?"Chart.SelectedObject.Hide":"Chart.SelectedObject.Show";return new L.ActionWithStandardIcon({actionId:n,options:{checkable:!0,statName:"ToggleVisibilitySelectedObject",label:s,iconId:r,onExecute:()=>{const s=e.model();s.withMacro(k,(()=>{t.forEach((e=>{s.setProperty(e.properties().visible,!i,k,P.lineToolsDoNotAffectChartInvalidation&&(0,y.isLineTool)(e))}))}))}}})}var et;!function(e){e.Copy="Copy"}(et||(et={}));class tt{constructor(e,t){this._chartWidget=e,this._options=(0,o.merge)((0,o.clone)(qe),t||{})}async contextMenuActionsForSources(e,t,i,s,r){const n=e[0],o=this._options,a=[];if(n===this._chartWidget.model().mainSeries()&&o.mainSeries)a.push(...await this._contextMenuActionsForSeries(n,i));else if((0,u.isStudy)(n)&&o.studies)a.push(...await this._contextMenuActionsForStudy(n,t,i));else if((0,y.isLineTool)(n)&&o.lineTools){const t=e.filter(y.isLineTool);a.push(...await this._contextMenuActionsForLineTool(t))}else 0;return a.length&&(null==r?void 0:r.length)&&a.push(new c.Separator),a.push(...null!=r?r:[]),a}_isReadOnly(){return this._chartWidget.readOnly()}_createActionScale(e){const t=(0,r.ensureNotNull)(e.priceScale()),i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(e)),n=s.priceScalePosition(t),o=("left"===n?s.leftPriceScales():s.rightPriceScales()).indexOf(t),a=i.priceScaleSlotsCount().totallySlots<2?"dontneedname":"needname",l="overlay"===n?"":(0,h.getPriceAxisNameInfo)(n,o).label,c=le.format({label:l}),d={"left-needname":c,"left-dontneedname":he,"right-needname":c,"right-dontneedname":de,"overlay-needname":ce,"overlay-dontneedname":ce}[n+"-"+a];return new L.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{label:d,iconId:"Chart.PriceScale",subItems:this._createActionScaleItems(e)}})}_createActionResetInputPoints(e){const t=e.metaInfo(),s=t.inputs.filter(I.isTimeOrPriceNotHiddenInput);return 0===s.length?null:new L.ActionWithStandardIcon({actionId:"Chart.Source.ResetInputPoints",options:{label:He,onExecute:async()=>{let r;try{const n=e.properties().childs().inputs.state();for(const e of Object.keys(n))s.find((t=>t.id===e))||delete n[e];const o=new M.Property({inputs:n}),a=await Promise.all([i.e(4703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2198),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(3030)]).then(i.bind(i,73339))
;r=(await a.selectInputValuesOnChart(this._chartWidget,s,o,t.shortDescription,t.inputs)).customSourceId,e.properties().mergeAndFire(o.state())}finally{void 0!==r&&this._chartWidget.model().model().removeCustomSource(r)}}}})}_createActionLayoutChartsSync(){return new LayoutChartsSyncContextMenuAction(this._chartWidget.linkingGroupIndex().readonly(),(e=>this._chartWidget.model().setLinkingGroupIndex(e)))}_createActionScaleDetach(e,t,i,s){const n=this._chartWidget.model().model(),o=(0,r.ensureNotNull)(n.paneForSource(e));if(!o.canCreateNewPriceScale())return null;const a=(0,r.ensureNotNull)(e.priceScale()),l=a.canDetachSource(e),c=o.priceScalePosition(a),d=l||c!==t;if(!d)return null;const u=n.priceScaleSlotsCount(),p={left:{labelled:ee,sided:oe},right:{labelled:ee,sided:ae}},_="left"===t?o.leftPriceScales().length:o.rightPriceScales().length,m=u[t]>_?"labelled":"sided",g=(0,h.getPriceAxisNameInfo)(t,_).label,f=p[t][m].format({label:g});return new L.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{checkable:!1,disabled:!d,label:f,statName:s,payload:e,onExecute:i}})}_onDetachLeft(e){const t=e.getPayload(),i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t));this._chartWidget.model().detachToLeft(t,s)}_onDetachRight(e){const t=e.getPayload(),i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t));this._chartWidget.model().detachToRight(t,s)}_createActionScaleDetachLeft(e){return this._createActionScaleDetach(e,"left",this._onDetachLeft.bind(this),"ToggleScaleLeft")}_createActionScaleDetachRight(e){return this._createActionScaleDetach(e,"right",this._onDetachRight.bind(this),"ToggleScaleRight")}_onMoveToScale(e){const t=e.getPayload();if(t.datasource.priceScale()===t.priceScale)return;const i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t.datasource));this._chartWidget.model().moveToScale(t.datasource,s,t.priceScale,t.undoText)}_createMoveToScaleAction(e,t,i,s){const r=e.priceScale()===t;return new L.ActionWithStandardIcon({actionId:"Chart.Source.MoveToOtherScale",options:{checkable:!0,checked:r,label:i,statName:"ToggleScale",payload:{datasource:e,priceScale:t,undoText:s},onExecute:this._onMoveToScale.bind(this)}})}_onNoScale(e){const t=e.getPayload().datasource,i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t));s.isOverlay(t)||this._chartWidget.model().detachNoScale(t,s)}_createActionNoScale(e){const t=this._chartWidget.model().model(),i=(0,r.ensureNotNull)(t.paneForSource(e)),s=i.actionNoScaleIsEnabled(e);return new L.ActionWithStandardIcon({actionId:"Chart.Source.MoveToNoScale",options:{checkable:!0,checked:i.isOverlay(e),label:ue,disabled:!s,statName:"ToggleNoScale",payload:{datasource:e},onExecute:this._onNoScale.bind(this)}})}_createActionScaleItems(e){const t=[],i=this._chartWidget.model().model(),s=(0,
r.ensureNotNull)(i.paneForSource(e)),n=i.priceScaleSlotsCount().totallySlots>1,o=s.rightPriceScales(),a=s.leftPriceScales(),l=this._createActionScaleDetachRight(e),d=this._createActionScaleDetachLeft(e),u=o.length+a.length+(null===l?0:1)+(null===d?0:1)>2,p={right:{hidden:{checked:{labelled:K,sided:Y},unchecked:{labelled:Z,sided:X}},visible:{checked:{labelled:J,sided:Q},unchecked:{labelled:ee,sided:te}}},left:{hidden:{checked:{labelled:K,sided:ie},unchecked:{labelled:Z,sided:se}},visible:{checked:{labelled:J,sided:re},unchecked:{labelled:ee,sided:ne}}}},_={right:E,left:V},m={left:s.visibleLeftPriceScales(),right:s.visibleRightPriceScales()},g=(t,i)=>{const s=("right"===i?o:a)[t],r=m[i].includes(s)?"visible":"hidden",l=e.priceScale()===s?"checked":"unchecked",c=n?"labelled":"sided",d=p[i],u=(0,h.getPriceAxisNameInfo)(i,t).label;return{actionText:d[r][l][c].format({label:u}),undoText:n?D.format({label:u}):_[i]}};t.push(...o.map(((t,i)=>{const s=g(i,"right");return this._createMoveToScaleAction(e,t,s.actionText,s.undoText)}))),null!==l&&t.push(l);u&&(o.length>0||null!==l)&&t.push(new c.Separator);t.push(...a.map(((t,i)=>{const s=g(i,"left");return this._createMoveToScaleAction(e,t,s.actionText,s.undoText)}))),null!==d&&t.push(d);u&&(a.length>0||null!==d)&&t.push(new c.Separator);return t.push(this._createActionNoScale(e)),t}_createActionMergeUp(e){const t=this._chartWidget.model();return t.model().isMergeUpAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.MergeUp",options:{label:_e,statName:"MergeUp",onExecute:()=>t.mergeSourceUp(e)}}):null}_createActionUnmergeUp(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeUp",options:{label:me,statName:"UnmergeUp",onExecute:()=>t.unmergeSourceUp(e)}}):null}_createActionMergeDown(e){const t=this._chartWidget.model();return t.model().isMergeDownAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.MergeDown",options:{label:ge,statName:"MergeDown",onExecute:()=>t.mergeSourceDown(e)}}):null}_createActionUnmergeDown(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeDown",options:{label:fe,statName:"UnmergeDown",onExecute:()=>t.unmergeSourceDown(e)}}):null}_mergeContentMenuItems(e){return[this._createActionMergeUp(e),this._createActionUnmergeUp(e),this._createActionMergeDown(e),this._createActionUnmergeDown(e)].filter(o.notNull)}_createActionMove(e){const t=this._mergeContentMenuItems(e);return t.length>0?new L.ActionWithStandardIcon({actionId:"Chart.Source.MoveToPane",options:{label:pe,iconId:"Chart.Move",subItems:t}}):null}async _contextMenuActionsForSeries(e,t){var i;const s=[],n=this._chartWidget.model().model(),o=(0,r.ensureNotNull)(n.paneForSource(e)),a=this._chartWidget.actions(),h=t&&"localY"in t?t.localY:void 0;if(this._isReadOnly())s.push(Qe(this._chartWidget,[e])),s.push(new c.Separator),s.push(this._createActionScale(e));else{0,
s.length>0&&!(s[s.length-1]instanceof c.Separator)&&s.push(new c.Separator),l.enabled("symbol_info")&&s.push(a.showSymbolInfoDialog);n.mainSeries().symbolInfo();if(s.length>0&&!(s[s.length-1]instanceof c.Separator)&&s.push(new c.Separator),!o.isEmpty()&&l.enabled("datasource_copypaste")){const e=Ze(o,h),t=$e(this._chartWidget,o);(e||t)&&(e&&s.push(e),t&&s.push(t),s.push(new c.Separator))}s.push(Ke(this._chartWidget,[e]));const t=this._createActionMove(e);null!==t&&s.push(t),s.push(this._createActionScale(e)),s.push(Qe(this._chartWidget,[e])),s.push(new c.Separator);Boolean(null===(i=window.widgetbar)||void 0===i?void 0:i.widget("watchlist"))&&a.addToWatchlist&&s.push(a.addToWatchlist),l.enabled("text_notes")&&s.push(a.addToTextNotes),s[s.length-1]instanceof c.Separator||s.push(new c.Separator),l.enabled("show_chart_property_page")&&!this._chartWidget.onWidget()&&s.push(a.mainSeriesPropertiesAction),s[s.length-1]instanceof c.Separator&&s.pop()}return s}_createActionAddChildStudy(e){throw new Error("unsupported")}_createActionAddFundamentals(e){return null}_createActionShowSymbolInfoDialog(e,t){const i=this._chartWidget.model().model();return new L.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowSymbolInfo",options:{label:We,iconId:"Chart.SymbolInfo",checkable:!1,statName:"SymbolInfo",onExecute:()=>{const s={symbolInfo:e.symbolInfo(),unitDescription:e=>e?t.description(e):"",dateFormatter:i.dateFormatter()};(0,f.showSymbolInfoDialog)(s)}}})}_createActionShowProperties(e){return new L.ActionWithStandardIcon({actionId:"Chart.Indicator.ShowSettingsDialog",options:{label:Ae,iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>this._chartWidget.showSourceProperties(e)}})}async _contextMenuActionsForStudy(e,t,i){const s=t!==this._chartWidget.model().paneForSource(e),r=this._chartWidget.actions(),n=(i&&"localY"in i&&i.localY,[]);if(!e.userEditEnabled())return n;if(this._chartWidget.readOnly())n.push(Qe(this._chartWidget,[e])),n.push(new c.Separator),(0,p.isNonSeriesStudy)(e)||n.push(this._createActionScale(e));else{0,l.enabled("study_on_study")&&e.canHaveChildren()&&n.push(this._createActionAddChildStudy(e));const t=this._createApplyToEntireLayoutCommand(e);null!==t&&n.push(t);const i=this._createAddIndicatorToFavoritesCommand(e);if(i&&n.push(i),n.length>0&&!(n[n.length-1]instanceof c.Separator)&&n.push(new c.Separator),l.enabled("symbol_info")&&(0,u.isCompareOrOverlayStudy)(e)&&null!==e.symbolInfo()&&(n.push(this._createActionShowSymbolInfoDialog(e,this._chartWidget.model().model().availableUnits())),n.push(new c.Separator)),s||n.push(Ke(this._chartWidget,[e])),n.push(Ye(this._chartWidget,[e])),!(0,p.isNonSeriesStudy)(e)&&!s){const t=this._createActionMove(e);null!==t&&n.push(t),n.push(this._createActionScale(e))}n.push(new c.Separator);const o=e.metaInfo();if(e.copiable()){const t=new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopySource",options:{label:Le,shortcutHint:(0,m.humanReadableHash)(m.Modifiers.Mod+67),statName:"Copy",onExecute:()=>{
this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([e])}}});n.push(t)}n.push(Qe(this._chartWidget,[e])),n.push(r.studyRemove);const a=this._options.objectTree&&r.paneObjectTree,h=!1;(a||h)&&(n.push(new c.Separator),a&&n.push(r.paneObjectTree),h&&n.push(this._chartWidget.actions().showDataWindow)),n.push(new c.Separator),l.enabled("property_pages")&&new _.MetaInfoHelper(o).hasUserEditableOptions()&&n.push(this._createActionShowProperties(e)),n[n.length-1]instanceof c.Separator&&n.pop()}return n}_createLineToolTemplateAction(e){return null}_createActionToggleLockLineTools(e){const t=e[0].properties().frozen.value(),i=t?Ee:Ve;return new L.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ToggleLocked",options:{label:i,statName:"ToggleLockSelectedObject",checkable:!0,iconId:t?"Chart.UnlockObject":"Chart.LockObject",onExecute:()=>{if(1===e.length)this._chartWidget.toggleLockSelectedObject();else{const i=t?H:W,s=this._chartWidget.model();s.withMacro(i,(()=>{e.forEach((e=>{s.setProperty(e.properties().frozen,!t,i,P.lineToolsDoNotAffectChartInvalidation)}))}))}}}})}async _contextMenuActionsForLineTool(e){const t=[],i=this._chartWidget.actions(),s=(this._chartWidget.model().model(),()=>{t.push(Ke(this._chartWidget,e))}),r=()=>{t.push(Ye(this._chartWidget,e))},n=()=>{const i=e.filter((e=>e.cloneable()));if(i.length>0){const e=new L.ActionWithStandardIcon({actionId:"Chart.LineTool.Clone",options:{label:ke,iconId:"Chart.Clone",shortcutHint:(0,m.humanReadableModifiers)(m.Modifiers.Mod)+"Drag",statName:"Clone",onExecute:()=>this._chartWidget.model().cloneLineTools(i,!1)},id:"Clone"});t.push(e)}return!!i.length},o=()=>{const i=e.filter((e=>e.copiable()));if(i.length>0){const e=new c.Action({actionId:"Chart.Clipboard.CopyLineTools",options:{label:Le,shortcutHint:(0,m.humanReadableHash)(m.Modifiers.Mod+67),statName:"Copy",onExecute:()=>this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy(i)},id:"Copy"});t.push(e)}return!!i.length},a=()=>{const e=(this._chartWidget,[]);return t.push(...e),e.length>0},h=e=>{const i=new L.ActionWithStandardIcon({actionId:"Chart.ScrollToLineTool",options:{label:De.format({lineToolName:e.title(d.TitleDisplayTarget.StatusLine)}),statName:"GoToLineTool",checkable:!1,onExecute:async()=>this._chartWidget.model().scrollToLineTool(e)}});t.push(i)},u=e=>{const t=this._chartWidget.model().model().lineToolsGroupModel(),i=e.map((e=>t.groupForLineTool(e)));return new Set(i).size<=1};if(1===e.length){const d=e[0];if(this._chartWidget.readOnly())t.push(Qe(this._chartWidget,[d]));else if(d.userEditEnabled()){0,s(),r(),this._options.objectTree&&i.paneObjectTree&&t.push(i.paneObjectTree),t.push(new c.Separator);let e=n();e=o()||e,e&&t.push(new c.Separator),e=a(),e&&t.push(new c.Separator),t.push(this._createActionToggleLockLineTools([d])),t.push(Qe(this._chartWidget,[d])),t.push(i.lineRemove),d.points().length>0&&this._options.gotoLineTool&&(t.push(new c.Separator),h(d));const u=await this._chartWidget.propertiesDefinitionsForSource(d)
;if(l.enabled("property_pages")&&null!==u&&(t.push(new c.Separator),t.push(i.format)),d.additionalActions){t.push(new c.Separator);const e=d.additionalActions(this._chartWidget.model());t.push(...e)}}}else this._options.objectTree&&i.paneObjectTree&&t.push(i.paneObjectTree),u(e)&&s(),r(),t.length>0&&t.push(new c.Separator),n(),o(),a(),t.push(new c.Separator),t.push(this._createActionToggleLockLineTools(e)),t.push(Qe(this._chartWidget,e)),t.push(i.lineRemove),l.enabled("property_pages")&&(t.push(new c.Separator),t.push(i.format));return t}_createEarningsShow(){return null}_createDividendsShow(){return null}_createSplitsShow(){return null}_contextMenuActionsForESD(){return[]}_contextMenuActionsForRollDates(){return[]}_contextMenuActionsForFuturesContractExpiration(){return[]}_contextMenuActionsForisLatestUpdates(){return[]}_contextMenuActionsForPublishedTimeline(e){const t=this._chartWidget.actions(),i=[];if(i.push(t.lineHide),window.is_authenticated){const t=e.properties().childs().filter,s=new c.Action({actionId:"Chart.ShowAllIdeas",options:{checked:t.value()===PublishedChartsFilter.None,checkable:!0,label:Be,name:"ToggleAllIdeas",statName:"ToggleAllIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.None,B)}}),r=new c.Action({actionId:"Chart.ShowIdeasOfFollowedUsers",options:{checked:t.value()===PublishedChartsFilter.Following,checkable:!0,label:Re,name:"ToggleIdeasOfPeopleAndUser",statName:"ToggleIdeasOfPeopleAndUser",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.Following,R)}}),n=new c.Action({actionId:"Chart.ShowMyIdeasOnly",options:{checked:t.value()===PublishedChartsFilter.Private,checkable:!0,label:Ne,name:"ToggleUserIdeas",statName:"ToggleUserIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.Private,N)}});i.push(new c.Separator,s,r,n)}return i}_contextMenuActionsForTradingDrawings(e){return e.contextMenuItems()}async _contextMenuActionsForAlertLabel(e,t){return[]}_contextMenuActionsForChartEvents(e){return[]}_createApplyToEntireLayoutCommand(e){if(!this._chartWidget.chartWidgetCollection().applyIndicatorsToAllChartsAvailable())return null;const t=this._chartWidget.model().model();if(e.parentSources().length>0)return null;const i=(0,r.ensureNotNull)(t.paneForSource(e)),s=t.paneForSource(t.mainSeries())===i,n=e instanceof g.StudyCompare&&e.priceScale()===t.mainSeries().priceScale()&&(0,r.ensureNotNull)(e.priceScale()).isPercentage(),o=s?void 0:t.panes().indexOf(i);let a=Fe,l=F,h="AddStudyToEntireLayout";return(0,S.isActingAsSymbolSource)(e)&&(a=Oe,l=O,h="AddSymbolToEntireLayout"),new c.Action({actionId:"Chart.AddIndicatorToAllCharts",options:{label:a,statName:h,onExecute:()=>{const i=(0,r.ensureNotNull)((0,v.clipboardDataForSources)(t.id(),[e])),a=this._chartWidget.chartWidgetCollection(),c={isOnMainPane:s,asCompare:n,paneIndex:o};a.applyIndicatorToAllCharts(this._chartWidget,i,c,l)}},id:"applyStudyToEntireLayout"})}_createAddIndicatorToFavoritesCommand(e){const t=e.metaInfo();let s
;if(!l.enabled("items_favoriting"))return null;{const{description_localized:e,description:r}=t,n=e||a.t(r,{context:"study"},i(83477));s=()=>i.e(9790).then(i.bind(i,23390)).then((({isFavorite:e,toggleFavorite:t})=>({label:e(n)?Ge:je,onExecute:()=>t(n)})))}return new c.Action({actionId:"Chart.Indicator.AddFavorites",id:"addIndicatorToFavorites",optionsLoader:s,options:{statName:"AddIndicatorToFavorites"}})}}},31045:(e,t,i)=>{"use strict";i.d(t,{Animation:()=>o});var s=i(78871),r=i(61119);const n={duration:250,easing:s.easingFunc.easeOutCubic};class o{constructor(e){this._onFinishCalled=!1,this._options={...n,...e},this._startTime=performance.now()}getStartPosition(){return this._options.from}getPosition(e){const t=this._calculateProgress(e);return 1===t?(this._options.onFinish&&!this._onFinishCalled&&(this._options.onFinish(!0),this._onFinishCalled=!0),this._options.to):(0,r.lerp)(this._options.from,this._options.to,this._options.easing(t))}finished(e){return 1===this._calculateProgress(e)}onFinish(e){var t,i;this._onFinishCalled||(null===(i=(t=this._options).onFinish)||void 0===i||i.call(t,e),this._onFinishCalled=!0)}_calculateProgress(e){const t=e-this._startTime;return t>=this._options.duration?1:t/this._options.duration}}},4711:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isSupportedLineTool:()=>s,supportedLineTools:()=>r});i(49483);function s(e){return e in r}const r={cursor:{name:"cursor",onlySelectable:!0},dot:{name:"dot",onlySelectable:!0},arrow_cursor:{name:"arrow",onlySelectable:!0},eraser:{name:"eraser",onlySelectable:!0},measure:{name:"measure",onlySelectable:!0},zoom:{name:"zoom",onlySelectable:!0},brush:{name:"LineToolBrush"},highlighter:{name:"LineToolHighlighter"},text:{name:"LineToolText"},anchored_text:{name:"LineToolTextAbsolute",isAnchored:!0},note:{name:"LineToolNote"},anchored_note:{name:"LineToolNoteAbsolute",isAnchored:!0},signpost:{name:"LineToolSignpost"},callout:{name:"LineToolCallout"},balloon:{name:"LineToolBalloon"},comment:{name:"LineToolComment"},arrow_up:{name:"LineToolArrowMarkUp"},arrow_down:{name:"LineToolArrowMarkDown"},arrow_left:{name:"LineToolArrowMarkLeft"},arrow_right:{name:"LineToolArrowMarkRight"},price_label:{name:"LineToolPriceLabel"},price_note:{name:"LineToolPriceNote"},arrow_marker:{name:"LineToolArrowMarker"},flag:{name:"LineToolFlagMark"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},cross_line:{name:"LineToolCrossLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},info_line:{name:"LineToolInfoLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},anchored_vwap:{name:"LineToolAnchoredVWAP"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{
name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fixed:{name:"LineToolGannFixed"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"},fib_channel:{name:"LineToolFibChannel"},xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},circle:{name:"LineToolCircle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},path:{name:"LineToolPath"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"},emoji:{name:"LineToolEmoji"},sticker:{name:"LineToolSticker"},regression_trend:{name:"LineToolRegressionTrend"},fixed_range_volume_profile:{name:"LineToolFixedRangeVolumeProfile"}}},86920:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>l,isLineToolClipboardData:()=>a});var s=i(50151),r=i(19466),n=i(72708),o=i(630);function a(e){return"drawing"===e.type}function l(e,t){if(1===t.length&&(0,n.isStudy)(t[0])){const e=t[0];return{title:e.title(r.TitleDisplayTarget.StatusLine),sources:[{source:(0,s.ensureNotNull)(e.state()),type:"study"}]}}const i={sources:[],title:""};return i.sources=t.filter((e=>e.copiable()&&(0,o.isLineTool)(e))).map((t=>{const i={type:"drawing",geometry:t.geometry(),source:{...t.state(!1),points:t.normalizedPoints()},modelId:e};return delete i.source.alertId,i})),i.sources.length>0?(1===i.sources.length?i.title=t[0].title(r.TitleDisplayTarget.StatusLine):i.title="Drawings",i):null}},7114:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>P,
addExclusionAreaByScope:()=>C,calcTextHorizontalShift:()=>b,clearRect:()=>_,createBoundCanvas:()=>y,createDisconnectedCanvas:()=>g,createDisconnectedCanvasByRenderingInfo:()=>f,disableSelection:()=>w,drawScaled:()=>m,drawWithExclusionAreaByScope:()=>x,fillRect:()=>p,getBindingRenderingInfo:()=>h,getContext2D:()=>d,getPrescaledContext2D:()=>u,measureText:()=>I,tryApplySuggestedCanvasBitmapSize:()=>S});var s=i(27714),r=i(50151),n=i(776),o=i(2844),a=i(63273),l=i(49483);function c(e){return{horizontalPixelRatio:Math.max(1,e.bitmapSize.width/e.canvasElementClientSize.width),verticalPixelRatio:Math.max(1,e.bitmapSize.height/e.canvasElementClientSize.height)}}function h(e){return{...c(e),bitmapSize:e.bitmapSize,mediaSize:e.canvasElementClientSize}}function d(e){const t=(0,r.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function u(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 p(e,t,i,s,r,n){e.save(),e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function _(e,t,i,s,r,n){e.save(),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function m(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function g(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 f(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 w(t),t}function y(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 S(e){const t=e.suggestedBitmapSize;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function b(e,t){return"center"===e.textAlign?0:(0,a.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function w(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function C(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{
"use strict";i.d(t,{ChartChangesWatcher:()=>o,changedAll:()=>n});var s,r=i(52033);!function(e){e[e.NothingChanged=0]="NothingChanged",e[e.ContentChanged=1]="ContentChanged",e[e.LineToolsChanged=2]="LineToolsChanged"}(s||(s={}));const n=3;class o{constructor(e,t,i){this._undoHistoryHasChanges=!1,this._changesMask=0,this._recursiveLoopingGuard=!1,this._handleMetainfoChanged=()=>{this._changesMask=1|this._changesMask},this._recalculateHaveChanges=(e,t)=>{if(!this._recursiveLoopingGuard)try{this._recursiveLoopingGuard=!0;const e=this._undoHistoryHasChanges?1:0;let i=this._lineToolsHaveChanges.value()?2:0;const s=this._changesMask;this._changesMask=e|i,s!==this._changesMask&&(this._changesMask&&(this._chartWidgetCollection.getAll().forEach((e=>{var i;null===(i=e.lineToolsSynchronizer())||void 0===i||i.markAsValidatedBecauseOfSavingToContent(!!t)})),i=this._lineToolsHaveChanges.value()?2:0,this._changesMask=e|i),this._onValueChanged.fire(0!==this._changesMask))}finally{this._recursiveLoopingGuard=!1}},this._chartWidgetCollection=e,this._undoHistory=e.undoHistory,this._lineToolsHaveChanges=e.lineToolsSynchronizerHasChanges,this._chartSaver=t,this._globalEvents=i,this._onValueChanged=new r.Delegate,this._subscribe()}destroy(){this._unsubscribe(),this._onValueChanged.destroy()}changes(){return this._changesMask}hasChanges(){return this._changesMask>0}getOnChange(){return this._onValueChanged}_subscribe(){var e;this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.subscribe("chart_migrated",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleUndoHistoryChange),null===(e=this._chartSaver)||void 0===e||e.chartSaved().subscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.subscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.subscribe(this._handleMetainfoChanged)}_unsubscribe(){var e;this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.unsubscribe("chart_migrated",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleUndoHistoryChange),null===(e=this._chartSaver)||void 0===e||e.chartSaved().unsubscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.unsubscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.unsubscribe(this._handleMetainfoChanged)}_setUndoHistoryHasChanges(e,t){this._undoHistoryHasChanges=e,this._recalculateHaveChanges(e,t)}_handleChartLoaded(){this._setUndoHistoryHasChanges(!1)}_handleUndoHistoryChange(e){(null==e?void 0:e.affectsState())&&this._setUndoHistoryHasChanges(!0)}_handleChartMigrated(){this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1,!0)}}},72522:(e,t,i)=>{"use strict";i.d(t,{ChartHotkeysListener:()=>v,globalEnvironmentState:()=>f,modifierPressed:()=>g,shiftPressed:()=>m});var s,r,n,o=i(4741),a=i(68335),l=i(35749),c=i(64147),h=i(28331)
;const d=new c.WatchedValue(Boolean((null!==(s=o.pressedKeys.value())&&void 0!==s?s:0)&a.Modifiers.Shift)),u=new c.WatchedValue(Boolean((null!==(r=o.pressedKeys.value())&&void 0!==r?r:0)&a.Modifiers.Mod)),p=new c.WatchedValue(Boolean((null!==(n=o.pressedKeys.value())&&void 0!==n?n:0)&a.Modifiers.Alt)),_=[a.Modifiers.None,a.Modifiers.Alt,a.Modifiers.Mod,a.Modifiers.Alt+a.Modifiers.Shift];function m(){return d}function g(){return u}function f(){return new h.EnvironmentState({altKey:p.value(),ctrlKey:g().value(),metaKey:g().value(),shiftKey:m().value()})}o.pressedKeys.subscribe(((e=0)=>{d.setValue(Boolean(e&a.Modifiers.Shift)),u.setValue(Boolean(e&a.Modifiers.Mod)),p.setValue(Boolean(e&a.Modifiers.Alt))}));class v{constructor(e,t){this._pressedKeyCode=null,this._boundKeydownHandler=null,this._boundKeyupHandler=null,this._chartWidget=e,this._parent=t,this._boundKeydownHandler=this._keydownHandler.bind(this),this._boundKeyupHandler=this._keyupHandler.bind(this),this._parent.ownerDocument.addEventListener("keydown",this._boundKeydownHandler),this._parent.ownerDocument.addEventListener("keyup",this._boundKeyupHandler)}destroy(){null!==this._boundKeydownHandler&&(this._parent.ownerDocument.removeEventListener("keydown",this._boundKeydownHandler),this._boundKeydownHandler=null),null!==this._boundKeyupHandler&&(this._parent.ownerDocument.removeEventListener("keyup",this._boundKeyupHandler),this._boundKeyupHandler=null)}_keydownHandler(e){this._chartWidget.hasModel()&&window.document.activeElement===window.document.body&&this._chartWidget.isActive().value()&&(e.defaultPrevented||(this._handleMoveDrawingsKeyDown(e)||this._handleScrollKeyDown(e)||this._handleZoomKeyDown(e))&&e.preventDefault())}_keyupHandler(e){this._chartWidget.hasModel()&&this._handleScrollKeyUp(e)}_handleMoveDrawingsKeyDown(e){const t=255&(0,a.hashFromEvent)(e),i=this._chartWidget.model();switch(t){case 37:return i.moveSelectedToolsLeft();case 39:return i.moveSelectedToolsRight();case 38:return i.moveSelectedToolsUp();case 40:return i.moveSelectedToolsDown()}return!1}_handleScrollKeyDown(e){if(null!==this._pressedKeyCode)return!1;const t=(0,a.hashFromEvent)(e),i=255&t,s=(0,a.modifiersFromEvent)(e);let r;if(37===i)r=1;else{if(39!==i)return!1;r=-1}return!(a.isMacKeyboard&&s===a.Modifiers.Mod||!_.includes(s))&&(!(0,l.isNativeUIInteraction)(t,e.target)&&(this._pressedKeyCode=i,s===a.Modifiers.None?this._chartWidget.scrollHelper().moveByBar(r):s===a.Modifiers.Alt||s===a.Modifiers.Mod?this._chartWidget.scrollHelper().move(r):-1===r?this._chartWidget.model().timeScale().scrollToRealtime(!0):this._chartWidget.model().timeScale().scrollToFirstBar(),!0))}_handleScrollKeyUp(e){if(null===this._pressedKeyCode)return!1;const t=(0,a.hashFromEvent)(e);if((0,l.isNativeUIInteraction)(t,e.target))return!1;return(255&t)===this._pressedKeyCode&&(this._pressedKeyCode=null,this._chartWidget.scrollHelper().stopMove(),!0)}_handleZoomKeyDown(e){const t=(0,a.hashFromEvent)(e),i=255&t;if((0,a.modifiersFromEvent)(e)!==a.Modifiers.Mod||(0,l.isNativeUIInteraction)(t,e.target))return!1
;const s=this._chartWidget.model();if(38===i)s.zoomIn();else{if(40!==i)return!1;s.zoomOut()}return!0}}},17730:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>n});var s=i(50151),r=i(53388);function n(e,t,i){return new a(function(e,t){const i=function(e,t){return e+t.session+t.timezone+(t.corrections||"")+(t.session_holidays||"")}(e,t);let s=o.get(i);void 0===s&&(s=(0,r.createDwmAligner)(e,t),o.set(i,s));return s}(e,t),i)}const o=new Map;class a{constructor(e,t){this._dwmAligner=e,this._chartModel=t}convertPublicTimeToInternalTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(1e3*e)/1e3:e}convertInternalTimeToPublicTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToExchangeTradingDay(1e3*e)/1e3:e}convertTimePointIndexToPublicTime(e){let t=this.convertTimePointIndexToInternalTime(e);return null!==t&&(t=this.convertInternalTimeToPublicTime(t)),t}convertTimePointIndexToInternalTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;const i=t.points(),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(i.range().value());let o=null;if(r<=e&&e<=n)o=i.valueAt(e);else if(e>n){const i=this._chartModel.mainSeries().syncModel();if(null!==i){const r=(0,s.ensureNotNull)(t.indexToTimePoint(n));o=i.projectTime(r,e-n)}}return o}}},4849:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetBase:()=>tl});var s=i(27714),r=i(95171),n=i(50151),o=i(3343),a=i(11542),l=i(76422),c=i(49483),h=i(56840),d=i(85662),u=i(51768),p=i(4741),_=i(19063),m=i(31955),g=i(14426);function f(e,t){const i=Object.create(Object.getPrototypeOf(e));for(const s of t)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var v=i(58473),y=i(90995),S=i(29280);let b;class w extends S.DialogRenderer{constructor(){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(){this._load().then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return b||(b=new w),b}_load(){return Promise.all([i.e(3796),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(6625),i.e(5546),i.e(4392),i.e(4632),i.e(8432),i.e(3204),i.e(6107),i.e(1227),i.e(8316),i.e(6220),i.e(7530),i.e(7844),i.e(2227),i.e(3443),i.e(7746),i.e(6014),i.e(361),i.e(2079),i.e(3098),i.e(4862)]).then(i.bind(i,34489)).then((e=>{var t,i;return null===(t=this._dialog)||void 0===t||t.hide(),null===(i=this._dialog)||void 0===i||i.visible().unsubscribe(this._subscribe),this._dialog=new e.ObjectTreeDialogRenderer,this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}var C,P=i(37265),x=i(65383),T=i(12988);async function I(e,t,s,r,n,o="default"){let l,c=[];const h=e.model().model(),d=(0,P.clone)(t),u=new T.Property({inputs:d}),p=function(e,t){return"symbol"===t?e.inputs.filter((t=>t.id===e.symbolInputId())):e.inputs.filter((e=>e.confirm))}(s,o),_=()=>{l&&h.removeCustomSource(l)},m=()=>{_(),n()},g=e=>{r({inputs:e,parentSources:c}),_()},f=p.filter(x.isTimeOrPriceNotHiddenInput);if(f.length>0)try{
const t=await Promise.all([i.e(4703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2198),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(3030)]).then(i.bind(i,73339)),r=await t.selectInputValuesOnChart(e,f,u,s.shortDescription,s.inputs);if(l=r.customSourceId,r.destPane){const e=r.destPane.mainDataSource();c=e===h.mainSeries()?[]:[e]}else c=[]}catch(e){return void m()}f.length!==p.length?Promise.all([i.e(4703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2198),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(3030)]).then(i.bind(i,29638)).then((t=>{const r=new t.ConfirmInputsDialogRenderer(function(e){if("symbol"===e)return a.t(null,void 0,i(46501));return a.t(null,void 0,i(48141))}(o),p,u,o,s,e.model(),g,m);return r.show(),r})):g(u.state().inputs||{})}!function(e){e.Default="default",e.Symbol="symbol"}(C||(C={}));let M=null;i(7727);var A=i(49481),L=i(58096);const k=(0,A.parseHtmlElement)(function(e=""){return``}());class D{constructor(e){this._shown=!1,this._el=k.cloneNode(!0),this.setSize(L.spinnerSizeMap[e||L.DEFAULT_SIZE])}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el&&this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach((t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)})),this}style(){return this._el.style}setSize(e){const t=void 0!==e?`tv-spinner--size_${e}`:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}var E=i(29981),V=i(88960),B=i(63950),R=i(52033),N=i(56570);function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function F(e){return e.reduce(((e,t)=>{for(const i in t)if(O(t,i)){const s=t[i],r=e[i];r?r.push(s):e[i]=[s]}return e}),{})}var W=i(45126),H=i(64147),z=i(7114),U=i(72522);const j=new W.TranslatedString("move left",a.t(null,void 0,i(79209))),G=new W.TranslatedString("move right",a.t(null,void 0,i(60114)));var q;!function(e){e[e.AccelerationPerMSecPixels=.003]="AccelerationPerMSecPixels",e[e.MaxSpeedPerMSecPixels=1.1]="MaxSpeedPerMSecPixels"}(q||(q={}));class ${constructor(e){this._chartModel=null,this._animation=null,this._chart=e,this._chart.withModel(this,(()=>{
this._chartModel=this._chart.model()}))}destroy(){var e;null===(e=this._animation)||void 0===e||e.stop()}move(e){if(null!==this._chartModel){if(this._chartModel.timeScale().isEmpty())return;const t=.003,i=1.1,s=Math.round(i/t);this._moveImpl(e,((r,n,o)=>{const a=Math.min(n,s),l=e*t*Math.pow(a,2)/2;if(n<=s)return r+l;const c=Number.isFinite(o)?Math.max(0,s-o):0;return r+l+e*(n-a-c)*i+e*(i*c-t*Math.pow(c,2)/2)}),(e=>Math.max(0,s-e)+s))}}moveByBar(e){if(null!==this._chartModel){const t=this._chartModel.timeScale(),i=t.visibleBarsStrictRange();if(t.isEmpty()||null===i)return;const s=300,r=i.lastBar();this._moveImpl(e,((i,n)=>{const o=Math.floor(Math.max(0,n-s)/100)+1,a=r+e*o,l=t.indexToCoordinate(r);return i+(t.indexToCoordinate(a)-l)}),(()=>0),!0)}}stopMove(){var e;null===(e=this._animation)||void 0===e||e.stop(),this._animation=null}scrollToRealtime(e){null!==this._chartModel&&this._chartModel.timeScale().scrollToRealtime(e)}_moveImpl(e,t,i,s){if(null===this._chartModel)return;const r=this._chartModel.timeScale();if(r.isEmpty())return;if(this._chartModel.changeTimeScale(1===e?j:G,!1),s&&null!==r.visibleBarsStrictRange()){const e=r.indexToCoordinate(r.visibleBarsStrictRange().lastBar())+r.barSpacing()/2;Math.abs(r.width()-e)>r.barSpacing()/6&&r.setRightOffset(Math.round(r.rightOffset()))}const n=performance.now();let o=1/0;this._animation={getStartPosition:()=>0,getPosition:e=>(e=Math.min(o,e),t(0,e-n,o-e)),finished:e=>e>=o,stop:()=>{const e=performance.now()-n;o=performance.now()+i(e)}},this._chartModel.model().stopTimeScaleAnimation(),this._chartModel.model().setTimeScaleAnimation(this._animation)}}var K=i(26023);function Y(e,t,s,r,n){return Promise.all([i.e(6150),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3762),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(889),i.e(61),i.e(71),i.e(9476),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),i.e(6265)]).then(i.bind(i,81346)).then((i=>{const o=new(0,i.EditObjectDialogRenderer)(e,t,r,n);return o.show(s),o}))}var Z=i(72708);let X=null;var J=i(630);const Q={[K.TabNames.symbol]:"symbol",[K.TabNames.legend]:"legend",[K.TabNames.scales]:"scales",[K.TabNames.trading]:"trading",[K.TabNames.events]:"events",[K.TabNames.eventsAndAlerts]:"events",[K.TabNames.timezoneSessions]:"canvas",[K.TabNames.text]:"text",[K.TabNames.style]:"style",[K.TabNames.visibility]:"visibility"},ee={[K.TabNames.style]:"style",[K.TabNames.visibility]:"visibilities"};async function te(e,t,s={},r,n){const o=r.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=ee[l]),(0,J.isStudyLineTool)(e)&&function(e){if(!(0,J.isStudyLineTool)(e))return!1;return["LineToolFixedRangeVolumeProfile","LineToolVbPFixed",null].filter(P.notNull).some((t=>e.toolname===t))
}(e))return o.propertiesDefinitionsForSource(e).then((i=>null!==i?Y(e,t,s,n,i):null));if((0,Z.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,J.isLineTool)(e))return o.propertiesDefinitionsForSource(e).then((r=>{if(null!==r){return function(e){return Promise.all([i.e(5757),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(889),i.e(71),i.e(223),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),i.e(6780)]).then(i.bind(i,75892)).then((t=>{const i=new(0,t.SourcePropertiesEditorRenderer)(e);return null!==X&&X.hide(),i.show({shouldReturnFocus:e.shouldReturnFocus}),X=i,i}))}({propertyPages:r,model:t,source:e,activePageId:l&&Q[l],shouldReturnFocus:s.shouldReturnFocus})}return null}));if((0,Z.isStudy)(e))return Y(e,t,s,n);{const e=l&&Q[l],t=r.getChartPropertiesDialogRenderer();return t.setActivePage(e),t.show(s)}}var ie=i(19625),se=i(45345),re=i(24633);async function ne(){return(await Promise.all([i.e(8077),i.e(4814),i.e(2227),i.e(139)]).then(i.bind(i,81200))).ErrorCardRenderer}var oe=i(82236),ae=i(68805),le=i(62825);const ce=(0,ie.getHexColorByName)("color-cold-gray-700"),he=(0,ie.getHexColorByName)("color-cold-gray-400"),de=(0,ie.getHexColorByName)("color-cold-gray-900"),ue=(0,ie.getHexColorByName)("color-white"),pe=a.t(null,void 0,i(18905));function _e(e){return e?{...e,message:(0,oe.formatStudyError)(e.message),rawHtml:!0}:null}class me{constructor(e){this._container=null,this._errorCardRenderer=null,this._mainSeriesErrorMessage=null,this._banErrorMessage=new H.WatchedValue(null).spawn(),this._errorMessageHandler=e=>{e=_e(e),this._chartWidget.hasModel()?this._updatePaneWidgets(e):this._renderErrorWithoutModel(e)},this._chartWidget=e,this._subscribeToMainSeriesErrors()}destroy(){var e,t;null===(e=this._mainSeriesErrorMessage)||void 0===e||e.destroy(),this._banErrorMessage.destroy(),null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>{e.container.remove(),e.destroy()}))}updatePaneWidgets(){this._updatePaneWidgets()}setContainer(e){var t;if(this._container!==e){this._container=e,null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>e.container.remove()));const i=this._getErrorMessage();i&&this._errorMessageHandler(i)}}_updatePaneWidgets(e=this._getErrorMessage()){this._chartWidget.paneWidgets().forEach((t=>t.setErrorMessage(e)))}async _renderErrorWithoutModel(e){if(null===this._container||null===e&&null===this._errorCardRenderer)return;const t=await this._getErrorCardRenderer();this._container.contains(t.container)||this._container.appendChild(t.container),t.update(this._createErrorCardRendererState(e))}async _getErrorCardRenderer(){return this._errorCardRenderer||(this._errorCardRenderer=this._createErrorCardRenderer())}
async _createErrorCardRenderer(){return new(await ne())}_createErrorCardRendererState(e){return e?{message:e.message,icon:e.icon,textColor:se.watchedTheme.value()===re.StdTheme.Dark?he:ce,backgroundColor:se.watchedTheme.value()===re.StdTheme.Dark?de:ue,solutionId:e.solutionId,rawHtml:e.rawHtml,buttons:e.buttons}:{message:null}}_subscribeToMainSeriesErrors(){const e=this._chartWidget;e.withModel(this,(()=>{const t=e.model().model().mainSeries();this._mainSeriesErrorMessage=(0,V.combine)(((t,s)=>{if(t)return t;if(null===s)return null;switch(s.type){case"invalid_symbol":return{message:a.t(null,void 0,i(52969)),icon:"ghost"};case"calculations_error":return{message:s.errorMessage,icon:"attention"};case"no_data":return{message:a.t(null,void 0,i(36252)),icon:"ghost"};case"unsupported_resolution":return this._createErrorParamsForUnsupportedResolution(e)}}),this._banErrorMessage.weakReference(),(0,ae.getSeriesDisplayErrorWV)(t).ownership()),this._mainSeriesErrorMessage.subscribe(this._errorMessageHandler,{callWithLast:!0})}))}_createErrorParamsForUnsupportedResolution(e){const t=e.model(),i=t.mainSeries().unsupportedResolutionState().value();return null===i?null:{message:(0,le.getErrorFromUnsupportedResolutionState)(i,!0),icon:"unsupported-resolution",rawHtml:!0,maxHeight:400,zeroHeight:200,buttons:[{name:pe.format({resolution:i.applicableResolution}),onClick:()=>{t.setResolution(t.model().mainSeries(),i.applicableResolution)}}]}}_getErrorMessage(){var e;return _e(this._banErrorMessage.value()||(null===(e=this._mainSeriesErrorMessage)||void 0===e?void 0:e.value())||null)}}var ge,fe=i(776),ve=i(62288),ye=i(69186),Se=i(68993),be=i(46088),we=i(4340),Ce=i(5171),Pe=i(66316);class xe{constructor(e,t){this._showed=!1,this._cw=e,this._element=document.createElement("div"),this._element.classList.add(Pe.screen),t.appendChild(this._element),this._cw.withModel(this,this._connectToModel)}show(e){if(e){const e=this._cw.model().mainSeries().status();if(1!==e&&2!==e)return}this._cw.setInLoadingState(!0),this._showed||(this._showed=!0,this._show())}hide(){this._cw.setInLoadingState(!1),this._showed&&this._hide()}isShown(){return this._showed}_connectToModel(){const e=this._cw.model().mainSeries(),t=e.dataEvents();t.symbolError().subscribe(this,(e=>{e!==we.permissionDenied&&this.hide()})),t.seriesError().subscribe(this,(()=>{(0,N.enabled)("hide_loading_screen_on_series_error")&&this.hide()})),e.statusWV().subscribe((e=>{(Ce.seriesReadyStatuses.has(e)||4===e||12===e||13===e||14===e)&&this.hide()}))}_show(){const e=this._cw.properties().childs().paneProperties.childs();let t;if(e.backgroundType.value()===be.ColorType.Solid)t=e.background.value();else{t=`linear-gradient(${e.backgroundGradientStartColor.value()},${e.backgroundGradientEndColor.value()})`}this._element.style.background=t,this._element.classList.add(Pe.fade)}_hide(){this._showed=!1,this._element.classList.remove(Pe.fade)}}function Te(e,t){let{deltaX:i,deltaY:s}=e;switch(i/=100,s/=100,t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,s*=120;break;case t.DOM_DELTA_LINE:i*=32,s*=32}return{
deltaX:i,deltaY:s}}!function(e){e[e.MaxNextEventDelay=100]="MaxNextEventDelay",e[e.IgnoreSmallerDeltaCoeff=3]="IgnoreSmallerDeltaCoeff"}(ge||(ge={}));class Ie{constructor(){this._totalDeltaX=0,this._totalDeltaY=0,this._prevWheelTime=0}processWheel(e){e.timeStamp-this._prevWheelTime>100&&this._reset();const t=!(0,c.isMac)()&&e.shiftKey,i=t?-e.deltaY:e.deltaX,s=t?e.deltaX:e.deltaY;this._totalDeltaX+=i,this._totalDeltaY+=s,this._prevWheelTime=e.timeStamp;const r={deltaX:i,deltaY:s};return 0===this._totalDeltaX||0===this._totalDeltaY||(Math.abs(this._totalDeltaX)>=Math.abs(3*this._totalDeltaY)&&(r.deltaY=0),Math.abs(this._totalDeltaY)>=Math.abs(3*this._totalDeltaX)&&(r.deltaX=0)),Te(r,e)}_reset(){this._totalDeltaX=0,this._totalDeltaY=0}}var Me,Ae=i(24377),Le=i(9859),ke=i(35236),De=i(37702);!function(e){e[e.Height=1]="Height",e[e.MinPaneHeight=30]="MinPaneHeight"}(Me||(Me={}));class Ee{constructor(e,t,i){this._handleEl=null,this._resizeInfo=null,this._colorCache={lineColor:"",backgroundColor:"",color:""},this._chart=e,this._topPaneIndex=t,this._bottomPaneIndex=i,this._element=document.createElement("div"),this._element.classList.add(De.paneSeparator),this._element.style.background=this._color(),this.adjustSize(),this._element.addEventListener("click",(()=>{}));const s=document.createElement("div");s.classList.add(De.handle),this._element.appendChild(s),this._mouseEventHandler=new ke.MouseEventHandler(s,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._handleEl=s,this._element.setAttribute("aria-hidden","true")}destroy(){this._mouseEventHandler.destroy(),this._element.parentElement&&this._element.parentElement.removeChild(this._element)}getElement(){return this._element}hide(){this._element.classList.add("js-hidden")}show(){this._element.classList.remove("js-hidden")}adjustSize(){this._element.style.height=Ee.height()+"px"}mouseEnterEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);null!==t&&null!==i&&(0,n.ensureNotNull)(this._handleEl).classList.add(De.hovered)}mouseLeaveEvent(e){(0,n.ensureNotNull)(this._handleEl).classList.remove(De.hovered)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e)}update(){this._element.style.background=this._color().toString()}paint(){}image(){const{topPane:e}=this._topBottomPane(!1),t=e.leftPriceAxisesContainer().getWidth(),i=e.width(),r=e.rightPriceAxisesContainer().getWidth(),n=this._color(),o=(0,z.createDisconnectedCanvas)(document,(0,s.size)({width:t,height:1})),a=(0,z.getPrescaledContext2D)(o);a.fillStyle=n,a.fillRect(0,0,t,1);const l=(0,z.createDisconnectedCanvas)(document,(0,s.size)({width:i,height:1})),c=(0,z.getPrescaledContext2D)(l);c.fillStyle=n,c.fillRect(0,0,i,1);const h=(0,z.createDisconnectedCanvas)(document,(0,s.size)({width:r,height:1})),d=(0,
z.getPrescaledContext2D)(h);return d.fillStyle=n,d.fillRect(0,0,r,1),{type:"separator",leftAxis:{content:o.toDataURL(),canvas:o,contentWidth:t,contentHeight:1},rightAxis:{content:h.toDataURL(),canvas:h,contentWidth:r,contentHeight:1},content:l.toDataURL(),canvas:l,contentWidth:i,contentHeight:1}}static height(){const e=window.devicePixelRatio||1;return e>=1?1:1/e}_mouseDownOrTouchStartEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);if(null===t||null===i)return;const s=t.state().stretchFactor()+i.state().stretchFactor(),r=s/(t.height()+i.height()),o=30*r;s<=2*o||(this._resizeInfo={startY:e.pageY,prevStretchTopPane:t.state().stretchFactor(),maxPaneStretch:s-o,totalStretch:s,pixelStretchFactor:r,minPaneStretch:o},(0,n.ensureNotNull)(this._handleEl).classList.add(De.active))}_pressedMouseOrTouchMoveEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;if(null===s||null===t||null===i)return;const r=(e.pageY-s.startY)*s.pixelStretchFactor,n=(0,Le.clamp)(s.prevStretchTopPane+r,s.minPaneStretch,s.maxPaneStretch);t.state().setStretchFactor(n),i.state().setStretchFactor(s.totalStretch-n),this._chart.model().model().fullUpdate()}_mouseUpOrTouchEndEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;null!==s&&null!==t&&null!==i&&(this._chart.model().addPaneStretchFactorUndoCommand(t.state(),i.state(),s.prevStretchTopPane,t.state().stretchFactor()),this._resizeInfo=null,(0,n.ensureNotNull)(this._handleEl).classList.remove(De.active))}_color(){const e=this._chart.properties().childs().paneProperties.childs().separatorColor.value(),t=this._chart.model().model().backgroundColor().value();if(this._colorCache.lineColor!==e||this._colorCache.backgroundColor!==t){const i=(0,Ae.parseRgba)(t),s=(0,Ae.parseRgba)(e),r=0===i[3]&&0===s[3]?"rgba(0,0,0,0)":(0,Ae.rgbaToString)((0,Ae.blendRgba)(i,s));this._colorCache={lineColor:e,backgroundColor:t,color:r}}return this._colorCache.color}_topBottomPane(e){const t=this._chart.paneWidgets();let i=null,s=null;for(let s=this._topPaneIndex;s>=0;--s){const r=t[s];if(!e||!r.state().collapsed().value()){i=r;break}}for(let i=this._bottomPaneIndex;i{this.update(),this._textWidthCache.reset()},this._timeAxisWidget=o,this._isLeft="left"===e;const{rendererOptionsProvider:a,sourcesTitlesProvider:l,contextMenuItemsProvider:c,backgroundBasedTheme:h,onActiveOrHoveredChart:d=new H.WatchedValue(!1).ownership(),requestRepaint:u,getBackgroundTopColor:p,getBackgroundBottomColor:_,showHorizontalBorder:m}=r;this._rendererOptionsProvider=a,this._sourcesTitlesProvider=l,this._contextMenuItemsProvider=c,this._backgroundBasedTheme=h,this._onActiveOrHoveredChart=d,this._requestRepaint=u,this._getBackgroundTopColor=p,this._getBackgroundBottomColor=_,this._showHorizontalBorder=Boolean(m),this._properties=t,this._axisInfo=i,this._labelOptions={...tt,...n},this._properties.lineColor.subscribe(this,this._onPropertyChanged),this._cell=document.createElement("div"),this._labelOptions.enableTooltip&&this._cell.classList.add("apply-common-tooltip"),this._cell.style.width="25px",this._cell.style.height="100%",this._cell.style.position="absolute",this._cell.style.left="0",this._cell.style.overflow="hidden",this._labelOptions.showLabels&&(this._labelOptions.enableTooltip&&(0,Xe.setTooltipData)(this._cell,"text",(e=>this._tooltipContent())),this._onActiveOrHoveredChart.subscribe(u)),this._mouseEventHandler=new ke.MouseEventHandler(this._cell,this,{treatHorzTouchDragAsPageScroll:!0,treatVertTouchDragAsPageScroll:!0}),this._canvasBinding=(0,z.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const g=this._canvasBinding.canvasElement;g.style.position="absolute",g.style.left="0",g.style.top="0",this._cell.setAttribute("aria-hidden","true")}destroy(){this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._properties.lineColor.unsubscribe(this,this._onPropertyChanged),this._mouseEventHandler.destroy(),this._backgroundBasedTheme.release(),this._onActiveOrHoveredChart.unsubscribe(this._requestRepaint),this._onActiveOrHoveredChart.release()}mouseEnterEvent(e){this._mouseOrTouchEnterEvent(e)}touchStartEvent(e){this._mouseOrTouchEnterEvent(e)}mouseLeaveEvent(e){this._mouseOrTouchLeaveEvent(e)}touchEndEvent(e){this._mouseOrTouchLeaveEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}update(){}getElement(){return this._cell}onLabelHovered(){return this._onLabelHovered}setSizeAndOffset(e,t){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._cell.style.width=`${e.width}px`,this._cell.style.minWidth=`${e.width}px`,this._cell.style.height=`${e.height}px`,this._invalidated=!0),this._offset!==t&&(this._offset=t,this._cell.style.left=`${t}px`)}paint(e){
e{e.fillText(r.label,p.x/o,p.y/a+t)}))}else if(!i&&this._onActiveOrHoveredChart.value()){const t=this._gearRenderer.viewBox(),i=Math.round(p.x-t.width*o/2),r=Math.round(p.y-t.height*a/2);e.fillStyle=d.themes[s].getThemedColor("color-text-primary"),e.imageSmoothingQuality="high",this._gearRenderer.render(e,{targetViewBox:{x:i,y:r,width:t.width*o,
height:t.height*a},doNotApplyColors:!0})}}_vertBorderColor(){return this._properties.lineColor.value()}_horzBorderColor(){var e,t;return null!==(t=null===(e=this._timeAxisWidget)||void 0===e?void 0:e.lineColor())&&void 0!==t?t:this._vertBorderColor()}_tooltipContent(){return this._sourcesTitlesProvider().join("\n")}_mouseOrTouchEnterEvent(e){this._labelOptions.showLabels&&this._labelOptions.enableHighlight&&this._setHighlighted(!0)}_mouseOrTouchLeaveEvent(e){this._labelOptions.showLabels&&this._labelOptions.enableHighlight&&this._setHighlighted(!1)}_mouseClickOrTapEvent(e){if(e.preventDefault(),null!==this._fixedLabelMode||1===this._labelMode||!this._labelOptions.enableMenu||!this._labelOptions.showLabels)return void Ze.ContextMenuManager.hideAll();this._fixedLabelMode=this._labelMode,this.setLabelMode(0);const t=this._cell.getBoundingClientRect();Ze.ContextMenuManager.showMenu(this._contextMenuItemsProvider(),{clientX:this._isLeft?t.left:t.right,clientY:t.top,attachToXBy:this._isLeft?"left":"right",attachToYBy:"bottom"},{statName:"PriceScaleLabelContextMenu",doNotCloseOn:this.getElement()},{menuName:"PriceScaleLabelContextMenu"},(()=>{this.setLabelMode((0,n.ensureNotNull)(this._fixedLabelMode)),this._fixedLabelMode=null}))}}var rt=i(96152);class nt{constructor(e,t,i,r,n,o=null){this._axises=[],this._stubs=[],this._size=(0,s.size)({width:0,height:0}),this._onLabelHovered=new R.Delegate,this._scalesProperties=e,this._priceAxisWidgetFactory=i,this._timeAxisWidget=o,this._rendererOptionsProvider=r.rendererOptionsProvider,this._titlesProvider=r.titlesProvider,this._stubContextMenuProvider=r.stubContextMenuProvider,this._backgroundBasedTheme=r.backgroundBasedTheme,this._onActiveOrHoveredChart=r.onActiveOrHoveredChart,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._requestRepaint=r.requestRepaint,this._showHorisontalBorder=Boolean(r.showHorizontalBorder),this._labelsOptions={...tt,...n};const a=this._scalesProperties.childs();this._stubProperties={lineColor:a.lineColor,fontSize:a.fontSize},this._side=t,this._cell=document.createElement("div"),this._cell.classList.add("chart-markup-table","price-axis-container"),this._cell.style.width="25px",this._cell.style.position="relative"}destroy(){var e;this.setScales([],0,0,0),this._backgroundBasedTheme.release(),null===(e=this._onActiveOrHoveredChart)||void 0===e||e.release()}onLabelHovered(){return this._onLabelHovered}setScales(e,t,i,s){for(;e.length>this._axises.length&&this._axises.lengtho;){
const e=(0,n.ensureDefined)(this._stubs.pop());e.onLabelHovered().unsubscribeAll(this),this._cell.removeChild(e.getElement()),e.destroy()}for(;this._stubs.length{this._labelsOptions.showLabels&&this._labelsOptions.enableHighlight&&this._onLabelHovered.fire({owner:t,axis:(0,n.ensureNotNull)(e)},i)})),this._stubs.push(t),this._cell.appendChild(t.getElement())}const a=this._labelsOptions.enableMenu;1===s?this._stubs.forEach(((e,t)=>e.setLabelMode(a?0:1))):this._stubs.forEach(((e,t)=>e.setLabelMode(te.updateCurrencyLabel()))}optimalWidths(){return this._axises.map((e=>e.optimalWidth()))}setSizes(e,t){this._size=(0,s.size)({width:t.reduce(((e,t)=>e+t),0),height:e}),this._cell.style.width=this._size.width+"px",this._cell.style.minWidth=this._size.width+"px",this._cell.style.height=this._size.height+"px",t.length!==this._axises.length+this._stubs.length&&(0,n.assert)(t.length===this._axises.length+this._stubs.length,"Widgets count should be the same as widths one");let i=0;this._forEachWidgetFromLeft(((r,n)=>{const o=t[n];r.setSizeAndOffset((0,s.size)({width:o,height:e}),i),i+=o}))}update(){this._axises.forEach((e=>e.update())),this._stubs.forEach((e=>e.update()))}paint(e){this._axises.forEach(((t,i)=>t.paint(e(i)))),this._stubs.forEach(((t,i)=>t.paint(e(i))))}paintStubs(e){this._stubs.forEach((t=>t.paint(e)))}restoreDefaultCursor(){this._axises.forEach((e=>e.restoreDefaultCursor()))}getWidth(){return this._size.width}findAxisWidgetForScale(e){const t=this._axises.find((t=>t.priceScale()===e));return void 0===t?null:t}getScreenshotData(){const e=this._getImage();return{canvas:e,content:e.toDataURL(),contentHeight:this._size.height,contentWidth:this._size.width}}getImage(){return this._getImage()}slotsCount(){return this._axises.length+this._stubs.length}highlightPriceAxisByLabel(e){this._axises.forEach((t=>{const i=t.axisInfo();t.setHighlighted(null!==i&&i.equals(e))}))}axes(){return this._axises}_stubParams(e){var t;return{rendererOptionsProvider:this._rendererOptionsProvider,backgroundBasedTheme:this._backgroundBasedTheme.spawnOwnership(),onActiveOrHoveredChart:null===(t=this._onActiveOrHoveredChart)||void 0===t?void 0:t.spawnOwnership(),sourcesTitlesProvider:()=>this._titlesProvider(this._side,e),contextMenuItemsProvider:()=>this._stubContextMenuProvider(this._side,e),getBackgroundTopColor:this._getBackgroundTopColor,getBackgroundBottomColor:this._getBackgroundBottomColor,requestRepaint:this._requestRepaint,showHorizontalBorder:this._showHorisontalBorder}}_getImage(){const e=(0,z.createDisconnectedCanvas)(document,this._size),t=(0,z.getPrescaledContext2D)(e);let i=0;return this._forEachWidgetFromLeft(((e,s)=>{const r=e.getWidth()
;0!==r&&0!==this._size.height&&(t.drawImage(e.getImage(),i,0,r,this._size.height),i+=r)})),e}_forEachWidgetFromLeft(e){const t=[...this._axises,...this._stubs],i="left"===this._side,s=i?-1:t.length,r=i?-1:1;for(let n=i?t.length-1:0;n!==s;n+=r)e(t[n],n,t)}}var ot=i(55824),at=i(25313);class lt{constructor(){this._width=null,this._labelBottom=null,this._currencyInfo=null,this._unitInfo=null,this._measureUnitIdInfo=null,this._fontSize=0,this._currencyAndUnitLabelsWrapper=document.createElement("div"),this._currencyAndUnitLabelsWrapper.className=at["price-axis-currency-label-wrapper"],this._currencyAndUnitLabelsWrapper.setAttribute("data-name","currency-unit-label-wrapper"),this._controlsContainer=document.createElement("div"),this._controlsContainer.className=at["price-axis-currency-label"],this._currencyAndUnitLabelsWrapper.appendChild(this._controlsContainer),this._currencyLabelDiv=document.createElement("div"),this._currencyLabelDiv.className=at.row,this._currencyLabelDiv.classList.add("apply-common-tooltip"),(0,Xe.setTooltipData)(this._currencyLabelDiv,"text",(e=>this._currencyTooltipContent())),this._currencyText=document.createElement("div"),this._currencyText.className=at["price-axis-currency-label-text"],this._currencyLabelDiv.appendChild(this._currencyText),this._currencyArrowDown=document.createElement("div"),this._currencyArrowDown.className=at["price-axis-currency-label-arrow-down"],this._currencyArrowDown.innerHTML=ot,this._currencyLabelDiv.appendChild(this._currencyArrowDown),this._measureUnitIdLabelDiv=document.createElement("div"),this._measureUnitIdLabelDiv.className=at.row,this._measureUnitIdLabelDiv.classList.add("apply-common-tooltip"),this._measureUnitIdLabelDiv.classList.add("readonly"),(0,Xe.setTooltipData)(this._measureUnitIdLabelDiv,"text",(e=>this._measureUnitIdTooltipContent())),this._measureUnitIdText=document.createElement("div"),this._measureUnitIdText.className=at["price-axis-currency-label-text"],this._measureUnitIdLabelDiv.appendChild(this._measureUnitIdText),this._unitLabelDiv=document.createElement("div"),this._unitLabelDiv.className=at.row,this._unitLabelDiv.classList.add("apply-common-tooltip"),(0,Xe.setTooltipData)(this._unitLabelDiv,"text",(e=>this._unitTooltipContent())),this._unitText=document.createElement("div"),this._unitText.className=at["price-axis-currency-label-text"],this._unitLabelDiv.appendChild(this._unitText),this._unitArrowDown=document.createElement("div"),this._unitArrowDown.className=at["price-axis-currency-label-arrow-down"],this._unitArrowDown.innerHTML=ot,this._unitLabelDiv.appendChild(this._unitArrowDown),this._controlsContainer.appendChild(this._currencyLabelDiv),this._controlsContainer.appendChild(this._measureUnitIdLabelDiv),this._controlsContainer.appendChild(this._unitLabelDiv),this.disableCurrency(),this.disableUnit()}element(){return this._currencyAndUnitLabelsWrapper}currencyLabelElement(){return this._currencyLabelDiv}unitLabelElement(){return this._unitLabelDiv}isEnabled(){
return this.currencyLabelEnabled()||this.unitLabelEnabled()||this.measureUnitIdLableEnabled()}isHidden(){return this._currencyAndUnitLabelsWrapper.classList.contains(at.hidden)}setCurrencyExpanded(e){this._currencyLabelDiv.classList.toggle(at.expanded,e)}setUnitExpanded(e){this._unitLabelDiv.classList.toggle(at.expanded,e)}width(){if(null!==this._width)return this._width;let e=0;if(this.currencyLabelEnabled()){const t=this._currencyText.getBoundingClientRect(),i=this._currencyArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}if(this.measureUnitIdLableEnabled()){const t=this._measureUnitIdText.getBoundingClientRect();e=Math.max(e,t.width+2*this._textMarginAndPadding())}if(this.unitLabelEnabled()){const t=this._unitText.getBoundingClientRect(),i=this._unitArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}return this._width=e}drawLabel(e,t,i){var s,r,n;if(!this.isEnabled())return;const o=Math.round(Number(at.css_wrapper_margin)*i),a=(0,Le.ceiledEven)(t*i)-2*o,l=Math.round(this.labelBottom()*i),c=l-2*o,h=Math.round(Number(at.css_value_currency_label_radius)*i);e.fillStyle=getComputedStyle(this._currencyAndUnitLabelsWrapper).backgroundColor,e.fillRect(0,0,Math.ceil(t*i),l);const d=[];d.push(this.currencyLabelEnabled()&&null!==(s=this._currencyText.textContent)&&void 0!==s?s:""),d.push(this.measureUnitIdLableEnabled()&&null!==(r=this._measureUnitIdText.textContent)&&void 0!==r?r:""),d.push(this.unitLabelEnabled()&&null!==(n=this._unitText.textContent)&&void 0!==n?n:""),e.font=(0,$e.makeFont)(this._fontSize,Je.CHART_FONT_FAMILY);const u=new Ye.TextWidthCache;let p=0;const _=[];d.forEach((t=>{let i=0;""!==t&&(i=u.yMidCorrection(e,t),p++),_.push(i)}));const m=c/p;e.beginPath();const g=getComputedStyle(this._controlsContainer);e.fillStyle=g.backgroundColor,e.strokeStyle=g.borderColor,(0,qe.drawRoundRect)(e,o,o,a,c,h),e.fill(),e.stroke(),e.fillStyle=getComputedStyle(this._currencyLabelDiv).color,e.textBaseline="middle",e.textAlign="left";const f=Math.round(this._textMarginAndPadding()*i)+o,v=m/2;let y=o+v;d.forEach(((t,s)=>{""!==t&&((0,z.drawScaled)(e,i,i,(()=>{e.fillText(t,f/i,(y+_[s])/i)})),y=Math.ceil(y+2*v))}))}setHidden(e){this._currencyAndUnitLabelsWrapper.classList.toggle(at.hidden,e)}enableCurrency(){this._currencyLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableCurrency(){this._currencyLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}enableUnit(){this._unitLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableUnit(){this._unitLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}enableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}currencyLabelEnabled(){return!this._currencyLabelDiv.classList.contains("js-hidden")}unitLabelEnabled(){
return!this._unitLabelDiv.classList.contains("js-hidden")}measureUnitIdLableEnabled(){return!this._measureUnitIdLabelDiv.classList.contains("js-hidden")}currencyConversionAvailable(){return!this._currencyLabelDiv.classList.contains("readonly")}unitConversionAvailable(){return!this._unitLabelDiv.classList.contains("readonly")}setCurrencyInfo(e){if(this._currencyInfo===e)return!1;this._currencyInfo=e;const t=null===e.selectedCurrency?a.t(null,void 0,i(54215)):(0,n.ensureDefined)(e.displayedValues.get(e.selectedCurrency));return this._currencyText.textContent!==t&&(this._currencyText.textContent=t,this._width=null),this._currencyArrowDown.classList.contains("js-hidden")!==e.readOnly&&(this._currencyArrowDown.classList.toggle("js-hidden",e.readOnly),this._currencyLabelDiv.classList.toggle("readonly",e.readOnly),this._width=null),!0}setUnitInfo(e){if(null!==this._unitInfo&&this._unitInfo.selectedUnit===e.selectedUnit&&0===this._unitInfo.availableGroups.size==(0===e.availableGroups.size)&&this._unitInfo.originalUnits.size===e.originalUnits.size)return this._unitInfo=e,!1;this._unitInfo=e;const t=null===e.selectedUnit?a.t(null,void 0,i(54215)):(0,n.ensureDefined)(e.names.get(e.selectedUnit));return this._unitText.textContent!==t&&(this._unitText.textContent=t,this._width=null),this._unitArrowDown.classList.contains("js-hidden")!==(0===e.availableGroups.size)&&(this._unitArrowDown.classList.toggle("js-hidden",0===e.availableGroups.size),this._unitLabelDiv.classList.toggle("readonly",0===e.availableGroups.size),this._width=null),!0}setMeasureUnitIdInfo(e){if(this._measureUnitIdInfo===e)return!1;this._measureUnitIdInfo=e;const t=null===e.selectedMeasureUnitId?a.t(null,void 0,i(54215)):(0,n.ensureDefined)(e.names.get(e.selectedMeasureUnitId));return this._measureUnitIdText.textContent!==t&&(this._measureUnitIdText.textContent=t,this._width=null),this._measureUnitIdLabelDiv.classList.contains("js-hidden")!==(0===e.names.size)&&(this._measureUnitIdLabelDiv.classList.toggle("js-hidden",0===e.names.size),this._width=null),!0}currencyInfo(){return this._currencyInfo}unitInfo(){return this._unitInfo}measureUnitIdInfo(){return this._measureUnitIdInfo}setFontSize(e){this._fontSize!==e&&(this._fontSize=e,this._currencyLabelDiv.style.fontSize=e+"px",this._measureUnitIdLabelDiv.style.fontSize=e+"px",this._unitLabelDiv.style.fontSize=e+"px",this._width=null,this._labelBottom=null)}labelBottom(){if(null!==this._labelBottom)return this._labelBottom;const e=this._controlsContainer.getBoundingClientRect(),t=this._currencyAndUnitLabelsWrapper.getBoundingClientRect(),i=e.y-t.y;return this._labelBottom=e.height+2*i}_resetSizesAndVisibility(){this._width=null,this._labelBottom=null,this._updateVisibility()}_textMarginAndPadding(){return Number(at.css_wrapper_margin)+Number(at.css_row_left_right_padding)+2}_currencyTooltipContent(){const e=this._currencyInfo;return null===e?"":null===e.selectedCurrency?Array.from(e.currencies).map((t=>(0,
n.ensureDefined)(e.displayedValues.get(t)))).join(", "):e.readOnly?a.t(null,void 0,i(43931)):a.t(null,void 0,i(48566))}_unitTooltipContent(){const e=this._unitInfo;return null===e?"":null===e.selectedUnit?Array.from(e.units).map((t=>(0,n.ensureDefined)(e.names.get(t)))).join(", "):0===e.availableGroups.size?a.t(null,void 0,i(40012)):a.t(null,void 0,i(85110))}_measureUnitIdTooltipContent(){const e=this._measureUnitIdInfo;return null===e?"":null===e.selectedMeasureUnitId?Array.from(e.measureUnitIds).map((t=>(0,n.ensureDefined)(e.names.get(t)))).join(", "):e.descriptions.get(e.selectedMeasureUnitId)||""}_updateVisibility(){const e=this.isEnabled();this._currencyAndUnitLabelsWrapper.classList.toggle("js-hidden",!e)}}async function ct(e,t,s,r,n,o){const{UnitConversionRenderer:a}=await Promise.all([i.e(9093),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(2248),i.e(3114),i.e(4632),i.e(3762),i.e(5458),i.e(8775),i.e(2227),i.e(361),i.e(2704)]).then(i.bind(i,41153));return new a(e,s,t,r,n,o)}var ht=i(97702);class dt{constructor(e){const{action:t,property:i,undoModel:s,undoText:r,callback:n=null}=e;this._property=i,this._undoModel=s,this._undoText=r,this._action=t,this.setValue(i.value()),i.subscribe(this,this._propertyChanged),null!==n?t.update({onExecute:n.bind(this)}):t.update({onExecute:this._onActionCallback.bind(this)})}destroy(){this._property.unsubscribe(this,this._propertyChanged)}value(){return this._action.isChecked()}setValue(e){this._action.update({checked:Boolean(e)})}_onActionCallback(){this._undoModel.setProperty(this._property,this.value(),this._undoText)}_propertyChanged(e){this.setValue(e.value())}}class ut extends ht.Action{constructor(e,t){super(e),this._binding=new dt({action:this,...t})}destroy(){this._binding.destroy(),super.destroy()}}var pt=i(68335),_t=i(73866),mt=i(51330),gt=i(50788),ft=i(92158),vt=i(97754),yt=i.n(vt),St=i(64176);class bt{constructor({setMode:e,className:t=""}){const s=this._wrapper=document.createElement("div");s.classList.add(t),s.addEventListener("dblclick",this._stopPropagation,{capture:!0}),s.addEventListener("touchstart",this._stopPropagation,{capture:!0});const r=s.appendChild(document.createElement("div"));r.className=St.priceScaleModeButtons;const[n,o]=this._createButton({title:a.t(null,{context:'The first letter of the "auto" word'},i(94073)),tooltip:a.t(null,void 0,i(24157)),onClick:()=>e("auto"),ariaLabel:a.t(null,void 0,i(94465))});this._autoScaleButton=o,r.appendChild(n);const[l,c]=this._createButton({title:a.t(null,{context:'The first letter of the "logarithmic" word'},i(66384)),tooltip:a.t(null,void 0,i(16170)),onClick:()=>e("log"),ariaLabel:a.t(null,void 0,i(46992))});this._logarithmButton=c,r.appendChild(l)}destroy(){this._wrapper.removeEventListener("dblclick",this._stopPropagation),this._wrapper.removeEventListener("touchstart",this._stopPropagation),this._wrapper.remove()}element(){return this._wrapper}width(){return 52}updateMode(e){const{log:t,autoScale:i}=e
;this._logarithmButton.classList.toggle(St.priceScaleModeButtons__button_activated,!!t),this._autoScaleButton.classList.toggle(St.priceScaleModeButtons__button_activated,!!i)}_createButton(e){const{ariaLabel:t,title:i,tooltip:s,onClick:r,className:n}=e,o=document.createElement("div");o.className=St.priceScaleModeButtons__buttonWrapper;const a=document.createElement("button");a.className=yt()(St.priceScaleModeButtons__button,n,"apply-common-tooltip"),a.textContent=i,a.dataset.tooltip=s;let l=a;return c.CheckMobile.any()&&(l=o),l.addEventListener("click",r),t&&l.setAttribute("aria-label",t),o.appendChild(a),[o,a]}_stopPropagation(e){e.stopPropagation()}}var wt=i(81199);i(11710);const Ct=new W.TranslatedString("change no overlapping labels",a.t(null,void 0,i(61557))),Pt=new W.TranslatedString("toggle auto scale",a.t(null,void 0,i(42240))),xt=new W.TranslatedString("toggle log scale",a.t(null,void 0,i(49403))),Tt=a.t(null,void 0,i(88314)),It=a.t(null,void 0,i(5119)),Mt=a.t(null,void 0,i(59396)),At=a.t(null,void 0,i(15432)),Lt=a.t(null,void 0,i(15332)),kt=a.t(null,void 0,i(24157)),Dt=a.t(null,{context:"scale_menu"},i(34954)),Et=a.t(null,{context:"scale_menu"},i(35210)),Vt=a.t(null,{context:"scale_menu"},i(31340)),Bt=a.t(null,{context:"scale_menu"},i(55300)),Rt=a.t(null,{context:"scale_menu"},i(19405)),Nt=a.t(null,{context:"scale_menu"},i(75163));const Ot=function(e){const t=new _t.LimitedPrecisionNumericFormatter(e);return(e,i)=>(0,P.isNumber)(i)&&!e.isLog()?t.format(i):""}(4),Ft=N.enabled("currency_menu_disabled"),Wt=N.enabled("unit_menu_disabled"),Ht={contextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,contextMenu:{general:!0,source:!0},pressedMouseMoveScale:!0,mouseWheelScale:!0,pinchScale:!0,croppedTickMarks:!0};var zt,Ut,jt;!function(e){e[e.LabelOffset=4]="LabelOffset",e[e.DefaultOptimalWidth=34]="DefaultOptimalWidth",e[e.WheelScaleCoeff=15]="WheelScaleCoeff"}(zt||(zt={})),function(e){e[e.Back=0]="Back",e[e.Top=1]="Top",e[e.All=2]="All"}(Ut||(Ut={}));class Gt{constructor(e,t,i,r,n,o,a,l,c){this._actions=null,this._priceScale=null,this._scaleModeButtons=null,this._widthCache=new Ye.TextWidthCache(1e3),this._color=null,this._fontSize=null,this._currencyFontSize=0,this._currencyLabelWidth=null,this._isVisible=!0,this._currencyMenu=null,this._unitMenu=null,this._size=(0,s.size)({width:0,height:0}),this._currentCursorClassName="",this._destroyed=!1,this._highlighted=!1,this._highlightColorCache=null,this._mouseWheelHelper=null,this._dragScaleActive=!1,this._offset=NaN,this._pinching=!1,this._lastHittestResult=null,this._isHovered=new H.WatchedValue(!1),this._recalcCurrencyAndUnitVisibility=()=>{if(null===this._currencyLabel)return;let e=!0;switch((0,gt.actualCurrencyUnitVisibility)().value()){case"alwaysOff":e=!1;break;case"visibleOnMouseOver":const t=this._chart.anyPriceAxisHovered().value(),i=null!==this._currencyMenu&&this._currencyMenu.isOpened(),s=null!==this._unitMenu&&this._unitMenu.isOpened();e=t||i||s}this._currencyLabel.setHidden(!e)},
this._handleactualAutoLogButtonsVisibility=e=>{const t=e.value();"alwaysOff"===t?this._scaleModeButtons&&this._destroyScaleModeButtons():(this._scaleModeButtons||this._createScaleModeButtons(),"alwaysOn"===t?(this._isHovered.unsubscribe(this._updatePriceScaleModeButtonsVisibility),this._updatePriceScaleModeButtonsVisibility(!0)):this._isHovered.subscribe(this._updatePriceScaleModeButtonsVisibility,{callWithLast:!0}))},this._updatePriceScaleModeButtonsVisibility=e=>{var t;null===(t=this._scaleModeButtons)||void 0===t||t.element().classList.toggle("price-axis__modeButtons_hidden",!e)},this._updateScaleModeButtons=()=>{var e;this._priceScale&&(null===(e=this._scaleModeButtons)||void 0===e||e.updateMode(this._priceScale.mode()))},this._chart=e,this._pane=t,this._undoModel=i,this._properties=r,this._isLeft="left"===o,this._options=(0,P.merge)((0,P.clone)(Ht),a),this._rendererOptionsProvider=n,this._backgroundBasedTheme=c,this._cell=document.createElement("div"),this._cell.className="price-axis",this._cell.style.width="25px",this._cell.style.left="0",this._canvasConfiguredHandler=()=>{this._undoModel.model().lightUpdate()},this._canvasBinding=(0,z.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._canvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this._topCanvasBinding=(0,z.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const d=this._topCanvasBinding.canvasElement;d.style.position="absolute",d.style.zIndex="2",d.style.left="0",d.style.top="0",this._cell.setAttribute("aria-hidden","true"),this._mouseEventHandler=new ke.MouseEventHandler(this._cell,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._options.currencyConversionEnabled||this._options.unitConversionEnabled?(this._currencyLabel=new lt,this._cell.appendChild(this._currencyLabel.element())):this._currencyLabel=null,this._properties.childs().fontSize.subscribe(this,this._onFontSizeChanged),this._options.mouseWheelScale&&(this._mouseWheelHelper=new Ie,this._cell.addEventListener("wheel",this._onMousewheel.bind(this),{passive:!1})),this._axisInfo=l,this._offset=0,this.restoreDefaultCursor(),(0,gt.actualCurrencyUnitVisibility)().subscribe(this,this._recalcCurrencyAndUnitVisibility),(0,ft.actualAutoLogButtonsVisibility)().subscribe(this,this._handleactualAutoLogButtonsVisibility),this._handleactualAutoLogButtonsVisibility((0,ft.actualAutoLogButtonsVisibility)()),this._chart.anyPriceAxisHovered().subscribe(this._recalcCurrencyAndUnitVisibility,{callWithLast:!0}),this.update()}getContextMenuActions(e){var t;this._initActions();const i=(0,n.ensureNotNull)(this._actions),s=this._chart.actions(),r=[];return(null===(t=this._priceScale)||void 0===t?void 0:t.resetScaleAvailable().value())&&r.push(i.reset,new ht.Separator),r.push(this._autoScaleAction()),
this._isMainSeriesAxis()&&r.push(this._lockScaleAction()),r.push(s.scaleSeriesOnly,this._invertAction(),new ht.Separator,this._regularScaleAction(),this._percentageAction(),this._indexedTo100Action(),this._logAction(),new ht.Separator),c.CheckMobile.any()||(r.push(this._createMergeScalesAction()),r.push(new ht.Separator)),N.enabled("fundamental_widget")||r.push(new ht.Action({actionId:"Chart.PriceScale.Labels",options:{label:It,subItems:[s.showSymbolLabelsAction,s.showSeriesLastValue,null,null,s.showHighLowPriceLabels,N.enabled("show_average_close_price_line_and_label")?s.showAverageClosePriceLabel:null,null,s.showStudyPlotNamesAction,s.showStudyLastValue,i.alignLabels].filter(Boolean)}})),r.push((0,mt.createLinesAction)(this._chart)),this._options.countdownEnabled&&r.push(s.showCountdown),this._undoModel.crossHairSource().isMenuEnabled()&&r.push(s.addPlusButton),e&&!this._chart.onWidget()&&N.enabled("show_chart_property_page")&&N.enabled("chart_property_page_scales")&&s.scalesProperties&&r.push(new ht.Separator,s.scalesProperties),r}getElement(){return this._cell}onOptimalWidthNeedToBeRecalculated(e){(this._size.width1e-14){const o=r.formatPrice(Math.floor(Math.min(e,i))+.11111111111111,n),a=r.formatPrice(Math.ceil(Math.max(e,i))-.11111111111111,n);s=Math.max(s,this._widthCache.measureText(t,o),this._widthCache.measureText(t,a))}}}let o=0;this._isCurrencyLabelEnabled()&&(null===this._currencyLabelWidth&&(this._currencyLabelWidth=(0,n.ensureNotNull)(this._currencyLabel).width()),o=Math.round(this._currencyLabelWidth));const a=s||34;let l=Math.max(o,null!==(i=null===(t=this._scaleModeButtons)||void 0===t?void 0:t.width())&&void 0!==i?i:0,Math.ceil(r.borderSize+r.additionalPaddingInner+r.paddingInner+r.paddingOuter+a+4));return l+=l%2,l}setSizeAndOffset(e,t){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._cell.style.width=e.width+"px",this._cell.style.height=e.height+"px",this._cell.style.minWidth=e.width+"px"),this._offset!==t&&(this._offset=t,this._cell.style.left=t+"px")}getWidth(){return this._size.width}getImage(){const e=this._size,t=(0,
z.createDisconnectedCanvas)(document,e);return(0,z.getPrescaledContext2D)(t).drawImage(this._canvasBinding.canvasElement,0,0,e.width,e.height),null===this._currencyLabel||this._currencyLabel.isHidden()||this._currencyLabel.drawLabel((0,z.getContext2D)(t),e.width,(0,fe.getCanvasDevicePixelRatio)(t)),t}update(){null!==this._priceScale&&(this._priceScale.marks(),this._updateCurrencyLabelFont(),this.rendererOptions())}paint(e){if(!this._isVisible||0===this._size.width||0===this._size.height)return;if(e===ve.InvalidationLevel.None)return;const t=this._pane.state(),i=!t.maximized().value()&&t.collapsed().value(),s=this._pane.hasState();(0,z.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,z.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const r=this._groupedSources(),o=null!==this._currencyLabel&&!this._currencyLabel.isHidden(),a=(e,t,i)=>{if(o){e.save(),e.beginPath();const i=(0,n.ensureNotNull)(this._currencyLabel).labelBottom();e.rect(0,i*t.verticalPixelRatio,t.bitmapSize.width,t.bitmapSize.height),e.clip()}i(),o&&e.restore()};if(e>ve.InvalidationLevel.Cursor){const e=(0,z.getContext2D)(this._canvasBinding.canvasElement),t=(0,z.getBindingRenderingInfo)(this._canvasBinding);i||this._alignLabels(),s&&this.updateCurrencyLabel(),this._drawBackground(e,t),a(e,t,(()=>{this._drawDrawingsHighlight(e,t)})),this._drawBorder(e,t),s&&(this._scaleModeButtons&&(this._scaleModeButtons.element().style.background=this._highlighted?this._highlightColor():this.backgroundColor()),i||a(e,t,(()=>{this._drawTickMarks(e,t),this._drawLabels(this._views(0,r),e,t)})))}if(s&&!i){const e=(0,z.getContext2D)(this._topCanvasBinding.canvasElement),t=(0,z.getBindingRenderingInfo)(this._topCanvasBinding);e.clearRect(0,0,t.bitmapSize.width,t.bitmapSize.height),a(e,t,(()=>{this._drawLabels(this._views(1,r),e,t),this._drawCrossHairLabel(e,t)}))}}restoreDefaultCursor(){this._setCursor("")}priceScale(){return(0,n.ensureNotNull)(this._priceScale)}setPriceScale(e){this._priceScale!==e&&(null!==this._priceScale&&(this._priceScale.onMarksChanged().unsubscribe(this,this.onOptimalWidthNeedToBeRecalculated),this._priceScale.modeChanged().unsubscribeAll(this)),this._priceScale=e,null!==e&&(e.onMarksChanged().subscribe(this,this.onOptimalWidthNeedToBeRecalculated),e.modeChanged().subscribe(this,(()=>this.onOptimalWidthNeedToBeRecalculated(!0))),this.onOptimalWidthNeedToBeRecalculated(),this._scaleModeButtons&&(e.modeChanged().subscribe(this,this._updateScaleModeButtons),this._updateScaleModeButtons())))}isVisible(){return this._isVisible}setVisible(e){(e=!!e)!==this._isVisible&&(this._cell.style.display=e?"table-cell":"none",this._isVisible=e)}destroy(){null!==this._currencyMenu&&(this._currencyMenu.close(),this._currencyMenu=null),null!==this._unitMenu&&(this._unitMenu.close(),this._unitMenu=null),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),
null!==this._priceScale&&(this._priceScale.onMarksChanged().unsubscribe(this,this.onOptimalWidthNeedToBeRecalculated),this._priceScale.modeChanged().unsubscribeAll(this)),this._priceScale=null,this._mouseEventHandler.destroy(),this._properties.childs().fontSize.unsubscribe(this,this._onFontSizeChanged),null!==this._actions&&(Object.values(this._actions).forEach((e=>{e.destroy()})),this._actions=null),(0,gt.actualCurrencyUnitVisibility)().unsubscribeAll(this),this._chart.anyPriceAxisHovered().unsubscribe(this._recalcCurrencyAndUnitVisibility),(0,ft.actualAutoLogButtonsVisibility)().unsubscribeAll(this),this._chart.setPriceAxisHovered(this,!1),this._destroyScaleModeButtons(),this._destroyed=!0}axisInfo(){return this._axisInfo}setHighlighted(e){this._highlighted=e}backgroundColor(){return this._pane.state().model().backgroundColor().value()}backgroundTopColor(){return this._pane.state().model().backgroundTopColor().value()}lineColor(){return this._properties.childs().lineColor.value()}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,$e.makeFont)(this.fontSize(),Je.CHART_FONT_FAMILY,"")}rendererOptions(){let e=this._rendererOptionsProvider.options();return this._color===e.color&&this._fontSize===e.fontSize||(this._color=e.color),this._fontSize!==e.fontSize&&(this._widthCache.reset(),this._fontSize=e.fontSize,this._currencyLabelWidth=null,this._currencyFontSize=0,this._updateCurrencyLabelFont(),this.onOptimalWidthNeedToBeRecalculated()),e}mouseEnterEvent(e){this._chart.setPriceAxisHovered(this,!0),this._isHovered.setValue(!0),this._applyLightUpdateIfRequired(),this._mouseEnterOrTouchStartEvent(e)}mouseMoveEvent(e){this._mouseOrTouchMoveEvent(e)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseOrTouchMoveEvent(e),this._mouseEnterOrTouchStartEvent(e),this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}pinchStartEvent(e,t,i,s){return s.bothPointsOnTargetElement}pinchEvent(e,t,i){if(this._zoomAvailable()&&this._options.pinchScale){if(this._dragScaleActive&&this._finishScale(),!this._pinching)return this._pinching=!0,void this._undoModel.startTwoPointsScalePrice(this._pane.state(),this.priceScale(),t.y,i.y);this._undoModel.twoPointsScalePriceTo(this._pane.state(),this.priceScale(),t.y,i.y)}}pinchEndEvent(){this._pinching=!1,this._undoModel.endTwoPointsScalePrice(this._pane.state(),this.priceScale())}mouseDownOutsideEvent(){this._finishScale()}touchStartOutsideEvent(){this._finishScale()}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseLeaveOrTouchEndEvent(e),this._mouseUpOrTouchEndEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}mouseLeaveEvent(e){this._chart.setPriceAxisHovered(this,!1),this._isHovered.setValue(!1),this._applyLightUpdateIfRequired(),this._mouseLeaveOrTouchEndEvent(e)}mouseDoubleClickEvent(e){
this._mouseDoubleClickOrDoubleTapEvent(e)}doubleTapEvent(e){this._mouseDoubleClickOrDoubleTapEvent(e)}contextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}touchContextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}dataSourceAtPoint(e,t){const i=this._pane.state();if(!i.maximized().value()&&i.collapsed().value())return null;const s=this._groupedSources(),r=[...s.sources,...s.topLevelSources,...i.customSources(),...i.sourcesByGroup().multipaneSources()];let n=null,o=null;if(!this._priceScale)return null;const a=(e,t)=>{var i;const s=null!==(i=null==o?void 0:o.target())&&void 0!==i?i:0;e.target()>s&&(o=e,n=t)},l=new Oe.Point(e,t),c=(0,z.getBindingRenderingInfo)(this._canvasBinding);for(let e=r.length-1;e>=0;--e){const t=r[e],s=t.priceAxisViews(i,this._priceScale);if(s&&0!==s.length)for(let e=s.length-1;e>=0;--e){const i=s[e].renderer();if(void 0!==i.hitTest){const e=i.hitTest(l,c,this._isLeft?"left":"right");null!==e&&a(e,t)}}}return this._lastHittestResult=o,n}reset(){const e=this._pane.state(),t=this.priceScale();this._undoModel.resetPriceScale(e,t),this.onOptimalWidthNeedToBeRecalculated(!0)}updateCurrencyLabel(){if(null===this._currencyLabel)return;let e=!1;if(this._options.currencyConversionEnabled){const t=this.priceScale().currency(this._undoModel.model().availableCurrencies());null===t||"alwaysOff"===(0,gt.actualCurrencyUnitVisibility)().value()?(e=this._currencyLabel.currencyLabelEnabled(),this._currencyLabel.disableCurrency()):(e=!this._currencyLabel.currencyLabelEnabled(),this._currencyLabel.enableCurrency(),e=this._currencyLabel.setCurrencyInfo(t)||e)}else this._currencyLabel.disableCurrency();if(this._options.unitConversionEnabled){const t="alwaysOff"===(0,gt.actualCurrencyUnitVisibility)().value(),i=this._undoModel.model().availableUnits(),s=this.priceScale().unit(i);null===s||t?(e=e||this._currencyLabel.unitLabelEnabled(),this._currencyLabel.disableUnit()):(e=e||!this._currencyLabel.unitLabelEnabled(),this._currencyLabel.enableUnit(),e=this._currencyLabel.setUnitInfo(s)||e);const r=this.priceScale().measureUnitId(i);null===r||t?(e=e||this._currencyLabel.measureUnitIdLableEnabled(),this._currencyLabel.disableMeasureUnitId()):(e=e||!this._currencyLabel.measureUnitIdLableEnabled(),this._currencyLabel.enableMeasureUnitId(),e=this._currencyLabel.setMeasureUnitIdInfo(r)||e)}else this._currencyLabel.disableUnit(),this._currencyLabel.disableMeasureUnitId();this._updateCurrencyLabelFont(),e&&(this._currencyLabelWidth=null)}_groupedSources(){var e;const t=this._pane.state(),i=t.model(),s=this._pane.state().sourcesByGroup(),r=this._isLeft?s.leftPriceScalesSources():s.rightPriceScalesSources(),n=this._priceScale===t.defaultPriceScale(),o=new Set(t.customSources()),a=e=>!!o.has(e)||(e.priceScale()===this._priceScale||n&&t.isOverlay(e)),l={sources:[...r.filter(a),...t.customSources()],topLevelSources:new Set};if(n){const e=this._pane.state().dataSources();for(const i of e)t.isOverlay(i)&&l.sources.push(i)}const c=null!==(e=i.lineBeingEdited())&&void 0!==e?e:i.lineBeingCreated()
;c&&a(c)&&(l.topLevelSources.add(c),l.lineBeingEditedOrCreated=c);const h=i.customSourceBeingMoved();h&&a(h)&&(l.topLevelSources.add(h),l.customSourceBeingMoved=h);const d=i.sourcesBeingMoved().filter(a);d.length>0&&(i.sourcesBeingMoved().forEach((e=>l.topLevelSources.add(e))),l.sourcesBeingMoved=d);const u=i.selection().allSources().filter(a);u.length>0&&(u.forEach((e=>l.topLevelSources.add(e))),l.selectedSources=u);const p=i.hoveredSource();return p&&a(p)&&(l.topLevelSources.add(p),l.hoveredSource=p),l}_isCurrencyLabelEnabled(){return null!==this._currencyLabel&&this._currencyLabel.isEnabled()}_updateCurrencyLabelFont(){if(null===this._currencyLabel)return;const e=this.fontSize();e!==this._currencyFontSize&&(this._currencyLabel.setFontSize(e),this._currencyFontSize=e,this._currencyLabelWidth=null,this.onOptimalWidthNeedToBeRecalculated())}_alignLabels(){var e,t,i,s,r;const n=this._size.height;let o=n/2;const a=[],l=this.priceScale(),c=l.orderedSources().slice(),h=this._pane.state(),d=this.rendererOptions();if(l===h.defaultPriceScale()){const e=h.priceDataSources();for(let t=0;t{if(e.ignoreAlignment()||!e.isVisible())return!1;const{total:t}=e.topBottomTotalHeight(d),i=e.floatCoordinate();return i>-t&&ie.floatCoordinate()<=o)),m=a.filter((e=>e.floatCoordinate()>o));_.sort(((e,t)=>t.floatCoordinate()-e.floatCoordinate())),_.length>0&&m.length>0&&m.push(_[0]),m.sort(((e,t)=>e.floatCoordinate()-t.floatCoordinate()));for(const e of a)e.setFixedCoordinate(e.coordinate());if(l.properties().childs().alignLabels.value()){if(m.length>0||_.length>0){{const e=null!==(s=_[0])&&void 0!==s?s:m[0],t=e.getFixedCoordinate(),{top:i,bottom:r,total:o}=e.topBottomTotalHeight(d);o0&&e.setFixedCoordinate(i)}{const e=null!==(r=m[0])&&void 0!==r?r:_[0],t=e.getFixedCoordinate(),{top:i,bottom:s,total:o}=e.topBottomTotalHeight(d);on&&e.setFixedCoordinate(n-s)}}for(let e=1;e<_.length;e++){const t=_[e],i=_[e-1],{top:s,bottom:r,total:n}=t.topBottomTotalHeight(d),o=t.getFixedCoordinate(),a=i.getFixedCoordinate();if(o>a-n)t.setFixedCoordinate(a-n);else if(a>0&&o-s<0&&o+r>0){const{top:e}=i.topBottomTotalHeight(d);t.setFixedCoordinate(Math.min(a-e-r,s))}}for(let e=1;en&&t.setFixedCoordinate(Math.max(a+s+e,n-i))}}}}_drawTickMarks(e,t){const i=this.priceScale().marks();e.save(),e.font=this.baseFont()
;const s=this.rendererOptions(),{horizontalPixelRatio:r,verticalPixelRatio:o}=t,a=this._isLeft?Math.floor((this._size.width-s.additionalPaddingInner)*r):0,l=this._isLeft?Math.round(a-s.paddingInner*r):Math.round(a+(s.additionalPaddingInner+s.paddingInner)*r),c=this.fontSize(),h=this._isCurrencyLabelEnabled()?(0,n.ensureNotNull)(this._currencyLabel).labelBottom():0,d=i.map((t=>{if(this._options.croppedTickMarks)return{visible:!0,yCorrection:this._widthCache.yMidCorrection(e,t.label)};const i=t.coord-c/2,s=t.coord+c/2,r=!(s>this._size.height||ithis._size.height||i{for(let t=i.length;t--;){if(!d[t].visible)continue;const s=i[t];e.fillText(s.label,l/r,s.coord+d[t].yCorrection)}})),e.restore()}async _showCurrenciesContextMenu(){var e;if(null!==this._currencyMenu&&this._currencyMenu.isOpened())return void this._currencyMenu.close();(0,u.trackEvent)("GUI","Currency conversion");const{currencyActions:t}=await Promise.all([i.e(9093),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(2248),i.e(3114),i.e(4632),i.e(3762),i.e(5458),i.e(8775),i.e(2227),i.e(361),i.e(2704)]).then(i.bind(i,75556)),s=await ct(Mt,(()=>t(this._undoModel,(0,n.ensureNotNull)(this._currencyLabel).currencyInfo(),this.priceScale())),(0,n.ensureNotNull)(this._currencyLabel).currencyLabelElement(),Ft,(()=>["toggle_currency_menu_inner",this._undoModel.model().id(),this._pane.state().id(),this.priceScale().id()]),(()=>{var e;this._recalcCurrencyAndUnitVisibility(),null===(e=this._currencyLabel)||void 0===e||e.setCurrencyExpanded(!1)}));null===(e=this._currencyLabel)||void 0===e||e.setCurrencyExpanded(!0),this._destroyed?s.close():this._currencyMenu=s}async _showUnitsContextMenu(){var e;if(null!==this._unitMenu&&this._unitMenu.isOpened())return void this._unitMenu.close();(0,u.trackEvent)("GUI","Unit conversion");const{unitActions:t}=await Promise.all([i.e(9093),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(2248),i.e(3114),i.e(4632),i.e(3762),i.e(5458),i.e(8775),i.e(2227),i.e(361),i.e(2704)]).then(i.bind(i,59363)),s=await ct(At,(()=>t(this._undoModel,(0,n.ensureNotNull)(this._currencyLabel).unitInfo(),this.priceScale())),(0,n.ensureNotNull)(this._currencyLabel).unitLabelElement(),Wt,(()=>["toggle_unit_menu_inner",this._undoModel.model().id(),this._pane.state().id(),this.priceScale().id()]),(()=>{var e;this._recalcCurrencyAndUnitVisibility(),null===(e=this._currencyLabel)||void 0===e||e.setUnitExpanded(!1)}));null===(e=this._currencyLabel)||void 0===e||e.setUnitExpanded(!0),this._destroyed?s.close():this._unitMenu=s}_onFontSizeChanged(){this._currencyLabelWidth=null,this._currencyFontSize=0,this._updateCurrencyLabelFont(),this.onOptimalWidthNeedToBeRecalculated()}_mouseOrTouchMoveEvent(e){var t,i,s,r;if(!this._priceScale)return
;if(e.localX<0||e.localY<0||e.localX>=this._size.width||e.localY>=this._size.height)return;let n=!0;const o=this.dataSourceAtPoint(e.localX,e.localY);o?(this._setCursorClassName("pointer"),(null===(i=null===(t=this._lastHittestResult)||void 0===t?void 0:t.data())||void 0===i?void 0:i.hoverModelFromAxis)&&(this._undoModel.model().setHoveredSource(o,null!==(r=null===(s=this._lastHittestResult)||void 0===s?void 0:s.data())&&void 0!==r?r:null,0),n=!1)):this._setResizeCursor(),n&&this._undoModel.model().setHoveredSource(null,null)}_mouseDownOrTouchStartEvent(e){this._zoomAvailable()&&this._options.pressedMouseMoveScale&&!this._pinching&&(this._dragScaleActive=!0,this._undoModel.startScalePrice(this._pane.state(),this.priceScale(),e.localY))}_mouseEnterOrTouchStartEvent(e){this._setResizeCursor()}_pressedMouseOrTouchMoveEvent(e){if(this._dragScaleActive){const t=this.priceScale();this._undoModel.scalePriceTo(this._pane.state(),t,e.localY)}}_mouseUpOrTouchEndEvent(e){this._finishScale()}_finishScale(){this._dragScaleActive&&(this._undoModel.endScalePrice(this._pane.state(),this.priceScale()),this.restoreDefaultCursor(),this._dragScaleActive=!1)}_mouseClickOrTapEvent(e){if(this._currencyLabel){if(this._currencyLabel.currencyConversionAvailable()&&this._currencyLabel.currencyLabelElement().contains(e.target))return this._showCurrenciesContextMenu(),void e.preventDefault();if(this._currencyLabel.unitConversionAvailable()&&this._currencyLabel.unitLabelElement().contains(e.target))return this._showUnitsContextMenu(),void e.preventDefault()}const t=this.dataSourceAtPoint(e.localX,e.localY);t&&this._undoModel.selectionMacro((e=>{var i,s,r;e.selection().isSelected(t)&&this._undoModel.model().lastSelectedHittestData()===(null===(i=this._lastHittestResult)||void 0===i?void 0:i.data())||(e.clearSelection(),e.addSourceToSelection(t,null!==(r=null===(s=this._lastHittestResult)||void 0===s?void 0:s.data())&&void 0!==r?r:null))}))}_mouseLeaveOrTouchEndEvent(e){this._setCursorClassName("")}_mouseDoubleClickOrDoubleTapEvent(e){var t,i,s;if((null===(t=this._currencyLabel)||void 0===t?void 0:t.currencyLabelElement().contains(e.target))||(null===(i=this._currencyLabel)||void 0===i?void 0:i.unitLabelElement().contains(e.target)))return;const r=this.dataSourceAtPoint(e.localX,e.localY);r?this._pane.processDoubleClickOnSource(r,null!==(s=this._lastHittestResult)&&void 0!==s?s:void 0,{origin:"price_scale"}):(this.reset(),(0,u.trackEvent)("GUI","Double click price scale"))}_contextMenuOrTouchContextMenuEvent(e){if(this._options.contextMenuEnabled){const t=this.dataSourceAtPoint(e.localX,e.localY);if(null!==t&&this._options.contextMenu.source){return void this._undoModel.model().selectionMacro((i=>{i.selection().isSelected(t)||(i.clearSelection(),i.addSourceToSelection(t)),this._pane.showContextMenuForSelection(e,{origin:"price_scale"})}))}this._options.contextMenu.general&&Ze.ContextMenuManager.showMenu(this.getContextMenuActions(!0),e,{statName:"PriceScaleContextMenu"},{menuName:"PriceScaleContextMenu"})}}_setResizeCursor(){
const e=this.priceScale();e.isPercentage()||e.isIndexedTo100()?this._setCursorClassName(""):this._zoomAvailable()&&(this._options.pressedMouseMoveScale||this._options.mouseWheelScale)&&this._setCursorClassName("ns-resize")}_setCursorClassName(e){let t="";e&&(t="price-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t)}_zoomAvailable(){return!this.priceScale().isEmpty()&&this.priceScale().hasCalculatedPriceRange()&&this._undoModel.model().zoomEnabled()}_onMousewheel(e){if(!this._zoomAvailable()||!this._options.mouseWheelScale)return;const t=(0,n.ensureNotNull)(this._mouseWheelHelper).processWheel(e).deltaY;if(0===t)return;e.cancelable&&e.preventDefault();const i=this._undoModel,s=this._pane.state(),r=this.priceScale(),o=this._cell.getBoundingClientRect(),a=e.clientY-o.top,l=a+15*t;i.startScalePrice(s,this.priceScale(),a,!0),i.scalePriceTo(s,r,l),i.endScalePrice(s,r),e.stopPropagation()}_drawCrossHairLabel(e,t){const i=this._pane.state(),s=i.model(),r=this.priceScale(),n=s.crossHairSource().priceAxisViews(i,r);n&&n.length>0&&this._drawLabels(n,e,t)}_drawBackground(e,t){const i=this.backgroundTopColor(),s=this.backgroundColor(),{bitmapSize:r}=t;if(i===s?(0,z.clearRect)(e,0,0,r.width,r.height,this.backgroundColor()):(0,qe.clearRectWithGradient)(e,0,0,r.width,r.height,i,s),this._highlighted){e.globalAlpha=.5;const t=d.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight");(0,z.fillRect)(e,0,0,r.width,r.height,t),e.globalAlpha=1}}_drawDrawingsHighlight(e,t){const i=this._pane.state().model(),s=this.priceScale(),r=i.selection().lineDataSources().filter((e=>e.priceScale()===s)).reduce(((e,t)=>{const i=t.priceAxisPoints();return 0===i.length?e:e.concat(i)}),[]);r.length>0&&this._hightlightBackground(e,r,this.priceScale().mainSource(),t);const n=i.crossHairSource();n.startMeasurePoint()&&this._hightlightBackground(e,n.measurePoints(),this.priceScale().mainSource(),t)}_drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const{horizontalPixelRatio:i}=t,s=Math.max(1,Math.floor(this.rendererOptions().borderSize*i)),r=this._isLeft?t.bitmapSize.width-s:0;e.fillRect(r,0,s,t.bitmapSize.height),e.restore()}_drawLabels(e,t,i){const s=this.rendererOptions(),r=this._isLeft?"right":"left";for(const n of e)n.isAxisLabelVisible()&&(t.save(),n.renderer().draw(t,i,s,this._widthCache,r),t.restore())}_hightlightBackground(e,t,i,s){if(!i)return;const r=i.firstValue();if(null===r)return;let n=t[0].price,o=t[0].price;for(let e=1;e=n&&(n=e,a=i),e<=t&&(t=e,o=i)}}return a&&o?[a,o]:[]}}_views(e,t){var i,s;const r=this._pane.state(),n=this.priceScale(),o=[];if(1!==e)for(const e of t.sources)t.topLevelSources.has(e)||o.push(...null!==(i=e.priceAxisViews(r,n))&&void 0!==i?i:[]);if(0!==e){const e=new Set,i=t=>!e.has(t),a=t=>{const s=t.filter(i);o.push(...this._viewsOrMaxMinViews(s));for(const t of s)e.add(t)};t.customSourceBeingMoved&&a([t.customSourceBeingMoved]),t.sourcesBeingMoved&&a(t.sourcesBeingMoved),t.selectedSources&&a(t.selectedSources),t.hoveredSource&&a([t.hoveredSource]),t.lineBeingEditedOrCreated&&a([t.lineBeingEditedOrCreated]);for(const e of[...t.sources,...r.customSources()])e.topPriceAxisViews&&o.push(...null!==(s=e.topPriceAxisViews(r,n))&&void 0!==s?s:[])}return o}_initActions(){if(!this._pane.hasState()||null!==this._actions)return;const e=this._undoModel,t=new wt.ActionWithStandardIcon({actionId:"Chart.PriceScale.Reset",options:{label:Lt,iconId:"Chart.Reset",shortcutHint:(0,pt.humanReadableHash)(pt.Modifiers.Alt+82),statName:"ResetScale",onExecute:()=>this.reset()}}),i=new ht.Action({actionId:"Chart.PriceScale.ToggleAutoScale",options:{label:kt,checkable:!0,checked:!0,statName:"ToggleAutoScale",onExecute:()=>{e.togglePriceScaleAutoScaleMode(this.priceScale()),this._updateScalesActions()}}}),s=new ht.Action({actionId:"Chart.PriceScale.TogglePercentage",options:{label:Dt,checkable:!0,checked:this.priceScale().isPercentage(),statName:"TogglePercantage",onExecute:()=>{e.togglePriceScalePercentageScaleMode(this.priceScale()),this._updateScalesActions()}}}),r=new ht.Action({actionId:"Chart.PriceScale.ToggleIndexedTo100",options:{label:Et,checkable:!0,checked:this.priceScale().isIndexedTo100(),statName:"ToggleIndexedTo100",onExecute:()=>{e.togglePriceScaleIndexedTo100ScaleMode(this.priceScale()),this._updateScalesActions()}}}),n=new ht.Action({actionId:"Chart.PriceScale.ToggleLogarithmic",options:{label:Vt,checkable:!0,checked:this.priceScale().isLog(),statName:"ToggleLogScale",onExecute:()=>{e.togglePriceScaleLogScaleMode(this.priceScale()),this._updateScalesActions()}}}),o=new ht.Action({actionId:"Chart.PriceScale.ToggleRegular",options:{label:Bt,checkable:!0,checked:this.priceScale().isRegular(),statName:"ToggleRegularScale",onExecute:()=>{e.setPriceScaleRegularScaleMode(this.priceScale()),this._updateScalesActions()}}}),a=new ut({actionId:"Chart.PriceScale.Labels.ToggleNoOverlappingLabelsVisibility",options:{label:Rt,checkable:!0,checked:this.priceScale().properties().childs().alignLabels.value(),statName:"TogglePreciseLabels"}},{property:this.priceScale().properties().childs().alignLabels,undoModel:e,undoText:Ct}),l=new ht.Action({actionId:"Chart.PriceScale.ToggleInvertScale",options:{label:Nt,checkable:!0,checked:this.priceScale().isInverted(),statName:"Invert Scale",onExecute:()=>{
e.invertPriceScale(this.priceScale()),this._updateScalesActions()}}});this._actions={reset:t,setAutoScale:i,setPercentage:s,setIndexedTo100:r,setLog:n,setRegular:o,alignLabels:a,invertScale:l},this._updateScalesActions()}_logAction(){return this._isMainSeriesAxis()?this._chart.actions().logSeriesScale:(0,n.ensureNotNull)(this._actions).setLog}_percentageAction(){return this._isMainSeriesAxis()?this._chart.actions().percentSeriesScale:(0,n.ensureNotNull)(this._actions).setPercentage}_indexedTo100Action(){return this._isMainSeriesAxis()?this._chart.actions().indexedTo100SeriesScale:(0,n.ensureNotNull)(this._actions).setIndexedTo100}_autoScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().autoSeriesScale:(0,n.ensureNotNull)(this._actions).setAutoScale}_regularScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().regularSeriesScale:(0,n.ensureNotNull)(this._actions).setRegular}_lockScaleAction(){const e=this._chart.actions().lockSeriesScale,t=Ot(this.priceScale(),this._undoModel.model().mainSeriesScaleRatio());return e.update({hint:t}),e}_invertAction(){return this._isMainSeriesAxis()?this._chart.actions().invertSeriesScale:(0,n.ensureNotNull)(this._actions).invertScale}_isMainSeriesAxis(){return this.priceScale().hasMainSeries()}_updateScalesActions(){const e=this.priceScale(),t=this._isMainSeriesAxis(),i=(0,n.ensureNotNull)(e.mainSource()).properties(),s=t&&e.isLockScale(),r=t&&6===i.style.value(),o=(0,n.ensureNotNull)(this._actions);o.setRegular.update({checked:e.isRegular(),disabled:s||r}),o.setPercentage.update({checked:e.isPercentage(),disabled:s||r}),o.setIndexedTo100.update({checked:e.isIndexedTo100(),disabled:s||r}),o.setLog.update({checked:e.isLog(),disabled:s||r}),o.setAutoScale.update({checked:e.isAutoScale(),disabled:e.properties().childs().autoScaleDisabled.value()})}_createMergeScalesAction(){const e=this._chart.actions(),t=this._undoModel.model().priceScaleSlotsCount();if(t.left+t.right===1)return 0===t.left?e.moveScaleToLeft:e.moveScaleToRight;const i=[];return i.push(e.mergeLeftScalesAction),i.push(e.mergeRightScalesAction),new ht.Action({actionId:"Chart.PriceScale.MergeAllScales",options:{label:Tt,subItems:i}})}_setCursor(e){let t="";"grabbing"!==e&&"ns-resize"!==e||(t="price-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}_createScaleModeButtons(){var e;const t=this._scaleModeButtons=new bt({className:"price-axis__modeButtons",setMode:e=>{this._priceScale&&("log"===e?this._chart.model().setPriceScaleMode({log:!this._priceScale.isLog()},this._priceScale,xt):this._chart.model().setPriceScaleMode({autoScale:!this._priceScale.isAutoScale()},this._priceScale,Pt))}});return t.element().style.background=this.backgroundColor(),this._cell.appendChild(t.element()),null===(e=this._priceScale)||void 0===e||e.modeChanged().subscribe(this,this._updateScaleModeButtons),this._updateScaleModeButtons(),t}
_destroyScaleModeButtons(){var e;this._scaleModeButtons&&(this._isHovered.unsubscribe(this._updatePriceScaleModeButtonsVisibility),null===(e=this._priceScale)||void 0===e||e.modeChanged().unsubscribe(this,this._updateScaleModeButtons),this._scaleModeButtons.destroy(),this._scaleModeButtons=null)}_highlightColor(){const e=this.backgroundColor(),t=this._backgroundBasedTheme.value();if(null===this._highlightColorCache||this._highlightColorCache.backgroundColor!==e||this._highlightColorCache.theme!==t){const i=(0,_.applyTransparency)(d.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight"),50),s=(0,Ae.rgbaToString)((0,Ae.blendRgba)((0,Ae.parseRgba)(this.backgroundColor()),(0,Ae.parseRgba)(i)));this._highlightColorCache={theme:t,backgroundColor:e,resultColor:s}}return this._highlightColorCache.resultColor}_applyLightUpdateIfRequired(){"visibleOnMouseOver"===(0,gt.actualCurrencyUnitVisibility)().value()&&this._undoModel.model().lightUpdate()}}function qt(e,t){return e.position-t.position}function $t(e,t,i){const s=(e.position-t.position)/(e.time-t.time);return Math.sign(s)*Math.min(Math.abs(s),i)}!function(e){e[e.MaxStartDelay=50]="MaxStartDelay",e[e.EpsilonDistance=1]="EpsilonDistance"}(jt||(jt={}));class Kt{constructor(e,t,i,s){this._position1=null,this._position2=null,this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._minSpeed=e,this._maxSpeed=t,this._dumpingCoeff=i,this._minMove=s}addPosition(e,t){if(null!==this._position1){if(this._position1.time===t)return void(this._position1.position=e);if(Math.abs(this._position1.position-e)50)return;let i=0;const s=$t(this._position1,this._position2,this._maxSpeed),r=qt(this._position1,this._position2),n=[s],o=[r];if(i+=r,null!==this._position3){const e=$t(this._position2,this._position3,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=qt(this._position2,this._position3);if(n.push(e),o.push(t),i+=t,null!==this._position4){const e=$t(this._position3,this._position4,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=qt(this._position3,this._position4);n.push(e),o.push(t),i+=t}}}}let a=0;for(let e=0;ea&&(e.result={hittest:t,source:i,renderer:s,isCustom:r})}const Ai={contextMenuEnabled:!0,contextMenu:mt.defaultContextMenuOptions,priceScaleContextMenuEnabled:!0,legendWidgetEnabled:!0,controlsEnabled:!0,propertyPagesEnabled:!0,sourceSelectionEnabled:!0,countdownEnabled:!0},Li=new Map([[We.AreaName.Text,"Text"],[We.AreaName.Style,"Style"]]),ki=!N.enabled("display_legend_on_all_charts");var Di;!function(e){e[e.MinScrollSpeed=.2]="MinScrollSpeed",e[e.MaxScrollSpeed=7]="MaxScrollSpeed",e[e.DumpingCoeff=.997]="DumpingCoeff",e[e.ScrollMinMove=15]="ScrollMinMove",e[e.SPenMaxDistance=5]="SPenMaxDistance",e[e.CollapsedHeight=33]="CollapsedHeight"}(Di||(Di={}));let Ei=null;function Vi(e,t){return!(0,We.shouldDefaultActionBeExecuted)(e,t,"pressedMouseMoveHandler","touchMoveHandler")}var Bi;!function(e){e[e.None=0]="None",e[e.DownWithoutMove=1]="DownWithoutMove",e[e.DownWithMove=2]="DownWithMove"}(Bi||(Bi={}));class Ri{constructor(e,t,i,r){this._legendWidget=null,this._paneControls=null,this._isDestroyed=!1,this._trackCrosshairOnlyAfterLongTap=(0,ye.lastMouseOrTouchEventInfo)().isTouch,this._startTrackPoint=null,this._exitTrackingModeOnNextTry=!1,this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._preventSourceChange=!1,this._preventScrollUntilNextMouseDownOrTouchStart=!1,this._clonningAtMoveLineTools=null,this._startCloningPoint=null,this._size=(0,s.size)({width:0,height:0}),this._themedTopColor=null,this._initCrossHairPosition=null,this._firstZoomPoint=null,this._editDialog=null,this._processing=!1,this._pressedMoveStage=0,this._touchMove=!1,this._startTouchPoint=null,this._isSelecting=!1,this._prevHoveredHittest=null,this._contextMenuX=0,this._contextMenuY=0,this._startScrollingPos=null,this._isScrolling=!1,this._scrollPriceScale=null,this._scrollXAnimation=null,this._prevPinchScale=1,this._pinching=!1,this._wasPinched=!1,this._longTap=!1,this._contextMenuOpenedOnLastTap=!1,this._paneControlsResizeObserver=null,this._lastClickedSource=null,this._customLegendWidgetsFactoryMap=new Map,this._prevMoveEventPosition=null,this._onMagnetStateChangedListener=this._onMagnetStateChanged.bind(this),this._onShiftKeyStateChangedListener=this._onShiftKeyStateChanged.bind(this),this._currentCursorClassName="",this._lastFinishedToolId=null,this._needResetMeasureLater=!1,
this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._prevTooltipData=null,this._errorRenderer=null,this._highlightedPriceAxis=new H.WatchedValue({owner:"",axis:null}),this._visuallyCollapsed=new H.WatchedValue(!1),this._endOfSeriesDataBanner=null,this._selectionBeforeMouseDown=new WeakSet,this._canvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._updateVisuallyCollapsed=()=>{this._visuallyCollapsed.setValue(!this.state().maximized().value()&&this.state().collapsed().value())},this._chart=e,this._state=t,this._options=(0,P.merge)((0,P.clone)(Ai),i),this._paneWidgetsSharedState=r,this._state&&this._subscribeToState();const n={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,mouseWheelScale:this._options.handleScale.mouseWheel,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks};void 0!==this._options.priceScaleContextMenu&&(n.contextMenu=this._options.priceScaleContextMenu);const o=(e,t,i,s,r)=>new Gt(this._chart,this,this._chartUndoModel(),i,t,e,n,s,r),a=e.properties().childs().scalesProperties,l=this._chartModel().rendererOptionsProvider(),c={backgroundBasedTheme:e.backgroundBasedTheme().spawnOwnership(),stubContextMenuProvider:()=>[],titlesProvider:()=>[],rendererOptionsProvider:l,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(),getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value(),requestRepaint:()=>this._chartModel().lightUpdate()},h={showLabels:!1};this._lhsPriceAxisesContainer=new nt(a,"left",o,c,h),this._rhsPriceAxisesContainer=new nt(a,"right",o,c,h),this._paneCell=document.createElement("div"),this._paneCell.classList.add("chart-markup-table","pane"),this._div=document.createElement("div"),this._div.classList.add("chart-gui-wrapper"),this._div.setAttribute("data-name","pane-widget-chart-gui-wrapper"),this._paneCell.appendChild(this._div),this._canvasBinding=(0,z.createBoundCanvas)(this._div,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const d=this._canvasBinding.canvasElement;d.style.position="absolute",d.style.left="0",d.style.top="0",this._topCanvasBinding=(0,z.createBoundCanvas)(this._div,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const u=this._topCanvasBinding.canvasElement;u.style.position="absolute",u.style.left="0",u.style.top="0",this._rowElement=document.createElement("div"),this._rowElement.style.display="flex",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()),d.setAttribute("aria-hidden","true");const p=this._chartModel().mainSeries()
;p.dataEvents().symbolResolved().subscribe(this,this._updateAccesibilityAttr),p.onIntervalChanged().subscribe(this,this._updateAccesibilityAttr),this._updateAccesibilityAttr(),this._options.legendWidgetEnabled&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),this._state&&!this._chart.readOnly()&&this._options.controlsEnabled&&this._loadAndCreatePaneControlsWidget(),(0,ci.magnetEnabled)().subscribe(this._onMagnetStateChangedListener),(0,U.shiftPressed)().subscribe(this._onShiftKeyStateChangedListener),this._paneCell.addEventListener("dragover",(e=>{e.dataTransfer&&Array.from(e.dataTransfer.files).some(blobImageFilter)&&e.preventDefault()})),this.setCursorForTool(),this._mouseEventHandler=new ke.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!this._options.handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:!this._options.handleScroll.horzTouchDrag}),this._prevHoveredHittest=null,this._highlightedPriceAxis.subscribe((e=>this._highlightPriceAxisByLabel(e.axis))),this._prevPinchScale=0,this._isDestroyed=!1}destroy(){var e;this._chart.onPaneWidgetDestroyed(this);const t=this._chartModel().mainSeries();t.dataEvents().symbolResolved().unsubscribeAll(this),t.onIntervalChanged().unsubscribeAll(this),this._customLegendWidgetsFactoryMap.clear(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),null!==this._paneControlsResizeObserver&&this._paneControlsResizeObserver.disconnect(),null!==this._paneControls&&(this._paneControls.destroy(),this._paneControls=null),this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this.hasState()&&this._unsubscribeFromState(),(0,ci.magnetEnabled)().unsubscribe(this._onMagnetStateChangedListener),(0,U.shiftPressed)().unsubscribe(this._onShiftKeyStateChangedListener),this._paneWidgetsSharedState.onPaneDestroyed(this),this._errorRenderer&&this._errorRenderer.then((e=>{e.destroy(),this._errorRenderer=null})),this._prevHoveredHittest=null,this._mouseEventHandler.destroy(),null===(e=this._rowElement.parentElement)||void 0===e||e.removeChild(this._rowElement),this._isDestroyed=!0}size(){return this._size}setSize(e){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._paneCell.style.width=e.width+"px",this._paneCell.style.height=e.height+"px",this._div.style.width=e.width+"px",this._div.style.height=e.height+"px",this._rowElement.classList.toggle("js-hidden",0===e.height),null!==this._legendWidget&&this._legendWidget.updateWidgetModeBySize(e),null!==this._paneControls&&this._paneControls.updateWidgetModeByWidth(e.width))}width(){return this._size.width}height(){
return this._size.height}backgroundColor(){return this._chartModel().backgroundColor().value()}highlightedPriceAxis(){return this._highlightedPriceAxis}processDoubleClickOnSource(e,t,i){(0,Ue.isDataSource)(e)&&e.id()!==this._lastFinishedToolId&&this._showEditDialogForSource(e,t)}stretchFactor(){return this._state?this._state.stretchFactor():0}setStretchFactor(e){this.hasState()&&this.state().setStretchFactor(e)}setCursorForTool(e,t,i){if(t&&t.mod()&&e&&e!==this._chartModel().crossHairSource())return void this._setCursorClassName("pointer");if(void 0!==i){switch(i){case ai.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ai.PaneCursorType.HorizontalResize:this._setCursorClassName("ew-resize");break;case ai.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ai.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case ai.PaneCursorType.Default:this._setCursorClassName("default");break;case ai.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case ai.PaneCursorType.Grabbing:this._setCursorClassName("grabbing");break;case ai.PaneCursorType.Text:this._setCursorClassName("text")}return}const s=je.tool.value();if((0,je.toolIsCursor)(s)){if(null!==this._paneWidgetsSharedState.draggingSource()||this._isScrolling||this._chartUndoModel()&&this._chartUndoModel().model().sourcesBeingMoved().length)return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}if("eraser"===s)return void this._setCursorClassName("eraser");if("performance"===s)return void this._setCursorClassName("performance");if("zoom"===s)return void this._setCursorClassName("zoom-in");const r=je.cursorTool.value();"dot"!==r?"arrow"!==r?this._setCursorClassName(""):this._setCursorClassName("default"):this._setCursorClassName("dot")}showContextMenuForSelection(e,t,i){const s=this._chartUndoModel().selection();if(s.isEmpty())return;const r=s.dataSources().filter((e=>e.hasContextMenu()));this.showContextMenuForSources(r,e,void 0,t,i)}async showContextMenuForSources(e,t,i,s,r){var n,o,a,l,c;if(!e.length||!this._state)return Promise.resolve(null);const h=e[0],d=(0,P.merge)((0,P.clone)(this._options.contextMenu),i||{}),u=new mt.ActionsProvider(this._chart,d);if(h===this._chartUndoModel().crossHairSource())return h.handleContextMenuEvent(t),Promise.resolve(null);{const i=await u.contextMenuActionsForSources(e,this._state,t,null==s?void 0:s.origin,null===(n=null==r?void 0:r.data())||void 0===n?void 0:n.customActions);if(0===i.length)return Promise.resolve(null);{let e;return e=h instanceof di.Series?{menuName:null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:"ObjectTreeContextMenu",detail:{type:"series",id:h.instanceId()}}:(0,J.isLineTool)(h)?{menuName:null!==(a=null==s?void 0:s.origin)&&void 0!==a?a:"ObjectTreeContextMenu",detail:{type:"shape",id:null!==(l=null==h?void 0:h.id())&&void 0!==l?l:null}}:{menuName:null!==(c=null==s?void 0:s.origin)&&void 0!==c?c:"ObjectTreeContextMenu",detail:{
type:"study",id:(null==h?void 0:h.id())||null}},Ze.ContextMenuManager.createMenu(i,{takeFocus:!0,returnFocus:!0,isKeyboardEvent:d.isKeyboardEvent},e).then((e=>(e.show(t),e)))}}}leftPriceAxisesContainer(){return this._lhsPriceAxisesContainer}rightPriceAxisesContainer(){return this._rhsPriceAxisesContainer}setPriceAxisSizes(e,t,i){this._priceAxisesContainer(e).setSizes(t,i)}state(){return(0,n.ensureNotNull)(this._state)}hasState(){return null!==this._state}setState(e){this._state!==e&&(this.hasState()&&this._unsubscribeFromState(),this._state=e,this.hasState()&&(this._subscribeToState(),this.updatePriceAxisWidgetsStates()))}getScreenshotData(e){var t,i,s,r;const n=[],o=[];let a,l=[];const c=this.state().sourcesByGroup().priceSources().slice().reverse(),h=this._chart.properties().childs().paneProperties.childs().legendProperties.childs();for(const d of c){const c=d.statusView();if((0,Z.isStudy)(d)&&(h.showLegend.value()||(null==e?void 0:e.showCollapsedStudies))){const s=h.showStudyTitles.value(),r=s;if(d.properties().childs().visible.value()&&this._chartModel().paneForSource(d)===this.state()&&c&&r){n.push(s?d.statusProvider(null==e?void 0:e.status).text():"");const r=N.enabled("use_last_visible_bar_value_in_legend")&&null!==(i=null===(t=this._chartModel().timeScale().visibleBarsStrictRange())||void 0===t?void 0:t.lastBar())&&void 0!==i?i:null,a=d.legendValuesProvider().getValues(r);o.push(a)}}else if(d===this._chartModel().mainSeries()&&c&&h.showSeriesTitle.value()){a=d.statusProvider((null==e?void 0:e.status)||{}).text();const t=N.enabled("use_last_visible_bar_value_in_legend")&&null!==(r=null===(s=this._chartModel().timeScale().visibleBarsStrictRange())||void 0===s?void 0:s.lastBar())&&void 0!==r?r:null;l=d.legendValuesProvider().getValues(t)}}return{type:"pane",leftAxis:this._lhsPriceAxisesContainer.getScreenshotData(),rightAxis:this._rhsPriceAxisesContainer.getScreenshotData(),content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,contentWidth:this._size.width,contentHeight:this._size.height,studies:n,studiesValues:o,containsMainSeries:this.containsMainSeries(),mainSeriesText:a,mainSeriesValues:l}}updatePriceAxisWidgetsStates(){if(!this.hasState())return;const e=this._chartModel(),t=e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount(),s=this.state(),r=s.visibleLeftPriceScales(),n=s.visibleRightPriceScales();this._lhsPriceAxisesContainer.setScales(r,i.left,t.leftPriceScales().length,i.left+i.right),this._rhsPriceAxisesContainer.setScales(n,i.right,t.rightPriceScales().length,i.left+i.right)}updatePriceAxisWidgets(){this._lhsPriceAxisesContainer.update(),this._rhsPriceAxisesContainer.update()}update(){this.hasState()&&(this.updatePriceAxisWidgets(),null!==this._legendWidget&&this._legendWidget.update(),this.updateControls())}updateStatusWidget(e){this.hasState()&&null!==this._legendWidget&&(e.legendWidgetLayoutInvalidated()?this._legendWidget.updateLayout():this._legendWidget.update())}updateControls(){
this.hasState()&&null!==this._paneControls&&this._paneControls.update()}updateThemedColors(e){this._themedTopColor=e.topColor,this._updateByThemedColors()}statusWidget(){return this._legendWidget}getElement(){return this._rowElement}canvasElement(){return this._canvasBinding.canvasElement}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}pinchStartEvent(){return null===this._paneWidgetsSharedState.scrollingPane()&&null===this._paneWidgetsSharedState.pinchingPane()&&(this._onTouchEvent(),!!this._options.handleScale.pinch&&(this._chartModel().stopTimeScaleAnimation(),this._prevPinchScale=1,this._pinching=!0,this._wasPinched=!0,this._paneWidgetsSharedState.setPinchingPane(this),!0))}pinchEvent(e,t,i,s){if(null!==this._paneWidgetsSharedState.scrollingPane()||this._paneWidgetsSharedState.pinchingPane()!==this)return;if(this._onTouchEvent(),!this._options.handleScale.pinch)return;const r=10*(s-this._prevPinchScale);this._prevPinchScale=s,this._chartModel().zoomTime(e.x,r,!0),this._prevPinchScale=s}pinchEndEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&this._paneWidgetsSharedState.pinchingPane()===this&&(this._onTouchEvent(),this._pinching=!1,this._paneWidgetsSharedState.setPinchingPane(null))}mouseClickEvent(e){this._onMouseEvent(),this._mouseClickOrTapEvent(e)}tapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseClickOrTapEvent(e))}mouseDownEvent(e){this._onMouseEvent(),this.hasState()&&this._mouseDownOrTouchStartEvent(e,this._dataSourceAtPoint(e.localX,e.localY))}touchStartEvent(e){if(this._paneWidgetsSharedState.startTouch(this),this._preventTouchEventsExceptPinch())return;const t=!this._trackCrosshairOnlyAfterLongTap&&null!==Ei&&Ei.stateId===this.state().id()&&Math.abs(Ei.x-e.localX)+Math.abs(Ei.y-e.localY)<5;this._onTouchEvent(),this._chart.setActivePaneWidget(this);const i=this._dataSourceAtPoint(e.localX,e.localY);if(t){const t=this._chartModel().crossHairSource();null!==i&&i.source===t||t.selectPointMode().value()!==je.SelectPointMode.None?this.startTrackingMode(new Oe.Point(e.localX,e.localY),new Oe.Point(e.localX,e.localY)):!this._chart.readOnly()&&null!==i&&(0,J.isLineTool)(i.source)&&i.source.userEditEnabled()&&this._chartUndoModel().selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(i.source,i.hittest.data())}))}this._mouseDownOrTouchStartEvent(e,i),this._mouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._onMouseEvent(),this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._paneWidgetsSharedState.endTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseOrTouchLeaveEvent(e),this._mouseUpOrTouchEndEvent(e))}mouseMoveEvent(e){this._onMouseEvent(),this._mouseOrTouchMoveEvent(e)}pressedMouseMoveEvent(e){this._onMouseEvent(),this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._pressedMouseOrTouchMoveEvent(e))}mouseLeaveEvent(e){this._onMouseEvent(),this._updateHoveredSource(null,new ze.EnvironmentState(e)),
this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._onMouseEvent(),this._mouseDoubleClickOrDoubleTapEvent(e)}wheelClickEvent(e){if(this._chart.readOnly())return;const t=this._dataSourceAtPoint(e.localX,e.localY);if(null===t||t.isCustom)return;if((t.hittest.target()||0)<=We.HitTarget.MovePointBackground)return;const i=new ze.EnvironmentState(e),s=t.hittest.eraseMarker();if(i.mod()&&void 0!==s&&t.source.processErase)return void t.source.processErase(this._chartUndoModel(),s);const r=this._chartUndoModel();r.selection().isSelected(t.source)||r.selectionMacro((e=>{e.clearSelection();const i=(0,n.ensureNotNull)(t.source);e.addSourceToSelection(i,Ii(t,i))})),this._chart.removeSelectedSources()}doubleTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseDoubleClickOrDoubleTapEvent(e))}longTapEvent(e){if(null===this._state||this._preventTouchEventsExceptPinch())return;if(this._onTouchEvent(),this._longTap=!0,null!==this._startTrackPoint||!this._trackingModeShouldBeActive())return;const t=this._chartModel().selection();if(!t.isEmpty()){const i=this._dataSourceAtPoint(e.localX,e.localY);if(null!==i&&t.isSelected(i.source))return}this.startTrackingMode(new Oe.Point(e.localX,e.localY),new Oe.Point(e.localX,e.localY),new ze.EnvironmentState(e))}mouseEnterEvent(e){if(this._onMouseEvent(),!this.hasState())return;this._chart.setActivePaneWidget(this);const t=this._dataSourceAtPoint(e.localX,e.localY);this._updateHoveredSource(t,new ze.EnvironmentState(e)),this.setCursorPosition(e.localX,e.localY,new ze.EnvironmentState(e))}contextMenuEvent(e){this._onMouseEvent(),this._contextMenuEvent(e)}touchContextMenuEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._contextMenuEvent(e))}mouseDownOutsideEvent(e){this._processOutsideClick(null,e)}touchStartOutsideEvent(e){this._processOutsideClick(null,e)}cancelZoom(){this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,this._preventCrossHairMove()&&this._clearCursorPosition()}startTrackingMode(e,t,i){this._startChangeLineToolParams=null,this._startMoveSourceParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._chartUndoModel().selectionMacro((e=>e.clearSelection())),this._startTrackPoint=e,this._exitTrackingModeOnNextTry=!1,this.setCursorPosition(t.x,t.y,i),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}setDragToAnotherPaneCursor(){this._setCursorClassName("grabbing")}cloneLineTools(e,t){return this._chartUndoModel().cloneLineTools(e,t)}exitTrackingMode(){null!==this._state&&null!==this._startTrackPoint&&(this._exitTrackingModeOnNextTry=!0,this._tryExitTrackingMode())}trackingModeEnabled(){return null!==this._state&&null!==this._startTrackPoint}addCustomWidgetToLegend(e,t){this._options.legendWidgetEnabled&&(this._customLegendWidgetsFactoryMap.set(e,t),null!==this._legendWidget&&this._legendWidget.addCustomWidgetToLegend(e,t))}containsMainSeries(){return!!this.hasState()&&this.state().containsMainSeries()}paint(e){
if(!this._chartUndoModel()||!this.hasState()||0===this._size.width||0===this._size.height)return;(0,z.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,z.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding),this._state&&(e.priceScaleSideMaxLevel("left")>ve.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>ve.InvalidationLevel.Cursor)&&(this._recalculatePriceScales((0,pi.viewportChangeEvent)(this.state())),null!==Ei&&Ei.stateId===this.state().id()&&this.setCursorPosition(Ei.x,Ei.y,Ei.envState));const t=e.fullInvalidation();if(t>ve.InvalidationLevel.Cursor&&null!==Ei&&Ei.stateId===this.state().id()){const e=this._dataSourceAtPoint(Ei.x,Ei.y);this._updateHoveredSource(e,(0,U.globalEnvironmentState)())}if(this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left")),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right")),t===ve.InvalidationLevel.None)return;const i=this._state&&(this._state.maximized().value()||!this._state.collapsed().value());if(t>ve.InvalidationLevel.Cursor){const e=(0,n.ensureNotNull)(this._canvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,z.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(t),this._drawBackground(e,t),i&&this._drawSources(e,t)}if(null!==this._state){const e=(0,n.ensureNotNull)(this._topCanvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,z.getBindingRenderingInfo)(this._topCanvasBinding);e.clearRect(0,0,t.bitmapSize.width,t.bitmapSize.height),i&&this._drawTopViews(e,t),this._drawCrossHair(e,t),i&&this._drawActiveLineTools(e,t)}}cancelCreatingLineTool(){const e=this._chartUndoModel(),t=this._chartUndoModel().lineBeingCreated();if(t)if(t.pointsCount()<=0&&!(0,oi.isLineDrawnWithPressedButton)(t.toolname)){const i=t.points();if(i.length>2){const s=i[i.length-2];e.continueCreatingLine(s),this._finishTool(t)}else e.cancelCreatingLine()}else e.cancelCreatingLine();null!==this._firstZoomPoint&&this.cancelZoom(),this.setCursorForTool()}drawRightThere(e){if((0,oi.isLineToolName)(e)&&this.hasState()){const t=this._chartUndoModel(),i=t.crossHairSource(),s=t.model().magnet().align(i.price,i.index,this.state());t.createLineTool({pane:this.state(),point:{index:i.index,price:s},linetool:e})}}cancelMeasuring(){this._chartUndoModel().crossHairSource().clearMeasure(),(0,je.resetToCursor)(),this.setCursorForTool()}async setErrorMessage(e){var t,i,s;e&&!this._errorRenderer&&(this._errorRenderer=this._createErrorBlock()),null===(t=await this._errorRenderer)||void 0===t||t.update({message:null==e?void 0:e.message,icon:(null===(i=this._state)||void 0===i?void 0:i.containsMainSeries())||(null===(s=this._state)||void 0===s?void 0:s.maximized().value())?null==e?void 0:e.icon:void 0,backgroundColor:`linear-gradient(${this._chartModel().backgroundTopColor().value()}, ${this._chartModel().backgroundColor().value()})`,textColor:this._chartModel().dark().value()?vi:fi,solutionId:null==e?void 0:e.solutionId,rawHtml:null==e?void 0:e.rawHtml,
buttons:this.containsMainSeries()?null==e?void 0:e.buttons:void 0,maxWidth:null==e?void 0:e.maxWidth,maxHeight:null==e?void 0:e.maxHeight,zeroHeight:null==e?void 0:e.zeroHeight})}collapsedHeight(){var e,t;return Math.max(Math.ceil(null!==(t=null===(e=this._paneControls)||void 0===e?void 0:e.bottomWithMargin())&&void 0!==t?t:0),33)}setCursorPosition(e,t,i){this._updateLastCrosshairPosition(e,t,i),this._chartModel().setAndSaveCurrentPosition(this._correctXCoord(e),this._correctYCoord(t),this.state(),i)}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,r){return!(!(0,je.toolIsMeasure)(je.tool.value())||t.startMeasurePoint())&&(e.isTouch||this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,i),s=this._chartModel().magnet().align(s,r,this.state()),t.startMeasuring({price:s,index:r},this.state()),!0)}_tryFinishMeasure(e,t){if(t.startMeasurePoint()&&!t.endMeasurePoint()){let i=t.price;const s=t.index;return i=this._chartModel().magnet().align(i,s,this.state()),t.finishMeasure({price:i,index:s}),e.isTouch?(0,je.resetToCursor)():this._needResetMeasureLater=!0,this._preventCrossHairMove()&&this._clearCursorPosition(),!0}return!1}_tryStartZoom(e,t,i,s){const r=this._chart.model().model().zoomEnabled();if("zoom"===je.tool.value()&&r){const r=this._chartUndoModel(),n=r.timeScale().indexToCoordinate(i)-.5*r.timeScale().barSpacing();return this._firstZoomPoint={price:t,index:i,x:n,y:e.localY},this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,s),this._chartModel().crossHairSource().startSelection(this.state()),!0}return!1}_finishZoom(e){const t=this.state(),i=t.defaultPriceScale(),s=(0,n.ensureNotNull)(t.mainDataSource()).firstValue(),r=i.coordinateToPrice(e.localY,(0,n.ensureNotNull)(s)),o=this._chartUndoModel(),a=Math.round(o.timeScale().coordinateToIndex(e.localX)),l=(0,n.ensureNotNull)(this._firstZoomPoint);a!==l.index&&o.zoomToViewport(l.index,a,l.price,r,t),this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,(0,je.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if(!("eraser"!==je.tool.value()||e.isCustom||(i=e.source,i&&i.customization&&i.customization.disableErasing))){const i=this._chartUndoModel();if((0,J.isLineTool)(e.source)||(0,Z.isStudy)(e.source)){const s=e.hittest.eraseMarker();return t.mod()&&void 0!==s&&e.source.processErase?e.source.processErase(i,s):i.removeSource(e.source,!1),!0}}var i;return!1}_tryStartChangingLineTool(e,t,i,s){var r,o,a;if(e.isTouch&&null!==this._startTrackPoint)return!1;const l=t.hittest;if((!e.isTouch||!this._preventSourceChange)&&l&&(0,J.isLineTool)(t.source)&&l.target()===We.HitTarget.ChangePoint){const c=this._chartUndoModel(),h=(0,n.ensure)(null===(r=this.state().mainDataSource())||void 0===r?void 0:r.firstValue()),d=(0,n.ensureNotNull)(t.source.priceScale()).coordinateToPrice(e.localY,h)
;c.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(t.source,l.data())}));let u=d;t.source.priceScale()===c.mainSeries().priceScale()&&(u=c.model().magnet().align(d,s,this.state()));const p=null===(o=l.data())||void 0===o?void 0:o.nonDiscreteIndex;p&&(s=c.timeScale().coordinateToFloatIndex(e.localX));const _=null===(a=l.data())||void 0===a?void 0:a.pointIndex;return this._startChangeLineToolParams={source:t.source,startPoint:{index:s,price:u,nonDiscreteIndex:p},screenPoint:{x:e.localX,y:e.localY},pointIndex:_,envState:i},!0}return this._startChangeLineToolParams=null,!1}_tryStartCloning(e,t,i,s){if(i.mod()){const t=this._chartUndoModel().selection().dataSources().filter((e=>e.cloneable()));if(s&&s.cloneable()&&t.push(s),t.length>0)return this._clonningAtMoveLineTools=t.map((e=>e.id())),this._startCloningPoint=new Oe.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t,i){const s=this._chartUndoModel(),r=this._chartModel();if(t.mod()&&this._clonningAtMoveLineTools){const o=new Oe.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(this._startCloningPoint).subtract(o).length(),l=[];for(const e of this._clonningAtMoveLineTools){const t=r.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const r=this.cloneLineTools(l,!0).map((e=>(0,n.ensureNotNull)(s.model().dataSourceForId(e))));s.selectionMacro((e=>{e.clearSelection();let t=null;r.forEach((s=>{null===t&&(t=Ii(i,s)),e.addSourceToSelection(s,t)}))}));const o=new Oe.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(r[0].priceScale()),c=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:s.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,(0,n.ensureNotNull)(c))};s.startMovingSources(r,{logical:h,screen:o},null,t),this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,s){var r,o;const a=je.tool.value();if(!this.hasState()||(0,oi.isLineToolDrawWithoutPoints)(a))return;const l=this._chartUndoModel();let c=!1,h=null;(0,je.hideAllDrawings)().value()&&(0,y.toggleHideMode)(),(0,je.lockDrawings)().setValue(!1),e.isTouch&&!e.stylus&&((0,oi.isLineToolName)(a)&&!(0,oi.isLineDrawnWithPressedButton)(a)||l.lineBeingCreated())&&this._initToolCreationModeParams(e);const d=l.lineBeingCreated();if(d&&!(0,oi.isLineDrawnWithPressedButton)(d.toolname)){const a=(0,n.ensure)(null===(r=d.ownerSource())||void 0===r?void 0:r.firstValue());if(e.isTouch&&!e.stylus){if(!this._startTouchPoint){this._startTouchPoint=new Oe.Point(e.pageX,e.pageY);const t=d.points(),i=t[t.length-1],s=l.timeScale().indexToCoordinate(i.index),r=(0,n.ensureNotNull)(d.priceScale()).priceToCoordinate(i.price,a);return void(this._initCrossHairPosition=new Oe.Point(s,r))}}else if(!e.isTouch){h=d;const r=l.model().paneForSource(d);if(r!==this._state&&null!==r){const i=this._externalPaneXCoord(r,e.localX),s=this._externalPaneYCoord(r,e.localY);c=l.continueCreatingLine({index:Math.round(l.timeScale().coordinateToIndex(i)),price:(0,
n.ensure)(null===(o=d.priceScale())||void 0===o?void 0:o.coordinateToPrice(s,a))},t)}else{const e=l.model().magnet().align(s,i,this.state());c=l.continueCreatingLine({index:i,price:e},t)}}}else if(!e.isTouch||e.stylus||(0,oi.isLineDrawnWithPressedButton)(a)){const e={index:i,price:l.model().magnet().align(s,i,this.state())};h=l.createLineTool({pane:this.state(),point:e,linetool:a}),l.lineBeingCreated()||(c=!0)}const u=this._dataSourceAtPoint(e.localX,e.localY);h&&l.selectionMacro((e=>{e.addSourceToSelection((0,n.ensureNotNull)(h),null==u?void 0:u.hittest.data())})),c&&h&&(this._finishTool(h,u),e.preventDefault())}_handleSelectionMouseDownAndGetJustDeselectedSource(e,t,i){const s=this._chartUndoModel();let r=null;return(null===t||t.source.isSelectionEnabled())&&s.selectionMacro((s=>{!this._preventSourceChange&&null!==t&&(e.isTouch?t.hittest.target()>=We.HitTarget.MovePointBackground:t.hittest.target()>We.HitTarget.MovePointBackground)?(i.mod()||s.selection().isSelected(t.source)||s.clearSelection(),i.mod()&&s.selection().isSelected(t.source)?(r=t.source,s.removeSourceFromSelection(t.source)):s.addSourceToSelection(t.source,t.hittest.data()),s.selection().allSources().length>1&&(0,u.trackEvent)("GUI","Multiselect","Click Select")):i.mod()||s.clearSelection()})),r}_processMouseMoveWhileZoom(e,t){this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,t)}_updateCommonTooltip(e,t){let i=null;if(null!==e&&null!==e.hittest){const t=e.hittest.data();t&&(i=t.tooltip||null)}if(null===this._prevTooltipData&&null===i)return;if(null===i||""===i.text)return this._prevTooltipData=null,void(0,li.hide)(t);if(this._prevTooltipData&&(0,Be.default)(i,this._prevTooltipData))return;this._prevTooltipData=i;const s=(0,P.clone)(i);if(void 0!==s.rect){const e=this._paneCell.getBoundingClientRect();s.rect.x+=e.left,s.rect.y+=e.top}(0,li.show)(s)}_setCursorPositionOnExternalPane(e,t,i,s){t=this._externalPaneXCoord(e,t),i=this._externalPaneYCoord(e,i);this._chart.paneByState(e).setCursorPosition(t,i,s)}_updateLastCrosshairPosition(e,t,i){const s=this.state().id();Ei={x:e,y:t,envState:i,stateId:s}}_setCursorClassName(e){let t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._paneCell.classList.remove(this._currentCursorClassName),t&&this._paneCell.classList.add(t),this._currentCursorClassName=t,this._paneCell.style.cursor)}_processMouseUpOrTouchEndHandler(e){const t=this._dataSourceAtPoint(e.localX,e.localY);if(null!==t){const i=this._sourceWasSelected(t);t.hittest.tryCallMouseUpOrTouchEndHandler(e,{sourceWasSelected:i})}}_crossHairShouldBeVisible(){const e=this._chartModel().crossHairSource();return(0,oi.isLineToolName)(je.tool.value())||(0,je.toolIsMeasure)(je.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){Ei=null,this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){var i,s;if(!this.hasState())return null;const r={
result:null},n=this._chartUndoModel();if((0,oi.isLineToolName)(je.tool.value())||null!==n.lineBeingCreated())return r.result;if(this._currentChangingLineToolHitTest)return this._currentChangingLineToolHitTest;const o=new Set;if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()){if(!(null===(i=this._currentMovingHitTest.cancelledContainer)||void 0===i?void 0:i.cancelled))return this._currentMovingHitTest.sourceAtPoint;o.add(this._currentMovingHitTest.sourceAtPoint.source.id())}if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()&&!(null===(s=this._currentMovingHitTest.cancelledContainer)||void 0===s?void 0:s.cancelled))return this._currentMovingHitTest.sourceAtPoint;const a=this.state(),l=(0,z.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(l);const c=Mi.bind(null,r),h=new Oe.Point(e,t);if(!a.maximized().value()&&a.collapsed().value()||(0,ye.lastMouseOrTouchEventInfo)().isTouch&&(je.activePointSelectionMode.value()!==je.SelectPointMode.None||null!==this._startTrackPoint))return this._hitTestSources(l,[n.crossHairSource()],h,c,!1,o),r.result;const d=a.sourcesByGroup(),u=n.selection(),p=u.dataSources().filter((e=>e.isMultiPaneEnabled()||n.paneForSource(e)===a));this._hitTestSources(l,p,h,c,!1,o),this._hitTestSources(l,u.customSources(),h,c,!0,o),u.allSources().forEach((e=>o.add(e.id()))),this._hitTestSources(l,[n.crossHairSource()],h,c,!1,o),this._hitTestSources(l,a.customSources(He.CustomSourceLayer.Topmost),h,c,!0,o),this._hitTestSources(l,d.tradingSources(),h,c,!1,o),this._hitTestSources(l,a.customSources(He.CustomSourceLayer.Foreground),h,c,!0,o);const _=d.hitTestSources();if(this._hitTestSources(l,_,h,c,!1,o),this.containsMainSeries()){const e=n.activeStrategySource().value();if(null!==e&&!o.has(e.id())){const t=e.strategyOrdersPaneView();if(null!==t){const i=t.renderer(l);if(null!==i){const t=i.hitTest(h,l);t&&Mi(r,t,e,i,!1)}}}}return null===r.result&&this._hitTestSources(l,a.customSources(He.CustomSourceLayer.Background),h,c,!0,o),r.result}_sourceWasSelected(e){return!!e&&this._selectionBeforeMouseDown.has(e.source)}_hitTestSources(e,t,i,s,r,o){const a=(0,n.ensureNotNull)(this._state);for(let n=t.length-1;n>=0;--n){const l=t[n];if(o.has(l.id()))continue;const c=l.paneViews(a);if(null!==c&&0!==c.length)for(let t=c.length-1;t>=0;--t){const n=c[t].renderer(e);if(n&&n.hitTest){const t=n.hitTest(i,e);null!==t&&s(t,l,n,r)}}}}_tryStartMovingLineTool(e,t,i,s){var r;if(null===t.source||!t.source.movable()||null!==this._startTrackPoint)return!1;if(!this._preventSourceChange){const o=this._chartUndoModel(),a=(0,n.ensureNotNull)((0,n.ensureNotNull)(this._state).mainDataSource()).firstValue(),l=(0,n.ensureNotNull)(t.source.priceScale()),c=null===a?NaN:l.coordinateToPrice(e.localY,a);let h=(t.source.isSelectionEnabled()?o.selection().allSources():[t.source]).filter(hi);const d=h.filter(J.isLineTool);h=d.length>0?d:h.includes(t.source)?[t.source]:[h[0]];const u=new Oe.Point(e.localX,e.localY),p={index:s,price:c
},_=null===(r=t.hittest.data())||void 0===r?void 0:r.activeItem;return this._startMoveSourceParams={source:h,startPoint:{logical:p,screen:u},activeItem:void 0===_?null:_,envState:i},!0}return this._startMoveSourceParams=null,!1}_chartModel(){return this._chart.model().model()}_chartUndoModel(){return this._chart.model()}_externalPaneXCoord(e,t){t+=this._div.getBoundingClientRect().left+document.body.scrollLeft;const i=(0,n.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().left+document.body.scrollLeft;return i._correctXCoord(t-s)}_externalPaneYCoord(e,t){t+=this._div.getBoundingClientRect().top+document.body.scrollTop;const i=(0,n.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().top+document.body.scrollTop;return i._correctYCoord(t-s)}_correctXCoord(e){return Math.max(0,Math.min(e,this._size.width-1))}_correctYCoord(e){return Math.max(0,Math.min(e,this._size.height-1))}_processScroll(e){if(!this._chart.model().model().scrollEnabled())return;const t=performance.now();this._startScrollingPos||this._preventScroll()||(this._startScrollingPos={x:e.clientX,y:e.clientY,timestamp:t,localX:e.localX,localY:e.localY});const i=this._chartUndoModel();let s=this.state().defaultPriceScale();if(this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==e.clientX||this._startScrollingPos.y!==e.clientY))return i.beginUndoMacro(yi),null===this._scrollXAnimation&&this._options.useKineticScroll&&(this._scrollXAnimation=new Kt(.2,7,.997,15),this._scrollXAnimation.addPosition(e.clientX,this._startScrollingPos.timestamp)),i.selection().isEmpty()||(s=i.selection().allSources()[0].priceScale()),null===s||s.isEmpty()||(this._scrollPriceScale=s,i.startScrollPrice(this.state(),s,e.localY)),i.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool(),void this._paneWidgetsSharedState.setScrollingPane(this);this._isScrolling&&(null!==this._scrollPriceScale&&i.scrollPriceTo(this.state(),this._scrollPriceScale,e.localY),i.scrollTimeTo(e.localX),null!==this._scrollXAnimation&&this._scrollXAnimation.addPosition(e.clientX,t))}_finishScroll(){const e=this._chartUndoModel();e.endScrollTime(),null!==this._scrollPriceScale&&e.endScrollPrice(this.state(),this._scrollPriceScale),e.endUndoMacro(),this._isScrolling=!1,this._startScrollingPos=null,this._scrollPriceScale=null,this.setCursorForTool(),this._paneWidgetsSharedState.setScrollingPane(null)}_endScroll(e){if(!this._isScrolling)return!1;this._finishScroll();const t=this._scrollUndoCommandInStack(),i=performance.now();return null!==this._scrollXAnimation&&(this._scrollXAnimation.start(e.clientX,i),this._scrollXAnimation.finished(i)||(this._chartModel().stopTimeScaleAnimation(),this._chartModel().setTimeScaleAnimation(this._scrollXAnimation),this._scrollXAnimation=null)),t}_preventScroll(){return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||(0,
oi.isLineToolName)(je.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint||this._preventScrollUntilNextMouseDownOrTouchStart}_isSelectPointModeEnabled(){return this._chartUndoModel().crossHairSource().selectPointMode().value()!==je.SelectPointMode.None}_preventCrossHairMove(){return!!this._trackCrosshairOnlyAfterLongTap&&(null===this._chart.trackingModePaneWidget()&&(!!this._contextMenuOpenedOnLastTap||!this._crossHairShouldBeVisible()&&null===this._startTrackPoint))}_finishTool(e,t=null){const i=this._chartUndoModel(),s=e.toolname;if(s===je.tool.value()&&(0,je.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),i.selectionMacro((i=>{i.addSourceToSelection(e,Ii(t,e))})),(0,J.isEditableTextLineTool)(e)&&e.activateEditingOnCreation())e.activateTextEditingOn(this._div,!0);else if((0,oi.isTextToolName)(s)){const t=i.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,K.TabNames.text,void 0,t)}this._lastFinishedToolId=e.id(),(0,l.emit)("drawing_event",e.id(),"create"),ni()}_alignSourcesThatBeingMoved(e,t,i,s,r){const n=this._chartUndoModel(),o=2===r?NaN:n.timeScale().coordinateToIndex(t);n.model().sourcesBeingMoved().forEach((e=>{var a;let l=o,c=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());if(null===c){if(1!==r)return;c=NaN}if((0,Z.isStudy)(e)){const e=n.mainSeries(),t=e.bars().firstIndex(),i=e.bars().lastIndex();null!==t&&null!==i&&2!==r&&(l=Math.min(Math.max(o,t),i)),1!==r&&(c=this._chartModel().magnet().align(c,o,this.state()))}null!==this._currentMovingHitTest&&void 0!==(null===(a=this._currentMovingHitTest.sourceAtPoint.hittest.data())||void 0===a?void 0:a.cursorType)||this.setCursorForTool(),n.moveSources({screen:new Oe.Point(t,i),logical:{index:l,price:c}},s)}))}_resetMeasureIfRequired(){this._needResetMeasureLater&&((0,je.resetToCursor)(),this._needResetMeasureLater=!1)}_makeSureIsUpdated(e){var t;const i=this.state(),s=[...i.dataSources(),...i.customSources()];for(const r of s){const s=r.paneViews(i);if(null!==s)for(const i of s)null===(t=i.makeSureIsUpdated)||void 0===t||t.call(i,e)}}_drawBackground(e,t){const i=this._chartModel(),s=i.backgroundTopColor().value(),r=i.backgroundColor().value();s===r?(0,z.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,r):(0,qe.clearRectWithGradient)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,s,r)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;if(!this.state().containsMainSeries())return;const s=i.paneViews();for(const i of s){e.save();const s=i.renderer(t);s&&s.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crossHairSource();i.invalidateLockPosition(),i.visible||null===je.crosshairLock.value()||i.updateAllViews((0,pi.sourceChangeEvent)(i.id())),this._drawSourceImpl(e,t,Ci,wi,i)}_drawActiveLineTools(e,t){const i=this._chartModel(),s=[i.lineBeingCreated(),i.lineBeingEdited(),...i.sourcesBeingMoved(),i.customSourceBeingMoved()].filter((e=>!!e));for(const r of s){(i.paneForSource(r)===this.state()||(0,
Ue.isDataSource)(r)&&r.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,Ci,wi,r)}}_drawTopViews(e,t){for(const i of this.state().sourcesByGroup().all())i.topPaneViews&&this._drawSourceImpl(e,t,Pi,wi,i)}_drawSources(e,t){const i=this.state(),s=i.model(),r=i.sourcesByGroup(),n=r.tradingSources(),o=r.generalSources(),a=r.phantomSources(),l=i.customSources(He.CustomSourceLayer.Background).slice(),c=i.customSources(He.CustomSourceLayer.Foreground).slice(),h=i.customSources(He.CustomSourceLayer.Topmost).slice(),d=s.activeStrategySource().value(),u=s.replayStudyStrategy().value();{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,Ci,wi,s.gridSource()),this._drawWatermark(e,t);for(const i of l)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of o)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of c)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of a)this._drawSourceImpl(e,t,Ci,bi,i);const p=new Set;[s.lineBeingCreated(),s.lineBeingEdited(),...s.sourcesBeingMoved(),s.customSourceBeingMoved()].filter(P.notNull).forEach((e=>p.add(e.id())));let _=s.hoveredSource();null!==_&&((0,Ue.isDataSource)(_)&&!_.showOnTopOnHovering()||p.has(_.id())||(0,Ue.isDataSource)(_)&&!o.includes(_)?_=null:p.add(_.id()));const m=s.selection().allSources().filter((e=>!((0,Ue.isDataSource)(e)&&!o.includes(e))&&!p.has(e.id())));m.forEach((e=>p.add(e.id())));for(const i of l)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of o)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of c)this._drawSourceImpl(e,t,Ci,wi,i,p);d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Ti,wi,d,p),u&&this._drawSourceImpl(e,t,Ti,wi,u,p);for(const i of n)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of h)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of o)this._drawSourceImpl(e,t,xi,wi,i,p);for(const i of c)this._drawSourceImpl(e,t,xi,wi,i,p);for(const i of n)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of h)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of m)this._drawSourceImpl(e,t,Ci,wi,i),i===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Ti,wi,d);for(const i of m)this._drawSourceImpl(e,t,xi,wi,i);_&&(this._drawSourceImpl(e,t,Ci,wi,_),_===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Ti,wi,d),this._drawSourceImpl(e,t,xi,wi,_));for(const i of a)this._drawSourceImpl(e,t,Ci,wi,i,p);{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].clearDrawingCaches()}}_drawSourceImpl(e,t,i,s,r,n){if(n&&n.has(r.id()))return;const o=i(r,this.state());if(o)for(const i of o){const r=i.renderer(t);r&&(e.save(),s(r,e,t),e.restore())}}_updateByThemedColors(){null!==this._legendWidget&&this._legendWidget.updateThemedColors(this._themedTopColor),null!==this._paneControls&&this._paneControls.updateThemedColors(this._themedTopColor)}_scrollUndoCommandInStack(){const e=this._chartUndoModel().undoHistory().undoStack();if(e.isEmpty())return!1;const t=e.head();if(!(t instanceof Ge.UndoMacroCommand))return!1;if(t.isEmpty())return!1;const i=t.commands()[0];return i instanceof ti||i instanceof Xt}_onStateDestroyed(){this.setState(null)}
_onDataSourcesCollectionChanged(){this._startMoveSourceParams=null}_processMouseEnterLeaveMoveHandlers(e,t){var i,s,r,n;if(null!==this._prevHoveredHittest&&(this._prevHoveredHittest.renderer!==(null==e?void 0:e.renderer)||(null===(i=this._prevHoveredHittest.hittest.data())||void 0===i?void 0:i.activeItem)!==(null===(s=e.hittest.data())||void 0===s?void 0:s.activeItem))){const e=this._sourceWasSelected(this._prevHoveredHittest);(0,We.tryCallHandler)(t,{sourceWasSelected:e},null===(r=this._prevHoveredHittest.hittest.data())||void 0===r?void 0:r.mouseLeaveHandler),this._prevHoveredHittest=null}if(!t.isTouch&&null!==e){const i=this._sourceWasSelected(e);(null===(n=this._prevHoveredHittest)||void 0===n?void 0:n.renderer)!==e.renderer&&(e.hittest.tryCallMouseEnterHandler(t,{sourceWasSelected:i}),this._prevHoveredHittest=e),e.hittest.tryCallMouseMoveHandler(t,{sourceWasSelected:i})}}_startChangeOrMoveLineToolIfNeeded(){if(null!==this._startChangeLineToolParams){const e=this._startChangeLineToolParams;this._chartUndoModel().startChangingLinetool(e.source,e.startPoint,e.pointIndex,e.envState)}if(null!==this._startMoveSourceParams){const e=this._startMoveSourceParams;this._chartUndoModel().startMovingSources(e.source,e.startPoint,e.activeItem,e.envState)}this._startMoveSourceParams=null,this._startChangeLineToolParams=null}_trackingModeShouldBeActive(){return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e,t){var i;let s=null;const r=this._chartModel();if(null!==e&&(s=e.isCustom?r.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==s){const e=this._lastClickedSource.id;let i=this._lastClickedSource.isCustom?r.customSourceForName(e):r.dataSourceForId(e);null!==i||this._lastClickedSource.isCustom||(i=r.dataSourceForId(e)),null!==i&&i.onClickOutside&&(i.onClickOutside((0,z.getBindingRenderingInfo)(this._canvasBinding),t),this._chartModel().updateSource(i))}this._lastClickedSource=null!==s?{id:s,isCustom:null!==(i=null==e?void 0:e.isCustom)&&void 0!==i&&i}:null}async showConfetti(e,t){0}_mouseClickOrTapEvent(e){var t;if(!this.hasState())return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i&&i.source,r=this._chartUndoModel(),o=Boolean(null===(t=null==i?void 0:i.hittest.data())||void 0===t?void 0:t.hideCrosshairLinesOnHover);this._processOutsideClick(i,e),!this._isSelectPointModeEnabled()||o||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||r.crossHairSource().trySelectCurrentPoint();const a=this._sourceWasSelected(i);null!==i&&i.hittest.tryCallClickOrTapHandler(e,{sourceWasSelected:a})&&r.model().updateSource((0,n.ensureNotNull)(s)),!e.isTouch||this._isSelectPointModeEnabled()||i&&i.source===r.crossHairSource()||this._tryExitTrackingMode(),s&&(0,J.isLineTool)(s)&&this._lastFinishedToolId!==s.id()&&(0,l.emit)("drawing_event",s.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e,t){var i,s,r,o,a,c,h;this._pressedMoveStage=1,
this._preventScrollUntilNextMouseDownOrTouchStart=!1,this._selectionBeforeMouseDown=new Set(this._chartModel().selection().allSources()),e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null;const d=this._chartModel();if(d.stopTimeScaleAnimation(),e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}(0,l.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),this._updateCommonTooltip(null);const u=this._chartUndoModel(),p=new ze.EnvironmentState(e);u.mainSeries().clearGotoDateResult();const _=this.state().defaultPriceScale();if(u.timeScale().isEmpty())return;const m=u.crossHairSource();if(!e.isTouch&&!(0,oi.isLineDrawnWithPressedButton)(je.tool.value())){const t=u.lineBeingCreated(),i=null!==t?u.model().paneForSource(t):null;null!==i&&i!==this._state?this._setCursorPositionOnExternalPane(i,e.localX,e.localY,p):this.setCursorPosition(e.localX,e.localY,p)}e.isTouch&&(0,oi.isLineToolName)(je.tool.value())&&((0,oi.isLineDrawnWithPressedButton)(je.tool.value())||null!==m.pane?(0,oi.isLineDrawnWithPressedButton)(je.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const g=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue();let f=null==g?null:_.coordinateToPrice(e.localY,g),v=d.timeScale().coordinateToIndex(e.localX);if(m.startMeasurePoint()&&m.endMeasurePoint()&&m.clearMeasure(),p.shift()&&(null===t||!(null===(s=null===(i=t.hittest.data())||void 0===i?void 0:i.hasOwnShortcutsBehaviourFor)||void 0===s?void 0:s.shiftKey))&&(0,je.toolIsCursor)(je.tool.value())&&u.selection().isEmpty()&&je.tool.setValue("measure"),(e.isTouch&&!e.stylus||null===f||!this._tryStartMeasure(e,m,p,f,v))&&(e.isTouch&&!e.stylus||!this._tryFinishMeasure(e,m))&&!(this._tryFinishZoom(e)||null!==f&&this._tryStartZoom(e,f,v,p))){if(e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=m.currentPoint(),this._startTrackPoint=new Oe.Point(e.localX,e.localY)):this._isSelectPointModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new Oe.Point(e.localX,e.localY),new Oe.Point(e.localX,e.localY),new ze.EnvironmentState(e))),e.isTouch&&(this._preventSourceChange=null===t||!u.selection().isSelected(t.source)),!this._isSelectPointModeEnabled()&&!this._isScrolling){if(e.isTouch&&!e.stylus&&((0,je.toolIsMeasure)(je.tool.value())||null!==m.measurePane().value()))return void this._initToolCreationModeParams(e);if(null!==f&&((0,oi.isLineToolName)(je.tool.value())||u.lineBeingCreated()))return p.shift()||u.selectionMacro((e=>e.clearSelection())),void this._mouseDownEventForLineTool(e,p,v,f)}
if(null!==t){const i=this._sourceWasSelected(t);t.hittest.tryCallMouseDownOrTouchStartHandler(e,{sourceWasSelected:i})}if(!this._chart.readOnly()){const i=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,p);if(null!==t&&!this._preventSourceChange){const i=t.hittest.data();if(t.isCustom){if(t.hittest.hasPressedMoveHandler(e))return u.model().setMovingCustomSource(t.source,i),this._preventScrollUntilNextMouseDownOrTouchStart=!0,this._currentMovingHitTest={sourceAtPoint:t,cancelledContainer:null!==(r=u.model().customSourceMovingHitTestData())&&void 0!==r?r:void 0},void u.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,n.ensureNotNull)(t.source),(0,n.ensureNotNull)(i))}))}else if((null==i?void 0:i.areaName)===We.AreaName.SourceItemMove){const s=null==i?void 0:i.activeItem;if(void 0!==s)return u.startCustomMoving(t.source,s,e),this._currentMovingHitTest={sourceAtPoint:t},void u.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,n.ensureNotNull)(t.source),(0,n.ensureNotNull)(i))}))}}if(null!==t&&this._tryHandleEraserMouseDown(t,p))return;const s=null!==t&&(0,J.isLineTool)(t.source)&&t.source.isLocked&&t.source.isLocked();if(!((0,je.lockDrawings)().value()||s)&&null!==t&&!t.isCustom){if(!t.source.userEditEnabled())return;const s=null===(o=t.hittest.data())||void 0===o?void 0:o.snappingPrice,r=null===(a=t.hittest.data())||void 0===a?void 0:a.snappingIndex;let l=e.localY,h=e.localX;if(void 0!==s&&null!==g&&(l=(0,n.ensure)(null===(c=t.source)||void 0===c?void 0:c.priceScale()).priceToCoordinate(s,g),f=s),void 0!==r&&(h=d.timeScale().indexToCoordinate(r),v=r),l===e.localY&&h===e.localX||(e={...e,localY:l,localX:h},this.setCursorPosition(e.localX,e.localY,p)),this._tryStartChangingLineTool(e,t,p,v))return void(this._currentChangingLineToolHitTest=t);if(this._currentChangingLineToolHitTest=null,(y=t.hittest.target())===We.HitTarget.MovePoint||y===We.HitTarget.MovePointBackground&&(0,ye.lastMouseOrTouchEventInfo)().isTouch){if(this._tryStartCloning(e,t,p,i))return;if(this._tryStartMovingLineTool(e,t,p,v))return void(this._currentMovingHitTest={sourceAtPoint:t});this._currentMovingHitTest=null}}if(null!==t&&(0,si.isPriceDataSource)(t.source)&&t.source.isDraggable()&&(null===(h=this._state)||void 0===h?void 0:h.hasDataSource(t.source))&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this))return}var y;null!==t&&t.hittest.target()===We.HitTarget.Regular||(this._processing=!0)}}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;this._pressedMoveStage=0;const s=e.isTouch&&null!==this._startTrackPoint,r=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null;const o=this._chartUndoModel(),a=o.model().customSourceMovingHitTestData();null!==a||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1
;const c=o.model(),h=c.crossHairSource(),d=this._dataSourceAtPoint(e.localX,e.localY);if(h.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(h.selection(),(0,z.getBindingRenderingInfo)(this._canvasBinding));o.selectionMacro((t=>{let i=null;e.forEach((e=>{null===i&&(i=Ii(d,e)),t.addSourceToSelection(e,i)}))})),h.clearSelection(),(0,u.trackEvent)("GUI","Multiselect","Area Select")}(0,l.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const p=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const _=new ze.EnvironmentState(e),m=je.tool.value();if(e.isTouch&&((0,je.toolIsMeasure)(m)||null!==h.measurePane().value())){if(!p&&!e.stylus&&null===h.measurePane().value()&&h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY);if(!p&&!e.stylus&&this._tryStartMeasure(e,h,_,h.price,h.index))return;if((!p||e.stylus)&&this._tryFinishMeasure(e,h))return}if(e.isTouch&&!p&&!(0,oi.isLineDrawnWithPressedButton)(m)&&(0,oi.isLineToolName)(m)&&!o.lineBeingCreated()){if(this._chart.justActivated())return;if(h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY,_);const i=h.currentPoint(),s=this.state().defaultPriceScale(),r=(0,n.ensure)(null===(t=this.state().mainDataSource())||void 0===t?void 0:t.firstValue()),a={index:Math.round(o.timeScale().coordinateToIndex(i.x)),price:s.coordinateToPrice(i.y,r)},l=(0,n.ensureNotNull)(o.createLineTool({pane:this.state(),point:a,linetool:m}));return o.selectionMacro((e=>{e.addSourceToSelection(l)})),o.lineBeingCreated()||(this._finishTool(l,d),e.preventDefault()),void(this._startTouchPoint=null)}const g=o.lineBeingCreated();if(g&&!(0,oi.isLineDrawnWithPressedButton)(g.toolname)&&e.isTouch&&(this._startTouchPoint||e.stylus)){if(this._startTouchPoint=null,!p||e.stylus){const t=g.points()[g.points().length-1],i=o.continueCreatingLine({index:t.index,price:t.price},new ze.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(g,d),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,o.customMoveBeingProcessed())return void o.endCustomMoving();if(null!==a){if(a.beingMoved&&!a.cancelled){const t=this._sourceWasSelected(d);(0,We.tryCallHandler)(e,{sourceWasSelected:t},a.mouseUpHandler,a.touchEndHandler),this.setCursorForTool()}if(c.setMovingCustomSource(null,null),Vi(e,a))return}if(c.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if((0,oi.isLineDrawnWithPressedButton)(m)&&!this._isSelectPointModeEnabled()){const t=o.lineBeingCreated();null!==t&&(ni(),t.finish(),"LineToolBrush"===t.toolname&&(0,l.emit)("drawing_event",t.id(),"create"));const s=this.state().defaultPriceScale();if(s.isEmpty())return;if(!t)return;const r=(0,n.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),a=s.coordinateToPrice(e.localY,r),c={
index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:a};return void o.continueCreatingLine(c)}if(c.sourcesBeingMoved().length)return o.endMovingSource(!1,!1),c.sourcesBeingMoved().filter(J.isLineTool).forEach((e=>{this.setCursorForTool(e)})),void c.invalidate(ve.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=e.localX>=0&&e.localXWe.HitTarget.MovePointBackground||(0,ye.lastMouseOrTouchEventInfo)().isTouch)&&o.selectionMacro((e=>{e.clearSelection();const t=(0,n.ensureNotNull)(d.source);e.addSourceToSelection(t,Ii(d,t))})),e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._resetMeasureIfRequired();const t=this._dataSourceAtPoint(e.localX,e.localY);this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const s=e.localX,r=e.localY;this._prevMoveEventPosition=new Oe.Point(s,r);const n=new ze.EnvironmentState(e);if(null===this._firstZoomPoint){if(this._updateHoveredSource(t,n,e),!e.isTouch&&i.lineBeingCreated()){const e=i.lineBeingCreated(),t=null===e?null:i.model().paneForSource(e);if(null!==t&&t!==this._state)return void this._setCursorPositionOnExternalPane(t,s,r,n)}e.isTouch||this.setCursorPosition(s,r,n)}else this._processMouseMoveWhileZoom(e,n)}_pressedMouseOrTouchMoveEvent(e){var t,i;if(!this.hasState()||this._pinching||e.isTouch&&this._contextMenuOpenedOnLastTap)return;this._pressedMoveStage=2,this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const s=new ze.EnvironmentState(e),r=this._chartUndoModel(),o=r.crossHairSource(),a=e.localX,l=e.localY;if(this._prevMoveEventPosition=new Oe.Point(a,l),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const c=je.tool.value();if(e.isTouch&&this._startTouchPoint&&(0,oi.isLineToolName)(c)&&!(0,
oi.isLineDrawnWithPressedButton)(c)&&!r.lineBeingCreated()&&!this._isSelectPointModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const h=o.measurePane().value();if(e.isTouch&&(this._startTouchPoint||e.stylus)&&((0,je.toolIsMeasure)(c)||null!==h))return void(e.stylus?this.setCursorPosition(e.localX,e.localY,new ze.EnvironmentState(e)):this._updateCrosshairPositionInToolCreationMode(e,h||this.state()));const d=r.lineBeingCreated();if(e.isTouch&&!e.stylus&&d&&!(0,oi.isLineDrawnWithPressedButton)(d.toolname)){if(this._startTouchPoint){const t=(0,n.ensureNotNull)(r.lineBeingCreated()),i=(0,n.ensureNotNull)(r.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=(0,n.ensureNotNull)(this._initCrossHairPosition),t=new Oe.Point(a,l).subtract(this._startTrackPoint),i=e.add(t);this.setCursorPosition(i.x,i.y,s)}else e.isTouch&&this._preventCrossHairMove()||this.setCursorPosition(a,l,s);const u=this._isSelectPointModeEnabled();if((0,oi.isLineToolName)(c)&&!(0,oi.isLineDrawnWithPressedButton)(c)&&!u&&!s.mod())return;if((0,oi.isLineDrawnWithPressedButton)(c)&&!u){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const s=r.lineBeingCreated();if(!s)return;const o=new Oe.Point(e.localX,e.localY),a=(0,n.ensure)(null===(t=s.ownerSource())||void 0===t?void 0:t.firstValue());return o.price=i.coordinateToPrice(e.localY,a),o.index=Math.round(r.timeScale().coordinateToIndex(e.localX)),void r.continueCreatingLine(o)}if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(r.timeScale().isEmpty())return;const p=this._options.handleScroll;if((!p.pressedMouseMove||e.isTouch)&&(!p.horzTouchDrag&&!p.vertTouchDrag||!e.isTouch))return;if(r.customMoveBeingProcessed())return void r.processCustomMove(e);const _=r.model().customSourceMovingHitTestData();if(null!==_&&(this._updateCommonTooltip(null,!0),_.cancelled||(r.model().processingCustomSourceMove(),(0,We.tryCallHandler)(e,{sourceWasSelected:this._selectionBeforeMouseDown.has(r.model().customSourceBeingMoved())},_.pressedMouseMoveHandler,_.touchMoveHandler)),Vi(e,_)))return;if(r.model().lineBeingEdited())return void this.setCursorPosition(a,l,s);if(r.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(r.model().sourcesBeingMoved(),e.localX,e.localY,s,null===(i=r.model().lastHittestData())||void 0===i?void 0:i.possibleMovingDirections);const m=this._dataSourceAtPoint(e.localX,e.localY);if(this._tryFinishClonning(e,new ze.EnvironmentState(e),m))return;const g=(0,je.toolIsMeasure)(c)||o.startMeasurePoint()&&o.endMeasurePoint();this._chart.readOnly()||!s.mod()||(0,oi.isLineToolName)(c)||g||u?(this._processScroll(e),
this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this.setCursorPosition(e.localX,e.localY,new ze.EnvironmentState(e))):this._isSelecting||(o.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){var t;if(!this.hasState())return;const i=this._chartUndoModel();if(!i)return;const s=i.crossHairSource();e.isTouch||null!==s.measurePane().value()&&null===s.endMeasurePoint()||this._clearCursorPosition();if(this._chartModel().setHoveredSource(null,null),null!==this._prevHoveredHittest){const i=this._sourceWasSelected(this._prevHoveredHittest);(0,We.tryCallHandler)(e,{sourceWasSelected:i},null===(t=this._prevHoveredHittest.hittest.data())||void 0===t?void 0:t.mouseLeaveHandler),this._prevHoveredHittest=null}this._updateCommonTooltip(null),this._chart.unsetActivePaneWidget()}_mouseDoubleClickOrDoubleTapEvent(e){if(!this.hasState())return;const t=!this._chart.readOnly()&&!(0,oi.isLineToolName)(je.tool.value())&&this._dataSourceAtPoint(e.localX,e.localY)||null,i=this._sourceWasSelected(t);if(null!==t&&t.isCustom)t.hittest.tryCallDblClickOrDblTapHandler(e,{sourceWasSelected:i});else if(null!==t&&(e.isTouch||t.hittest.target()>We.HitTarget.MovePointBackground))t.hittest.tryCallDblClickOrDblTapHandler(e,{sourceWasSelected:i})&&!(0,We.shouldDefaultActionBeExecuted)(e,(0,n.ensureNotNull)(t.hittest.data()),"doubleClickHandler","doubleTapHandler")||this.processDoubleClickOnSource(t.source,t.hittest?t.hittest:void 0);else if(!this._chart.readOnly()&&!(0,oi.isLineToolName)(je.tool.value())&&!this._chartUndoModel().lineBeingCreated()&&this._chartUndoModel().selection().isEmpty()){const t=this.state();new ze.EnvironmentState(e).mod()&&!t.maximized().value()?(t.collapsed().value()||this._chartModel().paneCollapsingAvailable().value())&&this._chartUndoModel().toggleCollapsedPane(this.state()):this._chart.toggleMaximizePane(this)}}_contextMenuEvent(e){const t=this._chartUndoModel();if(t.crossHairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return t.crossHairSource().clearMeasure(),void(0,je.resetToCursor)(!0);if(this._pinching)return;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,je.toolIsCursor)(je.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,je.resetToCursor)(!0),this.setCursorForTool(),void(t.lineBeingCreated()&&t.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i?i.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const r=i&&i.hittest?i.hittest.target():0,n=r>=We.HitTarget.Regular||r>=We.HitTarget.MovePointBackground&&e.isTouch;if(this._chart.updateActions(),t.selectionMacro((t=>{null!==s&&n?t.selection().isSelected(s)||(t.clearSelection(),
t.addSourceToSelection(s,Ii(i,s))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())})),null!==i&&n&&null!==s)if((0,Ue.isDataSource)(s)&&s.hasContextMenu())s.isSelectionEnabled()?this.showContextMenuForSelection(e,void 0,i.hittest):this.showContextMenuForSources([s],e,void 0,void 0,i.hittest);else{const t=this._sourceWasSelected(i);i.hittest.tryCallContextMenuHandler(e,{sourceWasSelected:t})}}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crossHairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new Oe.Point(e.localX,e.localY),new Oe.Point(i.x,e.localY),new ze.EnvironmentState(e))}}async _showContextMenu(e){const t=e=>e instanceof ht.Separator,i=this._customActions(),s=(await this._initActions(e)).filter((e=>null!==e));i.remove.forEach((e=>{for(let t=0;t0;e--)t(r[e])&&t(r[e-1])&&r.splice(e,1);r.length&&t(r[0])&&r.splice(0,1),r.length&&t(r[r.length-1])&&r.splice(r.length-1,1),Ze.ContextMenuManager.showMenu(r,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}async _initActions(e){var t;const i=this._chart.actions(),s=[];if(this._chart.model().model().resetScalesAvailable().value()&&(s.push(i.chartReset),s.push(new ht.Separator)),!this.state().isEmpty()&&N.enabled("datasource_copypaste")){const t=(0,mt.createActionCopyPrice)(this.state(),e.localY),i=(0,mt.createPasteAction)(this._chart,this.state());(t||i)&&(t&&s.push(t),i&&s.push(i),s.push(new ht.Separator))}s[s.length-1]instanceof ht.Separator||s.push(new ht.Separator);return Boolean(null===(t=window.widgetbar)||void 0===t?void 0:t.widget("watchlist"))&&i.addToWatchlist&&s.push(i.addToWatchlist),N.enabled("text_notes")&&s.push(i.addToTextNotes),s[s.length-1]instanceof ht.Separator||s.push(new ht.Separator),s.push(this._createLockTimeAxisAction(e)),s.push(new ht.Separator),!N.enabled("charting_library_base")&&i.applyColorTheme&&s.push(i.applyColorTheme),s[s.length-1]instanceof ht.Separator||s.push(new ht.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(s.push(i.applyStudiesToAllCharts),s.push(new ht.Separator)),s.push(i.paneRemoveAllDrawingTools),s.push(i.paneRemoveAllStudies),s.push(new ht.Separator),s.push(i.hideAllMarks),s.push(new ht.Separator),N.enabled("show_chart_property_page")&&s.push(i.chartProperties),s[s.length-1]instanceof ht.Separator&&s.pop(),s}_loadAndCreateLegendWidget(){Promise.all([i.e(2364),i.e(5514),i.e(1729),i.e(8073),i.e(3547),i.e(2153),i.e(2227),i.e(5715),i.e(5093)]).then(i.bind(i,8855)).then((e=>{if(this._isDestroyed)return;const t=e.LegendWidget,i=(0,Fe.deepExtend)({},this._options.legendWidget)
;i.canShowSourceCode=!this._chart.onWidget()&&!c.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled,pineSourceStatusEnabled:this._options.pineSourceStatusEnabled};const s=(0,V.combine)(((e,t)=>ki&&this._chart!==e&&!t),this._chart.chartWidgetCollection().activeChartWidget.weakReference(),this._chart.chartWidgetCollection().lock.crosshair.weakReference()),r=(0,V.combine)(((e,t)=>null!==e?e===this._state:(0,je.toolIsMeasure)(t)),this._chartModel().crossHairSource().measurePane().weakReference(),je.tool.weakReference());this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme().spawnOwnership(),s.ownership(),this._visuallyCollapsed.spawnOwnership(),r.ownership(),i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),updateActions:this._chart.updateActions.bind(this._chart),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart),onLegendRowFocused:()=>{this._chart.chartWidgetCollection().activeChartWidget.setValue(this._chart)}}),this._div.appendChild(this._legendWidget.getElement()),this._legendWidget.updateLayout(),this._legendWidget.updateWidgetModeBySize(this._size),this._legendWidget.updateThemedColors(this._themedTopColor);for(const e of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(e,(0,n.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))}))}_loadAndCreatePaneControlsWidget(){Promise.all([i.e(2364),i.e(5514),i.e(1729),i.e(8073),i.e(3547),i.e(2153),i.e(2227),i.e(5715),i.e(5093)]).then(i.bind(i,61560)).then((e=>{var t;if(this._isDestroyed)return;const i=e.PaneControlsWidget;this._paneControls=new i(this._chartUndoModel(),this,{backgroundThemeName:this._chart.backgroundTopTheme()},{toggleMaximizePane:this._chart.toggleMaximizePane.bind(this._chart)},this._div),this._paneControls.updateWidgetModeByWidth(this._size.width),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new ResizeObserver(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement()),(null===(t=this._state)||void 0===t?void 0:t.collapsed().value())&&this._chartModel().fullUpdate()}))}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+mi+gi;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){
this._chart.isActive().value()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive().value()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift(ze.EnvironmentState.create((0,U.shiftPressed)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&(0,oi.isLineToolName)(je.tool.value())&&t.crossHairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?(je.isStudyEditingNow.value()&&this.setCursorPosition(t,i,e),this._alignSourcesThatBeingMoved(s,t,i,e)):this.setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&e.userEditEnabled())if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(K.TabNames.symbol);else if((0,J.isLineTool)(e)||(0,Z.isStudy)(e)){let i;const s=null==t?void 0:t.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=Li.get(e))}this._chart.showChartPropertiesForSource(e,i).then((e=>{this._editDialog=e}))}}_initToolCreationModeParams(e){this._startTouchPoint=new Oe.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crossHairSource();this._chart.justActivated()&&(this._initCrossHairPosition=i.currentPoint());const s=e.pageX,r=e.pageY,o=(0,n.ensureNotNull)(this._initCrossHairPosition),a=new Oe.Point(s,r).subtract((0,n.ensureNotNull)(this._startTouchPoint)),l=o.add(a);this.setCursorPosition(l.x,l.y,new ze.EnvironmentState(e))}_priceAxisesContainer(e){return"left"===e?this._lhsPriceAxisesContainer:this._rhsPriceAxisesContainer}_recalculatePriceScales(e){const t=this.state();for(const i of t.leftPriceScales())t.recalculatePriceScale(i,e);for(const i of t.rightPriceScales())t.recalculatePriceScale(i,e);for(const i of t.sourcesByGroup().overlayPriceScaleSources())(0,J.isLineTool)(i)||t.recalculatePriceScale(i.priceScale(),e)}_createLockTimeAxisAction(e){var t;const i=0===(null===(t=je.crosshairLock.value())||void 0===t?void 0:t.type);return new ht.Action({actionId:"Chart.Crosshair.LockVerticalCursor",options:{label:Si,statName:"LockCursorInTime",checkable:!0,checked:i,onExecute:()=>this._toggleLockTimeAxis(e.localX,!i)}})}_toggleLockTimeAxis(e,t){if(t){const t=this._chartUndoModel().timeScale(),i=t.coordinateToIndex(e),s=t.points().roughTime(i)
;if(null!==s)return void je.crosshairLock.setValue({type:0,time:s})}je.crosshairLock.setValue(null)}_preventTouchEventsExceptPinch(){return this._paneWidgetsSharedState.hasTouchesOnOtherPanes(this)||null!==this._paneWidgetsSharedState.pinchingPane()}_updateHoveredSource(e,t,i){var s,r;const n=this._chartUndoModel(),o=n.model();let a=!1;const l=e&&e.source,c=this._chart.readOnly();if(o.crossHairSource().isReplaySelection())this._setCursorClassName("none");else if(!(!c||e&&(0,J.isLineTool)(e.source))||this._editDialog&&this._editDialog.visible().value())c&&(o.setHoveredSource(null,null),this.setCursorForTool());else{const h=je.tool.value();let d=null;if(!this._processing&&((0,je.toolIsCursor)(h)||"eraser"===h&&!c||t.mod()||!n.lineBeingCreated())){const t=null==e?void 0:e.hittest;a=Boolean(null===(s=null==t?void 0:t.data())||void 0===s?void 0:s.hideCrosshairLinesOnHover),t&&t.target()>We.HitTarget.MovePointBackground?(d=l,!(null==l?void 0:l.isHoveredEnabled())||"eraser"===h&&l===n.mainSeries()?o.setHoveredSource(null,null):o.setHoveredSource(l,t.data(),0)):o.setHoveredSource(null,null)}c?this.setCursorForTool(d,t,ai.PaneCursorType.Default):this._options.sourceSelectionEnabled&&(this._isSelectPointModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(d,t,null===(r=null==e?void 0:e.hittest.data())||void 0===r?void 0:r.cursorType));const u=o.customSourceBeingMoved(),p=null!==u?[u]:o.sourcesBeingMoved();if((!p.length||null!==e&&-1===p.indexOf(e.source))&&this._updateCommonTooltip(e),!c&&null!==e&&i&&e.hittest.hasPressedMoveHandler(i)){switch((e.hittest.data()||{}).cursorType){case ai.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ai.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case ai.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ai.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),1!==this._pressedMoveStage&&o.crossHairSource().setLinesShouldBeHidden(a)}async _createErrorBlock(){const e=new(await ne());return this._div.insertBefore(e.container,this._topCanvasBinding.canvasElement.nextSibling),e}_customActions(){const e={top:[],bottom:[],remove:[]},t=this._chartUndoModel().timeScale(),i=this._state&&this._state.defaultPriceScale();if(!N.enabled("custom_items_in_context_menu"))return e;const s=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let r;if(i&&!i.isEmpty()){const e=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue();r=i.coordinateToPrice(this._contextMenuY,(0,n.ensureNotNull)(e))}return(0,l.emit)("onContextMenu",{unixtime:null!=s?s.getTime()/1e3:void 0,price:r,callback:t=>{[...t].forEach((t=>{if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{let i;i="-"===t.text?new ht.Separator:new ht.Action({actionId:"Chart.ExternalActionId",options:{label:t.text,onExecute:t.click}}),t.position&&"top"===t.position?e.top.push(i):e.bottom.push(i)}}))}}),e}
_highlightPriceAxisByLabel(e){this._lhsPriceAxisesContainer.highlightPriceAxisByLabel(e),this._rhsPriceAxisesContainer.highlightPriceAxisByLabel(e)}_subscribeToState(){const e=this.state();e.onDestroyed().subscribe(this,this._onStateDestroyed,!0),e.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),e.maximized().subscribe(this._updateVisuallyCollapsed),e.collapsed().subscribe(this._updateVisuallyCollapsed)}_unsubscribeFromState(){const e=this.state();e.onDestroyed().unsubscribeAll(this),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.maximized().unsubscribe(this._updateVisuallyCollapsed),e.collapsed().unsubscribe(this._updateVisuallyCollapsed)}_updateAccesibilityAttr(){if(this.state().isMainPane()){const e=this._chartModel().mainSeries(),t=e.symbol(),s=(0,ui.getTranslatedResolutionModel)(e.interval()).hint,r=a.t(null,{replace:{symbol:t,interval:s}},i(1136));this._topCanvasBinding.canvasElement.setAttribute("aria-label",r)}else this._topCanvasBinding.canvasElement.setAttribute("aria-hidden","true")}async _updateEndOfSeriesBanner(){}}class Ni{constructor(){this._draggingSource=null,this._activeTouchPanes=new Set,this._scrollingPane=null,this._pinchingPane=null}onPaneDestroyed(e){this._activeTouchPanes.delete(e),this._scrollingPane===e&&(this._scrollingPane=null),this._pinchingPane===e&&(this._pinchingPane=null)}startTouch(e){this._activeTouchPanes.add(e)}endTouch(e){this._activeTouchPanes.delete(e)}hasTouchesOnOtherPanes(e){return this._activeTouchPanes.size>1||1===this._activeTouchPanes.size&&!this._activeTouchPanes.has(e)}trySetDraggingSource(e,t){return!this.hasTouchesOnOtherPanes(t)&&((0,n.assert)(null===this._draggingSource||this._draggingSource===e),this._draggingSource=e,!0)}clearDraggingSource(){null!==this._draggingSource&&(this._draggingSource=null)}draggingSource(){return this._draggingSource}setScrollingPane(e){(0,n.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,n.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}var Oi,Fi=i(55158),Wi=i(95700);i(8406);!function(e){e[e.BorderSize=1]="BorderSize",e[e.OffsetSize=5]="OffsetSize"}(Oi||(Oi={}));const Hi={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0},zi=new W.TranslatedString("change session",a.t(null,void 0,i(87041))),Ui=a.t(null,void 0,i(94031));class ji{constructor(e,t,i,r,n){this._rendererOptions=null,this._onLabelHovered=new R.Delegate,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,P.merge)((0,P.clone)(Hi),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("div"),this._element.style.display="flex",this._backgroundBasedTheme=n;const o=e.model().model().rendererOptionsProvider(),a=()=>this.backgroundColor(),l=()=>{throw new Error("Time axis does not support real price scales")},c={titlesProvider:i,
stubContextMenuProvider:(e,t)=>{const i=r(e,t),s=this.getContextMenuActions(!0);return 0===s.length?i:i.concat(new ht.Separator,s)},backgroundBasedTheme:n.spawnOwnership(),onActiveOrHoveredChart:(0,V.combine)(((e,t)=>e||t),this.chart.isActive().weakReference(),this.chart.isHovered().weakReference()).ownership(),rendererOptionsProvider:o,getBackgroundTopColor:a,getBackgroundBottomColor:a,requestRepaint:()=>this.chart.model().model().lightUpdate(),showHorizontalBorder:!0};this._lhsStubContainer=new nt(this._properties,"left",l,c,this._options.priceAxisLabelsOptions,this),this._lhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._rhsStubContainer=new nt(this._properties,"right",l,c,this._options.priceAxisLabelsOptions,this),this._rhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("div"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=(0,z.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._canvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this._topCanvasBinding=(0,z.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const d=this._topCanvasBinding.canvasElement;d.style.position="absolute",d.style.zIndex="2",d.style.left="0",d.style.top="0",this._dv.setAttribute("aria-hidden","true"),this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=Fi.MINUTE_SPAN,this._mouseEventHandler=new ke.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1}),this.size=(0,s.size)({width:0,height:0}),(0,je.hideMarksOnBars)().subscribe(this,(()=>this.chart.model().model().lightUpdate()))}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._rhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.destroy(),this._rhsStubContainer.destroy(),this.chart.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._backgroundBasedTheme.release(),(0,
je.hideMarksOnBars)().unsubscribeAll(this)}setCursor(e){let t="";"grabbing"!==e&&"ew-resize"!==e||(t="time-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}restoreDefaultCursor(){this.setCursor("")}getElement(){return this._element}optimalHeight(){const e=this.rendererOptions();return Math.ceil(e.borderSize+e.offsetSize+e.fontSize+e.paddingTop+e.paddingBottom+e.labelBottomOffset)}setSizes(e,t,i){this.size&&(0,s.equalSizes)(this.size,e)||(this.size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._cell.style.width=e.width+"px",this._cell.style.height=e.height+"px"),this._lhsStubContainer.setSizes(e.height,t),this._rhsStubContainer.setSizes(e.height,i)}rendererOptions(){if(!this._rendererOptions||this._rendererOptions.fontSize!==this.fontSize()){const e=this.fontSize();this._rendererOptions={borderSize:1,offsetSize:5,fontSize:e,font:(0,$e.makeFont)(e,Je.CHART_FONT_FAMILY,""),widthCache:new Ye.TextWidthCache,paddingTop:3*e/12,paddingBottom:3*e/12,paddingHorizontal:9*e/12,labelBottomOffset:4*e/12}}return this._rendererOptions}backgroundColor(){return this.chart.model().model().backgroundColor().value()}lineColor(){const e=this._properties.childs().lineColor.value();if(0===(0,Ae.parseRgba)(e)[3]){const e=this.chart.model().model().lastPane();if(e&&(e.collapsed().value()||e.isMainPane()&&this._areEventsEnabled()))return this.chart.properties().childs().paneProperties.childs().separatorColor.value()}return e}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,$e.makeFont)(this.fontSize(),Je.CHART_FONT_FAMILY)}baseBoldFont(){return(0,$e.makeFont)(this.fontSize(),Je.CHART_FONT_FAMILY,"","bold")}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}onLabelHovered(){return this._onLabelHovered}getScreenshotData(){return{content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,contentWidth:this.size.width,contentHeight:this.size.height,lhsStub:this._lhsStubContainer.getScreenshotData(),rhsStub:this._rhsStubContainer.getScreenshotData()}}getContextMenuActions(e){var t;const i=this.chart;i.updateActions();const s=i.actions(),r=[];if(e||(i.model().timeScale().resetAvailable().value()&&(r.push(s.timeScaleReset),r.push(new ht.Separator)),this._options.timezoneMenuEnabled&&r.push(s.applyTimeZone),r.push(s.sessionBreaks)),!i.model().mainSeries().isDWM()){const e=null===(t=i.model())||void 0===t?void 0:t.mainSeries().symbolInfo();if(e){const t=i.model().mainSeries().properties().childs().sessionId,s=(e.subsessions||[]).filter((e=>!e.private));if(s.length>1){const e=s.map((e=>new ht.Action({actionId:"Chart.SetSession",options:{label:(0,Wi.translateSessionDescription)(e.description),checkable:!0,checked:t.value()===e.id,statName:"SetSession",
onExecute:()=>{i.model().setProperty(t,e.id,zi)}}}))),n=new ht.Action({actionId:"Chart.SetSession",options:{label:Ui,statName:"SetSession",subItems:e}});r.push(n)}}}return!i.onWidget()&&N.enabled("show_chart_property_page")&&N.enabled("chart_property_page_scales")&&s.scalesProperties&&r.push(new ht.Separator,s.scalesProperties),r}update(){if(!this.chart.hasModel())return;const e=this.chart.model().timeScale().marks();if(e){this._minVisibleSpan=Fi.YEAR_SPAN;for(const t of e)this._minVisibleSpan=Math.min(t.span,this._minVisibleSpan)}}updatePriceAxisStubs(){const e=this.chart.model().model(),t=this.chart.isMaximizedPane()?(0,n.ensureNotNull)(this.chart.maximizedPaneWidget()).state():e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount();this._lhsStubContainer.setScales([],i.left,t.leftPriceScales().length,i.left+i.right),this._rhsStubContainer.setScales([],i.right,t.rightPriceScales().length,i.left+i.right)}paint(e){if(e===ve.InvalidationLevel.None||0===this.size.width||0===this.size.height)return;(0,z.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,z.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const t=(0,z.getContext2D)(this._topCanvasBinding.canvasElement);if(e>ve.InvalidationLevel.Cursor){const i=(0,z.getContext2D)(this._canvasBinding.canvasElement),s=(0,z.getBindingRenderingInfo)(this._canvasBinding);this.drawBackground(i,s),this.chart.hasModel()&&(this.drawBorder(i,s),this.drawTickMarks(i,s),this.drawBackLabels(i,s),this.drawCrossHairLabel(t,s)),this._lhsStubContainer.paintStubs(e),this._rhsStubContainer.paintStubs(e)}this.drawCrossHairLabel(t,(0,z.getBindingRenderingInfo)(this._topCanvasBinding))}drawBackground(e,t){if((0,z.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,this.backgroundColor()),!this.chart.hasModel())return;const i=this.chart.model();if(!i.timeScale().isEmpty()){const s=i.model().selection().lineDataSources().reduce(((e,t)=>{const i=t.timeAxisPoints();return 0===i.length?e:e.concat(i)}),[]);s.length>0&&this._highlightBackground(e,s,t)}const s=i.model().crossHairSource();s.startMeasurePoint()&&this._highlightBackground(e,s.measurePoints(),t)}drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t.verticalPixelRatio)),s=t.bitmapSize.width;e.fillRect(0,0,s,i),e.restore()}drawTickMarks(e,t){const i=this.chart.model().timeScale().marks();if(!i||0===i.length)return;let s=i.reduce(((e,t)=>e.span>t.span?e:t),i[0]).span;s>30&&s<40&&(s=30),e.save(),e.strokeStyle=this.lineColor();const r=this.rendererOptions(),n=r.borderSize+r.offsetSize+r.paddingTop+r.fontSize/2;e.textAlign="center",e.textBaseline="middle",e.fillStyle=this.textColor(),(0,z.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{e.font=this.baseFont();for(let t=0;t=s&&e.fillText(r.label,r.coord,n)}})),e.restore()}drawBackLabels(e,t){var i;e.save()
;const s=new Set,r=this.chart.model().model();let n=r.dataSources();const o=r.selection().allSources();for(const e of o)s.add(e);r.hoveredSource()&&s.add(r.hoveredSource());for(const e of r.sourcesBeingMoved())s.add(e);const a=r.customSourceBeingMoved();null!==a&&s.add(a);const l=null!==(i=r.lineBeingEdited())&&void 0!==i?i:r.lineBeingCreated();l&&s.add(l),s.add(this.chart.model().crossHairSource()),n=n.concat(r.customSources());const c=this.rendererOptions();for(let i=0;i=s&&(s=a,n=o),a<=i&&(i=a,r=o)}}return n&&t.push(n),r&&t.push(r),t}_zoomAvailable(){return!this.chart.model().timeScale().isEmpty()&&this.chart.model().model().zoomEnabled()&&this._options.pressedMouseMoveScale}_mouseDownOrTouchStartEvent(e){if(this._mousedown||!this._zoomAvailable())return;this._mousedown=!0;const t=this.chart.model();t.timeScale().isEmpty()||t.startScaleTime(e.localX)}_pressedMouseOrTouchMoveEvent(e){this._zoomAvailable()&&this.chart.model().scaleTimeTo(e.localX)}_mouseUpOrTouchEndEvent(e){this._zoomAvailable()&&(this._mousedown=!1,this.chart.model().endScaleTime(),this.restoreDefaultCursor())}_contextMenuOrTouchContextMenuEvent(e){this._options.contextMenuEnabled&&Ze.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"TimeScaleContextMenu"},{menuName:"TimeScaleContextMenu"})}_mouseOrTouchEnterEvent(e){this._zoomAvailable()&&this.setCursor("ew-resize")}_mouseOrTouchLeaveEvent(e){this.restoreDefaultCursor()}_mouseDoubleClickOrDoubleTapEvent(e){(0,u.trackEvent)("GUI","Double click time scale"),this.chart.model().resetTimeScale()}_areEventsEnabled(){return!(0,je.hideMarksOnBars)().value()}}var Gi=i(85459),qi=i.n(Gi),$i=i(78871),Ki=i(71885),Yi=i(68159),Zi=i(82783),Xi=i(85049);function Ji(e,t){return!!Xi.Interval.isEqual(e.res,t.res)&&(0,Zi.areEqualTimeFrames)(e.val,t.val)}var Qi=i(7611),es=i(31045),ts=i(86920),is=i(61119),ss=i(98272);const rs=new W.TranslatedString("toggle collapsed pane state",a.t(null,void 0,i(46054)));class ns extends Yt.UndoCommand{constructor(e,t){super(rs),this._chartModel=e,this._paneIndex=t}redo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}undo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}}const os=new W.TranslatedString("move all scales to left",a.t(null,void 0,i(64077))),as=new W.TranslatedString("move all scales to right",a.t(null,void 0,i(19013))),ls=(0,m.getLogger)("Chart.MergeAllScales");class cs extends Yt.UndoCommand{constructor(e,t,i,s,r,n){super(n),this._model=e,this._paneIndex=e.panes().indexOf(t),this._targetPosition=s,this._targetIndex=r,this._scaleId=i.id(),this._sourcePosition=t.priceScalePosition(i),"overlay"!==this._sourcePosition&&(this._sourceIndex=t.priceScaleIndex(i,this._sourcePosition))}redo(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._targetPosition,this._targetIndex),this._model.fullUpdate()}undo(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._sourcePosition,this._sourceIndex),this._model.fullUpdate()}}var hs=i(85719);class ds extends Yt.UndoCommand{constructor(e,t,i,s){super(s,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._createdIds=[],this._model=e,this._withoutShift=i,this._origStates=t.map((e=>e.state(!0)));const r=e.lineToolsGroupModel();this._origGroups=t.map((e=>{
const t=r.groupForLineTool(e);return t&&t.id}))}redo(){const e=this._model.lineToolsGroupModel(),t=this._origStates.map(((t,i)=>{const s=(0,n.ensureNotNull)(this._model.dataSourceForId(t.id)),r=0===this._createdIds.length?void 0:(0,n.ensureDefined)(this._createdIds[i]),o=(0,J.cloneLineTool)(this._model,s,!this._withoutShift,r);void 0!==t.sharingMode&&o.share(t.sharingMode);const a=(0,n.ensureNotNull)(s.priceScale());(0,n.ensureNotNull)(this._model.paneForSource(s)).addDataSource(o,a,!1);const l=this._origGroups[i];if(null!==l){const t=e.groupForId(l);t&&t.addLineTools([o])}return this._model.updateSource(o),o}));0===this._createdIds.length&&(this._createdIds=t.map((e=>e.id()))),this._model.selectionMacro((e=>{e.clearSelection(),t.forEach((t=>{e.addSourceToSelection(t)}))})),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=this._model.lineToolsGroupModel();this._createdIds.forEach((t=>{const i=(0,n.ensureNotNull)(this._model.dataSourceForId(t)),s=e.groupForLineTool(i);null!==s&&s.excludeLineTool(i),this._model.removeSource(i)}))}newIds(){return this._createdIds}}var us=i(74174),ps=i(70618),_s=i(300);class ms extends Yt.UndoCommand{constructor(e,t,i,s=!0){super(i,s,(0,_s.sourcesAffectState)(t)),this._newStates=[],this._model=e,this._savedStates=t.map((e=>e.state(!1)))}redo(){this._applyState(this._newStates)}undo(){0===this._newStates.length&&this.saveNewState(),this._applyState(this._savedStates)}saveNewState(){const e=this._savedStates.filter(P.notNull).map((e=>(0,n.ensureNotNull)(this._model.dataSourceForId(e.id))));this._newStates=e.map((e=>e.state(!1)))}_applyState(e){for(const t of e)if(null!==t){const e=this._model.dataSourceForId(t.id);if(null!==e)if((0,Z.isStudy)(e)){const i=t.state.inputs,s=e.properties().childs().inputs.childs();for(const e in i)s[e]&&s[e].setValue(i[e])}else this._model.restoreLineToolState(e,t,!0)}}}var gs=i(83520),fs=i(52967),vs=i(2718),ys=i(29137),Ss=i(69661),bs=i(98523);const ws=new W.TranslatedString("create {tool}",a.t(null,void 0,i(12898)));class Cs extends Ss.LineToolSynchronizeUndoCommand{constructor({model:e,pane:t,lineTool:i,ownerSource:s,drawOnAllChartsMode:r=0,id:n}){super(e,ws.format({tool:new W.TranslatedString(i,bs.lineToolsLocalizedNames[i])}),!1,!hs.lineToolsDoNotAffectChartInvalidation),this._lineId=null,this._lineState=null,this._paneIndex=e.panes().indexOf(t),this._lineTool=i,this._ownerSourceId=s.id(),this._lineId=null!=n?n:null,this._drawOnAllChartsMode=r}startCreatingLine(e,t,i,s,r){var n;const o=this._chartModel.panes()[this._paneIndex],a=this._chartModel.dataSourceForId(this._ownerSourceId)||void 0,l=this._chartModel.createLineTool({pane:o,point:e,linetool:this._lineTool,properties:t,linkKey:i,sharingMode:s,ownerSource:a,id:null!==(n=this._lineId)&&void 0!==n?n:void 0,fromExternalModel:r});return this._lineId=l.id(),this._fromExternalModel=r,!this._chartModel.lineBeingCreated()}continueCreatingLine(e,t,i,s){const r=this._chartModel.continueCreatingLine(e,t,i,s,this._fromExternalModel);return r&&this._chartModel.setShouldBeSavedEvenIfHidden(!0),r}line(){
return null===this._lineId?null:this._chartModel.dataSourceForId(this._lineId)}drawOnAllCharts(){return 0!==this._drawOnAllChartsMode}_redo(){if(null===this._lineState)return;const e=this._chartModel.restoreSource(!1,this._paneIndex,null,(0,n.ensureNotNull)(this._lineState),null);null!==e&&(this._lineId=e.id(),this._lineState=null,e.share(this._drawOnAllChartsMode))}_undo(){const e=this.line();null!==e&&(this._lineState=e.state(!1),this._chartModel.removeSource(e),this._lineId=null)}}var Ps=i(19466);const xs=new W.TranslatedString("bring {title} to front",a.t(null,void 0,i(53159))),Ts=new W.TranslatedString("send {title} to back",a.t(null,void 0,i(5005))),Is=new W.TranslatedString("insert {title} after {targetTitle}",a.t(null,void 0,i(56307))),Ms=new W.TranslatedString("insert {title} before {targetTitle}",a.t(null,void 0,i(46229))),As=new W.TranslatedString("send {title} backward",a.t(null,void 0,i(40962))),Ls=new W.TranslatedString("bring {title} forward",a.t(null,void 0,i(41966))),ks=new W.TranslatedString("send group {title} backward",a.t(null,void 0,i(69546))),Ds=new W.TranslatedString("bring group {title} forward",a.t(null,void 0,i(1979)));function Es(e){return new W.TranslatedString(e.name(),e.title(Ps.TitleDisplayTarget.StatusLine))}class Vs extends Yt.UndoCommand{constructor(e,t,i){super(i,void 0,(0,_s.sourcesAffectState)(t)),this._sourcesByPanes=new Map,this._originalState=new Map,this._model=e,t.forEach((t=>{const i=(0,n.ensureNotNull)(e.paneForSource(t)),s=e.panes().indexOf(i),r=this._sourcesByPanes.get(s)||[];r.push(t.id()),this._sourcesByPanes.set(s,r)})),Array.from(this._sourcesByPanes.keys()).forEach((t=>{const i=e.panes()[t],s=new Map,r=new Set(i.sourcesByGroup().multipaneSources());i.sourcesByGroup().allIncludingHidden().filter((e=>!r.has(e))).forEach((e=>{s.set(e.id(),e.zorder())})),this._originalState.set(t,s)}))}undo(){this._originalState.forEach(((e,t)=>{const i=this._model.panes()[t],s=new Map;e.forEach(((e,t)=>{const r=(0,n.ensureNotNull)(i.dataSourceForId(t));s.set(r,e)})),i.setZOrders(s)}))}redo(){this._sourcesByPanes.forEach(((e,t)=>{const i=this._model.panes()[t],s=e.map((e=>(0,n.ensureNotNull)(i.dataSourceForId(e))));this._paneOperation(i,s)}))}}class Bs extends Vs{constructor(e,t){super(e,t,xs.format({title:Es(t[0])}))}_paneOperation(e,t){e.bringToFront(t)}}class Rs extends Vs{constructor(e,t){super(e,t,Ts.format({title:Es(t[0])}))}_paneOperation(e,t){e.sendToBack(t)}}class Ns extends Vs{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertAfter(t,this._targetSource)}}class Os extends Ns{constructor(e,t,i){super(e,t,i,Is.format({title:Es(t[0]),targetTitle:Es(i)}))}}class Fs extends Vs{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertBefore(t,this._targetSource)}}class Ws extends Fs{constructor(e,t,i){super(e,t,i,Ms.format({title:Es(t[0]),targetTitle:Es(i)}))}}function Hs(e,t){const i=t[0],s=e.sourcesByGroup().all().filter((e=>e.zorder()e.zorder()>i.zorder()));if(0===s.length)throw new Error("Cannot bring forward source that alreadt on back");let r=s[0];if((0,J.isLineTool)(r)){const t=e.model().lineToolsGroupModel().groupForLineTool(r);if(null!==t){const e=t.lineTools();r=e[e.length-1]}}return r}class js extends Ns{constructor(e,t,i){super(e,i,Us(t,i),Ls.format({title:Es(i[0])}))}}function Gs(e,t){return(0,n.ensureNotNull)(e.paneForSource(t.lineTools()[0]))}class qs extends Fs{constructor(e,t){super(e,t.lineTools(),Hs(Gs(e,t),t.lineTools()),ks.format({title:t.name().value()}))}}class $s extends Ns{constructor(e,t){super(e,t.lineTools(),Us(Gs(e,t),t.lineTools()),Ds.format({title:t.name().value()}))}}const Ks=new W.TranslatedString("rearrange panes",a.t(null,void 0,i(2618)));class Ys extends Yt.UndoCommand{constructor(e,t,i){super(Ks),this._chartModel=e,this._index=t,(0,P.isNumber)(i)?this._dstIndex=i:this._dstIndex="up"===i?t-1:t+1}redo(){this._checkIndices()&&this._chartModel.movePane(this._index,this._dstIndex)}undo(){this._checkIndices()&&this._chartModel.movePane(this._dstIndex,this._index)}_checkIndices(){const e=this._chartModel.panes().length;return this._index>=0&&this._index=0&&this._dstIndex{var s,r;e.setValue(t[i].val),(null!==(r=null===(s=e.dependents)||void 0===s?void 0:s.call(e))&&void 0!==r?r:[]).forEach((e=>er(e,t[i].dependenValues)))}))}class tr extends Yt.UndoCommand{constructor(e,t,i,s,r=!0){super(i,void 0,r),this._targetObj=e,this._newValue=t,this._oldValue=this._targetObj.value(),this._dependentValues=Qs(this._targetObj),this._model=s}redo(){(0,Zs.allowSavingDefaults)(!0),this._targetObj.setValue(this._newValue),(0,Zs.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,pi.globalChangeEvent)()),this._model.lightUpdate()}undo(){(0,Zs.allowSavingDefaults)(!0),this._targetObj.setValue(this._oldValue),er(this._targetObj,this._dependentValues),(0,Zs.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,pi.globalChangeEvent)()),this._model.lightUpdate()}}class ir extends Yt.UndoCommand{constructor(e,t,i,s,r,n){super(s),this._prevPriceAxisProps={},this._dependentValues=[],this._property=e,this._mainSeries=i,this._value=t,this._model=r,this._chartWidget=n}redo(){
const e=this._mainSeries,t=e.properties().childs();this._dependentValues=Qs(this._property),this._prevResolution=t.interval.value(),this._prevValue=this._property.value(),this._storePriceAxisProps(),(0,Zs.allowSavingDefaults)(!0);const i=t.interval.value(),s=this._model.defaultResolutions(),r=(0,ui.getResolutionByChartStyle)(this._value,i,s);Xs.linking.interval.setValue(r),e.setChartStyleWithIntervalIfNeeded(this._value,r),(0,ae.setLastUsedStyle)(this._value,e.symbolInfo()),(0,ae.preparePriceAxisProperties)(t),(0,Zs.allowSavingDefaults)(!1),this._invalidateModel(),this._chartWidget.screen.show(!0)}undo(){const e=this._mainSeries;(0,Zs.allowSavingDefaults)(!0),e.setChartStyleWithIntervalIfNeeded(this._prevValue,this._prevResolution),this._restorePriceAxisProps(),Xs.linking.interval.setValue(this._prevResolution),er(this._property,this._dependentValues),(0,Zs.allowSavingDefaults)(!1),this._invalidateModel(),this._chartWidget.screen.show(!0)}_storePriceAxisProps(){const e=this._mainSeries.priceScale();this._prevPriceAxisProps=e.mode()}_restorePriceAxisProps(){this._mainSeries.priceScale().setMode(this._prevPriceAxisProps)}_invalidateModel(){this._model&&(this._model.recalculateAllPanes((0,pi.sourceChangeEvent)(this._model.mainSeries().id())),this._model.lightUpdate())}}const sr=new W.TranslatedString("change date range",a.t(null,void 0,i(16979)));class rr extends Yt.UndoCommand{constructor(e,t){super(sr),this._modelsData=[],this._rangeOptions=t,this._modelsData.push({model:e,prevResolution:e.mainSeries().properties().childs().interval.value(),barSpacing:e.timeScale().barSpacing(),rightOffset:e.timeScale().rightOffset(),rangeOptions:e.appliedTimeFrame().value()})}redo(){for(const e of this._modelsData){const t=e.model.mainSeries(),i=t.properties().childs().interval;Xi.Interval.isEqual(this._rangeOptions.res,i.value())?t.loadDataTo(this._rangeOptions.val):(t.setDefaultTimeframe(this._rangeOptions.val),t.setSymbolParams({interval:this._rangeOptions.res}))}}undo(){for(const e of this._modelsData){const t=e.model.mainSeries(),i=t.properties().childs().interval;e.prevResolution!==i.value()?(null!==e.rangeOptions&&t.setDefaultTimeframe(e.rangeOptions.val),t.setSymbolParams({interval:e.prevResolution})):null!==e.rangeOptions&&t.loadDataTo(e.rangeOptions.val);const s=e.model.timeScale();s.setBarSpacing(e.barSpacing),s.setRightOffset(e.rightOffset)}}canMerge(e){return e instanceof rr&&Ji(e._rangeOptions,this._rangeOptions)}merge(e){if(!(e instanceof rr))throw new Error("Invalid command to merge");this._modelsData=this._modelsData.concat(e._modelsData)}}var nr=i(62839);i(21251);class or extends Yt.UndoCommand{constructor(e,t,i){super(i,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._model=e,this._groupId=t.id,this._groupName=t.name().value(),this._lineToolsIds=t.lineTools().map((e=>e.id()))}redo(){const e=(0,n.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId));this._model.lineToolsGroupModel().removeGroup(e)}undo(){
const e=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))),t=new nr.LineToolsGroup(e,this._groupName,this._groupId);this._model.lineToolsGroupModel().addGroup(t)}}const ar=new W.TranslatedString("create line tools group",a.t(null,void 0,i(46219)));class lr extends Yt.UndoCommand{constructor(e,t){super(ar,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._groupId=null,this._model=e,this._sourcesIds=t.map((e=>e.id()))}redo(){const e=this._sourcesIds.map((e=>this._model.dataSourceForId(e))),t=null===this._groupId?void 0:this._groupId;this._groupId=this._model.lineToolsGroupModel().createGroup(e,this._title,t).id}undo(){const e=(0,n.ensureNotNull)(this._model.lineToolsGroupModel().groupForId((0,n.ensureNotNull)(this._groupId)));this._model.lineToolsGroupModel().removeGroup(e)}createdGroupId(){return this._groupId}}const cr=new W.TranslatedString("add line tool(s) to group {group}",a.t(null,void 0,i(21162)));class hr extends Yt.UndoCommand{constructor(e,t,i){super(cr.format({group:t.name().value()}),void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._model=e,this._groupId=t.id,this._lineToolsIds=i.map((e=>e.id()))}redo(){const e=(0,n.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map((e=>this._model.dataSourceForId(e)));e.addLineTools(t)}undo(){const e=this._lineToolsIds.map((e=>this._model.dataSourceForId(e)));(0,n.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)).excludeLineTools(e)}}class dr extends Yt.UndoCommand{constructor(e,t,i,s){super(s,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._chartModel=e,this._groupId=t.id,this._oldName=t.name().value(),this._newName=i}redo(){(0,n.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._newName)}undo(){(0,n.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._oldName)}}const ur=new W.TranslatedString("create line tools group from selection",a.t(null,void 0,i(95394))),pr=new W.TranslatedString("removing line tools group {name}",a.t(null,void 0,i(41430))),_r=new W.TranslatedString("add line tool {lineTool} to group {name}",a.t(null,void 0,i(12570))),mr=new W.TranslatedString("make group {group} visible",a.t(null,void 0,i(45987))),gr=new W.TranslatedString("make group {group} invisible",a.t(null,void 0,i(76709))),fr=new W.TranslatedString("lock group {group}",a.t(null,void 0,i(20453))),vr=new W.TranslatedString("unlock group {group}",a.t(null,void 0,i(74590))),yr=new W.TranslatedString("rename group {group} to {newName}",a.t(null,void 0,i(80491)));class Sr{constructor(e){this._environment=e}createGroupFromSelection(){const e=this._environment.model();(0,n.assert)(!e.selection().isEmpty(),"Cannot create group from empty selection");const t=(0,vs.sortSources)(e.selection().lineDataSources());(0,n.assert)(t.length===e.selection().allSources().length,"A group could contain line tools only")
;const i=t.length>1||null!==this._environment.model().lineToolsGroupModel().groupForLineTool(t[0]),s=t.reduce(((e,t)=>e.zorder()>t.zorder()?e:t),t[0]);let r=s;const o=e.lineToolsGroupModel().groupForLineTool(s);if(null!==o){const e=o.lineTools();r=e[e.length-1]}this._environment.beginUndoMacro(ur);const a=new Map,l=new Set;t.forEach((t=>{const i=this._groupForLineTool(t);if(null===i)return;const s=a.get(i)||[];s.push(t),a.set(i,s);const r=(0,n.ensureNotNull)(e.paneForSource(t));l.add(r)})),(0,n.assert)(l.size<=1,"All selected sources should be on the same pane"),a.forEach(((t,i)=>{const s=new ps.ExcludeLineToolsFromGroupUndoCommand(e,i,t);this._environment.pushUndoCommand(s)}));const c=new lr(e,(0,vs.sortSources)(t));if(this._environment.pushUndoCommand(c),i){const i=new Os(e,t,r);this._environment.pushUndoCommand(i)}this._environment.endUndoMacro();const h=(0,n.ensureNotNull)(c.createdGroupId());return(0,n.ensureNotNull)(e.lineToolsGroupModel().groupForId(h))}removeGroup(e){const t=this._environment.model(),i=e.lineTools();this._environment.beginUndoMacro(pr.format({name:e.name().value()}));const s=new or(t,e,null);this._environment.pushUndoCommand(s);const r=new us.RemoveSourcesUndoCommand(t,i,null);this._environment.pushUndoCommand(r);const o=t.mainSeries().symbol();i.forEach((e=>{null!==e.linkKey().value()&&(0,je.removeLineTool)({withUndo:!0,model:t,symbol:o,sourceTitle:new W.TranslatedString(e.name(),e.title(Ps.TitleDisplayTarget.DataWindow)),lineToolState:e.state(!1),linkKey:(0,n.ensureNotNull)(e.linkKey().value())})})),this._environment.endUndoMacro()}groups(){return this._environment.model().lineToolsGroupModel().groups()}excludeLineToolFromGroup(e,t){const i=this._environment.model(),s=new ps.ExcludeLineToolsFromGroupUndoCommand(i,e,[t]);this._environment.pushUndoCommand(s)}addLineToolToGroup(e,t){const i=this._environment.model(),s=i.lineToolsGroupModel().groupForLineTool(t);if(s===e)return;const r=_r.format({lineTool:new W.TranslatedString(t.name(),t.title(Ps.TitleDisplayTarget.StatusLine)),name:e.name().value()});this._environment.beginUndoMacro(r),null!==s&&this._environment.pushUndoCommand(new ps.ExcludeLineToolsFromGroupUndoCommand(i,s,[t]));if(N.enabled("saveload_separate_drawings_storage")){const s=e.sharingMode().value();t.sharingMode().value()!==s&&this._environment.pushUndoCommand(new SetLineSharingModeUndoCommand(t,s,i,null))}this._environment.pushUndoCommand(new hr(i,e,[t])),this._environment.endUndoMacro()}bringToFront(e){const t=this._environment.model(),i=new Bs(t,e.lineTools());this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendToBack(e){const t=this._environment.model(),i=new Rs(t,e.lineTools());this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}bringForward(e){const t=this._environment.model(),i=new $s(t,e);this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendBackward(e){const t=this._environment.model(),i=new qs(t,e)
;this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}insertAfter(e,t){const i=this._environment.model();let s;if(t instanceof nr.LineToolsGroup){const e=t.lineTools();s=e[e.length-1]}else s=t;const r=new Os(i,e.lineTools(),s);this._environment.pushUndoCommand(r),this._environment.emitEvent("changeZOrder",[e.lineTools()])}insertBefore(e,t){const i=this._environment.model();let s;if(t instanceof nr.LineToolsGroup){s=t.lineTools()[0]}else s=t;const r=new Ws(i,e.lineTools(),s);this._environment.pushUndoCommand(r),this._environment.emitEvent("changeZOrder",[e.lineTools()])}availableZOrderOperations(e){const t=this._environment.model(),i=e.lineTools(),s=i[0],r=i[i.length-1],o=(0,n.ensureNotNull)(t.paneForSource(i[0])).sourcesByGroup().allExceptSpecialSources(),a=o[0],l=o[o.length-1];return{bringForwardEnabled:r!==l,bringToFrontEnabled:r!==l,sendBackwardEnabled:s!==a,sendToBackEnabled:s!==a}}setGroupVisibility(e,t){const i=(t?mr:gr).format({group:e.name().value()}),s=this._environment.model();this._environment.beginUndoMacro(i),e.lineTools().forEach((e=>{const i=e.properties().visible,r=new tr(i,t,null,s,!hs.lineToolsDoNotAffectChartInvalidation);this._environment.pushUndoCommand(r)})),this._environment.endUndoMacro()}setGroupLock(e,t){const i=(t?fr:vr).format({group:e.name().value()}),s=this._environment.model();this._environment.beginUndoMacro(i),e.lineTools().forEach((e=>{const i=e.properties().frozen,r=new tr(i,t,null,s,!hs.lineToolsDoNotAffectChartInvalidation);this._environment.pushUndoCommand(r)})),this._environment.endUndoMacro()}setGroupName(e,t){const i=this._environment.model(),s=yr.format({group:e.name().value(),newName:t}),r=new dr(i,e,t,s);this._environment.pushUndoCommand(r)}canBeGroupped(e){const t=this._environment.model();return new Set(e.map((e=>t.paneForSource(e)))).size<=1}_groupForLineTool(e){return this._environment.model().lineToolsGroupModel().groups().find((t=>t.containsLineTool(e)))||null}}var br=i(14314),wr=i(96286),Cr=i(36915),Pr=i(9155);const xr=new W.TranslatedString("apply study template {template}",a.t(null,void 0,i(69604)));function Tr(e){for(const t of e.panes)for(const e of t.sources)if((0,Cr.isMainSeriesState)(e))return e.id;return null}class Ir extends Yt.UndoCommand{constructor(e,t,i){var s,r;super(xr.format({template:i})),this._newSymbolParams={},this._model=e,this._templateContent=function(e,t){const i=(0,br.default)({},e),s=(0,n.ensureNotNull)(Tr(i));for(const e of i.panes){e.mainSourceId===s&&(e.mainSourceId=t);for(const i of e.sources)if(i.id===s){i.id=t;const r=e=>{const i=e.indexOf(s);-1!==i&&e.splice(i,1,t)};if(e.leftAxisesState&&e.rightAxisesState?(e.leftAxisesState.forEach((e=>r(e.sources))),e.rightAxisesState.forEach((e=>r(e.sources)))):(r(e.leftAxisSources),r(e.rightAxisSources)),e.overlayPriceScales){const i=e.overlayPriceScales[s];i&&(delete e.overlayPriceScales[s],e.overlayPriceScales[t]=i)}}else i.ownerSource===s&&(i.ownerSource=t)}return i}(t,e.mainSeries().id()),this._initialState=e.studyTemplate(!0,!0,!0)
;const o=e.mainSeries();t.symbol&&(this._newSymbolParams={symbol:t.symbol,currency:null!==(s=t.currency)&&void 0!==s?s:null,unit:null!==(r=t.unit)&&void 0!==r?r:null}),t.interval&&(this._newSymbolParams.interval=t.interval,this._newSymbolParams.style=(0,ae.getChartStyleByResolution)(t.interval,o.style())),this._initialSymbolParams={symbol:o.symbol(),currency:o.currency(),unit:o.unit(),interval:o.interval(),style:o.style()},this._initialState=e.studyTemplate(),this._initialGroupsState=e.lineToolsGroupModel().state()}redo(){this._model.mainSeries().setSymbolParams(this._newSymbolParams);const e=this._merge(this._templateContent).filter(J.isLineTool);this._model.lineToolsGroupModel().removeLineTools(e);const t=this._model.mainSeries().properties();(0,ae.preparePriceAxisProperties)(t),this._model.recalcVisibleRangeStudies(He.RecalcVisibleRangeStudiesReason.StudyCreation),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){this._model.mainSeries().setSymbolParams(this._initialSymbolParams),this._merge(this._initialState)}_merge(e){const t=e.version||0,i=this._model,s=i.mainSeries();(0,n.assert)(s.id()===Tr(e)),s.priceScale().properties().childs().lockScale.setValue(!1);const r=i.panes(),o=[];for(let e=r.length;e--;){const t=r[e],i=t.containsMainSeries(),s=t.dataSources();for(let e=s.length;e--;){const t=s[e];(!i||((0,Z.isStudy)(t)||(0,Z.isStudyStub)(t))&&t.isRemovedByStudyTemplates())&&o.push(t)}}i.resetDeferredStudies();const a=(0,wr.closeSourcesSet)(i,o);for(let e=0;ee.zorder-t.zorder));for(let e=0;e-1,a=o?r[e]:i.createPane(e);o&&t<3&&(0,Pr.reorderDataSourcesStateZOrder)(n.sources),a.restoreState({state:n,withData:!1,version:t}),null!==a.mainDataSource()||i.removePane(a)}return i.syncLollipopSources(),s.priceScale().setMode({autoScale:!0}),i.startNotStartedStudies(),i.recalculateAllPanes((0,pi.globalChangeEvent)()),i.fullUpdate(),a}}var Mr=i(92184),Ar=i(60074);const Lr=(0,m.getLogger)("Chart.ChartUndoModel");var kr;!function(e){e[e.PasteYCoordOffset=-40]="PasteYCoordOffset"}(kr||(kr={}));const Dr=new W.TranslatedString("paste drawing",a.t(null,void 0,i(62192)));class Er extends Yt.UndoCommand{constructor(e,t,i,s,r){super(Dr,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._needCopyToOtherCharts=!1,this._sourceState=null,this._model=e,this._clipboardData=t,this._paneIndex=this._model.panes().indexOf(i||(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries()))),this._pasteWithData=!!s,this._keepZIndex=!!r}redo(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.clipboardLineToolOwnerSource(this._clipboardData.source.id)),i=t===this._model.mainSeries();null===this._sourceState&&(this._sourceState=this._getSourceState(t,i));const s=(0,n.ensureNotNull)(e.restoreLineTool(this._sourceState,this._pasteWithData,this._keepZIndex,void 0,t));(0,
n.ensureNotNull)(t.priceScale()).addDataSource(s),this._clipboardData.centeredOnChart&&s.centerPosition&&s.centerPosition(),s.restoreFixedPoint(),s.createServerPoints(),this._needCopyToOtherCharts=Boolean(i&&s.isSynchronizable()&&0!==s.sharingMode().value()),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){if(!this._sourceState)return void Lr.logError("This command was never executed - nothing to undo");const e=this.source();this._clipboardData.centeredOnChart&&(this._clipboardData.centeredOnChart=!1,this._sourceState.points=e.normalizedPoints()),this._model.removeSource(e)}source(){return(0,n.ensureNotNull)(this._model.dataSourceForId((0,n.ensureNotNull)(this._sourceState).id))}needCopyToOtherCharts(){return this._needCopyToOtherCharts}_getSourceState(e,t){const i=(0,P.clone)(this._clipboardData.source);delete i.state.symbol,t?(null!=i.linkKey||void 0!==i.sharingMode&&0!==i.sharingMode)&&(i.linkKey=(0,Mr.randomHash)()):(i.linkKey=null,i.sharingMode=0);const s=(0,n.ensureNotNull)(e.priceScale()),r=this._model,{symbol:o,currencyId:a,unitId:l}=this._clipboardData.source.state,c=(0,n.ensureNotNull)(e.symbolSource());let h=!1;!c.symbolSameAsCurrent(o)||(null!==a?a!==(0,ae.symbolCurrency)(c.symbolInfo(),void 0,!0):c.isConvertedToOtherCurrency())||(null!==l?l!==(0,ae.symbolUnit)(c.symbolInfo(),this._model.unitConversionEnabled()):c.isConvertedToOtherUnit())||((0,Ar.isActingAsSymbolSource)(e)?h=!0:(0,Z.isStudy)(e)&&(h=Boolean(e.metaInfo().is_price_study))),i.state.currencyId=r.currencyConversionEnabled()&&c.isConvertedToOtherCurrency()?c.currency():null,i.state.unitId=r.unitConversionEnabled()&&c.isConvertedToOtherUnit()?c.unit():null;const d=e=>{const t=e.x*r.timeScale().width(),i=e.y*s.height()-40;return new Oe.Point(t,i)},u=(0,n.ensureNotNull)(e.firstValue());if(this._model.id()===this._clipboardData.modelId||!h){for(let e=0;e{this._symbolSource(e).setSymbolParams(e.newSymbolParams),e.showFade&&e.chartWidget.screen.show(!0)})),this._firstRedo||(0,Nr.muteLinkingGroup)(this._linkingGroupIndex,!1),this._firstRedo=!1}undo(){(0,Nr.muteLinkingGroup)(this._linkingGroupIndex,!0),this._charts.forEach((e=>{this._symbolSource(e).setSymbolParams(e.prevSymbolParams),
e.showFade&&e.chartWidget.screen.show(!0)})),(0,Nr.muteLinkingGroup)(this._linkingGroupIndex,!1)}canMerge(e){if(!(e instanceof Or)||e._linkingGroupIndex!==this._linkingGroupIndex||!this._containsMainSeriesOnly()||!e._containsMainSeriesOnly()||e._creationTime-this._creationTime>500)return!1;for(const[t]of e._charts)if(this._charts.has(t))return!1;return!0}merge(e){if(e instanceof Or)for(const[t,i]of e._charts)this._charts.set(t,i)}_showFade(e,t){return e===t.model().mainSeries()}_symbolSource(e){return(0,n.ensureNotNull)(e.chartWidget.model().model().dataSourceForId(e.sourceId))}_containsMainSeriesOnly(){for(const[e,t]of this._charts)if(t.sourceId!==e.model().mainSeries().id())return!1;return!0}}const Fr=new W.TranslatedString("change symbol",a.t(null,void 0,i(35400)));class Wr extends Or{constructor(e,t,i){super(Fr,e,{symbol:t,currency:null,unit:null},i),this._symbol=t}canMerge(e){return e instanceof Wr&&e._symbol===this._symbol&&super.canMerge(e)}}const Hr=(0,m.getLogger)("Chart.ChartUndoModel"),zr=new W.TranslatedString("paste indicator",a.t(null,void 0,i(1064)));class Ur extends Yt.UndoCommand{constructor(e,t,i){super(zr),this._sourceState=null,this._model=e,this._clipboardData=t,this._paneId=i}redo(){if(!this._sourceState){const e=(0,P.clone)(this._clipboardData.source);e.id=(0,Mr.randomHashN)(6),this._sourceState=e}let e,t;e=this._paneId?(0,n.ensureNotNull)(this._model.paneForId(this._paneId)):this._sourceState.metaInfo.is_price_study?(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())):this._model.createPane();const i=!e.mainDataSource();this._sourceState.zorder=e.newStudyZOrder();const s=(0,n.ensureNotNull)(e.restoreStudy(this._sourceState,!1));i||(t=this._sourceState.metaInfo.is_price_study?t=this._model.mainSeries().priceScale():this._paneId?e.findSuitableScale(s):e.defaultPriceScale(),t!==s.priceScale()&&e.move(s,t)),(0,Z.isStudy)(s)&&s.start()}undo(){if(null===this._sourceState)return void Hr.logError("This command was never executed - nothing to undo");const e=(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceState.id));this._model.removeSource(e)}state(){return this._sourceState}}class jr extends Yt.UndoCommand{constructor(e,t,i,s,r){super(null,!1),this._model=e,this._paneA=t,this._paneB=i,this._prevStretchA=s,this._currStretchA=r}redo(){const e=this._paneA.stretchFactor()+this._paneB.stretchFactor();this._paneA.setStretchFactor(this._currStretchA),this._paneB.setStretchFactor(e-this._currStretchA),this._model.fullUpdate()}undo(){const e=this._paneA.stretchFactor()+this._paneB.stretchFactor();this._paneA.setStretchFactor(this._prevStretchA),this._paneB.setStretchFactor(e-this._prevStretchA),this._model.fullUpdate()}}const Gr=new W.TranslatedString("move",a.t(null,void 0,i(98277)));class qr extends Yt.UndoCommand{constructor(e,t,i,s){super(Gr,!1),this._endEvent=null,this._model=e,this._sourceId=t.id(),this._itemIndex=i,this._startEvent=s}move(e){this._endEvent=e,this._move(e)}hasChanges(){return null!==this._endEvent}undo(){this._move(this._startEvent)}redo(){this._move((0,
n.ensureNotNull)(this._endEvent))}_move(e){const t=(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceId));(0,n.assert)(void 0!==t.moveItem,'The method "moveItem" is not defined'),t.moveItem&&t.moveItem(new Oe.Point(e.localX,e.localY),this._itemIndex,new ze.EnvironmentState(e))}}class $r extends Yt.UndoCommand{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(u),this._paneState=null,this._lastInsertionStartPromise=null,this._additionalStudiesIds=[],this._chartModel=e,this._studyMetaInfo=t,this._props=s,this._addAsOverlay=r,this._parentIds=n.map((e=>e.id())),this._inputs=i,this._targetZOrder=h,this._preferredPriceScale=o,this._allowChangeCurrency=a,this._allowChangeUnit=l,this._paneSize=c,this._studyId=null!=d?d:null}redo(){const e=this._parentIds.map((e=>this._chartModel.dataSourceForId(e))),t=this._chartModel.insertStudyWithParams(this._studyMetaInfo,this._inputs,this._targetZOrder,this._props,this._addAsOverlay,e,this._preferredPriceScale,this._allowChangeCurrency,this._allowChangeUnit,this._paneSize,null===this._studyId?void 0:this._studyId),i=t.study;if(this._lastInsertionStartPromise=t.startPromise,this._studyId=i.id(),i.childStudyByRebind().subscribe(null,(()=>(0,u.trackEvent)("SOS","Apply SOS","Rebind SOS"))),this._chartModel.setShouldBeSavedEvenIfHidden(!0),null!==this._paneState){(0,n.ensureNotNull)(this._chartModel.paneForSource(i)).restoreState({state:this._paneState,withData:!1,version:this._chartModel.version()}),this._paneState=null}}undo(){const e=(0,n.ensureNotNull)(this._chartModel.dataSourceForId((0,n.ensureNotNull)(this._studyId)));(0,Ar.isSymbolSource)(e)&&e.symbolResolved().unsubscribeAll(this);const t=(0,n.ensureNotNull)(this._chartModel.paneForSource(e)).state();this._additionalStudiesIds.forEach((e=>{const t=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(e));this._chartModel.removeSource(t)})),this._additionalStudiesIds=[],this._chartModel.removeSource(e)&&(this._paneState=t)}insertedStudy(){return this._chartModel.dataSourceForId((0,n.ensureNotNull)(this._studyId))}lastInsertionStartPromise(){var e;return null!==(e=this._lastInsertionStartPromise)&&void 0!==e?e:Promise.resolve()}_createCopiesOfNewFundamentalForAllStocks(e){}_createCopiesOfExistingFundamentalsForNewStock(e){}}var Kr=i(48984),Yr=i(51804),Zr=i.n(Yr),Xr=i(33515);const Jr=new W.TranslatedString("zoom",a.t(null,void 0,i(91084)));class Qr extends Yt.UndoCommand{constructor(e,t,i,s,r,n){super(Jr),this._barSpacing=null,this._rightBarsOffset=null,this._leftBarsOffset=null,this._priceMode=null,this._model=e,this._startBar=t,this._endBar=i,this._startPrice=s,this._endPrice=r,this._pane=n}redo(){const e=(0,n.ensureNotNull)(this._model.timeScale().visibleBarsStrictRange());this._leftBarsOffset=e.firstBar()-this._startBar,this._rightBarsOffset=e.lastBar()-this._endBar,this._barSpacing=this._model.timeScale().barSpacing(),this._priceMode=this._pane.defaultPriceScale().mode(),this._model.zoomToViewport(this._startBar,this._endBar,this._startPrice,this._endPrice,this._pane)}undo(){
const e=this._model.timeScale(),t=this._pane.defaultPriceScale(),i=(0,n.ensureNotNull)(e.visibleBarsStrictRange());e.setBarSpacing((0,n.ensureNotNull)(this._barSpacing)),e.zoomToBarsRange(i.firstBar()+(0,n.ensureNotNull)(this._leftBarsOffset),i.lastBar()+(0,n.ensureNotNull)(this._rightBarsOffset)),t.setMode((0,n.ensureNotNull)(this._priceMode)),t.recalculatePriceRange((0,n.ensureNotNull)(e.visibleBarsStrictRange())),this._model.recalculateAllPanes((0,pi.viewportChangeEvent)()),this._model.lightUpdate()}}const en=(0,m.getLogger)("Chart.ChartUndoModel"),tn=new W.TranslatedString("zoom",a.t(null,void 0,i(91084)));class sn extends Yt.UndoCommand{constructor(e,t,i){super(tn),this._baseCmd=e,this._zoomStack=t,this._inOut=i}undo(){if(this._inOut){if(this._baseCmd!==this._zoomStack.head())return void en.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}else this._baseCmd.redo(),this._zoomStack.push(this._baseCmd)}redo(){if(this._inOut)this._baseCmd.redo(),this._zoomStack.push(this._baseCmd);else{if(this._baseCmd!==this._zoomStack.head())return void en.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}}}const rn=new W.TranslatedString("stop syncing drawing",a.t(null,void 0,i(3350)));class nn extends Yt.UndoCommand{constructor(e,t){super(rn,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._model=e,this._sourceId=t.id(),this._linkKey=t.linkKey().value()}redo(){(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(null)}undo(){(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(this._linkKey)}}var on=i(31229);const an=new W.TranslatedString("restore defaults",a.t(null,void 0,i(85815)));class ln extends Yt.UndoCommand{constructor(e,t,i=an,s=!0){super(i,void 0,s),this._chartModel=e,this._defaultProperty=t,this._state=t.state()}redo(){this._chartModel.restoreFactoryDefaults(this._defaultProperty)}undo(){this._defaultProperty.mergeAndFire(this._state),this._chartModel.mainSeries().onChartStyleChanged()}}class cn extends ln{constructor(e,t,i,s){super(e,t,i,null!=s?s:!hs.lineToolsDoNotAffectChartInvalidation)}redo(){this._defaultProperty.hasChild("intervalsVisibilities")&&this._defaultProperty.childs().intervalsVisibilities.mergeAndFire(on.intervalsVisibilitiesDefaults),super.redo()}}const hn=new W.TranslatedString("restore study defaults",a.t(null,void 0,i(96881)));class dn extends cn{constructor(e,t,i=hn){super(e,t.properties(),i,!0),this._study=t}redo(){super.redo(),this._chartModel.recalcColorStudies(!0),this._patchProperties()}undo(){super.undo(),this._chartModel.recalcColorStudies(!0),this._patchProperties()}_patchProperties(){0}}var un=i(10892),pn=i(35039);function _n(e){return f(e,["bidLineColor","askLineColor"])}function mn(e){return f(e,["preMarketColor","postMarketColor"])}function gn(e){return f(e,["highLowPriceLinesColor","averagePriceLineColor"])}function fn(e){return f(e,["upColor","downColor","borderColor","borderUpColor","borderDownColor","wickDownColor","wickUpColor","wickColor"])}
function vn(e){return f(e,["upColor","downColor","borderColor","borderUpColor","borderDownColor","wickDownColor","wickUpColor","wickColor"])}function yn(e){return f(e,["upColor","downColor","borderColor","borderUpColor","borderDownColor","wickDownColor","wickUpColor","wickColor"])}function Sn(e){return f(e,["upColor","downColor"])}function bn(e){return f(e,["color","borderColor","labelColor"])}function wn(e){return f(e,["color"])}function Cn(e){return f(e,["transparency","color1","color2","linecolor"])}function Pn(e){const{inputs:t,...i}=e;return i}function xn(e){const{inputs:t,...i}=e;return i}function Tn(e){const{inputs:t,...i}=e;return i}function In(e){const{inputs:t,...i}=e;return i}function Mn(e){const{topLineWidth:t,bottomLineWidth:i,baseLevelPercentage:s,priceSource:r,...n}=e;return n}function An(e){const{thinBars:t,inputs:i,barStyle:s,...r}=e;return r}function Ln(e){const{baseLineColor:t,priceLineColor:i,prevClosePriceLineColor:s,highLowAvgPrice:r,bidAsk:n,prePostMarket:o,hlcAreaStyle:a,candleStyle:l,volCandlesStyle:c,hollowCandleStyle:h,haStyle:d,barStyle:u,hiloStyle:p,lineStyle:_,lineWithMarkersStyle:m,steplineStyle:g,areaStyle:v,renkoStyle:y,pbStyle:S,kagiStyle:b,pnfStyle:w,baselineStyle:C,rangeStyle:P,volFootprintStyle:x,tpoStyle:T,svpStyle:I}=e;return{baseLineColor:t,priceLineColor:i,prevClosePriceLineColor:s,hlcAreaStyle:(M=a,f(M,["highLineColor","lowLineColor","closeLineColor","highCloseFillColor","closeLowFillColor"])),bidAsk:_n(n),prePostMarket:mn(o),candleStyle:fn(l),hollowCandleStyle:vn(h),haStyle:yn(d),barStyle:Sn(u),hiloStyle:bn(p),lineStyle:wn(_),lineWithMarkersStyle:wn(m),steplineStyle:wn(g),areaStyle:Cn(v),renkoStyle:Pn(y),pbStyle:xn(S),kagiStyle:Tn(b),pnfStyle:In(w),baselineStyle:Mn(C),rangeStyle:An(P),volFootprintStyle:{},tpoStyle:{},svpStyle:{},volCandlesStyle:fn(c),highLowAvgPrice:gn(r)};var M}function kn(e){return f(e,["backgroundColor","lineColor","textColor","axisHighlightColor","axisLineToolLabelBackgroundColorCommon","axisLineToolLabelBackgroundColorActive","crosshairLabelBgColorLight","crosshairLabelBgColorDark"])}function Dn(e){const{separatorColor:t,background:i,backgroundGradientEndColor:s,backgroundGradientStartColor:r,backgroundType:n,horzGridProperties:o,vertGridProperties:a,crossHairProperties:l}=e;return{separatorColor:t,background:i,backgroundGradientEndColor:s,backgroundGradientStartColor:r,backgroundType:n,horzGridProperties:{color:o.color},vertGridProperties:{color:a.color},crossHairProperties:{color:l.color,transparency:l.transparency}}}function En(e){const{graphics:{backgrounds:{outOfSession:t,preMarket:i,postMarket:s},vertlines:{sessBreaks:r}}}=e;return{graphics:{backgrounds:{outOfSession:{color:t.color,transparency:t.transparency},preMarket:{color:i.color,transparency:i.transparency},postMarket:{color:s.color,transparency:s.transparency}},vertlines:{sessBreaks:{color:r.color}}}}}function Vn(e){var t,i;e.wickUpColor=null!==(t=e.wickUpColor)&&void 0!==t?t:e.wickColor,e.wickDownColor=null!==(i=e.wickDownColor)&&void 0!==i?i:e.wickColor,delete e.wickColor}
const Bn=new W.TranslatedString("apply chart theme",a.t(null,void 0,i(68231)));class Rn extends Yt.UndoCommand{constructor(e,t,i){var s,r,n,o;super(Bn),this._model=e,this._newSessionProps=t.sessions?{properties:i?t.sessions:En(t.sessions)}:void 0,Vn(t.mainSourceProperties.candleStyle),Vn(t.mainSourceProperties.hollowCandleStyle),Vn(t.mainSourceProperties.haStyle);const a=t;a.chartProperties=null!==(s=a.chartProperties)&&void 0!==s?s:{paneProperties:{},scalesProperties:void 0};const l=a.chartProperties.paneProperties.gridProperties;a.chartProperties.paneProperties.vertGridProperties=null!==(r=a.chartProperties.paneProperties.vertGridProperties)&&void 0!==r?r:l,a.chartProperties.paneProperties.horzGridProperties=null!==(n=a.chartProperties.paneProperties.horzGridProperties)&&void 0!==n?n:l;const c=this._model.properties().state().paneProperties.legendProperties;delete c.backgroundTransparency;const h=a.chartProperties.paneProperties;i?h.legendProperties={...h.legendProperties,...c}:delete h.legendProperties;const d=(0,pn.factoryDefaults)("chartproperties"),u=(0,Fe.deepExtend)({},d,t.chartProperties),p=i?u.paneProperties:Dn(u.paneProperties),_=i?u.scalesProperties:kn(u.scalesProperties);this._newChartProps={paneProperties:p,scalesProperties:_},e.timeScale().preserveBarSpacing()&&delete this._newChartProps.scalesProperties.barSpacing;const m=(0,pn.factoryDefaults)("chartproperties.mainSeriesProperties"),g=(0,Fe.deepExtend)({},m,t.mainSourceProperties);this._newSeriesProps=i?g:Ln(g);const f=e.properties().state();this._oldChartProps={paneProperties:Dn(f.paneProperties),scalesProperties:kn(f.scalesProperties)};const v=e.mainSeries().properties().state();this._oldSeriesProps=i?v:Ln(v),this._oldSessionProps=null!==(o=this._model.sessions().state())&&void 0!==o?o:void 0}undo(){this._merge(this._oldChartProps,this._oldSeriesProps,this._oldSessionProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()}redo(){this._merge(this._newChartProps,this._newSeriesProps,this._newSessionProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()}_merge(e,t,i){var s,r,n,o;const a=this._model;(0,Zs.allowSavingDefaults)(!0),e&&(a.properties().childs().paneProperties.mergeAndFire(e.paneProperties),a.properties().childs().scalesProperties.mergeAndFire(e.scalesProperties)),"priceAxisProperties"in t&&a.mainSeries().priceScale().setMode({autoScale:null===(s=t.priceAxisProperties)||void 0===s?void 0:s.autoScale,percentage:null===(r=t.priceAxisProperties)||void 0===r?void 0:r.percentage,log:null===(n=t.priceAxisProperties)||void 0===n?void 0:n.log,lockScale:null===(o=t.priceAxisProperties)||void 0===o?void 0:o.lockScale}),a.mainSeries().properties().mergeAndFire(t),a.mainSeries().properties().updateThemedColors(),a.mainSeries().properties().saveDefaults(),a.mainSeries().createPaneView(),a.mainSeries().invalidateBarStylesCache(),a.recalculateAllPanes((0,pi.globalChangeEvent)()),a.fullUpdate(),a.properties().saveDefaults(),
i&&a.sessions().restoreState(i,!1),(0,Zs.allowSavingDefaults)(!1)}}const Nn=new W.TranslatedString("change resolution",a.t(null,void 0,i(32829)));class On extends Or{constructor(e,t,i){super(Nn,e,function(e,t){let i;const s=(0,ae.isRangeStyle)(e.style()),r=Xi.Interval.isRange(t);return!s&&r?i=11:s&&!r&&(i=(0,ae.getLastUsedStyle)()),{interval:t,style:i}}(e,t),i),this._resolution=t}canMerge(e){return e instanceof On&&e._resolution===this._resolution&&super.canMerge(e)}_showFade(e,t){return!0}}var Fn=i(11008);class Wn extends Fn.SetWatchedValueCommand{constructor(){super(...arguments),this._firstRedo=!0}redo(){this._firstRedo||(0,Nr.muteLinkingGroup)(this._newValue,!0),(0,Nr.muteLinkingGroup)(this._oldValue,!0),super.redo(),this._firstRedo||(0,Nr.muteLinkingGroup)(this._newValue,!1),(0,Nr.muteLinkingGroup)(this._oldValue,!1),this._firstRedo=!1}undo(){(0,Nr.muteLinkingGroup)(this._newValue,!0),(0,Nr.muteLinkingGroup)(this._oldValue,!0),super.undo(),(0,Nr.muteLinkingGroup)(this._newValue,!1),(0,Nr.muteLinkingGroup)(this._oldValue,!1)}}var Hn=i(72396),zn=i(15491);class Un extends Yt.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._stubDescriptor=(0,n.ensureNotNull)(t.getDescriptor())}redo(){this._chartModel.dataSourceForId(this._stubDescriptor.id)||this._chartModel.restoreStudyStub(this._stubDescriptor)}undo(){this._chartModel.removeStudyStub(this._stubDescriptor.id)}}class jn extends Yt.UndoCommand{constructor(e,t,i){super(i,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._source=e,this._newState=t,this._oldState=e.properties().state()}redo(){this._source.applyTemplate(this._newState)}undo(){this._source.applyTemplate(this._oldState)}}var Gn=i(77007),qn=i(63829),$n=i(11497),Kn=i(30141),Yn=i(60859),Zn=i(51613),Xn=i(79320),Jn=i(19475);const Qn=new W.TranslatedString("apply all chart properties",a.t(null,void 0,i(99551)));class eo extends Yt.UndoCommand{constructor(e){super(Qn),this._trading=null,this._oldShowSellBuyButtons=null,this._oldNoConfirmEnabled=null,this._oldShowOnlyRejectionNotifications=null,this._oldShowPricesWithZeroVolume=null,this._oldShowPricesWithSpread=null,this._oldOrderExecutedSoundEnabled=null,this._prevWatermarkPreferences=null,this._prevAlertPreferences=null,this._model=e,this._trading=(0,Xn.tradingService)(),null!==this._trading&&(this._oldShowSellBuyButtons=this._trading.showSellBuyButtons.value(),this._oldNoConfirmEnabled=this._trading.noConfirmEnabled.value(),this._oldShowOnlyRejectionNotifications=this._trading.showOnlyRejectionNotifications.value(),this._oldShowPricesWithZeroVolume=this._trading.showPricesWith().zeroVolume.value(),this._oldShowPricesWithSpread=this._trading.showPricesWith().spread.value(),this._oldOrderExecutedSoundEnabled=this._trading.orderExecutedSoundParams.enabled.value()),this._defaultsPreferences=(0,Gn.defaultsPreferencesByWhiteList)(this._model,this._model.mainSeries()),this._oldPreferences=e.preferences(),this._prevDateFormat=qn.dateFormatProperty.value(),this._prevTimeHoursFormat=$n.timeHoursFormatProperty.value(),
this._prevAddPlusButton=Jn.addPlusButtonProperty.value(),this._prevShowOpenMarkerStatus=Kn.showMarketOpenStatusProperty.value(),this._prevCurrencyUnitVisibility=(0,gt.currencyUnitVisibilityProperty)().value(),this._prevAutoLogButtonsVisibility=(0,ft.autoLogButtonsVisibilityProperty)().value(),this._prevNavigationButtonsVisibility=(0,Yn.property)().value(),this._prevPaneButtonsVisibility=(0,Zn.property)().value();const t=this._model.watermarkSource();null!==t&&(this._prevWatermarkPreferences=t.properties().state())}redo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue(!0),this._trading.noConfirmEnabled.setValue(!1),this._trading.showOnlyRejectionNotifications.setValue(!1),this._trading.showPricesWith().zeroVolume.setValue(!0),this._trading.showPricesWith().spread.setValue(!0),this._trading.orderExecutedSoundParams.enabled.setValue(!1)),this._model.applyPreferences(this._defaultsPreferences),this._model.updateScales(),(0,qn.restoreDateFormatSettingsValue)(),(0,$n.restoreTimeHoursFormatSettingsValue)(),(0,Jn.restoreAddPlusButtonSettingsValue)(),(0,Kn.restoreShowMarketOpenStatusProperty)(),(0,gt.restoreCurrencyUnitVisibilitySettingsValue)(),(0,ft.restoreAutoLogButtonsVisibilitySettingsValue)(),(0,Yn.restoreNavigationButtonsVisibilitySettingsValue)(),(0,Zn.restorePaneButtonsVisibilitySettingsValue)();const e=this._model.watermarkSource();null!==e&&e.restorePropertiesDefaults()}undo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue((0,n.ensureNotNull)(this._oldShowSellBuyButtons)),this._trading.noConfirmEnabled.setValue((0,n.ensureNotNull)(this._oldNoConfirmEnabled)),this._trading.showOnlyRejectionNotifications.setValue((0,n.ensureNotNull)(this._oldShowOnlyRejectionNotifications)),this._trading.showPricesWith().zeroVolume.setValue((0,n.ensureNotNull)(this._oldShowPricesWithZeroVolume)),this._trading.showPricesWith().spread.setValue((0,n.ensureNotNull)(this._oldShowPricesWithSpread)),this._trading.orderExecutedSoundParams.enabled.setValue((0,n.ensureNotNull)(this._oldOrderExecutedSoundEnabled))),this._model.applyPreferences(this._oldPreferences),this._model.updateScales(),qn.dateFormatProperty.setValue(this._prevDateFormat),$n.timeHoursFormatProperty.setValue(this._prevTimeHoursFormat),Kn.showMarketOpenStatusProperty.setValue(this._prevShowOpenMarkerStatus),Jn.addPlusButtonProperty.setValue(this._prevAddPlusButton),(0,gt.currencyUnitVisibilityProperty)().setValue(this._prevCurrencyUnitVisibility),(0,ft.autoLogButtonsVisibilityProperty)().setValue(this._prevAutoLogButtonsVisibility),(0,Yn.property)().setValue(this._prevNavigationButtonsVisibility),(0,Zn.property)().setValue(this._prevPaneButtonsVisibility);const e=this._model.watermarkSource();null!==e&&null!==this._prevWatermarkPreferences&&e.properties().mergeAndFire(this._prevWatermarkPreferences)}}var to=i(70131),io=i(34391);class so{constructor(e){this._leftScales=e.leftPriceScales().map((e=>e.id())),this._rightScales=e.rightPriceScales().map((e=>e.id()))}restorePane(e){this._leftScales.reverse().map((t=>(0,
n.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"left"))),this._rightScales.reverse().map((t=>(0,n.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"right")))}}class ro extends Yt.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._targetStrategy=(0,io.createPriceScaleSelectionStrategy)(t),this._initialState=e.panes().map((e=>new so(e)))}redo(){this._chartModel.panes().forEach((e=>e.setPriceScaleSelectionStrategy(this._targetStrategy))),this._chartModel.fullUpdate()}undo(){const e=this._chartModel.panes();for(let t=0;t{this._undoHistory.beginUndoMacro(e)},endUndoMacro:this._undoHistory.endUndoMacro.bind(this._undoHistory),emitEvent:this.emitEvent.bind(this)})}id(){return this._model().id()}undoHistory(){return this._undoHistory}setWatchedValue(e,t,i){this._undoHistory.setWatchedValue(e,t,i)}lineToolsGroupController(){return this._lineToolsGroupController}mergeAllScales(e){!function(e,t){e.beginUndoMacro("left"===t?os:as),e.model().panes().forEach((i=>{const s="left"===t?i.rightPriceScales():i.leftPriceScales(),r=("left"===t?i.leftPriceScales():i.rightPriceScales()).concat(s),n="overlay"===i.priceScalePosition(i.defaultPriceScale())?r[0]:i.defaultPriceScale();e.movePriceScale(i,n,t,0),r.forEach((t=>{if(t===n)return;let s=t.mainSource();for(;null!==s;){e.moveToScale(s,i,n,null,!0);const r=t.mainSource();if(r===s){ls.logError("Loop detected while trying to merge scales");break}s=r}}))})),e.endUndoMacro(),e.model().fullUpdate()}(this,e)}movePriceScale(e,t,i,s){const r=new cs(this._model(),e,t,i,s,_o);this._pushUndoCommand(r)}createLineTool({pane:e,point:t,linetool:i,properties:s,linkKey:r,ownerSource:o,disableSynchronization:a,sharingMode:l=oa(),id:c}){const h=zn.lineToolsStudyIds[i];if((0,n.assert)(!(0,oi.isStudyLineToolName)(h)||!!h),h){const e=this.canCreateStudy({id:h});if(!e.success)return aa(this.model(),e),(0,oi.isStudyLineToolName)(je.tool.value())&&(0,je.resetToCursor)(),null}const d=No.format({tool:new W.TranslatedString(i,bs.lineToolsLocalizedNames[i])});this.beginUndoMacro(d)
;const u=!a;this._createLineCommand=new Cs({model:this._model(),pane:e,lineTool:i,ownerSource:o||(0,n.ensureNotNull)(e.mainDataSource()),drawOnAllChartsMode:l,id:c});const p=this._createLineCommand.startCreatingLine(t,s,r||null,l,a),_=(0,n.ensureNotNull)(this._createLineCommand.line());let m=null;if(p&&(u&&this.finishLineTool(_),this._pushUndoCommand(this._createLineCommand),this._createLineCommand=null,m={points:_.normalizedPoints(),interval:this.mainSeries().interval()}),u&&void 0===r&&(0,je.drawOnAllCharts)().value()&&_.isSynchronizable()){const e=(0,n.ensureNotNull)(this.model().externalTimeStamp(t.index)),s={point:{price:t.price,timeStamp:e},linetool:i,properties:_.properties(),symbol:this.mainSeries().symbol(),model:this.model(),linkKey:(0,n.ensureNotNull)(_.linkKey().value()),finalState:m,id:_.id(),sharingMode:_.sharingMode().value()};_.isFixed()&&(s.pointPositionPercents=_.calcPositionPercents()),(0,je.createLineTool)(s)}return this.endUndoMacro(),_}continueCreatingLine(e,t,i,s){const r=(0,n.ensureNotNull)(this._createLineCommand);this.beginUndoMacro(r.text());const o=(0,n.ensureNotNull)(this._model().lineBeingCreated()),a=r.continueCreatingLine(e,t,i,s);let l=null;if(a&&(this.finishLineTool(o),this._pushUndoCommand(r),this._createLineCommand=null,l={points:o.normalizedPoints(),interval:this.mainSeries().interval()}),r.drawOnAllCharts()&&o.isSynchronizable()){const i=(0,n.ensureNotNull)(this._model().externalTimeStamp(e.index));(0,je.continueLineTool)({point:{price:e.price,timeStamp:i},envState:t,finalState:l,model:this._model()})}return this.endUndoMacro(),a}continueExternalLine(e,t,i){const s=(0,n.ensureNotNull)(this._createLineCommand),r=s.continueCreatingLine(e,t,i);return r&&(this._pushUndoCommand(s),this._createLineCommand=null),r}finishLineTool(e){this._model().finishLineTool(e)}cancelCreatingLine(){this.m_model.cancelCreatingLine()}lineBeingCreated(){return this.m_model.lineBeingCreated()}pasteImageAsLineTool(e,t,i,s){return null}loadRange(e){const t=this._model(),i=t.appliedTimeFrame().value();return(null===i||!Ji(i,e))&&(this._pushUndoCommand(new rr(t,e)),!0)}mainSeries(){return this.m_model.mainSeries()}model(){return this.m_model}publishedChartsTimelineSource(){return this.m_model.publishedChartsTimelineSource()}unlinkLines(e){const t=this.model();this.beginUndoMacro(mo);for(const i of e)null!==i.linkKey().value()&&(0,je.removeLineTool)({withUndo:!0,model:this.model(),symbol:i.symbol(),linkKey:(0,n.ensureNotNull)(i.linkKey().value()),sourceTitle:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,i),lineToolState:i.state(!1),unlink:!0}),this._pushUndoCommand(new nn(t,i));this.endUndoMacro()}zoomFromViewport(){const e=new sn((0,n.ensureDefined)(this._zoomStack.head()),this._zoomStack,!1);this._pushUndoCommand(e)}zoomToViewport(e,t,i,s,r){const n=new Qr(this.m_model,e,t,i,s,r),o=new sn(n,this._zoomStack,!0);this._pushUndoCommand(o)}zoomStack(){return this._zoomStack}timeScale(){return this.m_model.timeScale()}selection(){return this.m_model.selection()}selectionMacro(e,t){
return this.m_model.selectionMacro(e,t)}onSelectedSourceChanged(){return this.m_model.onSelectedSourceChanged()}onTagsChanged(){return this.m_model.onTagsChanged()}lineCancelled(){return this.m_model.lineCancelled()}hoveredSource(){return this.m_model.hoveredSource()}crossHairSource(){return this.m_model.crossHairSource()}activeStrategySource(){return this.m_model.activeStrategySource()}setProperty(e,t,i,s){if(e&&e.value()!==t){this.beginUndoMacro(i);const r=new tr(e,t,i,this.m_model,!s);this._pushUndoCommand(r),this.endUndoMacro(),this.emitEvent("setProperty")}}setProperties(e,t,i,s=!0){this.beginUndoMacro(i),this.m_model.selectionMacro((()=>{for(let r=0;r{this.startScaleTime(0),this.scaleTimeTo(e),this.endScaleTime()}}))}zoomIn(){const e=this.timeScale().width();this.canZoomIn()&&(this.changeTimeScale(fo),(0,is.doAnimate)({to:e/5,onStep:e=>{this.startScaleTime(e),this.scaleTimeTo(0),this.endScaleTime()}}))}scrollChart(e){this.m_model.scrollEnabled()&&(this.startScrollTime(0),this.scrollTimeTo(e),this.endScrollTime())}startMovingSources(e,t,i,s){e.filter((e=>e.doesMovingAffectsUndo())).length&&(this._currentSourceMoveCommand=new ms(this.model(),e,vo,!1)),
this.model().startMovingSources(e,t,i,new Map,s)}moveSources(e,t){this.model().moveSources(e,new Map,t)}endMovingSource(e,t){this.model().endMovingSources(e,void 0,t),null!==this._currentSourceMoveCommand&&(this._currentSourceMoveCommand.saveNewState(),this._pushUndoCommand(this._currentSourceMoveCommand)),this._currentSourceMoveCommand=null}startChangingLinetool(e,t,i,s,r){this._currentLineChangeCommand=new ms(this.model(),[e],Oo.format({pointIndex:i}),!1),this.model().startChangingLinetool(e,t,i,s,r)}changeLinePoint(e,t){this.model().changeLinePoint(e,t)}endChangingLinetool(e){this.model().endChangingLinetool(e),null!==this._currentLineChangeCommand&&(this._currentLineChangeCommand.saveNewState(),this._pushUndoCommand(this._currentLineChangeCommand)),this._currentLineChangeCommand=null}setChartStyleProperty(e,t,i){if(e.value()!==t){const s=void 0,r=()=>{this.beginUndoMacro(i);const s=new ir(e,t,this.mainSeries(),i,this.model(),this._chartWidget);this._pushUndoCommand(s),this.emitEvent("setChartStyleProperty"),e.value(),this.endUndoMacro()};s?runOrGoPro(r,s.feature,{feature:s.featureName}):r()}}setPriceAutoScale(e,t,i){this._pushUndoCommand(new ti(this.m_model,e,t,t.state())),this.m_model.setPriceAutoScale(e,t,i)}setPriceScaleMode(e,t,i){if(!(0,Be.default)(t.mode(),e)){const s=new Kr.SetPriceScaleModeCommand(e,t,i,this.m_model);this._pushUndoCommand(s)}}setPriceScaleSelectionStrategy(e){if(this.m_model.properties().priceScaleSelectionStrategyName.value()===e)return;(0,u.trackEvent)("Chart","Change PriceScale Selection Strategy");const t=Xo.format({title:e});this.beginUndoMacro(t),this.setProperty(this.m_model.properties().priceScaleSelectionStrategyName,e,t);const i=new ro(this.m_model,e,t);this._pushUndoCommand(i),this.endUndoMacro()}setScaleRatioProperty(e,t,i){if(e.value()!==t){const s=new to.SetScaleRatioPropertiesCommand(e,t,i,this.m_model);this._pushUndoCommand(s)}}createUndoCheckpoint(){return this._undoHistory.createUndoCheckpoint()}undoToCheckpoint(e){this._undoHistory.undoToCheckpoint(e)}restorePropertiesForSource(e){(0,J.isLineTool)(e)?this._restoreLineToolFactoryDefaults(e):this._restoreStudyFactoryDefaults(e)}restoreLineToolsFactoryDefaults(e){1===e.length?this._restoreLineToolFactoryDefaults(e[0]):(this.beginUndoMacro(So),e.forEach((e=>this._restoreLineToolFactoryDefaults(e))),this.endUndoMacro())}restorePreferences(){const e=new eo(this.model());this._pushUndoCommand(e)}restoreState(e,t,i){return this.m_model.restoreState(e,t,i)}async clipboardCopy(e,t=this.selection().dataSources()){if(!(0,N.enabled)("datasource_copypaste"))return;const i=t.filter((e=>e.copiable()));if(0===i.length)return;for(const e of i)if((0,Z.isStudy)(e)&&e.isChildStudy())throw new Error("Can not copy child study");const s=(0,ts.clipboardDataForSources)(this._model().id(),i);return null!==s?e.write({app:JSON.stringify(s),text:s.title}):void 0}async clipboardCut(e,t=this.selection().dataSources()){if(!(0,N.enabled)("datasource_copypaste"))return;const i=t.filter((e=>e.copiable()));if(0===i.length)return
;await this.clipboardCopy(e,i);const s=i.filter((e=>e.isUserDeletable()));if(0===s.length)return;const r=(1===s.length?co:ho).format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,s[0])});this.beginUndoMacro(r),this.m_model.selectionMacro((()=>this.removeSources(s,!1,r)),!0),this.endUndoMacro()}async clipboardPaste(e,t){let i=null;if((0,N.enabled)("datasource_copypaste")&&(i=i||await e.read(),i.app)){const e=JSON.parse(i.app);if(null!==await this.pasteSourceFromClip(t,e))return}await this._processSpecialLineToolsContents(e,i,t)}applyStudyTemplate(e,t){const i=new Ir(this._model(),e,t);this._pushUndoCommand(i),(0,l.emit)("load_study_template")}createStudyInserter(e,t,i={}){const{stubTitle:s,isOverlay:r}=i,n={createStudy:(e,t,i,s,r,n,o,a,c,h,d,p)=>{if(!this.checkIfFeatureAvailable(e,o))return ia.logNormal("Cannot insert study "+e.id),null;(0,u.trackEvent)("studies","Study_"+e.id),"Compare@tv-basicstudies"===e.id&&(0,u.trackEvent)("compare","symbol:"+t.symbol),s&&this.m_model.removeSource(s);const _=this._insertStudy(e,t,r,n,o,a,c,h,d,null,p);return(0,l.emit)("study_event",_.study.id(),"create"),_},storeFailedStub:e=>{this._storeFailedStub(e)}};void 0!==s&&(n.createStub=()=>this.m_model.insertStudyStub(s,r).id(),n.removeStub=e=>this.m_model.removeStudyStub(e));const o=new Hn.StudyInserter(e,n);return o.setParentSources(t),o}applyLineToolTemplate(e,t,i){this.beginUndoMacro(i),this.saveLineToolState(e,i);const s=new jn(e,t,i);this._pushUndoCommand(s),this.saveLineToolState(e,i),this.endUndoMacro(),this.model().updateSource(e)}replayStatus(){return this.m_model.replayStatus()}setReplayStatus(e){return this.m_model.setReplayStatus(e)}isInReplay(){return this.m_model.isInReplay()}getSymbolString(){return this.m_model.getSymbolString()}interval(){return this.m_model.interval()}onInReplayStateChanged(){return this.m_model.onInReplayStateChanged()}switchToReplay(e,t){0}switchToRealtime(){0}async canChangeResolution(e){return this.model().canChangeResolution(e)}startCustomMoving(e,t,i){this._currentCustomMoveCommand=new qr(this.model(),e,t,i)}customMoveBeingProcessed(){return null!==this._currentCustomMoveCommand}processCustomMove(e){(0,n.ensureNotNull)(this._currentCustomMoveCommand).move(e)}endCustomMoving(){null!==this._currentCustomMoveCommand&&this._currentCustomMoveCommand.hasChanges()&&(this._pushUndoCommand(this._currentCustomMoveCommand),this._currentCustomMoveCommand=null)}state(e,t,i,s){return this.m_model.state(e,t,i,s)}panes(){return this.m_model.panes()}cloneLineTools(e,t){for(let t=0;t(0,n.ensureNotNull)(this.model().dataSourceForId(e)))).filter((e=>0!==e.sharingMode().value()));return s.length&&this._model().copyToOtherCharts(s,!0),this.endUndoMacro(),this.emitEvent("cloneLineTools"),i.newIds()}removeSource(e,t,i){this.lineBeingCreated()!==e?this.removeSources([e],t,uo.format({title:(0,
ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),i):this.cancelCreatingLine()}removeSelectedSources(){const e=this._model().selection().dataSources();if(!e.length)return;const t=(e.length>1?po:uo).format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0])});this.removeSources(e,!1,t)}removeSources(e,t,i,s){s||(e=e.filter((e=>e.isUserDeletable())));const r=this._model(),o=r.lineToolsGroupModel();this.beginUndoMacro(i),r.selectionMacro((s=>{const a=new Map;e.forEach((e=>{if((0,J.isLineTool)(e)){const t=o.groupForLineTool(e);if(null!==t){const i=a.get(t)||[];i.push(e),a.set(t,i)}null!==e.linkKey().value()&&(0,je.removeLineTool)({withUndo:!0,model:this.model(),linkKey:(0,n.ensureNotNull)(e.linkKey().value()),symbol:this.model().mainSeries().symbol(),lineToolState:e.state(!1),sourceTitle:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)})}}));const l=new us.RemoveSourcesUndoCommand(r,e,i),c=l.removedIds();this._pushUndoCommand(l),!t&&c.length>0&&(1===c.length?this.emitEvent("removeSource",[c[0]]):this.emitEvent("removeSources",[c]))}),!0),this.endUndoMacro()}async scrollToLineTool(e){const t=this.timeScale().logicalRange();if(null===t)return;const i=e.points().map((e=>e.index)),s=this.timeScale().points().range().value();if(null===s)return;let r=s.firstIndex;const o=s.lastIndex,a=t.length()/2;if(0===i.length||i.some((e=>t.contains(e))))return;const l=()=>{const t=e.points().map((e=>e.index)),i=t.filter((e=>e<=o)).reduce(((e,t)=>null===e?t:Math.max(e,t)),null);return null!==i?i:t.reduce(((e,t)=>Math.min(e,t)))};let c=l();if(r-a>c){const t=e.points().map((e=>e.time)).filter(P.notUndefined).map((e=>1e3*e));if(0===t.length)return;const i=t.reduce(((e,t)=>Math.min(e,t)),t[0]);await this.model().gotoTime(i),c=l();if((0,n.ensureNotNull)(this.timeScale().logicalRange()).contains(c))return;r=(0,n.ensureNotNull)(this.timeScale().points().range().value()).firstIndex}r-a>c&&this.mainSeries().setGotoDateResult({timestamp:(0,n.ensureNotNull)(this.timeScale().points().valueAt(r)),eod:!0});const h=this.timeScale().width()/2,d=this.timeScale().indexToCoordinate(c);this.model().stopTimeScaleAnimation(),this.model().setTimeScaleAnimation(new es.Animation({from:0,to:h-d,duration:$i.dur,easing:$i.easingFunc.easeInOutCubic}))}mergeSourceUp(e){const t=new fs.MergeUpUndoCommand(this._model(),e,Po);this._mergeUnmergeSource(e,t)}mergeSourceDown(e){const t=new fs.MergeDownUndoCommand(this._model(),e,xo);this._mergeUnmergeSource(e,t)}mergeToPane(e,t,i){const s=this._model().panes().indexOf(t),r=new fs.MergeToTargetPane(this._model(),e,s,To,i);this._mergeUnmergeSource(e,r)}unmergeSourceUp(e){const t=new gs.UnmergeUpUndoCommand(this._model(),e,Io);this._mergeUnmergeSource(e,t)}unmergeSourceDown(e){const t=new gs.UnmergeDownUndoCommand(this._model(),e,Mo);this._mergeUnmergeSource(e,t)}unmergeToNewBottomPane(e){const t=new gs.UnmergeToNewBottomPane(this._model(),e,Ao);this._mergeUnmergeSource(e,t)}moveLeft(){this.beginUndoMacro(Yo),(0,is.doAnimate)({
to:this.m_model.timeScale().width()/5,onStep:e=>{this.startScrollTime(e),this.scrollTimeTo(0),this.endScrollTime()},onComplete:()=>{this.endUndoMacro()}})}moveRight(){this.beginUndoMacro(Zo),(0,is.doAnimate)({to:this.m_model.timeScale().width()/5,onStep:e=>{this.startScrollTime(0),this.scrollTimeTo(e),this.endScrollTime()},onComplete:()=>{this.endUndoMacro()}})}availableZOrderOperations(e){const t=this._model().lineToolsGroupModel(),i=e.filter(J.isLineTool),s=i.map((e=>t.groupForLineTool(e)));(0,n.assert)(new Set(s).size<=1,"Cannot move line tools from different group");const r=0===s.length?null:s[0];let o={bringForwardEnabled:!1,bringToFrontEnabled:!1,sendBackwardEnabled:!1,sendToBackEnabled:!1};const a=new Set(i);for(const t of(0,vs.sortSources)(e)){if((0,J.isLineTool)(t)&&null!==r){const e=(0,vs.sortSources)(r.lineTools().filter((e=>!a.has(e)||e===t)));o=ra(o,{bringForwardEnabled:t!==e[e.length-1],bringToFrontEnabled:t!==e[e.length-1],sendBackwardEnabled:t!==e[0],sendToBackEnabled:t!==e[0]});continue}const e=(0,n.ensureNotNull)(this._model().paneForSource(t)).sourcesByGroup().allExceptSpecialSources();if(0===e.length)continue;const i=t.zorder(),s=e[0].zorder(),l=e[e.length-1].zorder();o=ra(o,{bringForwardEnabled:i!==l,bringToFrontEnabled:i!==l,sendBackwardEnabled:i!==s,sendToBackEnabled:i!==s})}return o}sendToBack(e){if(!this.availableZOrderOperations(e).sendToBackEnabled)throw new Error("Send to back operation is unavailable");let t=null;const i=e[0];if((0,J.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new Ws(this.model(),(0,vs.sortSources)(e),i[0])}}null===t&&(t=new Rs(this.model(),(0,vs.sortSources)(e))),this._pushUndoCommand(t),this.emitEvent("changeZOrder",[e])}bringToFront(e){if(!this.availableZOrderOperations(e).bringToFrontEnabled)throw new Error("Bring to front operation is unavailable");let t=null;const i=e[0];if((0,J.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new Os(this.model(),(0,vs.sortSources)(e),i[i.length-1])}}null===t&&(t=new Bs(this.model(),(0,vs.sortSources)(e))),this._pushUndoCommand(t),this.emitEvent("changeZOrder",[e])}sendBackward(e){if(!this.availableZOrderOperations(e).sendBackwardEnabled)throw new Error("Send backward operation is unavailable");const t=no.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0])});this._sendBackOrBringForward(t,(0,vs.sortSources)(e),((e,t)=>new zs(this.model(),e,t)))}bringForward(e){if(!this.availableZOrderOperations(e).bringForwardEnabled)throw new Error("Bring forward operation is unavailable");const t=oo.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0])});this._sendBackOrBringForward(t,(0,vs.sortSources)(e),((e,t)=>new js(this.model(),e,t)))}insertAfter(e,t){e=(0,vs.sortSources)(e);const i=ao.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0]),target:(0,
ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,t)});this._insertAfterOrBefore(i,e,t,(()=>new Os(this.model(),e,t)))}insertBefore(e,t){e=(0,vs.sortSources)(e);const i=lo.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0]),target:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,t)});this._insertAfterOrBefore(i,e,t,(()=>new Ws(this.model(),e,t)))}detachToRight(e,t){(0,u.trackEvent)("Chart","Move to new right scale");const i=Lo.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),s=new Rr.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"right",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachToLeft(e,t){(0,u.trackEvent)("Chart","Move to new left scale");const i=ko.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),s=new Rr.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"left",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachNoScale(e,t){(0,u.trackEvent)("Chart","Make source no scale");const i=Do.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),s=new Rr.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"overlay",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}moveToScale(e,t,i,s,r){(0,u.trackEvent)("Chart","Move source to target scale"),this.beginUndoMacro(s);const n=new Rr.MoveToExistingPriceScaleUndoCommand(this.model(),e,t,i,s),o=r?null:(0,ss.sourceNewCurrencyOnPinningToPriceScale)(e,i,this._model()),a=r?null:(0,Xr.sourceNewUnitOnPinningToPriceScale)(e,i,this._model());this._pushUndoCommand(n),null!==o&&this.setPriceScaleCurrency(i,o),null!==a&&this.setPriceScaleUnit(i,a),this.endUndoMacro(),this.emitEvent("moveSource",[e])}setLinkingGroupIndex(e){this._undoHistory.beginUndoMacro(ta),this._pushUndoCommand(new Wn(this.model().linkingGroupIndex(),e,ta)),this._model().setShouldBeSavedEvenIfHidden(!0),this._undoHistory.endUndoMacro()}startScrollPrice(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this._model().startScrollPrice(e,t,i))}scrollPriceTo(e,t,i){t.isAutoScale()||(this._initialPriceScrollState&&this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this._pushUndoCommand(new ti(this.m_model,e,t,this._initialPriceScrollState,void 0,!1)),this._initialPriceScrollState=null,this._initialPriceScrollPos=null),this._model().scrollPriceTo(e,t,i))}endScrollPrice(e,t){t.isAutoScale()||(this._initialPriceScrollState=null,this._initialPriceScrollPos=null,this._model().endScrollPrice(e,t))}startScrollTime(e){const t=this.timeScale();this._initialTimeScrollState={rightOffset:t.rightOffset(),barSpacing:t.barSpacing()},this._initialTimeScrollPos=e,this.model().startScrollTime(e)}scrollTimeTo(e){null!==this._initialTimeScrollPos&&null!==this._initialTimeScrollState&&Math.abs(e-this._initialTimeScrollPos)>20&&(this._pushUndoCommand(new Xt(this.model(),this._initialTimeScrollState,Eo,!1)),this._initialTimeScrollPos=null,
this._initialTimeScrollState=null),this.model().scrollTimeTo(e)}endScrollTime(){this.model().endScrollTime(),this._initialTimeScrollPos=null,this._initialTimeScrollState=null}startScaleTime(e){const t=this.timeScale();this._initialTimeScaleState={rightOffset:t.rightOffset(),barSpacing:t.barSpacing()},this.model().startScaleTime(e)}scaleTimeTo(e){null!==this._initialTimeScaleState&&this._initialTimeScaleState.barSpacing!==this.timeScale().barSpacing()&&(this._pushUndoCommand(new Xt(this.model(),this._initialTimeScaleState,Vo,!0)),this._initialTimeScaleState=null),this.model().scaleTimeTo(e)}endScaleTime(){this.model().endScaleTime()}resetTimeScale(){this.changeTimeScale(Bo,this.timeScale().resetAvailable().value()),this.model().resetTimeScale()}changeTimeScale(e,t=!0){const i=this.timeScale(),s={rightOffset:i.rightOffset(),barSpacing:i.barSpacing()};this._pushUndoCommand(new Xt(this.model(),s,e,t))}startScalePrice(e,t,i,s){this._scalePriceInfo={priceScaleState:t.state(),tryMergeConsecutiveScales:s},this.model().startScalePrice(e,t,i)}scalePriceTo(e,t,i){this.model().scalePriceTo(e,t,i)}endScalePrice(e,t){this.model().endScalePrice(e,t);const i=(0,n.ensureNotNull)(this._scalePriceInfo);(0,Be.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new ti(this.model(),e,t,i.priceScaleState,i.tryMergeConsecutiveScales)),this._scalePriceInfo=null}startTwoPointsScalePrice(e,t,i,s,r){this._scalePriceInfo={priceScaleState:t.state(),tryMergeConsecutiveScales:r},this.model().startTwoPointsScalePrice(e,t,i,s)}twoPointsScalePriceTo(e,t,i,s){this.model().twoPointsScalePriceTo(e,t,i,s)}endTwoPointsScalePrice(e,t){this.model().endTwoPointsScalePrice(e,t);const i=(0,n.ensureNotNull)(this._scalePriceInfo);(0,Be.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new ti(this.model(),e,t,i.priceScaleState,i.tryMergeConsecutiveScales)),this._scalePriceInfo=null}resetPriceScale(e,t){const i=t.state();this.model().resetPriceScale(e,t),(0,Be.default)(i,t.state())||this._pushUndoCommand(new ti(this.m_model,e,t,i))}rearrangePanes(e,t){const i=new Ys(this._model(),e,t);this._pushUndoCommand(i)}movePane(e,t){const i=new Ys(this._model(),e,t);this._pushUndoCommand(i)}toggleCollapsedPane(e){const t=this.panes().findIndex((t=>t===e));t<0||this._pushUndoCommand(new ns(this._model(),t))}readOnly(){return this.m_model.readOnly()}checkIfFeatureAvailable(e,t){const i=t.length>0,s=this.canCreateStudy({id:e.id,child:i,fundamental:!1});return!!s.success||(aa(this.model(),s),!1)}async pasteSourceFromClip(e,t,i){const s=t;if(!s||0===s.sources.length)return null;const r=e||(0,n.ensureNotNull)(this.model().paneForSource(this.mainSeries()));if(!s.sources.some((e=>"drawing"!==e.type||null!==r.clipboardLineToolOwnerSource(e.source.id))))return null;const o=Array.from(new Set(s.sources.filter(ts.isLineToolClipboardData).map((e=>e.source.type))));await Promise.all(o.map((e=>(0,J.initLineTool)(e)))),this.beginUndoMacro(Fo.format({title:s.title}));let a=0;const l=[],c=[]
;for(const t of s.sources)if("drawing"===t.type&&null!==r.clipboardLineToolOwnerSource(t.source.id)){const e=this.pasteLineTool(r,t);a<5&&(ri(),a+=1),c.push(e),l.push(e)}else"study"===t.type&&t.source&&t.source.metaInfo&&this.checkIfFeatureAvailable(new Yi.StudyMetaInfo(t.source.metaInfo),[])&&l.push(this.pasteStudy(t,i?e:void 0));return c.length&&this.selectionMacro((e=>{e.clearSelection(),c.forEach((t=>{e.addSourceToSelection(t,null)}))})),this.endUndoMacro(),l}pasteLineTool(e,t,i,s){t.source.state.intervalsVisibilities=(0,un.mergeIntervalVisibilitiesDefaults)(t.source.state.intervalsVisibilities),(0,un.makeIntervalsVisibilitiesVisibleAtInterval)(t.source.state.intervalsVisibilities,this.model().mainSeries().intervalObj());const r=new Er(this.model(),t,e,i,s);this._pushUndoCommand(r);const n=r.source();return r.needCopyToOtherCharts()&&this._model().copyToOtherCharts([n],!0),this.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(n,null)})),n}pasteStudy(e,t){const i=new Ur(this.model(),e,null==t?void 0:t.id());this._pushUndoCommand(i);const s=(0,n.ensureNotNull)(i.state()).id;return(0,l.emit)("study_event",s,"paste_study"),(0,n.ensureNotNull)(this._model().dataSourceForId(s))}removePane(e){const t=this.m_model.panes()[e].dataSources().slice();this.removeSources(t,!1,Ho)}createPane(e){return this.m_model.createPane(e)}setPriceScaleCurrency(e,t){const i=new Vr.SetPriceScaleCurrencyUndoCommand(this.m_model,e,t,bo);this._pushUndoCommand(i)}setPriceScaleUnit(e,t){const i=new Br.SetPriceScaleUnitUndoCommand(this.m_model,e,t,wo);this._pushUndoCommand(i)}setSymbol(e,t){e.symbolSameAsResolved(t)||this._pushUndoCommand(new Wr(e,t,this._chartWidget))}setResolution(e,t){Xi.Interval.isEqual(e.interval(),t)||this._pushUndoCommand(new On(e,t,this._chartWidget))}hideMaximizedPaneIfRequired(){this._chartWidget.isMaximizedPane()&&this._chartWidget.toggleMaximizePane(null)}syncCrosshair(e,t,i){this._chartWidget.chartWidgetCollection().syncCrosshair(e,this._chartWidget.id(),t,i)}loadingScreen(){return this._chartWidget.screen}chartLoadTheme(e,t,i){const s=new Rn(this.model(),e,t);i?s.redo():this._pushUndoCommand(s)}isJustClonedChart(){return this._chartWidget.isJustClonedChart()}isMultipleLayout(){return this._chartWidget.isMultipleLayout()}addPaneStretchFactorUndoCommand(e,t,i,s){const r=new jr(this.model(),e,t,i,s);this._pushUndoCommand(r)}applyPreferences(e){throw new Error("Not implemented")}paneForSource(e){return this.m_model.paneForSource(e)}destroy(){this.m_model.destroy()}moveSelectedToolsLeft(){return this._moveSelectedTools(2)}moveSelectedToolsUp(){return this._moveSelectedTools(0)}moveSelectedToolsRight(){return this._moveSelectedTools(3)}moveSelectedToolsDown(){return this._moveSelectedTools(1)}insertStudyWithoutCheck(e,t,i,s){return this._insertStudy(e,t,{},!1,[],void 0,void 0,void 0,void 0,null!=i?i:null,void 0,s)}saveLineToolState(e,t){this._pushUndoCommand(new ms(this.m_model,[e],t))}resetScales(){this._model().stopTimeScaleAnimation(),this.beginUndoMacro(Ro),this.resetTimeScale()
;for(const e of this.m_model.panes()){for(const t of e.leftPriceScales())this.resetPriceScale(e,t);for(const t of e.rightPriceScales())this.resetPriceScale(e,t)}this.endUndoMacro(),this.m_model.recalculateAllPanes((0,pi.viewportChangeEvent)())}shareLineTools(e,t){}canCreateStudy(e,t){return this.model().chartApi().canCreateStudy(e,t)}chartWidgetCollectionLock(){return this._chartWidget.chartWidgetCollection().lock}onSymbolIntervalChanged(){return this.m_model.onSymbolIntervalChanged()}paneBeingCreatedLineOn(){return this.m_model.paneBeingCreatedLineOn()}invalidate(e){this.m_model.invalidate(e)}setWidth(e){this.m_model.setWidth(e)}setPaneHeight(e,t){this.m_model.setPaneHeight(e,t)}dataSourceForId(e){return this.m_model.dataSourceForId(e)}lineBeingEdited(){return this.m_model.lineBeingEdited()}sourcesBeingMoved(){return this.m_model.sourcesBeingMoved()}gridSource(){return this.m_model.gridSource()}watermarkSource(){return this.m_model.watermarkSource()}mainSeriesScaleRatioProperty(){return this.m_model.mainSeriesScaleRatioProperty()}setHoveredSource(e,t){this.m_model.setHoveredSource(e,t)}setCurrentPosition(e,t,i,s){this.m_model.setCurrentPosition(e,t,i,s)}setAndSaveCurrentPosition(e,t,i,s){this.m_model.setAndSaveCurrentPosition(e,t,i,s)}version(){return this.m_model.version()}restart(){this.m_model.restart()}disconnect(){this.m_model.disconnect()}calculateDefaultTags(){return this.m_model.calculateDefaultTags()}_model(){return this.m_model}_pushUndoCommand(e){this._undoHistory.pushUndoCommand(e)}_mergeUnmergeSource(e,t){this.beginUndoMacro(t.text());const i=(0,n.ensureNotNull)(this._model().paneForSource(e)),s=new Set(i.sourcesByGroup().lineSources().filter((t=>t.ownerSource()===e)));this._model().lineToolsGroupModel().groups().filter((e=>{const t=e.lineTools().some((e=>s.has(e))),i=e.lineTools().some((e=>!s.has(e)));return t&&i})).forEach((e=>{this._pushUndoCommand(new ps.ExcludeLineToolsFromGroupUndoCommand(this._model(),e,e.lineTools()))})),this._pushUndoCommand(t),this.endUndoMacro()}_insertStudy(e,t,i,s,r,o,a,l,c,h,d,u){const p=Wo.format({title:e.description});this.beginUndoMacro(p);const _=new $r(this.model(),e,t,i,s,r,o,a,l,c,h||null,u,p);this._pushUndoCommand(_);const m=_.insertedStudy();if(void 0!==d){const e=new Kr.SetPriceScaleModeCommand(d,(0,n.ensureNotNull)(m.priceScale()),null,this.model());this._pushUndoCommand(e)}return this.endUndoMacro(),{study:m,startPromise:_.lastInsertionStartPromise()}}_storeFailedStub(e){const t=Wo.format({title:e.title()});this.beginUndoMacro(t);const i=new Un(this.model(),e,t);this._pushUndoCommand(i),this.endUndoMacro()}async _processSpecialLineToolsContents(e,t,i){0}_insertAfterOrBefore(e,t,i,s){const r=(0,n.ensureNotNull)(this._model().paneForSource(i));if(t.some((e=>(0,J.isLineTool)(e)&&this._model().paneForSource(e)!==r)))throw new Error("Cannot insert line tool after target on another pane");this.beginUndoMacro(e),t.forEach((e=>{(0,n.ensureNotNull)(this.model().paneForSource(e))!==r&&this.mergeToPane(e,r)}));const o=s();this._pushUndoCommand(o),
this.emitEvent("changeZOrder",[t]),this.endUndoMacro()}_sendBackOrBringForward(e,t,i){const s=new Map;t.forEach((e=>{const t=(0,n.ensureNotNull)(this._model().paneForSource(e)),i=s.get(t)||[];i.push(e),s.set(t,i)})),this.beginUndoMacro(e),s.forEach(((e,t)=>{this._pushUndoCommand(i(t,e))})),this.endUndoMacro(),this.emitEvent("changeZOrder",[t])}_moveSelectedTools(e){const t=this.model().selection().lineDataSources();if(0===t.length)return!1;if((0,je.lockDrawings)().value())return!0;const i=this.timeScale().visibleBarsStrictRange();if(null===i)return!1;const s=function(e){const t=new Map;for(const i of e){const e=i.ownerSource();if(null===e)continue;let s=t.get(e);if(void 0===s){const r=e.priceScale(),n=e.priceStep(),o=e.firstValue();if(null===r||null===n||null===o)continue;if(null===r.priceRange())continue;s={sources:[],priceScale:r,priceStep:n,startPrice:i.points()[0].price,firstValue:o},t.set(e,s)}s.sources.push(i)}return t}(t);if(0===s.size)return!1;this.beginUndoMacro(vo);const r=i.firstBar(),n=this.timeScale().indexToCoordinate(r),o=r+(3===e?1:2===e?-1:0),a=this.timeScale().indexToCoordinate(o);return je.isDirectionalMovementActive.setValue(!0),s.forEach((t=>{const{startPrice:i,priceStep:s,priceScale:l,firstValue:c}=t,h=i+(0===e?s:1===e?-s:0),d=l.priceToCoordinate(i,c),u=l.priceToCoordinate(h,c),p={logical:{index:r,price:i},screen:new Oe.Point(n,d)},_={logical:{index:o,price:h},screen:new Oe.Point(a,u)};this.startMovingSources(t.sources,p,null),this.moveSources(_),this.endMovingSource(!1,!0)})),je.isDirectionalMovementActive.setValue(!1),this.endUndoMacro(),!0}_restoreStudyFactoryDefaults(e){const t=new dn(this.m_model,e);this._pushUndoCommand(t)}_restoreLineToolFactoryDefaults(e){this.beginUndoMacro(yo),this.saveLineToolState(e,yo);const t=new cn(this.m_model,e.properties(),yo);this._pushUndoCommand(t),this.saveLineToolState(e,yo),this.endUndoMacro(),this.model().updateSource(e)}_removeAllDrawingToolsImpl(e){this.selectionMacro((()=>{this.lineBeingCreated()&&this.cancelCreatingLine();this.dataSources().filter(J.isLineTool).filter((e=>e.isActualSymbol()&&e.isUserDeletable())).filter((t=>!e||e===t.toolname)).forEach((e=>this.removeSource(e,!1)))}),!0)}_removeAllStudiesImpl(){const e=this.dataSources(),t=e.filter(Z.isStudy).filter((e=>!e.isChildStudy()&&e.removeByRemoveAllStudies())),i=e.filter(Z.isStudyStub);t.concat(i).forEach((e=>this.removeSource(e,!1)))}}var ca=i(16638),ha=i(36986),da=i(79612),ua=i(17402);const pa=a.t(null,void 0,i(47773));var _a=i(3615);class ma extends class{constructor(e){this._lastResolvedSymbol=null,this._chart=e,this._chart.withModel(this,this._connectToModel)}_getPopupContent(){const e=this._getProSymbol(),t=new URL("https://www.tradingview.com/chart/");t.searchParams.append("symbol",e),t.searchParams.append("utm_source","www.tradingview.com"),t.searchParams.append("utm_medium","widget"),t.searchParams.append("utm_campaign","chart"),t.searchParams.append("utm_term",e);return pa.format({linkStart:``,linkEnd:""})}_onPopupClosed(){
const e=this._chart.defaultSymbol(),t=this._getSymbol();let i;i=this._lastResolvedSymbol?this._lastResolvedSymbol:e!==t?e:"AAPL",this._chart.setSymbol(i)}_getProSymbol(){return this._chart.model().mainSeries().proSymbol()}_getSymbol(){return this._chart.model().mainSeries().actualSymbol()}_connectToModel(){const e=this._chart.model().mainSeries();e.dataEvents().symbolResolved().subscribe(this,this._onSymbolResolved),e.dataEvents().symbolGroupNotPermitted().subscribe(this,this._onSymbolGroupNotPermitted),e.dataEvents().symbolNotPermitted().subscribe(this,this.show)}_onSymbolResolved(){this._lastResolvedSymbol=this._getSymbol()}_onSymbolGroupNotPermitted(){this.show()}}{show(){(0,_a.showWarning)({title:"Unavailable",html:this._getPopupContent(),onClose:()=>this._onPopupClosed()})}}const ga=(0,m.getLogger)("ChartApi.AbstractSession");var fa;!function(e){e[e.Disconnected=0]="Disconnected",e[e.Registered=1]="Registered",e[e.Connected=2]="Connected"}(fa||(fa={}));class va extends class{constructor(e,t,i){this._isConnected=new H.WatchedValue(!1),this._state=0,this._isConnectForbidden=!1,this._sessionId="",this._sessionIdChanged=new R.Delegate,this._chartApi=e,this._sessionPrefix=t,this._shouldReconnectAfterCriticalError=i}destroy(){this._logNormal("Destroying session"),this._isConnected.unsubscribe(),this.disconnect(),this._sessionIdChanged.destroy(),delete this._chartApi,this._logNormal("Session has been destroyed")}isConnected(){return this._isConnected}sessionId(){return this._sessionId}onSessionIdChanged(){return this._sessionIdChanged}connect(){0===this._state&&((0,n.assert)(!this._isConnectForbidden,"Cannot call connect because it is forbidden at this moment"),this._setSessionId(`${this._sessionPrefix}_${(0,Mr.randomHash)()}`),this._logNormal("Connecting session - wait until transport stay connected"),this._state=1,this._chartApi.createSession(this._sessionId,this))}disconnect(){0!==this._state&&((0,n.assert)(""!==this._sessionId,"sessionId must not be invalid"),this._logNormal("Disconnecting session..."),this._forbidConnectWhile((()=>{this._chartApi.connected()&&this._sendRemoveSession(),this._processDestroyingOnServer()})))}onMessage(e){switch(e.method){case"connected":return void this._onChartApiConnected();case"disconnected":return void this._onChartApiDisconnected();case"critical_error":const t=String(e.params[0]),i=String(e.params[1]);return void this._onCriticalError(t,i)}this._onMessage(e)}serverTime(){return this._chartApi.serverTime()}_getChartApi(){return this._chartApi}_generateLogMessage(e){return`[${this._sessionId}] ${e}`}_onCriticalError(e,t){this._logError(`Critical error. Reason=${e}, info=${t}.`),this._forbidConnectWhile((()=>{this._processDestroyingOnServer()})),this._shouldReconnectAfterCriticalError?(this._logNormal("Reconnecting after critical error..."),this.connect()):this._logNormal("Reconnecting after critical error skipped")}_onChartApiConnected(){(0,n.assert)(1===this._state,"Session is not registered"),this._logNormal("Transport is connected. Creating session on the server"),
this._sendCreateSession(),this._state=2,this._isConnected.setValue(!0)}_onChartApiDisconnected(){this._logNormal("Transport is disconnected. Reconnecting..."),this._forbidConnectWhile((()=>{this._processDestroyingOnServer()})),this.connect()}_setSessionId(e){const t=this._sessionId;this._logNormal(`Changing sessionId: old=${t}, new=${e}`),this._sessionId=e,this._sessionIdChanged.fire(e,t)}_logNormal(e){ga.logNormal(this._generateLogMessage(e))}_logError(e){ga.logError(this._generateLogMessage(e))}_processDestroyingOnServer(){this._state=0,this._isConnected.setValue(!1),this._chartApi.removeSession(this._sessionId),this._setSessionId("")}_forbidConnectWhile(e){this._isConnectForbidden=!0,e(),this._isConnectForbidden=!1}}{constructor(e,t=!1){super(e,"cs",!1),this._sessionDisabled=!1,this._handler=null,this._criticalError=new R.Delegate,this._symbolResolveMap=new Map,this._lastSymbolResolveInfoMap=new Map,this._disableStatistics=t}destroy(){this._criticalError.destroy(),this._handler=null,this._symbolResolveMap.clear(),super.destroy()}switchTimezone(e){return this._getChartApi().switchTimezone(this.sessionId(),e)}defaultResolutions(){return this._getChartApi().defaultResolutions()}availableCurrencies(){return this._getChartApi().availableCurrencies()}availableUnits(){return this._getChartApi().availableUnits()}availablePriceSources(e){return this._getChartApi().availablePriceSources(e)}resolveSymbol(e,t,i){if(this._symbolResolveMap.has(t)){const[e,s]=this._symbolResolveMap.get(t);return Array.isArray(s)?s.push(i):s.then(i),e}{const s=[i];return this._getChartApi().resolveSymbol(this.sessionId(),e,t,(i=>{if("symbol_error"===i.method)this._symbolResolveMap.delete(t);else{this._symbolResolveMap.set(t,[e,Promise.resolve(i)]);const[,s]=i.params,r={pro_name:s.pro_name,ticker:s.ticker};this._lastSymbolResolveInfoMap.set(t,r),r.pro_name&&this._lastSymbolResolveInfoMap.set(r.pro_name,r),s.full_name&&this._lastSymbolResolveInfoMap.set(s.full_name,r),r.ticker&&this._lastSymbolResolveInfoMap.set(r.ticker,r)}s.forEach((e=>e(i)))})),this._symbolResolveMap.set(t,[e,s]),e}}requestFirstBarTime(e,t,i){return this._getChartApi().requestFirstBarTime(this.sessionId(),e,t,i)}lastSymbolResolveInfo(e){var t;return null!==(t=this._lastSymbolResolveInfoMap.get(e))&&void 0!==t?t:null}createSeries(e,t,i,s,r,n,o){return this._getChartApi().createSeries(this.sessionId(),e,t,i,s,r,n,o)}modifySeries(e,t,i,s,r,n,o){return this._getChartApi().modifySeries(this.sessionId(),e,t,i,s,r,n,o)}removeSeries(e){return!!this.isConnected().value()&&this._getChartApi().removeSeries(this.sessionId(),e)}requestMoreData(e,t,i){return"number"==typeof e?this._getChartApi().requestMoreData(this.sessionId(),e):this._getChartApi().requestMoreData(this.sessionId(),e,t,i)}requestMoreTickmarks(e,t,i){return this._getChartApi().requestMoreTickmarks(this.sessionId(),e,t,i)}setFutureTickmarksMode(e){return this._getChartApi().setFutureTickmarksMode(this.sessionId(),e)}canCreateStudy(e,t){return this._getChartApi().canCreateStudy(this.sessionId(),e,t)}getStudyCounter(){
return this._getChartApi().getStudyCounter(this.sessionId())}getFundamentalCounter(){return this._getChartApi().getFundamentalCounter(this.sessionId())}createStudy(e,t,i,s,r,n,o){return this._getChartApi().createStudy(this.sessionId(),e,t,i,s,r,n,o)}modifyStudy(e,t,i,s,r){return this._getChartApi().modifyStudy(this.sessionId(),e,t,i,s,r)}notifyStudy(e,t,i){return this._getChartApi().notifyStudy(this.sessionId(),e,t,i)}removeStudy(e){return this._getChartApi().removeStudy(this.sessionId(),e)}createPointset(e,t,i,s,r,n){return this._getChartApi().createPointset(this.sessionId(),e,t,i,s,r,n)}modifyPointset(e,t,i,s){return this._getChartApi().modifyPointset(this.sessionId(),e,t,i,s)}removePointset(e){return this._getChartApi().removePointset(this.sessionId(),e)}setVisibleTimeRange(e,t,i,s,r,n){this._getChartApi().setVisibleTimeRange(this.sessionId(),e,t,i,s,!0,r,n)}criticalError(){return this._criticalError}connect(e=null){null!==e&&(this._handler=e),this._symbolResolveMap.clear(),super.connect()}setHandler(e){this._handler=e}connected(){return this.isConnected().value()&&!this._sessionDisabled}disable(){this._sessionDisabled=!0}chartApi(){return this._getChartApi()}_sendCreateSession(){Object.keys(this).forEach((e=>{/^(s|st|symbol_)\d+$/.test(e)&&delete this[e]})),this._getChartApi().chartCreateSession(this.sessionId(),this._disableStatistics)}_sendRemoveSession(){this._getChartApi().chartDeleteSession(this.sessionId())}_onMessage(e){this._handler&&this._handler(e)}_onCriticalError(e,t){this._criticalError.fire(e,t),super._onCriticalError(e,t)}}var ya=i(14381);i(66831);var Sa=i(8025),ba=i(7507),wa=i(7029),Ca=i(34585),Pa=i(80387),xa=i(62400);var Ta=i(86235);function Ia(e){const t=e.options(),s={label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(2569))),statName:"ChangeInterval",onExecute:()=>(0,Ta.showChangeIntervalDialogAsync)({initVal:Xs.linking.interval.value(),selectOnInit:!0})};return!(0,N.enabled)("show_interval_dialog_on_key_press")||t.readOnly||t.hideSymbolSearch||(s.shortcutHint=",",s.hotkeyGroup=e.hotkeys(),s.hotkeyHash=188),new ht.Action({actionId:"Chart.Dialogs.ShowChangeInterval",options:s})}i(67375);class Ma extends ht.Action{constructor(e,t=new H.WatchedValue(!1)){super({...e,options:{...e.options,checkable:!0,checked:t.value(),onExecute:()=>{this._wv.setValue(!this._wv.value())}}}),this._updateChecked=e=>{this.update({checked:e})},t.subscribe(this._updateChecked),this._wv=t}destroy(){this._wv.unsubscribe(this._updateChecked),super.destroy()}}var Aa=i(99531);const La=(0,N.enabled)("show_average_close_price_line_and_label"),ka=new W.TranslatedString("scale price chart only",wa.t(null,void 0,i(63796))),Da=new W.TranslatedString("stay in drawing mode",wa.t(null,void 0,i(4114))),Ea=new W.TranslatedString("hide marks on bars",wa.t(null,void 0,i(62249))),Va=new W.TranslatedString("change symbol last value visibility",wa.t(null,void 0,i(67453))),Ba=(new W.TranslatedString("change symbol previous close value visibility",wa.t(null,void 0,i(4729))),
new W.TranslatedString("change previous close price line visibility",wa.t(null,void 0,i(58419))),new W.TranslatedString("change symbol labels visibility",wa.t(null,void 0,i(73357)))),Ra=new W.TranslatedString("change indicators value labels visibility",wa.t(null,void 0,i(64729))),Na=new W.TranslatedString("change indicators name labels visibility",wa.t(null,void 0,i(24893))),Oa=(new W.TranslatedString("change bid and ask labels visibility",wa.t(null,void 0,i(69362))),new W.TranslatedString("change bid and ask lines visibility",wa.t(null,void 0,i(52919))),new W.TranslatedString("change pre/post market price label visibility",wa.t(null,void 0,i(30870))),new W.TranslatedString("change pre/post market price line visibility",wa.t(null,void 0,i(11718))),new W.TranslatedString("change high and low price labels visibility",wa.t(null,void 0,i(24226)))),Fa=new W.TranslatedString("change high and low price lines visibility",wa.t(null,void 0,i(80692))),Wa=new W.TranslatedString("change average close price label visibility",wa.t(null,void 0,i(76852))),Ha=new W.TranslatedString("change average close price line visibility",wa.t(null,void 0,i(1022))),za=new W.TranslatedString("change countdown to bar close visibility",wa.t(null,void 0,i(39383))),Ua=new W.TranslatedString("change plus button visibility",wa.t(null,void 0,i(96379))),ja=new W.TranslatedString("change session breaks visibility",wa.t(null,void 0,i(38413))),Ga=new W.TranslatedString("change price line visibility",wa.t(null,void 0,i(8662)));i(61442);const qa=(0,m.getLogger)("ChartWidget",{color:"#606"}),$a=N.enabled("chart_content_overrides_by_defaults"),Ka=N.enabled("symphony_embed"),Ya=new W.TranslatedString("hide {title}",a.t(null,void 0,i(13017)));const Za={addToWatchlistEnabled:!0,showFinancialsEnabled:!1,sourceSelectionEnabled:!0,propertyPagesEnabled:!0,paneContextMenuEnabled:!0,priceScaleContextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,goToDateEnabled:!1,marketStatusWidgetEnabled:!0,chartWarningWidgetEnabled:!0,dataProblemWidgetEnabled:!0,paneControlsEnabled:!0,isSymbolAvailable:e=>Promise.resolve(!0),legendWidgetEnabled:!0,chartEventsEnabled:!0,newsNotificationsEnabled:!0,esdEnabled:!1,latestUpdatesEnabled:{news:!1,minds:!1},continuousContractSwitchesEnabled:!1,futuresContractExpirationEnabled:!1,croppedTickMarks:!0,countdownEnabled:!0,lastPriceAnimationEnabled:!0,useKineticScroll:c.CheckMobile.any(),indicatorsDialogShortcutEnabled:!0,handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:{time:!0,price:!0}},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}};var Xa;function Ja(e,t,i,s=0){const r=t.mainSeries().syncModel(),n=e.mainSeries().syncModel();let o=i;if(null!==r&&null!==n){const t=e.createSyncPoint(r.syncSourceTarget(),n.syncSourceTarget());0!==s&&(i=r.projectTime(i,s)),o=t.sourceTimeToTargetTime(i)}return e.timeScale().points().roughIndex(o,n&&n.distance.bind(n))}!function(e){e[e.ShowTimeAxisMinChartHeight=61]="ShowTimeAxisMinChartHeight",
e[e.ShowPriceAxisMinChartWidth=102]="ShowPriceAxisMinChartWidth"}(Xa||(Xa={}));const Qa=new Set(["Volume@tv-basicstudies","Compare@tv-basicstudies","Overlay@tv-basicstudies","Dividends@tv-basicstudies","Earnings@tv-basicstudies","Splits@tv-basicstudies","BarSetContinuousRollDates@tv-corestudies","Sessions@tv-basicstudies","VbPSessionsRough@tv-volumebyprice","AnchoredVWAP@tv-basicstudies","RegressionTrend@tv-basicstudies","VbPAnchored@tv-basicstudies","VbPFixed@tv-basicstudies","VbPFixed@tv-volumebyprice"]),el=(0,r.default)((()=>{window.ChartApiInstance.setIsNonCountedStudyFn((e=>Qa.has(e)))}));class tl{constructor(e,t,i){this.activePaneWidget=null,this._model=null,this._paneWidgets=[],this._maximizedPaneWidget=null,this._timeAxisWidget=null,this._paneSeparators=[],this._controlBarNavigation=null,this._lineToolsSynchronizer=null,this._modelCreated=new R.Delegate,this._isDestroyed=!1,this._customLegendWidgetsFactoryMap=new Map,this._backgroundTopTheme=new H.WatchedValue("light"),this._backgroundBasedTheme=new H.WatchedValue("light"),this._backgroundBottomTheme=new H.WatchedValue("light"),this._lhsAxesWidth=0,this._rhsAxesWidth=0,this._lhsPriceAxisWidthChanged=new R.Delegate,this._rhsPriceAxisWidthChanged=new R.Delegate,this._mainDiv=null,this._parent=null,this._elTooltipDiv=null,this._hotkeysListener=null,this._mouseWheelHelper=null,this._onWheelBound=null,this._justActivated=!1,this._inited=!1,this._containsData=!1,this._initialLoading=!1,this._defTimeframe=void 0,this._removeMaximizeHotkey=null,this._invalidationMask=null,this._drawPlanned=!1,this._drawRafId=0,this._inLoadingState=!1,this._timingsMeter=null,this._tagsChanged=new R.Delegate,this._redraw=new R.Delegate,this._isVisible=new H.WatchedValue(!0),this._collapsed=new H.WatchedValue(!1),this._dataWindowWidget=null,this._resizeHandler=null,this._spinner=null,this._properties=null,this._symbolWV=new H.WatchedValue,this._resolutionWV=new H.WatchedValue,this._actions=null,this._updateThemedColorBound=this._updateThemedColor.bind(this),this._disconnected=new R.Delegate,this._reconnectBailout=new R.Delegate,this._connected=new R.Delegate,this._chartWidgetInitialized=new R.Delegate,this._saveChartService=null,this._objectTreeDialogController=null,this._chartPaintedPromise=null,this._noExchangeSubscrptionWarning=null,this._paneWidgetsSharedState=new Ni,this._onZoom=new R.Delegate,this._onScroll=new R.Delegate,this._availableScreen=null,this._hoveredPriceAxes=new Set,this._anyAxisHovered=new H.WatchedValue(!1),this._linkingGroupIndex=new H.WatchedValue(null),this._isHovered=new H.WatchedValue(!1),this._activeHint=null,this._eventHintDeferredPromise=null,this._warningHintDeferredPromise=null,this._setSymbolIntervalContentOverrides={},this._ariaPriceDescription=null,this._updateScalesActions=()=>{const e=this.actions(),t=this.model().mainSeries(),i=t.priceScale(),s=t.properties(),r=i.isLockScale(),n=6===s.childs().style.value();e.percentSeriesScale.update({disabled:r||n,checked:i.isPercentage()}),e.logSeriesScale.update({disabled:r||n,checked:i.isLog()}),
e.regularSeriesScale.update({disabled:r||n,checked:i.isRegular()}),e.indexedTo100SeriesScale.update({disabled:r||n,checked:i.isIndexedTo100()}),e.invertSeriesScale.update({checked:i.isInverted()}),e.lockSeriesScale.update({checked:i.isLockScale()}),e.autoSeriesScale.update({checked:i.isAutoScale(),disabled:i.properties().childs().autoScaleDisabled.value()})},this._invalidationHandler=e=>{if(!(e instanceof ve.InvalidationMask))throw new Error("Invalid mask");null!==this._invalidationMask?this._invalidationMask.merge(e):this._invalidationMask=e,this._drawPlanned||(this._drawPlanned=!0,this._options.visible.when((()=>{const e=!document.hidden,t=this.screen&&this.screen.isShown();null!==this._timingsMeter&&e&&!t&&this._timingsMeter.startWaitingDraw();const i=(0,n.ensureNotNull)((0,n.ensureNotNull)(this._parent).ownerDocument.defaultView);this._drawRafId=i.requestAnimationFrame(this._invalidationRAFCallback.bind(this))})))},this._onChartSessionIsConnectedChanged=e=>{e?this._onConnection():this._onDisconnect()},this._subscribeToBanInfo=e=>{var t,i;e?null===(t=this._spinner)||void 0===t||t.stop():null===(i=this._spinner)||void 0===i||i.spin()},this._id=t,this._layoutId=i,this._options=(0,P.merge)((0,P.clone)(Za),e),this._chartWidgetCollection=this._options.chartWidgetCollection,this._isActive=new H.WatchedValue(!!this._options.isActive),this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._subscribeToDrawingState(),this.withModel(this,(()=>{const e=this.model().model();e.backgroundTopColor().subscribe(this._updateThemedColorBound),e.backgroundColor().subscribe(this._updateThemedColorBound)})),this._errorRenderer=new me(this),this._scrollHelper=new $(this),this._objectTreeDialogController=w.getInstance(),this._properties=new Zs.DefaultProperty({defaultName:"chartproperties",useUserPreferences:this._options.useUserChartPreferences,excludedDefaultsKeys:["scalesProperties.axisHighlightColor","scalesProperties.axisLineToolLabelBackgroundColorActive","scalesProperties.axisLineToolLabelBackgroundColorCommon","scalesProperties.showPriceScaleCrosshairLabel","scalesProperties.showTimeScaleCrosshairLabel","scalesProperties.crosshairLabelBgColorLight","scalesProperties.crosshairLabelBgColorDark"]}),this._startSpinner(this._options.container.value()),this._chartSession=new va(window.ChartApiInstance),el(),this._isMultipleLayout=(0,V.combine)((e=>(0,Se.isMultipleLayout)(e)),this._chartWidgetCollection.layout.weakReference()),this._properties.childs().scalesProperties.childs().scaleSeriesOnly.subscribe(null,(()=>{const e=this.model().model();e.recalculateAllPanes((0,pi.viewportChangeEvent)()),e.invalidate(ve.InvalidationMask.full())})),this._hotkeys=p.createGroup({desc:"Chart actions",isDisabled:()=>!this.isActive().value()}),this._ariaPriceDescription=da.AriaCrosshairPriceDescription.getInstance(),this.withModel(this,(()=>{this.model().crossHairSource().moved().subscribe(this,this._updateAriaPriceDescription)}))}refreshMarks(){
this.model().barsMarksSources().forEach((e=>e.refreshData()))}clearMarks(e){this.model().barsMarksSources().forEach((t=>t.clearMarks(e)))}setTimezone(e){const t=e;t&&(0,B.timezoneIsAvailable)(t)?this.properties().childs().timezone.setValue(t):console.warn("Incorrect timezone: "+JSON.stringify(t))}getTimezone(){return this.properties().childs().timezone.value()}destroy(){var e,t,i;this._unsetActions(),this._hotkeys&&this._hotkeys.destroy(),null===(e=this._lineToolsSynchronizer)||void 0===e||e.destroy(),null===(t=this._noExchangeSubscrptionWarning)||void 0===t||t.destroy(),window.loginStateChange.unsubscribe(this,this._handleLoginStateChanged),null!==this._model&&(this._model.model().backgroundTopColor().unsubscribe(this._updateThemedColorBound),this._model.model().backgroundColor().unsubscribe(this._updateThemedColorBound),this._model.model().crossHairSource().moved().unsubscribe(this,this._updateAriaPriceDescription),this._model.destroy()),this._ariaPriceDescription=null,this._customLegendWidgetsFactoryMap.clear(),this._scrollHelper.destroy(),this._errorRenderer.destroy(),this._chartSession.criticalError().unsubscribe(this,this._onChartSessionCriticalError),this._chartSession.isConnected().unsubscribe(this._onChartSessionIsConnectedChanged),this._chartSession.destroy(),null===(i=this._persistentLogSwitcher)||void 0===i||i.destroy(),this._isDestroyed=!0}emulateCriticalError(){this._chartSession.removeSeries("-1")}chartSession(){return this._chartSession}onDisconnected(){return this._disconnected}onReconnectBailout(){return this._reconnectBailout}onConnected(){return this._connected}chartWidgetInitialized(){return this._chartWidgetInitialized}setVisibleTimeRange(e,t,i,s){{const r=this.model().mainSeries().seriesSource();this._chartSession.setVisibleTimeRange((0,n.ensureNotNull)(r.instanceId()),r.turnaround(),e,t,null!=i?i:{},null!=s?s:()=>{})}}lineToolsSynchronizer(){return this._lineToolsSynchronizer}actions(){return null===this._actions?this._setActions():this._actions}requestFullscreen(){this.getResizerDetacher().requestFullscreen()}exitFullscreen(){this.getResizerDetacher().exitFullscreen()}inFullscreen(){return this.getResizerDetacher().fullscreen.value()}model(){return(0,n.ensureNotNull)(this._model)}id(){return this._id}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}isActive(){return this._isActive.readonly()}isHovered(){return this._isHovered.readonly()}crossHairSyncEnabled(){return this._chartWidgetCollection.lock.crosshair.value()}isVisible(){return this._isVisible.value()}setVisible(e){this._isVisible.setValue(e)}visible(){return this._isVisible.readonly()}isCollapsed(){return this._collapsed.value()}setCollapsed(e){this._collapsed.setValue(e)}collapsed(){return this._collapsed.readonly()}isJustClonedChart(){return!!(this._options||{}).justCloned}removeAllDrawingTools(){this.model().removeAllDrawingTools()}removeAllStudies(){this.model().removeAllStudies()}removeAllStudiesDrawingTools(){this.model().removeAllStudiesAndDrawingTools()}getSymbol(e){var t,i,s,r;let n
;return n=this._model?this._model.mainSeries().properties().childs():this.properties().childs().mainSeriesProperties.childs(),n?e&&n.shortName&&n.shortName.value()?null!==(i=null===(t=n.shortName)||void 0===t?void 0:t.value())&&void 0!==i?i:"":null!==(r=null===(s=n.symbol)||void 0===s?void 0:s.value())&&void 0!==r?r:"":""}setSymbol(e){this._model?(this._symbolWV.setValue(e),this._model.setSymbol(this._model.mainSeries(),e)):(this.properties().childs().mainSeriesProperties.merge({symbol:e}),this._symbolWV.setValue(e),this._setSymbolIntervalContentOverrides.symbol=e)}setResolution(e){this._model?(this._resolutionWV.setValue(e),this._model.setResolution(this._model.mainSeries(),e)):(this.properties().childs().mainSeriesProperties.merge({interval:e}),this._resolutionWV.setValue(e),this._setSymbolIntervalContentOverrides.interval=e)}getResolution(){return this._model?this._model.mainSeries().properties().childs().interval.value():this.properties().childs().mainSeriesProperties.childs().interval.value()}symbolWV(){return this._symbolWV.readonly()}resolutionWV(){return this._resolutionWV.readonly()}loadRange(e){if(this._model){this.screen.show();this._model.loadRange(e)||this.screen.hide()}}async showGeneralChartProperties(e,t){if(!N.enabled("show_chart_property_page"))return Promise.resolve(null);const s=await this._showChartProperties(this.model().mainSeries(),e,{doNotCloseOnBgClick:!0,onResetToDefault:async()=>{this.model().restorePreferences();const e=await Promise.resolve().then(i.bind(i,85662)),t=e.getCurrentTheme().name;e.loadTheme(this.chartWidgetCollection(),{themeName:t,standardTheme:!0})},shouldReturnFocus:null==t?void 0:t.shouldReturnFocus});if(null===s)return null;const r=()=>{s.hide(),this._chartWidgetCollection.activeChartWidget.unsubscribe(r)};return this._chartWidgetCollection.activeChartWidget.subscribe(r),s}showChartPropertiesForSource(e,t,i,s){return N.enabled("property_pages")&&e.userEditEnabled()?e===this.model().model().mainSeries()?this.showGeneralChartProperties(t):((i=i||{}).onResetToDefault=()=>{((0,J.isLineTool)(e)||(0,Z.isStudy)(e))&&this.model().restorePropertiesForSource.bind(this._model,e)},this._showChartProperties(e,t,i,s)):Promise.resolve(null)}options(){return this._options}async showChartPropertiesForSources(e){if(!N.enabled("property_pages"))return Promise.resolve(null);const{sources:t,title:s,tabName:r,renamable:o}=e,l=(0,n.ensureNotNull)(this._model),c=F(t.map((e=>e.properties().childs()))),h=F(t.map((e=>e.properties().childs().intervalsVisibilities))),[{createPropertyPage:d},{getSelectionStylePropertiesDefinitions:u},{getSelectionIntervalsVisibilitiesPropertiesDefinition:p},{getSelectionCoordinatesPropertyDefinition:_}]=await Promise.all([Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,57717)),Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,72707)),Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,26434)),Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,73174))]);return async function(e){
const{SourcesPropertiesEditorRenderer:t}=await Promise.all([i.e(5757),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(889),i.e(71),i.e(223),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),i.e(6780)]).then(i.bind(i,66512)),s=new t(e);return null!==M&&(M.hide(),M=s),s.show(),s}({sources:t,propertyPages:[d(u(c,l),"style",a.t(null,void 0,i(92516))),d({definitions:[_(t,l)]},"displacement",a.t(null,void 0,i(70132))),d(p(h,l),"visibility",a.t(null,void 0,i(40091)))],undoModel:l,title:s,activeTabId:r,renamable:o})}getPriceAxisWidthChangedByName(e){return"left"===e?this._lhsPriceAxisWidthChanged:this._rhsPriceAxisWidthChanged}getPriceAxisMaxWidthByName(e){return"left"===e?this._lhsAxesWidth:this._rhsAxesWidth}timeAxisHeight(){return null!==this._timeAxisWidget?this._timeAxisWidget.size.height:0}withModel(e,t){null!==this._model?t.call(e):this.modelCreated().subscribe(e,t,!0)}hasModel(){return null!==this._model}onRedraw(){return this._redraw}copyLineToOtherCharts(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources().filter((e=>e.isSynchronizable()));e.model().copyToOtherCharts(t,!0)}hideDataSources(e){if(e.length){const t=e.map((e=>e.properties().visible)),i=e.map((()=>!1));this.model().setProperties(t,i,Ya.format({title:new W.TranslatedString(e[0].name(),e[0].title(Ps.TitleDisplayTarget.StatusLine))}))}}hideSelectedObject(){this.hideDataSources(this.model().selection().dataSources().filter((e=>!0)))}unlinkSelectedLine(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources();e.unlinkLines(t)}selectPointMode(){return(0,n.ensureNotNull)(this._model).model().selectPointMode()}cancelRequestSelectPoint(){const e=(0,n.ensureNotNull)(this._model).model();e.cancelRequestSelectPoint(),e.setReplayStatus(e.isInReplay().value()?3:0),e.clearCurrentPosition()}requestSelectPoint(e,t){const i=(0,n.ensureNotNull)(this._model);return e.selectPointMode===je.SelectPointMode.Replay&&i.model().setReplayStatus(1),new Promise(((s,r)=>{const n=()=>!!this.isVisible()||(r("Chartwidget must be visible"),this.cancelRequestSelectPoint(),!1);if(!n())return;(0,je.resetToCursor)(!0),i.lineBeingCreated()&&i.cancelCreatingLine();let o=!1;const a={};i.model().onPointSelected().subscribe(a,((e,t)=>{o=!0,this._isVisible.unsubscribe(n),this._hideHint(),s({point:e,pane:t})}),!0),i.model().requestSelectPoint(e),this.startTrackingMode(),void 0!==t&&this._showEventHint(t),this._isVisible.subscribe(n),this.selectPointMode().subscribe((()=>{setTimeout((()=>{o||(this.selectPointMode().value()===je.SelectPointMode.None&&this._hideHint(),i.model().onPointSelected().unsubscribeAll(a),this._isVisible.unsubscribe(n),r("cancelled"))}))}),{once:!0})}))}onScroll(){return this._onScroll}onZoom(){
return this._onZoom}images(e){window.TradingView.printing=!0;const t=this.model().selection().allSources();this.model().selectionMacro((e=>e.clearSelection())),this.model().model().recalculateAllPanes((0,pi.globalChangeEvent)());const i=(t,i)=>{t.paint(i);const s={showCollapsedStudies:Boolean(null==e?void 0:e.showCollapsedStudies),status:null==e?void 0:e.status};return t.getScreenshotData(s)},s=[];if(null!==this._maximizedPaneWidget){const e=this._paneWidgets.indexOf(this._maximizedPaneWidget);s.push(i(this._maximizedPaneWidget,ve.InvalidationMask.light().invalidateForPane(e)))}else for(let e=0;e{t.forEach((t=>{e.addSourceToSelection(t)}))})),this.model().model().recalculateAllPanes((0,pi.globalChangeEvent)()),this.model().model().lightUpdate();const n=this.mainSeriesQuotesAndMetainfo();return{panes:s,timeAxis:r,colors:{text:this.properties().childs().scalesProperties.childs().textColor.value(),bg:this.properties().childs().paneProperties.childs().background.value(),scales:this.properties().childs().scalesProperties.childs().lineColor.value()},meta:n.meta,ohlc:n.ohlc,quotes:n.quotes}}insertStudy(e,t,i,s,r){return this._insertStudyOrReplaceStub(e,t,void 0,i,s,r)}replaceStubByStudy(e,t,i,s,r,n){return e.updateDescriptor(t),this._insertStudyOrReplaceStub(t,i,e,s,r,n)}addOverlayStudy(e,t,i){const s=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((async r=>{if(!r)return null;await(0,ca.studyMetaInfoRepository)().requestMetaInfo();const n=s.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"},[]),o={allowExtendTimeScale:i};if(N.enabled("use_overrides_for_overlay")){const e=(0,pn.factoryDefaults)("study_Overlay@tv-basicstudies.style");o.style=e}return n.setPropertiesState(o),n.setForceOverlay(t),n.insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]})))})):Promise.resolve(null)}addCompareStudy(e){const t=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((async i=>i?(await(0,ca.studyMetaInfoRepository)().requestMetaInfo(),t.createStudyInserter({type:"java",studyId:"Compare@tv-basicstudies"},[]).insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]})))):null)):Promise.resolve(null)}showIndicators(e,t){if(window.studyMarket)return window.studyMarket.visible().value()?void window.studyMarket.hide():(window.studyMarket.show(e,t),window.studyMarket)}setSaveChartService(e){this._saveChartService=e,null!==this._lineToolsSynchronizer&&this._lineToolsSynchronizer.setSaveChartService(e)}getSaveChartService(){return this._saveChartService}mainSeriesQuotesAndMetainfo(){let e,t,i
;const s=this._model&&this._model.mainSeries();if(s){const r=e=>null==e?"":s.formatter().format(e,{signNegative:!0,useRtlFormat:!1}),n=e=>null==e?"":e+"";e={resolution:s.interval(),symbol:s.symbol(),values:s.legendValuesProvider().getValues(null)};const o=s.symbolInfo();o&&(e.symbol=o.full_name,e.description=o.description,e.exchange=o.exchange);const a=s.bars().last();null!==a&&(t=a.value.slice(1,5).map(r));const l=s.quotes();l&&(i={change:r(l.change),changePercent:n(l.change_percent),last:r(l.last_price)})}return{meta:e,ohlc:t,quotes:i}}isMultipleLayout(){return this._isMultipleLayout}updateCrossHairPositionIfNeeded(){if(this._model){const e=je.tool.value();this._model.model().setCurrentTool(e);const t=(0,ye.lastMouseOrTouchEventInfo)();if(t.isTouch){const e=this._maximizedPaneWidget||this._paneWidgets[0];if(e.hasState()&&(!t.stylus&&(this._isLineToolModeExceptBrush()||(0,je.toolIsMeasure)(je.tool.value()))||this.selectPointMode().value()!==je.SelectPointMode.None)){const t=.5*this._model.model().timeScale().width(),i=.5*e.state().defaultPriceScale().height();e.setCursorPosition(t,i)}const i=this._model.model().crossHairSource();i.updateAllViews((0,pi.sourceChangeEvent)(i.id()))}}}trackingModePaneWidget(){if(!(0,ye.lastMouseOrTouchEventInfo)().isTouch)return null;for(const e of this.paneWidgets())if(e.trackingModeEnabled())return e;return null}startTrackingMode(){if((0,ye.lastMouseOrTouchEventInfo)().isTouch){this.exitTrackingMode(),this.updateCrossHairPositionIfNeeded();const e=this._maximizedPaneWidget||this._paneWidgets[0],t=this.model().model().crossHairSource().currentPoint();e.startTrackingMode(t,t)}}exitTrackingMode(){(0,ye.lastMouseOrTouchEventInfo)().isTouch&&this.paneWidgets().some((e=>e.trackingModeEnabled()))&&(this.paneWidgets().forEach((e=>e.exitTrackingMode())),this.model().model().clearCurrentPosition())}onToolChanged(){const e=this.model().model();e.lineBeingCreated()&&!e.lineBeingCreateFromExternal()&&this._cancelCreatingLine(),this.selectPointMode().value()!==je.SelectPointMode.None&&this.cancelRequestSelectPoint(),this.exitTrackingMode()}setInLoadingState(e){this._inLoadingState=e}paint(e){const t=null!=e?e:ve.InvalidationMask.full();t.validationActions().forEach((e=>e())),this._paneWidgets.forEach(((e,i)=>{null!==this._maximizedPaneWidget&&this._maximizedPaneWidget!==e||e.paint(t.invalidateForPane(i))})),this._timeAxisWidget&&this._timeAxisWidget.paint(t.invalidateForTimeScale()),this._redraw.fire()}GUIResetScales(){(0,u.trackEvent)("GUI","Reset Scales"),null!==this._model&&this._model.resetScales()}applyOverrides(e){const t={};for(const[i,s]of Object.entries(e))i.startsWith("mainSeriesProperties.priceAxisProperties")||(t[i]=s);if((0,pn.applyPropertiesOverrides)(this.properties(),void 0,!1,t,void 0),this._model){(0,pn.applyPropertiesOverrides)(this._model.model().properties(),void 0,!1,t),(0,pn.applyPropertiesOverrides)(this._model.mainSeries().properties(),void 0,!1,t,"mainSeriesProperties"),this._model.model().sessions().callFunction((e=>e.applyOverrides(t)))
;const e=this._model.model().watermarkSource();null!==e&&e.applyOverrides(t)}}toggleMaximizePane(e){var t;if(!(this._paneWidgets.length<2)){this._maximizedPaneWidget?(this._maximizedPaneWidget.state().maximized().setValue(!1),this._maximizedPaneWidget=null,this._paneSeparators.forEach((e=>e.show()))):(this._maximizedPaneWidget=e,this._maximizedPaneWidget.state().maximized().setValue(!0),this._paneSeparators.forEach((e=>e.hide())));for(let e=this._paneWidgets.length;e--;)this._paneWidgets[e].updateControls(),this._paneWidgets[e].updatePriceAxisWidgetsStates();this._errorRenderer.updatePaneWidgets(),null===(t=this._timeAxisWidget)||void 0===t||t.updatePriceAxisStubs(),this._adjustSize(),this.updateCrossHairPositionIfNeeded()}}maximizedPaneWidget(){return this._maximizedPaneWidget}isMaximizedPane(){return null!==this._maximizedPaneWidget}setActive(e){(0,ye.lastMouseOrTouchEventInfo)().isTouch&&(e&&this.selectPointMode().value()!==je.SelectPointMode.None?this.startTrackingMode():this.exitTrackingMode());for(const e of this._paneWidgets)e.update();e||this.model().selectionMacro((e=>{e.clearSelection()})),this._isActive.setValue(e)}justActivated(){return this._justActivated}unsetActivePaneWidget(){this.activePaneWidget=null}setActivePaneWidget(e){this.activePaneWidget=e}onPaneWidgetDestroyed(e){this.activePaneWidget===e&&(this.activePaneWidget=null)}backgroundTopTheme(){return this._backgroundTopTheme.readonly()}backgroundBasedTheme(){return this._backgroundBasedTheme.readonly()}backgroundBottomTheme(){return this._backgroundBottomTheme.readonly()}lineToolsAndGroupsDTO(){return(0,n.ensureNotNull)(this._lineToolsSynchronizer).prepareDTO()}resetLineToolsInvalidated(e,t,i){(0,n.ensureNotNull)(this._lineToolsSynchronizer).resetInvalidated(e,t,i)}applyLineToolUpdateNotification(e,t){(0,n.ensureNotNull)(this._lineToolsSynchronizer).applyLineToolUpdateNotification(e,t)}reloadAllLineTools(){(0,n.ensureNotNull)(this._lineToolsSynchronizer).reloadAllLineTools()}startApplyingLineToolUpdateNotification(){var e;null===(e=this._lineToolsSynchronizer)||void 0===e||e.startApplyingLineToolUpdateNotification()}endApplyingLineToolUpdateNotification(){var e;null===(e=this._lineToolsSynchronizer)||void 0===e||e.endApplyingLineToolUpdateNotification()}applyAlertIdByExternalSource(e,t){var i;null===(i=this._lineToolsSynchronizer)||void 0===i||i.applyAlertIdByExternalSource(e,t)}deleteAlertByExternalSource(e,t){var i;null===(i=this._lineToolsSynchronizer)||void 0===i||i.deleteAlertByExternalSource(e)}shouldBeSavedEvenIfHidden(){return this._model?this.model().model().shouldBeSavedEvenIfHidden():!!this._options.content.shouldBeSavedEvenIfHidden}showObjectsTreePanelOrDialog(){let e=!1;const t=window.widgetbar;if(t&&t.isVisible()){const i=(0,n.ensureNotNull)(t.setPage("object_tree"));(0,n.ensureNotNull)(i.widget("object_tree"));0,e="object_tree"===i.name}e||this.showObjectsTreeDialog()}showObjectsTreeDialog(){var e;null===(e=this._objectTreeDialogController)||void 0===e||e.show()}addCustomWidgetToLegend(e,t){
this._customLegendWidgetsFactoryMap.set(e,t);for(const i of this.paneWidgets())i.addCustomWidgetToLegend(e,t)}applyIndicatorsToAllChartsAvailable(){if(!this.chartWidgetCollection().applyIndicatorsToAllChartsAvailable())return!1;for(const e of this.model().model().panes()){if(e.sourcesByGroup().all().some((e=>(0,Z.isStudy)(e)&&!0)))return!0}return!1}restoreState(e,t,i){this._adjustSize();const s=(0,n.ensureNotNull)(this._model),r=(s.restoreState(this._content,t,i),s.mainSeries().properties().childs());this._symbolWV.setValue(r.symbol.value()),this._resolutionWV.setValue(r.interval.value())}addCompareAsOverlay(e,t,i){const s=this.model();return(0,n.ensureDefined)(this._options.isSymbolAvailable)(e).then((async r=>{if(!r)return null;await(0,ca.studyMetaInfoRepository)().requestMetaInfo();const n=s.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"},[]);return n.setForceOverlay(!0),n.setPreferredPriceScale("as-series"),!0!==i&&n.setTargetPriceScaleMode({percentage:!0}),void 0!==t&&n.setPropertiesState({allowExtendTimeScale:t}),n.insert((async()=>({inputs:{symbol:e},parentSources:[]})))}))}scrollHelper(){return this._scrollHelper}chartPainted(){return this._drawPlanned?(null===this._chartPaintedPromise&&(this._chartPaintedPromise=(0,g.createDeferredPromise)()),this._chartPaintedPromise.promise):Promise.resolve()}setDataWindowWidget(e){this._dataWindowWidget=e}removeDataWindowWidget(){this._dataWindowWidget=null}showSelectedSourcesProperties(e){const t=(0,n.ensureNotNull)(this._model).selection().dataSources();if(1===t.length)this.showSourceProperties(t[0],e);else{const i=t.filter(J.isLineTool);i.length>0&&this.showChartPropertiesForSources({sources:i,tabName:e})}}executeActionById(e){if("takeScreenshot"===e)return console.warn('Action "takeScreenshot" is deprecated. Use method "takeScreenshot" instead'),void this._chartWidgetCollection.takeScreenshot();const t=this.actions()[e];t?t.execute():console.warn("Unknown action id: "+e)}getCheckableActionState(e){const t=this.actions()[e];if(t){if(t.isCheckable())return t.isChecked();console.warn("Action "+e+" has no state")}else console.warn("Unknown action id: "+e);return null}connect(){this._chartSession.isConnected().subscribe(this._onChartSessionIsConnectedChanged),this._chartSession.criticalError().subscribe(this,this._onChartSessionCriticalError),this._chartSession.connect(this._onData.bind(this))}finishInitWithoutConnect(){this._chartSession.disable(),this._init(),this._chartWidgetInitialized.fire()}reconnect(){this._chartSession.disconnect(),this._chartSession.connect()}update(){if(this.hasModel()){for(const e of this._paneWidgets)e.update();this._timeAxisWidget&&this._timeAxisWidget.update()}}setPriceAxisHovered(e,t){t?this._hoveredPriceAxes.add(e):this._hoveredPriceAxes.delete(e),this._anyAxisHovered.setValue(this._hoveredPriceAxes.size>0)}anyPriceAxisHovered(){return this._anyAxisHovered.readonly()}linkingGroupIndex(){return this._linkingGroupIndex}offsetInDocument(e){const t=this._paneWidgets.find((t=>t.state()===e));if(void 0===t)return{left:NaN,
top:NaN};const i=t.getElement().getBoundingClientRect();return{left:Math.round(i.left+document.body.scrollLeft),top:Math.round(i.top+document.body.scrollTop)}}showHint(e,...t){if(0===e)this._showEventHint(...t);else if(1===e)throw new Error("Warning hint not implemented")}hotkeys(){return this._hotkeys}_clearSelectionHotkey(){return{desc:"Cancel selection",hotkey:27,handler:()=>{var e,t,i,s;if(this.selectPointMode().value()!==je.SelectPointMode.None)return this.selectPointMode().value()===je.SelectPointMode.Replay&&this._chartWidgetCollection.getAll().forEach((e=>{e!==this&&e.selectPointMode().value()===je.SelectPointMode.Replay&&e.cancelRequestSelectPoint()})),void this.cancelRequestSelectPoint();null===(e=this._model)||void 0===e||e.selectionMacro((e=>{this._cancelCreatingLine(),e.clearSelection()}));const r=null===(t=this._model)||void 0===t?void 0:t.model().customSourceMovingHitTestData();r&&r.cancelMoveHandler&&r.cancelMoveHandler()&&(r.cancelled=!0,null===(i=this._model)||void 0===i||i.model().setMovingCustomSource(null,null),null===(s=this._model)||void 0===s||s.model().lightUpdate())},isDisabled:()=>{const e=this._model;if(!e)return!0;const t=0===e.selection().allSources().length,i=null===e.crossHairSource().measurePane().value(),s=this.selectPointMode().value()===je.SelectPointMode.None;return t&&i&&s}}}_insertStudyOrReplaceStub(e,t,i,s,r,n){const o="java"===e.type;return new Promise((async a=>{if(0===t.length)return null==n||n(),o&&await(0,ca.studyMetaInfoRepository)().requestMetaInfo(),void a(this._insertOrReplaceStubByStudyImpl(e,t,i,s,r));window.runOrSignIn((async()=>{null==n||n(),o&&await(0,ca.studyMetaInfoRepository)().requestMetaInfo(),a(this._insertOrReplaceStubByStudyImpl(e,t,i,s,r))}),{source:"study on study"})})).catch((()=>null))}_insertOrReplaceStubByStudyImpl(e,t,i,s,r){const o=(0,n.ensureNotNull)(this._model).createStudyInserter(e,t,s);o.setForceOverlay("java"===e.type&&"Volume@tv-basicstudies"===e.studyId&&N.enabled("volume_force_overlay"));const a=o.insert(((e,i,s)=>new Promise(((n,o)=>{this.selectPointMode().value()!==je.SelectPointMode.None&&this.cancelRequestSelectPoint(),r?n(r(e,i,s)):(0,Z.isSymbolicStudy)(s)?((0,u.trackEvent)("GUI","Confirmation dialogs","Symbol confirmation dialog"),I(this,e,s,n,o,"symbol")):(0,Z.hasConfirmInputs)(i)?((0,u.trackEvent)("GUI","Confirmation dialogs","Inputs confirmation dialog"),I(this,e,s,n,o)):n({inputs:{},parentSources:t})}))),void 0,i);return a.then((()=>{(0,je.hideAllIndicators)().value()&&(0,y.toggleHideMode)()})).catch((e=>{})),a}async _showChartProperties(e,t,i,s){if(!this._model)return null;t&&((0,h.setValue)("properties_dialog.active_tab.chart",t),i.tabName=t);const r=await te(e,this._model,i,this._options.chartWidgetCollection,s);return(null==r?void 0:r.visible().value())?r:null}_createLineToolsSynchronizerIfNeeded(){var e;if(N.enabled("saveload_separate_drawings_storage")){const t={readOnlyMode:this.readOnly(),migrateSyncedLineTools:this===this._options.chartWidgetCollection.getAll()[0]},i=(0,ba.getLineToolsSynchronizerClass)()
;this._lineToolsSynchronizer=new i({layoutId:this.layoutId(),chartId:this._id,clientId:this._chartWidgetCollection.clientId},this.model().model(),t),null!==this._saveChartService&&this._lineToolsSynchronizer.setSaveChartService(this._saveChartService),this._lineToolsSynchronizer.invalidateAll(),null===(e=this._model)||void 0===e||e.model().setLineToolsSynchronizer(this._lineToolsSynchronizer)}}_updateThemedColor(){const e=this.model().model(),t=e.backgroundColorAtYPercentFromTop(.5);let i=e.backgroundTopColor().value(),s=e.backgroundColor().value();const r=(0,_.isColorDark)(t),n=(0,_.isColorDark)(i),o=(0,_.isColorDark)(s);this.widget().classList.toggle("chart-widget--themed-dark",r),this.widget().classList.toggle("chart-widget--themed-light",!r),this.widget().classList.toggle("chart-widget__top--themed-dark",n),this.widget().classList.toggle("chart-widget__top--themed-light",!n),this.widget().classList.toggle("chart-widget__bottom--themed-dark",o),this.widget().classList.toggle("chart-widget__bottom--themed-light",!o),this._backgroundTopTheme.setValue(n?"dark":"light"),this._backgroundBasedTheme.setValue(r?"dark":"light"),this._backgroundBottomTheme.setValue(o?"dark":"light"),i===s&&(0,d.isStdThemedDefaultValue)("chartProperties.paneProperties.background",i,this._backgroundBasedTheme.value())&&(i=null,s=null);for(const e of this._paneWidgets)e.updateThemedColors({topColor:i,bottomColor:s})}_isLineToolModeExceptBrush(){const e=je.tool.value();return(0,oi.isLineToolName)(e)&&!(0,oi.isLineDrawnWithPressedButton)(e)&&this.selectPointMode().value()===je.SelectPointMode.None}_cancelCreatingLine(){const e=(0,n.ensureNotNull)(this._model).model(),t=e.lineBeingCreated();if(null!==t){const i=(0,n.ensureNotNull)(e.paneForSource(t));(0,n.ensureNotNull)(this.paneByState(i)).cancelCreatingLineTool(),t.toolname===je.tool.value()&&(0,je.resetToCursor)()}const i=e.crossHairSource().measurePane().value();if(null!==i){(0,n.ensureNotNull)(this.paneByState(i)).cancelMeasuring()}}_adjustSize(e){var t;let i=0;const r=null===this._model?null:this._model.model().priceScaleSlotsCount(),n=new Uint32Array(null===r?0:r.left),o=new Uint32Array(null===r?0:r.right),a=(0,fe.getCanvasDevicePixelRatio)(document.body),c=(e,t)=>e+t,h=(e,t)=>{t.forEach(((t,i)=>{e[i]=Math.max(e[i],t)}))},d=this._width(),u=this._height(),p=this._paneSeparators.length,_=this.isMaximizedPane()?0:Ee.height()*p,m=null!==this._timeAxisWidget?this._timeAxisWidget.optimalHeight():0;let g=u-m>=61?m:0;g%2&&(g+=1);const f=Math.max(1,Math.floor((u-_-g)/this._paneWidgets.length));let v=0,y=null;for(const e of this._paneWidgets)if(!this._maximizedPaneWidget||this._maximizedPaneWidget===e){e.leftPriceAxisesContainer().updateCurrencyLabels();const t=e.leftPriceAxisesContainer().optimalWidths();e.rightPriceAxisesContainer().updateCurrencyLabels();const s=e.rightPriceAxisesContainer().optimalWidths();h(n,t),h(o,s),this._maximizedPaneWidget!==e&&e.state().collapsed().value()?v+=Math.min(f,e.collapsedHeight()):(i+=e.stretchFactor(),y=e)}let S=n.reduce(c,0),b=o.reduce(c,0),w=Math.max(d-S-b,0)
;if(w<=102){S=0,b=0,w=d;for(let e=0;e0){const e=new Ee(this,r-1,r);this._paneSeparators.push(e),
this._timeAxisWidget?this._elMainTable.insertBefore(e.getElement(),this._timeAxisWidget.getElement()):this._elMainTable.appendChild(e.getElement())}this._timeAxisWidget?this._elMainTable.insertBefore(i.getElement(),this._timeAxisWidget.getElement()):this._elMainTable.appendChild(i.getElement())}for(let i=0;ive.InvalidationLevel.Cursor&&(null===(i=this._timeAxisWidget)||void 0===i||i.update(),this._paneWidgets.forEach((e=>{e.updatePriceAxisWidgets()})),this._applyTimeScaleInvalidations(e,t),(null===(s=this._invalidationMask)||void 0===s?void 0:s.fullInvalidation())===ve.InvalidationLevel.Full&&(this._invalidationMask.merge(e),this._adjustSize(this._invalidationMask.isVisibleTimeRangeLockedOnResize()),this._applyTimeScaleInvalidations(this._invalidationMask,t),e=this._invalidationMask,this._invalidationMask=null)),this.paint(e),this._dataWindowWidget){const t=e.maxPaneInvalidation();t===ve.InvalidationLevel.Full?this._dataWindowWidget.fullUpdate():t>ve.InvalidationLevel.None&&this._dataWindowWidget.update()}for(let t=0;tthis._justActivated=!1),0)}_requestActive(){this._beginRequestActive(),this._endRequestActive()}_updateGui(e){this._model&&(this._makeTimeAxisWidget(),this._makePaneWidgetsAndSeparators(),this._elMainTable.style.userSelect="none",this._adjustSize(e))}_setElement(e){if(this._mainDiv){this._mainDiv.remove();const e=document.createRange();e.selectNodeContents((0,n.ensureNotNull)(this._parent)),e.deleteContents()}this._controlBarNavigation&&(this._controlBarNavigation.destroy(),this._controlBarNavigation=null),null!==this._removeMaximizeHotkey&&this._removeMaximizeHotkey(),this._removeMaximizeHotkey=this._initMaximizeHotkey(e);const t=e.ownerDocument,s=t.createElement("div");s.classList.add("chart-container-border"),e.insertBefore(s,e.firstChild),this._parent=s;const r=t.createElement("div");if(r.classList.add("chart-widget"),this._mainDiv=r,this._elTooltipDiv=t.createElement("div"),this._elTooltipDiv.className="tooltip-wrapper",this._mainDiv.appendChild(this._elTooltipDiv),this._elMainTable=t.createElement("div"),this._elMainTable.className="chart-markup-table",this._mainDiv.appendChild(this._elMainTable),r.setAttribute("role","region"),r.setAttribute("aria-label",a.t(null,{replace:{index:this.id()}},i(56275))),this._hotkeysListener&&this._hotkeysListener.destroy(),this._errorRenderer.setContainer(this._parent),this._hotkeysListener=new U.ChartHotkeysListener(this,this._mainDiv),(this._options.controlBarEnabled||N.enabled("control_bar"))&&this._createControlBar(),this._options.handleScale.mouseWheel||this._options.handleScroll.mouseWheel){this._mouseWheelHelper=new Ie;const e=this._onMousewheel.bind(this);this._onWheelBound=e,this._mainDiv.addEventListener("wheel",e,{passive:!1})}this._mainDiv.addEventListener("mouseenter",(()=>this._isHovered.setValue(!0))),this._mainDiv.addEventListener("mouseleave",(()=>this._isHovered.setValue(!1))),this.resize(),this._justActivated=!1,this.withModel(this,(()=>{s.appendChild(r),r.addEventListener("mousedown",this._beginRequestActive.bind(this)),r.addEventListener("mouseup",this._endRequestActive.bind(this)),r.addEventListener("touchstart",this._beginRequestActive.bind(this)),r.addEventListener("touchmove",this._endRequestActive.bind(this)),r.addEventListener("touchend",this._endRequestActive.bind(this)),r.addEventListener("click",this._requestActive.bind(this))})),this._inited&&(null!==this._timeAxisWidget&&(this._timeAxisWidget.destroy(),this._timeAxisWidget=null),this._paneWidgets.forEach((e=>{e.destroy()})),this._paneWidgets.length=0,this._paneSeparators.forEach((e=>{e.destroy()})),this._paneSeparators.length=0,this._update(ve.InvalidationMask.full(),performance.now()))}_init(){this.hasModel()&&this.model().mainSeries().clearData(),this._initColors(),this._makeDefaultGui();this._makeDefaultModel(),(()=>{this._checkObsoleteTimezone(),
this._chartSession&&this._chartSession.connected()&&this.model().model().restart(),this._content&&(this._initColors(),this._updateGui(),this.update()),this._resizeHandler=()=>{this._invalidationHandler(ve.InvalidationMask.full())},this._resizeHandler(),(0,n.ensureNotNull)(this._parent).appendChild((0,n.ensureNotNull)(this._mainDiv)),this._spinner&&(this._spinner.stop(),this._spinner=null),this._activateSymbolSearchHotkeys(),this.model().timeScale().onScroll().subscribe(this,(()=>this._onScroll.fire())),this._inited=!0})()}_makeDefaultModel(){let e;if(this._content&&this._content.timeScale.points){const t=this._content.timeScale.points.items[0];e={startDate:t}}const t=()=>{var t,i;const s={readOnly:this.readOnly(),isSnapshot:!!this._containsData,...f(this._options,["timeScale","crossHair","chartEventsEnabled","newsNotificationsEnabled","esdEnabled","latestUpdatesEnabled","continuousContractSwitchesEnabled","futuresContractExpirationEnabled","countdownEnabled","lastPriceAnimationEnabled","currencyConversionEnabled","unitConversionEnabled","watermarkEnabled","shiftVisibleRangeOnNewBar","hideIdeas","onWidget"])},r=function(e,t,i,s,r,n,o,a,l,c,h){const d=new la(e,t,i,s,r,n,o,a,l,c,h);return d.model().fullUpdate(),d}(this._chartSession,this._invalidationHandler,this.properties(),e,this,this._options.undoHistory,this._options.barsMarksContainersFactory,s,this._collapsed,this._linkingGroupIndex,null!==(i=null===(t=this._saveChartService)||void 0===t?void 0:t.autoSaveEnabled())&&void 0!==i?i:new H.WatchedValue(!0));return this._createSessions(r.model()),r};N.enabled("lean_chart_load")?this._model=this._model||t():this._model=t(),this._model.model().setChartSaveTime(1e3*this._chartWidgetCollection.metaInfo.lastModified.value()),this._createVolumeIfNeeded();if(this._content){let e=this._setSymbolIntervalContentOverrides;$a&&this._initialLoading&&(e={...e,symbol:this._defSymbol,interval:this._defInterval,style:this._defStyle},Xi.Interval.isRange(this._defInterval)&&(e.style=11)),this.restoreState(this._content,this._containsData,e),this._setSymbolIntervalContentOverrides={},$a&&this._defSymbol&&this.model().model().recalculatePriceRangeOnce()}this._setActions(),this._createLineToolsSynchronizerIfNeeded(),(()=>{const e=(0,n.ensureNotNull)(this._model);e.onTagsChanged().subscribe(this,(()=>this.onModelTagsChanged())),this._initBackgroundColor(),this._updateGui(),this._modelCreated.fire(e),this._tagsChanged.fire(),N.enabled("determine_first_data_request_size_using_visible_range")&&this._setFirstRequestNumbarsUsingTimeframeAndInterval(e);const t=e.mainSeries(),i=t.properties().childs();this._defTimeframe&&t.setDefaultTimeframe(this._defTimeframe),t.dataEvents().symbolNotPermitted().subscribe(null,(e=>t.setSymbolParams({symbol:e}))),this._symbolWV.setValue(i.symbol.value()),i.symbol.subscribe(this,(e=>this._symbolWV.setValue(e.value()))),this._resolutionWV.setValue(i.interval.value()),i.interval.subscribe(this,(e=>this._resolutionWV.setValue(e.value()))),i.style.unsubscribe(this,this._onChartStyleChanged),
i.style.subscribe(this,this._onChartStyleChanged),t.dataEvents().completed().subscribe(this,(()=>this._addPerfMark("SeriesCompleted")),!0),t.dataEvents().barReceived().subscribe(this,(()=>this._addPerfMark("SeriesFirstDataReceived")),!0);this._options;t.dataEvents().chartTypeNotPermitted().subscribe(null,(()=>{t.setSymbolParams({interval:"D"})})),t.dataEvents().intradaySpreadNotPermitted().subscribe(null,(()=>{t.setSymbolParams({interval:"D"})})),t.dataEvents().customIntervalNotPermitted().subscribe(null,(i=>{const s=e.model().defaultResolutions(),r=s.find((e=>(0,ui.compareResolutions)(e,i)>=0)),n=null!=r?r:s[s.length-1];t.setSymbolParams({interval:n})})),t.dataEvents().intradayExchangeNotPermitted().subscribe(null,(()=>{t.setSymbolParams({interval:"D"})})),t.requestingStyleIsNotSupported.subscribe(null,(()=>{const i=t.interval(),s=e.model().defaultResolutions(),r=(0,ae.getLastUsedSingleValueBasedStyle)(),n=(0,ui.getResolutionByChartStyle)(r,i,s);t.setChartStyleWithIntervalIfNeeded(r,n)})),t.requestingStyleSupportRecovered.subscribe(null,(i=>{const s=t.interval(),r=e.model().defaultResolutions(),n=(0,ui.getResolutionByChartStyle)(i,s,r);t.setChartStyleWithIntervalIfNeeded(i,n)}))})()}_addHotkeys(){if(this._hotkeys.add({desc:"Maximize",hotkey:o.Modifiers.Alt+13,handler:()=>this.toggleFullscreen(),isDisabled:()=>!this.getResizerDetacher().fullscreenable.value()}),this._hotkeys.add(this._clearSelectionHotkey()),this._options.indicatorsDialogShortcutEnabled&&this._hotkeys.add({desc:"Show insert indicator dialog",hotkey:111,handler:()=>this.showIndicators()}),!this.readOnly()){this._hotkeys.add({desc:"Remove selected source",hotkey:o.isMacKeyboard?46:8,handler:()=>this.removeSelectedSources()});{const e=(e,t)=>{this.activePaneWidget&&("drawRightThere"===t.action?this.activePaneWidget.drawRightThere(e):je.tool.setValue(e))},t=(t,i)=>()=>e(t,i);Object.entries(ua.lineToolsSelectHotkeys).map((([e,i])=>({desc:i.description,hotkey:i.hash,handler:t(e,i)}))).forEach((e=>this._hotkeys.add(e)))}}this._hotkeys.add({desc:"Hide all drawing tools",hotkey:o.Modifiers.Mod+o.Modifiers.Alt+72,handler:()=>(0,y.toggleHideMode)()}),this.withModel(null,(()=>{const e=()=>this._hotkeys.promote();this.model().onSelectedSourceChanged().subscribe(null,e),this.model().crossHairSource().measurePane().subscribe((t=>{null!==t&&e()}))}))}_startSpinner(e){this._spinner||e&&(this._spinner=(new D).spin(e))}_handleLoginStateChanged(){0}_checkObsoleteTimezone(){const e=this.properties().childs().timezone.value();(0,B.timezoneIsAvailable)(e)||this.properties().childs().timezone.setValue({UTC:"Etc/UTC",EST:"America/New_York",CST:"America/Chicago",PST:"America/Los_Angeles"}[e]||"exchange")}_initColors(){const e=this.properties().childs(),t=e.scalesProperties.childs();t.lineColor.listeners().subscribe(this,this._updateAndPaint),t.textColor.listeners().subscribe(this,this._updateAndPaint),e.paneProperties.childs().separatorColor.listeners().subscribe(this,this._setPaneSeparatorLineColor)}_setPaneSeparatorLineColor(){this._paneSeparators.forEach((e=>e.update())),
this._updateAndPaint()}_updateAndPaint(){this.update(),this.paint()}_makeDefaultGui(){this._makeLoadingScreen(),((0,ha.getChartingLibraryGlobalContext)().configurationData.is_tradingview_data||this.onWidget())&&this._makeAvailableOnTVPopup(),this.hasModel()&&(this._makeTimeAxisWidget(),this._makePaneWidgetsAndSeparators(),this._updateScalesActions()),this._adjustSize(),(0,z.disableSelection)(this._elMainTable),this._updateAndPaint()}_makeLoadingScreen(){if(N.enabled("lean_chart_load")){if(this.screen)return;this.screen=new xe(this,(0,n.ensureNotNull)(this._parent))}else this.screen=new xe(this,(0,n.ensureNotNull)(this._mainDiv))}_makeAvailableOnTVPopup(){this._availableScreen||(this._availableScreen=new ma(this))}_activateSymbolSearchHotkeys(){this.readOnly()||this._options.hideSymbolSearch||(0,v.activateKeyPressHandler)()}_makeTimeAxisWidget(){if(this._timeAxisWidget)return void this._timeAxisWidget.updatePriceAxisStubs();const e=this.model();this._timeAxisWidget=new ji(this,this._options.timeScaleWidget,this._titlesProvider.bind(this),this._menuItemsProvider.bind(this),this._backgroundBasedTheme.spawnOwnership()),this._elMainTable.appendChild(this._timeAxisWidget.getElement()),this._timeAxisWidget.updatePriceAxisStubs(),this._timeAxisWidget.onLabelHovered().subscribe(this,((t,i)=>{const s=this._maximizedPaneWidget?this._maximizedPaneWidget.state():e.paneForSource(e.mainSeries()),r=(0,n.ensureNotNull)(this.paneByState((0,n.ensureNotNull)(s))).highlightedPriceAxis(),o=r.value();(i||o.owner===t.owner)&&(r.setValue({owner:t.owner,axis:i?t.axis:null}),this.model().model().lightUpdate())}))}_updateAriaPriceDescription(e){var t;if(this._ariaPriceDescription&&N.enabled("aria_crosshair_price_description")){const i=this.model().mainSeries().nearestData(e.index,Sa.PlotRowSearchMode.Exact);if(!i)return;const s=i.value[4];if(!(0,P.isNumber)(s))return;const r=this.model().timeScale().indexToUserTime(i.index),n=Xi.Interval.parse(this.model().mainSeries().interval());this._ariaPriceDescription.updateChartDescription(this.model().mainSeries(),s,null!==(t=null==r?void 0:r.getTime())&&void 0!==t?t:null,n.isIntraday())}}_titlesProvider(e,t){const i=this.model(),s=(0,n.ensureNotNull)(this._maximizedPaneWidget?this._maximizedPaneWidget.state():i.paneForSource(i.mainSeries())),r="right"===e?s.rightPriceScales():s.leftPriceScales();if(r.lengthe===i.mainSeries()||(0,Z.isStudy)(e)));return o.reverse(),o=(0,E.moveToHead)(o,i.mainSeries()),o.map((e=>e.title(Ps.TitleDisplayTarget.StatusLine,!0,void 0,!1)))}_menuItemsProvider(e,t){const i=this.model(),s=(0,n.ensureNotNull)(this._maximizedPaneWidget?this._maximizedPaneWidget.state():i.paneForSource(i.mainSeries())),r="right"===e?s.visibleRightPriceScales():s.visibleLeftPriceScales();if(r.length{const i=this._model;if(null===i)return;const s=i.model();e.model!==s&&(this._lineToolsSynchronizer?this._lineToolsSynchronizer.executeSyncedAction((()=>t(s,i))):t(s,i))};je.createdLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,n.ensureNotNull)(e.paneForSource(e.mainSeries()));let r,o=null;if(void 0===t.pointPositionPercents){if(o=Ja(e,t.model,t.point.timeStamp),null===o)return;r=t.point.price}else{const i=t.pointPositionPercents.x*e.timeScale().width(),s=e.mainSeries().priceScale(),n=t.pointPositionPercents.y*s.height(),a=e.mainSeries().firstValue();if(null===a)return;o=e.timeScale().coordinateToIndex(i),r=s.coordinateToPrice(n,a)}const a={index:(0,n.ensureNotNull)(o),price:r},l=i.createLineTool({pane:s,point:a,linetool:t.linetool,properties:t.properties,linkKey:t.linkKey,
ownerSource:e.mainSeries(),disableSynchronization:!0,id:t.id,sharingMode:t.sharingMode});null!==l&&!Boolean(this.model().lineBeingCreated())&&t.finalState&&l.restoreExternalPoints(t.finalState,{indexesChanged:!0,pricesChanged:!0})}))})),je.continuedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=Ja(e,t.model,t.point.timeStamp);if(null===r)return;const n={index:r,price:t.point.price},o=e.lineBeingCreated();if(null===o)return;i.continueExternalLine(n,null!==(s=t.envState)&&void 0!==s?s:void 0,!!t.finalState)&&t.finalState&&o.restoreExternalPoints(t.finalState,{indexesChanged:!0,pricesChanged:!0})}))})),je.cancelledLineTool.subscribe(null,(t=>{e(t,((e,t)=>{e.cancelCreatingLine()}))})),je.beenSetLineToolLastPoint.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.lineBeingCreated();if(null===s||s.linkKey().value()!==t.linkKey)return;const r=Ja(e,t.model,t.point.timeStamp);if(null===r)return;const n={index:r,price:t.point.price};s.setLastPoint(n),s.updateAllViews((0,pi.sourceChangeEvent)(s.id())),e.lightUpdate()}))})),je.startedMovingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=t.linkKeys.map(J.lineToolByLinkKey.bind(null,e)).filter(P.notNull);if(r.length){const i=Ja(e,t.model,t.point.timeStamp);if(null===i)return;const n={index:i,price:t.point.price},o=null!==(s=t.activeItem)&&void 0!==s?s:null,a=r[0].pointToScreenPoint(n);a&&e.startMovingSources(r,{logical:n,screen:a},o,t.pointPositionPercents,null===t.envState?void 0:t.envState,!0)}}))})),je.movedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=e.sourcesBeingMoved().filter(J.isLineTool).filter((e=>(e=>t.linkKeys.some((t=>e.linkKey().value()===t)))(e)));if(!r.length)return;const n=Ja(e,t.model,t.point.timeStamp);if(null===n)return;const o={index:n,price:t.point.price},a=r[0].pointToScreenPoint(o);a&&e.moveSources({logical:o,screen:a},t.pointPositionPercents,null!==(s=t.envState)&&void 0!==s?s:void 0,!0)}))})),je.finishedMovingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.sourcesBeingMoved().filter(J.isLineTool);if(0===s.length)return;s.forEach((i=>{const s=(e=>{for(let i=0;i{e(t,((e,i)=>{var s;const r=(0,J.lineToolByLinkKey)(e,t.linkKey);if(null!==r){const i=r.getPoint(t.pointIndex),n=i?i.index:Ja(e,t.model,t.point.timeStamp);if(null===n)return;if(r.isActualSymbol()&&r.isActualCurrency()&&r.isActualUnit()){const i={index:n,price:t.point.price};e.startChangingLinetool(r,i,t.pointIndex,null!==(s=t.envState)&&void 0!==s?s:void 0,!0)}}}))})),je.changedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.lineBeingEdited();if(null===s||s.linkKey().value()!==t.linkKey)return;let r=null;if(r=t.changes.indexesChanged?Ja(e,t.model,t.point.timeStamp):(0,n.ensureNotNull)(e.linePointBeingChanged()).index,
null!==r&&s.isActualSymbol()&&s.isActualCurrency()&&s.isActualUnit()){const i={index:r,price:t.point.price};e.changeLinePoint(i,void 0,!0)}}))})),je.finishedChangingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.lineToolByLinkKey)(e,t.linkKey);null!==s&&s.isActualSymbol()&&s.isActualCurrency()&&s.isActualUnit()&&null!==e.lineBeingEdited()&&e.endChangingLinetool(!!t.finalState,!0),null!==s&&t.finalState&&s.restoreExternalPoints(t.finalState,t.changes)}))})),je.removedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const{withUndo:s,unlink:r,linkKey:n}=t,o=(0,J.lineToolByLinkKey)(e,n);null!==o&&(r&&o.detachAlert(),s?i.removeSource(o,!1):(e.lineToolsGroupModel().removeLineTools([o]),e.removeSource(o)))}))})),je.finishedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.lineToolByLinkKey)(e,t.linkKey);null!==s&&(0,oi.isLineToolFinishRequiredWhenCreatedByApi)(s.toolname)&&s.finish()}))})),je.changedLineStyle.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.lineToolByLinkKey)(e,t.linkKey);null!==s&&(s.restoreExternalState(t.state),s.propertiesChanged(!0),t.alertId&&s.syncAlert(t.alertId))}))})),je.restoredLineToolState.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.lineToolByLinkKey)(e,t.linkKey);if(null!==s){const i={...t.state};i.indexes=t.state.points.map((i=>({index:Ja(e,t.model,i.time_t),price:i.price}))),e.restoreLineToolState(s,i,!1)}}))})),je.restoredLineTool.subscribe(null,(t=>{e(t,((e,i)=>{e.restoreSource(t.state.restorePane,t.state.paneIndex,t.state.paneState,t.state.sourceState,null)}))})),je.copiedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,n.ensureNotNull)(e.paneForSource(e.mainSeries()));let r;const o={...t.state,intervalsVisibilities:(0,un.mergeIntervalVisibilitiesDefaults)(t.state.intervalsVisibilities)},a=(0,J.createLineToolProperties)(t.linetool,o,e),l=e.dataSourceForId(t.id);if(l){if(!(0,J.isLineTool)(l))return void qa.logError(`Error sync creating line tool. Object with id ${t.id} is already in use and it is not a line tool`);if(l.toolname!==t.linetool)return void qa.logError(`Error sync creating line tool. Object with id ${t.id} is already in use and its type differs: ${l.toolname} and ${t.linetool}`)}if(l&&(l.linkKey().setValue(t.linkKey),l.share(t.sharingMode)),t.pointPositionPercents){const e={index:0,price:0};if(r=null!=l?l:i.createLineTool({pane:s,point:e,linetool:t.linetool,properties:a,linkKey:t.linkKey,disableSynchronization:!0,id:t.id}),null===r)return;r.restorePositionPercents((0,n.ensureDefined)(t.pointPositionPercents))}else{const o=i=>({index:(0,n.ensureNotNull)(Ja(e,t.model,i.timeStamp)),price:i.price}),c=t.points.map(o),h=t.pointsForCreating.map(o),d=c[0];if(l)r=l;else if(t.withUndo)r=i.createLineTool({pane:s,point:d,linetool:t.linetool,properties:a,linkKey:t.linkKey,sharingMode:t.sharingMode,disableSynchronization:!0,id:t.id});else{const e=new Cs({model:i.model(),pane:s,lineTool:t.linetool,ownerSource:(0,n.ensureNotNull)(s.mainDataSource()),drawOnAllChartsMode:t.sharingMode,id:t.id});e.redo(),e.startCreatingLine(d,a,t.linkKey||null,t.sharingMode,!0),r=(0,
n.ensureNotNull)(e.line())}if(null===r)return;const u=(e,s)=>{t.withUndo?i.continueCreatingLine(e,new ze.EnvironmentState(void 0,!0),s,!0):i.model().continueCreatingLine(e,new ze.EnvironmentState(void 0,!0),s,!0)},p=(0,oi.isLineToolFinishRequiredWhenCreatedByApi)(t.linetool);if(e.lineBeingCreated())if(h.length>1)for(let e=1;e0){const i=Math.ceil(e.timeScale().width()/t.barCount);e.timeScale().setBarSpacing(i)}}_createEventHint(){if(null===this._eventHintDeferredPromise){const e=(0,g.createDeferredPromise)();this._eventHintDeferredPromise=e,Promise.all([i.e(7727),i.e(2227),i.e(6166)]).then(i.bind(i,5015)).then((t=>{
e.resolve(new t.ChartEventHintRenderer(this._chartWidgetCollection.getContainer()))}))}return this._eventHintDeferredPromise.promise}async _createWarningHint(){return null}_showEventHint(e){N.enabled("popup_hints")&&(null!==this._activeHint&&0===this._activeHint.type?this._activeHint.show(e):(this._hideHint(),this._createEventHint().then((t=>{this._activeHint=t,void 0!==e&&this._activeHint.show(e)}))))}_showWarningHint(e){0}_hideHint(){null!==this._activeHint&&this._activeHint.hide()}_checkIsTradedGroupSelected(){const e=this.model(),t=e.model();return e.selection().customSources().some((e=>{var i;return null===(i=t.customSourceName(e))||void 0===i?void 0:i.startsWith(tradedGroupPlaceOrderPrefix)}))}_setActions(){return this._unsetActions(),this._addHotkeys(),this._actions=function(e){const t=e.hotkeys(),s=e.model(),r=e.options(),n=e.properties(),l=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleInvertPriceScale",options:{label:wa.t(null,void 0,i(37189)),statName:"Invert Scale",checkable:!0,onExecute:()=>s.invertPriceScale(s.mainSeries().priceScale()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+73}}),c=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleAutoScale",options:{label:wa.t(null,void 0,i(24157)),checkable:!0,onExecute:e=>{const t=s.mainSeries().priceScale();s.togglePriceScaleAutoScaleMode(t),e.update({checked:t.isAutoScale()})}}}),h=new ht.Action({actionId:"Chart.Scales.ToggleLockPriceToBarRatio",options:{label:wa.t(null,void 0,i(14017)),checkable:!0,statName:"ToggleLockScale",onExecute:()=>s.togglePriceScaleLockScaleMode(s.mainSeries().priceScale())}}),d=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleRegular",options:{label:wa.t(null,{context:"scale_menu"},i(55300)),checkable:!0,statName:"ToggleRegularScale",onExecute:e=>{const t=s.mainSeries().priceScale();s.setPriceScaleRegularScaleMode(t),e.update({checked:t.isRegular()})}}}),p=new ht.Action({actionId:"Chart.Series.PriceScale.TogglePercentage",options:{label:wa.t(null,void 0,i(6919)),checkable:!0,statName:"TogglePercantage",onExecute:()=>s.togglePriceScalePercentageScaleMode(s.mainSeries().priceScale()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+80}}),_=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleIndexedTo100",options:{label:wa.t(null,void 0,i(89999)),checkable:!0,statName:"ToggleIndexedTo100",onExecute:()=>s.togglePriceScaleIndexedTo100ScaleMode(s.mainSeries().priceScale())}}),m=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleLogarithmic",options:{label:wa.t(null,void 0,i(16170)),statName:"ToggleLogScale",checkable:!0,onExecute:()=>s.togglePriceScaleLogScaleMode(s.mainSeries().priceScale()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+76}}),g=new ht.Action({actionId:"Chart.ChangeTimeZone",options:{label:wa.t(null,void 0,i(20909)),statName:"TimeZone"}}),f=new wt.ActionWithStandardIcon({actionId:"Chart.TimeScale.Reset",options:{label:wa.t(null,void 0,i(54170)),iconId:"Chart.Reset",statName:"ResetScale",onExecute:()=>s.resetTimeScale(),hotkeyGroup:e.hotkeys(),hotkeyHash:o.Modifiers.Mod+o.Modifiers.Alt+81}}),y=new ht.Action({
actionId:"Chart.Dialogs.ShowInsertIndicators",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(87829))),statName:"InsertIndicator",onExecute:()=>e.showIndicators(),...r.indicatorsDialogShortcutEnabled?{hotkeyGroup:t,hotkeyHash:191}:void 0}}),S=new ht.Action({actionId:"Chart.Dialogs.ShowCompareOrAddSymbol",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(53942))),statName:"CompareOrAddSymbol",onExecute:()=>e.toggleCompareOrAdd()}}),b=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(32514))),iconId:"Settings",statName:"ChartProperties",onExecute:()=>e.showGeneralChartProperties()}}),w=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings.SymbolTab",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(32514))),iconId:"Settings",statName:"MainSeriesProperties",onExecute:()=>e.showGeneralChartProperties(K.TabNames.symbol)}}),C=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings.ScalesTab",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(93907))),iconId:"Settings",statName:"ScalesProperties",onExecute:()=>e.showGeneralChartProperties(K.TabNames.scales)}}),P=new ht.Action({actionId:"Chart.SelectedObject.ToggleLocked",options:{label:wa.t(null,void 0,i(79777)),statName:"ToggleLockSelectedObject",onExecute:()=>e.toggleLockSelectedObject()}}),x=new wt.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Hide",options:{label:wa.t(null,void 0,i(27298)),iconId:"Chart.Hide",statName:"HideSelectedObject",onExecute:()=>e.hideSelectedObject()}}),T=new ut({actionId:"Chart.PriceScale.ToggleAutoScaleSeriesOnly",options:{label:wa.t(null,void 0,i(43758)),checkable:!0,statName:"ScalePriceChartOnly"}},{property:n.childs().scalesProperties.childs().scaleSeriesOnly,undoModel:s,undoText:ka}),I=new Ma({actionId:"Chart.DrawingToolbar.ToggleVisibility",options:{label:wa.t(null,void 0,i(93864)),statName:"ToggleDrawingToolbar"}},r.isDrawingToolbarVisible),M=new ut({actionId:"",options:{label:wa.t(null,void 0,i(4035)),checkable:!0,statName:"ToggleStayInDrawingMode"}},{property:je.properties().childs().stayInDrawingMode,undoModel:s,undoText:Da}),A=new ut({actionId:"Chart.Marks.ToggleVisibility",options:{label:wa.t(null,void 0,i(28345)),checkable:!0,statName:"ToggleHideMarksOnBars"}},{property:je.hideMarksOnBars(),undoModel:s,undoText:Ea,callback:e=>je.hideMarksOnBars().setValue(e.isChecked())}),L=new ut({actionId:"Chart.PriceScale.Labels.ToggleSeriesLastValueVisibility",options:{label:wa.t(null,void 0,i(10127)),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"}},{property:n.childs().scalesProperties.childs().showSeriesLastValue,undoModel:s,undoText:Va}),k=new ut({actionId:"Chart.PriceScale.Labels.ToggleSymbolNameLabelsVisibility",options:{label:wa.t(null,void 0,i(32390)),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"}},{property:n.childs().scalesProperties.childs().showSymbolLabels,undoModel:s,undoText:Ba}),D=(0,
Aa.combineProperty)(((e,t)=>e||!1),n.childs().scalesProperties.childs().showStudyLastValue.weakReference(),n.childs().scalesProperties.childs().showFundamentalLastValue.weakReference()),E=new ut({actionId:"Chart.PriceScale.Labels.ToggleIndicatorsValueLabelsVisibility",options:{label:wa.t(null,void 0,i(46850)),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsPriceLabels",onDestroy:()=>{D.destroy()}}},{property:D,undoModel:s,undoText:null,callback:()=>{const e=!D.value();s.beginUndoMacro(Ra),s.setProperty(n.childs().scalesProperties.childs().showStudyLastValue,e,null),s.endUndoMacro()}}),V=(0,Aa.combineProperty)(((e,t)=>e||!1),n.childs().scalesProperties.childs().showStudyPlotLabels.weakReference(),n.childs().scalesProperties.childs().showFundamentalNameLabel.weakReference()),B=new ut({actionId:"Chart.PriceScale.Labels.ToggleIndicatorsNameLabelsVisibility",options:{label:wa.t(null,void 0,i(54418)),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsNameLabels",onDestroy:()=>{V.destroy()}}},{property:V,undoModel:s,undoText:null,callback:()=>{const e=!V.value();s.beginUndoMacro(Na),s.setProperty(n.childs().scalesProperties.childs().showStudyPlotLabels,e,null),s.endUndoMacro()}}),R=s.mainSeries().properties().childs().highLowAvgPrice.childs(),O=new ut({actionId:"Chart.PriceScale.Labels.ToggleHighLowPriceLabelsVisibility",options:{label:wa.t(null,void 0,i(99479)),checkable:!0,checked:!1,statName:"ToggleHighLowPriceLabels"}},{property:R.highLowPriceLabelsVisible,undoModel:s,undoText:Oa}),F=new ut({actionId:"Chart.Lines.ToggleHighLowLinesVisibility",options:{label:wa.t(null,void 0,i(33766)),checkable:!0,checked:!1,statName:"ToggleHighLowPriceLine"}},{property:R.highLowPriceLinesVisible,undoModel:s,undoText:Fa}),W=new ut({actionId:"Chart.PriceScale.ToggleCountdownToBarCloseVisibility",options:{label:wa.t(null,void 0,i(83140)),checkable:!0,checked:!1,statName:"ToggleCountdown"}},{property:s.mainSeries().properties().childs().showCountdown,undoModel:s,undoText:za}),H=new ut({actionId:"Chart.PriceScale.ToggleAddOrderPlusButtonVisibility",options:{label:wa.t(null,void 0,i(71566)),checkable:!0,checked:Jn.addPlusButtonProperty.value(),statName:"ToggleAddOrderPlusButton"}},{property:Jn.addPlusButtonProperty,undoModel:s,undoText:Ua}),z=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowSymbolInfo",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(75594))),iconId:"Chart.SymbolInfo",checkable:!1,statName:"SymbolInfo",onExecute:()=>{{const t=e.model().model(),i=t.mainSeries().symbolInfo();if(i){const e=t.availableUnits(),s=t.unitConversionEnabled();(0,Pa.showSymbolInfoDialog)({symbolInfo:i,showUnit:s,unitDescription:t=>t?e.description(t):"",dateFormatter:t.dateFormatter()})}}}}}),U=new ht.Action({actionId:"Chart.PriceScale.MergeAllScalesToLeft",options:{label:wa.t(null,void 0,i(62329)),statName:"MergeAllScalesToLeft",onExecute:()=>s.mergeAllScales("left")}}),j=new ht.Action({actionId:"Chart.PriceScale.MergeAllScalesToRight",options:{label:wa.t(null,void 0,i(55813)),statName:"MergeAllScalesToRight",
onExecute:()=>s.mergeAllScales("right")}}),G=new ht.Action({actionId:"Chart.PriceScale.MoveToLeft",options:{label:wa.t(null,void 0,i(26493)),statName:"MoveScaleToLeft",onExecute:()=>s.mergeAllScales("left")}}),q=new ht.Action({actionId:"Chart.PriceScale.MoveToRight",options:{label:wa.t(null,void 0,i(40789)),statName:"MoveScaleToRight",onExecute:()=>s.mergeAllScales("right")}}),$=new wt.ActionWithStandardIcon({actionId:"Chart.Scales.Reset",options:{label:wa.t(null,void 0,i(75246)),iconId:"Chart.Reset",statName:"ResetChart",onExecute:()=>e.GUIResetScales(),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+82}}),Y=e.model().model().sessions();let Z;const X=(0,Aa.createWVFromProperty)(e.model().mainSeries().isDWMProperty()),J=new ht.Action({actionId:"Chart.SessionBreaks.ToggleVisibility",options:{label:wa.t(null,void 0,i(66707)),checkable:!0,checked:!1,statName:"ToggleSessionBreaks",disabled:!0,onExecute:()=>{Z&&s.setProperty(Z,!Z.value(),ja)},onDestroy:()=>X.destroy()},optionsLoader:async()=>{const e=await Y.promise();return Z=e.properties().childs().graphics.childs().vertlines.childs().sessBreaks.childs().visible,{checked:Z.value(),disabled:X.value()}}});X.subscribe((()=>J.update({disabled:X.value()})));const Q=new ut({actionId:"Chart.Lines.ToggleSeriesPriceLineVisibility",options:{label:wa.t(null,void 0,i(72926)),checkable:!0,statName:"TogglePriceLine"}},{property:s.mainSeries().properties().childs().showPriceLine,undoModel:s,undoText:Ga}),ee=new ht.Action({actionId:"Chart.Undo",options:{label:wa.t(null,void 0,i(14804)),onExecute:()=>{(0,u.trackEvent)("GUI","Undo"),s.undoHistory().undo()},onDestroy:()=>{e.model().undoHistory().undoStack().onChange().unsubscribeAll(ee)},disabled:!0,hotkeyGroup:t,hotkeyHash:o.Modifiers.Mod+90,isRepeatAccepted:!0}});e.model().undoHistory().undoStack().onChange().subscribe(ee,(()=>ee.update({disabled:e.model().undoHistory().undoStack().isEmpty()})));const te=new ht.Action({actionId:"Chart.Redo",options:{label:wa.t(null,void 0,i(48236)),onExecute:()=>{(0,u.trackEvent)("GUI","Redo"),e.model().undoHistory().redo()},onDestroy:()=>{e.model().undoHistory().redoStack().onChange().unsubscribeAll(te)},disabled:!0,hotkeyGroup:t,hotkeyHash:o.Modifiers.Mod+89,isRepeatAccepted:!0}});e.model().undoHistory().redoStack().onChange().subscribe(te,(()=>te.update({disabled:e.model().undoHistory().redoStack().isEmpty()})));const ie={invertSeriesScale:l,autoSeriesScale:c,lockSeriesScale:h,regularSeriesScale:d,percentSeriesScale:p,indexedTo100SeriesScale:_,logSeriesScale:m,applyTimeZone:g,symbolSearch:new ht.Action({actionId:"Chart.Dialogs.ShowChangeSymbol",options:{label:(0,Ca.appendEllipsis)(a.t(null,void 0,i(85124))),statName:"ChangeSymbol",onExecute:()=>{(0,v.showDialog)({defaultValue:"",trackResultsOptions:{trackResults:!1,emptySearchType:"empty_result__supercharts"}})}}}),changeInterval:Ia(e),timeScaleReset:f,insertIndicator:y,compareOrAdd:S,chartProperties:b,mainSeriesPropertiesAction:w,scalesProperties:C,lineToggleLock:P,seriesHide:x,studyHide:x,lineHide:x,scaleSeriesOnly:T,drawingToolbarAction:I,
stayInDrawingModeAction:M,hideAllMarks:A,showSeriesLastValue:L,showSymbolLabelsAction:k,showStudyLastValue:E,showStudyPlotNamesAction:B,showHighLowPriceLabels:O,showHighLowPriceLines:F,showCountdown:W,addPlusButton:H,showSymbolInfoDialog:z,mergeLeftScalesAction:U,mergeRightScalesAction:j,moveScaleToLeft:G,moveScaleToRight:q,chartReset:$,sessionBreaks:J,showPriceLine:Q,undo:ee,redo:te};return r.goToDateEnabled&&(ie.gotoDate=new ht.Action({actionId:"Chart.Dialogs.ShowGoToDate",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(54280))),statName:"GoToDate",onExecute:()=>(0,xa.showGoToDateDialog)(e.chartWidgetCollection().activeChartWidget.value()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+71}})),(0,N.enabled)("show_object_tree")&&(ie.paneObjectTree=new ht.Action({actionId:"Chart.ObjectTree.Show",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(51221))),statName:"ObjectsTree",onExecute:()=>e.showObjectsTreePanelOrDialog()}})),(0,N.enabled)("property_pages")&&(ie.format=new wt.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ShowSettingsDialog",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(32514))),iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>e.showSelectedSourcesProperties()}})),La&&(ie.showAverageClosePriceLabel=new ut({actionId:"Chart.PriceScale.Labels.ToggleAveragePriceLabelVisibility",options:{label:wa.t(null,void 0,i(21841)),checkable:!0,checked:!1,statName:"ToggleAverageClosePriceLabel"}},{property:R.averageClosePriceLabelVisible,undoModel:s,undoText:Wa}),ie.showAverageClosePriceLine=new ut({actionId:"Chart.Lines.TogglePrePostMarketLineVisibility",options:{label:wa.t(null,void 0,i(16138)),checkable:!0,checked:!1,statName:"ToggleAverageClosePriceLine"}},{property:R.averageClosePriceLineVisible,undoModel:s,undoText:Ha})),e.readOnly()||(ie.paneRemoveAllStudies=new ht.Action({actionId:"Chart.RemoveAllIndicators",options:{label:wa.t(null,void 0,i(99984)),statName:"RemoveAllIndicators",onExecute:()=>e.removeAllStudies()}}),ie.paneRemoveAllDrawingTools=new ht.Action({actionId:"Chart.RemoveAllLineTools",options:{label:wa.t(null,void 0,i(96374)),statName:"RemoveAllDrawingTools",onExecute:()=>e.removeAllDrawingTools()}}),ie.paneRemoveAllStudiesDrawingTools=new ht.Action({actionId:"Chart.RemoveAllIndicatorsAndLineTools",options:{label:wa.t(null,void 0,i(81442)),statName:"RemoveAllIndicatorsAndDrawingTools",onExecute:()=>e.removeAllStudiesDrawingTools()}}),ie.applyStudiesToAllCharts=new ht.Action({actionId:"Chart.ApplyIndicatorsToAllCharts",options:{label:wa.t(null,void 0,i(22437)),statName:"ApplyIndicatorsToAllCharts",onExecute:()=>e.chartWidgetCollection().applyIndicatorsToAllCharts(e)}}),ie.studyRemove=ie.lineRemove=new wt.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Remove",options:{label:wa.t(null,void 0,i(67410)),iconId:"Chart.RemoveSelectedObject",statName:"RemoveSelectedObject",onExecute:()=>{var t;(null!==(t=e.chartWidgetCollection().activeChartWidget.value())&&void 0!==t?t:e).removeSelectedSources()},hotkeyGroup:t,hotkeyHash:o.isMacKeyboard?8:46}})),ie}(this),
this.withModel(null,(()=>{const e=this.model().mainSeries(),t=e.properties();t.childs().priceAxisProperties.subscribe(this,this._updateScalesActions),e.priceScaleAboutToBeChanged().subscribe(this,(()=>{t.childs().priceAxisProperties.unsubscribeAll(this)})),e.priceScaleChanged().subscribe(this,(()=>{t.childs().priceAxisProperties.subscribe(this,this._updateScalesActions),this._updateScalesActions()}))})),this._updateScalesActions(),this._actions}_unsetActions(){this._actions&&(Object.values(this._actions).forEach((e=>{e.destroy()})),this._actions=null)}}},29250:(e,t,i)=>{"use strict";i.r(t),i.d(t,{activeLinkingGroupWV:()=>Ei,allInitialModelsCreated:()=>gi,allInitialSymbolsResolved:()=>mi,allLinkingGroupsWV:()=>Bi,applyIndicatorToAllChartsImpl:()=>xt,applyIndicatorsToAllChartsImpl:()=>Pt,applyLineToolUpdateNotificationImpl:()=>Dt,applyStudiesOverrides:()=>Xi,applyThemeImpl:()=>yi,chartsSymbolsImpl:()=>Bt,checkProFeatureImpl:()=>fi,combinedTrackTimeLock:()=>Wi,computeContentBoxImpl:()=>qt,copyScreenshotToClipboard:()=>Ht,createBroadcastChannel:()=>ui,createChartStorageSubscriptionsIfRequired:()=>Rt,createChartWidgetCollectionNewsNotifier:()=>Nt,createClipboardHandler:()=>Et,createLeftBottomChartWidgetWV:()=>Ut,deserializedChartIds:()=>Lt,destroyBroadcastChannel:()=>pi,downloadScreenshot:()=>Wt,generateNewChartId:()=>ti,getAllLinkingGroups:()=>Vi,getAsyncStateForChartImpl:()=>At,getChartWidgetsForIntervalLock:()=>ki,getClientSnapshot:()=>Gt,getLinkingGroupCharts:()=>Ri,getSnapshot:()=>jt,getStateForChartImpl:()=>Mt,getVisuallyAdjacentDefImpl:()=>Qt,handleConnectionLimitReachedChanged:()=>Oi,handleDateRangeLockChange:()=>xi,handleInternalDateRangeLockChange:()=>Pi,handleInternalIntervalLockChange:()=>wi,handleInternalSymbolLockChange:()=>Si,handleInternalTrackTimeLockChange:()=>Ti,handleIntervalLockChange:()=>Ci,handleSymbolLockChange:()=>bi,handleTrackTimeLockChange:()=>Ii,hideChartImpl:()=>ri,lineToolsAndGroupsDTOsImpl:()=>It,removeChartWidgetSubscriptionsImpl:()=>oi,resetLayoutSizesImpl:()=>Yt,resetLineToolsInvalidatedImpl:()=>kt,setBrokerImpl:()=>Vt,setChartLayoutWithUndoImpl:()=>vi,setChartStyleToWidget:()=>Li,setLayoutImpl:()=>ci,setResolution:()=>Di,setSymbol:()=>Mi,setSymbolAll:()=>Ai,someOfWidgetsAreInSelectingReplayPointMode:()=>Fi,stateImpl:()=>Yi,subscribeToCompletedEventForDateRangeUpdate:()=>Hi,subscribeToEventsForDateRangeSync:()=>Gi,syncChartsDateRangesWithActiveChartRange:()=>Ki,syncCrosshairImpl:()=>di,syncScrollImpl:()=>_i,takeScreenshot:()=>Ot,takeServerScreenshot:()=>Ft,unloadUnusedChartsImpl:()=>ai,unsubscribeFromEventsForDateRangeSync:()=>qi,updateLayoutImpl:()=>Jt,updateLayoutPartialImpl:()=>Xt,updateLinkingGroupCharts:()=>Ni});var s=i(50151),r=i(86441),n=i(31955),o=i(11542),a=i(69109),l=i(49483),c=i(45126),h=i(56570);function d(e){const t={};return{promise:new Promise(((i,s)=>{e.subscribe(t,i,!0)})),destroy:()=>{e.unsubscribeAll(t)}}}var u=i(64147),p=(i(77788),i(60265));class _ extends p.UndoCommand{constructor(e,t){super(null),this._chartModel=e,this._targetIndex=t}redo(){
const e=this._chartModel.createPane(this._targetIndex,void 0,this._paneId);this._paneId=e.id()}undo(){const e=(0,s.ensureDefined)(this._paneId),t=this._chartModel.panes().find((t=>t.id()===e));void 0!==t&&this._chartModel.removePane(t)}createdPaneId(){return this._paneId}}class m extends p.UndoCommand{constructor(e,t,i,s){super(s),this._setter=e,this._oldValue=t,this._newValue=i}redo(){this._setter(this._newValue)}undo(){this._setter(this._oldValue)}}class g extends m{constructor(e,t,i,s){super((e=>this._vwState.setValue(e)),t,i,s),this._vwState=e}}var f=i(49406),v=i(65446),y=i(93352);const S=(0,n.getLogger)("Clipboard");var b;!function(e){e.MagicAttrName="data-tradingview-clip"}(b||(b={}));class w{constructor(e){this._e=e}write(e){return(0,v.writeImpl)(this._toRaw(e),this._e)}_toRaw(e){const t={files:[]};t.text=e.text,void 0!==e.app?t.html=this._serializeAppData(e.app,e.text):e.html&&(t.html=e.html);for(const i of e.files||[])t.files.push(i);return t}_serializeAppData(e,t){return`${t?(0,f.htmlEscape)(t.slice(0,256)):"📈"}`}}class C{constructor(e){this._e=e}async read(){this._e&&0===this._e.eventPhase&&(S.logWarn("Cannot use an already dispatched ClipboardEvent for reading"),this._e=null);const e=this._e?this._readUsingEvent(this._e):await this._readUsingApi();return this._fromRaw(e)}_readUsingEvent(e){const t=(0,s.ensure)(e.clipboardData);e.preventDefault();const i={files:[]};for(let e=0;e0&&(t.files=e.files),t}_parseAppData(e){if(-1===e.slice(0,1024).indexOf("data-tradingview-clip"))return;const t=(new DOMParser).parseFromString(e,"text/html").querySelector("[data-tradingview-clip]");return t?t.getAttribute("data-tradingview-clip")||"":void 0}_readBlobAsText(e){return new Promise(((t,i)=>{const s=new FileReader;s.onloadend=()=>{t(s.result)},s.onerror=()=>{i(s.error)},s.readAsText(e)}))}}var P=i(35749);function x(e){const t=e.target;return null!==t&&1===t.nodeType&&(0,P.isTextEditingField)(t)}function T(e){const t=e.target;if(null===t)return!1;const i=(t.ownerDocument||t).getSelection();return null!==i&&!i.isCollapsed}class I extends class{constructor(e){this._callbacks=Object.assign({},e),
this._boundOnCopy=this._onCopyEv.bind(this),this._boundOnCut=this._onCutEv.bind(this),this._boundOnPaste=this._onPasteEv.bind(this)}listen(){document.addEventListener("copy",this._boundOnCopy),document.addEventListener("cut",this._boundOnCut),document.addEventListener("paste",this._boundOnPaste)}async peek(){if("granted"!==(await navigator.permissions.query({name:"clipboard-read"})).state)throw new Error("clipboard-read is not granted");return new C(null).read()}uiRequestCopy(e){this._callbacks.copyRequested&&this._callbacks.copyRequested(new w(null),e)}uiRequestCut(e){this._callbacks.cutRequested&&this._callbacks.cutRequested(new w(null),e)}uiRequestPaste(e){this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new C(null),e)}destroy(){document.removeEventListener("copy",this._boundOnCopy),document.removeEventListener("cut",this._boundOnCut),document.removeEventListener("paste",this._boundOnPaste)}_onCopyEv(e){e.defaultPrevented||this._callbacks.copyRequested&&this._callbacks.copyRequested(new w(e))}_onCutEv(e){e.defaultPrevented||this._callbacks.cutRequested&&this._callbacks.cutRequested(new w(e))}_onPasteEv(e){e.defaultPrevented||this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new C(e))}}{_onCopyEv(e){if(!x(e)&&!T(e))return super._onCopyEv(e)}_onCutEv(e){if(!x(e)&&!T(e))return super._onCutEv(e)}_onPasteEv(e){if(!x(e))return super._onPasteEv(e)}}const M=()=>i.e(4389).then(i.bind(i,7960));function A(e,t={}){return M().then((i=>i.copyToClipboardImageOfChart(e,t)))}function L(e,t={}){return M().then((i=>i.getImageOfChartSilently(e,t)))}var k=i(2740),D=i(68805),E=i(84015),V=i(85662),B=i(27714),R=i(24377),N=i(26843),O=i(29981),F=i(7114),W=i(15938),H=i(68979),z=i(87489),U=i(76351);const j=!h.enabled("widget_logo")||!1;var G;function q(e,t=null,i=null){let s={};if("number"==typeof e)return{relativePositions:{[e]:{l:t,t:i}},nextElementLeft:e,nextElementTop:e};const[r,...n]=e;if("v"===r){let e=null;for(const r of n){const n=q(r,t,i);s={...s,...n.relativePositions},i=n.nextElementTop,e=n.nextElementLeft}t=e}if("h"===r){let e=null;for(const r of n){const n=q(r,t,i);s={...s,...n.relativePositions},t=n.nextElementLeft,e=n.nextElementTop}i=e}return{relativePositions:s,nextElementTop:i,nextElementLeft:t}}!function(e){e[e.LegendTopMargin=10]="LegendTopMargin",e[e.LegendLeftMargin=8]="LegendLeftMargin",e[e.LegendLineSpacingCoeff=1.4]="LegendLineSpacingCoeff",e[e.LegendItemSpacingCoeff=1.4]="LegendItemSpacingCoeff",e[e.LegendTextFontSize=12]="LegendTextFontSize",e[e.FooterTextFontSize=13]="FooterTextFontSize",e[e.Padding=10]="Padding",e[e.ChartsSpacing=5]="ChartsSpacing",e[e.FooterHeight=35]="FooterHeight",e[e.LogoHeight=15]="LogoHeight",e[e.LogoWidth=20]="LogoWidth",e[e.LogoTextMargin=3]="LogoTextMargin"}(G||(G={}));const $=function(e){const t={};for(const i of Object.keys(e)){const s=q(e[i]).relativePositions;t[i]=s}return t}(z);function K(e,t,i,s){let r=Math.round(10*s),n=Math.round(10*s);const o=i[e];if(null!==o.l){const e=K(o.l,t,i,s);r=e.x+e.width+Math.round(5*s)}if(null!==o.t){const e=K(o.t,t,i,s)
;n=e.y+e.height+Math.round(5*s)}const a=t[e];return{x:r,y:n,width:a.width,height:a.height}}function Y(e,t,i){var s;const r=(new DOMParser).parseFromString(U,"image/svg+xml");null===(s=null==r?void 0:r.firstElementChild)||void 0===s||s.setAttribute("color",i);const n=URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(r)],{type:"image/svg+xml"}));return new Promise((i=>{const s=new Image;s.width=e,s.height=t,s.onload=()=>{i({image:s,width:e,height:t})},s.src=n}))}function Z(e,t,i,s,r){e.save(),e.drawImage(s.image,t,i,s.width,s.height),e.textBaseline="bottom";const n=(t+s.width)/r+3,o=(i+s.height)/r;(0,F.drawScaled)(e,r,r,(()=>{e.fillText("TradingView",n,o)})),e.restore()}function X(e,t,i,s){return(0,F.drawScaled)(e,s,s,(()=>{e.fillText(i,t.x/s,t.y/s)})),e.measureText(i).width*s}function J(e,t,i,s,n,o){const a=n.map((e=>e.text)).join("");let l=i.x;const c=function(e,t,i,s){if(e.measureText(t).width*s<=i)return{text:t,elided:!1};const r=e.measureText("...").width*s,n=[];for(let e=0;ee.measureText(t.slice(0,o+1)).width*s+r>i));return{text:(t=t.slice(0,o)).trim(),elided:!0}}(e,a,s-l,t);if(c.elided&&!o)return null;const h=[];let d=0;for(const e of n){if(d+e.text.length>c.text.length)break;h.push(e.text),d+=e.text.length}const u=h.join("").trim().length;d=0;for(const s of n){if(d+s.text.length>u)break;s.color&&(e.save(),e.fillStyle=s.color),l+=X(e,new r.Point(l,i.y),s.text,t),s.color&&e.restore(),d+=s.text.length}return c.elided&&(l+=X(e,new r.Point(l,i.y),"...",t)),l}function Q(e){return e.map((e=>({...e,title:""})))}function ee(e,t){const i=[{text:e.trim()}];for(const e of t)e.visible&&(""!==i[i.length-1].text&&i.push({text:" "}),e.title&&i.push({text:e.title}),i.push({text:e.value,color:e.color}));return i}class te{constructor(e,t){this._logoTextColor=null,this._snapshotData=e,t=t||{},this._options={backgroundColor:V.themes[e.theme].getThemedColor("color-bg-primary"),borderColor:V.themes[e.theme].getThemedColor("color-border"),font:W.CHART_FONT_FAMILY,fontSize:12,legendMode:"vertical",hideResolution:!1,hideStudiesFromLegend:!1,showHeaderPublishedBy:!1,showHeaderMainSymbol:!1,...t};const i=$[e.layout],s=e.charts.map((e=>function(e){const t=e.panes[0],i=t.canvas.width+t.leftAxis.canvas.width+t.rightAxis.canvas.width;let s=0;for(const t of e.panes)s+=t.canvas.height;return void 0!==e.timeAxis&&0!==e.timeAxis.contentHeight&&(s+=e.timeAxis.canvas.height),(0,B.size)({width:i,height:s})}(e)));if(this._pixelRatio=e.hidpiRatio,this._chartsGeometry=e.charts.map(((e,t)=>K(t,s,i,this._pixelRatio))),!j){let i=e.theme;void 0!==t.backgroundColor&&(i="black"===(0,R.rgbToBlackWhiteString)((0,R.parseRgb)(t.backgroundColor),150)?N.StdTheme.Dark:N.StdTheme.Light),this._logoTextColor=V.themes[i].getThemedColor("color-text-primary")}this._headerDefaultTextColor=V.themes[e.theme].getThemedColor("color-text-primary")}async getImage(){const e=this._pixelRatio;let t=0,i=0,s=0;const n=this._headerItems();if(n.length>0){s=Math.ceil(1.4*this._options.fontSize*e)*n.length}
i+=s;let o=0,a=0;for(const e of this._chartsGeometry)o=Math.max(o,e.x+e.width),a=Math.max(a,e.y+e.height);const l=i;t+=o,i+=a,t+=Math.round(10*e);const c=j?Math.round(10*e):Math.round(35*e),h=i;i+=c;const d=(0,F.createDisconnectedCanvas)(document,(0,B.size)({width:t,height:i}),1),u=(0,F.getContext2D)(d);u.font=(0,H.makeFont)(this._options.fontSize,this._options.font),u.textBaseline="top",u.fillStyle=this._options.backgroundColor,u.fillRect(0,0,t,i),n.length>0&&this._drawHeader(u,n,t,new r.Point(Math.round(10*e),Math.round(10*e)));for(let e=0;e0&&t.leftAxis.contentHeight>0&&(i.drawImage(t.leftAxis.canvas,s,n),s+=t.leftAxis.canvas.width),i.drawImage(t.canvas,s,n),s+=t.canvas.width,t.rightAxis.contentWidth>0&&t.rightAxis.contentHeight>0&&i.drawImage(t.rightAxis.canvas,s,n),"pane"===t.type&&(i.fillStyle=e.colors.text,this._drawLegend(t,i,new r.Point(o,l),a)),n+=t.canvas.height}if(void 0!==e.timeAxis&&0!==e.timeAxis.contentHeight){let t=0;e.timeAxis.lhsStub.contentWidth>0&&e.timeAxis.lhsStub.contentHeight>0&&(i.drawImage(e.timeAxis.lhsStub.canvas,t,n),t+=e.timeAxis.lhsStub.canvas.width),i.drawImage(e.timeAxis.canvas,t,n),t+=e.timeAxis.canvas.width,e.timeAxis.rhsStub.contentWidth>0&&e.timeAxis.rhsStub.contentHeight>0&&i.drawImage(e.timeAxis.rhsStub.canvas,t,n)}i.strokeStyle=this._options.borderColor,i.strokeRect(0,0,t.width,t.height),i.restore()}_headerItems(){var e,t,i,s;const r=[];if(this._options.showHeaderPublishedBy&&this._snapshotData.publishedBy)for(const e of this._snapshotData.publishedBy)r.push([{text:e}]);if(this._options.showHeaderMainSymbol){const n=this._snapshotData.charts[0],o=`${null===(e=n.meta)||void 0===e?void 0:e.symbol}, ${null===(t=n.meta)||void 0===t?void 0:t.resolution}`;r.push(ee(o,null!==(s=null===(i=n.meta)||void 0===i?void 0:i.values)&&void 0!==s?s:[]))}return r}_drawHeader(e,t,i,s){e.save(),e.fillStyle=this._headerDefaultTextColor;const n=Math.ceil(1.4*this._options.fontSize*this._pixelRatio);t.forEach(((t,o)=>{J(e,this._pixelRatio,new r.Point(s.x,s.y+n*o),i,t,!0)})),e.restore()}_drawLegend(e,t,i,n){let o=!0;const a=Math.ceil(1.4*this._options.fontSize*this._pixelRatio);let l=i.x,c=i.y;if(e.mainSeriesText&&c+a{e.fillText(r,0,0)}))}_fillRadius(e){const t=this._data.style,i=Math.max(1,Math.floor(e));let s=Math.round(t.lollipop.width*e);return s%2!=i%2&&(s+=1),s/2}_drawBorderLine(e,t,i,s){const r=this._data.style;e.strokeStyle=r.lollipop.strokeStyle,e.lineWidth=i,(0,we.setLineStyle)(e,be.LINESTYLE_SOLID),(0,we.createCircle)(e,t.x,t.y,s),e.stroke()}_drawFilledCircle(e,t,i,s){e.fillStyle=s,(0,we.createCircle)(e,t.x,t.y,i),e.fill()}}var xe,Te,Ie=i(56468);!function(e){e[e.SpaceBetweenRows=25]="SpaceBetweenRows",e[e.TooltipTopMargin=15]="TooltipTopMargin",
e[e.SpaceBetweenCardAndLollipop=8]="SpaceBetweenCardAndLollipop"}(xe||(xe={}));class Me extends Pe{_drawLollipop(e,t,i){var s;if(!this._imageLoaded())return void super._drawLollipop(e,t,i);const r=this._data.style,{horizontalPixelRatio:n}=i,o=this._fillRadius(n);let a=Math.round(r.lollipop.lineWidth*n),l=o-Math.round(1*n+a/2);if(r.lollipop.fillCircle&&(r.lollipop.backgroundColor&&this._drawFilledCircle(e,t,o,r.lollipop.backgroundColor),r.lollipop.fillStyle&&this._drawFilledCircle(e,t,l,r.lollipop.fillStyle)),null===(s=this._data.style.lollipop.image)||void 0===s?void 0:s.imageElement){const i=o-Math.round(1*n+2*a),s=2*i;e.save(),e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high",(0,we.createCircle)(e,t.x,t.y,i),e.clip(),e.drawImage(this._data.style.lollipop.image.imageElement,t.x-i,t.y-i,s,s),e.restore()}"active"===this._data.status&&(l-=a/2,a*=1.5),this._drawBorderLine(e,t,a,l)}_drawLabel(e,t,i){this._imageLoaded()&&!this._data.style.lollipop.text.showWhenImageLoaded||super._drawLabel(e,t,i)}_imageLoaded(){return Boolean(this._data.style.lollipop.image&&this._data.style.lollipop.image.imageElement&&this._data.style.lollipop.image.imageElement.complete&&this._data.style.lollipop.image.imageElement.naturalWidth)}}!function(e){e.PositiveEarningFillPath="M8.961.92a3 3 0 0 1 3.078 0l7.5 4.48A3 3 0 0 1 21 7.975V20a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V7.975A3 3 0 0 1 1.461 5.4l7.5-4.48z",e.PositiveEarningStrokePath="M9.867 2.742c.39-.23.875-.23 1.266 0l7.5 4.406c.382.225.617.635.617 1.078V20c0 .69-.56 1.25-1.25 1.25H3c-.69 0-1.25-.56-1.25-1.25V8.226c0-.443.235-.853.617-1.078l7.5-4.406z",e.NegativeEarningFillPath="M8.961 23.08a3 3 0 0 0 3.078 0l7.5-4.48A3 3 0 0 0 21 16.025V4a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3v12.025A3 3 0 0 0 1.461 18.6l7.5 4.48z",e.NegativeEarningStrokePath="M9.866 21.257c.391.23.877.23 1.268 0l7.5-4.414a1.25 1.25 0 0 0 .616-1.078V4c0-.69-.56-1.25-1.25-1.25H3c-.69 0-1.25.56-1.25 1.25v11.765c0 .443.234.853.616 1.078l7.5 4.414z",e.DefaultEarningFillPath="M3 0h15c1.662 0 3 1.338 3 3v15c0 1.662-1.338 3-3 3H3c-1.662 0-3-1.338-3-3V3c0-1.662 1.338-3 3-3z",e.DefaultEarningStrokePath="M3 1.75h15c.693 0 1.25.557 1.25 1.25v15c0 .693-.557 1.25-1.25 1.25H3c-.692 0-1.25-.558-1.25-1.25V3c0-.692.558-1.25 1.25-1.25z"}(Te||(Te={}));const Ae={fillPath:new Path2D("M8.961.92a3 3 0 0 1 3.078 0l7.5 4.48A3 3 0 0 1 21 7.975V20a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V7.975A3 3 0 0 1 1.461 5.4l7.5-4.48z"),strokePath:new Path2D("M9.867 2.742c.39-.23.875-.23 1.266 0l7.5 4.406c.382.225.617.635.617 1.078V20c0 .69-.56 1.25-1.25 1.25H3c-.69 0-1.25-.56-1.25-1.25V8.226c0-.443.235-.853.617-1.078l7.5-4.406z")},Le={fillPath:new Path2D("M8.961 23.08a3 3 0 0 0 3.078 0l7.5-4.48A3 3 0 0 0 21 16.025V4a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3v12.025A3 3 0 0 0 1.461 18.6l7.5 4.48z"),strokePath:new Path2D("M9.866 21.257c.391.23.877.23 1.268 0l7.5-4.414a1.25 1.25 0 0 0 .616-1.078V4c0-.69-.56-1.25-1.25-1.25H3c-.69 0-1.25.56-1.25 1.25v11.765c0 .443.234.853.616 1.078l7.5 4.414z")},ke={
fillPath:new Path2D("M3 0h15c1.662 0 3 1.338 3 3v15c0 1.662-1.338 3-3 3H3c-1.662 0-3-1.338-3-3V3c0-1.662 1.338-3 3-3z"),strokePath:new Path2D("M3 1.75h15c.693 0 1.25.557 1.25 1.25v15c0 .693-.557 1.25-1.25 1.25H3c-.692 0-1.25-.558-1.25-1.25V3c0-.692.558-1.25 1.25-1.25z")};function De(e,t,i,s,r){const{horizontalPixelRatio:n,verticalPixelRatio:o}=i;e.save(),e.translate(t.x-s.lollipop.width*n/2,t.y-s.lollipop.height*o/2),e.scale(n,o),s.lollipop.fillCircle&&s.lollipop.backgroundColor&&(e.fillStyle=s.lollipop.backgroundColor,e.fill(r.fillPath)),e.strokeStyle=s.lollipop.strokeStyle,e.lineWidth=Math.round(s.lollipop.lineWidth*n)/n,(0,we.setLineStyle)(e,be.LINESTYLE_SOLID),s.lollipop.fillCircle&&s.lollipop.fillStyle&&(e.fillStyle=s.lollipop.fillStyle,e.fill(r.strokePath)),e.stroke(r.strokePath),e.restore()}function Ee(e,t,i,s){De(e,t,i,s,Ae)}function Ve(e,t,i,s){De(e,t,i,s,Le)}function Be(e,t,i,s){De(e,t,i,s,ke)}class Re extends Pe{_drawLollipop(e,t,i){const s=this._data.style;switch(s.shape){case"earningUp":Ee(e,t,i,s);break;case"earningDown":Ve(e,t,i,s);break;case"earning":Be(e,t,i,s);break;default:super._drawLollipop(e,t,i)}}}var Ne;!function(e){e[e.HoveredColorTransparency=85]="HoveredColorTransparency",e.ActiveTextColor="rgba(255, 255, 255, 0.92)"}(Ne||(Ne={}));const Oe={backgroundDark:(0,ge.getHexColorByName)("color-cold-gray-900"),backgroundLight:(0,ge.getHexColorByName)("color-white")};class Fe extends class{constructor(e,t,i){this._invalidated=!1,this._renderer=new fe.CompositeRenderer,this._textWidthCache=new ve.TextWidthCache,this._stylesCache=null,this._lollipops={},this._lollipopsCounter=0,this._lastClickedId=null,this.onPaneBgChange=()=>{this._recreateStyles(this._model)},this._lastClickedId=null,this._model=e,this._source=t,this._clickHandler=i,this._recreateStyles(e),e.backgroundColor().subscribe(this.onPaneBgChange),e.mainSeries().onSymbolIntervalChanged().subscribe(this,this._onSymbolOrIntervalChanged)}destroy(){this._model.backgroundColor().unsubscribe(this.onPaneBgChange),this._model.mainSeries().onSymbolIntervalChanged().unsubscribeAll(this)}processClickOutside(e,t){var i;if(null===this._lastClickedId||!t)return void this.clearLastClicked();let n=null;if((0,ce.isTouchMouseEvent)(t))n=new r.Point(t.clientX,t.clientY);else if(function(e){return void 0!==e.touches}(t)){if(1!==t.touches.length)return;{const e=(0,s.ensureNotNull)(t.target).getBoundingClientRect(),i=t.touches[0];n=new r.Point(i.clientX-e.left,i.clientY-e.top)}}else n=new r.Point(t.offsetX,t.offsetY);const o=this._renderer.hitTest(n,e);null!==o&&(null===(i=o.data())||void 0===i?void 0:i.activeItem)===(0,s.ensureDefined)(this._lollipops[this._lastClickedId]).itemIndex||this.clearLastClicked()}clearLastClicked(){const e=null!==this._lastClickedId&&this._lollipops[this._lastClickedId]||null;null!==e&&(e.active=!1),this._lastClickedId=null}getLastClickedLollipopId(){return this._lastClickedId}update(){this._invalidated=!0}afterUpdate(e,t,i,s){}getStyle(e,t){let i=t;if(e.stack&&(i+="_stack:"+e.stack),"active"===i)return this._activeStyle
;if("hovered"===i)return this._hoveredStyle;if("default"===i)return this._defaultStyle;if(this._stylesCache||(this._stylesCache={}),!this._stylesCache[i]){const s=(0,_e.clone)("active"===t?this._activeStyle:"hovered"===t?this._hoveredStyle:this._defaultStyle);e.stack&&(s.lollipop.incHeight=25*e.stack),this._stylesCache[i]=s}return this._stylesCache[i]}hasTooltip(e){return!0}_getY(){let e=0;const t=this._model.panes();for(let i=t.length;i--;){const s=t[i];s.containsMainSeries()&&(e+=s.height())}return e}_showBarLine(e){return this.hasTooltip(e)&&(e.hovered||e.active)}_createRenderers(e){const{mediaSize:t}=e;this._renderer.clear();for(const i in this._lollipops)if(this._lollipops.hasOwnProperty(i)){const n=(0,s.ensureDefined)(this._lollipops[i]);if(n.visible){const i=this._getLollipopStatus(n),s=this.getStyle(n,i),o={id:n.id,centerPoint:new r.Point(n.basePoint.x,n.basePoint.y-s.lollipop.bottom-s.lollipop.height/2-(s.lollipop.incHeight||0)),style:s,status:i},a={activeItem:n.itemIndex,hideCrosshairLinesOnHover:!0,clickHandler:this._lollipopMouseClickHandler.bind(this,e,o,t),tapHandler:this._lollipopMouseClickHandler.bind(this,e,o,t)};if(this._renderer.append(this._createRendererForLollipop(o,a)),this._showBarLine(n)){const{strokeStyle:e,lineStyle:t,lineWidth:i}=s.barLine,r={color:e,linestyle:t,linewidth:i,x:n.basePoint.x,top:0,bottom:n.basePoint.y-s.lollipop.bottom-s.lollipop.height},o=new ye.VerticalLineRenderer;o.setData(r),this._renderer.insert(o,0)}}}}_recreateStyles(e){this._stylesCache=null}_createRendererForLollipop(e,t){return new Pe(e,new Ie.HitTestResult(Ie.HitTarget.Custom,t),this._textWidthCache)}_onSymbolOrIntervalChanged(){this._lollipops={},this._lollipopsCounter=0,this._renderer.clear(),this.clearLastClicked()}_lollipopMouseClickHandler(e,t,i,n){n.preventDefault();const o=t.id;if(this._lastClickedId=this._lastClickedId===o?null:o,null===this._lastClickedId)return;const a={target:n.target,targetSize:i,point:new r.Point(t.centerPoint.x,t.centerPoint.y-t.style.lollipop.height/2-8),marginTop:15};this._clickHandler(e,a,(()=>{const e=(0,s.ensureDefined)(this._lollipops[o]);return this._createTooltipContent(e)}))}_getLollipopStatus(e){return e.active?"active":e.hovered?"hovered":"default"}}{constructor(e,t,i){super(e,t,i),this.stylesCache={},this.templatesCache={},this._itemIndexToId=new Map,this.source=t}clearCaches(){this.clearLastClicked(),this._lollipops={},this._lollipopsCounter=0}update(){this._invalidated=!0}renderer(e){return this._invalidated&&(this._createLollipops(e),this._invalidated=!1),this._renderer}getStyle(e){const t=e.active?"active":e.hovered?"hovered":"default";return this._generateStyle(t,e)}hasTooltip(e){return Boolean(e.items&&e.items.length)}_createTooltipContent(e){const t=e.items;return t?[{type:"common",subTitle:Array.isArray(t)?t.map((e=>({value:e}))):[{value:t}],style:{color:e.color}}]:null}_createRendererForLollipop(e,t){return new(e.style.lollipop.image?Me:Re)(e,new Ie.HitTestResult(Ie.HitTarget.Custom,t),this._textWidthCache)}_lollipopMouseClickHandler(e,t,i,s){
super._lollipopMouseClickHandler(e,t,i,s),(0,re.emit)("onTimescaleMarkClick",t.id)}_createLollipops(e){const t=this._model.timeScale(),i=super._getY(),s=this._model.lastHittestData(),n=this._model.hoveredSource(),o=this.source.marks(),a=new Map;Object.keys(o).forEach((e=>{var l;const c=o[e],h=c.id,d=c.index;if(null!=d){const e=h===this.getLastClickedLollipopId(),o=this._lollipops[h],u=void 0!==o?o.itemIndex:this._lollipopsCounter++;this._itemIndexToId.has(u)||this._itemIndexToId.set(u,h);const p=n===this.source&&null!==s&&s.activeItem===u,_=(null!==(l=a.get(d))&&void 0!==l?l:-1)+1;a.set(d,_),this._lollipops[h]={id:h,itemIndex:u,basePoint:new r.Point(t.indexToCoordinate(d)+1,i),hovered:p,active:e,label:c.label,color:c.color,items:c.tooltip,visible:!0,stack:_,shape:c.shape,image:this._getImageForUrl(c.imageUrl),showLabelWhenImageLoaded:c.showLabelWhenImageLoaded,textColor:c.labelFontColor}}})),super._createRenderers(e)}_getImageForUrl(e){if(e)return this.source.getImageElement(e)}_generateStyle(e,t){const{color:i,label:s,stack:r,shape:n,image:o,textColor:a}=t;let l=e+i+s+(this._model.dark().value()?"dark":"light");if(void 0!==r&&(l+="_stack"+r),!(l in this.stylesCache)){const c=this._model.dark().value()?Oe.backgroundDark:Oe.backgroundLight;let h,d=i;if("active"===e)h=i,d="rgba(255, 255, 255, 0.92)";else if("hovered"===e){const e=(0,R.tryParseRgba)(i);if(null!==e){const t=e[3]*(1-.85);h=(0,R.rgbaToString)((0,R.rgba)(e[0],e[1],e[2],t))}}a&&(d=a);let u=23,p=23,_=1,m=0;"earning"===n?(p=21,u=21,_=2):"earningUp"===n?(u=21,m=1,_=2):"earningDown"===n&&(u=21,m=-.5,_=.5);const g={barLine:{lineStyle:be.LINESTYLE_DASHED,lineWidth:1,strokeStyle:i},lollipop:{width:u,height:p,bottom:_,backgroundColor:c,lineWidth:1.5,fillStyle:h,strokeStyle:i,fillCircle:!0,text:{label:s,deltaY:m,strokeStyle:d,font:(0,H.makeFont)(12,W.CHART_FONT_FAMILY,"bold"),showWhenImageLoaded:t.showLabelWhenImageLoaded},image:o},shape:n};void 0!==r&&(g.lollipop.incHeight=25*r),this.stylesCache[l]=g}return this.stylesCache[l]}}var We=i(55917),He=i(2718),ze=i(19938),Ue=i(41925);const je=(0,n.getLogger)("Chart.UserDefinedImageMarks");class Ge extends Ue.BarsMarksContainer{constructor(){super(...arguments),this._imageItems=new Map,this._destroyed=!1}destroy(){this._destroyed=!0,super.destroy()}getImageElement(e){return this._imageItems.has(e)||this.addImageToStore(e),this._imageItems.get(e)}addImageToStore(e){this._imageItems.has(e)||this._loadNewImage(e)}_loadNewImage(e){const t={imageElement:null};(0,ze.getImage)(e,e).then((e=>{this._destroyed||(t.imageElement=e,this.updateAllViewsAndRepaint(),this._model.updateSource(this))})).catch((()=>{je.logWarn(`An error ocurred while loading image ${e}`)})),this._imageItems.set(e,t)}}class qe extends Ge{constructor(e){super(e,new We.DefaultProperty({defaultName:"UserDefinedTimescaleMarks",state:{visible:!0}})),this._requestedPointsets=new Set,(0,me.hideMarksOnBars)().subscribe(this,(()=>this._properties.childs().visible.setValue(!(0,me.hideMarksOnBars)().value()))),this._paneView=new Fe(e,this,this._showTooltip.bind(this)),
this._paneViews=[this._paneView]}destroy(){(0,me.hideMarksOnBars)().unsubscribeAll(this),super.destroy()}zorder(){return He.sortSourcesPreOrdered.TimeScaleMarks}name(){return"UserDefinedTimescaleMarks"}userEditEnabled(){return!1}clearMarks(e=0){if(1===e)return;const t=this._model.chartApi();t.isConnected().value()&&Object.keys(this._marks).forEach((e=>{const i=this._getPointsetId(e);t.removePointset(i)})),this._requestedPointsets.clear(),super.clearMarks(),this._paneView.clearCaches(),this.updateAllViewsAndRepaint()}hasContextMenu(){return!1}paneViews(){return this._properties.childs().visible.value()?this._paneViews:[]}updateAllViews(){this._paneView.update()}onClickOutside(e,t){this._paneView.processClickOutside(e,t)}isVisible(){return this.properties().childs().visible.value()}_initialize(){this._properties.childs().visible.setValue(!(0,me.hideMarksOnBars)().value())}_plateViewData(e){return{text:e.text}}_getData(e){const t=this._model.mainSeries().symbolInfo();if(!t)return;const i=this.roundRange(this._rangeDifference(e)),r=this._model.mainSeries(),n=r.seriesSource().symbolInstanceId(),o=r.properties().childs().interval.value();window.ChartApiInstance.getTimescaleMarks(t,i.start,i.end,(t=>{const i=this._model.chartApi();for(const e of t){e.index=null;const t=e.id,r=this._getPointsetId(t.toString()),a=this._marks[t];if(a&&null!==a.index&&(a.tickmark===e.tickmark?e.index=a.index:this._requestedPointsets.has(r)&&i.isConnected().value()&&(i.removePointset(r),this._requestedPointsets.delete(r))),e.imageUrl&&this.addImageToStore(e.imageUrl),this._marks[t]=e,null===e.index&&i.isConnected().value()){this._requestedPointsets.add(r);const t=[[e.tickmark,0]];i.createPointset(r,"turnaround",(0,s.ensureNotNull)(n),o,t,(e=>this._onPointsetData(e)))}}this._loadedRange=this._rangeUnion(e,this._loadedRange),this.updateAllViewsAndRepaint()}),o)}_getPointsetId(e){return"pointsetMark_"+e}_onPointsetData(e){if("data_update"===e.method){const t=e.params.customId.split("_")[1],i=this._marks[t],s=e.params.plots;i&&1===s.length&&(i.index=s[0].value[0])}this.updateAllViewsAndRepaint()}async _showTooltip(e,t,r){const n=r();if(!n)return;const o=this._model.timeScale(),a=[o.onScroll(),o.barSpacingChanged(),this._model.mainSeries().onSymbolIntervalChanged(),(0,s.ensureNotNull)(this._model.paneForSource(this)).onSizeChanged()],l=this._paneView.processClickOutside.bind(this._paneView,e),c=this._paneView.clearLastClicked.bind(this._paneView);(await Promise.all([i.e(2603),i.e(7769),i.e(8077),i.e(9259),i.e(2227),i.e(361),i.e(9039)]).then(i.bind(i,184))).showLollipopTooltip({items:n,position:t,customCloseSubscriptions:a,onClickOutside:l,onCustomClose:c})}}var $e,Ke,Ye=i(71382);function Ze(e,t){const{horizontalPixelRatio:i,verticalPixelRatio:s}=t,r=Math.max(1,Math.floor(i)),n=Math.round(e.x*i)+r%2/2;let o=Math.round(e.size*i);(n+o/2)%1!=0&&(o+=1);const a=Math.min(Math.max(1,Math.round(i*e.borderWidth)),o/2);let l;const c=("up"===e.direction?-1:1)*(e.yInverted?-1:1),h=c*(Math.round(e.size*s/2)+r%2);if(void 0!==e.fixedSpaceYPosition){
const t=Math.round(e.fixedSpaceYPosition.itemSpacing*s),i=e.fixedSpaceYPosition.order,r=c*(o*i+t*(i+1));l=Math.round(e.fixedSpaceYPosition.basePosition*s)+r+h}else l=Math.round(e.y*s)+h;return{x:n,y:l,size:o,borderWidth:a,tickSize:r}}function Xe(e,t,i,s){var r,n,o;if(e.save(),i&&!s.highlightByAuthor&&(e.globalAlpha=.4),s.mine)!function(e,t,i){const{borderColor:s,backgroundColor:r,doNotFill:n,direction:o,yInverted:a}=i,{x:l,y:c,borderWidth:h,size:d,tickSize:u}=Ze(i,t);e.strokeStyle=s,e.fillStyle=r,e.lineWidth=h;const p="up"===o!==a?-1:1;let _=Math.round(d/2/Math.tan(Math.PI/6))+u%2/2;(l+_/2)%1!=0&&(_-=1);e.translate(l,c+_/2*p),e.beginPath();const m=h/2;e.moveTo(0,-p*(_-m)),e.lineTo(d/2-m,h/2),e.lineTo(-d/2+m,h/2),e.lineTo(0,-p*(_-h/2)),e.closePath(),n||e.fill();e.stroke()}(e,t,s);else{let i=!1;{const e=s.image&&(o=s.image,Boolean(o&&o.imageElement&&o.imageElement.complete&&o.imageElement.naturalWidth));i=Boolean(e&&!s.showLabelWhenImageLoaded)}!function(e,t,i,s,r){const{borderColor:n,backgroundColor:o,label:a}=i,{x:l,y:c,borderWidth:h,size:d}=Ze(i,t);e.strokeStyle=n,e.fillStyle=o,e.lineWidth=h,e.beginPath();const u=d/2-h/2;e.arc(l,c,u,0,2*Math.PI,!0),e.closePath(),e.fill(),r&&function(e,t,i,s,r){if(t){const n=2*i;e.save(),e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high",(0,we.createCircle)(e,s,r,i),e.clip(),e.drawImage(t,s-i,r-i,n,n),e.restore()}}(e,r,u,l,c);e.stroke(),!s&&a&&d/2>=7&&(e.textAlign="center",e.textBaseline="middle",e.font=a.font,e.fillStyle=a.fontColor,(0,F.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{e.fillText(a.text,l/t.horizontalPixelRatio,c/t.verticalPixelRatio)})))}(e,t,s,i,null!==(n=null===(r=s.image)||void 0===r?void 0:r.imageElement)&&void 0!==n?n:void 0)}e.restore()}!function(e){e[e.MinRadiusToDrawText=7]="MinRadiusToDrawText"}($e||($e={}));class Je{constructor(e,t,i,s){this._canvas=null,this._clickHandler=e,this._enterHandler=t,this._leaveHandler=i,this._data=null!=s?s:null}setData(e){this._data=e}hitTest(e,t){if(null===this._data)return null;for(let i=this._data.items.length-1;i>=0;--i){const s=this._hitTestDot(this._data.items[i],e,t);if(s)return s}return null}draw(e,t){this._canvas=e.canvas,null!==this._data&&this._data.items.forEach(Xe.bind(null,e,t,this._data.highlightByAuthor))}_hitTestDot(e,t,i){const s=new r.Point(e.x,Ze(e,i).y/i.verticalPixelRatio);if((0,Se.pointInCircle)(t,s,Math.max(e.size/2,8))){const t=this._canvas,i=null===t?void 0:{mouseEnterHandler:()=>this._enterHandler(e,s.y,t),mouseLeaveHandler:()=>this._leaveHandler(),clickHandler:i=>this._clickHandler(e,s.y,t,i),tapHandler:i=>this._clickHandler(e,s.y,t,i)};return new Ie.HitTestResult(Ie.HitTarget.Regular,{activeItem:e.originalItem.id,...i})}return null}}!function(e){e[e.BarSpacingToSizeRatio=.8]="BarSpacingToSizeRatio",e[e.MinSize=7]="MinSize",e[e.MaxSize=553]="MaxSize"}(Ke||(Ke={}));const Qe={green:{border:(0,ge.getHexColorByName)("color-minty-green-700"),background:(0,ge.getHexColorByName)("color-minty-green-a600")},red:{border:(0,ge.getHexColorByName)("color-ripe-red-700"),background:(0,
ge.getHexColorByName)("color-ripe-red-500")},neutral:{border:(0,ge.getHexColorByName)("color-tan-orange-700"),background:(0,ge.getHexColorByName)("color-tan-orange-500")},yellow:{border:"#EAC300",background:"#FFD400"},blue:{border:"#047ACE",background:"#0496FF"}};function et(e){var t,i,s,r;return e.hovered||e.highlightByAuthor?null!==(i=null===(t=e.overrideBorderWidth)||void 0===t?void 0:t.hoveredWidth)&&void 0!==i?i:4:null!==(r=null===(s=e.overrideBorderWidth)||void 0===s?void 0:s.width)&&void 0!==r?r:2}class tt extends class{constructor(e,t){this._tooltip=null,this._hoveredBarsMarkData=null,this._destroyed=!1,this._invalidated=!0,this._originalData=[],this._source=e,this._model=t,this._renderer=new Je(this._onItemClicked.bind(this),this._showItem.bind(this),this._hideItem.bind(this)),this._createTooltipRenderer().then((e=>{this._destroyed?null==e||e.destroy():this._tooltip=e})),e.properties().childs().visible.subscribe(null,(()=>{var e;null===(e=this._tooltip)||void 0===e||e.hide(!0)}))}destroy(){var e;this._destroyed=!0,null===(e=this._tooltip)||void 0===e||e.destroy()}source(){return this._source}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}onClickOutside(e,t){t&&((0,ce.isTouchMouseEvent)(t)?t.isTouch:(0,Ye.isTouchEvent)(t))&&null!==this._tooltip&&!this._tooltip.contains(t.target)&&this._tooltip.hide(!0)}_extractBarMarksRendererItemData(e,t){var i,s;const r=null!==(i=t.overridedTheme)&&void 0!==i?i:Qe[t.theme],n=this._calculateSize(e,t),o=this._calculateY(e,n,t);return null===this._hoveredBarsMarkData||this._hoveredBarsMarkData.id!==t.id||this._hoveredBarsMarkData.x===t.x&&this._hoveredBarsMarkData.y===Math.round(o)||(null===(s=this._tooltip)||void 0===s||s.hide(!0),this._hoveredBarsMarkData=null),{x:t.x,y:this._calculateY(e,n,t),direction:t.direction,borderColor:r.border,borderWidth:et(t),backgroundColor:r.background,size:n,doNotFill:!t.public,yInverted:t.yInverted,label:void 0===t.label?void 0:{text:t.label,fontColor:t.labelFontColor,font:(0,H.makeFont)(Math.ceil(Math.max(10,Math.min(n/2,20))),W.CHART_FONT_FAMILY,"bold")},originalItem:t}}_onItemClicked(e,t,i,s){s.isTouch&&this._showItem(e,t,i)}async _showItem(e,t,i){var r;const n=await this._tooltipProps(e);if(null===n)return;const o=this._model.timeScale().barSpacing(),a=this._calculateSize(o,e.originalItem);this._hoveredBarsMarkData={x:e.x,y:Math.round(this._calculateY(o,a,e.originalItem)),id:e.originalItem.id},null===(r=this._tooltip)||void 0===r||r.show({itemSize:a,container:(0,s.ensureNotNull)(i.parentElement),x:e.x,y:t,factoryProps:n,onClickOutside:()=>{var e;return null===(e=this._tooltip)||void 0===e?void 0:e.hide(!0)}})}_hideItem(){var e;null===(e=this._tooltip)||void 0===e||e.hide()}_calculateSize(e,t){return Math.min(553,Math.max(7,t.minSize,.8*e))}_updateImpl(){this._originalData=this._source.getPlatesViewData();const e=this._model.timeScale().barSpacing(),t=this._originalData.map(this._extractBarMarksRendererItemData.bind(this,e));this._renderer.setData({items:t,
barSpacing:e,highlightByAuthor:!1})}}{async _createTooltipRenderer(){const[{TooltipRenderer:e},{UserDefinedBarsMarksTooltip:t}]=await Promise.all([Promise.all([i.e(2841),i.e(2227),i.e(8020)]).then(i.bind(i,6897)),Promise.all([i.e(2841),i.e(2227),i.e(8020)]).then(i.bind(i,16608))]);return new e(t)}_calculateY(e,t,i){const s=Math.max(1.4*i.minSize,e+4),r=("up"===i.direction?-1:1)*(i.yInverted?-1:1)*(s*(i.order+.6)+.25*s);return i.y+r}_onItemClicked(e,t,i,s){var r,n;super._onItemClicked(e,t,i,s),null===(n=(r=e.originalItem).onClicked)||void 0===n||n.call(r)}_tooltipProps(e){const t=e.originalItem.text;return t?Promise.resolve({text:t}):Promise.resolve(null)}_extractBarMarksRendererItemData(e,t){return{...super._extractBarMarksRendererItemData(e,t),showLabelWhenImageLoaded:t.showLabelWhenImageLoaded,image:t.image}}}class it extends Ge{constructor(e){super(e,new We.DefaultProperty({defaultName:"UserDefinedBarsMarks",state:{visible:!0}})),this._paneView=new tt(this,e),this._paneViews=[this._paneView],(0,me.hideMarksOnBars)().subscribe(this,(()=>{this.properties().childs().visible.setValue(!(0,me.hideMarksOnBars)().value())}))}destroy(){(0,me.hideMarksOnBars)().unsubscribeAll(this),this._paneView.destroy(),super.destroy()}zorder(){return He.sortSourcesPreOrdered.BarMarks}name(){return"UserDefinedBarsMarks"}userEditEnabled(){return!1}clearMarks(e=0){2!==e&&(super.clearMarks(),this.updateAllViewsAndRepaint())}hasContextMenu(){return!1}paneViews(){return this._properties.childs().visible.value()?this._paneViews:[]}isVisible(){return this.properties().childs().visible.value()}onClickOutside(e,t){this._paneView.onClickOutside(e,t)}_initialize(){this.properties().childs().visible.setValue(!(0,me.hideMarksOnBars)().value())}_plateViewData(e){const t={text:e.text,onClicked:e.onClicked};"object"==typeof e.color&&(t.theme="user_defined_theme",t.overridedTheme={},t.overridedTheme.border=e.color.border,t.overridedTheme.background=e.color.background);const i=(0,_e.isNumber)(e.borderWidth)?e.borderWidth:void 0,s=(0,_e.isNumber)(e.hoveredBorderWidth)?e.hoveredBorderWidth:void 0;if(void 0===i&&void 0===s||(t.overrideBorderWidth={width:i,hoveredWidth:s}),e.showLabelWhenImageLoaded&&(t.showLabelWhenImageLoaded=!0),e.imageUrl){const i=this.getImageElement(e.imageUrl);t.image=i}return t}_getData(e){const t=this._model.mainSeries().symbolInfo();if(!t)return;const i=this.roundRange(this._rangeDifference(e)),s=this._model.mainSeries().properties().childs().interval.value();window.ChartApiInstance.getMarks(t,i.start,i.end,(t=>{for(const e of t)this._marks[e.id]=e,e.imageUrl&&this.addImageToStore(e.imageUrl);this._loadedRange=this._rangeUnion(e,this._loadedRange),this.updateAllViewsAndRepaint()}),s)}}var st=i(45345);const rt=new c.TranslatedString("apply toolbars theme",o.t(null,void 0,i(86708)));class nt extends p.UndoCommand{constructor(e,t,i=!0){super(rt),this._prevThemeName=e,this._themeName=t,this._syncState=i}undo(){(0,V.isStdThemeName)(this._prevThemeName)&&((0,st.setTheme)(this._prevThemeName),this._syncState&&(0,V.syncTheme)())}redo(){(0,
V.isStdThemeName)(this._themeName.toLowerCase())&&((0,st.setTheme)(this._themeName.toLowerCase()),this._syncState&&(0,V.syncTheme)())}}var ot=i(88960),at=i(23869),lt=i(91676),ct=(i(85049),i(10074)),ht=i(16638),dt=i(68159),ut=i(75162);i(53473);const pt=!l.CheckMobile.any(),_t=((0,n.getLogger)("ChartWidgetCollectionBase"),new c.TranslatedString("apply indicators to entire layout",o.t(null,void 0,i(70507)))),mt=new c.TranslatedString("sync time",o.t(null,void 0,i(91677))),gt=new c.TranslatedString("resize layout",o.t(null,void 0,i(47418))),ft=new c.TranslatedString("reset layout sizes",o.t(null,void 0,i(85366))),vt=new c.TranslatedString("apply chart theme",o.t(null,void 0,i(68231))),yt=new c.TranslatedString("symbol lock",o.t(null,void 0,i(53278))),St=new c.TranslatedString("interval lock",o.t(null,void 0,i(56558))),bt=new c.TranslatedString("date range lock",o.t(null,void 0,i(58850))),wt=new c.TranslatedString("track time",o.t(null,void 0,i(46807))),Ct=new c.TranslatedString("change series style",o.t(null,void 0,i(49965)));o.t(null,void 0,i(28298)),o.t(null,void 0,i(78972)),o.t(null,void 0,i(10615)),o.t(null,void 0,i(81518)),o.t(null,void 0,i(40947)),o.t(null,void 0,i(55801)),o.t(null,void 0,i(76651)),o.t(null,void 0,i(68054)),o.t(null,void 0,i(94656));function Pt(e,t){const i=t.model().model().studyTemplate();e.undoHistory.beginUndoMacro(_t);for(let s=0;se.id()===n)))}const l=await t.pasteSourceFromClip(o,i,!0);if(l&&1===l.length){const e=l[0];if(r.asCompare){const i=(0,s.ensureNotNull)(t.mainSeries().priceScale());t.moveToScale(e,(0,s.ensureDefined)(o),i,n),t.setPriceScaleMode({percentage:!0},i,null)}}t.model().lightUpdate()}}e.undoHistory.endUndoMacro()}function Tt(e){let t=1;for(;e.has(""+t);)t++;return""+t}function It(e){const t=new Map,i=e.chartsCountToSave(),s=new Set;for(let r=0;r(0,s.ensureDefined)(e.content.chartId)))}function kt(e,t,i){e.chartsCountToSave();i.forEach((i=>{const s=(t=>{var i,s;return null!==(s=null===(i=e.chartWidgetsDefs.find((e=>e.chartWidget.id()===t)))||void 0===i?void 0:i.chartWidget)&&void 0!==s?s:null})(i.chartId);null==s||s.resetLineToolsInvalidated(t,i.savedDto,i.sharingMode)}))}function Dt(e,t,i,s){const r=e.map((e=>e.chartWidget)).filter((e=>e.hasModel())).filter((e=>e.id()===t||0!==s));try{r.forEach((e=>e.startApplyingLineToolUpdateNotification())),r.forEach((e=>e.applyLineToolUpdateNotification(i,s)))}finally{r.forEach((e=>e.endApplyingLineToolUpdateNotification()))}}function Et(e){return new I({copyRequested:(t,i)=>{e.activeChartWidget.value().model().clipboardCopy(t,i)},cutRequested:(t,i)=>{e.activeChartWidget.value().model().clipboardCut(t,i)},pasteRequested:(t,i)=>{(i?i.model().undoModel():e.activeChartWidget.value().model()).clipboardPaste(t,i)}})}function Vt(e,t){0}function Bt(e){const t={};return e.chartWidgetsDefs.map((e=>e.chartWidget)).forEach((e=>t[e.id()]=function(e){var t,i,r,n,o;const a={};if(!e.hasModel()){const n=e.options().content;if(!n)return a;const o=(0,s.ensureNotNull)(n.panes.reduce(((e,t)=>{var i;return null!==(i=null!=e?e:t.sources.find((e=>"MainSeries"===e.type)))&&void 0!==i?i:null}),null));return a.resolution=null===(t=o.state)||void 0===t?void 0:t.interval,a.symbol=null===(i=o.state)||void 0===i?void 0:i.symbol,a.short_name=null===(r=o.state)||void 0===r?void 0:r.shortName,a}const l=e.model().mainSeries(),c=l.properties().childs(),h=l.symbolInfo();a.resolution=c.interval.value(),a.symbol_type=null!==h&&h.type||"",a.exchange=null!==h&&h.exchange||"",a.listed_exchange=null!==h&&h.listed_exchange||"";const d=null!==(n=null==h?void 0:h.legs)&&void 0!==n?n:[];if(null!==h&&l.isSpread()){const e=d[0];let t=h.base_name[0];t=t.split(":")[1],a.symbol=e,a.short_name=t,a.expression=h.full_name}else a.symbol=null!==h&&h.ticker||c.symbol.value(),a.short_name=c.shortName.value();const u=null!==(o=null==h?void 0:h.base_name)&&void 0!==o?o:[];return a.legs=d.map(((e,t)=>({symbol:e,pro_symbol:u[t]}))),a}(e))),t}function Rt(e,t){0}async function Nt(e,t){return null}function Ot(e,t){return L(t,{snapshotUrl:e}).then((e=>((0,re.emit)("onScreenshotReady",e),e)))}function Ft(e,t){const i={snapshotUrl:e};const s=(0,E.isOnMobileAppPage)("any");return(s?L:A)(t,i).then((e=>((0,re.emit)("onScreenshotReady",e),s||(0,re.emit)("onServerScreenshotCopiedToClipboard"),e)))}function Wt(e){return function(e){return M().then((t=>t.downloadClientScreenshot(e)))}(e)}function Ht(e){return function(e){return M().then((t=>t.copyToClipboardClientScreenshot(e)))}(e).then((()=>{(0,re.emit)("onClientScreenshotCopiedToClipboard")}))}const zt={
s:0,"2h":0,"2v":1,"2-1":1,"3s":0,"3h":0,"3v":2,4:1,6:1,8:1,"1-2":1,"3r":1,"4h":0,"4v":3,"4s":0,"4s-l":0,"5h":0,"5v":0,"6h":0,"6v":0,"7h":0,"8h":0,"8v":0,"1-3":1,"2-2":3,"2-2-l":0,"2-3":2,"3-2":3,"1-4":1,"2-4":2,"5s":0,"6c":4,"8c":6,"9s":6,"9h":0,"9v":0,"10h":0,"10v":0,"10c5":1,"12c6":1,"12c4":3,"14c7":1,"16c8":1,"16c4":3};function Ut(e,t,i,s){let r=0;const n=(0,at.createWVFromGetterAndSubscriptions)((()=>++r),[i,s]);return(0,ot.combine)((t=>{var i;return null!==(i=e()[zt[t]])&&void 0!==i?i:null}),t.weakReference(),n.ownership())}function jt(e,t,i,s){const r=Math.max(1,window.devicePixelRatio||1),n=e.getAll();let o;const a=e.maximizedChartWidget().value();if(s&&s.onlyActiveChart||a)return{layout:"s",hidpiRatio:r,theme:(0,V.getCurrentTheme)().name,charts:[e.activeChartWidget.value().images(s)],publishedBy:o};const l=[],c=se.layouts[e.layout.value()].count,h={showCollapsedStudies:(s=s||{}).showCollapsedStudies,status:s.status};for(let e=0;et?e.allLayoutSizesState.set(s,t):e.allLayoutSizesState.delete(s);if(t)return e.sizingState.setValue(i),void r(i);e.undoHistory.beginUndoMacro(ft),e.undoHistory.pushUndoCommand(new g(e.sizingState,e.sizingState.value(),i,ft)),e.undoHistory.pushUndoCommand(new m(r,e.allLayoutSizesState.get(e.layoutTemplate.value().layoutType),i,ft)),e.undoHistory.endUndoMacro()}function Yt(e,t){Kt(e,t)}class Zt{constructor(e,t,i){this._onShiftPressed=e=>{const t=this._state.currentLayoutResizeAction.value();t&&this._applyMouseMove(t.delta,e)},this._state=e,this._splitterElement=t,this._splitter=i,(0,he.shiftPressed)().subscribe(this._onShiftPressed)}destroy(){(0,he.shiftPressed)().unsubscribe(this._onShiftPressed)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e)}mouseEnterEvent(e){this._highlightSplitters(e.shiftKey)}mouseLeaveEvent(e){const t=$t(this._splitter.className)
;Array.from(this._state.parent.getElementsByClassName(t)).forEach((e=>e.classList.remove(ut.hovered)))}mouseDoubleClickEvent(e){Kt(this._state)}_highlightSplitters(e){const t=$t(this._splitter.className);Array.from(this._state.parent.getElementsByClassName(t)).forEach((e=>e.classList.remove(ut.hovered)));(e?Array.from(this._state.parent.getElementsByClassName(t)):[this._splitterElement]).forEach((e=>e.classList.add(ut.hovered)))}_mouseDownOrTouchStartEvent(e){const t=new r.Point(e.localX+this._splitterElement.offsetLeft,e.localY+this._splitterElement.offsetTop),i=(0,le.deepCopy)(this._state.sizingState.value());this._state.currentLayoutResizeAction.setValue({point:t,splitter:this._splitter,initialState:i,alignedState:this._state.layoutTemplate.value().syncSublayoutsBySplitter(this._splitter,(0,le.deepCopy)(i)),shiftState:e.shiftKey,delta:0}),this._splitterElement.classList.add(ut["i-active"]),this._highlightSplitters(e.shiftKey)}_pressedMouseOrTouchMoveEvent(e){const t=this._state.currentLayoutResizeAction.value();if(!t)return;t.shiftState!==e.shiftKey&&(this._highlightSplitters(e.shiftKey),t.shiftState=e.shiftKey);const i=new r.Point(e.localX+this._splitterElement.offsetLeft,e.localY+this._splitterElement.offsetTop);t.delta="v"===t.splitter.orientation?i.y-t.point.y:i.x-t.point.x,this._applyMouseMove(t.delta,e.shiftKey)}_mouseUpOrTouchEndEvent(e){const t=this._state.currentLayoutResizeAction.value();if(t&&(this._splitterElement.classList.remove(ut["i-active"]),this._state.currentLayoutResizeAction.setValue(null),t.currentState)){this._state.undoHistory.beginUndoMacro(gt),this._state.undoHistory.pushUndoCommand(new g(this._state.sizingState,t.initialState,t.currentState,gt));const e=this._state.layoutTemplate.value().layoutType;this._state.undoHistory.pushUndoCommand(new m((t=>t?this._state.allLayoutSizesState.set(e,t):this._state.allLayoutSizesState.delete(e)),this._state.allLayoutSizesState.get(this._state.layoutTemplate.value().layoutType),this._state.sizingState.value(),ft)),this._state.undoHistory.endUndoMacro(),this._state.layoutSizesChanged.setValue(!0)}}_applyMouseMove(e,t){var i;const r=(0,s.ensureNotNull)(this._state.currentLayoutResizeAction.value()),n=t?r.alignedState:r.initialState,o=null!==(i=this._state.options.padding)&&void 0!==i?i:2,a=qt(this._state);r.currentState=this._state.layoutTemplate.value().resizeApplier(a,o,e,r.splitter,(0,le.deepCopy)(n),t),this._state.sizingState.setValue(r.currentState)}}function Xt(e,t,i,s,r){var n,o;const a=null!==(n=e.options.padding)&&void 0!==n?n:2,l=null!==(o=e.options.border)&&void 0!==o?o:0;r=null!=r?r:e.layoutTemplate.value();const c=qt(e),h=r.sizer(c,i,s,a+l,pt?e.sizingState.value():void 0);h.width=Math.max(Math.round(h.width),0),h.height=Math.max(Math.round(h.height),0),h.top=Math.round(h.top),h.left=Math.round(h.left),t.metrics=h;const d=t.container.value();if(d){d.style.width=h.width+"px",d.style.height=h.height+"px",d.style.top=h.top+"px",d.style.left=h.left+"px";const e=1===s;false
;const t=Math.round(c.width),i=0===h.top&&0===h.left,r=0===h.top&&h.left+h.width===t,n=0===h.top&&h.width===t;d.classList.toggle("top-left-chart",!e&&!n&&i),d.classList.toggle("top-right-chart",!e&&!n&&r),d.classList.toggle("top-full-width-chart",e||n)}t.width.setValue(h.width),t.height.setValue(h.height)}function Jt(e){var t,i,s;let r;const n=e.layoutTemplate.value(),o=e.maximizedChartDef.value();if(r=o?[o]:e.chartWidgetsDefs.slice(0,n.count).filter((e=>!e.hiddenInLayout.value())),r.forEach(((t,i)=>Xt(e,t,i,r.length))),pt&&!e.maximizedChartDef.value()){const r=qt(e),o=null!==(t=e.options.padding)&&void 0!==t?t:2,a=null!==(i=e.options.border)&&void 0!==i?i:0,l=n.splitters(r,o+a,e.sizingState.value()),c=null!==(s=e.splitters.value())&&void 0!==s?s:[];c.forEach(((e,t)=>{t>=l.length&&(e.splitterElement.remove(),e.mouseHandler.destroy(),e.mouseListener.destroy())}));const h=l.map(((t,i)=>{const s=i({def:t,metrics:e.layoutTemplate.value().sizer({top:0,left:0,width:256,height:256},i,s.length,0)}))).sort(((e,t)=>e.metrics.top-t.metrics.top||e.metrics.left-t.metrics.left)).map((e=>e.def));if(s.length<2)return null;let r=s.indexOf(t);return-1===r?null:(r=(r+(i?s.length-1:1))%s.length,s[r])}function ei(e,t){return e.chartWidgetsDefs.some((e=>{var i;return(null===(i=e.chartWidget)||void 0===i?void 0:i.id())===t}))}function ti(e){let t=1;for(;e(""+t);)t++;return""+t}function ii(e,t,i){var r,n;const{toastsFactory:o,chartWidgetsDefs:a,customLegendWidgetsFactoriesMap:c}=e;let h={chartWidgetCollection:t,isActive:0===a.length,barsMarksContainersFactory:t=>function(e,t,i){const s=[];{const t=new it(e);s.push(t);const i=new qe(e);s.push(i)}return s}(t,0,e.options),undoHistory:e.undoHistory,readOnly:e.readOnly,initialLoading:e.initialLoading,getToasts:o?()=>o.getChartToasts():void 0,...null!=i?i:{}};void 0!==c&&(h.customLegendWidgetFactories=new Map(c));const d=document.createElement("div");d.classList.add("chart-container"),d.style.position="absolute",d.style.overflow="hidden",e.parent.insertBefore(d,e.bottomToolbar.value()),l.isEdge&&(d.style.touchAction="none",d.style.msTouchAction="none"),h.className&&d.classList.add(h.className);const p={alive:new u.WatchedValue(!0),
container:new u.WatchedValue(d),width:new u.WatchedValue,height:new u.WatchedValue,collapsed:new u.WatchedValue(!1),hiddenInLayout:new u.WatchedValue(!1),visible:new u.WatchedValue,rdState:new ne.ResizerDetacherState,requestFullscreen:()=>{e.globalDetachable.value()&&(e.setMaximized(p),e.activeChartWidget.setValue((0,s.ensureNotNull)(p.chartWidget)))},exitFullscreen:()=>{e.activeChartWidget.value()===p.chartWidget&&e.setMaximized(null)},detachable:e.globalDetachable,fullscreenable:e.globalDetachable,fullscreen:new u.WatchedValue,chartWidget:null};p.rdState.pushOwner(p),a.push(p);const _=()=>{p.visible.setValue(!p.hiddenInLayout.value()&&e.options.resizerBridge.visible.value())};p.hiddenInLayout.subscribe((()=>{(0,s.ensureNotNull)(p.chartWidget).setVisible(!p.hiddenInLayout.value()),_()})),p.collapsed.subscribe((()=>(0,s.ensureNotNull)(p.chartWidget).setCollapsed(p.collapsed.value()))),e.options.resizerBridge.visible.subscribe(_),_(),function(e,t){let i=0,s=0;const r=t.layoutTemplate.value();for(let n=0;nei(e,t))),g=p.chartWidget=new oe.ChartWidget(h,m,t.metaInfo.uid.value());e.saveChartService&&g.setSaveChartService(e.saveChartService),h.containsData?g.finishInitWithoutConnect():g.connect(),g.withModel(null,(()=>{const t=g.model().model();e.customSources.forEach(((e,i)=>{t.addCustomSource(i,e.factory,e.layer)}))})),e.updateWatchedValue(),e.updateActivityView();const f=null!==(n=null===(r=null==h?void 0:h.content)||void 0===r?void 0:r.linkingGroup)&&void 0!==n?n:null;g.linkingGroupIndex().setValue(f),g.linkingGroupIndex().subscribe(e.updateLinkingGroupCharts);const v=Ri(e,f).value();return v.length>0&&(e.symbolLock.value()&&g.setSymbol(v[0].symbolWV().value()),e.intervalLock.value()&&g.setResolution(v[0].resolutionWV().value())),e.updateLinkingGroupCharts(),e.chartWidgetCreatedDelegate.fire(g),p}function si(e,t,i,s){let r,n=e.savedChartWidgetOptions.shift();if(void 0!==n){const t=e.activeChartWidget.value();t&&t.lineToolsSynchronizer()&&(r=t.lineToolsAndGroupsDTO())}else n=function(e){const t=e.activeChartWidget.value();if(t){const i=t.state();return i.chartId=ti((t=>ei(e,t))),i.shouldBeSavedEvenIfHidden=!1,i.panes.forEach((e=>{e.sources.forEach((e=>{"alertId"in e&&(e.alertId=void 0)}))})),{content:i}}}(e);const o={...e.widgetOptions,...n,...0===i||e.symbolLock.value()?void 0:{defSymbol:null}},a=ii(e,t,o),{chartWidget:l}=a;return l.modelCreated().subscribe(null,(()=>{s?s():e.checkAllPendingModelsAlreadyCreated(),e.dateRangeLock.value()&&l===e.activeChartWidget.value()&&e.subscribeToCompletedEventForDateRangeSync(l,!0);const t=l.lineToolsSynchronizer();void 0!==r&&t&&[...r.entries()].map((([e,i])=>{0!==e&&t.applyDTO(i,e).then((()=>{t.invalidateAll()}))}));const i=e.chartWidgetsDefs.filter((e=>e.chartWidget.hasModel())).map((e=>e.chartWidget.model()));e.chartModels.setValue(i)}),!0),a}function ri(e){e.hiddenInLayout.setValue(!0);const t=e.container.value()
;t.parentNode&&t.parentNode.removeChild(t),e.fullscreen.setValue(!1)}function ni(e,t,i){const r=(0,s.ensureNotNull)(e.chartWidget);r.onZoom().unsubscribeAll(i),r.onScroll().unsubscribeAll(i),r.withModel(null,(()=>{const e=r.lineToolsSynchronizer();null!==e&&(e.hasChanges().unsubscribe(t.recalcHasChanges),t.recalcHasChanges())}))}function oi(e,t){e.chartWidgetsDefs.forEach((i=>{ni(i,e,t)}))}function ai(e,t){const i=e.actualLayoutCount();for(let s=i;s{const r=(0,s.ensureNotNull)(i.chartWidget);r.onZoom().subscribe(t,(t=>e.onZoom.fire(t))),r.onScroll().subscribe(t,(()=>e.onScroll.fire())),r.withModel(null,(()=>{const t=r.lineToolsSynchronizer();null!==t&&(t.hasChanges().subscribe(e.recalcHasChanges),e.recalcHasChanges())}))}))}async function ci(e){var t,i;const r=this.innerState();(e=r.checkProFeature(e))in se.layouts||(e="s"),oi(r,this);const n=r.layoutType,o=se.layouts[e].count;(0,re.emit)("layout_about_to_be_changed",e),(null!==(t=r.splitters.value())&&void 0!==t?t:[]).forEach(((e,t)=>{e.splitterElement.remove(),e.mouseHandler.destroy()})),r.splitters.setValue([]);const a=se.layouts[e];r.layoutTemplate.setValue(a);const l=null!==(i=r.allLayoutSizesState.get(a.layoutType))&&void 0!==i?i:(0,ae.layoutInitialSizingState)(a.expression);r.allLayoutSizesState.set(a.layoutType,l),r.sizingState.setValue(l);const c=r.maximizedChartDef.value();n!==e&&r.maximizedChartDef.value()&&r.maximizedChartDef.setValue(null),c&&r.activeChartWidget.setValue((0,s.ensureNotNull)(c.chartWidget));for(let e=0;e=o;if(t=r.maximizedChartDef.value()?r.maximizedChartDef.value()===i:e1),i.fullscreen.setValue(r.maximizedChartDef.value()===i),i.collapsed.setValue(n)}else i&&(ri(i),i.collapsed.setValue(n))}r.sizingState.setValue(l),Jt(r),r.layoutWV.setValue(e),r.setLayoutType(e),r.updateWatchedValue(),function(e){const t=e.layoutTemplate.value().count;e.inlineChartsCount.setValue(t),e.globalDetachable.setValue(t>1)}(r),r.checkAllPendingModelsAlreadyCreated(),li(r,this),r.inlineChartsCount.value()<1&&o>0&&r.chartWidgetsDefs[o-1].rdState.bridge().attach()}function hi(e,t,i,s,r){const n=e.actualLayoutCount();return e.chartWidgetsDefs.slice(0,n).filter((e=>e.rdState.bridge().visible.value())).map((e=>e.chartWidget)).filter((t=>t.id()!==i&&(!!t.hasModel()&&(s||e.crosshairLockRaw)))).forEach((e=>e.model().model().setExternalPosition(t,r))),!0}function di(e,t,i,s,r){if(hi(e,t,i,s,r)){const i=e.crossHairSyncBroadcast;if(i){
const e={type:"crosshair",payload:{point:t,envState:r,sourceUniqueId:i.uniqueId}};i.channel.postMessage(e)}}}function ui(e){const t=new BroadcastChannel("ChartWidgetsCollection");return t.onmessage=t=>{const i=t.data,s=e();if(s.crossHairSyncBroadcast&&"crosshair"===i.type)s.crossHairSyncBroadcast.uniqueId!==i.payload.sourceUniqueId&&hi(s,i.payload.point,null,!1,i.payload.envState)},{channel:t,uniqueId:(0,ie.randomHashN)(6)}}function pi(e){var t;null===(t=e.crossHairSyncBroadcast)||void 0===t||t.channel.close()}function _i(e,t,i){if(!e.combinedTrackTimeLock.value()||e.dateRangeLock.value())return;const s=e.layoutTemplate.value().count;e.undoHistory.beginUndoMacro(mt),e.chartWidgetsDefs.slice(0,s).filter((e=>e.chartWidget.hasModel()&&e.chartWidget.model().model()!==i)).forEach((e=>{const i=e.chartWidget.model().model(),s=i.mainSeries().syncModel();s&&i.syncTimeWithModel(s.syncSourceTarget(),t)})),e.undoHistory.endUndoMacro(),(0,re.emit)("sync_time",t)}function mi(e){return Promise.all(e.map((e=>{const t=e.model().mainSeries();return t.symbolResolvingActive().value()?d(t.dataEvents().symbolResolved()).promise:t.symbolInfo()})))}function gi(e){return e.chartWidgetsDefs.every((e=>e.chartWidget.hasModel()))?Promise.resolve(e.chartWidgetsDefs.map((e=>e.chartWidget))):Promise.all(e.chartWidgetsDefs.map((e=>e.chartWidget.hasModel()||d(e.chartWidget.modelCreated()).promise))).then((()=>gi(e)))}function fi(e,t){var i;if((0,h.enabled)("charting_library_base"))return t;if("s"===t||e.widgetOptions.containsData||e.readOnly||isProductFeatureEnabled("MULTIPLE_CHARTS")&&(0,s.ensure)(null===(i=getProductFeatureConfig("MULTIPLE_CHARTS"))||void 0===i?void 0:i.limit)>=se.layouts[t].count)return t;return"s"}async function vi(e,t,i){return i=fi(e,i),e.layoutWV.value()!==i&&(e.undoHistory.pushUndoCommand(new ue(t,i)),!0)}async function yi(e,t,i){const{theme:s,onlyActiveChart:r,restoreNonThemeDefaults:n,themeName:o,standardTheme:a,syncState:l=!0,noUndo:c}=i,h=(0,V.getCurrentTheme)().name;let d;r?d=[e.activeChartWidget.value()]:(oi(e,t),await Promise.all(e.savedChartWidgetOptions.map(((i,s)=>new Promise((i=>{ri(si(e,t,s,i))}))))),d=e.chartWidgetsDefs.map((e=>e.chartWidget)),li(e,t)),c?(a&&new nt(h,o,l).redo(),d.forEach((e=>{e.model().model().restoreTheme(s,n,c)}))):(e.undoHistory.beginUndoMacro(vt),a&&e.undoHistory.pushUndoCommand(new nt(h,o,l)),d.forEach((e=>{e.model().model().restoreTheme(s,n)})),e.undoHistory.endUndoMacro()),await Promise.all(d.map((e=>e.model().model().colorStudiesPropertiesReady())))}function Si(e,t){e.symbolLock.setValue(t)}function bi(e,t){const{internalSymbolLock:i,activeChartWidget:s,undoHistory:r,dateRangeLock:n,loadingContent:o,linkingGroupsCharts:l,chartWidgetsDefs:c}=e;if(t!==i.value())if(o)i.setValue(t);else{if(e.undoHistory.beginUndoMacro(yt),t){const t=s.value();c.map((e=>e.chartWidget));l.forEach(((i,s)=>{const r=(t.linkingGroupIndex().value(),t);if(void 0!==r){(0,a.muteLinkingGroup)(s,!0);for(const t of i.value())t!==r&&t.symbolWV().value()!==r.symbolWV().value()&&(t.setSymbol(r.symbolWV().value()),
n.value()&&e.subscribeToCompletedEventForDateRangeSync(t,!0));(0,a.muteLinkingGroup)(s,!1)}}))}r.setWatchedValue(i,t,yt),r.endUndoMacro()}}function wi(e,t){e.intervalLock.setValue(t)}function Ci(e,t){const{internalIntervalLock:i,activeChartWidget:s,undoHistory:r,dateRangeLock:n,loadingContent:o,chartWidgetsDefs:l,linkingGroupsCharts:c}=e;if(t!==i.value())if(o)i.setValue(t);else{if(r.beginUndoMacro(St),t&&t){const t=s.value();l.map((e=>e.chartWidget));c.forEach(((i,s)=>{const r=(t.linkingGroupIndex().value(),t);if(void 0!==r){(0,a.muteLinkingGroup)(s,!0);for(const t of i.value())t!==r&&t.resolutionWV().value()!==r.resolutionWV().value()&&(t.setResolution(r.resolutionWV().value()),n.value()&&e.subscribeToCompletedEventForDateRangeSync(t,!0));(0,a.muteLinkingGroup)(s,!1)}}))}r.setWatchedValue(i,t,St),r.endUndoMacro()}}function Pi(e,t){const i=e.activeChartWidget.value();if(i&&i.hasModel()){const s=i.model();t?(e.subscribeToEventsForDateRangeSync(s),e.syncChartsDateRangesWithActiveChartRange()):e.unsubscribeFromEventsForDateRangeSync(s)}e.dateRangeLock.setValue(t)}function xi(e,t){const{internalDateRangeLock:i,undoHistory:s,loadingContent:r}=e;r?i.setValue(t):s.setWatchedValue(i,t,bt)}function Ti(e,t){e.trackTimeLock.setValue(t)}function Ii(e,t){const{internalTrackTimeLock:i,undoHistory:s,loadingContent:r}=e;r?i.setValue(t):s.setWatchedValue(i,t,wt)}function Mi(e,t,i){e.symbolLock.value()?Ai(e,t,i):e.activeChartWidget.value().setSymbol(t)}function Ai(e,t,i){const s=e.activeChartWidget.value();void 0===i&&(i=s.linkingGroupIndex().value());for(const i of e.chartWidgetsDefs){const e=i.chartWidget;(e.hasModel()?e.model().mainSeries().symbolSameAsResolved(t):e.symbolWV().value()===t)||e.setSymbol(t)}}async function Li(e,t=this.activeChartWidget.value()){return!!t&&(function(e,t){const i=e.model(),s=i.mainSeries().properties().childs().style;i.setChartStyleProperty(s,t,Ct)}(t,e),!0)}function ki(e){return(e.intervalLock.value()?e.chartWidgetsDefs.map((e=>e.chartWidget)):[e.activeChartWidget.value()]).filter((e=>e.hasModel()))}async function Di(e,t,i,s){return!(e.flags.loadingChart||e.flags.setTimeFrameActive||e.flags.setNewResolution)&&(function(e,t,i,s){(0,ct.setLastUsedResolution)(t),e.flags.setNewResolution=!0,s=null!=s?s:e.activeChartWidget.value(),void 0===i&&(i=s.linkingGroupIndex().value());if(e.intervalLock.value())for(const i of e.chartWidgetsDefs){const e=i.chartWidget;e.resolutionWV().value()!==t&&e.setResolution(t)}else s.setResolution(t);e.flags.setNewResolution=!1}(e,t,i,s),!0)}function Ei(e){return new u.WatchedValue(null).spawn()}function Vi(e){return[null]}function Bi(e){const t=new lt.WatchedObject((e.chartWidgetsDefs,[null])),i=()=>{t.setValue((e.chartWidgetsDefs,[null]))};e.chartWidgetsDefs.forEach((e=>e.chartWidget.linkingGroupIndex().subscribe(i)));const s=e=>{e.linkingGroupIndex().subscribe(i),i()};return e.chartWidgetCreatedDelegate.subscribe(null,s),t.spawn((()=>{e.chartWidgetsDefs.forEach((e=>e.chartWidget.linkingGroupIndex().unsubscribe(i))),e.chartWidgetCreatedDelegate.unsubscribe(null,s)}))}
function Ri(e,t){t=null;let i=e.linkingGroupsCharts.get(t);return void 0===i&&(i=new lt.WatchedObject([],O.compareTwoCollectionsByIds),e.linkingGroupsCharts.set(t,i)),i}function Ni(e){var t;const i=new Map;for(const t of e.chartWidgetsDefs){const e=null;let s=i.get(e);void 0===s&&(s=[],i.set(e,s)),s.push(t.chartWidget)}for(const s of(0,O.join)(new Set(e.linkingGroupsCharts.keys()),new Set(i.keys())))Ri(e,s).setValue(null!==(t=i.get(s))&&void 0!==t?t:[])}function Oi(e){0}function Fi(e,t){return new u.WatchedValue(!1).spawn()}function Wi(e,t,i){return(0,ot.combine)(((e,t)=>e||t),t.weakReference(),Fi().ownership())}function Hi(e,t,i){const s=t.id();if(e.chartWidgetIdToCompletedCallbackMap.has(s))return;const r=()=>{e.chartWidgetIdToCompletedCallbackMap.has(s)&&(e.chartWidgetIdToCompletedCallbackMap.delete(s),Ki(e,i?t:void 0))};t.model().mainSeries().dataEvents().completed().subscribe(null,r,!0),e.chartWidgetIdToCompletedCallbackMap.set(s,{cw:t,callback:r})}function zi(e){Ki(e)}const Ui=new Map;function ji(e){var t;const i=null!==(t=Ui.get(e.id()))&&void 0!==t?t:{};return Ui.set(e.id(),i),i}function Gi(e,t){t.timeScale().visibleBarsStrictRangeChanged().subscribe(ji(t),zi.bind(null,e))}function qi(e,t){t.timeScale().visibleBarsStrictRangeChanged().unsubscribeAll(ji(t)),e.chartWidgetIdToCompletedCallbackMap.forEach((e=>{const t=e.cw,i=e.callback;t.model().mainSeries().dataEvents().completed().unsubscribe(null,i)})),e.chartWidgetIdToCompletedCallbackMap.clear()}function $i(e,t,i){e.model().model().gotoTimeRange(t,i),(0,re.emit)("sync_date_range",t,i)}function Ki(e,t){if(!e.dateRangeLock.value()||null!==e.currentLayoutResizeAction.value())return;const i=e.activeChartWidget.value(),r=i.model().mainSeries();if(!(0,D.isTimeBasedStyle)(r.style()))return;const n=i.model().timeScale(),o=n.visibleBarsStrictRange();if(null===o)return;const a=(0,s.ensureNotNull)(n.points().range().value());let l=n.indexToTimePoint(o.firstBar());null===l&&r.endOfData()&&(l=n.indexToTimePoint(a.firstIndex));let c=n.indexToTimePoint(o.lastBar());if(null===c&&(c=n.indexToTimePoint(a.lastIndex)),null===l||null===c)return void Hi(e,i,!1);e.chartWidgetIdToCompletedCallbackMap.delete(i.id());let h=1e3*l,d=1e3*c;if(r.isDWM()){const e=new Date(h),t=new Date(d);(0,k.set_hms)(e,0,0,0,0),(0,k.set_hms)(t,0,0,0,0),h=e.getTime(),d=t.getTime()}for(let s=0;s(e[t]=i,e)),{});return{name:this.metaInfo.name.value(),layout:t?"s":s.layoutType,charts:o,symbolLock:Zi(s.symbolLock),intervalLock:Zi(s.intervalLock),trackTimeLock:Zi(s.trackTimeLock),
dateRangeLock:Zi(s.dateRangeLock),crosshairLock:Zi(s.crosshairLock),layoutsSizes:a,studyMetaInfoMap:undefined}}function Zi(e){return e.value()?1:0}function Xi(e){dt.StudyMetaInfo.mergeDefaultsOverrides(e),(0,ht.studyMetaInfoRepository)().isReady()&&dt.StudyMetaInfo.overrideDefaults((0,ht.studyMetaInfoRepository)().getInternalMetaInfoArray())}},15938:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CHART_FONT_FAMILY:()=>n,CHART_MONOSPACE_FONT_FAMILY:()=>o,setChartFontFamily:()=>r});const s="'Trebuchet MS', Roboto, Ubuntu, sans-serif";function r(e){n=e}let n=`-apple-system, BlinkMacSystemFont, ${s}`;const o="monospace"},79754:(e,t,i)=>{"use strict";var s=i(78954).splitSymbolName,r=i(45126).TranslatedString,n=i(50151).assert,o=i(56570),a=i(26023).TabNames,l=i(68335),c=i(67317).Study,h=i(21239).StudyStub,d=i(72708).isStudy,u=i(29875).LineDataSource,p=i(630),_=p.isLineTool,m=p.isStudyLineTool,g=i(94113).STUDYPLOTDISPLAYTARGET,f=i(16638).studyMetaInfoRepository,v=i(97702).Action,y=i(33388).ACTION_ID,S=i(85049).Interval,b=i(68805),w=b.getDefaultStyle,C=b.hasVolume,P=i(63950),x=P.availableTimezones,T=P.timezoneIsAvailable,I=i(85719).lineToolsDoNotAffectChartInvalidation,M=i(51768).trackEvent,A=i(35039),L=i(52033).Delegate,k=i(31955).getLogger("ChartWidget",{color:"#606"}),D=i(19334).addPerfMark,E=i(4849).ChartWidgetBase,V=i(49483).CheckMobile.any(),B=i(82783).TIMEFRAMETYPE,R=new r("change timezone",i.i18next(null,void 0,i(20137))),N=new r("unlock {title}",i.i18next(null,void 0,i(12525))),O=new r("lock {title}",i.i18next(null,void 0,i(76104)));e.exports.ChartWidget=class extends E{constructor(e,t,i){super(e,t,i),this._options.timeScaleWidget&&(this._options.timeScaleWidget.pressedMouseMoveScale=this._options.handleScale.axisPressedMouseMove.time);var s=this,r=this._options.content,n=this._options.readOnly;this._removeMaximizeHotkey=null;var o=this._options.containsData,a=this._options.onWidget,l=this._options.onCmeWidget;l&&k.logWarn("[ChartWidget] 'onCmeWidget' option is depricated");var c=this._options.widgetCustomer,h=this._options.timezone,d=this._options.hideSymbolSearch,u=this._options.defSymbol,p=S.isValid(this._options.defInterval)?this._options.defInterval:void 0,_=parseInt(this._options.defStyle),m=b.isValidStyle(_)?_:void 0,g=this._options.defSessionId,f=void 0!==this._options.defTimeframe?"string"==typeof this._options.defTimeframe?{value:this._options.defTimeframe.toUpperCase(),type:B.PeriodBack}:{...this._options.defTimeframe,type:B.TimeRange}:void 0;this._content=r,this._initialLoading=this._options.initialLoading,this._readOnly=n,this._containsData=o,this._defSymbol=u,this._defInterval=p,this._defTimeframe=f,this._defStyle=m,this._onWidget=!!a,this._compareSymbols=this._options.compareSymbols,this._onWidget&&(l?this._widgetCustomer="cme":c&&(this._widgetCustomer=c)),this._hideSymbolSearch=d,this._frameTime=30,this._model=null,this._metaInfo={},this._drawRafId=0,this._compareDialog=this._chartWidgetCollection.getCompareDialogRenderer();var v=this._contentSeriesProperties();v&&(u=v.symbol,p=v.interval),
void 0===this._options.useUserChartPreferences&&(this._options.useUserChartPreferences=!0);var y="chartproperties.mainSeriesProperties",C=this._options.useUserChartPreferences?A.defaults(y):A.factoryDefaults(y);this._properties.mainSeriesProperties.merge(C),this._properties.mainSeriesProperties.hasChild("esdBreaksStyle")&&this._properties.mainSeriesProperties.removeProperty("esdBreaksStyle"),p=p||C.interval||"D",b.isValidStyle(m)||(m=b.isValidStyle(C.style)?C.style:w(S.isRange(p))),this._properties.mainSeriesProperties.merge({visible:!0,symbol:u||DEFAULT_SYMBOL,shortName:"",timeframe:"",onWidget:this._onWidget,interval:p,currencyId:null,unitId:null,style:m,sessionId:g}),this._symbolWV.setValue(this.getSymbol()),this._resolutionWV.setValue(this.getResolution()),this._containsData&&this._properties.mainSeriesProperties.merge({showCountdown:!1}),h&&T(h)&&this._properties.timezone.setValue(h),this._tagsChanged=new L,this._timingsMeter=null,this._options.container.subscribe((function(e){s._setElement(e)}),{callWithLast:!0});var P=function(){s.resize()};this._options.width.subscribe(P),this._options.height.subscribe(P),this._options.visible.subscribe(this._updateTimingsMeterState.bind(this)),this._aboutToBeDestroyed=new L,this._definitionsViewModel=null,this._backgroundTopColorSpawn=null,this._backgroundBottomColorSpawn=null}isInitialized(){return Boolean(this._inited)}compareSymbols(){return this._compareSymbols}async _getChartPropertyDefinitionsViewModel(){if(null===this._definitionsViewModel){const{ChartPropertyDefinitionsViewModel:e}=await Promise.all([i.e(1184),i.e(8278),i.e(4482),i.e(3596)]).then(i.bind(i,61857));if(this._isDestroyed)throw new Error("Chart widget already destroyed");await new Promise((e=>this.withModel(null,e))),null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this.model(),this.properties(),this._options))}return this._definitionsViewModel}_initMaximizeHotkey(e){var t=this;function i(e){e.defaultPrevented||l.modifiersFromEvent(e)===l.Modifiers.Alt&&e.stopPropagation()}function s(e){e.defaultPrevented||l.modifiersFromEvent(e)===l.Modifiers.Alt&&(e.preventDefault(),e.stopPropagation(),t.toggleFullscreen())}return e.addEventListener("mousedown",i,!0),e.addEventListener("click",s,!0),function(){e.removeEventListener("mousedown",i,!0),e.removeEventListener("click",s,!0)}}toggleFullscreen(){var e=this.getResizerDetacher();e.fullscreenable.value()&&(e.fullscreen.value()?e.exitFullscreen():e.requestFullscreen())}setTimezone(e){e&&T(e)?this._properties.timezone.setValue(e):console.warn("Incorrect timezone: "+JSON.stringify(e))}getTimezone(){return this._properties.timezone.value()}refreshMarks(){this.model().barsMarksSources().forEach((function(e){e.refreshData()}))}clearMarks(e){this.model().barsMarksSources().forEach((function(t){t.clearMarks(e)}))}_initBackgroundColor(){null===this._backgroundTopColorSpawn&&(this._backgroundTopColorSpawn=this._model.model().backgroundTopColor().spawn(),this._backgroundTopColorSpawn.subscribe(this._onBackgroundColorChanged.bind(this))),
null===this._backgroundBottomColorSpawn&&(this._backgroundBottomColorSpawn=this._model.model().backgroundColor().spawn(),this._backgroundBottomColorSpawn.subscribe(this._onBackgroundColorChanged.bind(this)))}paneWidgets(){return this._paneWidgets}paneByCanvas(e){for(var t=0;t0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state}containsVolume(){return this.model().dataSources().some((function(e){return e instanceof c&&"Volume"===e.metaInfo().shortId}))}containsStudyByPredicate(e){return!!this._model&&this._model.dataSources().some((function(t){if(!(t instanceof c))return!1;var i=t.metaInfo();return e(i)}))}containsStudy(e){return this.containsStudyByPredicate((function(t){return t.id===e||t.fullId===e}))}isSmall(){return this._width()<550||this._height()<300}onWidget(){return this._onWidget}onCmeWidget(){return"cme"===this.widgetCustomer()}widgetCustomer(){return this._widgetCustomer}resize(){var e=this._height()+"px",t=this._width()+"px";this._mainDiv.style.height=e,this._mainDiv.style.width=t,this._elMainTable.style.height=e,this._elMainTable.style.width=t,this._resizeHandler&&this._mainDiv&&this._resizeHandler()}showReplayOrderConfirmationDialog(){
if(!this.model().isInReplay().value())return Promise.resolve()}_addPerfMark(e){D("ChartWidget."+this._id+"."+e)}getResizerDetacher(){return this._options}}},68122:(e,t,i)=>{"use strict";const{clone:s}=i(37265);var r=i(50151).assert,n=i(68993).layouts,o=i(55902).createUndoHistory,a=i(928),l=i(4741),c=i(68335),h=i(76422),d=i(56570),u=i(91676).WatchedObject,p=i(64147).WatchedValue,_=i(31955).getLogger("Chart.ChartWidgetCollection"),m=i(14729).preventDefaultForContextMenu,g=i(5171),f=i(13323).GeneralChartPropertiesRenderer,v=i(42120).CompareDialogRenderer,y=i(84015).isOnMobileAppPage,S=i(52033).Delegate;const{isSupportedLayout:b,tryGuessingTheMostSuitableLayout:w}=i(68993);var C,P=i(35474).AriaChartDescription;const x=i(92184).randomHash;var T=i(29250),I=T.applyIndicatorsToAllChartsImpl,M=T.applyIndicatorToAllChartsImpl,A=T.lineToolsAndGroupsDTOsImpl,L=T.resetLineToolsInvalidatedImpl,k=T.applyLineToolUpdateNotificationImpl,D=T.createClipboardHandler,E=T.chartsSymbolsImpl,V=T.updateLayoutImpl,B=T.computeContentBoxImpl,R=(T.getVisuallyAdjacentDefImpl,T.setLayoutImpl),N=T.removeChartWidgetSubscriptionsImpl,O=T.generateNewChartId,F=T.syncCrosshairImpl,W=T.createBroadcastChannel,H=T.destroyBroadcastChannel,z=T.syncScrollImpl,U=T.allInitialModelsCreated,j=T.allInitialSymbolsResolved,G=T.applyThemeImpl,q=T.handleDateRangeLockChange,$=T.handleInternalDateRangeLockChange,K=T.handleTrackTimeLockChange,Y=T.handleInternalTrackTimeLockChange,Z=T.handleIntervalLockChange,X=T.handleInternalIntervalLockChange,J=T.handleSymbolLockChange,Q=T.handleInternalSymbolLockChange,ee=(T.handleConnectionLimitReachedChanged,T.createLeftBottomChartWidgetWV),te=T.subscribeToEventsForDateRangeSync,ie=T.unsubscribeFromEventsForDateRangeSync,se=T.syncChartsDateRangesWithActiveChartRange,re=T.subscribeToCompletedEventForDateRangeUpdate,ne=T.resetLayoutSizesImpl,oe=T.unloadUnusedChartsImpl,ae=T.applyStudiesOverrides,le=new Map,ce={saveChartEnabled:!0,takeScreenshotEnabled:!0,publishedChartsEnabled:!0};e.exports=function(e){var t=this,he=Object.assign({},ce,e),de=new p,ue=he.readOnly||!1,pe=x(),_e=[],me=0,ge=new p,fe=new p,ve=new p,ye="s",Se=new p(null),be=new Map,we=new p([]),Ce=new p,Pe=[];const xe={isConfirmationAboutReplayLocked:!1,loadingChart:!1,setTimeFrameActive:!1,setNewResolution:!1};var Te=!1,Ie=!1,Me=new p(!1),Ae=new p(null),Le=new p(!1),ke=new p(!1);ke.subscribe((e=>J(yt(),e)));var De=new p(ke.value());De.subscribe((e=>Q(yt(),e)));var Ee=new p(!1);Ee.subscribe((e=>Z(yt(),e)));var Ve=new p(Ee.value());Ve.subscribe((e=>X(yt(),e)));var Be=new p(ye),Re=new p(!1);Re.subscribe((e=>K(yt(),e)));var Ne=T.combinedTrackTimeLock(Be,Re,_e);Re.subscribe((e=>K(yt(),e)));var Oe=new p(Ne.value());Oe.subscribe((e=>Y(yt(),e)));var Fe=new p(!1);Fe.subscribe((e=>q(yt(),e))),Se.subscribe(zt);var We=new p(Fe.value());We.subscribe((e=>$(yt(),e)));var He=new p(TVSettings.getBool("chart.syncCrosshair",!0)),ze=l.createGroup({desc:"Layout"}),Ue=null,je=null,Ge=null,qe=null;if(window.TVD){var $e=window.TVD.crosshairSyncEnabled;$e?($e.value()&&(Ge=W(yt)),
qe=$e.subscribe((e=>{e?Ge=W(yt):(H(yt()),Ge=null)}))):Ge=W(yt)}var Ke=He.value();He.subscribe((function(e){Ke=e=!!e,TVSettings.setValue("chart.syncCrosshair",e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().lightUpdate()}}));var Ye=he.resizerBridge.width,Ze=he.resizerBridge.height,Xe=new p(null),Je=new p(null);Xe.subscribe((e=>{Je.setValue(null===e?null:e.chartWidget)}));var Qe=he.widgetOptions||{},et=he.metaInfo||{},tt={id:new p(et.id||null),name:new p(et.name),description:new p(et.description),username:new p(et.username),uid:new p(et.uid),lastModified:new p(et.lastModified)},it=o();it.onChange().subscribe(null,(function(e){h.emit("undo_redo_state_changed",e)}));var st=he.resizerBridge.container.value();st.addEventListener("contextmenu",m);var rt,nt=new S,ot=new S,at=new S,lt=new p(!1),ct=new p(null),ht=null,dt=null;he.seriesControlBarEnabled&&(rt="0px",ct.setValue(document.createElement("div")),ct.value().style.left=rt,ct.value().style.right=rt,ct.value().style.bottom=rt,ct.value().classList.add("chart-toolbar","chart-controls-bar"),ct.value().setAttribute("data-is-chart-toolbar-component","true"),st.appendChild(ct.value()),Promise.all([i.e(6822),i.e(3060),i.e(2603),i.e(5514),i.e(7811),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(5546),i.e(8073),i.e(6107),i.e(3762),i.e(8732),i.e(1227),i.e(302),i.e(2227),i.e(361),i.e(5075),i.e(7260)]).then(i.bind(i,68426)).then((({BottomToolbarRenderer:e})=>{var i=he.resizerBridge,s=[i.container.spawn(),i.width.spawn(),i.height.spawn()],r=i.container.value(),n=function(){var e=r.getBoundingClientRect(),t=B(yt());return t.top=e.top+t.top,t.left=e.left+t.left,t},o=new S,a=function(){o.fire()};s.forEach((function(e){e.subscribe(a)}));var l=function(){s.forEach((function(e){e.destroy()})),o.destroy()};ht=new e(ct.value(),o,n,t,ChartApiInstance,Qe,he.seriesControlBar),dt=function(){null!==ht&&(ht.destroy(),ht=null,ct.value().remove(),ct.setValue(null)),l()}})));var ut=new f(t),pt=new v(t);function _t(){lt.setValue(_e.some((e=>{const t=e.chartWidget.lineToolsSynchronizer();return null!==t&&t.hasChanges().value()})))}function mt(e){return T.checkProFeatureImpl(yt(),e)}Ae.subscribe((()=>wt()));const gt=new Map,ft=()=>T.updateLinkingGroupCharts(yt()),vt=new u([]);function yt(){return{undoHistory:it,chartWidgetsDefs:_e,chartsCountToSave:St,actualLayoutCount:bt,savedChartWidgetOptions:Pe,activeChartWidget:de,options:he,parent:st,toastsFactory:null,crosshairLockRaw:Ke,crossHairSyncBroadcast:Ge,setChartStorageNotificationSubscription:e=>{je=e},maximizedChartDef:Xe,setMaximized:It,layoutTemplate:ve,widthWV:Ye,heightWV:Ze,checkProFeature:mt,lineToolsSynchronizerHasChanges:lt,recalcHasChanges:_t,onZoom:ot,onScroll:at,layoutType:ye,layoutWV:Be,setLayoutType:e=>{ye=e},isPhoneSize:Me,viewMode:Ce,updateViewMode:At,loadingContent:Te,setLoadingContent:e=>{Te=e},initialLoading:Ie,inlineChartsCount:fe,updateWatchedValue:Lt,checkAllPendingModelsAlreadyCreated:Mt,readOnly:ue,symbolLock:ke,internalSymbolLock:De,intervalLock:Ee,internalIntervalLock:Ve,dateRangeLock:We,
internalDateRangeLock:We,trackTimeLock:Re,internalTrackTimeLock:Oe,crosshairLock:He,customLegendWidgetsFactoriesMap:Xt,globalDetachable:ge,saveChartService:Ue,customSources:Yt,updateActivityView:kt,chartWidgetCreatedDelegate:nt,sizingState:Ae,currentLayoutResizeAction:Se,allLayoutSizesState:be,splitters:we,widgetOptions:Qe,bottomToolbar:ct,replayContainer:Zt,layoutSizesChanged:Le,subscribeToCompletedEventForDateRangeSync:(e,t)=>re(yt(),e,t),subscribeToEventsForDateRangeSync:e=>te(yt(),e),unsubscribeFromEventsForDateRangeSync:e=>ie(yt(),e),syncChartsDateRangesWithActiveChartRange:e=>se(yt(),e),combinedTrackTimeLock:Ne,chartWidgetIdToCompletedCallbackMap:le,flags:xe,linkingGroupsCharts:gt,chartModels:vt,updateLinkingGroupCharts:ft}}function St(){return bt()}function bt(){return n[ye].count}function wt(){V(yt())}Ye.subscribe(wt),Ze.subscribe(wt),this.updateLayout=wt;const Ct=T.activeLinkingGroupWV(de),Pt=T.allLinkingGroupsWV(yt());function xt(e){return e.rdState.owner.value()!==e}function Tt(e){return R.call(t,e)}function It(e){Xe.value()!==e&&(Xe.setValue(e),Tt(ye))}function Mt(){_e.every((e=>e.chartWidget.hasModel()))&&(Lt(),h.emit("layout_changed"))}function At(){"s"===ye||Xe.value()?Ce.setValue(C.ForceFullscreen):Ce.setValue(C.Multichart)}function Lt(){var e=Math.min(ve.value().count,_e.length)-1;if(e<0)de.deleteValue();else{var t=me;t<0&&(t=0),t>e&&(t=e),de.setValue(_e[t].chartWidget)}}function kt(){for(var e=_e.length;e--;){var t=e===me;_e[e].container.value().classList.toggle("active",t),_e[e].container.value().classList.toggle("inactive",!t)}}function Dt(e){{const t=ri().indexOf(e);P.getInstance().updateChartDescription(e,t,ye)}}function Et(e){Dt(de.value())}const Vt=new S;var Bt=new S,Rt=new p,Nt=new p([]),Ot=null;function Ft(e){var t=e.mainSeries().properties();t.style.subscribe(null,Wt),Wt(t.style),e.model().onSelectedSourceChanged().subscribe(null,Ht),Fe.value()&&(te(yt(),e),se(yt())),Ht(e.selection().allSources())}function Wt(e){Rt.setValue(e.value())}function Ht(){var e=Ot.model();Nt.setValue(e.selection().allSources())}function zt(e){Fe.value()&&null===e&&se(yt())}de.subscribe((function(e){if(e){for(var t,i=_e.length;i--;)if(_e[i].chartWidget===e){t=i;break}if(!isFinite(t))throw new Error("Cannot make detached ChartWidget active");if(me!==t){Xe.value()&&(xt(_e[t])||Xe.setValue(_e[t])),me=t,kt();for(i=_e.length;i--;)_e[i].chartWidget!==e&&_e[i].chartWidget.setActive(!1);ai(),e.setActive(!0),a.activePointSelectionMode.setValue(e.selectPointMode().value())}!function(e){if(Ot!==e){if(Ot&&(Ot.modelCreated().unsubscribe(null,Ft),Ot.hasModel())){var t=Ot.model();Fe.value()&&ie(yt(),t),t.mainSeries().properties().style.unsubscribe(null,Wt),t.model().onSelectedSourceChanged().unsubscribe(null,Ht),Ot=null}e&&(Ot=e,e.hasModel()?Ft(e.model()):e.modelCreated().subscribe(null,Ft))}}(e)}}),{callWithLast:!0});var Ut=new S;function jt(){he.resizerBridge.requestFullscreen()}function Gt(){he.resizerBridge.exitFullscreen()}function qt(){return he.resizerBridge.fullscreenable}function $t(){return he.resizerBridge.fullscreen}
function Kt(e){if(0!==_e.length){for(var t=_e.length;t--;)_e[t].chartWidget.setActive(!1);_e[me].chartWidget.setActive(e)}}ue||(ze.add({desc:"Switch active chart",hotkey:d.enabled("accessible_keyboard_shortcuts")?c.Modifiers.Shift+39:9,handler:function(){Et()}}),ze.add({desc:"Switch active chart",hotkey:d.enabled("accessible_keyboard_shortcuts")?c.Modifiers.Shift+37:c.Modifiers.Shift+9,handler:function(){Et()}})),ze.add({desc:"Fullscreen mode",hotkey:c.Modifiers.Shift+70,isDisabled:d.enabled("widget")||!qt().value(),handler:function(){$t().value()?Gt():jt()}}),he.takeScreenshotEnabled&&(ze.add({desc:"Screenshot server",hotkey:c.Modifiers.Alt+83,handler:T.takeServerScreenshot.bind(this,he.snapshotUrl,t)}),y("any")||(ze.add({desc:"Download client screenshot",hotkey:c.Modifiers.Mod+c.Modifiers.Alt+83,handler:T.downloadScreenshot.bind(this,t)}),ze.add({desc:"Copy client screenshot",hotkey:c.Modifiers.Mod+c.Modifiers.Shift+83,handler:T.copyScreenshotToClipboard.bind(this,t)}))),he.saveChartEnabled&&ze.add({desc:"Save Chart Layout",hotkey:c.Modifiers.Mod+83,handler:function(){Bt.fire()}});var Yt=new Map,Zt=null,Xt=new Map;const Jt=D(yt());he.globalEvents&&Jt.listen();const Qt=ke.spawn(),ei=Ee.spawn(),ti=Fe.spawn(),ii=Re.spawn(),si=He.spawn(),ri=()=>_e.map((e=>e.chartWidget)),ni=ee(ri,Be.readonly(),Vt,nt);function oi(e,t){if(Te=!0,Ie=Boolean(t),Pe.splice(0),e){if(e.charts||(e={layout:"s",charts:[e]}),e.layoutsSizes)for(const t of Object.keys(e.layoutsSizes))be.set(t,e.layoutsSizes[t]);var i=new Set;e.charts.forEach((function(e){e.chartId&&i.add(e.chartId)})),e.charts.forEach((function(e){if(!e.chartId){var t=O((function(e){return i.has(e)}));i.add(t),e.chartId=t}}));let t=e.layout;if(!b(t)){const e=w(t);_.logError(`Loading unsupported layout ${t}. Force migration to ${e}`),t=e}ye=mt(t||"s");for(const t of e.charts)e.studyMetaInfoMap&&t.panes.forEach((t=>{t.sources.forEach((t=>{"string"==typeof t.metaInfo&&(t.metaInfo=s(e.studyMetaInfoMap[t.metaInfo]))}))})),Pe.push({content:t});void 0!==e.symbolLock&&ke.setValue(Boolean(e.symbolLock)),void 0!==e.intervalLock&&Ee.setValue(Boolean(e.intervalLock)),void 0!==e.trackTimeLock&&Re.setValue(Boolean(e.trackTimeLock)),void 0!==e.dateRangeLock&&Fe.setValue(Boolean(e.dateRangeLock)),void 0!==e.crosshairLock&&He.setValue(Boolean(e.crosshairLock))}Tt(ye),a.init(),a.tool.subscribe(li),a.tool.subscribe(ai),Te=!1,Ie=!1}function ai(){var e=de.value();_e.forEach((function(t){t.chartWidget!==e&&t.chartWidget.updateCrossHairPositionIfNeeded()})),e&&e.updateCrossHairPositionIfNeeded()}function li(){_e.forEach((function(e){e.chartWidget.onToolChanged()}))}Object.assign(this,{innerState:yt,getAll:ri,maximizedChartWidget:()=>Je.readonly(),leftBottomChartWidget:()=>ni,activeLinkingGroup:()=>Ct,allLinkingGroups:()=>Pt,linkingGroupsCharts:e=>T.getLinkingGroupCharts(yt(),e).readonly(),destroy:function(){if(Ut.fire(),Kt(!1),null!==dt&&(dt(),dt=null),N(yt()),Qt.destroy(),ei.destroy(),ii.destroy(),ti.destroy(),Ne.destroy(),si.destroy(),Se.unsubscribe(zt),_e.forEach((function(e){
void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.linkingGroupIndex().unsubscribe(ft),e.chartWidget.destroy()})),he.resizerBridge.remove(),we.value().forEach((e=>{e.mouseHandler.destroy(),e.mouseListener.destroy()})),window.removeEventListener("resize",wt),a.tool.unsubscribe(ai),a.tool.unsubscribe(li),st.remove(),Yt.clear(),Xt.clear(),ze.destroy(),je&&je.destroy(),Jt&&Jt.destroy(),Ct.destroy(),Pt.destroy(),window.TVD){const e=window.TVD.crosshairSyncEnabled;e&&e.unsubscribe(qe),H(yt())}ni.destroy(),!0},onAboutToBeDestroyed:Ut,layout:Be.readonly(),setLayout:Tt,activeChartWidget:de,viewMode:Ce,activeChartStyle:Rt.readonly(),setChartStyleToWidget:T.setChartStyleToWidget.bind(this),selectedSources:Nt.readonly(),metaInfo:tt,state:function(e,i,s,r,n){return T.stateImpl.call(t,{withData:e,skipLineToolsFromOtherSymbols:i,wipeSensitiveData:s,skipLineTools:r,addOnlyActiveChart:n})},lineToolsAndGroupsDTOs:function(){return A(yt())},resetLineToolsInvalidated:function(e,t){return L(yt(),e,t)},applyLineToolUpdateNotification:k.bind(null,_e),readOnly:function(){return ue},onZoom:function(){return ot},onScroll:function(){return at},resizerBridge:function(){return he.resizerBridge},lock:{symbol:Qt,interval:ei,dateRange:ti,crosshair:si,trackTime:ii},setSymbol:(e,t)=>T.setSymbol(yt(),e,t),setSymbolAll:(e,t)=>T.setSymbolAll(yt(),e,t),setResolution:(e,t,i)=>T.setResolution(yt(),e,t,i),setTimeFrame:function(e){xe.loadingChart||xe.setTimeFrameActive||(xe.setTimeFrameActive=!0,Ee.value()?_e.forEach((function(t){t.chartWidget.loadRange(e)})):de.value().loadRange(e),xe.setTimeFrameActive=!1)},updateLayout:wt,setChartLayoutWithUndo:function(e){return T.setChartLayoutWithUndoImpl(yt(),this,e)},images:T.getSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),clientSnapshot:T.getClientSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),tags:function(){for(var e=[],t=0;t<_e.length&&tF(yt(),e,t,i,s),syncScroll:function(e,t){return z(yt(),e,t)},clearChartMetaInfo:function(){tt.id.setValue(null),tt.uid.setValue(void 0),tt.name.setValue(void 0)},takeScreenshot:T.takeScreenshot.bind(this,he.snapshotUrl,this),takeServerScreenshot:T.takeServerScreenshot.bind(this,he.snapshotUrl,this),loadContent:oi,purgeUnusedWidgets:function(){for(var e=n[ye].count;e<_e.length;e++)_e[e].chartWidget.destroy();_e.splice(n[ye].count)},applyOverrides:function(e){for(var t=0;t<_e.length;t++)_e[t].chartWidget.applyOverrides(e)},applyStudiesOverrides:ae,switchChart:Et,startFullscreen:jt,exitFullscreen:Gt,fullscreen:$t,fullscreenable:qt,chartWidgetCreated:function(){return nt},saveKeysPressed:function(){return Bt},getContainer:function(){return st},onWidget:Qe.onWidget,applyTheme:function(e){return G(yt(),t,e)},applyIndicatorsToAllCharts:function(e){I(yt(),e)},
applyIndicatorsToAllChartsAvailable:function(){return!ue&&bt()>1},applyIndicatorToAllCharts:async function(e,t,i,s){await M(yt(),e,t,i,s)},setActive:Kt,inlineChartsCount:fe.readonly(),revertToInline:function(){It(null);for(var e=0;e<_e.length;e++)_e[e].rdState.bridge().attach()},chartMarketStatuses:function(){return _e.map((function(e){return"-"}))},chartSeriesStatuses:function(){return _e.map((function(e){var t=e.chartWidget.hasModel()?e.chartWidget.model().mainSeries().status():null;return(null===t?"":g.SERIES_STATUS_TEXT[t])+" ("+t+")"}))},undoHistory:it,lineToolsSynchronizerHasChanges:lt,applyPreferencesToAllCharts:function(e){},getToasts:function(){return Promise.resolve(null)},addCustomSource:function(e,t,i){r(!Yt.has(e),"Cannot create the same custom source multiple times"),Yt.set(e,{factory:t,layer:i});for(var s=0;s<_e.length;++s){var n=_e[s].chartWidget;n.hasModel()&&n.model().model().addCustomSource(e,t,i)}},removeCustomSource:function(e){r(Yt.has(e),"Cannot remove not created custom source"),Yt.delete(e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().removeCustomSource(e)}},addCustomWidgetToLegend:function(e,t){r(!Xt.has(e),"Cannot create the same custom widget in legend multiple times"),Xt.set(e,t);for(var i=0;i<_e.length;++i)_e[i].chartWidget.addCustomWidgetToLegend(e,t)},addReplayWidget:function(e){r(null===Zt,"Cannot create replay container multiple times"),(Zt=document.createElement("div")).style.position="absolute",Zt.style["min-height"]="51px",Zt.style.overflow="hidden",Zt.style.left="0px",Zt.style.right="0px";var t=null===ct.value()?0:ct.value().offsetHeight;Zt.style.bottom=`${t}px`,Zt.setAttribute("data-is-chart-toolbar-component","true"),st.prepend(Zt),e(Zt,(()=>wt())),wt()},destroyReplayWidget:function(){r(null!==Zt,"Cannot remove replay container, container is not created"),Zt.remove(),Zt=null,wt()},setViewMode:function(e){Ce.setValue(e)},moveActiveChartWithUndo:function(e){},activeChartCanBeMoved:function(){return!1},generalPropertiesDefinitions:function(){return de.value().generalPropertiesDefinitions()},reconnectChartApi:function(e){undefined(e)},setBroker:function(e){0},setSaveChartService:function(e){Ue=e;for(var t=0;t<_e.length;++t){_e[t].chartWidget.setSaveChartService(e)}},getCompareDialogRenderer:function(){return pt},getChartPropertiesDialogRenderer:function(){return ut},clipboard:Jt,chartsSymbols:function(){return E(yt())},resetLayoutSizes:ne.bind(null,yt()),unloadUnusedCharts:oe.bind(null,yt()),layoutSizesChanged:()=>Le,clientId:pe,ariaDescribeChart:Dt,chartModels:()=>vt.readonly()}),oi(he.content,!0),Be.subscribe((function(){kt()})),Be.hook=function(e){return e===this.value()?e:mt(e)},ue&&(Be.writeLock=!0),window.addEventListener("resize",wt);var ci=0;function hi(){0===--ci&&h.emitOnce("onChartReady")}_e.forEach((function(e){if(e){ci++;var t=e.chartWidget;t.withModel(null,(function(){he.metaInfo&&t.model().model().setChartSaveTime(1e3*he.metaInfo.lastModified);var e=t.model().mainSeries();if(e.bars().size()>0||e.isFailed())hi();else{
var i=e.dataEvents(),s=function(){hi(),i.barReceived().unsubscribe(null,s),i.completed().unsubscribe(null,s),i.error().unsubscribe(null,s),i.unsupportedResolutionRequested().unsubscribe(null,s)};i.barReceived().subscribe(null,s),i.completed().subscribe(null,s),i.error().subscribe(null,s),i.unsupportedResolutionRequested().subscribe(null,s)}}))}})),U(yt()).then(j).then((function(){window.saver&&window.is_authenticated&&he.widgetOptions.justCloned&&window.saver.saveChartSilently()})).catch(_.logError.bind(_))}},40443:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,r=i(29981),n=i(97702),o=i(59064);!function(e){let t=null,s=null;const a=[],l={createAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:e}),createAsyncAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:{},optionsLoader:e}),createSeparator:()=>new n.Separator};async function c(e,n={},o={menuName:""},c){null!==t&&(e=await t(e,l,o));let d=null;const u=()=>{const e=(0,r.indexOf)(a,(e=>e.renderer===d));-1!==e&&a.splice(e,1),void 0!==c&&c()};let p=!1;if(null!==s&&(d=await s(e,o,u)),d)p=!0,h();else{const t=await Promise.all([i.e(4109),i.e(2603),i.e(7769),i.e(5666),i.e(4632),i.e(8432),i.e(8073),i.e(8732),i.e(1335),i.e(2227),i.e(2157),i.e(1584)]).then(i.bind(i,11785));d=new t.ContextMenuRenderer(e,n,u,h)}return a.push({renderer:d,isExternal:p}),d}function h(){(0,o.globalCloseMenu)(),a.forEach((e=>{e.isExternal&&e.renderer.isShown()&&e.renderer.hide()}))}e.createMenu=c,e.showMenu=function(e,t,i={},s,r){return c(e,i,s,r).then((e=>e.show(t)))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=h,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{DialogRenderer:()=>r});var s=i(64147);class r{constructor(){this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1),this._rootInstance=null}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},26023:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},9726:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>o});var s=i(72894);let r=null,n=null;function o(){return n}function a(){
null===n&&(n=Promise.all([i.e(1595),i.e(3060),i.e(2603),i.e(5514),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(55),i.e(5666),i.e(4632),i.e(8432),i.e(8073),i.e(6107),i.e(3645),i.e(8732),i.e(1227),i.e(1335),i.e(5877),i.e(1538),i.e(2227),i.e(361),i.e(1890),i.e(2157),i.e(3504),i.e(2306)]).then(i.bind(i,17815)).then((({FavoriteDrawingToolbar:e})=>(r=null!==r?r:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),r))))}},776:(e,t,i)=>{"use strict";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})},96152:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>o});const s=["Z","Y","X","W","V","U","T","S"],r=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){return null!==e&&this.label===e.label}}function o(e,t){const i="left"===e?s:r;return new n(t{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>s});i(16216);const s={id:"ChartWidgetCollectionService"};var r;!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(r||(r={}))},62288:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>l,defaultInvalidationLevel:()=>o});var s,r=i(50151);class n{constructor(e=o){this._paneInvalidationLevel=o,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 s="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,r=s.get(t)||o;s.set(t,Math.max(r,i))}invalidationLevelForPane(){return Math.max(this._paneInvalidationLevel,this._invalidationLevel)}legendWidgetLayoutInvalidated(){return this._legendWidgetInvalidated||this._invalidationLevel===s.Full}getterForPriceScaleInvalidationLevelBySide(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;return e=>Math.max(t.get(e)||o,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)||o;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||o;this._rightPriceScalesInvalidationMap.set(t,Math.max(i,e))})),
this._legendWidgetInvalidated=this._legendWidgetInvalidated||e._legendWidgetInvalidated}}!function(e){e[e.None=0]="None",e[e.Cursor=1]="Cursor",e[e.Light=2]="Light",e[e.Full=3]="Full"}(s||(s={}));const o=s.None;var a;!function(e){e[e.ScrollAnimation=0]="ScrollAnimation",e[e.StopAnimation=1]="StopAnimation"}(a||(a={}));class l{constructor(e=o){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeAxisInvalidationLevel=o,this._invalidatedPanes=new Map,this._additionalActions=[],this._timeScaleInvalidations=[],this._invalidationLevel=e}invalidateAll(e){this._invalidationLevel!==e&&(this._invalidationLevel=Math.max(this._invalidationLevel,e),this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})))}invalidateAllPane(e,t){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidateAll(t)}invalidatePriceScale(e,t,i,s){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e){this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e)}invalidatePanesOrder(){this._panesOrderChanged=!0}lockVisibleTimeRangeOnResize(){this._keepVisibleTimeRangeOnResize=!0}fullInvalidation(){return this._invalidationLevel}maxPaneInvalidation(){const e=[];return this._invalidatedPanes.forEach((t=>{e.push(t.fullInvalidation())})),Math.max(...e,this._invalidationLevel)}invalidateForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidateForTimeScale(){return Math.max(this._timeAxisInvalidationLevel,this._invalidationLevel)}validationActions(){return this._additionalActions}addValidationAction(e){this._additionalActions.push(e)}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._panesOrderChanged=this._panesOrderChanged||e._panesOrderChanged,this._keepVisibleTimeRangeOnResize=this._keepVisibleTimeRangeOnResize||e._keepVisibleTimeRangeOnResize,this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})),e._invalidatedPanes.forEach(((e,t)=>{this._invalidatedPanes.has(t)||this._invalidatedPanes.set(t,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)})),this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e._timeAxisInvalidationLevel);for(let t=0;t0===e.type));if(-1!==i){const[s]=this._timeScaleInvalidations.splice(i,1);null===(t=(e=s.value).onFinish)||void 0===t||t.call(e,!1)}}}},69186:(e,t,i)=>{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>r,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(49483).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function r(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},65952:(e,t,i)=>{"use strict";i.d(t,{layoutInitialSizingState:()=>n});var s=i(3308);i(50151);function r(e){return e.map((t=>{if((0,s.default)(t))return{percent:1/e.length};{const i=t.slice(1);return{percent:1/e.length,substate:r(i)}}}))}function n(e){return r(e.slice(1))}},68993:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMultipleLayout:()=>o,isSingleLayout:()=>n,isSupportedLayout:()=>a,layouts:()=>r,tryGuessingTheMostSuitableLayout:()=>l});i(87489),i(65952);let s;s={};const r={...{s:{title:"1 chart",count:1,layoutType:"s",sizer:(e,t)=>{if(0!==t)throw new RangeError("invalid index");return e},splitters:()=>[],resizeApplier:(e,t,i,s,r)=>r,syncSublayoutsBySplitter:(e,t)=>t,expression:["h",0]}},...s};function n(e){return"s"===e}function o(e){return!n(e)}function a(e){return n(e)||s.hasOwnProperty(e)}function l(e){return"s"}},17402:(e,t,i)=>{"use strict";i.d(t,{lineToolsSelectHotkeys:()=>r});i(21251);var s=i(68335);const r={LineToolFibRetracement:{hash:s.Modifiers.Alt+70,action:"setTool",description:"Draw Fib Retracement"},LineToolHorzLine:{hash:s.Modifiers.Alt+72,action:"drawRightThere",description:"Draw Horizontal Line here"},LineToolHorzRay:{hash:s.Modifiers.Alt+74,action:"drawRightThere",description:"Draw Horizontal Ray here"},LineToolRectangle:{hash:s.Modifiers.Alt+s.Modifiers.Shift+82,action:"setTool",description:"Draw Rectangle"},LineToolTrendLine:{hash:s.Modifiers.Alt+84,action:"setTool",description:"Draw Trend Line"},LineToolVertLine:{hash:s.Modifiers.Alt+86,action:"drawRightThere",description:"Draw Vertical Line here"},LineToolCrossLine:{hash:s.Modifiers.Alt+67,action:"drawRightThere",description:"Draw Cross Line here"}}},35236:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>g,defaultPreventedHandler:()=>_,ignoreClickOrTapOnDblClickOrDblTapHandlers:()=>m,isTouchMouseEvent:()=>p});var s=i(95171),r=i(50151),n=i(49483),o=i(37265),a=i(80007),l=i(69186);const c=n.isSafari?"click":"auxclick";var h,d;!function(e){
e[e.ResetClick=500]="ResetClick",e[e.LongTap=240]="LongTap",e[e.PreventFiresTouchEvents=500]="PreventFiresTouchEvents"}(h||(h={})),function(e){e[e.CancelClickManhattanDistance=5]="CancelClickManhattanDistance",e[e.CancelTapManhattanDistance=5]="CancelTapManhattanDistance",e[e.DoubleClickManhattanDistance=5]="DoubleClickManhattanDistance",e[e.DoubleTapManhattanDistance=30]="DoubleTapManhattanDistance"}(d||(d={}));const u={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function p(e){return"isTouch"in e&&"stylus"in e}function _(e){return t=>{t.preventDefault(),e(t)}}function m(e){let t=!1;return{clickOrTap:(...i)=>{t=!1,setTimeout((()=>!t&&e.clickOrTap(...i)),501)},doubleClickOrDoubleTap:(...i)=>{var s;t=!0,null===(s=e.doubleClickOrDoubleTap)||void 0===s||s.call(e,...i)}}}class g{constructor(e,t,i){if(this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._pinchInfo=null,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!n.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=e=>{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handlers.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._options=(0,o.merge)((0,o.clone)(u),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){if(t.mouseClickEvent&&t.mouseDoubleClickEvent){const e=m({clickOrTap:t.mouseClickEvent.bind(t),doubleClickOrDoubleTap:t.mouseDoubleClickEvent.bind(t)});t.mouseClickEvent=e.clickOrTap,t.mouseDoubleClickEvent=e.doubleClickOrDoubleTap}if(t.tapEvent&&t.doubleTapEvent){const e=m({clickOrTap:t.tapEvent.bind(t),doubleClickOrDoubleTap:t.doubleTapEvent.bind(t)});t.tapEvent=e.clickOrTap,t.doubleTapEvent=e.doubleClickOrDoubleTap}}this._handlers=t,this._init()}destroy(){
null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=b(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=S(e),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(v(t),(0,r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:o}=i;if(this._touchMoveExceededManhattanDistance||!(o<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=n>=e&&!this._options.treatVertTouchDragAsPageScroll,i=e>n&&!this._options.treatHorzTouchDragAsPageScroll;t||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.touchMoveEvent),(0,a.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(v(e),(0,r.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.pressedMouseMoveEvent)}}
_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=b(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=S(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handlers.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(v(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handlers.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handlers.tapEvent),this._handlers.tapEvent&&(0,a.preventDefault)(e));0===this._tapCount&&(0,a.preventDefault)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,a.preventDefault)(e))}_touchCancelHandler(e){this._touchEndHandler(e)}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),n.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handlers.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handlers.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return this._clearLongTapTimeout(),void this._resetTapTimeout();const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=S(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=v(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),240)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handlers.touchStartEvent),
this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=v(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;n.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=v(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=v(e))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._touchCancelHandler.bind(this));{const e=this._target.ownerDocument,t=e=>!e.target||!this._target.contains(e.target),i=e=>{if(!t(e))return;const i=e.changedTouches[0];this._lastTouchEventTimeStamp=S(e),this._processTouchEvent(this._makeCompatEvent(e,i),this._handlers.touchStartOutsideEvent)},s=e=>{t(e)&&!this._firesTouchEvents(e)&&this._processMouseEvent(this._makeCompatEvent(e),this._handlers.mouseDownOutsideEvent)};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",s)},e.addEventListener("mousedown",s),e.addEventListener("touchstart",i,{passive:!0})}n.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),(0,a.preventScrollByWheelClick)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(c,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(()=>{}),{passive:!1})}_initPinch(){void 0===this._handlers.pinchStartEvent&&void 0===this._handlers.pinchEvent&&void 0===this._handlers.pinchEndEvent||(this._target.addEventListener("touchstart",(e=>this._checkPinchState(e.touches)),{passive:!0}),this._target.addEventListener("touchmove",(e=>{if(null===this._pinchInfo)return;const t=b(e.touches,(0,
r.ensureNotNull)(this._activeTouchId)),i=b(e.touches,this._pinchInfo.secondTouchId);if(t&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:s,startPinchMiddlePoint:r}=this._pinchInfo,n=y(t,i)/s,o=f(this._target);this._handlers.pinchEvent(r,{x:t.clientX-o.left,y:t.clientY-o.top},{x:i.clientX-o.left,y:i.clientY-o.top},n),(0,a.preventDefault)(e)}}),{passive:!1}),this._target.addEventListener("touchend",(e=>{this._checkPinchState(e.touches)})))}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){if(void 0!==this._handlers.pinchStartEvent&&null===this._pinchInfo){const t=f(this._target);let i,s;e[0].identifier===this._activeTouchId?(i=e[0],s=e[1]):(i=e[1],s=e[0]);const r={x:i.clientX-t.left,y:i.clientY-t.top},n={x:s.clientX-t.left,y:s.clientY-t.top},o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};this._handlers.pinchStartEvent(o,r,n,{bothPointsOnTargetElement:this._target.contains(s.target)})&&(this._pinchInfo={startPinchDistance:y(i,s),startPinchMiddlePoint:o,secondTouchId:s.identifier})}this._clearLongTapTimeout()}_stopPinch(){var e,t;null!==this._pinchInfo&&(this._pinchInfo=null,null===(t=(e=this._handlers).pinchEndEvent)||void 0===t||t.call(e))}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseLeaveEvent),this._acceptMouseLeave=!n.CheckMobile.iOS()}_longTapHandler(e){const t=b(e.touches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.longTapEvent),this._processTouchEvent(i,this._handlers.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if((0,a.preventDefault)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:S(e)this._target.getBoundingClientRect()||{left:0,top:0}));return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,get localX(){return i.clientX-r().left},get localY(){return i.clientY-r().top},ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,isTouch:!e.type.startsWith("mouse")&&"contextmenu"!==e.type&&"click"!==e.type,stylus:"stylus"===(null==t?void 0:t.touchType),srcType:e.type,target:i.target,view:e.view,preventDefault:()=>{"touchstart"!==e.type&&(0,
a.preventDefault)(e)}}}}function f(e){return e.getBoundingClientRect()||{left:0,top:0}}function v(e){return{x:e.pageX,y:e.pageY}}function y(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function S(e){return e.timeStamp||performance.now()}function b(e,t){for(let i=0;i{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,navigationButtonsVisibilityKey:()=>r,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(17656);const r="NavigationButtons.visibility",{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(r)},51613:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(17656),r=i(60859);const{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",r.navigationButtonsVisibilityKey)},65388:(e,t,i)=>{"use strict";i.d(t,{isCustomStudy:()=>r});const s={VbPFixed:!0,PivotPointsStandard:!0,VbPVisible:!0,VbPAnchored:!0};function r(e){return e in s}},28388:(e,t,i)=>{"use strict";i.d(t,{MetaInfoHelper:()=>u});var s=i(50151),r=i(68159),n=i(94113),o=i(37265),a=i(31955),l=i(65383);function c(e){return!e.groupId&&!e.isHidden&&e.id!==l.RangeDependentStudyInputNames.FirstBar&&e.id!==l.RangeDependentStudyInputNames.LastBar}var h=i(65388);const d=(0,a.getLogger)("Platform.GUI.PropertyDialog.Indicators.MetaInfo");class u{constructor(e){this._metaInfo=e}hasUserEditableInputs(){return this._metaInfo.inputs.some(c)}getUserEditableInputs(){return this._metaInfo.inputs.filter(c)}hasUserEditableProperties(){return r.StudyMetaInfo.isScriptStrategy(this._metaInfo)}hasUserEditableStyles(){const e=this._metaInfo;return e.plots.length>0||void 0!==e.bands||void 0!==e.filledAreas||(0,h.isCustomStudy)(e.shortId)||r.StudyMetaInfo.isScriptStrategy(this._metaInfo)||Object.values(e.graphics).some((e=>void 0!==e))}getUserEditablePlots(){const e=new Set,t=this._metaInfo;return t.plots.filter((i=>{if((0,n.isColorerPlot)(i)||(0,n.isTextColorerPlot)(i)||(0,n.isDataOffsetPlot)(i)||(0,n.isOhlcColorerPlot)(i)||(0,n.isAlertConditionPlot)(i)||(0,n.isDataPlot)(i))return!1;if((0,n.isOhlcPlot)(i)){const r=i.target;if(e.has(r))return!1;e.add(r);const n=(0,s.ensureDefined)(t.ohlcPlots);return!(0,s.ensureDefined)(n[r]).isHidden}{const e=t.styles?t.styles[i.id]:void 0;return void 0===e||!e.isHidden}}))}hasUserEditableOptions(){return this.hasUserEditableInputs()||this.hasUserEditableProperties()||this.hasUserEditableStyles()}getStrategyProperties(){const e=this._metaInfo,t=e.inputs.filter(_),i={...p};for(const s of t){const t=s.internalID;i[t]=s,p.hasOwnProperty(t)||d.logWarn(`Unknown strategy input internal id ${t} in ${e.fullId}`)}return(0,o.clone)(i)}}const p={currency:void 0,backtest_fill_limits_assumption:void 0,calc_on_every_tick:void 0,calc_on_order_fills:void 0,commission_value:void 0,commission_type:void 0,
initial_capital:void 0,pyramiding:void 0,slippage:void 0,default_qty_type:void 0,default_qty_value:void 0,margin_long:void 0,margin_short:void 0,use_bar_magnifier:void 0,process_orders_on_close:void 0,fill_orders_on_standard_ohlc:void 0};function _(e){return"strategy_props"===e.groupId}},59063:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>r,CommonJsonStoreService:()=>n});var s=i(52033);class r{constructor(e,t,i,r,n){this._onChange=new s.Delegate,this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=r,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)}set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class n extends r{_serialize(e){return e}_deserialize(e){return e}}},38119:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(64147);const r="#9598a1",n=!1,o=null,a='';class l{constructor(e){this._visible=new s.WatchedValue(n),this._tooltip=new s.WatchedValue(o),this._icon=new s.WatchedValue(a),this._color=new s.WatchedValue(r),this._tooltipContent=new s.WatchedValue(null),this._symbol=e}symbol(){return this._symbol}tooltip(){return this._tooltip}icon(){return this._icon}color(){return this._color}visible(){return this._visible}tooltipContent(){return this._tooltipContent}}class c{constructor(){this._symbolCustomStatuses=new Map}getSymbolCustomStatus(e){if(this._symbolCustomStatuses.has(e))return this._symbolCustomStatuses.get(e);const t=new l(e);return this._symbolCustomStatuses.set(e,t),t}hideAll(){for(const e of this._symbolCustomStatuses.values())e.visible().setValue(!1)}static getInstance(){return null===this._instance&&(this._instance=new c),this._instance}}c._instance=null},30141:(e,t,i)=>{"use strict";i.d(t,{restoreShowMarketOpenStatusProperty:()=>l,showMarketOpenStatusProperty:()=>a});var s=i(17625),r=i(56840);const n="Chart.ShowMarketOpenStatus";function o(){return r.getBool(n,true)}const a=(0,s.createPrimitiveProperty)(o());function l(){a.setValue(true),r.remove(n)}r.onSync.subscribe(null,(()=>a.setValue(o()))),a.subscribe(null,(()=>r.setValue(n,a.value())))},90823:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>u});var s,r=i(50151),n=i(64147),o=i(88960),a=i(68805),l=i(69748),c=i(2740);function h(e){return window.ChartApiInstance.serverTime()/1e3-e}
function d(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}!function(e){e.Open="market",e.Pre="pre_market",e.Post="post_market",e.Close="out_of_session",e.Holiday="holiday",e.Delisted="delisted",e.Expired="expired"}(s||(s={}));class u{constructor(e){var t,i;this._currentSession=new n.WatchedValue(null),this._delistedByTypespecs=new n.WatchedValue(!1),this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new n.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._delay=0,this._futuresContractExpirationTime=null,this._quotesProvider=e,this._marketStatus=(0,o.combine)(((e,t,i)=>null===e?e:t?"delisted":i?"expired":function(e){switch(e){case"market":return"market";case"pre_market":return"pre_market";case"post_market":return"post_market";case"out_of_session":return"out_of_session";case"holiday":return"holiday"}(0,r.ensureNever)(e)}(e)),this._currentSession.weakReference(),this._delistedByTypespecs.weakReference(),(null!==(i=null===(t=this._futuresContractExpirationTime)||void 0===t?void 0:t.expired())&&void 0!==i?i:new n.WatchedValue(!1)).weakReference()),e.quotesUpdate().subscribe(this,(e=>{var t;this._currentSession.setValue(null!==(t=null==e?void 0:e.values.current_session)&&void 0!==t?t:null)})),e.quoteSymbolChanged().subscribe(this,(()=>{this._currentSession.setValue(null)}))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId),this._marketStatus.destroy()}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){var t,i,s,r,n;if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);this._delay=(0,a.getSymbolDelaySeconds)(e);const o=new l.SessionSpec(e.timezone,null!==(t=e.session_display)&&void 0!==t?t:e.session,e.session_holidays,e.corrections);let c,h;const d=null===(i=e.subsessions)||void 0===i?void 0:i.find((e=>"premarket"===e.id)),u=null===(s=e.subsessions)||void 0===s?void 0:s.find((e=>"postmarket"===e.id));void 0!==d&&(c=new l.SessionSpec(e.timezone,null!==(r=d["session-display"])&&void 0!==r?r:d.session,e.session_holidays,d["session-correction"])),void 0!==u&&(h=new l.SessionSpec(e.timezone,null!==(n=u["session-display"])&&void 0!==n?n:u.session,e.session_holidays,u["session-correction"])),this._sessionsSpec={general:o,preMarket:c,postMarket:h},this._recalculateNextSessionEdge()}status(){return this._marketStatus}currentSession(){return this._currentSession}nextSessionEdge(){return this._nextSessionEdge}_getNextSessionEdgeInternal(){var e;if(null===this._sessionsSpec||"24x7"===this._sessionsSpec.general.spec())return null;const t=1e3*h(this._delay);if(null===this._nextSessionEdgeInternal||(null!==(e=this._nextSessionEdgeInternal.timestamp)&&void 0!==e?e:1/0)<=t/1e3){const{general:e,preMarket:i,postMarket:s}=this._sessionsSpec,r=(0,c.get_timezone)(e.timezone()),n=(0,c.utc_to_cal)(r,t),o=d((0,
c.cal_to_utc)(r,e.alignToNearestSessionStart(n,1)),(0,c.cal_to_utc)(r,e.alignToNearestSessionEnd(n,1)),t),a=d(void 0!==i?(0,c.cal_to_utc)(r,i.alignToNearestSessionStart(n,1)):1/0,void 0!==i?(0,c.cal_to_utc)(r,i.alignToNearestSessionEnd(n,1)):1/0,t),l=d(void 0!==s?(0,c.cal_to_utc)(r,s.alignToNearestSessionStart(n,1)):1/0,void 0!==s?(0,c.cal_to_utc)(r,s.alignToNearestSessionEnd(n,1)):1/0,t);let u=Math.min(o,a,l);if(u===1/0){const t=h(this._delay),i=6e4,s=new Date(Math.round(new Date(1e3*t).getTime()/i)*i).getTime()+i,n=(0,c.utc_to_cal)(r,s),o=d((0,c.cal_to_utc)(r,e.alignToNearestSessionStart(n,1)),(0,c.cal_to_utc)(r,e.alignToNearestSessionEnd(n,1)),s),p=Math.min(o,a,l);p!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=p):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===l?{timestamp:u,status:"post_market"}:u===a?{timestamp:u,status:"pre_market"}:{timestamp:u}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-h(this._delay))};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},22118:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>l,firstReplacedByBatsExchange:()=>c,isDelay:()=>d,isEod:()=>h,witoutRealtime:()=>u});i(50151);var s=i(13665),r=i.n(s);const n=["DJ","JSE","BELEX"],o=["NZX"],a=["BIVA"],l=["AMEX","NASDAQ","NYSE"];function c(e){return null}function h(e,t){return r().hasEodSymbols(e.full_name)||6===t}function d(e){return void 0!==e&&e>0}function u(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&o.includes(e.listed_exchange)||a.includes(e.listed_exchange)}},76032:(e,t,i)=>{"use strict";i.d(t,{getStudyTemplateDescString:()=>a,getStudyTemplateMetaInfo:()=>n,getStudyTemplateSaveData:()=>o});var s=i(19466),r=i(72708);function n(e,t){return{indicators:e.orderedDataSources(!0).filter((e=>(0,r.isStudy)(e)&&!0)).map((e=>({id:e.metaInfo().id,description:e.title(s.TitleDisplayTarget.StatusLine,!0,void 0,!0)}))),interval:t}}function o(e,t,i,s){const r=t.studyTemplate(i,s);return{name:e,content:JSON.stringify(r),meta_info:n(t,r.interval)}}function a(e){const t=new Map;return e.forEach((e=>{const[i,s]=t.get(e.id)||[e.description,0];t.set(e.id,[i,s+1])})),Array.from(t.values()).map((([e,t])=>`${e}${t>1?` x ${t}`:""}`)).join(", ")}},79652:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>r,globalKeypressMatches:()=>n});var s=i(56570);function r(){let e=!1;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1
;const t=e.target;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},50340:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(359),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(5546),i.e(3114),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(2227),i.e(3443),i.e(6014),i.e(361),i.e(2079),i.e(3098),i.e(2751),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},79320:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(16216);const r={id:"TradingService"};function n(){return(0,s.hasService)(r)?(0,s.service)(r):null}},31601:(e,t,i)=>{"use strict";i.d(t,{TradingViewApiBase:()=>Re});var s=i(50151),r=i(82992),n=i(76422),o=i(56570),a=i(40443),l=i(68993),c=i(51768),h=i(85662),d=i(45345),u=i(52033);class p{constructor(e){this._toolbarThemeChanged=new u.Delegate,this._onWatchedThemeChanged=e=>{this._toolbarThemeChanged.fire(e)},this._opts=e,d.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){d.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every((e=>(0,h.isStdTheme)((0,h.extractThemeFromModel)(e.model()))));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,h.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,d.setTheme)(e),t&&(0,h.syncTheme)()}getCurrentThemeName(){return(0,h.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}var _=i(4711),m=i(928),g=i(64147),f=i(55917),v=i(630),y=i(19888),S=i.t(y,2);const b=new u.Delegate;var w=i(11542),C=i(45126),P=i(85049),x=i(78749),T=i(14381),I=i(9447);class M{constructor(e){this._timeScale=e}coordinateToTime(e){const t=this._timeScale.coordinateToIndex(e);return this._timeScale.indexToTimePoint(t)}barSpacingChanged(){return this._timeScale.barSpacingChanged()}rightOffsetChanged(){return this._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){return this._timeScale.barSpacing()}rightOffset(){return this._timeScale.rightOffset()}width(){return this._timeScale.width()}defaultRightOffset(){return this._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){return this._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){return this._timeScale.usePercentageRightOffset().spawn()}isEmpty(){return this._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){return this._timeScale.points().size()}}var A=i(63950);const L=new C.TranslatedString("change timezone",w.t(null,void 0,i(20137)));class k{constructor(e){this._onTimezoneChanged=new u.Delegate,this._chartWidget=e,this._timezoneProperty=e.properties().childs().timezone,this._timezoneProperty.subscribe(this,(e=>{this._onTimezoneChanged.fire(e.value())})),
e.onAboutToBeDestroyed().subscribe(this,(()=>{this._timezoneProperty.unsubscribeAll(this)}),!0)}availableTimezones(){return A.availableTimezones}getTimezone(){const e=this._timezoneProperty.value();return(0,s.ensureDefined)(this.availableTimezones().find((t=>t.id===e)))}setTimezone(e,t){(0,s.assert)((0,A.timezoneIsAvailable)(e),`Incorrect timezone: ${e}`),(null==t?void 0:t.disableUndo)?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,L)}onTimezoneChanged(){return this._onTimezoneChanged}}class D{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){const e=this._priceScale.properties().childs();return e.percentage.value()?2:e.indexedTo100.value()?3:e.log.value()?1:0}setMode(e){this._priceScale.setMode({percentage:2===e,log:1===e,indexedTo100:3===e})}isInverted(){return this._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){return this._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){return this._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){return this._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){return this._priceScale.hasMainSeries()}getStudies(){return this._priceScale.getStudies().map((e=>e.id()))}currency(){const e=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);return null===t?null:{readOnly:t.readOnly,selectedCurrency:t.selectedCurrency,originalCurrencies:Array.from(t.originalCurrencies),currencies:e.getItems()}}setCurrency(e){var t;const i=null===(t=this.currency())||void 0===t?void 0:t.currencies;i&&e&&!i.includes(e)?console.warn("The provided currency is not supported by your datafeed!"):this._chartUndoModel.setPriceScaleCurrency(this._priceScale,e)}unit(){const e=this._chartModel.availableUnits(),t=this._priceScale.unit(e);return null===t?null:{readOnly:0===t.availableGroups.size,selectedUnit:t.selectedUnit,originalUnits:Array.from(t.originalUnits),availableGroups:Array.from(t.availableGroups)}}setUnit(e){!e||this._chartModel.availableUnits().unitGroupById(e)?this._chartUndoModel.setPriceScaleUnit(this._priceScale,e):console.warn("The provided unit is not supported by your datafeed!")}coordinateToPrice(e){var t;const i=null===(t=this._priceScale.mainSource())||void 0===t?void 0:t.firstValue();return null==i?null:this._priceScale.coordinateToPrice(e,i)}measureUnitId(){const e=this._priceScale.measureUnitId(this._chartModel.availableUnits());return null===e?null:{selectedMeasureUnitId:e.selectedMeasureUnitId}}}var E=i(72708);function V(e){return{id:e.id(),name:(t=e.toolname,Object.keys(_.supportedLineTools).find((e=>_.supportedLineTools[e].name===t))||null)};var t}function B(e){return{id:e.id(),name:e.metaInfo().description}}var R=i(37265),N=i(60265);const O=new C.TranslatedString("change pane height",w.t(null,void 0,i(14691)))
;class F extends N.UndoCommand{constructor(e,t,i){super(O),this._model=e,this._paneIndex=t,this._paneHeight=i,this._prevStretchFactors=this._model.panes().map((e=>e.stretchFactor()))}redo(){this._model.changePanesHeight(this._paneIndex,this._paneHeight)}undo(){const e=this._model.panes();for(let t=0;t!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){return t===e.mainSeries()?{id:e.mainSeries().id(),name:"Main Series"}:(0,E.isStudy)(t)?B(t):(0,v.isLineTool)(t)?V(t):null}(e,t))).filter(R.notNull).filter((e=>null!==e.name))}getHeight(){return this._pane.height()}setHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,s.assert)(i.length>1,"Unable to change pane's height if there is only one pane");const r=i.indexOf(this._pane);(0,s.assert)(-1!==r,"Invalid pane index");const n=new F(t,r,e);this._chartWidget.model().undoHistory().pushUndoCommand(n)}moveTo(e){const t=this.paneIndex();t!==e&&((0,s.assert)(e>=0&&e{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this)})),this._study.onStatusChanged().subscribe(this,(e=>{switch(e.type){case Z.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case Z.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return(0,X.getStudyInputsInfo)(this._study.metaInfo())}getInputValues(){const e=this._study.inputs({symbolsForChartApi:!1,asObject:!0});return Object.keys(e).map((t=>{const i=e[t];return{id:t,value:(0,R.isObject)(i)?i.v:i}}))}getStyleInfo(){return(0,J.getStudyStylesInfo)(this._study.metaInfo())}getStyleValues(){const{styles:e,bands:t,filledAreas:i,palettes:s,graphics:r,ohlcPlots:n,filledAreasStyle:o}=this._study.properties().state();return{styles:e,bands:t,filledAreas:i,palettes:s,graphics:r,ohlcPlots:n,filledAreasStyle:o}}setInputValues(e){const t=this.getInputValues();for(const i of e){void 0!==t.find((e=>e.id===i.id))?this._study.properties().childs().inputs.childs()[i.id].setValue(i.value):console.warn(`There is no such input: "${i.id}"`)}}mergeUp(){this._model.isMergeUpAvailableForSource(this._study)&&new G.MergeUpUndoCommand(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new G.MergeDownUndoCommand(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new j.UnmergeUpUndoCommand(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new j.UnmergeDownUndoCommand(this._model,this._study,null).redo()}onDataLoaded(){return this._onStudyCompleted}onStudyError(){return this._onStudyError}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._study)&&this._undoModel.mergeSourceUp(this._study)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._study)&&this._undoModel.mergeSourceDown(this._study)}unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceUp(this._study)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceDown(this._study)}priceScale(){return new D(this._undoModel,(0,s.ensureNotNull)(this._study.priceScale()))}symbolSource(){const e=(0,s.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){return this._study.currency()}changePriceScale(e){const t=(0,s.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())),i=(0,s.ensureNotNull)(this._model.paneForSource(this._study));switch(e){case"no-scale":(0,
s.assert)(i.actionNoScaleIsEnabled(this._study),"Unable to leave a pane without any non-overlay price scale"),new q.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,s.assert)(i===t,"Study should be on the main pane"),new q.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new q.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"left",null).redo();break;case"new-right":new q.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"right",null).redo();break;default:const r=this._model.dataSourceForId(e);if(null===r)throw new Error(`There is no study with entityId='${e}'`);const n=i===this._model.paneForSource(r);(0,s.assert)(n,"Both studies should be on the same pane");const o=(0,s.ensureNotNull)(r.priceScale()),a=(0,U.sourceNewCurrencyOnPinningToPriceScale)(this._study,o,this._model),l=(0,K.sourceNewUnitOnPinningToPriceScale)(this._study,o,this._model);new q.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,o,null).redo(),null!==a&&new z.SetPriceScaleCurrencyUndoCommand(this._model,o,a,null).redo(),null!==l&&new Y.SetPriceScaleUnitUndoCommand(this._model,o,l,null).redo()}}isVisible(){return this._study.properties().childs().visible.value()}setVisible(e){this._study.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._study])}sendToBack(){this._model.sendToBack([this._study])}applyOverrides(e){(0,x.applyOverridesToStudy)(this._study,e)}hasPlots(){return this._study.metaInfo().plots.length>0}dataLength(){return this._study.status().type!==Z.StudyStatusType.Completed?0:this._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){const e=this._study.status();return e.type===Z.StudyStatusType.Undefined||e.type===Z.StudyStatusType.Loading}hasPendingUnresolvedSymbols(){return this._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,Q.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){return this._study.graphicsViewsReady()}properties(){return this._study.properties()}async applyToEntireLayout(){const e=new $.ActionsProvider(this._chartWidget),t=(await e.contextMenuActionsForSources([this._study],(0,s.ensureNotNull)(this._chartWidget.model().paneForSource(this._study)))).find((e=>"applyStudyToEntireLayout"===e.id));t&&t.execute()}status(){return{...this._study.status()}}title(){return this._study.title(H.TitleDisplayTarget.StatusLine)}symbolsResolved(){return this._study.symbolsResolved()}}const te=new Map([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function ie(e){const t=te.get(e.toolname);if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function se(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}
const re=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class ne{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){return this._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){return this._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){return this._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){return this._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(){return this._source.properties().state(re,!0)}setProperties(e,t){(0,f.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,f.allowSavingDefaults)(!1)}getPoints(){let e=this._source.points();const t=ie(this._source);return e.length>t&&((0,s.assert)(se(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;const t=ie(this._source);if(t!==e.length)throw new Error(`Wrong points count. Required: ${t}, provided: ${e.length}`);const i=this._pointsConverter.apiPointsToDataSource(e);this._model.startChangingLinetool(this._source),this._model.changeLinePoints(this._source,i),this._model.endChangingLinetool(!0),this._source.createServerPoints()}getAnchoredPosition(){return this._source.positionPercents()}setAnchoredPosition(e){const t=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void 0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void 0===t||null===i||null===s)return;const r={logical:s,screen:t},n=new Map;n.set(i,e),this._model.startMovingSources([this._source],r,null,new Map),this._model.moveSources(r,n),this._model.endMovingSources(!0)}ownerSourceId(){return(0,s.ensureNotNull)(this._source.ownerSource()).id()}changePoint(e,t){if(this._source.isFixed())return;const i=this._pointsConverter.apiPointsToDataSource([e])[0];this._model.startChangingLinetool(this._source,{...i},t),this._model.changeLinePoint({...i}),this._model.endChangingLinetool(!1),this._source.createServerPoints()}isHidden(){return this._source.isSourceHidden()}getRawPoints(){return this._source.points()}setRawPoint(e,t){this._model.startChangingLinetool(this._source,{...t},e),this._model.changeLinePoint({...t}),this._model.endChangingLinetool(!1)}move(e,t){this._model.startMovingSources([this._source],{logical:e},null,new Map),this._model.moveSources({logical:t},new Map),this._model.endMovingSources(!1)}dataAndViewsReady(){return this._source.dataAndViewsReady()}zorder(){return this._source.zorder()}symbol(){return this._source.properties().symbol.value()}currency(){
return this._source.properties().currencyId.value()}unit(){return this._source.properties().unitId.value()}share(e){this._undoModel.shareLineTools([this._source],e)}setVisible(e,t=!1){this._undoModel.setProperty(this._source.properties().visible,e,null,t)}sharingMode(){return this._source.sharingMode().value()}}class oe{constructor(e,t){this._series=e,this._undoModel=t,this._model=t.model()}isUserEditEnabled(){return this._series.userEditEnabled()}setUserEditEnabled(e){this._series.setUserEditEnabled(e)}mergeUp(){this._model.isMergeUpAvailableForSource(this._series)&&new G.MergeUpUndoCommand(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&new G.MergeDownUndoCommand(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&new j.UnmergeUpUndoCommand(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&new j.UnmergeDownUndoCommand(this._model,this._series,null).redo()}detachToRight(){new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"overlay",null).redo()}changePriceScale(e){const t=(0,s.ensureNotNull)(this._model.paneForSource(this._series));switch(e){case"new-left":new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"left",null).redo();break;case"new-right":new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"right",null).redo();break;case"no-scale":(0,s.assert)(t.actionNoScaleIsEnabled(this._series),"Unable to leave a pane without any non-overlay price scale"),new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"overlay",null).redo();break;default:const i=this._model.dataSourceForId(e);if(null===i)throw new Error(`There is no study with entityId='${e}'`);const r=this._model.paneForSource(i)===t;(0,s.assert)(r,"Study should be on the main pane");const n=(0,s.ensureNotNull)(i.priceScale());new q.MoveToExistingPriceScaleUndoCommand(this._model,this._series,t,n,null).redo()}}isVisible(){return this._series.properties().childs().visible.value()}setVisible(e){this._series.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._series])}sendToBack(){this._model.sendToBack([this._series])}entityId(){return this._series.id()}chartStyleProperties(e,t){return t?this._series.properties().childs()[ae(e)].state():this._series.properties().childs()[ae(e)].state(["inputs","inputsInfo"])}setChartStyleProperties(e,t){this._series.properties().childs()[ae(e)].mergeAndFire(t)}barsCount(){return this._series.bars().size()}endOfData(){return this._series.endOfData()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}isLoading(){return this._series.isLoading()}isInReplay(){return this._series.isInReplay()}
data(){return this._series.data()}priceScale(){return new D(this._undoModel,this._series.priceScale())}seriesErrorMessage(){return this._series.seriesErrorMessage()}compositeStatusVW(){return this._series.compositeStatusVW()}_pane(){return(0,s.ensureNotNull)(this._model.paneForSource(this._series))}}function ae(e){switch(e){case 0:return"barStyle";case 1:return"candleStyle";case 2:return"lineStyle";case 14:return"lineWithMarkersStyle";case 15:return"steplineStyle";case 3:return"areaStyle";case 16:return"hlcAreaStyle";case 4:return"renkoStyle";case 5:return"kagiStyle";case 6:return"pnfStyle";case 7:return"pbStyle";case 8:return"haStyle";case 9:return"hollowCandleStyle";case 10:return"baselineStyle";case 11:return"rangeStyle";case 12:return"hiloStyle";case 13:return"columnStyle";case 17:return"volFootprintStyle";case 18:return"tpoStyle";case 19:return"volCandlesStyle";case 20:return"svpStyle";default:(0,s.ensureNever)(e)}throw new Error(`unsupported chart style: ${e}`)}var le=i(32112),ce=i(16638),he=i(48984),de=i(70131);function ue(e,t){const{symbolChanged:i,currencyChanged:s,unitChanged:r,styleChangeRequiresRestart:n}=e.compareSymbolParams(t);return!(i||s||r||n)}function pe(e,t){e.isLoading()&&!e.isFailed()||t(e.isFailed());const i=e.seriesSource().symbolInstanceId(),s=e.dataEvents(),r=e.symbolParams(),n=()=>{s.completed().unsubscribe(null,o),(ue(e,r)||e.seriesSource().symbolInstanceId()===i)&&t(!1)},o=()=>{s.error().unsubscribe(null,n),(ue(e,r)||e.seriesSource().symbolInstanceId()===i)&&t(!0)};s.completed().subscribe(null,n,!0),s.error().subscribe(null,o,!0)}var _e=i(71885),me=i(68159),ge=i(17730),fe=i(53388),ve=i(45579),ye=i(74174),Se=i(2718);class be{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0,s.ensureDefined)(this._groupById(e));return(0,Se.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._model.dataSourceForId(t));(0,s.assert)((0,v.isLineTool)(r),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,r)}addShapeToGroup(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._model.dataSourceForId(t));(0,s.assert)((0,v.isLineTool)(r),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,r)}availableZOrderOperations(e){const t=(0,s.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,s.ensureDefined)(this._groupById(e))
;this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,r)}insertBefore(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,r)}groupVisibility(e){return(0,s.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,s.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,s.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(0,s.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,s.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){const i=(0,s.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,s.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,v.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}var we=i(15764),Ce=i(28331),Pe=i(39076),xe=i(76032);const Te=new C.TranslatedString("change price to bar ratio",w.t(null,void 0,i(2509))),Ie=new C.TranslatedString("toggle lock scale",w.t(null,void 0,i(49695)));function Me(e,t){return t.map((t=>(0,s.ensureNotNull)(e.dataSourceForId(t))))}class Ae{constructor(e,t){this._visibleBarsChanged=new u.Delegate,this._crosshairMoved=new u.Delegate,this._dataSourceHovered=new u.Delegate,this._ranges=null,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap,this._selectionApi=null,this._prevVisibleRange=null,this._prevHoveredSourceId=null,this._chartWidget=e,this._activateChart=t,this._timezoneApi=new k(e),this._chartWidget.withModel(this,(()=>{this._chartWidget.model().crossHairSource().moved().subscribe(this,this._onCrosshairMoved),this._chartWidget.model().model().hoveredSourceChanged().subscribe(this,this._onHoveredSourceChanged),this._chartWidget.model().timeScale().logicalRangeChanged().subscribe(this,this._onLogicalRangeChanged)})),this._widgetLinkingGroupIndex=e.linkingGroupIndex().spawn(),this._widgetLinkingGroupIndex.subscribe((e=>this._apiLinkingGroupIndex.setValue(e))),this._apiLinkingGroupIndex=new g.WatchedValue(this._widgetLinkingGroupIndex.value()),this._apiLinkingGroupIndex.subscribe((e=>{this._widgetLinkingGroupIndex.value()!==e&&(this._chartWidget.hasModel()?this._chartWidget.model().setLinkingGroupIndex(e):this._widgetLinkingGroupIndex.setValue(e))})),this._chartWidget.onAboutToBeDestroyed().subscribe(this,this._destroy,!0)}setActive(){this._activateChart()}getPriceToBarRatio(){return this._chartWidget.model().model().mainSeriesScaleRatioProperty().value()}setPriceToBarRatio(e,t){const i=this._chartWidget.model(),s=i.model(),r=s.mainSeriesScaleRatioProperty();(null==t?void 0:t.disableUndo)?new de.SetScaleRatioPropertiesCommand(r,e,null,s).redo():i.setScaleRatioProperty(r,e,Te)}
isPriceToBarRatioLocked(){return this._chartWidget.model().model().mainSeries().priceScale().isLockScale()}setPriceToBarRatioLocked(e,t){const i=this._chartWidget.model(),s=i.model(),r=s.mainSeries().priceScale();(null==t?void 0:t.disableUndo)?new he.SetPriceScaleModeCommand({lockScale:e},r,null,s).redo():i.setPriceScaleMode({lockScale:e},r,Ie)}id(){return this._chartWidget.id()}onDataLoaded(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())}onSymbolChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().symbolResolved())}onIntervalChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())}onVisibleRangeChanged(){return this._makeSubscriptionFromDelegate(this._visibleBarsChanged)}onChartTypeChanged(){const e=this._chartWidget.model().mainSeries().onStyleChanged();return this._makeSubscriptionFromDelegate(e)}onSeriesTimeframe(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().seriesTimeFrame())}dataReady(e){const t=!this._chartWidget.hasModel()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return e&&(t?this.onDataLoaded().subscribe(null,e,!0):e()),!t}whenChartReady(e){this._chartWidget.withModel(this,e)}crossHairMoved(){return this._makeSubscriptionFromDelegate(this._crosshairMoved)}onHoveredSourceChanged(){return this._makeSubscriptionFromDelegate(this._dataSourceHovered)}setVisibleRange(e,t){return new Promise((i=>{this._chartWidget.setVisibleTimeRange(e.from,e.to,t,i)}))}setSymbol(e,t){(0,R.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s}=t||{};e===this.symbol()||this._chartWidget.hasModel()&&this._chartWidget.model().mainSeries().symbolSameAsResolved(e)?null==i||i():(s||this._activateChart(),this._chartWidget.setSymbol(e),pe(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})))}async setResolution(e,t){(0,R.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s}=t||{},r=P.Interval.normalize(e);if(null===r||r===this.resolution())return null==i||i(),!0;s||this._activateChart();const n=await this._chartWidget.chartWidgetCollection().setResolution(r,void 0,this._chartWidget);return n&&pe(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),n}async setChartType(e,t){if(this._chartWidget.model().mainSeries().properties().childs().style.value()===e)return null==t||t(),!0;const i=this._chartWidget.chartWidgetCollection().setChartStyleToWidget(e,this._chartWidget);return pe(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}getBarsMarksSources(){return this._chartWidget.model().barsMarksSources()}getAllShapes(){
return this._chartWidget.model().model().allLineTools().map(V).filter((e=>null!==e.name))}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(B)}getStudyTemplateSnapshot(e,t,i){return(0,xe.getStudyTemplateSaveData)(e,this._chartWidget.model().model(),t,i)}getStudyTemplateDescString(){const e=(0,xe.getStudyTemplateMetaInfo)(this._chartWidget.model().model());return(0,xe.getStudyTemplateDescString)(e.indicators)}applyStudyTemplateByRecord(e){if(!e)return;const t=t=>this._chartWidget.model().applyStudyTemplate(JSON.parse(t.content),e.name);e.is_default?Pe.backend.getStandardStudyTemplateById(e.id,t):Pe.backend.getStudyTemplateById(e.id).then(t)}getAllPanesHeight(){const e=this._chartWidget.model().model().panes();if(this._chartWidget.isMaximizedPane()){let t=0,i=0;e.forEach((e=>{t+=e.height(),i+=e.stretchFactor()}));const s=i/t;return e.map((e=>Math.round(e.stretchFactor()/s*100)/100))}return e.map((e=>e.height()))}setAllPanesHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,s.assert)(i.length===e.length,"There`s a mismatch between the number of heights you provided and the number of panes.");const r=i.reduce(((e,t)=>e+t.stretchFactor()),0)/e.reduce(((e,t)=>e+t));e.forEach(((e,t)=>{const s=e*r;i[t].setStretchFactor(s)})),t.fullUpdate()}maximizeChart(){this._chartWidget.requestFullscreen()}isMaximized(){return this._chartWidget.inFullscreen()}restoreChart(){this._chartWidget.exitFullscreen()}restoreChartPreferences(){this._chartWidget.model().restorePreferences()}availableZOrderOperations(e){const t=Me(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}bringForward(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}insertAfter(e,t){const i=this._chartWidget.model().model(),r=Me(i,e),n=(0,s.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertAfter(r,n)}insertBefore(e,t){const i=this._chartWidget.model().model(),r=Me(i,e),n=(0,s.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertBefore(r,n)}sessions(){var e,t;return null!==(t=null===(e=this._chartWidget.model().model().sessions())||void 0===e?void 0:e.get())&&void 0!==t?t:null}chartModel(){return this._chartWidget.model().model()}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");const i=this._chartWidget.model().model().dataSourceForId(e);if(!i)return;const s=i.properties();s&&s.visible&&s.visible.setValue(t)}async createStudy(e,t,i,s,r,n){if("function"==typeof r)return console.warn('"createStudy" does not take "callback" parameter anymore'),
Promise.resolve(null);if(n=n||{},"string"!=typeof e)return this._createStudy(e);e=e.toLowerCase();const o=await(0,ce.studyMetaInfoRepository)().findAllJavaStudies(),a=me.StudyMetaInfo.findStudyMetaInfoByDescription(o,e);if(n.checkLimit){const e=this._chartWidget.model().canCreateStudy({id:a.id});if(!e.success)return(0,_e.showTooManyStudiesNotice)(e.limitValue),Promise.resolve(null)}const l=(n.disableUndo?this._chartWidget.model().model():this._chartWidget.model()).createStudyInserter({type:"java",studyId:a.id},[]);if(l.setForceOverlay(!!t),n.priceScale&&l.setPreferredPriceScale(function(e){switch(e){case"no-scale":return"overlay";case"as-series":return"as-series";case"new-left":return"left";case"new-right":return"right";default:throw new Error(`The pricescale "${e}" is invalid, the only valid options are "no-scale", "as-series", "new-left" and "new-right".`)}}(n.priceScale)),n.allowChangeCurrency&&l.setAllowChangeCurrency(!0),n.allowChangeUnit&&l.setAllowChangeUnit(!0),Array.isArray(s)){console.warn("Passing study inputs as an ordered array is now deprecated. Please use an object where keys correspond to the inputs of your study instead.");const e={};for(let t=0;tPromise.resolve({inputs:s||{},parentSources:[]}))).then((e=>(r&&(0,x.applyOverridesToStudy)(e,r),i&&e.setUserEditEnabled(!1),e.id())))}getStudyById(e){const t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw new Error("There is no such study");return this._getStudyApi(t)}getSeries(){const e=this._chartWidget.model(),t=e.mainSeries();return new oe(t,e)}createShape(e,t){return this.createMultipointShape([e],t)}createMultipointShape(e,t){var i;const r=Object.assign({},{filled:!0},t),n=_.supportedLineTools[r.shape]||_.supportedLineTools.flag;const o=this._chartWidget.model().model(),a=o.mainSeries();if(o.timeScale().isEmpty())return null;const l=void 0!==r.ownerStudyId&&null!==(i=o.dataSourceForId(r.ownerStudyId))&&void 0!==i?i:a,c=o.paneForSource(l),h=this._convertUserPointsToDataSource(e);if(null===h||null===c)return null;if(n.onlySelectable)throw new Error(`Cannot create "${r.shape}" shape`);if("LineToolIcon"===n.name){const e=r;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!r.hasOwnProperty("icon"))throw new Error("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}const d=(0,v.createLineToolProperties)(n.name,void 0,this._chartWidget.model().model());if((0,v.prepareLineToolPropertiesByOwnerSource)(d,l),r.overrides)for(const e in r.overrides)d.hasChild(e)?(0,s.ensureDefined)(d.child(e)).mergeAndFire(r.overrides[e]):se(n.name)&&-1!==["profitLevel","stopLevel"].indexOf(e)&&d.addProperty(e,r.overrides[e]);let u;void 0!==d.hasChild("text")&&r.text&&(0,s.ensureDefined)(d.child("text")).setValue(r.text),d.hasChild("filled")&&r.filled&&(0,s.ensureDefined)(d.child("filled")).setValue(!0),u=r.disableUndo?this._chartWidget.model().model():this._chartWidget.model();const p=u.createLineTool({pane:c,point:h[0],linetool:n.name,properties:d,
ownerSource:l});if(null===p)return null;if(se(n.name)){if(h.length>2)throw new Error(`Wrong points count for ${r.shape}. Required 1 or 2`);2===h.length&&(p.startChanging(1,h[1]),p.setPoint(1,h[1]),p.endChanging(!0,!1))}else{const e=p.pointsCount();if(e!==h.length&&-1!==e)throw new Error(`Wrong points count for ${r.shape}. Required ${e}`);const t=new Ce.EnvironmentState(void 0,!0),i=(0,we.isLineDrawnWithPressedButton)(n.name);for(let e=1;e{const i={};return t.forEach((t=>{void 0!==e[t]&&(i[t]=e[t])})),i})(e,["name","base_name","ticker","description","long_description","type","session","session_display","session_holidays","corrections","exchange","exchange","listed_exchange","timezone","format","pricescale","minmov","fractional","minmove2","variable_tick_size","has_intraday","supported_resolutions","intraday_multipliers","has_seconds","has_ticks","seconds_multipliers","has_daily","daily_multipliers","has_weekly_and_monthly","weekly_multipliers","monthly_multipliers","has_empty_bars","visible_plots_set","volume_precision","data_status","delay","expired","expiration_date","sector","industry","currency_code","original_currency_code","unit_id","original_unit_id","unit_conversion_types","subsession_id","subsessions","price_source_id","price_sources","logo_urls","exchange_logo","pro_name","library_custom_fields"]);return t.pro_name=e.pro_name,t}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().currentSession().spawn()}getVisibleRange(){const e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;const r=i.firstBar(),n=i.lastBar(),o=this._convertIndexToPublicTime(n);if(null===o)return e;const a=Math.max((0,s.ensureNotNull)(t.points().range().value()).firstIndex,r);return e.from=(0,s.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=o,e}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())return null;return this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}priceFormatter(){return this._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){return this._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){return this._chartWidget.getTimezone()}getTimezoneApi(){return this._timezoneApi}getPanes(){return this._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){if(!o.enabled("charting_library_export_chart_data"))return Promise.reject("Data export is not supported");const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),i.e(9498).then(i.bind(i,99992)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}canZoomOut(){return!this._chartWidget.model().zoomStack().isEmpty()}zoomOut(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()}setZoomEnabled(e){
this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}shapesGroupController(){return new be(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==m.SelectPointMode.None}requestSelectBar(){return this.isSelectBarRequested()?Promise.reject("already requested"):new Promise(((e,t)=>{this._chartWidget.requestSelectPoint({pointType:"time"}).then((t=>{e(this._convertTimeToPublic((0,s.ensureDefined)(t.point.time)))})).catch((()=>{t("cancelled")}))}))}cancelSelectBar(){this.isSelectBarRequested()&&this._chartWidget.cancelRequestSelectPoint()}barTimeToEndOfPeriod(e){const t=this._prepareEndOfPeriodArgs();return(0,I.barTimeToEndOfPeriod)(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return(0,I.endOfPeriodToBarTime)(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=t.shape;if((0,_.isSupportedLineTool)(i)&&!0!==_.supportedLineTools[i].isAnchored)return console.warn(`${i} is not an anchored shape. It can be created using createShape or createMultipointShape`),null;const s=this._chartWidget.model().model(),r=s.mainSeries();if(s.timeScale().isEmpty())return null;const n=void 0!==t.ownerStudyId?s.dataSourceForId(t.ownerStudyId):r,o=this._convertPositionPercentToPricedPoint(e,n);return null===o?null:this.createMultipointShape([o],t)}properties(){return this._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){return this._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){return this._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){return this._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){const t=this._chartWidget.model(),i=t.model().dataSourceForId(e);t.cloneLineTools([i],!1)}shareLineTools(e,t){const i=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}linkingGroupIndex(){return this._apiLinkingGroupIndex.spawn()}loadingScreenActive(){return this._chartWidget.screen.isShown()}symbolResolvingActive(){for(const e of this._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){return this._chartWidget.hasModel()}disableAllUtilitySources(){0}ranges(){throw new Error("not implemented")}getTimeScale(){return new M(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,h.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}syncTime(e){if(this._chartWidget.hasModel()){const t=this._chartWidget.model().model(),i=t.mainSeries().syncModel();i&&t.syncTimeWithModel(i.syncSourceTarget(),e)}}syncDateRange(e,t){
this._chartWidget.hasModel()&&this._chartWidget.model().model().gotoTimeRange(e,t)}getLineToolsState(e=1,t,i){this._canUseLineToolsSynchronizer("getLineToolsState");const r=null==i||i,n=(0,s.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,r);return delete n.clientId,n}async applyLineToolsState(e){this._canUseLineToolsSynchronizer("applyLineToolsState"),await(0,s.ensureNotNull)(this.lineToolsSynchronizer()).applyDTO(e)}reloadLineToolsFromServer(){this._canUseLineToolsSynchronizer("reloadLineToolsFromServer"),(0,s.ensureNotNull)(this.lineToolsSynchronizer()).reloadAllLineTools()}studyMetaIntoRepository(){return(0,ce.studyMetaInfoRepository)()}replayStatus(){return this._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){return this._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s){return this._chartWidget.model().insertStudyWithoutCheck(new me.StudyMetaInfo(e),t,i,s)}_destroy(){this._chartWidget.hasModel()&&(this._chartWidget.model().crossHairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged)),this._widgetLinkingGroupIndex.destroy()}_createTradingPrimitive(e,t){const i=this._chartWidget.model(),r=i.model(),n={pane:(0,s.ensureNotNull)(r.paneForSource(r.mainSeries())),point:(()=>{const e=(0,s.ensureNotNull)(i.mainSeries().bars().last());return{index:e.index,price:e.value[4]}})(),linetool:e};return(t?r.createLineTool(n):i.createLineTool(n)).adapter()}_createStudy(e){return Promise.reject("Pine Script™ and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_convertPositionPercentToPricedPoint(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),r=t.firstValue();if(null==r||!isFinite(r)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width()),o=i.indexToTimePoint(n);if(null===o)return null;return{price:s.coordinateToPrice(e.y*s.height(),r),time:o}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),r=t.timeScale().points(),n=i.data();if(t.timeScale().isEmpty())return null;const o=e.map((e=>e.time||0)),a=this._alignPoints(o),l=(e,t,o)=>{const a=r.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,s.ensureNotNull)(r.valueAt(a)),h=(0,s.ensureNotNull)(r.range().value());if(e>c&&a===h.lastIndex){const t=(0,s.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(ee.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));d.entityValues[t.id()]={isHovered:s,values:r,title:i.header()}}this._crosshairMoved.fire(d)}_makeSubscriptionFromDelegate(e){return{subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}_prepareEndOfPeriodArgs(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,s.ensureNotNull)(e.mainSeries().symbolInfo()),r=e.mainSeries().interval(),n=new T.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,T.newBarBuilder)(r,n,n),intervalObj:P.Interval.parse(r)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new W(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new ee(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new ne(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,s.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),r=i.symbolInfo();if(t.timeScale().isEmpty()||!P.Interval.isDWM(s)||null===r)return e;const n=(0,fe.createDwmAligner)(s,r);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty()
;if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=this.getVisibleRange();null!==this._prevVisibleRange&&(0,R.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!o.enabled("saveload_separate_drawings_storage"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}}var Le=i(74047),ke=i(19475),De=i(97990),Ee=i(99531),Ve=i(42752);function Be(){throw new Error("not implemented")}class Re{constructor(e){this.linking=r.linking,this._studyTemplatesDrawer=null,this._fontIconsSettingsDrawer=null,this._favoriteDrawingsToolbar=null,this._webview=null,this._themesApi=null,this._newsApiDeferredPromise=null,this._newsApiRejectionReason=null,this._watchlistApiDeferredPromise=null,this._watchlistApiRejectionReason=null,this._widgetbarApiDeferredPromise=null,this._widgetbarApiRejectionReason=null,this._isDestroyed=!1,this._widgebarApi=null,this._chartWidgets=new WeakMap,this._layoutSettingsDrawer=null,this._magnetEnabledWatchedValue=null,this._magnetModeWatchedValue=null,this._drawOnAllCharts=(0,Ve.convertPropertyToWatchedValue)((0,m.drawOnAllCharts)()),this._replayApi=null,this._pineEditorApi=null,this._activateChart=e=>{this.setActiveChart(this._chartIndex(e))},this._toggleUnitConversionMenu=(e,t,i,r,o)=>{const a=this._chartWidgetCollection.getAll(),l=a.findIndex((e=>e.model().model().id()===i));if(-1===l)return;const c=(0,s.ensureDefined)(a[l]).paneWidgets().findIndex((e=>e.state().id()===r));-1!==c&&n.emit(e,t,l,c,o)};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:o,saveChartService:a,loadChartService:l,sharingChartService:c=null,webview:h=null,favoriteServices:d}=e;this._chartApiInstance=t,this._chartWidgetCollection=i,this._studyMarket=o,this._saveChartService=a,this._sharingChartService=c,this._loadChartLayoutDialog=l,this._favoriteServices=d,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=r.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=h;const u=new De.ChartChangesWatcher(this._chartWidgetCollection,window.saver,n);this._chartChangesWatcher=u,this._chartHasChanged=(0,Ee.createWVFromGetterAndSubscription)((()=>u.hasChanges()),u.getOnChange());const p=i.lock;this._symbolSync=p.symbol.spawn(),this._intervalSync=p.interval.spawn(),this._dateRangeSync=p.dateRange.spawn(),this._crosshairSync=p.crosshair.spawn(),this._timeSync=p.trackTime.spawn(),n.subscribe("toggle_currency_menu_inner",((e,t,i,s)=>this._toggleUnitConversionMenu("toggle_currency_menu",e,t,i,s)),this),n.subscribe("toggle_unit_menu_inner",((e,t,i,s)=>this._toggleUnitConversionMenu("toggle_unit_menu",e,t,i,s)),this)}destroy(){var e,t,i,s;this._chartHasChanged.destroy(),this._chartChangesWatcher.destroy(),
this._supportedChartStylesSpawn.destroy(),null===(e=this._intervalsService)||void 0===e||e.destroy(),null===(t=this._themesApi)||void 0===t||t.destroy(),null===(i=this._widgebarApi)||void 0===i||i.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._drawOnAllCharts.destroy(),null===(s=this._pineEditorApi)||void 0===s||s.destroy(),this._isDestroyed=!0,(0,m.properties)().childs().magnet.unsubscribeAll(this),(0,m.properties)().childs().magnetMode.unsubscribeAll(this),n.unsubscribeAll("toggle_currency_menu_inner",this),n.unsubscribeAll("toggle_unit_menu_inner",this)}themes(){return null===this._themesApi&&(this._themesApi=new p({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){var e,t,i,s,r,n;return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:null!==(t=null===(e=this._saveChartService)||void 0===e?void 0:e.getSaveAsController())&&void 0!==t?t:null,ChartLayoutRename:null!==(s=null===(i=this._saveChartService)||void 0===i?void 0:i.getRenameController())&&void 0!==s?s:null,ChartLayoutCreate:null!==(n=null===(r=this._saveChartService)||void 0===r?void 0:r.getCreateController())&&void 0!==n?n:null,ChartLayoutLoad:this._loadChartLayoutDialog,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){n.subscribe(e,t,void 0)}unsubscribe(e,t){n.unsubscribe(e,t,void 0)}webview(){return Be(),this._webview}studyTemplatesDrawerApi(){Be()}fontIconsSettingsDrawer(){Be()}intervalsService(){Be()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,m.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,m.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,m.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,m.drawOnAllChartsMode)().setValue(e)}currencies(){var e,t;return null!==(t=null===(e=this._chartApiInstance)||void 0===e?void 0:e.availableCurrencies())&&void 0!==t?t:Promise.reject()}units(){var e,t;return null!==(t=null===(e=this._chartApiInstance)||void 0===e?void 0:e.availableUnits())&&void 0!==t?t:Promise.reject()}disableTrackingEvents(){(0,c.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){return this._intervalSync}dateRangeSync(){return this._dateRangeSync}crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){Be()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}activeChart(){
return this._getChartWidgetApi(this._activeChartWidget())}setActiveChart(e){if(e>=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){Be()}setWatchlistApiPromise(e){Be()}news(){Be()}setNewsApiPromise(e){Be()}widgetbar(){Be()}setWidgetbarApiPromise(e){Be()}getChartStorage(){return getChartStorage()}setDebugMode(e){o.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?o.setEnabled(e,t):ke.addPlusButtonProperty.setValue(t)}magnetEnabled(){return null===this._magnetEnabledWatchedValue&&(this._magnetEnabledWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnet.value()),this._magnetEnabledWatchedValue.subscribe((e=>{(0,f.allowSavingDefaults)(!0),(0,m.properties)().childs().magnet.setValue(e),(0,f.allowSavingDefaults)(!1)})),(0,m.properties)().childs().magnet.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetEnabledWatchedValue).setValue((0,m.properties)().childs().magnet.value())}))),this._magnetEnabledWatchedValue}magnetMode(){return null===this._magnetModeWatchedValue&&(this._magnetModeWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnetMode.value()),
this._magnetModeWatchedValue.subscribe((e=>{(0,f.allowSavingDefaults)(!0),(0,m.properties)().childs().magnetMode.setValue(e),(0,f.allowSavingDefaults)(!1)})),(0,m.properties)().childs().magnetMode.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetModeWatchedValue).setValue((0,m.properties)().childs().magnetMode.value())}))),this._magnetModeWatchedValue}flushBufferedData(){b.fire()}chartWidgetCollectionState(...e){return this._chartWidgetCollection.state(...e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}initAllLineTools(){const e=Object.keys(S).concat(["LineToolAnchoredVWAP","LineToolRegressionTrend","LineToolAnchoredVolumeProfile","LineToolFixedRangeVolumeProfile","LineToolVbPFixed"]);return Promise.all(e.map((e=>(0,v.initLineTool)(e)))).then((()=>{}))}watermark(){{const e=Le.WatermarkApi.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}setContextMenuOptions(e){Re.setContextMenuOptions(e)}changeSymbol(e,t,i){r.linking.interval.setValue((0,s.ensureNotNull)(P.Interval.normalize(t))),r.linking.setSymbolAndLogInitiator(e,"API"),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}getFavoriteChartStylesService(){throw new Error("not implemented")}getFavoriteIntervalsService(){throw new Error("not implemented")}getFavoriteCurrencyUnitConversionApi(){throw new Error("not implemented")}getLinetoolsFavoritesStore(){throw new Error("not implemented")}getSavedCharts(e){Pe.backend.getCharts().then(e)}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return null==e||e(t),t}hasChartChanges(){return this._chartHasChanged}loadChartFromServer(e){Pe.backend.loadChart(e)}removeChartFromServer(e,t){Pe.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;const i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}autosave(){if(!this._saveChartService)throw new Error("Saving service is not available");return this._saveChartService.autoSaveEnabled()}setForceFullscreenMode(){Be()}setMultichartMode(){Be()}setDateRangeLinkingEnabled(e){this._chartWidgetCollection.lock.dateRange.setValue(e)}studyMetaIntoRepository(){return(0,ce.studyMetaInfoRepository)()}shouldBeSaved(){var e;return!this._chartWidgetCollection.readOnly()&&((null===(e=this._saveChartService)||void 0===e?void 0:e.hasChanges())||!1)}showLoadChartDialog(){var e;null===(e=this._loadChartLayoutDialog)||void 0===e||e.show()}persistentLogger(){return null}static setContextMenuOptions(e){void 0!==e.items_processor&&a.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&a.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new Ae(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){
return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}}},25605:(e,t,i)=>{"use strict";var s=i(82992).linking,r=(i(14426).createDeferredPromise,i(76422)),n=i(40443).ContextMenuManager,o=i(928),a=i(10074),l=i(31955),c=i(3615).showWarning,h=i(3615).showConfirm,d=i(4711),u=i(52092).CLOSE_POPUPS_AND_DIALOGS_COMMAND,p=i(31601).TradingViewApiBase,_=i(68159).StudyMetaInfo,m=i(152).getStudyInputsInfo,g=i(70120).getStudyStylesInfo,f=i(52033).Delegate,v=i(64147).WatchedValue;e.exports=class extends p{constructor(e){const{chartWidgetCollection:t,saveChartService:i,loadChartService:s,sharingChartService:r,alertsServices:n,supportTicketData:o,favoriteServices:a,chartApiInstance:l=null,studyMarket:c=null,webview:h}=e;super({chartApiInstance:l,chartWidgetCollection:t,studyMarket:c,saveChartService:i,loadChartService:s,sharingChartService:r,webview:h,favoriteServices:a}),this._supportTicketData=o,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._getDataSourceHub=function(){return t.activeChartWidget.value().model().model()},this._alertService=n?new undefined(n.alertsDispatcher,this._getDataSourceHub,n.alertsFacadeChannelPushApi):null,this._activeChangedChangedDelegate=new f,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this))}onContextMenu(e){r.subscribe("onContextMenu",(function(t){t.callback(e(t.unixtime,t.price))}))}onGrayedObjectClicked(e){r.subscribe("onGrayedObjectClicked",e)}onActiveChartChanged(){return this._activeChangedChangedDelegate}viewMode(){throw new Error("not implemented")}viewModeWatchedValue(){throw new Error("not implemented")}loadChart(e){this._chartApiInstance.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),this._chartApiInstance.connect(),s.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),r.emit("chart_loaded")}getStudiesList(){return this._chartApiInstance.allStudiesMetadata().filter((function(e){return!e.is_hidden_study})).map((function(e){return e.description}))}getStudyInputs(e){{const t=_.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return m(t)}}getStudyStyles(e){{const t=_.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return g(t)}}getIntervals(){var e=[],t=a.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),a.mergeResolutions(e,t)}closePopupsAndDialogs(){n.hideAll(),r.emit(u)}selectedLineTool(){for(var e=Object.keys(d.supportedLineTools),t=o.tool.value(),i=0;i{"use strict";i.d(t,{WatermarkApi:()=>o});var s=i(50151),r=i(42752),n=i(96001);class o{constructor(){this._widgets=null,this._provider=null,this._watermarkProperties=(0,n.watermarkProperty)();const e=(0,s.ensureDefined)(this._watermarkProperties.child("color")),t=(0,s.ensureDefined)(this._watermarkProperties.child("visibility"));this._colorWatchedValue=(0,r.convertPropertyToWatchedValue)(e),this._visibilityWatchedValue=(0,r.convertPropertyToWatchedValue)(t)}setWidgetCollection(e){this._widgets=e}setContentProvider(e){this._provider=e,this._widgets&&this._widgets.getAll().forEach((e=>{e.model().model().lightUpdate()}))}provider(){return this._provider}ready(){return null!==this._widgets}destroy(){this._colorWatchedValue.destroy(),this._visibilityWatchedValue.destroy()}visibility(){return this._visibilityWatchedValue}color(){return this._colorWatchedValue}static getInstance(){return null===this._instance&&(this._instance=new o),this._instance}}o._instance=null},96e3:(e,t,i)=>{"use strict";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}}},19475:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>_,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(4741),r=i(56570),n=i(56840),o=i(17625),a=i(64147);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c());s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return r.enabled("chart_crosshair_menu")}function p(){return n.getBool(l,u())}const _=(0,o.createPrimitiveProperty)(p());function m(){_.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>_.setValue(p()))),_.subscribe(null,(()=>{n.setValue(l,_.value()),r.setEnabled("chart_crosshair_menu",!r.enabled("chart_crosshair_menu"))}))},92934:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),r=i.n(s);function n(e,t){return r()(e).div(t).round(0,r().roundHalfUp).mul(t).toNumber()}},12974:(e,t,i)=>{"use strict";i.d(t,{AppliedTimeFrame:()=>r});var s=i(91676);class r{constructor(e){this._appliedTimeFrame=new s.WatchedObject(null),this._appliedTimeFrameInfo=null,this._appliedTimeFrameChangedBound=this._appliedTimeFrameChanged.bind(this),this._model=e,e.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),
this._appliedTimeFrame.subscribe(this._appliedTimeFrameChangedBound)}destroy(){this._appliedTimeFrame.unsubscribe(this._appliedTimeFrameChangedBound),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.mainSeries().dataEvents().seriesTimeFrame().unsubscribeAll(this)}appliedTimeFrame(){return this._appliedTimeFrame}_appliedTimeFrameChanged(){this._model.timeScale().logicalRangeChanged().unsubscribe(this,this._invalidateAppliedTimeFrame)}_onSeriesTimeFrame(e,t,i,s){if(s){const e=this._model.timeScale();this._appliedTimeFrameInfo={logicalRange:e.logicalRange(),baseIndex:e.baseIndex()},e.logicalRangeChanged().subscribe(this,this._invalidateAppliedTimeFrame)}}_invalidateAppliedTimeFrame(){if(null===this._appliedTimeFrameInfo)return;const e=this._model.timeScale(),t=e.logicalRange(),i=e.baseIndex(),s=this._appliedTimeFrameInfo.logicalRange,r=this._appliedTimeFrameInfo.baseIndex;(null===t||null===s||Math.abs(i-t.left()-(r-s.left()))>=.01||Math.abs(i-t.right()-(r-s.right()))>=.01)&&this._appliedTimeFrame.setValue(null)}}},77007:(e,t,i)=>{"use strict";i.d(t,{defaultsPreferencesByWhiteList:()=>x,preferencesByWhiteList:()=>P});var s=i(37265),r=i(91140),n=i(20596),o=i(31955),a=i(94164),l=i(35039),c=i(6290),h=i(31054),d=i(46088);const u=(0,o.getLogger)("Chart.ApplyPreferencesToAllCharts"),p={color:"",style:0},_={autoScale:!1,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!1,isInverted:!1,indexedTo100:!1},m={backgroundType:d.ColorType.Solid,background:"",backgroundGradientStartColor:"",backgroundGradientEndColor:"",topMargin:0,bottomMargin:0,rightOffset:0,gridLinesMode:"both",horzGridProperties:(0,h.deepExtend)({},p),vertGridProperties:(0,h.deepExtend)({},p),crossHairProperties:(0,h.deepExtend)({},{color:"",style:0,transparency:0,width:0}),legendProperties:(0,h.deepExtend)({},{showStudyArguments:!1,showStudyTitles:!1,showStudyValues:!1,showSeriesTitle:!1,showSeriesOHLC:!1,showLegend:!1,showLastDayChange:!1,showBarChange:!0,showVolume:!1,showPriceSource:!1,showBackground:!0,backgroundTransparency:0,showLogo:!0}),axisProperties:(0,h.deepExtend)({},_),separatorColor:""},g={lineColor:"",textColor:"",fontSize:0,scaleSeriesOnly:!1,showSeriesLastValue:!1,seriesLastValueMode:a.PriceAxisLastValueMode.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalLastValue:!1,showFundamentalNameLabel:!1,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0},f={...g},v={visible:!1,futureOnly:!1,breaks:(0,h.deepExtend)({},{color:"",visible:!1,style:0,width:0})},y={style:0,minTick:"",showPriceLine:!1,priceLineWidth:0,priceLineColor:"",baseLineColor:"",showPrevClosePriceLine:!1,showCountdown:!0,prevClosePriceLineWidth:0,sessionId:"regular",prevClosePriceLineColor:"",esdShowDividends:!1,esdShowSplits:!1,esdShowEarnings:!1,esdShowBreaks:!1,showContinuousContractSwitches:!1,showContinuousContractSwitchesBreaks:!1,
showFuturesContractExpiration:!1,showLastNews:!1,dividendsAdjustment:!1,backAdjustment:!1,settlementAsClose:!0,statusViewStyle:(0,h.deepExtend)({},{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"}),priceAxisProperties:(0,h.deepExtend)({},_),highLowAvgPrice:(0,h.deepExtend)({},{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLabelVisible:!1,averageClosePriceLineVisible:!1,highLowPriceLinesColor:"",highLowPriceLinesWidth:0,averagePriceLineColor:"",averagePriceLineWidth:0}),candleStyle:(0,h.deepExtend)({},n.candleStylePreferencesDefault),hollowCandleStyle:(0,h.deepExtend)({},n.hollowCandlePreferencesStyleDefault),barStyle:(0,h.deepExtend)({},n.barStylePreferencesDefault),lineStyle:(0,h.deepExtend)({},n.lineStyleDefault),lineWithMarkersStyle:(0,h.deepExtend)({},n.lineStyleDefault),steplineStyle:(0,h.deepExtend)({},n.lineStyleDefault),areaStyle:(0,h.deepExtend)({},n.areaStylePreferencesDefault),hlcAreaStyle:(0,h.deepExtend)({},n.hlcAreaStylePreferencesDefault),baselineStyle:(0,h.deepExtend)({},n.baselineStylePreferencesDefault),hiloStyle:(0,h.deepExtend)({},n.hiloStylePreferencesDefault),haStyle:(0,h.deepExtend)({},n.haStylePreferencesDefault),renkoStyle:(0,h.deepExtend)({},n.renkoStylePreferencesDefault),pbStyle:(0,h.deepExtend)({},n.pbStylePreferencesDefault),kagiStyle:(0,h.deepExtend)({},n.kagiStylePreferencesDefault),pnfStyle:(0,h.deepExtend)({},n.pnfStylePreferencesDefault),rangeStyle:(0,h.deepExtend)({},n.rangeStylePreferencesDefault),columnStyle:(0,h.deepExtend)({},n.columnStylePreferencesDefault)},S={priceScaleSelectionStrategyName:"auto",timeScale:(0,h.deepExtend)({},{defaultRightOffset:0,defaultRightOffsetPercentage:5,usePercentageRightOffset:!1}),mainSeries:(0,h.deepExtend)({},y),sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:(0,h.deepExtend)({},m),chartEventsSourceProperties:(0,h.deepExtend)({},v),tradingProperties:(0,h.deepExtend)({},r.tradingPreferencesDefault)},b={timezone:"",scalesProperties:(0,h.deepExtend)({},f),...S},w={scalesProperties:(0,h.deepExtend)({},g),...S};function C(e,t,i,r,n=!0){if(void 0===t[e])return u.logDebug(`We haven't had this property ${r}.${e} yet, please, remove it from whiteList`),null;if((0,s.isObject)(i[e])){const s=Object.keys(i[e]);let o="";return s.map((s=>({[s]:C(s,t[e],i[e],`${r}.${e}`,n)}))).reduce(((e,t)=>(o=Object.keys(t)[0],e[o]=t[o],e)),{})}return n?t[e].value():t[e]}function P(e,t,i=b){var s;const r={timezone:"",priceScaleSelectionStrategyName:"auto",timeScale:{defaultRightOffset:e.timeScale().defaultRightOffset().value(),defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:{},paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{}},n=["timeScale","mainSeries","sessions"],o=i.mainSeries,a=Object.keys(i),l=Object.keys(o),c=t.properties(),h=e.properties(),d=i.sessions,u=Object.keys(d);l.forEach((e=>{
r.mainSeries[e]=C(e,c,o,"mainSeries")}));const p=null===(s=e.sessions().state())||void 0===s?void 0:s.properties;return p&&u.forEach((e=>{r.sessions[e]=C(e,p,d,"sessions",!1)})),a.forEach((e=>{n.includes(e)||(r[e]=C(e,h,i,"preferences"))})),r}function x(e,t,i=w,s=!0){const r={timeScale:{defaultRightOffset:e.timeScale().rightOffsetDefaultValue(),defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{},priceScaleSelectionStrategyName:"auto"},n=["timeScale","mainSeries","sessions"],o=i.mainSeries,a=Object.keys(i),d=Object.keys(o),u=(0,l.factoryDefaults)("chartproperties.mainSeriesProperties"),p=(0,l.factoryDefaults)("chartproperties");return d.forEach((e=>{s&&"style"===e||(r.mainSeries[e]=C(e,u,o,"mainSeries",!1))})),a.forEach((e=>{n.includes(e)||(r[e]=C(e,p,i,"preferences",!1))})),r}},92158:(e,t,i)=>{"use strict";i.d(t,{actualAutoLogButtonsVisibility:()=>l,autoLogButtonsVisibilityOptions:()=>o,autoLogButtonsVisibilityProperty:()=>n,restoreAutoLogButtonsVisibilitySettingsValue:()=>a});var s,r=i(17656);!function(e){e.SettingsKey="PriceAxisAutoLogButtons.visibility"}(s||(s={}));const{property:n,availableValues:o,restoreDefaultValue:a,actualBehavior:l}=(0,r.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},57596:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>r});var s=i(19625);const r={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]};var n;!function(e){e.BorderColor="#2E84A6"}(n||(n={}))},53388:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>c,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>h});var s=i(2740),r=i(56570),n=i(85049),o=i(42217),a=i(14381);const l=new o.SessionInfo("Etc/UTC","0000-0000:1234567");function c(e,t){if(!h()||!n.Interval.isDWM(e))return null;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),r=(0,a.newBarBuilder)(e,i,l);return{timeToSessionStart:e=>r.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{const t=s.utc_to_cal(i.timezone,e),r=i.spec.correctTradingDay(t);return s.set_hms(r,0,0,0,0,s.get_timezone("Etc/UTC")),r.getTime()}}}function h(){return!r.enabled("disable_resolution_rebuild")}function d(e,t){if(!h())return e=>e;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),s=(0,a.newBarBuilder)(e,i,i,!1);return e=>s.alignTimeIfPossible(e)}},42217:(e,t,i)=>{"use strict";i.d(t,{BarBuilderBase:()=>a,SessionInfo:()=>o});var s=i(2740),r=i(83910),n=i(69748);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 a{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)}}},14381:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SessionInfo:()=>o.SessionInfo,alignExchangeTimeToSessionStartAndReturnUTC:()=>T,alignPeriodsBackForDataRequest:()=>w,alignPeriodsBackForVisibleRange:()=>C,getPeriodsBetweenDates:()=>x,isTradingNow:()=>I,newBarBuilder:()=>b});var s=i(2740),r=i(85049),n=i(9859),o=i(42217),a=i(83910);class l extends o.BarBuilderBase{constructor(e,t){super(),this._sessionStartMs=-Number.MAX_VALUE,this._sessionEndMs=-Number.MAX_VALUE,this._periodSec=e,this._session=t}alignTimeIfPossible(e){const t=this.alignTime(e);return isNaN(t)?e:t}indexOfBar(e){return e=this._sessionEndMs?a.SessionStage.POST_SESSION:(0,n.toInt)(s.time_seconds_diff(e,this._sessionStartMs)/this._periodSec)}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._session.timezone,this._sessionStartMs-1),t=this._session.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._session.timezone,t)}if(e===a.SessionStage.POST_SESSION)return this._sessionEndMs;if(e<0)throw new Error("Negative offset is not supported");return this._sessionStartMs+s.time_seconds(this._periodSec*e)}endOfBar(e){if(e<0)throw new Error("Index cannot be negative");const t=this.startOfBar(e)+1e3*this._periodSec;return t>this._sessionEndMs?this._sessionEndMs:t}isLastBar(e,t){return t>=this._sessionStartMs+s.time_seconds(this._periodSec*(e+1)-1)}moveTo(e){const t=this._session.timezone,i=s.utc_to_cal(t,e),r=this._session.spec.alignToSessionStart(i);this._sessionStartMs=s.cal_to_utc(t,i),s.add_minutes(i,r),this._sessionEndMs=s.cal_to_utc(t,i)}indexOfLastBarInSession(){return(0,n.toInt)((this._sessionEndMs-1-this._sessionStartMs)/1e3/this._periodSec)}moveNext(){this.moveTo(this._sessionEndMs)}}var c,h,d=i(79324);function u(e,t){const i=s.clone(t),r=e.businessDaysToCalendarDays(i,1);r>1&&s.add_date(i,r-1);const n=e.leftBorderOfDailyBar(i);if(null===n)throw new Error("Cannot calculate left border of daily bar");return s.cal_to_utc(s.get_timezone(e.timezone()),n)}class p extends o.BarBuilderBase{constructor(e,t,i,s,r=!1){super(),this._periodStart=-Number.MAX_VALUE,this._periodEnd=-Number.MAX_VALUE,this._periodLastBarStart=-Number.MAX_VALUE,this._periodStartDay=new d.BusinessDay(0,0,0),this._periodEndDay=new d.BusinessDay(0,0,0),this._period=i,this._sessionTgt=e,this._builder=s,this._useBusinessDays=r,this._sessionSrc=r?new o.SessionInfo("Etc/UTC","24x7"):t||e}builder(){return this._builder}alignTimeIfPossible(e){return this.tradingDayToSessionStart(e)}tradingDayToSessionStart(e){return this.moveTo(e),this.startOfBar(0)}indexOfBar(e){if(this._useBusinessDays){const t=d.BusinessDay.fromCalendar(s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e));return t.before(this._periodStartDay)?a.SessionStage.PRE_SESSION:this._periodEndDay.before(t)?a.SessionStage.POST_SESSION:0}
return e=this._periodEnd?a.SessionStage.POST_SESSION:0}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._sessionTgt.timezone,this._periodStart-1),t=this._sessionTgt.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._sessionTgt.timezone,t)-1}return e===a.SessionStage.POST_SESSION||e>0?this._periodEnd:e===a.SessionStage.LASTBAR_SESSION?this._periodLastBarStart:this._periodStart}moveTo(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e);this._sessionSrc.spec.correctTradingDay(t);const i=s.get_year(t),r=this._indexOfPeriodInYear(t),n=r+this._period,o=this._sessionTgt.spec,a=this._sessionTgt.timezone,l=this._builder.startOfPeriod(a,r,i);this._periodStart=u(o,l);const c=s.clone(l),h=o.businessDaysToCalendarDays(c,1);h>1&&s.add_date(c,h-1),this._periodStartDay=d.BusinessDay.fromCalendar(c);const p=this._builder.startOfPeriod(a,n,i);this._periodEnd=u(o,p);const _=s.clone(p);for(s.add_date(_,-1);o.isCalWeekEnd(_);)s.add_date(_,-1);this._periodEndDay=d.BusinessDay.fromCalendar(_),s.add_date(p,-1),function(e,t){for(;e.isCalWeekEnd(t);)s.add_date(t,-1)}(this._sessionTgt.spec,p),this._periodLastBarStart=u(o,p),(this._periodLastBarStart=this._periodLastBarStart}currentRange(){return{from:this._periodStartDay,to:this._periodEndDay}}indexOfBarInYear(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e),i=s.get_year(t),r=this._builder.indexOfPeriod(t),o=this._sessionTgt.timezone;let a=this._builder.startOfPeriod(o,r,i),l=u(this._sessionTgt.spec,a);return a=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),l),i=0&&(r-=7),(0,n.toInt)((r+i)/7))}class g{indexOfPeriod(e){return s.get_day_of_year(e)-1}startOfPeriod(e,t,i){const r=s.days_per_year(i);return s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1+Math.min(t,r))}}class f extends g{constructor(e){super(),this._sessionsSpec=e}indexOfPeriod(e){return super.indexOfPeriod(e)-function(e,t){const i=m(e,t),r=s.get_cal(s.get_timezone("Etc/UTC"),s.get_year(t),s.JANUARY,1);s.add_date(r,7*i);const n=i*e.weekEndsCount()+e.holidaysFromYearStart(r),o=s.get_day_of_year(t)-s.get_day_of_year(r);return n+o-e.calendarDaysToBusinessDays(r,o)}(this._sessionsSpec,e)}
startOfPeriod(e,t,i){const r=7-this._sessionsSpec.weekEndsCount(),o=Math.max(0,(0,n.toInt)(t/r)-1),a=s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1),l=s.get_days_per_year(a);if(s.add_date(a,7*o),(t-=r*o-this._sessionsSpec.holidaysFromYearStart(a))>0){const e=this._sessionsSpec.businessDaysToCalendarDays(a,t);s.add_date(a,e)}let c=s.get_day_of_year(a)-1;return is.get_days_per_year(r)?this.startOfPeriod(e,0,i+1):(s.add_date(r,a),r)}}class S{indexOfPeriod(e){return s.get_month(e)}startOfPeriod(e,t,i){if(t<0){const e=(0,n.toInt)((11-t)/12);i-=e,t+=12*e}else t>s.DECEMBER&&(i++,t=s.JANUARY);return s.get_cal(s.get_timezone("Etc/UTC"),i,t,1)}}function b(e,t,i,s=!1){const n=r.Interval.parse(e),o=n.multiplier();return n.isMinutes()?new l(60*o,t):n.isSeconds()?new l(o,t):n.isTicks()?new l(1,t):n.isRange()?new l(60*o,t):new p(t,i,o,function(e,t){switch(e){case r.ResolutionKind.Days:return new v(t);case r.ResolutionKind.Weeks:return new y(t);case r.ResolutionKind.Months:return new S}throw new Error(`Unknown dwm resolution: ${e}`)}(n.kind(),t),s)}function w(e,t,i,s,r,n,o){return P(e,t,i,s,r,n,o,0)}function C(e,t,i,s,r,n,o){return P(e,t,i,s,r,n,o,1)}function P(e,t,i,s,n,a,l,c){const h=r.Interval.parse(n+s);if(h.isMonths()){const e=new Date(l);return 0===c&&e.setUTCDate(1),function(e,t){M(e,Math.floor(t/12));let i=e.getUTCMonth()-t%12;i<0&&(M(e,1),i+=12);e.setUTCMonth(i);for(;e.getUTCMonth()!==i;)A(e,1)}(e,a*h.multiplier()),e.getTime()}const d=new o.SessionInfo("Etc/UTC",e,t,i),u=h.inMilliseconds(),p=h.isDWM();let _;_=p?864e5:60*d.spec.maxTradingDayLength()*1e3;let m=0;m=h.isWeeks()?7:7-d.spec.weekEndsCount();const g=_/u,f=m*g;let v;if(a=g&&(f=_/6048e5*g);return f%1<=Number.EPSILON*Math.ceil(f)?Math.round(f):Math.ceil(f)}function T(e,t){const i=s.clone(t);return e.alignToSessionStart(i),s.cal_to_utc(s.get_timezone(e.timezone()),i)}function I(e,t){const i=s.utc_to_cal(t.timezone,+e);let r=s.get_day_of_week(i),n=s.get_minutes_from_midnight(i);const o=t.spec.findSession(t.spec.getWeekIndex(i),r,n).getEntry();return o.isOvernight()&&n>o.startOffset()+o.length()&&r===o.dayOfWeek()-1&&(r++,n-=1440),r===o.dayOfWeek()&&n>=o.startOffset()&&n{"use strict";i.d(t,{BusinessDay:()=>r});var s=i(2740);class r{constructor(e,t,i){this.year=e,this.month=t,this.day=i}toString(){return`${this.year}-${this.month}-${this.day}`}compareTo(e){return this.year>e.year||this.year===e.year&&this.month>e.month||this.year===e.year&&this.month===e.month&&this.day>e.day?1:this.year===e.year&&this.month===e.month&&this.day===e.day?0:-1}before(e){return-1===this.compareTo(e)}toCalendar(e){return s.get_cal(s.get_timezone("Etc/UTC"),this.year,this.month-1,this.day)}addDays(e){const t=this.toCalendar(s.get_timezone("Etc/UTC"));return s.add_date(t,e),r.fromCalendar(t)}static fromCalendar(e){return new r(s.get_year(e),s.get_month(e)+1,s.get_day_of_month(e))}}},83910:(e,t,i)=>{"use strict";var s;i.d(t,{SessionStage:()=>s}),function(e){e[e.PRE_SESSION=-1]="PRE_SESSION",e[e.POST_SESSION=-2]="POST_SESSION",e[e.LASTBAR_SESSION=-3]="LASTBAR_SESSION"}(s||(s={}))},40644:(e,t,i)=>{"use strict";i.d(t,{extrapolateBarsFrontByCount:()=>n,extrapolateBarsFrontToTime:()=>r});var s=i(83910);function r(e,t,i,s,n=!1){if(t>i){const o=r(e,i,t,s,n);return o.count=-o.count,o}return o(e,t,1,((e,t)=>t>i||0!==s&&e>s),n)}function n(e,t,i,s=!1){const r=i<0?-1:1;return o(e,t,r,((e,t)=>e>=i*r),s)}function o(e,t,i,r,n){let o=0,a=t;e.moveTo(a);let l=0,c=Number.MAX_VALUE,h=!1,d=t;const u=[];for(;!r(o,a);){if(l>15)throw new Error("Internal error 0x10 while extrapolating.");const r=e.indexOfBar(a);if(r===s.SessionStage.PRE_SESSION&&1===i)a=e.startOfBar(0),e.moveTo(a);else if(r===s.SessionStage.PRE_SESSION&&-1===i)a=e.startOfBar(s.SessionStage.PRE_SESSION),e.moveTo(a);else if(r===s.SessionStage.POST_SESSION&&1===i)a=e.startOfBar(s.SessionStage.POST_SESSION),e.moveTo(a);else{if(r===s.SessionStage.POST_SESSION&&-1===i)throw new Error("Internal error 0x12 while extrapolating.");{const p=e.startOfBar(r);if(p>t&&i>0||t>p&&i<0){if(h&&c===p)throw new Error("Internal error 0x11 while extrapolating.");h=!0,c=p,l=0,o++,d=p,n&&u.push(d)}if(0===r&&-1===i)a=p-1;else{a=e.startOfBar(r+i);const t=e.startOfBar(s.SessionStage.POST_SESSION);a>t&&(e.moveTo(t),a=e.startOfBar(0))}}}l++}return{time:d,times:u,count:o}}},69748:(e,t,i)=>{
"use strict";i.d(t,{SessionSpec:()=>y});var s,r=i(2740),n=i(29981),o=i(79324);function a(e,t){return e.compareTo(t)}!function(e){e[e.LeftFirst=-1]="LeftFirst",e[e.Unchanged=0]="Unchanged",e[e.RightFirst=1]="RightFirst"}(s||(s={}));class l{constructor(e,t,i){this._dayOfWeek=e,this._start=t,this._length=i}start(){return this._start+r.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start}sessionStartDaysOffset(){return this._start>=0?0:this._start%r.minutesPerDay==0?-Math.ceil(this._start/r.minutesPerDay):-Math.floor(this._start/r.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%r.minutesPerDay==0?-Math.ceil(e/r.minutesPerDay):-Math.floor(e/r.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset();return er.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*r.minutesPerDay+this._start}compareTo(e){const t=this.weight(),i=t+this._length,s=e.weight(),r=s+e._length;return t<=s&&ss?1:-1}contains(e){const t=60*r.get_hours(e)+r.get_minutes(e);let i=r.get_day_of_week(e)-this._dayOfWeek;i>0&&(i-=7);const s=i*r.minutesPerDay+t;return s>=this._start&&s=48&&e<=57}class m{constructor(){this.entries=[],this.firstDayOfWeek=r.MONDAY,this.weekEndsCount=-1,this.maxTradingDayLength=0}parseSessions(e,t){var i;let s=!1;this._clear(),this.timezone=e;const{hasErrors:r,spec:n}=this._parseFirstDayOfWeek(t);if("24x7"===n.toLowerCase())for(const e of u)this.entries.push(m._createSessionEntry(e,0,0,0,0));else{let e=!1;const t=new Map;for(const i of n.split("|")){const r=i.split(":");if(1!==r.length&&2!==r.length){s=!0,p.logError(`Bad session section: ${i}`);continue}const n=1===r.length;if(n){if(e){s=!0,p.logError(`Duplicated default section: ${i}`);continue}e=!0}const o=n?d:m._parseWorkingDays(r[1]);for(const e of o)n&&t.has(e)||t.set(e,r[0])}for(const e of u){const i=t.get(e);if(void 0!==i)for(const t of i.split(",")){const{hasErrors:i,sessionEntry:r}=m._parseSessionEntry(e,t);i&&(s=i),this.entries.push(r)}}}this.entries.sort(a);const o=new Map;for(const e of this.entries){const t=e.dayOfWeek();o.set(t,e.length()+(null!==(i=o.get(t))&&void 0!==i?i:0))}return this.maxTradingDayLength=0,o.forEach((e=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,e)})),this.weekEndsCount=7-o.size,s||r}static parseHolidaysAndCorrections(e,t,i){const s=new Map,n=new Map,o=e=>{const t=this._parseDay(e),i=t.toString(),s=n.get(i);return void 0!==s?s:(n.set(i,t),t)}
;if(""!==t){const e=[];for(const i of t.split(",")){if(8!==i.length)throw new Error(`bad holiday date: ${i}`);const t=o(i);s.set(t,e)}}if(""===i)return s;const a=r.get_timezone("Etc/UTC");for(const e of i.split(";")){const t=e.split(":");if(2!==t.length)throw new Error(`bad correction section: ${e}`);const i=[];if("dayoff"!==t[0])for(const e of t[0].split(","))i.push(this._parseSessionEntry(1,e).sessionEntry);for(const e of t[1].split(",")){if(8!==e.length)throw new Error(`bad correction date: ${e}`);const t=o(e),n=r.get_day_of_week(r.get_cal(a,t.year,t.month-1,t.day)),c=[];for(const e of i)c.push(new l(n,e.startOffset(),e.length()));s.set(t,c)}}return s}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=r.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const t=e.split(";");if(t.length>2)return p.logError(`Only one \`first day\` specification expected @ session ${e}`),{hasErrors:!0,spec:e};if(1===t.length)return{hasErrors:!1,spec:e};let i=1;let s=t[0].indexOf("-")>=0?NaN:parseInt(t[0]);return isNaN(s)&&(i=0,s=parseInt(t[1])),sr.SATURDAY?(p.logError(`Unexpected day index @ session: ${e}; day index ${s}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=s,{hasErrors:!1,spec:t[i]})}static _parseDay(e){const t=parseInt(e.substring(0,4)),i=parseInt(e.substring(4,6)),s=parseInt(e.substring(6,8));return new o.BusinessDay(t,i,s)}static _parseSessionEntry(e,t){let i=!1,s=t.split("-");2!==s.length&&(i=!0,p.logError(`Bad sessions entry: ${t}`),s=["0000","0000"]);let r=0,n=s[0];if(n.includes("F")){const e=n.split("F");n=e[0],r=""!==e[1]?parseInt(e[1]):1}let o=0,a=s[1];if(a.includes("F")){const e=a.split("F");a=e[0],o=""!==e[1]?parseInt(e[1]):1}if(!this._isCorrectSession(n)||!this._isCorrectSession(a))throw new Error(`Incorrect entry syntax: ${t}`);const l=n,c=a;return{hasErrors:i,sessionEntry:this._createSessionEntry(e,m._minutesFromHHMM(l),m._minutesFromHHMM(c),r,o)}}static _isCorrectSession(e){return 4===e.length&&_(e.charCodeAt(0))&&_(e.charCodeAt(1))&&_(e.charCodeAt(2))&&_(e.charCodeAt(3))}static _parseWorkingDays(e){const t=[];for(let i=0;i0&&(t-=s*r.minutesPerDay),n>0&&(i-=n*r.minutesPerDay);return new l(e,t,i-t)}}function g(e,t){return e.compareTo(t)<0}function f(e,t){const i=(0,n.lowerbound)(e,t,((e,t)=>-1===e.day.compareTo(t)));return i===e.length?null:e[i]}const v=621672192e5;class y{constructor(e="Etc/UTC",t="0000-0000",i="",s=""){this._entries=[],this._firstDayOfWeek=r.MONDAY,this._entriesHash=new Map,this._holidayAndCorrectionMap=new Map,this._holidaySessions=[],t=function(e){const t=e.lastIndexOf("/");return-1===t?e:e.slice(t+1)}(t);const n=new m;n.parseSessions(e,t),this._entries=n.entries,this._timezone=n.timezone,this._spec=t,this._firstDayOfWeek=n.firstDayOfWeek,this._weekEndsCount=n.weekEndsCount,this._maxTradingDayLength=n.maxTradingDayLength
;const o=m.parseHolidaysAndCorrections(e,i,s),a=r.get_timezone(e);this._isThereCorrections=""!==i||""!==s,o.forEach(((e,t)=>{this._holidayAndCorrectionMap.set(t.toString(),e),this._holidaySessions.push({day:t,sessions:e});const i=this.getWeekIndex(t.toCalendar(a));this._entriesHash.set(i,null)})),this._holidaySessions.sort(((e,t)=>e.day.compareTo(t.day)))}entries(){return this._entries}timezone(){return this._timezone}spec(){return this._spec}firstDayOfWeek(){return this._firstDayOfWeek}addSessionEntry(e,t,i,s,n){0===i&&(i=r.minutesPerDay),s===n&&i<=t&&(s+=1),s>0&&(t-=s*r.minutesPerDay),n>0&&(i-=n*r.minutesPerDay);const o=i-t;this._entries.push(new l(e,t,o))}longestSessionLength(){let e=0,t=0;for(const t of this._holidaySessions)t.sessions.forEach((t=>{e=Math.max(e,t.length())}));return this._entries.forEach((e=>{t=Math.max(t,e.length())})),Math.max(e,t)}isWeekEnd(e){const t=(0,n.lowerbound)(this._entries,new l(e,0,0),((e,t)=>e.dayOfWeek()this._entries.length-1||this._entries[t].dayOfWeek()!==e}isCalWeekEnd(e){const t=r.get_day_of_week(e);if(!this._isThereCorrections)return this.isWeekEnd(t);const i=o.BusinessDay.fromCalendar(e),s=this._holidayAndCorrectionMap.get(i.toString());return void 0===s?this.isWeekEnd(t):0===s.length}hasWeekEnds(){return this.weekEndsCount()>0}weekEndsCount(){return this._weekEndsCount}maxTradingDayLength(){return this._maxTradingDayLength}holidaysFromYearStart(e){if(!this._isThereCorrections)return 0;const t=r.get_timezone(this._timezone),i=new o.BusinessDay(r.get_year(e),r.JANUARY,1),s=o.BusinessDay.fromCalendar(e);let n=0;const a=this._selectHolidays(i,s);for(let e=0;et.start()%e==0&&t.length()%e==0))}indexOfSession(e,t,i){const s=this._getEntriesForWeek(e);let o=(0,n.lowerbound)(s,new l(t,i,0),g);if(o!==s.length)return new c(e,o,s);let a=e;const h=7-t+this._firstDayOfWeek-1;for(i=-(r.minutesPerDay-i+h*r.minutesPerDay);;){a++;const e=this._getEntriesForWeek(a);if(0!==e.length)return o=(0,n.lowerbound)(e,new l(this._firstDayOfWeek,i,0),g),new c(a,o,e)}}findSession(e,t,i,s=0){const r=this.indexOfSession(e,t,i),n=r.entries;let o=r.entryIndex;if(0!==s){const e=n[o].dayOfWeek(),t=s>0?1:-1;for(;;){const i=o+t;if(i<0||i>=n.length||n[i].dayOfWeek()!==e)break;o=i}}return new c(r.weekIndex,o,n)}getWeekIndex(e){if(!this._isThereCorrections)return 0;const t=r.get_day_of_week(e)-r.SUNDAY,i=r.get_timezone("Etc/UTC"),s=r.get_cal(i,r.get_year(e),r.get_month(e),r.get_day_of_month(e)-t);return Math.floor((s.getTime()+v)/1e3/86400/7)}correctTradingDay(e){const t=r.get_day_of_week(e),i=60*r.get_hours(e)+r.get_minutes(e),s=this.getWeekIndex(e),n=this.findSession(s,t,i,0),o=n.getEntry().dayOfWeek()-t+7*(n.weekIndex-s);return 0!==o&&r.add_date(e,o),e}alignToSessionStart(e,t=0){
const i=r.get_day_of_week(e),s=60*r.get_hours(e)+r.get_minutes(e),n=this.getWeekIndex(e),o=this.findSession(n,i,s,t),a=o.getEntry(),l=a.dayOfWeek()-i+7*(o.weekIndex-n);0!==l&&r.add_date(e,l);const c=a.startOffset();return r.set_hms(e,c/60,c%60,0,0,r.get_timezone(this._timezone)),a.length()}businessDaysToCalendarDays(e,t){let i=this.getWeekIndex(e),s=r.get_day_of_week(e),n=0,o=0;for(;oi);)e[a].dayOfWeek()=t)return n}i++,s=r.SUNDAY}return n}calendarDaysToBusinessDays(e,t){let i=this.getWeekIndex(e),s=r.get_day_of_week(e),n=0,o=0;for(;ni);)e[a].dayOfWeek()=t)return o}i++,s=r.SUNDAY}return o}alignToNearestSessionStart(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionStart.bind(this))}alignToNearestSessionEnd(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionEnd.bind(this))}leftBorderOfDailyBar(e){const t=this._getEntriesForDay(e);return 0===t.length?null:(t.sort(a),this._getLeftEntryBorder(e,t[0]))}bordersOfDailyBar(e){const t=this._getEntriesForDay(e);if(0===t.length)return null;t.sort(a);const i=this._getLeftEntryBorder(e,t[0]),s=t[t.length-1],n=r.clone(e);let o=60*(s.startOffset()+s.length())-1;const l=Math.floor(o/3600);return o-=3600*l,r.set_hms(n,l,o/60,o%60,0,r.get_timezone(this._timezone)),{from:i,to:n}}getEntriesForWeekByCalendar(e){const t=this.getWeekIndex(e);return this._getEntriesForWeek(t)}_getEntriesForWeek(e){let t=this._entriesHash.get(e);if(void 0===t)return this._entries;if(null!==t)return t;const i=r.get_timezone(this._timezone);t=this._entries.slice();const s=this._weekIndexToCalendar(e),n=this._weekIndexToCalendar(e+1),l=o.BusinessDay.fromCalendar(s),c=o.BusinessDay.fromCalendar(n),h=this._selectHolidays(l,c);for(const e of h){const s=e.day.toCalendar(i),n=r.get_day_of_week(s);t=t.filter((e=>e.dayOfWeek()!==n)),t=t.concat(e.sessions)}return t.sort(a),this._entriesHash.set(e,t),t}_selectHolidays(e,t){const i=[];let s=e;for(;;){const e=f(this._holidaySessions,s);if(null===e)return i;if(!e.day.before(t))return i;i.push(e),s=e.day.addDays(1)}}_weekIndexToCalendar(e){const t=1e3*(86400*e*7+86400)-v,i=r.get_cal_from_unix_timestamp_ms(r.get_timezone("Etc/UTC"),t),s=r.get_timezone("Etc/UTC");return r.get_cal(s,r.get_year(i),r.get_month(i),r.get_day_of_month(i))}_alignToNearestSessionValue(e,t,i){const s=r.get_day_of_week(e),n=60*r.get_hours(e)+r.get_minutes(e),o=this.getWeekIndex(e);let a=this.findSession(o,s,n);if(a.getEntry().contains(e)&&o===a.weekIndex||1===t)return i(a,r.clone(e),t);const l=a.getEntry(),h=l.contains(e),d=o===a.weekIndex,u=l.sessionStartDaysOffset()-l.dayOfWeek()>=0;if(h&&(d||u))return i(a,r.clone(e),t);let p=a.entryIndex-1;if(p<0){let e=a.weekIndex,t=a.entries;for(;p<0;)e--,t=this._getEntriesForWeek(e),p+=t.length;a=new c(e,p,t)
}else a=new c(a.weekIndex,p,a.entries);return i(a,r.clone(e),t)}_entrySessionStart(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*e.start()))}_entrySessionEnd(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*(e.start()+e.length())-1))}_entrySessionValue(e,t,i,s){let n=r.get_day_of_week(t);const o=e.getEntry();let a=o.dayOfWeek()-o.sessionStartDaysOffset();const l=this.getWeekIndex(t);let c=e.weekIndex-l,h=!1;if(a0&&i>=0||c<0&&i<0)&&r.add_date(t,7*c),!o.contains(t)){let e=a-n;h&&i<0&&(e=-(7-a+n)),r.add_date(t,e),n=r.get_day_of_week(t)}o.isOvernight()&&n===o.dayOfWeek()&&r.add_date(t,-o.sessionStartDaysOffset());let d=s(o);const u=Math.floor(d/3600);return d-=3600*u,r.set_hms(t,u,d/60,d%60,0,r.get_timezone(this._timezone)),t}_getEntriesForDay(e){const t=r.get_day_of_week(e);return this._getEntriesForWeek(this.getWeekIndex(e)).filter((e=>e.dayOfWeek()===t))}_getLeftEntryBorder(e,t){const i=r.clone(e),s=t.startOffset();return r.set_hms(i,s/60,s%60,0,0,r.get_timezone(this._timezone)),i}}},15716:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>r});var s=i(3070);function r(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 18:case 20:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(null!=t?t:"close");default:return(0,s.barFunction)("close","open")}}},41925:(e,t,i)=>{"use strict";i.d(t,{BarsMarksContainer:()=>g});var s=i(50151),r=i(31955),n=i(56840),o=i.n(n),a=i(56570),l=i(85049),c=i(37265),h=i(68805),d=i(29137),u=i(44672);const p=(0,r.getLogger)("Chart.BarsMarksContainer"),_=Math.round(new Date(2037,0,1).getTime()/1e3);var m;!function(e){e[e.MaxPlatesPerBar=10]="MaxPlatesPerBar"}(m||(m={}));class g extends d.DataSource{constructor(e,t,i){const r=e.onWidget();let n;n=r?!e.hideIdeas():!!a.enabled("bars_marks")&&o().getBool("BarsMarksContainer.visibile",!1),t.merge({visible:n}),t.childs().visible.subscribe(null,(t=>{r||e.isSnapshot()||!a.enabled("bars_marks")||o().setValue("BarsMarksContainer.visibile",!!t.value())})),super(i),this._paneViews=[],this._model=e,this._properties=t,this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this._lastRange=null;const l=this._model.mainSeries();l.onSymbolIntervalChanged().subscribe(this,this.clearMarks),l.dataEvents().symbolResolved().subscribe(this,this.clearMarks),l.dataEvents().completed().subscribe(this,(()=>{var e,t;const i=l.data();if(0===i.size())return;const r=(0,s.ensureNotNull)(i.first()).index,n=(0,s.ensureNotNull)(i.last()).index,o=this.timeScale();this.getData({start:null!==(e=o.indexToTimePoint(r))&&void 0!==e?e:1/0,end:null!==(t=o.indexToTimePoint(n))&&void 0!==t?t:-1/0})})),this._initialize(),this._pinnedTooltips={}}destroy(){const e=this._model.mainSeries();e.onSymbolIntervalChanged().unsubscribeAll(this),e.dataEvents().symbolResolved().unsubscribeAll(this),e.dataEvents().completed().unsubscribeAll(this),super.destroy()}properties(){return this._properties}marks(){return this._marks}pinTooltip(e,t){this._pinnedTooltips[e]=t}
timeScale(){return this._model.timeScale()}getIntervalInTicks(){const e=this._model.mainSeries().properties().childs().interval.value(),t=l.Interval.parse(e);if(!t.isValid())throw new TypeError("Unexpected interval");return t.isRange()?60:t.inMilliseconds()/1e3}getVisibleTickMarksRange(){var e,t;if(this.timeScale().isEmpty())return{start:0,end:0};const i=(0,s.ensureNotNull)(this.timeScale().visibleBarsStrictRange()),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(this.timeScale().points().range().value());if(!(i.lastBar()>r&&i.firstBar(){var r,n;const o=this._marks[s],a=o.tickmark;a>=(null!==(r=t.start)&&void 0!==r?r:1/0)&&a<=(null!==(n=t.end)&&void 0!==n?n:-1/0)+i&&e.push(o)})),e}getPublishedPlates(){const e={};return window.is_authenticated?(this.getVisibleRangePlates().forEach((t=>{t.is_public&&(this._pinnedTooltips[t.id]||t.user__id===window.user.id)&&(e[t.id]=t)})),e):e}filterDisplayedPlates(e){const t=e.reduce(((e,t)=>{const i=this._getIndex(t.tickmark);return null!==i&&(e[i]=e[i]||[],e[i].push(t)),e}),{});return Object.keys(t).reduce(((e,i)=>{let s=t[i];return s=s.sort(((e,t)=>t.views_count-e.views_count)),s=s.slice(0,10),e.concat(s)}),[])}getPlatesViewData(){var e,t,i;const r=this._model.mainSeries();if(r.data().isEmpty())return[];const n=(0,h.isPriceSourceStyle)(r.style())?r.barFunction():null,o=this.filterDisplayedPlates(this.getVisibleRangePlates()),a={},l=null!==(e=this._model.lastHittestData())&&void 0!==e?e:this._model.lastSelectedHittestData();let c=null;null!==l&&this._model.hoveredSource()===this&&(c=null!==(t=l.activeItem)&&void 0!==t?t:null);const d=[];for(const e of o){const t=(0,s.ensureNotNull)(this._getIndex(e.tickmark)),i=this._getBar(t);if(null===i)continue;const r=this._layout(e.direction),o=this._theme(e.direction),l=c===e.id,h=this.timeScale().indexToCoordinate(t),u=this._offset(r,i,n),p=(0,s.ensureNotNull)(this.priceScale()).isInverted();let _=0;t in a||(a[t]={up:0,down:0}),_=a[t][r]++,d.push({id:e.id,x:h,y:u,yInverted:p,order:_,direction:r,theme:o,hovered:l,pinned:!0===this._pinnedTooltips[e.id],user__id:e.user__id,label:e.label,labelFontColor:e.labelFontColor||"#444",minSize:e.minSize||5,...this._plateViewData(e)})}const u=d.filter((e=>!0===e.hovered));for(let e=0;ee.hovered&&!t.hovered?1:0)),d}priceAxisViews(){return null}updateAllViews(e){for(const t of this._paneViews)t.update(e)}updateAllViewsAndRepaint(){this.updateAllViews((0,u.sourceChangeEvent)(this.id())),this._model.updateSource(this)}roundRange(e){return{start:Math.round(e.start),
end:Math.round(e.end)}}refreshData(){null!==this._lastRange&&this.getData(this._lastRange)}getData(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._lastRange=e,e.end=_,this._pushGetDataStack(Object.assign({},e))):p.logError("Wrong range")}clearMarks(){this._abortAllRequests(),this._marks={},this._loadedRange=null}isUserDeletable(){return!1}isSavedInChart(e){return!1}isSpeciallyZOrderedSource(){return!0}showInObjectTree(){return!1}_plateViewData(e){return{}}_layout(e){switch(e){default:case 0:case 2:case 3:case 4:case 5:case 6:return"up";case 1:return"down"}}_theme(e){switch(e){default:case 0:return"neutral";case 1:case 5:return"green";case 2:case 6:return"red";case 3:return"yellow";case 4:return"blue"}}_offset(e,t,i){let r;switch(e){default:case"up":r=null===i?t[2]:i(t);break;case"down":r=null===i?t[3]:i(t)}return(0,s.ensureNotNull)(this.priceScale()).priceToCoordinate(r,(0,s.ensureNotNull)((0,s.ensureNotNull)(this.ownerSource()).firstValue()))}_getIndex(e){return this.timeScale().timePointToIndex(e)}_getBar(e){return this._model.mainSeries().data().valueAt(e)}_rangeDifference(e){return e=Object.assign({start:1/0,end:-1/0},e),this._loadedRange&&(e.startthis._loadedRange.end&&(e.start=this._loadedRange.end)),e}_rangeUnion(e,t){return e=Object.assign({start:1/0,end:-1/0},e),t&&(e.start=Math.min(t.start,e.start),e.end=Math.max(t.end,e.end)),e}_pushGetDataStack(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(e,this._collectedRange),this._getDataTimeout=setTimeout((()=>{this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null}),300)):p.logError("Wrong tickmark range")}_abortAllRequests(){this._requests.forEach((e=>{e.cancel()})),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null}}},91988:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>r});var s=i(50151);class r{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},93815:(e,t,i)=>{"use strict";i.d(t,{ChartModelBase:()=>Rs});var s=i(12481),r=i(43370),n=i(27788),o=i(50151),a=i(86441),l=i(24377),c=i(19625),h=i(11542),d=i(45345),u=i(85662),p=i(51768),_=i(14426),m=i(76422),g=i(11417),f=i(91140),v=i(66666),y=i(29981),S=i(630);function b(e){return(0,S.isLineTool)(e)&&e.boundToSymbol()||!1}class w{constructor(){this._items=[],this._set=new Set,this._dataSourcesCache=null,this._customSourcesCache=null,this._lineSourcesCache=null}isEmpty(){return 0===this._items.length}add(e){
if(this._items.length>0&&!b(this._items[0])&&this.clear(),b(e)){const t=(0,y.lowerbound)(this._items,e,((e,t)=>e.zorder()!(0,v.isDataSource)(e)))),this._customSourcesCache}checkLineToolSelection(){this._items.forEach((e=>(0,S.isLineTool)(e)&&e.calcIsActualSymbol())),this._items=this._items.filter((e=>!(0,S.isLineTool)(e)||e.isActualSymbol())),this._invalidateCache()}remove(e){this._items=this._items.filter((t=>t!==e)),this._set.delete(e),this._invalidateCache()}clear(){this._items=[],this._set.clear(),this._invalidateCache()}_invalidateCache(){this._customSourcesCache=null,this._dataSourcesCache=null,this._lineSourcesCache=null}}var C,P,x=i(65383),T=i(21239),I=i(67317),M=i(85049),A=i(55917),L=i(12988),k=i(68979),D=i(15938);!function(e){e[e.BorderSize=1]="BorderSize"}(C||(C={})),function(e){e[e.AdditionalInnerPadding=4]="AdditionalInnerPadding",e[e.HorzPadding=4]="HorzPadding",e[e.VertPadding=2.5]="VertPadding",e[e.LineSpacing=2]="LineSpacing"}(P||(P={}));class E{constructor(e){this._rendererOptions={borderSize:1,additionalPaddingInner:0,fontSize:NaN,font:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,lineSpacing:0},this._chartModel=e}options(){const e=this._rendererOptions,t=this._chartModel.properties().childs(),i=t.scalesProperties.childs().fontSize.value();return e.fontSize!==i&&(e.fontSize=i,e.font=(0,k.makeFont)(i,D.CHART_FONT_FAMILY,""),e.paddingTop=i/12*2.5,e.paddingBottom=i/12*2.5,e.paddingInner=i/12*4,e.additionalPaddingInner=i/12*4,e.paddingOuter=i/12*4,e.lineSpacing=i/12*2),e.color=t.scalesProperties.childs().textColor.value(),e.paneBackgroundColor=t.paneProperties.childs().background.value(),this._rendererOptions}}var V=i(16638);class B extends class{constructor(e,t){this._destroyed=!1,this._callbacks=[],this._resource={pendingResource:e},e.then((e=>{var t;if(this._destroyed)null===(t=this._destroyFn)||void 0===t||t.call(this,e);else{for(const t of this._callbacks)t(e);this._resource.resource=e}})).finally((()=>{this._callbacks=[]}))}destroy(){var e;this._resource.resource&&(null===(e=this._destroyFn)||void 0===e||e.call(this,this._resource.resource)),this._resource={pendingResource:Promise.reject("Resource is destroyed").catch((()=>{}))},this._callbacks=[],this._destroyed=!0}callFunction(e){this._destroyed||(this._resource.resource?e(this._resource.resource):this._callbacks.push(e))}get(){
return this._destroyed||!this._resource.resource?null:this._resource.resource}promise(){return this._resource.pendingResource}}{constructor(e){super(e,(e=>e.destroy())),this._sessionsState=null,e.then((()=>{if(!this._destroyed&&this._sessionsState){const{state:e,includeData:t}=this._sessionsState;this.restoreState(e,t),this._sessionsState=null}}))}state(e){var t,i,s,r;return null!==(r=null!==(i=null===(t=this.get())||void 0===t?void 0:t.state(e))&&void 0!==i?i:null===(s=this._sessionsState)||void 0===s?void 0:s.state)&&void 0!==r?r:null}restoreState(e,t){const i=this.get();i?(e&&i.restoreState(e,t),this._sessionsState=null):this._sessionsState=e?{state:e,includeData:t}:null}}var R=i(72708),N=i(52033),O=i(64147),F=i(91676),W=i(62288),H=i(50788),z=i(92158),U=i(96001),j=i(35039),G=i(29137),q=i(22365),$=i(24708),K=i(75919),Y=i(2844);class Z extends K.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._widthCache=new Y.TextWidthCache}setData(e){this._data=e}hitTest(e){return null}_drawImpl(e){if(!this._data)return;const{lines:t,color:i}=this._data,{context:s,mediaSize:{width:r,height:n}}=e;s.fillStyle=i;let o=0;const a=[];for(const e of t){if(!e.text)continue;s.font=e.font;const t=this._widthCache.measureText(s,e.text),i=t>r?r/t:1;a.push(i),o+=e.lineHeight*i}let l=Math.max((n-o)/2,0),c=-1;for(const e of t){if(!e.text)continue;c+=1;const t=a[c];s.save(),s.translate(r/2,l),s.textBaseline="top",s.textAlign="center",s.font=e.font,s.scale(t,t),s.fillText(e.text,0,e.vertOffset),s.restore(),l+=e.lineHeight*t}}}class X{constructor(e,t){this._renderer=new Z,this._invalidated=!0,this._model=e,this._watermark=t}update(){this._invalidated=!0}renderer(){return this._invalidated&&this._updateImpl(),this._renderer}_updateImpl(){const e=this._watermark.properties().childs(),t=this._model.mainSeries(),i=t.symbolInfo();if(!i||!e.visibility.value())return void this._renderer.setData(null);let s;{const e=this._model.watermarkContentProvider(),r=e?e({symbolInfo:i,interval:t.interval()}):null;s=r?r.map((e=>({text:e.text,font:(0,k.makeFont)(e.fontSize,D.CHART_FONT_FAMILY),lineHeight:e.lineHeight,vertOffset:e.vertOffset}))):null}let r=i.name;if(/QUANDL/.test(i.exchange)){const e=r.split(/\//);e.length&&(r=e[e.length-1])}const n={description:i.description,short_description:i.short_description,pro_name:i.pro_name,short_name:i.name,local_description:i.local_description,language:i.language},o=s||[{text:r?`${r}, ${(0,$.translatedIntervalString)(t.interval())}`:"",font:(0,k.makeFont)(96,D.CHART_FONT_FAMILY),lineHeight:117,vertOffset:0},{text:(0,q.getTranslatedSymbolDescription)(n)||"",font:(0,k.makeFont)(48,D.CHART_FONT_FAMILY),lineHeight:58,vertOffset:5}];this._renderer.setData({color:e.color.value(),lines:o})}}const J="symbolWatermark";class Q extends G.DataSource{constructor(e){super(),this._properties=(0,U.watermarkProperty)(),(0,j.applyDefaultsOverrides)(this._properties,void 0,!1,J),this._properties.subscribe(this,(()=>e.updateSource(this))),this._paneView=new X(e,this)}destroy(){
this._properties.unsubscribeAll(this),super.destroy()}name(){return"watermark"}properties(){return this._properties}restorePropertiesDefaults(){(0,U.restoreWatermarkPropertyDefaults)()}applyOverrides(e){(0,j.applyPropertiesOverrides)(this._properties,void 0,!1,e,J)}paneViews(){return[this._paneView]}updateAllViews(e){super.updateAllViews(e),this._paneView.update()}}var ee,te=i(56570),ie=i(31955),se=i(92184),re=i(18112),ne=i(34391),oe=i(68159),ae=i(37265),le=i(56991),ce=i(45579),he=i(2718);function de(e,t,i){return i.hasDataSource(t)?_e(t,i)===e:!!i.isMainPane()&&_e(i.model().mainSeries(),i)===e}!function(e){e.Trading="trading",e.Drawing="drawing",e.DrawingForAllSymbols="drawingsForAllSymbols",e.Phantom="phantom",e.RestRowSources="restRowSources",e.LegendViewSources="legendViewSources",e.LeftPriceScale="leftPriceScale",e.RightPriceScale="rightPriceScale",e.OverlayPriceScale="overlayPriceScale",e.MultipaneSources="multipane",e.AllWithoutMultipane="allWithoutMultipane",e.HitTest="hitTest",e.General="general",e.Price="price",e.ExceptSpecial="exceptSpecial",e.AllSorted="allSorted",e.VisibleSorted="visibleSorted"}(ee||(ee={}));const ue=new Map([["price",e=>(0,ce.isPriceDataSource)(e)],["trading",e=>(0,S.isTrading)(e)],["drawing",e=>(0,S.isLineTool)(e)&&!(0,S.isTrading)(e)&&!e.isPhantom()],["drawingsForAllSymbols",e=>(0,S.isLineTool)(e)&&!(0,S.isTrading)(e)&&!e.isPhantom()],["phantom",e=>(0,S.isLineTool)(e)&&e.isPhantom()],["restRowSources",e=>!(0,S.isLineTool)(e)&&!(0,S.isTrading)(e)],["legendViewSources",(e,t)=>t.hasDataSource(e)&&((0,ce.isPriceDataSource)(e)||(0,S.isStudyLineTool)(e))],["leftPriceScale",de.bind(null,"left")],["rightPriceScale",de.bind(null,"right")],["overlayPriceScale",de.bind(null,"overlay")],["multipane",(e,t)=>!t.hasDataSource(e)],["allWithoutMultipane",(e,t)=>t.hasDataSource(e)]]),pe=new Map([["price","visibleSorted"],["trading","visibleSorted"],["drawing","visibleSorted"],["drawingsForAllSymbols","allSorted"],["phantom","visibleSorted"],["restRowSources","visibleSorted"],["legendViewSources","visibleSorted"],["leftPriceScale","visibleSorted"],["rightPriceScale","visibleSorted"],["overlayPriceScale","visibleSorted"],["multipane","visibleSorted"],["allWithoutMultipane","visibleSorted"]]);function _e(e,t){const i=e.priceScale();return null===i?"overlay":t.priceScalePosition(i)}class me{constructor(e){this._groupedSources=new Map,this._sources=null,this._pane=e}clear(){this._groupedSources.clear(),this._sources=null}destroy(){this.clear()}all(){return this._groupedSources.has("visibleSorted")||this._sortSources(),(0,o.ensureDefined)(this._groupedSources.get("visibleSorted"))}allIncludingHidden(){return this._groupedSources.has("allSorted")||this._sortSources(),(0,o.ensureDefined)(this._groupedSources.get("allSorted"))}allWithoutMultipane(){return this._getSourcesByGroupType("allWithoutMultipane")}allExceptSpecialSources(){if(!this._groupedSources.has("exceptSpecial")){const e=this.allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource()));this._groupedSources.set("exceptSpecial",e)}return(0,
o.ensureDefined)(this._groupedSources.get("exceptSpecial"))}tradingSources(){return this._getSourcesByGroupType("trading")}priceSources(){return this._getSourcesByGroupType("price")}lineSources(){return this._getSourcesByGroupType("drawing")}lineSourcesForAllSymbols(){return this._getSourcesByGroupType("drawingsForAllSymbols")}phantomSources(){return this._getSourcesByGroupType("phantom")}allExceptLineAndTradingSources(){return this._getSourcesByGroupType("restRowSources")}hitTestSources(){if(!this._groupedSources.has("hitTest")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("hitTest",(0,he.sortSources)(e,this._pane))}return(0,o.ensureDefined)(this._groupedSources.get("hitTest"))}generalSources(){if(!this._groupedSources.has("general")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("general",(0,he.sortSources)(e,this._pane))}return(0,o.ensureDefined)(this._groupedSources.get("general"))}leftPriceScalesSources(){return this._getSourcesByGroupType("leftPriceScale")}rightPriceScalesSources(){return this._getSourcesByGroupType("rightPriceScale")}overlayPriceScaleSources(){return this._getSourcesByGroupType("overlayPriceScale")}multipaneSources(){return this._getSourcesByGroupType("multipane")}legendViewSources(){return this._getSourcesByGroupType("legendViewSources")}_getSourcesByGroupType(e){const t=(0,o.ensureDefined)(pe.get(e));return this._groupedSources.has(t)?this._groupedSources.has(e)||this._groupSources(e):(this._sortSources(),this._groupSources(e)),(0,o.ensureDefined)(this._groupedSources.get(e))}_sortSources(){null===this._sources&&(this._sources=this._pane.dataSources());const e=this._pane.model().multiPaneSources(this._pane),t=(0,he.sortSources)(this._sources.concat(e),this._pane),i=t.filter((e=>!(0,S.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()&&e.isActualUnit()));this._groupedSources.set("allSorted",t),this._groupedSources.set("visibleSorted",i)}_groupSources(e){const t=(0,o.ensureDefined)(pe.get(e)),i=ue.get(e);if(void 0!==i){const s=(0,o.ensureDefined)(this._groupedSources.get(t)).filter((e=>i(e,this._pane)));this._groupedSources.set(e,s)}}}var ge=i(15764),fe=i(93280),ve=i(49256),ye=i(32549),Se=i(60074),be=i(68805),we=i(33515),Ce=i(60521),Pe=i(9859);function xe(e,t,i){const s=e.div(t).toNumber();return Math.abs(Math.round(s)-s)100)throw new Error("something wrong with base")}}}tickSpan(e,t,i){const s=0===this._base?0:1/this._base,r=Math.min(1e-14,(e-t)/1e3);let n=Math.pow(10,Math.max(0,Math.ceil((0,Pe.log10)(e-t))));if(!isFinite(n))return 1e305
;let o=0,a=this._integralDividers[0];for(;;){const e=(0,Pe.greaterOrEqual)(n,s,r)&&n>s+r,t=(0,Pe.greaterOrEqual)(n,i*a,r),l=(0,Pe.greaterOrEqual)(n,1,r),c=new Ce.Big(n).div(a),h=0===s||xe(c,s,r);if(!(e&&t&&l&&h))break;n=c.toNumber(),a=this._integralDividers[++o%this._integralDividers.length]}if(n<=s+r&&(n=s),n=Math.max(1,n),this._fractionalDividers.length>0&&(0,Pe.equal)(n,1,r))for(o=0,a=this._fractionalDividers[0];;){const e=(0,Pe.greaterOrEqual)(n,i*a,r)&&n>s+r,t=new Ce.Big(n).div(a),l=0===s||xe(t,s,r);if(!e||!l)break;n=t.toNumber(),a=this._fractionalDividers[++o%this._fractionalDividers.length]}return n}}class Ae{constructor(e,t,i,s){this._marks=null,this._priceScale=e,this._base=t,this._coordinateToLogicalFunc=i,this._logicalToCoordinateFunc=s}base(){return this._base}setBase(e){if(e<0)throw new Error("base < 0");this._base=e}tickSpan(e,t,i=0){if(e{const o=r.tickSpan(e,t,n);return o>i?Math.min(o,s):s}),1/0);return o>0&&isFinite(o)?o:e-t}rebuildTickMarks(){this._marks=null}marks(){return null===this._marks&&(this._marks=this._rebuildTickMarksImpl()),this._marks}_fontHeight(){return this._priceScale.fontSize()}_tickMarkHeight(){return Math.ceil(2.5*this._fontHeight())}_rebuildTickMarksImpl(){const e=this._priceScale,t=[],i=e.mainSource();if(e.isEmpty()||!e.hasCalculatedPriceRange()||null===i)return t;let s=i.firstValue();null===s&&(s=0);const r=e.height(),n=this._coordinateToLogicalFunc(r-1,s),o=this._coordinateToLogicalFunc(0,s),a=Math.max(n,o),l=Math.min(n,o);if(a===l)return t;let c=this.tickSpan(a,l),h=a%c;h+=h<0?c:0;const d=a>=l?1:-1;let u=null;const p=e.formatter();let _=NaN;for(let i=a-h;i>l;i-=c){i===_&&(c=this.tickSpan(a,l,c)),_=i;const r=this._logicalToCoordinateFunc(i,s);null!==u&&Math.abs(r-u){const e=this.mainSource();if(e&&e.model()){const t=e.model().paneForSource(e);t&&e.model().updatePane(t)}})),this._scalesProperties.subscribe(this,(()=>{this._marksCache=null})),this._properties.childs().lockScale.subscribe(this,this._updateResetAvailableValue),this._properties.childs().autoScale.subscribe(this,this._updateResetAvailableValue),this._updateResetAvailableValue(),this.setId((0,se.randomHash)())}id(){return this._id}setId(e){this._id=e}isLog(){return this._properties.childs().log.value()}isPercentage(){return this._properties.childs().percentage.value()}isInverted(){return this._properties.childs().isInverted.value()}isIndexedTo100(){return this._properties.childs().indexedTo100.value()}isAutoScale(){return this._properties.childs().autoScale.value()&&!this.isLockScale()}isLockScale(){return this._properties.childs().lockScale.value()}isRegular(){return!this.isPercentage()&&!this.isLog()&&!this.isIndexedTo100()}isScaleSeriesOnly(){return this._scaleSeriesOnly}properties(){return this._properties}height(){return this.m_height}setHeight(e){this.m_height!==e&&(this.m_height=e,this._invalidateInternalHeightCache(),this._marksCache=null)}internalHeight(){if(this._internalHeightCache)return this._internalHeightCache;const e=this.height()-this.topPixelMargin()-this.bottomPixelMargin();return this._internalHeightCache=e,e}fontSize(){return this._scalesProperties.childs().fontSize.value()}priceRange(){return this._makeSureItIsValid(),this._priceRange}setPriceRange(e,t,i){if(!(e instanceof fe.PriceRange))throw new TypeError("incorrect price range");const s=this._priceRange;if(!t&&fe.PriceRange.compare(s,e))return;const r=null!==this._maxPriceRange&&this._maxPriceRange.containsStrictly(e),n=null!==this._minPriceRange&&e.containsStrictly(this._minPriceRange);this.isLockScale()&&!t&&(r||n)||(this._marksCache=null,this._priceRange=e,i||this._priceRangeChanged.fire(s,e))}setMinPriceRange(e){this._minPriceRange=e
}setMaxPriceRange(e){this._maxPriceRange=e}recalculatePriceRangeOnce(){this._recalculatePriceRangeOnce=!0}priceRangeShouldBeRecalculatedOnce(){if(!this._recalculatePriceRangeOnce||this.isLockScale())return!1;const e=this.mainSource();return null!==e&&e.priceRangeReady()}priceRangeChanged(){return this._priceRangeChanged}mode(){const e=this._properties.childs();return{autoScale:e.autoScale.value(),lockScale:e.lockScale.value(),percentage:e.percentage.value(),indexedTo100:e.indexedTo100.value(),log:e.log.value()}}setMode(e){const t={},i=this.mode(),s=this._properties.state();let r=null;void 0!==e.autoScale&&e.autoScale!==s.autoScale&&(t.autoScale=e.autoScale,this._setAutoScaleValueWithDependentProperties(e.autoScale)),void 0!==e.lockScale&&e.lockScale!==s.lockScale&&(t.lockScale=e.lockScale,this._setLockScaleValueWithDependentProperties(e.lockScale)),void 0!==e.percentage&&e.percentage!==s.percentage&&(t.percentage=e.percentage,this._setPercentageValueWithDependentProperties(e.percentage),this._invalidatedForRange.isValid=!1),void 0!==e.indexedTo100&&e.indexedTo100!==s.indexedTo100&&(t.indexedTo100=e.indexedTo100,this._setIndexedTo100ValueWithDependentProperties(e.indexedTo100),this._invalidatedForRange.isValid=!1),void 0!==e.log&&e.log!==s.log&&(t.log=e.log,this._setLogValueWithDependentProperties(e.log));const n=this._properties.childs();s.log&&!n.log.value()&&(this._canConvertPriceRangeFromLog(this._priceRange)?(r=this._convertPriceRangeFromLog(this._priceRange),null!==r&&this.setPriceRange(r)):n.autoScale.setValue(!0)),!s.log&&n.log.value()&&(r=this._convertPriceRangeToLog(this._priceRange),null!==r&&this.setPriceRange(r)),s.autoScale!==n.autoScale.value()&&n.autoScale.listeners().fire(n.autoScale,""),s.autoScaleDisabled!==n.autoScaleDisabled.value()&&n.autoScaleDisabled.listeners().fire(n.autoScaleDisabled,""),s.lockScale!==n.lockScale.value()&&n.lockScale.listeners().fire(n.lockScale,""),s.percentage!==n.percentage.value()&&(n.percentage.listeners().fire(n.percentage,""),this.updateFormatter()),s.indexedTo100!==n.indexedTo100.value()&&(n.indexedTo100.listeners().fire(n.indexedTo100,""),this.updateFormatter()),s.percentageDisabled!==n.percentageDisabled.value()&&n.percentageDisabled.listeners().fire(n.percentageDisabled,""),s.log!==n.log.value()&&n.log.listeners().fire(n.log,""),s.logDisabled!==n.logDisabled.value()&&n.logDisabled.listeners().fire(n.logDisabled,""),void 0===t.log&&void 0===t.percentage&&void 0===t.lockScale&&void 0===t.autoScale&&void 0===t.indexedTo100||this._modeChanged.fire(i,this.mode())}modeChanged(){return this._modeChanged}isEmpty(){return this._makeSureItIsValid(),0===this.m_height||!this._priceRange||this._priceRange.isEmpty()}hasCalculatedPriceRange(){return this._hasCalculatedPriceRange}canDetachSource(e){return this.m_dataSources.some((t=>t!==e&&(0,ce.isPriceDataSource)(t)&&!((0,R.isStudy)(t)&&t.isLinkedToSeries())))}updateAllViews(e){const t=this._getSourcesToUpdateViews();for(const i of t)i.updateAllViews(e)}logFormula(){return this._logFormula}state(){var e
;const t=this._properties.childs();return{id:this._id,m_priceRange:this.isAutoScale()?null:(null===(e=this.priceRange())||void 0===e?void 0:e.serialize())||null,m_isAutoScale:this.isAutoScale(),m_isPercentage:t.percentage.value(),m_isIndexedTo100:t.indexedTo100.value(),m_isLog:t.log.value(),m_isLockScale:this.isLockScale(),m_isInverted:this.isInverted(),m_topMargin:this._margins.top,m_bottomMargin:this._margins.bottom,alignLabels:t.alignLabels.value(),logFormula:(0,ae.clone)(this._logFormula),hasCalculatedPriceRange:this._hasCalculatedPriceRange}}restoreState(e){var t;let i=e.m_priceRange;if(void 0===i)throw new TypeError("invalid state");if(void 0===e.m_isAutoScale)throw new TypeError("invalid state");void 0!==e.id&&(this._id=e.id);const s={autoScale:e.m_isAutoScale};void 0!==e.m_isPercentage&&(s.percentage=e.m_isPercentage),void 0!==e.m_isIndexedTo100&&(s.indexedTo100=e.m_isIndexedTo100),void 0!==e.m_isLog&&(s.log=e.m_isLog),void 0!==e.m_isLockScale&&(s.lockScale=e.m_isLockScale),void 0!==e.m_isInverted&&this._properties.childs().isInverted.setValue(e.m_isInverted),this.setMode(s),this._hasCalculatedPriceRange=null!==(t=e.hasCalculatedPriceRange)&&void 0!==t?t:null!==i,i?(i instanceof fe.PriceRange||(i=new fe.PriceRange(i)),this.setPriceRange(i,!0)):this.clearPriceRange(),e.logFormula&&(this._logFormula=e.logFormula),void 0!==e.m_topMargin&&(this._margins.top=e.m_topMargin),void 0!==e.m_bottomMargin&&(this._margins.bottom=e.m_bottomMargin),void 0!==e.alignLabels&&this._properties.childs().alignLabels.setValue(e.alignLabels),this._mainSource=null,this._scaleSeriesOnly=!1}priceToLogical(e){return this.isLog()&&e?(0,ve.toLog)(e,this._logFormula):e}logicalToPrice(e){return this.isLog()?(0,ve.fromLog)(e,this._logFormula):e}priceToCoordinate(e,t){const i=this._priceToPercentOrIndexedTo100IfNeeded(e,t);return this._logicalToCoordinate(i)}coordinateToPrice(e,t){let i=this._coordinateToLogical(e);return this.isPercentage()?i=(0,ve.fromPercent)(i,t):this.isIndexedTo100()&&(i=(0,ve.fromIndexedTo100)(i,t)),i}mainSource(){if(null!==this._mainSource)return this._mainSource;let e;for(const t of this._priceDataSources){if(t instanceof ye.Series){e=t;break}e||(e=t)}return this._mainSource=e||null,this._correctedMarginsCache=null,this._mainSource}priceToCoordinateFn(e){this._makeSureItIsValid();const t=this.bottomPixelMargin(),i=(0,o.ensureNotNull)(this.priceRange()),s=i.minValue(),r=i.maxValue(),n=this.internalHeight()-1,a=this.isInverted(),l=n/(r-s),c=this.m_height,h=e=>{const i=t+l*(e-s);return a?i:c-1-i};return this.isPercentage()?t=>h((0,ve.toPercent)(t,e)):this.isIndexedTo100()?t=>h((0,ve.toIndexedTo100)(t,e)):this.isLog()?e=>h((0,ve.toLog)(e,this._logFormula)):e=>h(e)}pricesArrayToCoordinates(e,t,i){this._makeSureItIsValid();const s=this.bottomPixelMargin(),r=(0,o.ensureNotNull)(this.priceRange()),n=r.minValue(),a=r.maxValue(),l=this.internalHeight()-1,c=this.isInverted(),h=l/(a-n);void 0===i&&(i=e.length);const d=this.isPercentage(),u=this.isIndexedTo100(),p=this.isLog(),_=this.m_height;let m,g;for(let r=0;re?(0,ve.toLog)(e,this._logFormula):e),0===s.length)return;const h="open"in s[0],d="close"in s[0];if(null!==c)for(let e=0;e0){const t=(0,we.unitConvertibleGroups)(d,p,e);l=(0,y.intersect)(l,new Set(t))}h+=1}if(null!==t)for(const i of this._priceDataSources){if(u.includes(i))continue;const c=i;if(!c.isUnitSource()||!c.isVisible())continue;const h=c.unit();if(null===h){t=null;break}s.add(h),d+=1;const p=(0,o.ensureNotNull)(c.symbolSource()),_=p.symbolInfo();if(null===_){t=null;break}if(l.size>0){const t=(0,we.unitConvertibleGroups)(_,h,e);l=(0,y.intersect)(l,new Set(t))}if(r.set(h,e.name(h)),n.set(h,e.description(h)),u.includes(p)||(l=new Set),void 0===a)a=h;else if(null!==a&&a!==h){a=null;break}}if(void 0===t)if(0===h&&0===d)t=null;else{t={availableGroups:l,selectedUnit:a||null,units:s,originalUnits:i,symbolSourceCount:h,allUnitsAreOriginal:c,names:r,descriptions:n}}return this._unitCache={value:t,availableUnitsCount:e.size()},t}measureUnitId(e){if(null!==this._measureUnitIdCache&&e.size()===this._measureUnitIdCache.availableUnitsCount)return this._measureUnitIdCache.value;let t,i;const s=new Map,r=new Map,n=new Set;let o=0;const a=this._seriesLikeSources.filter(Se.isActingAsSymbolSource);for(const l of a){if(!l.isVisible())continue;const a=l.measureUnitId();if(null===a){t=null;break}n.add(a),s.set(a,e.name(a)),r.set(a,e.description(a)),void 0===i?i=a:null!==i&&i!==a&&(i=null),o+=1}return void 0===t&&(t=0===o?null:{selectedMeasureUnitId:i||null,measureUnitIds:n,names:s,descriptions:r,symbolSourceCount:o}),this._measureUnitIdCache={value:t,availableUnitsCount:e.size()},t}setMargins(e){if(!(0,ae.isNumber)(e.top)||!(0,
ae.isNumber)(e.bottom))throw new TypeError("invalid margin");if(e.top<0||e.top>30||e.bottom<0||e.bottom>30)throw new RangeError("invalid margin");this._margins.top===e.top&&this._margins.bottom===e.bottom||(this._margins=e,this._correctedMarginsCache=null,this._invalidateInternalHeightCache(),this._marksCache=null)}topMargin(){return this._correctedMargins().top}bottomMargin(){return this._correctedMargins().bottom}invalidateMargins(){this._correctedMarginsCache=null}topPixelMargin(){return this.isInverted()?this.bottomMargin()*this.height()+this._bottomPixelMargin:this.topMargin()*this.height()+this._topPixelMargin}bottomPixelMargin(){return this.isInverted()?this.topMargin()*this.height()+this._topPixelMargin:this.bottomMargin()*this.height()+this._bottomPixelMargin}marks(){return this.isEmpty()?(this._marksCache=null,[]):(null===this._marksCache&&(this._markBuilder.rebuildTickMarks(),this._marksCache=this._markBuilder.marks(),this._onMarksChanged.fire()),this._marksCache)}onMarksChanged(){return this._onMarksChanged}priceRangeInPrice(){if(this.isEmpty())return null;const e=this.mainSource();if(null===e)return null;const t=(0,o.ensureNotNull)(e.firstValue()),i=this.height();return{from:this.coordinateToPrice(i-1,t),to:this.coordinateToPrice(0,t)}}setPriceRangeInPrice(e){if(this.isPercentage()||this.isIndexedTo100())return;const t=this.isInverted(),i=t?this.bottomMargin():this.topMargin(),s=t?this.topMargin():this.bottomMargin(),r=this.isLog();let n=r?(0,ve.toLog)(e.from,this._logFormula):e.from,o=r?(0,ve.toLog)(e.to,this._logFormula):e.to;const a=o-n;n+=s*a,o-=i*a,this.setMode({autoScale:!1}),this.setPriceRange(new fe.PriceRange(n,o)),this._marksCache=null,this._onMarksChanged.fire()}hasMainSeries(){return this._hasSeries}getStudies(){return this.dataSources().filter(R.isStudy)}lastSourceRemoved(){return this._lastSourceRemoved}sourcesForAutoscale(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.childs().scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||(this._sourcesForAutoscale=this._recalculateSourcesForAutoscale()),this._sourcesForAutoscale}recalculatePriceRange(e){this._invalidatedForRange={visibleBars:e,isValid:!1}}internalHeightChanged(){return this._internalHeightChanged}orderedSources(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;let e=this.m_dataSources.slice();return e=(0,he.sortSources)(e),this._cachedOrderedSoruces=e,this._cachedOrderedSoruces}invalidateSourcesCache(){this._cachedOrderedSoruces=null,this._sourcesToUpdateViews=null}startScale(e){var t,i;this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint||null!==this._priceRangeSnapshot||(this._scaleStartPoint=this.m_height-e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null)}scaleTo(e){if(this.isPercentage()||this.isIndexedTo100()||null===this._scaleStartPoint)return;this.setMode({autoScale:!1}),(e=this.m_height-e)<0&&(e=0)
;let t=(this._scaleStartPoint+.2*(this.m_height-1))/(e+.2*(this.m_height-1));const i=(0,o.ensureNotNull)(this._priceRangeSnapshot).clone();t=Math.max(t,.1),i.scaleAroundCenter(t),this.setPriceRange(i)}endScale(){this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._priceRangeSnapshot=null)}startTwoPointsScale(e,t){if(this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._twoPointsScaleStartPosition)return;const i=Math.min(e,t),s=Math.max(e,t);this._twoPointsScaleStartPosition={topLogical:this._coordinateToLogical(i),bottomLogical:this._coordinateToLogical(s)}}twoPointsScale(e,t){if(this.isPercentage()||this.isIndexedTo100()||null===this._twoPointsScaleStartPosition)return;this.setMode({autoScale:!1});const i=Math.min(e,t),s=Math.max(e,t),{topLogical:r,bottomLogical:n}=this._twoPointsScaleStartPosition,o=this.bottomPixelMargin(),a=this.internalHeight()-1,l=(this._invertedCoordinate(i)-o)/a,c=(n-r)/((this._invertedCoordinate(s)-o)/a-l);if(!Number.isFinite(c))return;const h=r-c*l,d=h+c;this.setPriceRange(new fe.PriceRange(this.priceToLogical(h),this.priceToLogical(d)))}endTwoPointsScale(){this._twoPointsScaleStartPosition=null}startScroll(e){var t,i;this.isAutoScale()||null===this._scrollStartPoint&&null===this._priceRangeSnapshot&&(this.isEmpty()||(this._scrollStartPoint=e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null))}scrollTo(e){if(this.isAutoScale())return;if(null===this._scrollStartPoint||null===this._priceRangeSnapshot)return;const t=this.priceRange();if(null===t)return;let i=e-this._scrollStartPoint;this.isInverted()&&(i*=-1);const s=i*(t.length()/(this.internalHeight()-1)),r=this._priceRangeSnapshot.clone();r.shift(s),this.setPriceRange(r,!0),this._marksCache=null}endScroll(){this.isAutoScale()||null!==this._scrollStartPoint&&(this._scrollStartPoint=null,this._priceRangeSnapshot=null)}clearPriceRange(){this._priceRange=null,this.recalculatePriceRangeOnce()}isVisible(){return this._isVisible}_addDataSourceImpl(e,t,i){if(t||-1===this.m_dataSources.indexOf(e)){if((0,ce.isPriceDataSource)(e)){if(void 0===i?this._priceDataSources.push(e):this._priceDataSources.splice(i,0,e),e.currencyChanged().subscribe(this,(()=>this._currencyCache=null)),e.unitChanged().subscribe(this,(()=>this._unitCache=null)),(0,Se.isSymbolSource)(e)&&(this._seriesLikeSources.push(e),e.symbolResolved().subscribe(this,(()=>{this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null,this._updateLogFormula()})),e.isActingAsSymbolSource().subscribe(this._boundOnSourceIsActingAsSymbolSourceChanged),e instanceof ye.Series)){const t=e.properties();this._hasSeries||(t.childs().lockScale&&(this.setMode({lockScale:t.childs().lockScale.value()}),t.removeProperty("lockScale")),t.childs().pnfStyle.child("lockScale")&&t.childs().pnfStyle.removeProperty("lockScale")),this._hasSeries=!0}e.isSpeciallyZOrderedSource()||(this._sourcesThatAffectVisibility.push(e),
e.properties().childs().visible.listeners().subscribe(this,this._onSourceVisibilityChanged))}(0,R.isStudy)(e)&&(e.onIsActualIntervalChange().subscribe(this,this._dropScaleCache),e.onHibernationStateChange().subscribe(this,this._dropScaleCache),0===this._studiesCount&&(0,Le.hideAllIndicators)().subscribe(this,this._dropScaleCache),this._studiesCount++),(0,S.isLineTool)(e)&&(0===this._drawingCount&&(0,Le.hideAllDrawings)().subscribe(this,this._dropScaleCache),this._drawingCount++),this.m_dataSources.push(e),this._mainSource=null,this.mainSource()===e&&(this._correctedMarginsCache=null,this._internalHeightCache=null,this._marksCache=null),this._dropScaleCache(),this.updateFormatter(),this._initScaleProperties(),this.invalidateSourcesCache(),this._updateIsVisible(),this._updateLogFormula()}}_recalculateSourcesForAutoscale(){this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.childs().scaleSeriesOnly.value());const e=this._scaleSeriesOnly&&this._hasSeries;return this.m_dataSources.filter((t=>!!(t.properties().visible.value()||t instanceof ye.Series)&&(e?t instanceof ye.Series:(0,R.isStudy)(t)?!t.isSourceHidden()&&t.isIncludedInAutoScale():t.isIncludedInAutoScale())))}_updateAutoScaleDisabledProperty(e){const t=this._properties.childs(),i=t.indexedTo100.value()||t.percentage.value()||t.lockScale.value();e?t.autoScaleDisabled.setValueSilently(i):t.autoScaleDisabled.setValue(i)}_setAutoScaleValueWithDependentProperties(e){const t=this._properties.childs();t.autoScale.setValueSilently(e),e&&(t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.logDisabled.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLockScaleValueWithDependentProperties(e){const t=this._properties.childs();t.lockScale.setValueSilently(e),e&&(t.autoScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.log.setValueSilently(!1)),t.percentageDisabled.setValueSilently(e),t.logDisabled.setValueSilently(e),this._updateAutoScaleDisabledProperty(!0)}_setPercentageValueWithDependentProperties(e){const t=this._properties.childs();t.percentage.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setIndexedTo100ValueWithDependentProperties(e){const t=this._properties.childs();t.indexedTo100.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLogValueWithDependentProperties(e){const t=this._properties.childs();t.log.setValueSilently(e),e&&(t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_recalculatePriceRangeImpl(){const e=this._invalidatedForRange.visibleBars;if(null===e)return;let t=null
;const i=this.sourcesForAutoscale(),s=this.isPercentage(),r=this.isIndexedTo100();let n=0,o=0;const a={targetPriceScale:this,scaleSeriesOnly:this._scaleSeriesOnly};for(const l of i){if(!l.properties().visible.value())continue;const i=l.firstValue();if(null===i||s&&0===i)continue;const c=e.firstBar(),h=e.lastBar(),d=l.autoScaleInfo(c,h,a);let u=d.range;u&&(s?u=(0,ve.toPercentRange)(u,i):r&&(u=(0,ve.toIndexedTo100Range)(u,i)),t=null===t?u:t.merge(u)),void 0!==d.topPixelMargin&&(n=Math.max(n,d.topPixelMargin)),void 0!==d.bottomPixelMargin&&(o=Math.max(o,d.bottomPixelMargin))}(Math.abs(n-this._topPixelMargin)>0||Math.abs(o-this._bottomPixelMargin)>0)&&(this._bottomPixelMargin=o,this._topPixelMargin=n,this._marksCache=null,this._invalidateInternalHeightCache()),t?(this._hasCalculatedPriceRange=!0,t.minValue()===t.maxValue()&&(t=new fe.PriceRange(t.minValue()-.5,t.maxValue()+.5)),this.setPriceRange(t)):this._priceRange||this.setPriceRange(new fe.PriceRange(-.5,.5)),this._invalidatedForRange.isValid=!0;const l=this.mainSource();null!==l&&this._recalculatePriceRangeOnce&&(this._recalculatePriceRangeOnce=!l.priceRangeReady())}_makeSureItIsValid(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this._recalculatePriceRangeImpl())}_invalidateInternalHeightCache(){this._internalHeightCache=null,this._internalHeightChanged.fire()}_coordinateToLogical(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;const t=this._invertedCoordinate(e),i=(0,o.ensureNotNull)(this.priceRange()),s=i.minValue()+(i.maxValue()-i.minValue())*((t-this.bottomPixelMargin())/(this.internalHeight()-1));return this.logicalToPrice(s)}_logicalToCoordinate(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;e=this.priceToLogical(e);const t=(0,o.ensureNotNull)(this.priceRange()),i=this.bottomPixelMargin()+(this.internalHeight()-1)*(e-t.minValue())/(t.maxValue()-t.minValue());return this._invertedCoordinate(i)}_convertPriceRangeFromLog(e){if(null===e)return null;const t=(0,ve.fromLog)(e.minValue(),this._logFormula),i=(0,ve.fromLog)(e.maxValue(),this._logFormula);return new fe.PriceRange(t,i)}_convertPriceRangeToLog(e){if(null===e)return null;const t=(0,ve.toLog)(e.minValue(),this._logFormula),i=(0,ve.toLog)(e.maxValue(),this._logFormula);return new fe.PriceRange(t,i)}_canConvertPriceRangeFromLog(e){if(null===e)return!1;const t=(0,ve.fromLog)(e.minValue(),this._logFormula),i=(0,ve.fromLog)(e.maxValue(),this._logFormula);return isFinite(t)&&isFinite(i)}_onSourceVisibilityChanged(){this._dropScaleCache(),this._updateIsVisible()}_dropScaleCache(){this._sourcesForAutoscale=null,this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null}_updateIsVisible(){if(!Ee)return void this._isVisible.setValue(!0);const e=this._sourcesThatAffectVisibility.some((e=>e.isVisible()));this._isVisible.setValue(e)}_updateLogFormula(){const e=this.mainSource();if(null===e)return void(this._logFormula=(0,ve.logFormulaForBase)(null));const t=e.base()||null,i=(0,ve.logFormulaForBase)(t);(0,
ve.logFormulasAreSame)(i,this._logFormula)||(this._logFormula=i)}_invertedCoordinate(e){return this.isInverted()?e:this.height()-1-e}_initScaleProperties(){const e=this.isLockScale(),t=this.properties().childs();e&&(t.percentage.setValue(!1),t.indexedTo100.setValue(!1),t.log.setValue(!1),t.autoScale.setValue(!1)),t.percentageDisabled.setValue(e),t.logDisabled.setValue(e),this._updateAutoScaleDisabledProperty(!1),t.percentage.value()&&(t.log.setValue(!1),t.indexedTo100.setValue(!1)),t.indexedTo100.value()&&(t.log.setValue(!1),t.percentage.setValue(!1))}_correctedMargins(){if(null===this._correctedMarginsCache){const e=this.mainSource();this._correctedMarginsCache=null!==e?e.correctScaleMargins(this._margins):this._margins}return this._correctedMarginsCache}_getSourcesToUpdateViews(){return this._sourcesToUpdateViews||(this._sourcesToUpdateViews=this.m_dataSources.filter((e=>!(0,S.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()))),this._sourcesToUpdateViews}_mainSourceFormatter(){const e=this.mainSource();return(null==e?void 0:e.formatter())||Be}_priceToPercentOrIndexedTo100IfNeeded(e,t){return this.isPercentage()?(0,ve.toPercent)(e,t):this.isIndexedTo100()?(0,ve.toIndexedTo100)(e,t):e}_onSourceIsActingAsSymbolSourceChanged(){this._dropScaleCache()}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}_updateResetAvailableValue(){this._resetScaleAvailable.setValue(!this.isLockScale()&&!this.isAutoScale())}}var Oe=i(59769),Fe=i(9155),We=i(36915),He=i(5171),ze=i(678);const Ue=[],je=[];class Ge{constructor(e){this._studies={},this._deferreds={},this._container=e,Ue.push(e),je.push(this)}add(e,t){this._deferreds[e]&&(this._deferreds[e].resolve(t),delete this._deferreds[e]),this._studies[e]=t}get(e){return this._studies[e]?Promise.resolve(this._studies[e]):(this._deferreds[e]||(this._deferreds[e]=(0,_.createDeferredPromise)()),this._deferreds[e].promise)}delete(e){delete this._studies[e],delete this._deferreds[e]}reset(){const e=Ue.indexOf(this._container);~e&&(Ue.splice(e,1),je.splice(e,1))}static instance(e){const t=Ue.indexOf(e);return~t?je[t]:new Ge(e)}}var qe=i(65365);var $e=i(10892),Ke=i(81756),Ye=i(62828),Ze=i(83776),Xe=i(37968),Je=i(56621),Qe=i(44672),et=i(42989),tt=i(79303);const it=te.enabled("clear_price_scale_on_error_or_empty_bars"),st=(0,ie.getLogger)("Chart.Pane");var rt;function nt(e,t,i){e.setMargins({top:t,bottom:i})}!function(e){e[e.DefaultStretchFactor=1e3]="DefaultStretchFactor",e[e.LargePaneSizeRatio=1]="LargePaneSizeRatio",e[e.MediumPaneSizeRatio=.6]="MediumPaneSizeRatio",e[e.SmallPaneSizeRatio=.3]="SmallPaneSizeRatio",e[e.TinyPaneSizeRatio=.15]="TinyPaneSizeRatio"}(rt||(rt={}));const ot="chart.pane";class at{constructor(e,t,i,s){this.m_dataSources=[],this._sourceWatchedValuesSubscriptions=new Map,this.m_mainDataSource=null,this._cachedOrderedSources=new me(this),this._sourcesById=new Map,this._priceSourcesById=new Map,this._sourcePropertiesChanged=new N.Delegate,this._sourcesZOrderChanged=new N.Delegate,this._tagsChanged=new N.Delegate,this._stretchFactor=1e3,
this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null,this._rightPriceScales=[],this._leftPriceScales=[],this._lockedPriceScale=null,this._currentPriceScaleRatio=null,this._onPriceScalesChanged=new N.Delegate,this._isRecalculatingScales=!1,this._priceDataSources=[],this._symbolSources=[],this._lollipopDataSources=[],this._symbolSourceResolved=new N.Delegate,this._symbolSourceResolvingActive=new O.WatchedValue(!1),this._bulkActions={activeCounter:0},this._height=0,this._width=0,this._sizeChanged=new N.Delegate,this._dataSourcesCollectionChanged=new N.Delegate,this._symbolSourceCollectionChanged=new N.Delegate,this._priceSourcesCollectionChanged=new N.Delegate,this._maximized=new O.WatchedValue(!1),this._collapsed=new O.WatchedValue(!1),this._resetPriceScalesAvailable=new O.WatchedValue(!1),this._destroyed=new N.Delegate,this._executionsPositionController=null,this._seriesDisplayError=null,this._onPriceScaleIsVisibleChanged=()=>{this._model.fullUpdate()},this._recalcSymbolSourceResolvingActive=()=>{for(const e of this._symbolSources)if(e.symbolResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._onSymbolSourceCollectionChanged=()=>{0===this._bulkActions.activeCounter?this._symbolSourceCollectionChanged.fire():this._bulkActions.symbolSourceCollectionChanged=!0},this._onSeriesDisplayError=e=>{if(null!==e){for(const e of this._leftPriceScales)e.clearPriceRange();for(const e of this._rightPriceScales)e.clearPriceRange()}},this._updateResetPriceScalesAvailableValue=()=>{const e=e=>e.resetScaleAvailable().value(),t=this._leftPriceScales.some(e)||this._rightPriceScales.some(e);this._resetPriceScalesAvailable.setValue(t)},this._priceScaleSelectionStrategy=(0,ne.createPriceScaleSelectionStrategy)(i.properties().childs().priceScaleSelectionStrategyName.value()),this._id=null!=s?s:(0,se.randomHashN)(6),this._timeScale=e,this.m_mainDataSource=null,this._properties=t,this._model=i,i.properties().childs().priceScaleSelectionStrategyName.subscribe(null,(e=>{this._priceScaleSelectionStrategy=(0,ne.createPriceScaleSelectionStrategy)(e.value()),this._priceScaleSelectionStrategy.apply(this)})),this._timeScale.barSpacingChanged().subscribe(this,(()=>{this.m_mainDataSource===this._model.mainSeries()&&this._recalculatePriceScaleByScaleRatio(this.m_mainDataSource.priceScale())})),it&&(this._seriesDisplayError=(0,be.getSeriesDisplayErrorWV)(this._model.mainSeries()),this._seriesDisplayError.subscribe(this._onSeriesDisplayError)),i.onMultipaneSourcesCollectionChanged().subscribe(this,this._invalidateSourcesCache),i.panesCollectionChanged().subscribe(this,this._invalidateSourcesCache),t.childs().topMargin.subscribe(this,this._updateMargins),t.childs().bottomMargin.subscribe(this,this._updateMargins),this._updateMargins()}destroy(){var e;this._properties.childs().topMargin.unsubscribeAll(this),this._properties.childs().bottomMargin.unsubscribeAll(this),this._model.properties().childs().priceScaleSelectionStrategyName.unsubscribeAll(this),
this._timeScale.barSpacingChanged().unsubscribeAll(this),this._leftPriceScales.concat(this._rightPriceScales).forEach((e=>{e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue)}));for(const e of this.m_dataSources)this.removeSourceFromPriceScale(e),e.destroy&&e.destroy();null===(e=this._seriesDisplayError)||void 0===e||e.destroy(),this._model.onMultipaneSourcesCollectionChanged().unsubscribeAll(this),this._model.panesCollectionChanged().unsubscribeAll(this),this._destroyed.fire()}id(){return this._id}bulkActionMacro(e){const t=this._bulkActions;t.activeCounter+=1,e(),t.activeCounter-=1,0===t.activeCounter&&(this._dataSourcesCollectionChanged.fire(),t.symbolSourceCollectionChanged&&(this._symbolSourceCollectionChanged.fire(),t.symbolSourceCollectionChanged=!1),t.priceSourcesCollectionChanged&&(this._priceSourcesCollectionChanged.fire(),t.priceSourcesCollectionChanged=!1))}defaultPriceScale(){var e,t;const i=null!==(t=null===(e=this.m_mainDataSource)||void 0===e?void 0:e.priceScale())&&void 0!==t?t:null;if(null!==i)return i;const s=this.properties().childs().axisProperties.state();return s.autoScale=!0,new Ne(this._model.properties().childs().scalesProperties,s)}leftPriceScales(){return this._leftPriceScales}rightPriceScales(){return this._rightPriceScales}visibleLeftPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._leftPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.left&&(null==s?void 0:s.isVisible().value())){const e=(0,y.moveToHead)(i,s);return e.splice(t.left),e}return i}visibleRightPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._rightPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.right&&(null==s?void 0:s.isVisible().value())){const e=(0,y.moveToHead)(i,s);return e.splice(t.right),e}return i}clearSeries(e){const t=this._model.mainSeries();for(let i=this.m_dataSources.length-1;i>=0;i--)this.m_dataSources[i]===t&&this._removeSourceFromCollections(i,e)}sourcesByGroup(){return this._cachedOrderedSources}dataSourceForId(e){return this._sourcesById.get(e)||null}changeSourceId(e,t){var i;e===this._model.mainSeries()&&(null===(i=(0,re.getPersistentLogger)())||void 0===i||i.addPersistentLogEntry(`changeSourceId for series from ${e.id()} to ${t}`,ie.LOGLEVEL.INFO,ot)),(0,o.assert)(this.hasDataSource(e));const s=e.id();e.setId(t),this._sourcesById.delete(s),this._sourcesById.set(t,e),(0,ce.isPriceDataSource)(e)&&(this._priceSourcesById.delete(s),this._priceSourcesById.set(t,e))}movePriceScale(e,t,i){const s=this.priceScalePosition(e);if(s!==t)this.removePriceScale(e),this._placePriceScale(e,t,i),e.invalidateMargins(),this._invalidateSourcesCache();else if(void 0!==i&&"overlay"!==s){
const t="left"===s?this._leftPriceScales:this._rightPriceScales,r=t.indexOf(e);t.splice(r,1),t.splice(i,0,e)}}mainDataSource(){return this.m_mainDataSource}isEmpty(){return null===this.m_mainDataSource}recalculatePriceScale(e,t){if(!e)return;let i=e.sourcesForAutoscale();if(e===this._model.mainSeries().priceScale()&&(i=[...i,...this._cachedOrderedSources.multipaneSources()]),(e.isAutoScale()||e.priceRangeShouldBeRecalculatedOnce()||null===e.priceRange())&&i.length>0&&!this.timeScale().isEmpty()){const t=this.timeScale().visibleBarsStrictRange();e.recalculatePriceRange(t)}e.updateAllViews(t)}onSourceTagsChanged(){this._tagsChanged.fire()}insertDataSource(e,t,i,s){e.setZorder(i),t||(s=!1,t=this.findSuitableScale(e)),this._addSourceToCollections(e);let r=!1;e===this.model().mainSeries()?(this.m_mainDataSource=this.model().mainSeries(),r=!0):null===this.m_mainDataSource&&(0,ce.isPriceDataSource)(e)&&(this.m_mainDataSource=e,r=!0),s||t.addDataSource(e,this._isInInsertManyDataSourcesState),e.setPriceScale(t),t.invalidateMargins(),e.onTagsChanged&&e.onTagsChanged().subscribe(this,this.onSourceTagsChanged),r&&this._processMainSourceChange(),this._tagsChanged.fire(),(0,ce.isPriceDataSource)(e)&&this.recalculatePriceScale(t,(0,Qe.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}addDataSource(e,t,i){let s=e.zorder();i||((0,S.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()?(s=null!==this._lastLineDataSourceZOrder?this._lastLineDataSourceZOrder+1:this.newLineToolZOrder(),this._isInInsertManyDataSourcesState&&(this._lastLineDataSourceZOrder=s)):(0,R.isStudy)(e)&&!e.isSpeciallyZOrderedSource()&&(s=this.newStudyZOrder())),this.insertDataSource(e,t,s)}removeDataSource(e,t,i,s){const r=this.m_dataSources.indexOf(e);if(-1===r)return void st.logDebug("removeDataSource: invalid data source");this._removeSourceFromCollections(r,!!i),e!==this.m_mainDataSource||t||(this.m_mainDataSource=null);const n=e.priceScale();s||this.removeSourceFromPriceScale(e),e.onTagsChanged&&e.onTagsChanged().unsubscribe(this,this.onSourceTagsChanged),(0,ce.isPriceDataSource)(e)&&!t&&this._processMainSourceChange(),(0,R.isStudy)(e)&&e.metaInfo().hasForceOverlayPlots()&&this._model.removeMultiPaneSource(e),this._tagsChanged.fire(),n&&(0,ce.isPriceDataSource)(e)&&this.recalculatePriceScale(n,(0,Qe.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}hasDataSource(e){return this._sourcesById.has(e.id())}hasPriceDataSource(e){return this._priceSourcesById.has(e.id())}dataSources(){return this.m_dataSources}priceDataSources(){return this._priceDataSources}lollipopDataSources(){return this._lollipopDataSources}symbolSources(){return this._symbolSources}replaceSource(e,t,i){const s=this.m_mainDataSource===e,r=e.zorder(),n=null==i?void 0:i.replaceSource(e,t);this.removeDataSource(e,s,void 0,n),this.insertDataSource(t,i,r,n),this._sourcesById.set(t.id(),t),(0,ce.isPriceDataSource)(t)&&this._priceSourcesById.set(t.id(),t),s&&(this.m_mainDataSource=t,this._processMainSourceChange())}findSuitableScale(e,t,i){
return this._priceScaleSelectionStrategy.findSuitableScale(this,e,t,i)}createNewPriceScaleIfPossible(){return this._priceScaleSelectionStrategy.createNewPriceScaleIfPossible(this)}canCreateNewPriceScale(){return this._priceScaleSelectionStrategy.canCreateNewPriceScale(this)}isOverlay(e){const t=e.priceScale();return null===t||"overlay"===this.priceScalePosition(t)}recalculate(e){this._leftPriceScales.forEach((t=>this.recalculatePriceScale(t,e))),this._rightPriceScales.forEach((t=>this.recalculatePriceScale(t,e)));for(const t of this.m_dataSources)this.isOverlay(t)&&!(0,S.isLineTool)(t)&&this.recalculatePriceScale(t.priceScale(),e);this.updateAllViews(e),this._model.updatePane(this)}updateAllViews(e){const t=this._cachedOrderedSources.all();for(const i of t)i.updateAllViews(e);for(const t of this.model().customSources())t.updateViewsForPane(this,e)}updateLollipopViews(e){}priceScalePosition(e){return this._leftPriceScales.includes(e)?"left":this._rightPriceScales.includes(e)?"right":"overlay"}createPriceScaleAtPosition(e,t){const i=this.properties().childs().axisProperties.state();i.autoScale=!0;const s=new Ne(this.model().properties().childs().scalesProperties,i);return s.setHeight(this.height()),nt(s,this._defaultTopMargin(),this._defaultBottomMargin()),this._placePriceScale(s,e,t),s}removePriceScale(e){e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue),e===this._lockedPriceScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null);const t=this._leftPriceScales.indexOf(e);-1!==t&&(this._leftPriceScales[t].invalidateMargins(),this._leftPriceScales.splice(t,1));const i=this._rightPriceScales.indexOf(e);if(-1!==i&&(this._rightPriceScales[i].invalidateMargins(),this._rightPriceScales.splice(i,1)),null===e.mainSource()){const t=e.dataSources().length;0!==t&&st.logError("Invalid priceScale state: empty mainSource but non-empty data sources="+t)}this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue()}priceScaleIndex(e,t){switch(t){case"left":return this.leftPriceScales().indexOf(e);case"right":return this.rightPriceScales().indexOf(e)}}move(e,t,i){const s=e.priceScale();this.removeSourceFromPriceScale(e),t.addDataSource(e),e.setPriceScale(t),t.invalidateMargins(),this._processMainSourceChange(),this._invalidateSourcesCache(),e.isIncludedInAutoScale()&&(null!==s&&this.recalculatePriceScale(s,(0,Qe.sourceChangeEvent)(e.id())),this.recalculatePriceScale(t,(0,Qe.sourceChangeEvent)(e.id()))),this._onPriceScalesChanged.fire()}setZOrders(e){e.forEach(((e,t)=>{t.setZorder(e)})),this._invalidateSourcesCache(),0===this._bulkActions.activeCounter&&this._dataSourcesCollectionChanged.fire(),this.model().fullUpdate()}isMainPane(){return this.hasDataSource(this.model().mainSeries())}isLast(){const e=this.model().panes();return e[e.length-1]===this}newStudyZOrder(){return(0,
Fe.newStudyZOrder)(this._priceDataSources)}newLineToolZOrder(e){return(0,Fe.newLineToolZOrder)(this.m_dataSources,e)}model(){return this._model}containsMainSeries(){return this._sourcesById.has(this.model().mainSeries().id())}applyPriceScaleRatio(e,t){var i;null!==this._lockedPriceScale&&this._lockedPriceScale!==e||this._currentPriceScaleRatio===t||!this.isMainPane()||null===this._lockedPriceScale&&e!==(null===(i=this.mainDataSource())||void 0===i?void 0:i.priceScale())||(this._setNewPriceRangeByScaleRatio(e,t,this._mainSourceVisiblePriceRange(e),!0,!0),null!==this._lockedPriceScale?this._tryToApplyNewPriceScaleRatio():e.isLog()||this.model().mainSeriesScaleRatioPropertyOnChanged())}sendToBack(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[0],Fe.moveBeforeSource)}bringToFront(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[t.length-1],Fe.moveAfterSource)}sendBackward(e){const t=this.sourcesByGroup().allIncludingHidden(),i=t.indexOf(e[0]);if(0===i)this.bringToFront(e);else{const s=t[i-1];this.insertBefore(e,s)}}bringForward(e){const t=this.sourcesByGroup().allExceptSpecialSources(),i=t.indexOf(e[e.length-1]);if(i===t.length-1)this.sendToBack(e);else{const s=t[i+1];this.insertAfter(e,s)}}insertAfter(e,t){this._batchReorder(e,t,Fe.moveAfterSource)}insertBefore(e,t){this._batchReorder(e,t,Fe.moveBeforeSource)}maximized(){return this._maximized}collapsed(){return this._collapsed}getPriceScaleById(e){const t=this.m_dataSources.find((t=>{var i;return(null===(i=t.priceScale())||void 0===i?void 0:i.id())===e}));return void 0===t?null:t.priceScale()}priceScaleSelectionStrategy(){return this._priceScaleSelectionStrategy}setPriceScaleSelectionStrategy(e){this._priceScaleSelectionStrategy=e,e.apply(this)}findTargetPriceAxisViews(e,t,i,s){if((0,v.isDataSource)(e)&&this.model().paneForSource(e)!==this)return[];const r=e.priceScale();if(t===r)return i;if(null===r)return[];if("overlay"===this.priceScalePosition(r))return t===this.defaultPriceScale()?i:[];const n=this.priceScalePosition(t);if(n!==this.priceScalePosition(r))return[];const o="left"===n?this.leftPriceScales():this.rightPriceScales();return o.indexOf(t)1}properties(){return this._properties}setPriceAutoScale(e,t){e.setMode({autoScale:t}),this.timeScale().isEmpty()||this.recalculatePriceScale(e,(0,Qe.viewportChangeEvent)())}state(e,t,i,s,r,n){var o,a;const l={sources:[],mainSourceId:null===(o=this.m_mainDataSource)||void 0===o?void 0:o.id(),stretchFactor:this._stretchFactor,leftAxisesState:[],rightAxisesState:[],overlayPriceScales:{},priceScaleRatio:this._currentPriceScaleRatio,isCollapsed:this._collapsed.value()},c=new Map,h=e=>{if(c.has(e))return c.get(e);let o=null;const a=i&&!e.isSavedInStudyTemplates()||!e.state||(0,S.isLineTool)(e)&&n||!e.isSavedInChart(Boolean(t))||!(o=e.state(t,r))||s&&(0,
S.isLineTool)(e)&&e.isActualSymbol&&!e.isActualSymbol()||e.isPhantom()?null:o;return c.set(e,a),a};if(e){l.sources=[];for(let e=0;enull!==c.get(e),u=e=>!n||!(0,S.isLineTool)(e);l.leftAxisesState=this._leftPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.rightAxisesState=this._rightPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.overlayPriceScales={};for(const e of this.m_dataSources)if(this.isOverlay(e)&&e.isSavedInChart(Boolean(t))){const t=e.priceScale();l.overlayPriceScales[e.id()]=null!==(a=null==t?void 0:t.state())&&void 0!==a?a:null}return l}restoreState(e){var t;const{state:i,withData:s,version:r,seriesId:n=this._model.mainSeries().id(),settingsMigration:a={},contentOverrides:l,restoreSilently:c,reason:h=0}=e;null===(t=(0,re.getPersistentLogger)())||void 0===t||t.addPersistentLogEntry(`Restoring pane with seriesId ${n}`,ie.LOGLEVEL.INFO,ot),i.stretchFactor&&(this._stretchFactor=i.stretchFactor);const d={};if(i.sources){const e=i.sources.filter((e=>{var t;return!!e&&("MainSeries"===e.type||(!(null===(t=e.points)||void 0===t?void 0:t.some((e=>null===e.time_t||!isFinite(e.time_t))))||(st.logNormal("Dropped invalid "+e.type+". Reason: non-numeric point time"),!1)))})),t=e.findIndex(We.isMainSeriesState);-1!==t&&this.model().mainSeries().setObsoleteZOrder(e[t].zorder),r<3&&(0,Fe.reorderDataSourcesStateZOrder)(e);const o=-1!==this.m_dataSources.indexOf(this._model.mainSeries());this.clearSeries(Boolean(c)),this.m_mainDataSource=null,o&&this._addSourceToCollections(this._model.mainSeries(),c),(()=>{const t=e.find((e=>e.id===i.mainSourceId));if(void 0===t)return void st.logWarn("There is no main source with id "+i.mainSourceId+", total sources="+e.length);if(!window.TradingView[t.type]||!(0,ge.isLineToolName)(t.type))return void st.logNormal("The type of main source is not line tool - fix is unnecessary");let s=null;for(const i of e)if(!window.TradingView[t.type]||!(0,ge.isLineToolName)(i.type)){if(null!==s)return void st.logWarn("Pane contains more than 1 possibly main sources - auto fix cannot be applied");s=i}if(null===s)return void st.logWarn("Pane contains only line tools - possible we need to remove this pane?");const r=i.mainSourceId;let n=0;i.mainSourceId=s.id,e.forEach((e=>{e.ownerSource===r&&(e.ownerSource=null==s?void 0:s.id,n+=1)})),st.logNormal("Auto fix broken pane is applied, changed line tools="+n+", changed from="+r+" to="+s.id)})();for(const t of e)if("study_Sessions"===t.type){const e=t;e.oldState=!0,this.model().sessions().restoreState(e,s);break}for(const t of e)"study_Sessions"!==t.type&&(null===this._model.dataSourceForId(t.id)||"MainSeries"===t.type?(d[t.id]=t.ownerSource,(0,We.isMainSeriesState)(t)?this._restoreMainSeries(t,s,o,a,l,c):(0,We.isStudyState)(t)?this.restoreStudy(t,s,n,a,c,h):(0,We.isLineToolState)(t)?(t.state&&(t.state.zOrderVersion=2),
this.restoreLineTool(t,s,void 0,c)):"ChartEventsSource"===t.type&&this._restoreSpecialSource(t,s,c)):st.logError("Duplicate id while restoring pane: "+t.type+","+t.id))}const u=new Set,p=(e,t)=>{e.priceScale()!==t&&(this.removeSourceFromPriceScale(e),e.setPriceScale(t),t.addDataSource(e))},_=(e,t,i)=>{if(u.has(e))return;u.add(e);const s=i.m_showSymbolLabels;void 0!==s&&e===this.model().mainSeries()&&this.model().properties().childs().scalesProperties.childs().showSymbolLabels.setValue(s),this._model.children(e,!0).forEach((e=>_(e,t,i))),p(e,t)},m=e=>{const t=(0,j.defaults)("chartproperties").paneProperties.axisProperties,i=new Ne(this.model().properties().childs().scalesProperties,t);return i.restoreState(e.state),i.setHeight(this._height),e.sources.forEach((e=>{const s=this.dataSourceForId(e);s&&_(s,i,t)})),0===i.dataSources().length?null:i},g=e=>e.map(m).filter((e=>null!==e));let f;if(i.leftAxisesState)f=g(i.leftAxisesState);else{const e=m({state:i.leftAxisState,sources:i.leftAxisSources});f=null!==e?[e]:[]}let v;if(this._leftPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._leftPriceScales=[],f.forEach((e=>this._placePriceScale(e,"left"))),i.rightAxisesState)v=g(i.rightAxisesState);else{const e=m({state:i.rightAxisState,sources:i.rightAxisSources});v=null!==e?[e]:[]}this._rightPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._rightPriceScales=[],v.forEach((e=>this._placePriceScale(e,"right"))),this._currentPriceScaleRatio=i.priceScaleRatio||i.leftPriceScaleRatio||i.rightPriceScaleRatio||null;const y=new Map;for(const e of this.m_dataSources){if(u.has(e))continue;let t;if(i.overlayPriceScales&&i.overlayPriceScales[e.id()]){let s=i.overlayPriceScales[e.id()];y.has(null==s?void 0:s.id)?t=y.get(null==s?void 0:s.id):(s=(0,o.ensure)(s),t=new Ne(this._model.properties().childs().scalesProperties),t.setHeight(this._height),s.m_isAutoScale=!0,s.m_isLog=!1,s.m_isPercentage=!1,s.m_isLockScale=!1,t.restoreState(s),y.set(s.id,t))}else t=new Ne(this._model.properties().childs().scalesProperties),t.setHeight(this._height);p(e,t)}for(const e of Object.keys(d)){const t=d[e],i=this.dataSourceForId(e);t&&i&&null===i.ownerSource()&&i.setOwnerSource(this.dataSourceForId(t))}if(i.mainSourceId&&!this.containsMainSeries()&&(this.m_mainDataSource=this.dataSourceForId(i.mainSourceId)),!this.m_mainDataSource)for(const e of this.m_dataSources)if((0,ce.isPriceDataSource)(e)){this.m_mainDataSource=e;break}for(const e of this.m_dataSources)(0,S.isLineTool)(e)?(e.ownerSource()||e.setOwnerSource(this.mainDataSource()),e.isFixed()&&e.restoreFixedPoint()):(0,R.isStudy)(e)&&!e.ownerSource()&&e.isLinkedToSeries()&&e.setOwnerSource(this.model().mainSeries());this._updateMargins(),this._cachedOrderedSources.clear()}onPriceScalesChanged(){return this._onPriceScalesChanged}setPaneSize(e){let t;switch(e){case"large":t=1;break;case"medium":t=.6;break;case"small":t=.3;break;case"tiny":t=.15;break;default:throw new Error("Unknown size enum value: "+e)}this._stretchFactor=1e3*t}stretchFactor(){return this._stretchFactor}
setStretchFactor(e){this._stretchFactor=e}customSources(e){return this.model().customSources(e)}createDrawingsCaches(){le.ExecutionsPositionController.recreateOrderedByBarsSourcesCache(this)}clearDrawingCaches(){le.ExecutionsPositionController.clearOrderedByBarsSourcesCache()}executionsPositionController(){return this._executionsPositionController||(this._executionsPositionController=new le.ExecutionsPositionController(this)),this._executionsPositionController}width(){return this._width}height(){return this._height}setHeight(e){if(this._height!==e){this._height=e,this._leftPriceScales.forEach((t=>t.setHeight(e))),this._rightPriceScales.forEach((t=>t.setHeight(e)));for(let t=0;t(e.paneViews(this)||[]).some((e=>{const s=e.renderer(t);return s&&s.doesIntersectWithBox&&s.doesIntersectWithBox(i,t)}))))}logicalRectToPixels(e){const t=this.defaultPriceScale(),i=this.timeScale(),s=(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainSource()).firstValue()),r=t.priceToCoordinate(e.p1.price,s),n=i.indexToCoordinate(e.p1.index),l=t.priceToCoordinate(e.p2.price,s),c=i.indexToCoordinate(e.p2.index),h=new a.Point(Math.min(n,c),Math.min(r,l)),d=new a.Point(Math.max(n,c),Math.max(r,l));return(0,a.box)(h,d)}timeScale(){return this._timeScale}restoreLineTool(e,t,i,s,r){var n,a,l,c,h,d,u,p,_,m,g;if((0,ge.isMtpPredictorToolName)(e.type))return st.logWarn(`No longer supported tool ${e.type} is skipped while restoring state`),null;delete e.state.lastUpdateTime,e.state.intervalsVisibilities=(0,$e.mergeIntervalVisibilitiesDefaults)(e.state.intervalsVisibilities),i=void 0===i||i,qe.LineToolElliott.migrateState(e),"LineToolGannComplex"!==(g=e).type||void 0!==g.version&&1!==g.version||(g.type="LineToolGannFixed"),Array.isArray(e.positionPercents)&&(e.positionPercents=e.positionPercents[0]);const f=e.type,v=e.id,y=e.state,b=i?e.zorder:this.newLineToolZOrder();(0,o.assert)((0,ge.isLineToolName)(f),"invalid data source type:"+f+" (expected to be a Line Tool)");let w,C,P=null
;if((0,We.isStudyLineToolState)(e)){P=this._model.isSnapshot()?new tt.StudyVersioning([],[]):(0,V.studyMetaInfoRepository)().studyVersioning();const t=tt.StudyVersioning.patchPointsBasedStudyState(e);e=t;const i=new oe.StudyMetaInfo(t.metaInfo);0;const s=P.updateMetaInfo(i),r=null!=s?s:i;C=(0,S.createStudyLineToolProperties)(f,i,r,y,P),w=(0,S.createLineTool)(f,this._model,C,r,!0)}else C=(0,S.createLineToolProperties)(f,y,this._model,!1),t?null===(n=C.child("fixedSize"))||void 0===n||n.setValue(!1):null===(a=C.child("fixedSize"))||void 0===a||a.setValue(!0),w=(0,S.createLineTool)(f,this._model,C,null,!0);w.setId(v),w.linkKey().setValue(e.linkKey||null);e.alertId&&w.canHasAlert();let x=null!==(l=e.indexes)&&void 0!==l?l:[];if(x=x.slice(0,null!==(h=null===(c=e.points)||void 0===c?void 0:c.length)&&void 0!==h?h:x.length),w.isFixed()?void 0!==e.positionPercents?w.restorePositionPercents(e.positionPercents):w.restorePositionPercents({x:.5,y:.5}):e.points&&w.restorePoints(e.points,x,t),w instanceof Ke.LineToolBarsPattern||w instanceof Ye.LineToolCallout||w instanceof Ze.LineToolTrendAngle||w instanceof Xe.LineToolGhostFeed||w instanceof Je.LineToolParallelChannel)null===(u=(d=w).restoreData)||void 0===u||u.call(d,e);else if(t&&(0,We.isStudyLineToolState)(e)&&w.restoreData){const t=e;P&&(t.graphics=tt.StudyVersioning.patchPointsBasedStudyData(new oe.StudyMetaInfo(t.metaInfo),t.graphics)),null===(p=w.restoreData)||void 0===p||p.call(w,t)}const T=null==e.version?1:e.version,I=null==w.version?1:w.version;if(T!==I&&(null===(m=(_=w).migrateVersion)||void 0===m||m.call(_,T,I,{pane:this,model:this._model,properties:C})),void 0!==b&&w.setZorder(b),r)(0,S.prepareLineToolPropertiesByOwnerSource)(w.properties(),r),w.setOwnerSource(r);else{const t=e.ownerSource?this.dataSourceForId(e.ownerSource):null;w.setOwnerSource(t)}return w.isFixed()&&w.restoreFixedPoint(),void 0!==e.userEditEnabled&&w.setUserEditEnabled(e.userEditEnabled),void 0!==e.isSelectionEnabled&&w.setSelectionEnabled(e.isSelectionEnabled),this._addSourceToCollections(w,s),this._cachedOrderedSources.clear(),w}restoreStudy(e,t,s,r,n,o){var a,l;if(t&&void 0===e.data&&void 0===e.nonSeriesData&&void 0===e.indexes)return st.logError("Cannot restore (skipping) study without data "+e.id+", "+e.metaInfo.id),null;const c=e.id,d=e.state,u=e.zorder;s=null!=s?s:this._model.mainSeries().id();const p=(null!==(a=e.parentSources)&&void 0!==a?a:e.ownerSource?[e.ownerSource]:[]).filter((e=>e!==s));let _=new oe.StudyMetaInfo(e.metaInfo);if(function(e){return"Script$TV_EARNINGS@tv-scripting"===e||"Script$TV_DIVIDENDS@tv-scripting"===e||"Script$TV_SPLITS@tv-scripting"===e||"ESD$TV_EARNINGS@tv-scripting"===e||"ESD$TV_DIVIDENDS@tv-scripting"===e||"ESD$TV_SPLITS@tv-scripting"===e||"Earnings@tv-basicstudies"===e||"Dividends@tv-basicstudies"===e||"Splits@tv-basicstudies"===e||"BarSetContinuousRollDates@tv-corestudies"===e}(_.id)&&!t)return st.logNormal("Skipping study "+_.id),null;let m=d;const g=new T.StudyStub(this._model,e,null!==(l=_.shortDescription)&&void 0!==l?l:_.name);let f;g.setId(c),
g.setZorder(u);let v=!1;const y=(i,s)=>{if(v&&this._model.dataSourceForId(c)!==g)return;g.setStatus({type:ze.StudyStatusType.Undefined});const r=null!=i?i:_,n=Ge.instance(this._model),a=a=>{var l;const h=(0,I.prepareStudyPropertiesForLoadChart)(_,i,m,s),d=(0,R.createStudy)(this._model,h,a,r,void 0,o);if(d.setId(c),d.setOwnFirstValue(null!==(l=e.ownFirstValue)&&void 0!==l?l:null),e.customFields&&d.restoreStateCustomFields(e.customFields),t){const t=e,{data:i,nsData:s,indexes:r}=tt.StudyVersioning.patchStudyData(_,t.data,t.nonSeriesData,t.indexes);d.restoreData(i,s,r)}this._model.replaceStudyStub(g,d)||(f=d),n.add(c,d)};if(p.length>0){const e=p.map((e=>n.get(e)));Promise.all(e).then(a)}else a([])};let S;if(t){const e=tt.StudyVersioning.patchPropsStateAndMetaInfo(d,_,{oldShowStudyLastValueProperty:!(null==r?void 0:r.showStudyLastValueProperty)});S=Promise.resolve(new oe.StudyMetaInfo(e.metaInfo))}else{S=(0,V.studyMetaInfoRepository)().requestMetaInfo().then((()=>{const e=tt.StudyVersioning.patchPropsStateAndMetaInfo(d,_,{oldShowStudyLastValueProperty:t&&!(null==r?void 0:r.showStudyLastValueProperty)});return m=e.propsState,new oe.StudyMetaInfo(e.metaInfo)}))}S.then((e=>{var t;const i=this._model.isSnapshot()?new tt.StudyVersioning([],[]):(0,V.studyMetaInfoRepository)().studyVersioning();if(null===e||this._model.isSnapshot())return void y(e,i);const s=i.updateMetaInfoAsync(e);s.sync?y(null!==(t=s.result)&&void 0!==t?t:e,i):s.result.then((e=>y(e,i))).catch((e=>g.setFailed("error: "+e)))})).catch((()=>g.setFailed(h.t(null,void 0,i(11768)))));const b=null!=f?f:g;if(b){b.setZorder(u);const t=e.metaInfo.linkedToSeries?this._model.mainSeries():p.length?this.dataSourceForId(p[0]):null;b.setOwnerSource(t),this._addSourceToCollections(b,n),this._processMainSourceChange(),v=b===g}return this._cachedOrderedSources.clear(),b}clipboardLineToolOwnerSource(e){const t=this.dataSourceForId(e);if(null!==t){const e=t.ownerSource();if(null!==e&&null!==e.firstValue())return e}const i=this.mainDataSource();if(null!==i&&null!==i.firstValue())return i;for(const e of this.dataSources())if((0,ce.isPriceDataSource)(e)&&null!==e.firstValue())return e;return null}realignLineTools(e){var t;let i=!1;for(const s of this.m_dataSources)!(0,S.isLineTool)(s)||void 0!==e&&(null===(t=null==s?void 0:s.ownerSource())||void 0===t?void 0:t.symbolSource())!==e&&(0,Se.isActingAsSymbolSource)(e)||(s.realign(),s.updateAllViews((0,Qe.sourceChangeEvent)(s.id())),i=!0);return i&&this._invalidateSourcesCache(),i}startScalePrice(e,t){e.startScale(t)}scalePriceTo(e,t){e.scaleTo(t),this.updateAllViews((0,Qe.viewportChangeEvent)())}endScalePrice(e){e.endScale()}startScrollPrice(e,t){e.startScroll(t)}scrollPriceTo(e,t){e.scrollTo(t),this.updateAllViews((0,Qe.viewportChangeEvent)())}endScrollPrice(e){e.endScroll()}resetPriceScale(e){const t=this.timeScale().visibleBarsStrictRange();e.resetScaleAvailable().value()&&e.resetScale(),e.recalculatePriceRange(t),this.updateAllViews((0,Qe.viewportChangeEvent)())}resetPriceScalesAvailable(){
return this._resetPriceScalesAvailable.readonly()}restorePriceScaleState(e,t){e.restoreState(t),this.updateAllViews((0,Qe.viewportChangeEvent)())}beginInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!0,this._lastLineDataSourceZOrder=null}endInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null}removeSourceFromPriceScale(e){const t=e.priceScale();if(null!==t){const i=t.dataSources();i.indexOf(e)>=0&&t.removeDataSource(e),0===i.length&&this.removePriceScale(t)}}_invalidateSourcesCache(){this._cachedOrderedSources.clear(),this._leftPriceScales.forEach((e=>e.invalidateSourcesCache())),this._rightPriceScales.forEach((e=>e.invalidateSourcesCache()))}_processMainSourceChange(){let e=!1;if(null===this.m_mainDataSource)for(const t of this.m_dataSources)if((0,ce.isPriceDataSource)(t)&&!this.isOverlay(t)&&(!(0,R.isStudy)(t)||!t.isLinkedToSeries())){this.m_mainDataSource=t,e=!0;break}if(this.m_mainDataSource&&e){let e=this.m_dataSources.filter(S.isLineTool);e=(0,he.sortSources)(e);for(const t of e)this.move(t,(0,o.ensureNotNull)(this.m_mainDataSource.priceScale()),!0)}else if(!this.m_mainDataSource||this.isOverlay(this.m_mainDataSource)&&0===this._nonOverlayPricesSourcesCount()){let e=null;if(this.m_dataSources.includes(this._model.mainSeries()))e=this._model.mainSeries();else for(const t of this.m_dataSources)if((0,ce.isPriceDataSource)(t)&&this.isOverlay(t)&&t.showInObjectTree()){e=t;break}if(null!==e){const t=this.m_mainDataSource===e;this.m_mainDataSource=e;const i=this.createNewPriceScaleIfPossible();if(t&&e===this._model.mainSeries()){const t=(0,o.ensureNotNull)(e.priceScale());this._model.children(e,!0).forEach((e=>{this.removeSourceFromPriceScale(e),i.addDataSource(e),e.setPriceScale(i)})),this.removePriceScale(t)}this.move(e,i,!0),this.recalculatePriceScale(e.priceScale(),(0,Qe.globalChangeEvent)())}}}_addSourceToCollections(e,t){this.m_dataSources.push(e),this._sourcesById.set(e.id(),e),this._invalidateSourcesCache();const i=()=>{this._sourcePropertiesChanged.fire(e)};e.properties().subscribe(this,i),e.zOrderChanged().subscribe(this,(t=>this._sourcesZOrderChanged.fire(e,t))),(0,S.isLineTool)(e)&&(e.normalizedPointsChanged().subscribe(this,i),e.fixedPointChanged().subscribe(this,i),e.hasAlert().subscribe(i),e.sharingMode().subscribe(i),e.linkKey().subscribe(i),this._sourceWatchedValuesSubscriptions.set(e.id(),i));const s=(0,Se.isSymbolSource)(e)?e:null;(0,ce.isPriceDataSource)(e)&&(this._priceSourcesById.set(e.id(),e),e.currencyChanged().subscribe(this,(()=>this._invalidateSourcesCache())),e.unitChanged().subscribe(this,(()=>this._invalidateSourcesCache())),this._priceDataSources.push(e),this._onPriceSourcesCollectionChanged(),null!==s&&(this._symbolSources.push(s),s.symbolResolved().subscribe(this,(()=>this._symbolSourceResolved.fire(e))),s.symbolResolvingActive().subscribe(this._recalcSymbolSourceResolvingActive),s.symbolHibernated().subscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),
this._onSymbolSourceCollectionChanged())),e.isMultiPaneAvailable()&&this.model().addMultiPaneSource(e),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_removeSourceFromCollections(e,t){const i=this.m_dataSources[e],s=i.id();if(i.properties().unsubscribeAll(this),i.zOrderChanged().unsubscribeAll(this),this.m_dataSources.splice(e,1),this._sourcesById.delete(i.id()),(0,S.isLineTool)(i)&&(i.normalizedPointsChanged().unsubscribeAll(this),i.fixedPointChanged().unsubscribeAll(this),this._sourceWatchedValuesSubscriptions.has(s))){const e=this._sourceWatchedValuesSubscriptions.get(s);i.hasAlert().unsubscribe(e),i.linkKey().unsubscribe(e)}this._invalidateSourcesCache();const r=(0,Se.isSymbolSource)(i)?i:null;(0,ce.isPriceDataSource)(i)&&(this._priceSourcesById.delete(i.id()),i.currencyChanged().unsubscribeAll(this),i.unitChanged().unsubscribeAll(this),(0,y.removeItemFromArray)(this._priceDataSources,i),this._onPriceSourcesCollectionChanged(),null!==r&&((0,y.removeItemFromArray)(this._symbolSources,r),r.symbolResolved().unsubscribeAll(this),r.symbolResolvingActive().unsubscribe(this._recalcSymbolSourceResolvingActive),r.symbolHibernated().unsubscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),i.isMultiPaneAvailable()&&this.model().removeMultiPaneSource(i),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_recalculatePriceScaleByScaleRatio(e){this.isMainPane()&&e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToPriceScale():this._tryToApplyNewPriceScaleRatio())}_defaultBottomMargin(){return.01*this.properties().childs().bottomMargin.value()}_defaultTopMargin(){return.01*this.properties().childs().topMargin.value()}_updateMargins(){const e=this._defaultTopMargin(),t=this._defaultBottomMargin();for(const i of this._leftPriceScales)nt(i,e,t);for(const i of this._rightPriceScales)nt(i,e,t);for(const i of this.m_dataSources)if(this.isOverlay(i)){const s=i.priceScale();null!==s&&(nt(s,e,t),this.recalculatePriceScale(s,(0,Qe.viewportChangeEvent)()))}for(const e of this._leftPriceScales)this.recalculatePriceScale(e,(0,Qe.viewportChangeEvent)());for(const e of this._rightPriceScales)this.recalculatePriceScale(e,(0,Qe.viewportChangeEvent)());this.updateAllViews((0,Qe.viewportChangeEvent)())}_batchReorder(e,t,i){i(this.sourcesByGroup().allExceptSpecialSources(),e,t),this._invalidateSourcesCache(),this._dataSourcesCollectionChanged.fire(),this.model().fullUpdate()}_placePriceScale(e,t,i){if("overlay"===t)return void e.invalidateMargins();const s="left"===t?this._leftPriceScales:this._rightPriceScales,r=void 0===i?s.length:i;s.splice(r,0,e),e.modeChanged().subscribe(this,this._onPriceScaleModeChanged.bind(this,e)),e.internalHeightChanged().subscribe(this,this._recalculatePriceScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._recalculateTimeScaleByScaleRatio.bind(this,e)),
e.priceRangeChanged().subscribe(this,this._onPriceScaleSetMinMaxPriceRange.bind(this,e)),e.isVisible().subscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().subscribe(this._updateResetPriceScalesAvailableValue),e.isLockScale()&&((0,o.assert)(null===this._lockedPriceScale),this._lockedPriceScale=e,this._currentPriceScaleRatio=null),e.invalidateMargins(),this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue()}_onPriceScaleModeChanged(e,t,i){if(i.lockScale&&(this._lockedPriceScale!==e&&null!==this._lockedPriceScale&&this._lockedPriceScale.setMode({lockScale:!1}),this._lockedPriceScale=e,this._currentPriceScaleRatio=(0,Oe.scaleRatio)(this.timeScale(),e)),t.lockScale&&!i.lockScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null),t.percentage===i.percentage&&t.indexedTo100===i.indexedTo100)return;const s=this.timeScale().visibleBarsStrictRange();null!==s&&(e.recalculatePriceRange(s),e.updateAllViews((0,Qe.viewportChangeEvent)()))}_applyOldScaleRatioToPriceScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||null===this._lockedPriceScale||(this._isRecalculatingScales=!0,this._setNewPriceRangeByScaleRatio(this._lockedPriceScale,this._currentPriceScaleRatio,this._mainSourceVisiblePriceRange(this._lockedPriceScale)),this._isRecalculatingScales=!1)}_setNewPriceRangeByScaleRatio(e,t,i,s,r){const n=(0,Oe.priceRangeByScaleRatio)(e,this.timeScale().barSpacing(),t);e.setPriceRange(null!==n?n:i,s,r)}_applyOldScaleRatioToTimeScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||(this._isRecalculatingScales=!0,this._setNewBarSpacingByScaleRatio(),this._isRecalculatingScales=!1)}_tryToApplyNewPriceScaleRatio(){const e=(0,o.ensureNotNull)(this._lockedPriceScale),t=(0,Oe.scaleRatio)(this.timeScale(),e);this._currentPriceScaleRatio===t||e.isLog()||(this._currentPriceScaleRatio=t,this.model().mainSeriesScaleRatioPropertyOnChanged())}_recalculateTimeScaleByScaleRatio(e){e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToTimeScale():this._tryToApplyNewPriceScaleRatio())}_setNewBarSpacingByScaleRatio(){const e=this.timeScale().getValidBarSpacing((0,Oe.barSpacingByScaleRatio)((0,o.ensureNotNull)(this._lockedPriceScale),this._currentPriceScaleRatio));this.timeScale().isValidBarSpacing(e)&&this.timeScale().setBarSpacing(e)}_mainSourceVisiblePriceRange(e){const t=this.timeScale().visibleBarsStrictRange();return null!==t?(0,o.ensureNotNull)((0,o.ensureNotNull)(e.mainSource()).priceRange(t.firstBar(),t.lastBar(),{targetPriceScale:e,scaleSeriesOnly:e.isScaleSeriesOnly()})):new fe.PriceRange(-.5,.5)}_setMinMaxPriceRange(){const e=(0,o.ensureNotNull)(this._lockedPriceScale),t=(0,Oe.priceRangeByScaleRatio)(e,this.timeScale().maxBarSpacing(),this._currentPriceScaleRatio),i=(0,Oe.priceRangeByScaleRatio)(e,this.timeScale().minBarSpacing(),this._currentPriceScaleRatio);null!==t&&e.setMaxPriceRange(t),null!==i&&e.setMinPriceRange(i)}_onPriceScaleSetMinMaxPriceRange(e){e===this._lockedPriceScale&&this._setMinMaxPriceRange()}
_onPriceSourcesCollectionChanged(){0===this._bulkActions.activeCounter?this._priceSourcesCollectionChanged.fire():this._bulkActions.priceSourcesCollectionChanged=!0}_nonOverlayPricesSourcesCount(){return this.m_dataSources.filter((e=>(!(0,R.isStudy)(e)||!e.isLinkedToSeries())&&((0,ce.isPriceDataSource)(e)&&e.showInObjectTree()&&!this.isOverlay(e)))).length}_restoreMainSeries(e,t,i,s,r,n){var a,l,c;const h=e.id,d=e.state;if(d&&r&&(d.style=null!==(a=r.style)&&void 0!==a?a:d.style,d.interval=r.interval||d.interval,r.symbol&&r.symbol!==d.symbol&&(d.symbol=r.symbol,delete d.currencyId,delete d.unitId)),d&&["candleStyle","hollowCandleStyle","haStyle"].forEach((e=>{d[e]&&(d[e].wickUpColor=d[e].wickUpColor||d[e].wickColor,d[e].wickDownColor=d[e].wickDownColor||d[e].wickColor)})),d&&(d.statusViewStyle=d.statusViewStyle||{},!d.statusViewStyle.symbolTextSource)){const e=!!d.statusViewStyle.showSymbolAsDescription;d.statusViewStyle.symbolTextSource=e?"ticker":"description"}if(d){d.extendedHours?d.sessionId="extended":d.sessionId||(d.sessionId="regular"),delete d.extendedHours,(0,et.allChartStyles)().includes(d.style)||(d.style=2);const e=d.lineStyle.styleType;let t;delete d.lineStyle.styleType,0===e&&(t=14,d.lineWithMarkersStyle=(0,ae.clone)(d.lineStyle)),1===e&&(t=15,d.steplineStyle=(0,ae.clone)(d.lineStyle)),void 0!==t&&2===d.style&&(d.style=t)}if(!i){const e=this._model.mainSeries();(0,o.ensureNotNull)(this._model.mainPane()).removeDataSource(e,!1,n),this._addSourceToCollections(e,n)}const u=this.model().mainSeries(),p=u.properties().childs();this.m_mainDataSource=u;const _=d&&d.style?d.style:void 0;6===_&&"ATR"===p.pnfStyle.childs().inputs.childs().style.value()?p.pnfStyle.childs().inputs.childs().style.setValueSilently("Traditional"):4===_&&"ATR"===p.renkoStyle.childs().inputs.childs().style.value()&&p.renkoStyle.childs().inputs.childs().style.setValueSilently("Traditional"),d&&!d.hasOwnProperty("showSessions")&&(d.showSessions=!1),d&&void 0===d.settlementAsClose&&(d.settlementAsClose=!1),d&&t&&(d.showCountdown=!1),d&&(t&&!("showSeriesLastValueProperty"in s)&&"showLastValue"in d&&this._model.properties().childs().scalesProperties.childs().showSeriesLastValue.setValue(d.showLastValue),delete d.showLastValue),d&&this._restoreMainSeriesStudyInputs(e,u.styleStudyInfos());const m=u.sessionId();null===(l=(0,re.getPersistentLogger)())||void 0===l||l.addPersistentLogEntry(`Restore series. source.id: ${e.id} id: ${h}`,ie.LOGLEVEL.INFO,ot),u.restoreState(e,t),this.changeSourceId(u,h),null===(c=(0,re.getPersistentLogger)())||void 0===c||c.addPersistentLogEntry(`Series has been successfully restored. id: ${u.id()}`,ie.LOGLEVEL.INFO,ot),u.sessionId()!==m&&p.sessionId.listeners().fire(p.sessionId,"")}async _restoreMainSeriesStudyInputs(e,t){const i={haStyle:(0,be.chartStyleStudyId)(8,!0),renkoStyle:(0,be.chartStyleStudyId)(4,!0),pbStyle:(0,be.chartStyleStudyId)(7,!0),kagiStyle:(0,be.chartStyleStudyId)(5,!0),pnfStyle:(0,be.chartStyleStudyId)(6,!0),rangeStyle:(0,be.chartStyleStudyId)(11,!0),volFootprintStyle:(0,
be.chartStyleStudyId)(17,!0),tpoStyle:(0,be.chartStyleStudyId)(18,!0),svpStyle:(0,be.chartStyleStudyId)(20,!0)};await(0,V.studyMetaInfoRepository)().requestMetaInfo();const s=(0,V.studyMetaInfoRepository)().studyVersioning(),r=Object.keys(He.SYMBOL_STRING_DATA),n={},a=(0,o.ensureDefined)(e.state);for(let o=0;othis._right+.5?!0===t&&2:!0!==t||0}before(e){return ethis._right+.5}intersects(e){return!(this.after(e.left())||this.before(e.right()))}equals(e){return this._left===e.left()&&this._right===e.right()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}const pt=(0,ie.getLogger)("Chart.TimePoints");function _t(e,t){return null===e||null===t?e===t:e.firstIndex===t.firstIndex&&e.lastIndex===t.lastIndex}class mt{constructor(){this._zoffset=0,this._items=[],this._range=new F.WatchedObject(null,_t)}clear(){this._zoffset=0,this._items=[],this._range.setValue(null)}size(){return this._items.length}range(){return this._range.readonly()}merge(e,t,i){const s=this._mergeImpl(e,t,i);return this._updateFirstAndLastIndex(),s}addTail(e,t){for(let i=t?1:0;ithis._items[this._items.length-1])return t?this._validOffsetToIndex(this._items.length-1):null;for(let i=0;io){const i=e-o;if(i<500&&null!=t)return t(l,i);return l+i*c}return null}roughIndex(e,t=null){const i=this._items;if(!i.length||i.length<2)return null;const s=i.length-1,r=this._validOffsetToIndex(0),n=this._validOffsetToIndex(s),o=i[0],a=i[s];if(e>=o&&e<=a)return this.closestIndexLeft(e);const l=(a-o)/(n-r);if(ea){const i=e-a;let s=Math.trunc(i/l);if(s<500&&null!==t){const i=t(a,e);i.success&&(s=i.result)}return n+s}return null}closestIndexLeft(e){const t=this._items;if(!t.length)return null;if(Number.isNaN(e))return null;let i=t.length-1;if(e>=t[i])return this._validOffsetToIndex(i);let s=0;const r=t[s];if(es+1;){const r=s+i>>1,n=t[r];if(n>e)i=r;else{if(!(nthis._zoffset&&e+t>0)return pt.logError("merge: when the first time point index is updated, we should fill the time points starting from the first one"),[];if(0===this._items.length)return this._items=i.slice(),this._zoffset=t,[{change:"rebuild",index:this._validOffsetToIndex(0)}];const s=e+this._zoffset;if(s<0){const r=Math.abs(s);if(i.lengththis._items.length){const e=o-this._items.length;for(let t=n;t{this._usePercentageRightOffset.setValue(!1),this._defaultRightOffsetOptionsUpdated()})),this._defaultRightOffsetPercentage.subscribe((e=>{if(e>=100||e<0){const t=Math.max(0,Math.min(e,99));this._defaultRightOffsetPercentage.setValue(t)}else this._usePercentageRightOffset.setValue(!0),this._defaultRightOffsetOptionsUpdated()})),this._usePercentageRightOffset.subscribe((()=>{this._defaultRightOffsetOptionsUpdated()})),this._options.preserveBarSpacing&&(this._barSpacing=this._scalesProperties.childs().barSpacing.value()||6),this._barSpacingChanged.subscribe(this,this._maxRightOffsetOnChanged),this._barSpacingChanged.subscribe(this,this._updateResetAvailableValue),this._rightOffsetChanged.subscribe(this,this._updateResetAvailableValue),this._widthChanged.subscribe(this,this._maxRightOffsetOnChanged),this._updateResetAvailableValue()}destroy(){this._barSpacingChanged.unsubscribeAll(this),this._barSpacingChanged.destroy(),this._widthChanged.unsubscribeAll(this),this._widthChanged.destroy()}isEmpty(){return 0===this._width||!this.canNormalize()}canNormalize(){return this._points.size()>0}update(e,t,i,s){this._visibleBarsInvalidated=!0,i.length>0&&this._points.merge(e,t,i),this._tickMarks.merge(s),this.correctOffset()}addTail(e,t,i){this._tickMarks.removeTail(t);const s=e.params,r=(0,o.ensureDefined)(this._tickMarks.maxIndex)+(i?0:1);for(let e=0;e0&&(s*=this._width/e.width)),t&&this._pointWeights.needAdjustingOnDataRestoring()){this._tryToUpdateBarSpacing(this._barSpacing,s);const e=this._points.range().value();if(e){const t=e.firstIndex;let i=s,r=s,n=0;(()=>{n=this.indexToCoordinate(t),n<0?(r=s,i=s/10):(i=s,r=10*s)})();for(let e=0;e<20&&Math.abs(n)>2;e++){const e=(r+i)/2;this._tryToUpdateBarSpacing(this._barSpacing,e),n=this.indexToCoordinate(t),n<0?r=e:i=e}}}else this._tryToUpdateBarSpacing(this._barSpacing,s);this.correctOffset(),this._usePercentageRightOffset.value()&&(this._rightOffset=this.percentsToBarIndexLength(this._defaultRightOffsetPercentage.value())),this._rightOffsetChanged.fire(this._rightOffset)}marks(){if(this.isEmpty())return null;const e=this._barSpacing,t=5*((this._scalesProperties.childs().fontSize.value()||0)+4),i=Math.round(t/e),s=(0,o.ensureNotNull)(this.visibleBarsStrictRange()),r=Math.max(s.firstBar(),s.firstBar()-i),n=Math.max(s.lastBar(),s.lastBar()-i),a=this._tickMarks.build(e,t),l=[];for(const e of a){if(!(r<=e.index&&e.index<=n))continue;const t=this._tickMarks.indexToTime(e.index);null!==t&&l.push({coord:this.indexToCoordinate(e.index),label:this.formatLabel(t,e.span),span:e.span,major:e.label>=St.DAY_SPAN})}return l}visibleBarsStrictRange(){return this._visibleBarsInvalidated&&(this._visibleBarsInvalidated=!1,this._updateVisibleBars()),this._visibleBars.strictRange()}visibleBarsStrictRangeChanged(){return this._visibleBarsChanged}visibleStrictDataRange(e){const t=this.visibleBarsStrictRange();if(null===t)return null;const i=e.search(t.firstBar(),It.PlotRowSearchMode.NearestRight),s=e.search(t.lastBar(),It.PlotRowSearchMode.NearestLeft);return null===i||null===s?null:new dt.BarsRange(i.index,s.index)}visibleExtendedDataRange(e,t){const i=this.visibleBarsStrictRange();if(null===i)return null;let s=1===t?null:e.search(i.firstBar()-1,It.PlotRowSearchMode.NearestLeft),r=0===t?null:e.search(i.lastBar()+1,It.PlotRowSearchMode.NearestRight);return null===s&&(s=e.search(i.firstBar(),It.PlotRowSearchMode.NearestRight)),null===r&&(r=e.search(i.lastBar(),It.PlotRowSearchMode.NearestLeft)),null===s||null===r?null:new dt.BarsRange(s.index,r.index)}logicalRangeChanged(){return this._logicalRangeChanged}tickMarks(){return this._tickMarks}points(){return this._points}width(){return this._width}setWidth(e,t){if(!Number.isFinite(e)||e<=0)return void Et.logWarn(`setWidth: invalid argument: ${e}`);if(this._width===e)return;const i=this._usePercentageRightOffset.value()&&this._rightOffset>0?this.barIndexLengthToPercents(this._rightOffset):-1;if(this._visibleBarsInvalidated=!0,
(t||this._options.lockVisibleTimeRangeOnResize)&&this._width){const t=this._barSpacing*e/this._width;this._tryToUpdateBarSpacing(this._barSpacing,t)}else this._width&&this.setBarSpacing(this._barSpacing);if(null!==this._leftEdgeIndex){if((0,o.ensureNotNull)(this.visibleBarsStrictRange()).firstBar()<=this._leftEdgeIndex){const t=this._width-e;this._rightOffset-=Math.round(t/this._barSpacing)+1}}this._width=e,this._widthChanged.fire(e);const s=this._rightOffset;i>0?this._rightOffset=this.percentsToBarIndexLength(i):this.correctOffset(),this._rightOffset!==s&&this._rightOffsetChanged.fire(this._rightOffset),this._requestMoreData()}setLeftEdgeFix(e){this._leftEdgeIndex=e;const t=this.visibleBarsStrictRange();if(null===t)return;const i=t.firstBar()-e;if(i<0){const e=this._rightOffset-i-1;this.scrollToOffsetAnimated(e,500)}}indexToCoordinate(e){if(this.isEmpty())return 0;const t=this.baseIndex(),i=this._pointWeights.indexToTotalWeight(t+this._rightOffset+.5)-this._pointWeights.indexToTotalWeight(e);return this._width-i*this._barSpacing}indexToUserTime(e){return this._tickMarks.indexToTime(e)}timePointToIndex(e,t){switch(t){case 0:return this._points.indexOf(e,!1);case 1:return this._points.closestIndexLeft(e);default:return this._points.indexOf(e,!0)}}indexToTimePoint(e){return this._points.valueAt(e)}timeToCoordinate(e){const t=this._points.closestIndexLeft(e);if(null===t)return null;const i=(0,o.ensureNotNull)(this._points.valueAt(t)),s=this.indexToCoordinate(t);if(s<=0||s>=this._width)return null;const r=this.barSpacing(),n=this.baseIndex();let a;a=0===n?this._model.mainSeries().intervalObj().inMilliseconds()/1e3:(0,o.ensureNotNull)(this._points.valueAt(n))-(0,o.ensureNotNull)(this._points.valueAt(n-1));const l=s+(e-i)/a*r+1;return l<=0||l>=this._width?null:l}barBorders(e){const t={timePointIndex:e,left:NaN,center:NaN,right:NaN};return this.fillBarBorders([t]),t}fillBarBorders(e,t,i){var s,r;if(0===e.length)return;let n=null!==(s=null==t?void 0:t.startItemIndex)&&void 0!==s?s:0;const a=(null!==(r=null==t?void 0:t.endItemIndex)&&void 0!==r?r:e.length)-1;if(!0===i&&(n=(0,y.upperbound)(e,gt.UNPLOTTABLE_TIME_POINT_INDEX,((e,t)=>ea)return;const l=this._pointWeights.indexToTotalWeight(this.baseIndex()+this._rightOffset+.5),c=this._pointWeights.indexRangeToWeights(e[n].timePointIndex,e[a].timePointIndex,this._weightedPointsCache);let h=0,d=c[h];const u=d,p=c[c.length-1];let _=NaN,m=NaN,g=NaN,f=!0;for(let t=n;t<=a;t+=1){const i=e[t];if(i.timePointIndexp.timePointIndex)g=p.right+(i.timePointIndex-p.timePointIndex),m=g-.5,_=g-1;else for(f&&(_=d.left,m=d.center,g=d.right,f=!1);d.timePointIndexe{void 0!==t&&t(),this._requestMoreData()};if(e){const e=this.logicalRange(),t=this._model.mainSeries().bars().lastIndex();if(null===e||null===t)return;const i=this.indexToCoordinate(e.right()+.5),r=this.indexToCoordinate(t+this._defaultRightOffset.value()+.5);return this._model.stopTimeScaleAnimation(),void this._model.setTimeScaleAnimation(new Mt.Animation({from:0,to:i-r,duration:1e3,easing:ct.easingFunc.easeInOutQuint,onFinish:s}))}this._visibleBarsInvalidated=!0,this._updateRightOffset(i),this._onScroll.fire(),s()}scrollToFirstBar(e=(()=>{})){this._model.gotoTime(new Date("1800-01-01").getTime()).then(e),this._onScroll.fire()}scrollToOffsetAnimated(e,t){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");const i=void 0===t?400:t;if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const s=this._rightOffset,r=Date.now(),n=()=>{this._visibleBarsInvalidated=!0;const t=(Date.now()-r)/i;if(t>=1)return this._updateRightOffset(e),this._visibleBarsInvalidated=!0,this._model.recalculateAllPanes((0,Qe.viewportChangeEvent)()),void this._model.lightUpdate();const o=s+(e-s)*t;this._updateRightOffset(o),this._model.recalculateAllPanes((0,Qe.viewportChangeEvent)()),setTimeout(n,20)};n()}defaultRightOffset(){return this._defaultRightOffset}rightOffsetDefaultValue(){return 10}defaultRightOffsetPercentage(){return this._defaultRightOffsetPercentage}usePercentageRightOffset(){return this._usePercentageRightOffset}barSpacing(){return this._barSpacing}setBarSpacing(e){Number.isFinite(e)?(e=this.getValidBarSpacing(e),this._tryToUpdateBarSpacing(this._barSpacing,e)&&(this.correctOffset(),this._options.preserveBarSpacing&&((0,A.allowSavingDefaults)(!0),this._scalesProperties.childs().barSpacing.setValue(this._barSpacing),(0,A.allowSavingDefaults)(!1)),this._model.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this._model.lightUpdate())):Et.logWarn(`setBarSpacing: invalid argument: ${e}`)}barSpacingChanged(){return this._barSpacingChanged}getValidBarSpacing(e){return null==e&&(e=this.barSpacing()),ethis.maxBarSpacing()?this.maxBarSpacing():e}isValidBarSpacing(e){return e>=this.minBarSpacing()&&e<=this.maxBarSpacing()}preserveBarSpacing(){
return this._options.preserveBarSpacing}normalizeBarIndex(e){let t=0,i=0;const s=this.baseIndex(),r=(0,o.ensureNotNull)(this._points.range().value()).firstIndex;return es?(t=(0,o.ensureNotNull)(this._points.valueAt(s)),i=e-s):(t=(0,o.ensureNotNull)(this._points.valueAt(e)),i=0),{time_t:t,offset:i}}denormalizeTimePoint(e){const t=this._points.indexOf(e.time_t,!1);if(null!==t)return t+e.offset}rightOffset(){return this._rightOffset}rightOffsetChanged(){return this._rightOffsetChanged}minRightOffset(){var e;const t=null===(e=this.points().range().value())||void 0===e?void 0:e.firstIndex,i=this._baseIndex;if(void 0===t||null===i)return null;if(null!==this._leftEdgeIndex){const e=this.width()/this._barSpacing;return this._leftEdgeIndex-i+e-1}return t-i-1+Dt}maxRightOffset(){return this.width()/this._barSpacing-Dt}maxRightOffsetChanged(){return this._maxRightOffsetChanged}onReset(){return this._resetDelegate}baseIndex(){return this._baseIndex||0}zoom(e,t,i){if(!Number.isFinite(e)||!Number.isFinite(t))return void Et.logWarn(`zoom: invalid arguments: ${e}, ${t}, ${i}`);const s=this.rightOffset(),r=void 0!==i?!i:this._options.rightBarStaysOnScroll,n=r&&this.usePercentageRightOffset().value()&&s>=0,o=n?this.barIndexLengthToPercents(s):void 0,a=this.coordinateToIndex(e),l=this.barSpacing(),c=l+t*(l/10);this.setBarSpacing(c),r||(this.startScroll(this.indexToCoordinate(a)),this.scrollTo(e),this.endScroll()),n&&void 0!==o&&this.setRightOffset(this.percentsToBarIndexLength(o)),this._requestMoreData()}zoomToBarsRange(e,t){if(null!==this._leftEdgeIndex&&(e=Math.max(e,this._leftEdgeIndex)),tthis._options.minBarSpacing}minBarSpacing(){return this._options.minBarSpacing}maxBarSpacing(){const e=this.width();return kt?e:e/Dt}minVisibleBarCount(){return Dt}resetRightOffset(){this.setRightOffset(this.targetDefaultRightOffset())}reset(){this._visibleBarsInvalidated=!0,this._points.clear(),this._scrollData=null,this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._tickMarks.reset(),this._leftEdgeIndex=null,this._resetDelegate.fire(),this.disconnect()}resetAvailable(){
return this._resetAvailable.readonly()}disconnect(){this._requestingMoreData=!1,this._requestedTickmarksCount=0,this._endOfData=!1}setBaseIndex(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._baseIndex=e,this._pointWeights.setBaseIndex(this._baseIndex),this.correctOffset()):Et.logDebug(`setBaseIndex: invalid argument: ${e}`)}resetBaseIndex(){this._visibleBarsInvalidated=!0,this._baseIndex=null}setRightOffset(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._updateRightOffset(e)):Et.logWarn(`setRightOffset: invalid argument: ${e}`)}correctBarSpacing(){this.isEmpty()||this.points().size()e&&(this._rightOffset=e,this._visibleBarsInvalidated=!0);const t=this.minRightOffset();null!==t&&this._rightOffset=0&&this.setRightOffset(this.percentsToBarIndexLength(s))}endScale(){null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._requestMoreData())}startScroll(e){null===this._scrollData&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scrollData={startCoordinate:e,startRightEdgeLogical:this.baseIndex()+this._rightOffset+.5,startBaseIndex:this.baseIndex()},this._saveCommonTransitionsStartState()))}scrollTo(e){if(this._visibleBarsInvalidated=!0,null===this._scrollData)return;const{startCoordinate:t,startRightEdgeLogical:i,startBaseIndex:s}=this._scrollData,r=e-t,n=i+(this.baseIndex()-s),o=this.indexToCoordinate(n),a=this.coordinateToFloatIndex(o-r)-.5-this.baseIndex();this._updateRightOffset(a),this._onScroll.fire()}endScroll(){null!==this._scrollData&&(this._scrollData=null,
this._clearCommonTransitionsStartState(),this._requestMoreData())}formatLabel(e,t){const i="24-hours"===Pt.timeHoursFormatProperty.value()?t.toString():`${t}_ampm`;let s=this._formattedBySpan.get(i);return void 0===s&&(s=new bt((e=>this.formatLabelImpl(e,t))),this._formattedBySpan.set(i,s)),s.format(new Date(e))}formatLabelImpl(e,t){if(!(e&&e instanceof Date))return"incorrect time";const s=function(e,t){if(e===St.MILLISECOND_SPAN&&t)return"TimeWithMilliseconds";if(e=0){const e=this._defaultRightOffsetPercentage.value(),t=this._usePercentageRightOffset.value()&&this._rightOffset>=0?Math.round(this.barIndexLengthToPercents(this._rightOffset)):-1;if(this._lastDefaultRightOffset!==e&&t===this._lastDefaultRightOffset){const t=this._barSpacing*(100-e)/(100-this._lastDefaultRightOffset);this._tryToUpdateBarSpacing(this._barSpacing,t)}}this.setRightOffset(this.targetDefaultRightOffset()),this._updateResetAvailableValue(),this._lastDefaultRightOffset=this._defaultRightOffsetPercentage.value()}_updateResetAvailableValue(){
this._resetAvailable.setValue(6!==this.barSpacing()||this.rightOffset()!==this.targetDefaultRightOffset())}}var Rt=i(52388),Nt=i(82826),Ot=i(63829),Ft=i(62839);class Wt{constructor(e){this._onChanged=new N.Delegate,this._groups=[],this._groups=e||[],this._groups.forEach((e=>{e.onChanged().subscribe(null,(t=>this._onChanged.fire(e.id,t)))}))}groups(){return this._groups.filter((e=>e.isActualSymbol()))}groupsForAllSymbols(){return this._groups}createGroup(e,t,i){t=t||this._generateNextName();const s=new Ft.LineToolsGroup(e,t,i);this._groups.push(s),s.onChanged().subscribe(null,(e=>this._onChanged.fire(s.id,e)));const r={visibilityChanged:!1,lockedChanged:!1,isActualIntervalChanged:!1,affectedLineTools:e.map((e=>e.id()))};return this._onChanged.fire(s.id,r),s}addGroup(e){this._groups.push(e),e.onChanged().subscribe(null,(t=>this._onChanged.fire(e.id,t))),this._onChanged.fire(e.id)}removeGroup(e){const t=this._groups.findIndex((t=>t.id===e.id));this._groups.splice(t,1),this._onChanged.fire(e.id)}groupForId(e){return this._groups.find((t=>t.id===e))||null}groupForLineTool(e){return this._groups.find((t=>t.containsLineTool(e)))||null}removeLineTools(e){const t=new Set;this._groups.forEach((i=>{const s=e.filter(i.containsLineTool.bind(i));s.length&&(i.excludeLineTools(s),t.add(i.id))}));return this._groups.filter((e=>0===e.lineTools().length)).forEach((e=>this.removeGroup(e))),Array.from(t)}state(e){return{groups:(e?this._groups.filter((e=>e.isActualSymbol())):this._groups).map((e=>e.state()))}}onChanged(){return this._onChanged}fireChangedAll(){this._groups.forEach((e=>{this._onChanged.fire(e.id)}))}static fromState(e,t){const i=[];for(const s of t.groups){const t=Ft.LineToolsGroup.fromState(e,s);null!==t&&i.push(t)}return new Wt(i)}_generateNextName(){const e=new Set(this.groups().map((e=>e.name().value())));for(let t=1;;t++){const i=`Group ${t}`,s=`Group_${t}`;if(!e.has(i)&&!e.has(s))return i}}}var Ht=i(2740),zt=i.n(Ht),Ut=i(14381);let jt=null;function Gt(e){return Boolean(e.symbolInfo.timezone)&&Boolean(e.symbolInfo.session)}class qt{constructor(e,t){var i,s;this._sourceTargetBarBuilder=null,this._cache=new Map,this._source=e,this._sourceSession=Ut.SessionInfo.fromState(e.session),this._target=t,this._targetSession=Ut.SessionInfo.fromState(t.session),this._isResolutionTheSame=M.Interval.isEqual(e.resolution,t.resolution)||M.Interval.isTicks(e.resolution)&&M.Interval.isTicks(t.resolution),this._isSessionTheSame=(i=e.symbolInfo,s=t.symbolInfo,i.timezone===s.timezone&&i.session===s.session&&i.session_holidays===s.session_holidays&&i.corrections===s.corrections),this._shouldCorrectTradingDay=M.Interval.isDWM(e.resolution)&&!this._isSessionTheSame}sourceTimeToTargetTime(e){if(this._isSessionTheSame&&this._isResolutionTheSame)return e;if(!Gt(this._source)||!Gt(this._target))return e;let t=this._cache.get(e);if(void 0===t){let i=1e3*e;if(this._shouldCorrectTradingDay){let e=zt().utc_to_cal(this._sourceSession.timezone,i);e=this._sourceSession.spec.correctTradingDay(e);const t=new Date(e)
;zt().set_hms(t,0,0,0,0,this._sourceSession.timezone),i=t.valueOf()}const s=this._sourceTargetBuilder();s.moveTo(i);const r=s.indexOfBar(i);t=s.startOfBar(Math.max(0,r))/1e3,this._cache.set(e,t)}return t}_sourceTargetBuilder(){if(null===this._sourceTargetBarBuilder){const e=this._isSessionTheSame?this._targetSession:(null===jt&&(jt=new Ut.SessionInfo("Etc/UTC","24x7")),jt);this._sourceTargetBarBuilder=(0,Ut.newBarBuilder)(this._target.resolution,this._targetSession,e)}return this._sourceTargetBarBuilder}}var $t=i(56468),Kt=i(19063),Yt=i(41925),Zt=i(46088);function Xt(e,t){return e.codet.code?1:0}class Jt{constructor(e){this._convertibleItems=e,this._idsToItems=new Map;for(const t of e)this._idsToItems.set(t.id,t)}convertible(e){return void 0!==this._idsToItems.get(e)}item(e){var t;return null!==(t=this._idsToItems.get(e))&&void 0!==t?t:null}size(){return this._convertibleItems.length}filterConvertible(e,t){const i=this._convertibleItems.filter(function(e,t){return i=>!e.has(i.id)&&t(i.id)}(e,t));return i.sort(Xt),i}getItems(){return this._convertibleItems.map((e=>e.id))}}class Qt{constructor(e){this._allGroups=new Set,this._idToName=new Map,this._idToDescription=new Map,this._groupedUnitIds=new Map,this._groupedUnits=new Map,this._groupById=new Map,this._size=0,this._units=e;for(const t in e)if(e.hasOwnProperty(t)){this._allGroups.add(t),this._groupedUnitIds.set(t,new Set(e[t].map((e=>e.id)))),this._groupedUnits.set(t,e[t]);for(const i of e[t])this._size++,this._idToName.set(i.id,i.name),this._idToDescription.set(i.id,i.description),this._groupById.set(i.id,t)}}unitsChanged(e){return this._units!==e}size(){return this._size}name(e){return this._idToName.get(e)||e}description(e){return this._idToDescription.get(e)||e}unitGroupById(e){return this._groupById.get(e)||null}allGroups(){return new Set(this._allGroups)}unitsByGroups(e){const t=[];return e.forEach((e=>{const i=this._groupedUnits.get(e);void 0!==i&&t.push({name:e,units:i})})),t}convertible(e,t){for(const i of t){const t=this._groupedUnitIds.get(i);if(void 0!==t&&t.has(e))return!0}return!1}}var ei=i(50335);class ti{constructor(e){this._source=null,this._sourcePane=null,this._currentToolSupportsPhantomMode=!1,this._model=e}destroy(){this._source=null,this._sourcePane=null}source(){return this._source}onToolChanged(){this._removeSource();const e=this._model.currentTool();this._currentToolSupportsPhantomMode=(0,ge.isLineToolName)(e)&&(0,S.supportsPhantomMode)(e)}onCursorPositionUpdated(){if(!this._currentToolSupportsPhantomMode)return;const e=this._model.crossHairSource();if(this._sourcePane!==e.pane&&this._removeSource(),null===e.pane||!(0,ei.isNumber)(e.index)||!(0,ei.isNumber)(e.price))return void this._removeSource();const t={index:e.index,price:e.price};null!==this._source?this._source.setPoint(0,t):(this._source=this._model.createLineTool({pane:e.pane,point:t,linetool:this._model.currentTool()}),this._sourcePane=e.pane)}_removeSource(){null!==this._source&&(this._model.removeSource(this._source),this._source=null,this._sourcePane=null)}}
var ii,si=i(82783),ri=i(92693),ni=i(81171);!function(e){e[e.MagnetTolerance=50]="MagnetTolerance"}(ii||(ii={}));class oi{constructor(){this._lastValue=null}align(e,t,i){this._lastValue=null;let s=e;if(!(0,ni.magnetEnabled)().value())return s;const r=i.mainDataSource();if(null===r)return s;const n=r.model().mainSeries();if(r!==n)return s;const a=n.priceScale();if(a.isEmpty())return s;const l=function(e,t){const i=e.bars().valueAt(t);if(null===i)return;let s;if(null!==e.priceSource())s=[e.barFunction()(i)];else switch(e.style()){case 12:s=[i[2],i[3]];break;case 16:s=[i[2],i[4],i[3]];break;default:s=[i[1],i[2],i[3],i[4]]}return s}(n,t);if(!l)return s;const c=(0,o.ensure)(n.firstValue()),h=l.map((e=>({y:a.priceToCoordinate(e,c),price:e}))),d=a.priceToCoordinate(e,c);h.sort(((e,t)=>Math.abs(e.y-d)-Math.abs(t.y-d)));const u=h[0];return((0,ni.magnetMode)().value()===ri.MagnetMode.StrongMagnet||Math.abs(u.y-d)<50)&&(s=u.price,this._lastValue=s),s}lastValue(){return this._lastValue}resetLastValue(){this._lastValue=null}}var ai=i(53388),li=i(37743),ci=i(30125);class hi extends ci.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e){return null}_drawImpl(e){if(null===this._data)return;const{context:t,verticalPixelRatio:i,horizontalPixelRatio:s,bitmapSize:r}=e,n=Math.max(1,Math.floor(s));t.lineWidth=n;const o=Math.ceil(r.height*i),a=Math.ceil(r.width*s);if(t.lineCap="butt",this._data.vertLinesVisible){t.strokeStyle=this._data.vertLinesColor,(0,li.setLineStyle)(t,this._data.vertLineStyle);for(const e of this._data.timeMarks){const i=Math.round(e.coord*s);(0,li.drawVerticalLine)(t,i,0,o)}}if(this._data.horzLinesVisible){t.strokeStyle=this._data.horzLinesColor,(0,li.setLineStyle)(t,this._data.horzLineStyle);for(const e of this._data.priceMarks){const s=Math.round(e.coord*i);(0,li.drawHorizontalLine)(t,s,0,a)}}}}class di{constructor(e){this._renderer=new hi,this._pane=e}update(){}renderer(){const e=this._pane.defaultPriceScale(),t=this._pane.model().timeScale();if(e.isEmpty()||t.isEmpty())return null;const i=this._pane.model().properties().childs().paneProperties.childs(),s=t.marks(),r=i.gridLinesMode.value(),n={horzLinesVisible:"both"===r||"horz"===r,vertLinesVisible:"both"===r||"vert"===r,horzLinesColor:i.horzGridProperties.childs().color.value(),vertLinesColor:i.vertGridProperties.childs().color.value(),horzLineStyle:i.horzGridProperties.childs().style.value(),vertLineStyle:i.vertGridProperties.childs().style.value(),priceMarks:e.marks(),timeMarks:null!==s?s:[]};return this._renderer.setData(n),this._renderer}}class ui extends G.DataSource{id(){return"grid"}paneViews(e){return[new di(e)]}name(){return"Grid"}}var pi=i(98558);class _i extends pi.PriceAxisView{constructor(e,t,i,s){super(),this._source=e,this._pane=t,this._priceScale=i,this._priceProvider=s,this._properties=e.model().properties().childs().scalesProperties}setHitTestData(e){this._hitTestData=e}setXCoord(e){this._xCoord=e}additionalPadding(e){return 0}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1
;const s=this._priceScale,r=s.mainSource(),n=null!==r?r.firstValue():null;if(!this._isVisible()||s.isEmpty()||null===n)return;const o=this._currentPrice(s);if(null===o)return;i.background=(0,Kt.resetTransparency)(this._bgColor()),i.textColor=this.generateTextColor(i.background);const a=this.additionalPadding(s.fontSize());i.additionalPaddingTop=a,i.additionalPaddingBottom=a,i.coordinate=s.priceToCoordinate(o,n),e.text=s.formatPrice(o,n),e.visible=!0,t.visible=!0,t.hitTestData=this._hitTestData,t.xCoord=this._xCoord}_currentPrice(e){return this._priceProvider(e)}}class mi extends _i{additionalPadding(e){return 2/12*e}_isVisible(){const e=this._source.lockedPane();return this._properties.childs().showPriceScaleCrosshairLabel.value()&&(this._source.visible||null!==e)&&(null!=e?e:this._source.pane)===this._pane}_currentPrice(e){const t=Le.crosshairLock.value();return null!==t&&1===t.type?this._pane===this._source.lockedPane()?t.price:null:super._currentPrice(e)}_bgColor(){const e=this._properties.childs();return this._source.model().dark().value()?e.crosshairLabelBgColorDark.value():e.crosshairLabelBgColorLight.value()}_updateRendererData(e,t,i){const s=t.visible;super._updateRendererData(e,t,i),this._source.isHovered()?t.backgroung=this._source.model().dark().value()?c.colorsPalette["color-cold-gray-600"]:c.colorsPalette["color-cold-gray-650"]:t.backgroung=void 0,s||(t.visible=s)}}class gi extends _i{_isVisible(){return null!==this._source.measurePane().value()}_bgColor(){return this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}}var fi,vi=i(65458),yi=(i(97702),i(40443)),Si=(i(19466),i(19475));i(81199);function bi(e){const t=e.priceScale();return null===t?0:t.isPercentage()||t.isIndexedTo100()?2:1}!function(e){e[e.NotDefined=0]="NotDefined",e[e.Regular=1]="Regular",e[e.Unregular=2]="Unregular"}(fi||(fi={}));class wi extends vi.PanePriceAxisView{constructor(e,t,i,s,r){super(e,t,s),this._crossHairMenuCachedState=null,this._hasActions=!1,this._gaOrigin="CH menu",this._crosshairPriceAxisView=e,e.setPaneRendererLabelIcon(0),this._crosshair=t,this._scale=i,this._options=r,this._updateGaOrigin()}_updateImpl(e){const t=this._crosshair.y,i=this._chartModel.properties().childs().scalesProperties.childs().fontSize.value(),s=this._chartModel.timeScale().width(),r=this._crosshair.model().priceAxisRendererOptions(),n=i+2*this._crosshairPriceAxisView.additionalPadding(i)+r.paddingTop+r.paddingBottom,o=n,l=t-n/2,c=this._crosshair.pane,h=this._mainDataSourceOnPane(),d=h&&h.symbolSource(),u=!!d&&(d.isConvertedToOtherCurrency()||d.isConvertedToOtherUnit());if(this._updateGaOrigin(),null!==h){const e=bi(h),t=h.idForAlert(),i=this._chartModel.isInReplay().value(),s=this._crossHairMenuCachedState,r=te.enabled("chart_crosshair_menu");null!==s&&s.id===t&&s.priceScale===e&&s.isCurrencyOrUnitConverted===u&&s.isInReplay===i&&s.isMenuEnabled===r||(this._updateTooltipAndActionsAvailability(h,e,u),this._crossHairMenuCachedState={id:t,priceScale:e,isCurrencyOrUnitConverted:u,isInReplay:i,isMenuEnabled:r})}const p=null!==h&&(0,
Se.isActingAsSymbolSource)(h)?h.symbol():null,_=null!==c&&(c.maximized().value()||!c.collapsed().value())&&(Boolean(p)||!1);this._crosshairPriceAxisView.setPaneLabelVisible(_);const m=this._position();if(null!==m){const e=0,t=s-o,i=Boolean(Si.showPlusButtonOnCursor.value()),r=i?this._crosshair.x:void 0,c=void 0!==r?r-o/2:"left"===m?e:t,h=void 0!==r?r+o/2:"left"===m?e+o:t+o,d=(0,a.box)(new a.Point(c,l),new a.Point(h,l+n));this._data={itemBox:d,clickHandler:this._handleClick.bind(this,m,i,d)},this._crosshairPriceAxisView.setHitTestData(this._data),this._crosshairPriceAxisView.setXCoord(r)}super._updateImpl(e)}_priceScale(){return this._scale}_updateGaOrigin(){this._gaOrigin=Boolean(Si.showPlusButtonOnCursor.value())?"CH menu cursor":"CH menu"}_updateTooltipAndActionsAvailability(e,t,i){this._hasActions=!1;if(!(1===t))return;this._chartModel.isInReplay().value();this._hasActions=!1}_handleClick(e,t,i,s,r){(0,p.trackEvent)(this._gaOrigin,"click");const n=this._mainDataSourceOnPane(),o=null!==n&&(0,Se.isActingAsSymbolSource)(n)?n.symbol():null,a={pageX:r.pageX,pageY:r.pageY,clientX:r.clientX,clientY:r.clientY,screenX:r.screenX,screenY:r.screenY,price:this._crosshair.price,symbol:o};m.emit("onPlusClick",a)}_getMenuItems(e){return Promise.resolve([])}_createAlertMenuItems(e){return Promise.resolve([])}_createTradingMenuItems(){return Promise.resolve([])}_createAddHorizontalLineMenuItem(){return[]}_getActionAddAlert(e){return null}_getActionAddHorizontalLine(e){return null}_getValue(e,t){const i=e.priceScale(),s=e.firstValue();if(null===i||null===s)return null;return i.isPercentage()||i.isIndexedTo100()?null:i.coordinateToPrice(t,s)}_formatValue(e,t){return t.formatter().format(e)}async _addAlert(e,t){}_addHorizontalLineTool(e,t){}_showContextMenu(e,t,i,s,r){const n="left"===r;setTimeout((()=>{const r=s.clientX-s.localX,a=s.clientY-s.localY,l=i.min.x+r,c=i.max.x+r,h=i.min.y+a,d=c-l,u=i.max.y+a-h,p=t?Le.crosshairLock.value():void 0;if(void 0!==p){const e=(0,o.ensureNotNull)(this._chartModel.timeScale().points().roughTime(this._crosshair.index));Le.crosshairLock.setValue({type:1,price:this._crosshair.price,time:e,modelId:this._chartModel.id(),paneId:(0,o.ensureNotNull)(this._crosshair.pane).id()})}yi.ContextMenuManager.showMenu(e,{clientX:s.clientX,clientY:s.clientY,box:{x:l,w:d,y:h,h:u},attachToXBy:t?"auto":n?"left":"right",attachToYBy:"auto-strict",marginX:t?0:-d},void 0,{menuName:"CrosshairMenuView"},(()=>{void 0!==p&&Le.crosshairLock.setValue(p)}))}))}_mainDataSourceOnPane(){const e=this._crosshair.pane;return null!==e?e.mainDataSource():null}}var Ci,Pi=i(51056),xi=i(69186);class Ti extends ci.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return void 0===this._data.clickHandler?null:new $t.HitTestResult($t.HitTarget.Custom,{clickHandler:this._data.clickHandler,tapHandler:this._data.clickHandler})}_drawImpl(e){const t=this._data.vertLinesVisible,i=this._data.horzLinesVisible;if(!t&&!i)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:n,bitmapSize:o}=e
;s.lineWidth=Math.max(1,Math.floor(this._data.lineWidth*r)),s.strokeStyle=this._data.color,s.fillStyle=this._data.color,s.lineCap="butt",(0,li.setLineStyle)(s,this._data.lineStyle);const a=Math.round(this._data.x*r),l=Math.round(this._data.y*n),c=Math.ceil(o.width*r),h=Math.ceil(o.height*n);t&&a>=0&&(0,li.drawVerticalLine)(s,a,0,h),i&&l>=0&&(0,li.drawHorizontalLine)(s,l,0,c),this._data.drawCenter&&(s.beginPath(),s.arc(a,l,Math.round(3*r),0,2*Math.PI,!0),s.fillStyle=this._data.color,s.fill()),this._data.scissors&&function(e,t,i){const{context:s,bitmapSize:r,horizontalPixelRatio:n,verticalPixelRatio:o}=e,a=24*n,l=Math.round(t-a/2);let c=Math.round(i-a/2);if(c<0)c=0;else{const e=r.height-a;c>e&&(c=e)}s.translate(l,c),s.scale(n,o),s.fillStyle="#131722",s.fill(Ii),s.strokeStyle="#fff",s.lineWidth=1,s.stroke(Ii)}(e,a,l)}}!function(e){e.Path="m15.68 3.72-3.82 5.52-3.83-5.52-.28-.42-.42.3a2.84 2.84 0 0 0-.68 3.92l3.27 4.73-1.16 1.68a3.34 3.34 0 0 0-4.26 3.22 3.34 3.34 0 0 0 3.32 3.35 3.34 3.34 0 0 0 3.08-4.6l1-1.44 1.13 1.62a3.34 3.34 0 0 0 3.15 4.42c1.84 0 3.32-1.5 3.32-3.35a3.34 3.34 0 0 0-4.42-3.17l-1.23-1.78 3.22-4.65a2.86 2.86 0 0 0-.69-3.96l-.41-.29-.29.42ZM7.82 16.27c.47 0 .86.39.86.88 0 .48-.39.87-.86.87a.87.87 0 0 1-.86-.87c0-.5.4-.88.86-.88Zm8.36 0c.47 0 .86.39.86.88 0 .48-.4.87-.86.87a.87.87 0 0 1-.86-.87c0-.5.39-.88.86-.88Z",e[e.Size=24]="Size",e.FillColor="#131722",e.StrokeColor="#fff",e[e.StrokeWidth=1]="StrokeWidth"}(Ci||(Ci={}));const Ii=new Path2D("m15.68 3.72-3.82 5.52-3.83-5.52-.28-.42-.42.3a2.84 2.84 0 0 0-.68 3.92l3.27 4.73-1.16 1.68a3.34 3.34 0 0 0-4.26 3.22 3.34 3.34 0 0 0 3.32 3.35 3.34 3.34 0 0 0 3.08-4.6l1-1.44 1.13 1.62a3.34 3.34 0 0 0 3.15 4.42c1.84 0 3.32-1.5 3.32-3.35a3.34 3.34 0 0 0-4.42-3.17l-1.23-1.78 3.22-4.65a2.86 2.86 0 0 0-.69-3.96l-.41-.29-.29.42ZM7.82 16.27c.47 0 .86.39.86.88 0 .48-.39.87-.86.87a.87.87 0 0 1-.86-.87c0-.5.4-.88.86-.88Zm8.36 0c.47 0 .86.39.86.88 0 .48-.4.87-.86.87a.87.87 0 0 1-.86-.87c0-.5.39-.88.86-.88Z");const Mi=c.colorsPalette["color-tv-blue-500"];class Ai{constructor(e,t){this._rendererData={},this._renderer=new Ti(this._rendererData),this._source=e,this._pane=t}update(){}renderer(){var e,t;const i=this._source.selectPointMode().value()!==Le.SelectPointMode.None,s=this._source.lockedPane(),r=(this._source.visible||null!==s)&&(this._source.areLinesVisible||i)&&!this._source.linesShouldBeHidden(),n=this._rendererData;if(!r||null===this._pane)return null;const a=this._source.paneForPointSelect(),l=this._source.isReplaySelection(),c=null!=s?s:this._source.pane,h=this._pane===c,d=l||(null!==a?c===a&&this._pane===a:h);if(n.scissors=!1,i&&(l||this._source.isOnHoveredChartWidget())&&d){const e=(0,o.ensureNotNull)(this._source.pointToSelect());n.color=this._source.lineColor()||Mi,l?(n.lineWidth=2,n.scissors=h):n.lineWidth=1,n.lineStyle=Pi.LINESTYLE_SOLID,n.horzLinesVisible=!0,n.vertLinesVisible=!0,n.drawCenter=!1,"time"===e?n.horzLinesVisible=!1:"price"===e&&(n.vertLinesVisible=!1)}else{const e=this._source.properties(),t=this._source.model().currentTool(),i=(0,
xi.lastMouseOrTouchEventInfo)(),s=i.isTouch&&!i.stylus&&((0,ge.isLineToolName)(t)||(0,Le.toolIsMeasure)(t));let r;r=s?Mi:e.childs().color.value();const o=e.childs().transparency.value();!s&&o>0&&(r=(0,Kt.generateColor)(r,o)),n.color=r,n.horzLinesVisible=this._pane===c&&(this._pane.maximized().value()||!this._pane.collapsed().value()),n.vertLinesVisible=!0,n.lineWidth=e.childs().width.value(),n.lineStyle=e.childs().style.value(),n.drawCenter=s&&this._pane===c}return n.x=null!==(e=this._source.lockedX())&&void 0!==e?e:this._source.x,n.y=null!==(t=this._source.lockedY())&&void 0!==t?t:this._source.y,this._renderer}}var Li=i(62189);const ki={backgroundColor:(0,Kt.generateColor)(c.colorsPalette["color-tv-blue-500"],70),borderColor:(0,Kt.generateColor)(c.colorsPalette["color-tv-blue-500"],20)};class Di{constructor(e){this._renderer=new Li.RectangleRenderer,this._rectangle=null,this._crosshair=e}update(){const e=this._crosshair.selection();null!==e&&null!==this._crosshair.pane?this._rectangle=this._crosshair.pane.logicalRectToPixels(e):this._rectangle=null}renderer(){if(!this._rectangle)return null;const e={backcolor:ki.backgroundColor,color:ki.borderColor,fillBackground:!0,linewidth:1,points:[this._rectangle.min,this._rectangle.max],extendLeft:!1,extendRight:!1};return this._renderer.setData(e),this._renderer}}var Ei=i(63273),Vi=i(92953),Bi=i(91046),Ri=i(17330),Ni=i(95201),Oi=i(49857);const Fi=h.t(null,void 0,i(41643)),Wi=h.t(null,{context:"study"},i(24261)),Hi=(0,De.getPercentageFormatter)(),zi=new Vi.TimeSpanFormatter,Ui=(0,De.getVolumeFormatter)(),ji=(0,c.getHexColorByName)("color-tv-blue-500"),Gi=(0,c.getHexColorByName)("color-ripe-red-400"),qi={bgColorPositive:(0,Kt.generateColor)(ji,80),bgColorNegative:(0,Kt.generateColor)(Gi,80),colorPositive:(0,c.getHexColorByName)("color-tv-blue-600"),colorNegative:(0,c.getHexColorByName)("color-ripe-red-400"),labelBgColorPositive:ji,labelBgColorNegative:Gi};var $i;!function(e){e[e.MinArrowDistance=50]="MinArrowDistance"}($i||($i={}));class Ki{constructor(e,t){this._horzTrenRenderer=new Bi.TrendLineRenderer,this._vertTrenRenderer=new Bi.TrendLineRenderer,this._bgRenderer=new Li.RectangleRenderer,this._labelRenderer=new Ri.TextRenderer,this._p1=null,this._p2=null,this._label=null,this._source=e,this._pane=t}update(e){var t,i;const[s,r]=this._source.measurePoints();if(void 0===r)return this._p1=null,void(this._p2=null);const n=(0,o.ensureNotNull)(this._source.measurePane().value()),l=s.price,c=r.price,h=r.index-s.index,d=(0,Ei.forceLTRStr)(""+h),u=(0,o.ensureNotNull)(n.mainDataSource()),p=(0,o.ensureNotNull)(u.formatter()),_=r.price-l;let m=null!==(i=null===(t=p.formatChange)||void 0===t?void 0:t.call(p,r.price,l))&&void 0!==i?i:p.format(_);if(Math.abs(l)>1e-8){const e=_/Math.abs(l);m+=" ("+Hi.format(100*e)+")"}const g=(0,Ei.forceLTRStr)(m);this._label=g+"\n"+Fi.format({count:d});const f=(0,
o.ensureNotNull)(u.firstValue()),v=this._source.model().timeScale().indexToCoordinate(s.index),y=this._source.model().timeScale().indexToCoordinate(r.index),S=n.defaultPriceScale().priceToCoordinate(l,f),b=n.defaultPriceScale().priceToCoordinate(c,f);this._p1=new a.Point(v,S),this._p2=new a.Point(y,b);const w=this._source.model().timeScale().indexToUserTime(s.index),C=this._source.model().timeScale().indexToUserTime(r.index);let P=null;null!==w&&null!==C&&(P=(C.valueOf()-w.valueOf())/1e3);const x=this._pane.model().mainSeries().symbolInfo(),T=x&&(0,De.getPipFormatter)(x),I=T?T.format(_):null,M=null!==I?" , "+I:"",A=null!==P?zi.format(P):null,L=null!==A?", "+(0,Ei.startWithLTR)(A):"";this._label=(0,Ei.forceLTRStr)(g+M)+"\n"+Fi.format({count:d})+L;const k=this._source.measureVolume();Number.isNaN(k)||(this._label+=`\n${Wi} ${Ui.format(k)}`);const E=c=50?Oi.LineEnd.Arrow:Oi.LineEnd.Normal};this._horzTrenRenderer.setData(s)}{const e=Math.round(N.x),t=new a.Point(e,this._p1.y),i=new a.Point(e,this._p2.y),s={points:[t,i],color:V,linewidth:1,linestyle:Pi.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:Oi.LineEnd.Normal,rightend:Math.abs(t.y-i.y)>=50?Oi.LineEnd.Arrow:Oi.LineEnd.Normal};this._vertTrenRenderer.setData(s)}const O={x:0,y:10},F=.5*(this._p1.x+this._p2.x),W=this._p2.y,H=new a.Point(F,W),z=(U=(0,o.ensureNotNull)(this._label),{points:[H],text:U,color:"#FFFFFF",horzAlign:"center",vertAlign:"middle",font:D.CHART_FONT_FAMILY,offsetX:O.x,offsetY:O.y,bold:!1,italic:!1,fontsize:12,padding:8,highlightBorder:!1,backgroundColor:B,backgroundTransparency:10,boxPaddingVert:9,boxPaddingHorz:9,backgroundRoundRect:4});var U;this._labelRenderer.setData(z);const j=this._labelRenderer.measure(),G=(0,Ri.calculateLabelPosition)(j,this._p1,this._p2,O,this._pane.height());this._labelRenderer.setPoints([G])}renderer(){if(null===this._p1||null===this._p2)return null;const e=new Ni.CompositeRenderer;return e.append(this._bgRenderer),e.append(this._horzTrenRenderer),e.append(this._vertTrenRenderer),e.append(this._labelRenderer),e}}var Yi,Zi=i(12027),Xi=i(99875);!function(e){e[e.Light=0]="Light",e[e.Dark=1]="Dark"}(Yi||(Yi={}));class Ji extends K.MediaCoordinatesPaneRenderer{constructor(e){super(),this._svgMap=new Map,this._data=e,this._svgMap.set(e.theme,this._createSvgRenderer(e.theme))}hitTest(){return null}setData(e){this._svgMap.has(e.theme)||this._svgMap.set(e.theme,this._createSvgRenderer(e.theme)),this._data=e}_drawImpl(e){
const{context:t,mediaSize:i}=e,{theme:s,x:r}=this._data,n=this._svgMap.get(s);if(!n)return;const o=n.viewBox(),{width:a,height:l}=o,c=a/2;r+c<0||r-c>i.width||(t.translate(r-c,i.height-l),n.render(t,{targetViewBox:o}))}_createSvgRenderer(e){const t=1===e?Xi.replace("backgroundColor",(0,c.getHexColorByName)("color-cold-gray-900")).replace("lineColor",(0,c.getHexColorByName)("color-cold-gray-450")):Xi.replace("backgroundColor",(0,c.getHexColorByName)("color-white")).replace("lineColor",(0,c.getHexColorByName)("color-cold-gray-550"));return(0,Zi.svgRenderer)(t)}}class Qi{constructor(e){this._source=e,this._renderer=new Ji(this._getRenderData(0))}update(){}renderer(){var e;const t=this._source.visible&&this._source.areLinesVisible,i=this._source.lockedX(),s=0===(null===(e=Le.crosshairLock.value())||void 0===e?void 0:e.type);return t&&s&&null!==i?(this._renderer.setData(this._getRenderData(i+1)),this._renderer):null}_getRenderData(e){return{x:e,theme:this._source.model().dark().value()?1:0}}}var es=i(49483),ts=i(7576),is=i(82587);class ss extends ts.DataWindowView{constructor(e){super(),this._invalidated=!0,this._dateItem=new ts.DataWindowItem("",h.t(null,void 0,i(62154)),""),this._timeItem=new ts.DataWindowItem("",h.t(null,void 0,i(12806)),""),this._model=e,this._items.push(this._dateItem),this._items.push(this._timeItem)}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}_updateImpl(){const e=this._model.mainSeries().isDWM();if(this._timeItem.setVisible(!e),this._timeItem.setValue(is.notAvailable),this._dateItem.setValue(is.notAvailable),this._model.timeScale().isEmpty())return;let t=this._model.crossHairSource().appliedIndex();if(!(0,ei.isNumber)(t)){const e=this._model.mainSeries().data().last();if(null===e)return;t=e.index}const i=this._model.timeScale().indexToUserTime(t);null!==i&&(this._dateItem.setValue(this._model.dateFormatter().format(i)),e||this._timeItem.setValue(this._model.timeFormatter().format(i)))}}var rs=i(66156);const ns=c.colorsPalette["color-tv-blue-500"],os=h.t(null,{context:"Replay"},i(53310));class as extends rs.TimeAxisView{constructor(e,t,i,s=!1){super(e),this._indexProvider=i,this._highlighted=s,this._source=t,this._properties=e.properties().childs().scalesProperties}_getText(e){if(this._source.isReplaySelection()){const t=this._model.timeScale().indexToUserTime(e);return null!==t?`${os}: ${this._model.dateTimeFormatter().format(t)}`:""}return super._getText(e)}_getBgColor(){if(this._source.isReplaySelection())return ns;const e=this._properties.childs();return this._highlighted?e.axisLineToolLabelBackgroundColorCommon.value():this._model.dark().value()?e.crosshairLabelBgColorDark.value():e.crosshairLabelBgColorLight.value()}_getIndex(){return this._model.crossHairSource().visible||null!==this._source.lockedPane()?this._indexProvider():null}_isVisible(){return this._properties.childs().showTimeScaleCrosshairLabel.value()}}var ls=i(61105),cs=i(10074);const hs={menuEnabled:!1,menuForMainSourceOnly:!1,disableTradingMenuActions:!1,
disableDrawHorizLineMenuAction:!1};let ds=0;const us=(0,ie.getLogger)("Chart.Crosshair");class ps extends G.DataSource{constructor(e,t,i){super(),this.pane=null,this.price=NaN,this.index=NaN,this.visible=!0,this.areLinesVisible=!0,this.x=NaN,this.y=NaN,this._lockData=null,this._measurePane=new O.WatchedValue(null),this._measurePaneViewCache=new WeakMap,this._startMeasurePoint=null,this._endMeasurePoint=null,this._lastValidMeasurePoint=null,this._isOnHoveredChartWidget=!1,this._crossHairSelectPointMode=new O.WatchedValue(Le.SelectPointMode.None),this._selectionPane=null,this._selectionView=new Di(this),this._selectionStartPoint=null,this._timeLockPaneView=null,this._crosshairPaneViewCache=new WeakMap,this._pointSelectionPaneViewCache=new WeakMap,this._priceAxisViews=new Map,this._panePriceAxisViews=new Map,this._startMeasurePriceAxisViews=new Map,this._endMeasurePriceAxisViews=new Map,this._originX=NaN,this._originY=NaN,this._subscribed=!1,this._movedDelegate=new N.Delegate,this._pointSelectedDelegate=new N.Delegate,this._requestedPoint=null,this._paneForRequestedPoint=null,this._selectLineColor=null,this._volumeCalculator=null,this._selectFromAllChartsIfOutOfData=null,this._currentMeasurePointsetAndSymbolId=null,this._model=e,this._options=Object.assign({},hs,i||{}),this._linesShouldBeHidden=this._model.readOnly(),this._dataWindowView=new ss(e),this.setSelectionEnabled(!1);const s=e=>t=>t===(0,o.ensureNotNull)(this._measurePane.value()).defaultPriceScale()?e():null;this._currentPosPriceProvider=e=>{const t=(0,o.ensureNotNull)(this.pane);if(e===t.defaultPriceScale())return this.price;const i=(0,o.ensureNotNull)(t.defaultPriceScale().mainSource()).firstValue();if(null===i)return null;const s=t.defaultPriceScale().priceToCoordinate(this.price,i),r=(0,o.ensureNotNull)(e.mainSource()).firstValue();return null===r?null:e.coordinateToPrice(s,r)},this._startMeasurePriceProvider=s((()=>(0,o.ensureNotNull)(this._startMeasurePoint).price)),this._endMeasurePriceProvider=s((()=>(0,o.ensureNotNull)(this._lastMeasurePoint()).price)),this._properties=t;this._timeAxisView=new as(e,this,(()=>this.appliedIndex()),!1),this._startMeasureTimeAxisView=new as(e,this,(()=>(0,o.ensureNotNull)(this._startMeasurePoint).index),!0),this._endMeasureTimeAxisView=new as(e,this,(()=>(0,o.ensureNotNull)(this._lastMeasurePoint()).index),!0),e.readOnly()||Le.cursorTool.subscribe((e=>this.areLinesVisible="arrow"!==e),{callWithLast:!0}),this._crosshairLock=Le.crosshairLock.spawn(),this._showPlusButtonOnCursor=Si.showPlusButtonOnCursor.spawn();const r=()=>{this.updateAllViews((0,Qe.sourceChangeEvent)(this.id())),this._model.lightUpdate()};this._crosshairLock.subscribe(r),this._showPlusButtonOnCursor.subscribe(r)}destroy(){null!==this._volumeCalculator&&this._volumeCalculator.destroy(),this._measurePane.setValue(null),this._crosshairLock.destroy(),this._showPlusButtonOnCursor.destroy(),this._removeMeasurePointset(),super.destroy()}name(){return"Crosshair"}moved(){return this._movedDelegate}originX(){return this._originX}originY(){return this._originY}
saveOriginCoords(e,t){this._originX=e,this._originY=t}clearOriginCoords(){this._originX=NaN,this._originY=NaN}currentPoint(){return new a.Point(this.x,this.y)}model(){return this._model}appliedIndex(){var e;return null!==(e=this._getLockData().index)&&void 0!==e?e:this.index}lockedX(){var e;return null!==(e=this._getLockData().xCoord)&&void 0!==e?e:null}lockedY(){var e;return null!==(e=this._getLockData().yCoord)&&void 0!==e?e:null}lockedPane(){const e=Le.crosshairLock.value();return null===e||1!==e.type?null:this._model.id()===e.modelId?this._model.paneForId(e.paneId):this._model.mainPane()}invalidateLockPosition(){this._lockData=null}startMeasurePoint(){return this._startMeasurePoint||null}endMeasurePoint(){return this._endMeasurePoint||null}measureVolume(){if(null===this._volumeCalculator)return NaN;const[e,t]=this.measurePoints();return void 0===t?NaN:this._volumeCalculator.volume(e.index,t.index)}measurePane(){return this._measurePane.readonly()}startMeasuring(e,t){this._startMeasurePoint=e,this._measurePane.setValue(t),t.containsMainSeries()&&((0,o.assert)(null===this._volumeCalculator),this._volumeCalculator=new ls.SeriesTimeRangeVolumeCalculator(this.model().mainSeries())),this._model.updatePane(t)}finishMeasure(e){this._endMeasurePoint=e,this._createMeasurePointset((0,o.ensureNotNull)(this._startMeasurePoint),this._endMeasurePoint)}clearMeasure(){this._removeMeasurePointset(),this._measurePane.setValue(null),delete this._startMeasurePoint,delete this._endMeasurePoint,delete this._lastValidMeasurePoint,this._model.lightUpdate(),null!==this._volumeCalculator&&(this._volumeCalculator.destroy(),this._volumeCalculator=null)}measurePoints(){const e=[(0,o.ensureNotNull)(this._startMeasurePoint)],t=this._lastMeasurePoint();return null!==t&&e.push(t),e}startSelection(e){this._selectionStartPoint=this.currentLogicalPoint(),this._selectionPane=e}clearSelection(){this._selectionStartPoint=null,this._selectionPane=null}selection(){return this._selectionStartPoint?{p1:this._selectionStartPoint,p2:this.currentLogicalPoint()}:null}currentLogicalPoint(){return{index:this.appliedIndex(),price:this.price}}selectPointMode(){return this._crossHairSelectPointMode}lineColor(){return this._selectLineColor}cancelRequestSelectPoint(){this._crossHairSelectPointMode.value()!==Le.SelectPointMode.None&&this._setSelectPointModeState(Le.SelectPointMode.None),this._selectFromAllChartsIfOutOfData=null}requestSelectPoint(e){(0,o.assert)(this._crossHairSelectPointMode.value()===Le.SelectPointMode.None,"Point already requested");const{pointType:t,pane:i,lineColor:s=null,selectFromAllChartsIfOutOfData:r,selectPointMode:n=Le.SelectPointMode.Study}=e;i&&((0,o.assert)(-1!==this._model.panes().indexOf(i),"Chartmodel doesn't contains specified pane"),this._paneForRequestedPoint=i,this._model.panesCollectionChanged().subscribe(this,this._paneCollectionChanged)),this._selectLineColor=s,this._requestedPoint=t,this._selectFromAllChartsIfOutOfData=null!=r?r:null,this._setSelectPointModeState(n)}onPointSelected(){return this._pointSelectedDelegate}
trySelectCurrentPoint(){var e;const t=this.pane;if(!t)return;const i=(0,o.ensureNotNull)(this._requestedPoint);let s=null;if(!this._model.mainSeries().bars().search(this.index,It.PlotRowSearchMode.Exact)&&"price"!==i&&(this._selectFromAllChartsIfOutOfData&&(s=null!==(e=Math.min(...Array.from(Le.barTimesUnderCursor.values())))&&void 0!==e?e:null),null===s))return;if(this._paneForRequestedPoint&&this._paneForRequestedPoint!==t)return;let r,n=s;if("price"===i||null!==s||(n=this._model.timeScale().indexToTimePoint(this.index),null!==n)){if("time"!==i){const e=t.mainDataSource();if(null===e)return;const i=e.firstValue(),s=e.priceScale();if(null===i||null===s)return;r=s.coordinateToPrice(this.y,i)}this._setSelectPointModeState(Le.SelectPointMode.None),this._pointSelectedDelegate.fire({time:null!=n?n:void 0,price:r},t)}}isOnHoveredChartWidget(){return this._isOnHoveredChartWidget}setOnHoveredChartWidget(e){this._isOnHoveredChartWidget=e}isReplaySelection(){return!1}clearPosition(){this.visible=!1,this.index=NaN,this.price=NaN,this.x=NaN,this.y=NaN,this.pane=null,this.clearOriginCoords(),this._updateVisibilityDependentPaneViews()}setPosition(e,t,i){this._subscribed||(this._model.mainSeries().onRestarted().subscribe(this,this.clearMeasure),this._subscribed=!0),this.visible=!0;const s=this._model.id(),r=this._model.mainSeries().bars().search(this.index,It.PlotRowSearchMode.NearestRight);return r&&Le.barTimesUnderCursor.set(s,r.value[0]),this._tryToUpdateViews(e,t,i)}setLinesShouldBeHidden(e){this._linesShouldBeHidden=e}linesShouldBeHidden(){return this._linesShouldBeHidden}handleContextMenuEvent(e){this._crossHairSelectPointMode.value()!==Le.SelectPointMode.None&&this._setSelectPointModeState(Le.SelectPointMode.None)}properties(){return this._properties}priceAxisViews(e,t){var i;const s=null===this._requestedPoint||"time"!==this._requestedPoint||!this._isOnHoveredChartWidget,r=[];return(null!==(i=this.lockedPane())&&void 0!==i?i:this.pane)===e&&s&&r.push(this._createPriceAxisViewOnDemand(this._priceAxisViews,this._panePriceAxisViews,e,t,this._currentPosPriceProvider,mi,!0)[0]),this._startMeasurePoint&&r.push(this._createPriceAxisViewOnDemand(this._startMeasurePriceAxisViews,null,e,t,this._startMeasurePriceProvider,gi)[0]),this._lastMeasurePoint()&&r.push(this._createPriceAxisViewOnDemand(this._endMeasurePriceAxisViews,null,e,t,this._endMeasurePriceProvider,gi)[0]),r}timeAxisViews(){const e=[],t=null===this._requestedPoint||"price"!==this._requestedPoint||!this._isOnHoveredChartWidget;return this._linesShouldBeHidden||!this.visible&&null===Le.crosshairLock.value()||!t||e.push(this._timeAxisView),this._startMeasurePoint&&e.push(this._startMeasureTimeAxisView),this._lastMeasurePoint()&&e.push(this._endMeasureTimeAxisView),e}paneViews(e){var t,i;if(void 0===e)return null;const s=[];if(this.isReplaySelection()){let t=this._pointSelectionPaneViewCache.get(e);t||(t=new CrosshairPointSelectionPaneView(this,e,this._model),this._pointSelectionPaneViewCache.set(e,t)),s.push(t)}let r=this._crosshairPaneViewCache.get(e)
;if(r||(r=new Ai(this,e),this._crosshairPaneViewCache.set(e,r)),s.push(r),e===this._selectionPane&&s.push(this._selectionView),e===this._measurePane.value()){let t=this._measurePaneViewCache.get(e);t||(t=new Ki(this,e),this._measurePaneViewCache.set(e,t)),t.update((0,Qe.sourceChangeEvent)(this.id())),s.push(t)}if((Si.addPlusButtonProperty.value()||this._showPlusButtonOnCursor.value())&&1!==(null===(t=Le.crosshairLock.value())||void 0===t?void 0:t.type)){const t=e===this.pane,i=!es.CheckMobile.any()||window.screen.width>=320,r=Le.tool.value(),n=(0,ge.isLineToolName)(r),o=null!==this._model.lineBeingEdited()||null!==this._model.lineBeingCreated()||this._model.sourcesBeingMoved().length>0||null!==this._model.customSourceBeingMoved()||(0,Le.toolIsMeasure)(r);if(t&&this._isOnHoveredChartWidget&&this._crossHairSelectPointMode.value()===Le.SelectPointMode.None&&i&&!n&&!o){const t=e.mainDataSource();if(null!==t){const i=t.priceScale();if(null!==i){const t=this._createPriceAxisViewOnDemand(this._priceAxisViews,this._panePriceAxisViews,e,i,this._currentPosPriceProvider,mi,!0)[1];null!==t&&s.push(t)}}}}return 0===(null===(i=Le.crosshairLock.value())||void 0===i?void 0:i.type)&&(null===this._timeLockPaneView&&(this._timeLockPaneView=new Qi(this)),s.push(this._timeLockPaneView)),s}dataWindowView(){return this._dataWindowView}updateAllViews(e){this._priceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._panePriceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._startMeasurePoint&&(this._startMeasurePriceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._startMeasureTimeAxisView.update(e)),this._lastMeasurePoint()&&(this._endMeasurePriceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._endMeasureTimeAxisView.update(e)),this._timeAxisView.update(e),this._selectionView.update(),this._dataWindowView.update(),this._updateVisibilityDependentPaneViews()}isMenuEnabled(){return!0}isHoveredEnabled(){return Si.addPlusButtonProperty.value()||this._showPlusButtonOnCursor.value()}isHovered(){return this._model.hoveredSource()===this}pointToSelect(){return this._requestedPoint}paneForPointSelect(){return this._paneForRequestedPoint}_lastMeasurePoint(){return this._endMeasurePoint?this._endMeasurePoint:(null!==this.pane&&this._measurePane.value()===this.pane&&(this._lastValidMeasurePoint={price:this._model.magnet().align(this.price,this.index,this.pane),index:this.index}),this._lastValidMeasurePoint||null)}_createPriceAxisViewOnDemand(e,t,i,s,r,n,a=!1){let l=e.get(i),c=null!==t?t.get(i):void 0;void 0===l&&(l=new Map,e.set(i,l),this.isMenuEnabled()&&null!==t&&(c=new Map,t.set(i,c)),a&&i.onDestroyed().subscribe(this,(()=>this._onPaneDestroyed(i))));let h=l.get(s);if(void 0===h){if(h=new n(this,i,s,r),l.set(s,h),void 0!==c){const e=new wi(h,this,s,this._model,this._options);c.set(s,e)}a&&s.lastSourceRemoved().subscribe(this,(()=>this._onPriceScaleCleared(s)))}let d=null;return void 0!==c&&(d=(0,o.ensureDefined)(c.get(s))),[h,d]}_onPaneDestroyed(e){e.onDestroyed().unsubscribeAll(this),
this._priceAxisViews.delete(e),this._panePriceAxisViews.delete(e),this._startMeasurePriceAxisViews.delete(e),this._endMeasurePriceAxisViews.delete(e)}_onPriceScaleCleared(e){e.lastSourceRemoved().unsubscribeAll(this),this._priceAxisViews.forEach((t=>t.delete(e))),this._panePriceAxisViews.forEach((t=>t.delete(e))),this._startMeasurePriceAxisViews.forEach((t=>t.delete(e))),this._endMeasurePriceAxisViews.forEach((t=>t.delete(e)))}_tryToUpdateViews(e,t,i){return!!this._tryToUpdateData(e,t,i)&&(this.updateAllViews((0,Qe.sourceChangeEvent)(this.id())),this._movedDelegate.fire({index:this.index,price:this.price}),!0)}_tryToUpdateData(e,t,i){const s=this.x,r=this.y,n=this.price,a=this.index,l=this.pane,c=this._priceScaleByPane(i);if(this.index=e,this.x=isNaN(e)?NaN:this._model.timeScale().indexToCoordinate(e),null!==c&&null!==i){this.pane=i,this.price=t;const e=(0,o.ensureNotNull)(i.mainDataSource()).firstValue();this.y=null===e?NaN:c.priceToCoordinate(t,e)}else this.pane=null,this.price=NaN,this.y=NaN;return s!==this.x||r!==this.y||a!==this.index||n!==this.price||l!==this.pane}_priceScaleByPane(e){return e&&!e.defaultPriceScale().isEmpty()?e.defaultPriceScale():null}_setSelectPointModeState(e){e===Le.SelectPointMode.None&&(this._requestedPoint=null,this._selectLineColor=null,this._paneForRequestedPoint&&(this._paneForRequestedPoint=null,this._model.panesCollectionChanged().unsubscribe(this,this._paneCollectionChanged))),Le.activePointSelectionMode.setValue(e),this._crossHairSelectPointMode.setValue(e),this._model.lightUpdate()}_paneCollectionChanged(e){const t=this._paneForRequestedPoint;null!==t&&-1===e.indexOf(t)&&this.cancelRequestSelectPoint()}_updateVisibilityDependentPaneViews(){var e;for(const t of this.model().panes())null===(e=this._pointSelectionPaneViewCache.get(t))||void 0===e||e.update()}_getLockData(){var e;if(null===this._lockData){const t=Le.crosshairLock.value();if(null===t)this._lockData={};else{const i=this._model.timeScale(),s=null!==(e=i.points().roughIndex(t.time))&&void 0!==e?e:void 0,r=void 0===s?void 0:i.indexToCoordinate(s);switch(t.type){case 0:this._lockData={index:s,xCoord:r};break;case 1:{let e;const i=this.lockedPane();if(null!==i){const s=i.mainDataSource();if(null!==s){const i=s.firstValue(),r=s.priceScale();null!==r&&null!==i&&(e=r.priceToCoordinate(t.price,i))}}this._lockData={index:s,xCoord:r,yCoord:e}}}}}return this._lockData}_createMeasurePointset(e,t){const i=this._normalizePoint(e),s=this._normalizePoint(t),r=[[i.time_t,i.offset],[s.time_t,s.offset]];this._removeMeasurePointset(),++ds,this._currentMeasurePointsetAndSymbolId={measurePointsetId:ds,symbolId:(0,o.ensureNotNull)(this._model.mainSeries().seriesSource().symbolInstanceId())};const n=(0,cs.getServerInterval)(this._model.mainSeries().interval());this._model.chartApi().createPointset(this._currentMeasurePointsetIdWithPrefix(),"turnaround",this._currentMeasurePointsetAndSymbolId.symbolId,n,r,this._onPointsetResponse.bind(this))}_removeMeasurePointset(){
null!==this._currentMeasurePointsetAndSymbolId&&this._model.chartApi().isConnected().value()&&this._model.chartApi().removePointset(this._currentMeasurePointsetIdWithPrefix()),this._currentMeasurePointsetAndSymbolId=null}_currentMeasurePointsetIdWithPrefix(){return"pointsetMeasure_"+(0,o.ensureNotNull)(this._currentMeasurePointsetAndSymbolId).measurePointsetId}_normalizePoint(e){return{...this._model.timeScale().normalizeBarIndex(e.index),price:e.price}}_onPointsetResponse(e){if("pointset_error"===e.method)return void us.logError(`Error getting pointset: ${e.params[0]} ${e.params[1]}`);if(e.params.customId!==this._currentMeasurePointsetIdWithPrefix())return;if(null===this._startMeasurePoint||null===this._endMeasurePoint)return;const t=e.params.plots;if(2!==t.length)return;const i=t[0].value[0],s=t[1].value[0];this._startMeasurePoint.index=i,this._endMeasurePoint.index=s,this.updateAllViews((0,Qe.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}var _s=i(63812),ms=i(77007),gs=i(31229),fs=i(45126),vs=i(98272),ys=i(25149),Ss=i(56840);class bs{constructor(e){this._priceSourceNamesById=new Map,e.forEach((e=>this._priceSourceNamesById.set(e.id,e.name)))}name(e){var t;return null!==(t=this._priceSourceNamesById.get(e))&&void 0!==t?t:null}priceSourcesChanged(e){return e.length!==this._priceSourceNamesById.size}}var ws=i(88960),Cs=i(99531),Ps=i(74047);const xs=new fs.TranslatedString("remove deselected empty line tools",h.t(null,void 0,i(27171))),Ts=te.enabled("auto_enable_symbol_labels"),Is=te.enabled("saveload_separate_drawings_storage"),Ms=(0,ie.getLogger)("Chart.ChartModel");var As;function Ls(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}function ks(e){var t,i;for(let s=e.length;s--;){const r=e[s].dataSources();for(let e=r.length;e--;)null===(t=r[e].dataWindowView())||void 0===t||t.update();const n=e[s].priceDataSources();for(let e=n.length;e--;)null===(i=n[e].legendView())||void 0===i||i.update()}}!function(e){e[e.MnPaneHeight=30]="MnPaneHeight"}(As||(As={}));const Ds={isSnapshot:!1,readOnly:!1,watermarkEnabled:!0,shiftVisibleRangeOnNewBar:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,lastPriceAnimationEnabled:!0,onWidget:!1,hideIdeas:!1};!function(e){e[e.RecalcVisibleRangeStudiesTimeout=2e3]="RecalcVisibleRangeStudiesTimeout",e[e.RecalcVisibleRangeStudiesLargeTimeout=5e3]="RecalcVisibleRangeStudiesLargeTimeout",e[e.RecalcVisibleRangeStudiesTimeoutLibrary=500]="RecalcVisibleRangeStudiesTimeoutLibrary",e[e.RecalcColorStudiesTimeout=250]="RecalcColorStudiesTimeout"}(As||(As={}));const Es={throttle:r.default,debounce:s.default},Vs=new Map([[f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction,{timeout:500,adapter:"debounce"}],[f.RecalcVisibleRangeStudiesReason.DataUpdate,{timeout:500,adapter:"throttle"}],[f.RecalcVisibleRangeStudiesReason.SeriesRestart,{timeout:500,adapter:"debounce"}],[f.RecalcVisibleRangeStudiesReason.SeriesCompleted,{timeout:500,adapter:"debounce"}],[f.RecalcVisibleRangeStudiesReason.StudyCreation,{timeout:500,adapter:"debounce"
}]]),Bs=Array.from(Vs.values());class Rs{constructor(e,t,i,r,n,o,a,l,c,h){this._onRearrangePanes=new N.Delegate,this._lineToolsGroupModel=new Wt,this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,this._lineBeingEdited=null,this._linePointBeingEdited=null,this._linePointBeingChanged=null,this._customSourceBeingMovedHitTestData=null,this._customSourceBeingMoved=null,this._dataSourceCollectionChanged=new N.Delegate,this._sourceProperitesChanged=new N.Delegate,this._sourceZOrderChanged=new N.Delegate,this._symbolSourceResolved=new N.Delegate,this._symbolSourceResolvingActive=new O.WatchedValue(!1),this._adjustForDividendsAvailability=new O.WatchedValue(0),this._adjustForDividendsEnabled=new O.WatchedValue(!1),this._currentTool="",this._lineBeingCreated=null,this._paneBeingCreatedLineOn=null,this._lineCancelled=new N.Delegate,this._phantomSourceContainer=new ti(this),this._destroyed=!1,this._isSettingsExternalPosition=!1,this._isTimeScrolling=!1,this._magnet=new oi,this._scrollingState=null,this._modelIntervals=[],this._rendererOptionsProvider=new E(this),this._studyInserted=new N.Delegate,this._cachedStudiesMaxOffset=0,this._replayStatus=new O.WatchedValue(0),this._panes=[],this._tagsChanged=new N.Delegate,this._strategySources=[],this._strategySourcesChange=new N.Delegate,this._activeStrategySource=new O.WatchedValue(null),this._symbolIntervalChanged=new N.Delegate,this._paneCollapsingAvailable=new O.WatchedValue(!1),this._panesCollectionChanged=new N.Delegate,this._scrollEnabled=te.enabled("chart_scroll"),this._zoomEnabled=te.enabled("chart_zoom"),this._lollipopSourcesWatcher=null,this._alertsWatcher=null,this._hoveredSource=null,this._hoveredSourceChanged=new N.Delegate,this._lastHoveredHittestData=null,this._hoveredSourceOrigin=null,this._lastSelectedHittestData=null,this._topmostCustomSources=[],this._fgCustomSources=[],this._bgCustomSources=[],this._allCustomSources=[],this._customSourcesMap=new Map,this._multiPaneSources=[],this._showLegendProperty=new L.Property,this._id=(0,se.guid)(),this._chartSaveTime=null,this._availableCurrenciesList=null,this._availableCurrencies=new Jt([]),this._availablePriceSources=new bs([]),this._availableUnitsObject=null,this._availableUnits=new Qt({}),this._availablePriceSourcesBySymbol=new Map,this._shouldBeSavedEvenIfHidden=!1,this._watchedThemeSpawn=d.watchedTheme.spawn(),this._gradientColorsCache=null,this._studiesWV=new F.WatchedObject([],y.compareTwoCollectionsByIds),this._studiesExcludeInternalWV=new F.WatchedObject([],y.compareTwoCollectionsByIds),this._resetScalesAvailable=new O.WatchedValue(!1),this._recalcVRStudiesParams={reasons:new Set},this._recalcColorStudiesParams={},this._replayStudyStrategy=new O.WatchedValue(null),this._recalcVisibleRangeStudiesImplDebouncedByAdapter=new Map(Object.keys(Es).map((e=>[e,new Map(Bs.filter((t=>t.adapter===e)).map((e=>[e.timeout,Es[e.adapter](this._recalcVisibleRangeStudiesImpl.bind(this,this._recalcVRStudiesParams),e.timeout)])))]))),this._recalcColorStudiesImplDebounced=(0,
s.default)(this._recalcColorStudiesImpl.bind(this,this._recalcColorStudiesParams),250),this._width=0,this._resetScales=new N.Delegate,this._chartThemeLoaded=new N.Delegate,this._selection=new w,this._selectedSourceChanged=new N.Delegate,this._symbolSourceCollectionChanged=new N.Delegate,this._gridSource=new ui,this._visibleRangeStudiesInputs=new F.WatchedObject(null),this._syncPointCache=new Map,this._lastAppliedGotoTimeRange=null,this._lastGotoTimeRange=null,this._lollipopSourcesWatcherLoader=null,this._sessions=null,this._onMultipaneSourcesCollectionChanged=new N.Delegate,this._replayStudyStrategyInputs=null,this._clearSelection=()=>{this._lastSelectedHittestData=null,this._selection.clear()},this._removeSourceFromSelection=e=>{this._selection.remove(e)},this._addSourceToSelection=(e,t)=>{const i=this._selection.isSelected(e);i&&this._lastSelectedHittestData===t||e&&!e.isSelectionEnabled()||(this._lastSelectedHittestData=t||null,i||this._selection.add(e))},this._recalcSymbolResolvingActive=()=>{for(const e of this._panes)if(e.symbolSourceResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._recalcAdjustForDividendsAvailability=()=>{var e,t,i,s;if(this._symbolSourceResolvingActive.value())return;const r=this.mainSeries();switch(null!==(t=null===(e=r.symbolInfo())||void 0===e?void 0:e.allowed_adjustment)&&void 0!==t?t:"none"){case"dividends":return void this._adjustForDividendsAvailability.setValue(2);case"splits":return void this._adjustForDividendsAvailability.setValue(1);case"any":return void this._adjustForDividendsAvailability.setValue(3)}for(const e of this.symbolSources().filter(Se.isActingAsSymbolSource)){if(e.symbolHibernated().value()||e===r)continue;if("any"===(null!==(s=null===(i=e.symbolInfo())||void 0===i?void 0:i.allowed_adjustment)&&void 0!==s?s:"none"))return void this._adjustForDividendsAvailability.setValue(3)}this._adjustForDividendsAvailability.setValue(0)},this._recalcAdjustForDividendsEnabled=()=>{switch(this._adjustForDividendsAvailability.value()){case 2:return void this._adjustForDividendsEnabled.setValue(!0);case 0:case 1:return void this._adjustForDividendsEnabled.setValue(!1)}this._adjustForDividendsEnabled.setValue(this.mainSeries().properties().childs().dividendsAdjustment.value())},this._recalcPaneCollapsingAvailable=e=>{let t=this._panes.filter((e=>!e.collapsed().value())).length;0===t&&e&&this._panes.length>0&&(this._panes[0].collapsed().setValue(!1),t=1),this._paneCollapsingAvailable.setValue(t>1)},this._updateResetScalesAvailableValue=()=>{const e=this._timeScale.resetAvailable().value()||this._panes.some((e=>e.resetPriceScalesAvailable().value()));this._resetScalesAvailable.setValue(e)},this._chartApi=e,this._invalidateHandler=t,this._undoModel=n,this._properties=i,this._options=(0,ae.merge)((0,ae.clone)(Ds),a),this._hibernateWV=l,this._linkingGroupIndex=c,this._isAutoSaveEnabled=h,this._readOnly=this._options.readOnly,this._isSnapshot=this._options.isSnapshot,
this._chartSaveTime=(new Date).valueOf(),this._backgroundColor=new O.WatchedValue(this._getBackgroundColor()),this._backgroundTopColor=new O.WatchedValue(this._getBackgroundColor(!0)),this._properties.childs().paneProperties.childs().background.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundType.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.subscribe(this,this._updateBackgroundColor),this._backgroundColor.subscribe(this.recalcColorStudies.bind(this,!1)),this._backgroundTopColor.subscribe(this.recalcColorStudies.bind(this,!1)),this._backgroundCounterColor=new O.WatchedValue(this._getBackgroundCounterColor()),this._backgroundColor.subscribe((()=>this._backgroundCounterColor.setValue(this._getBackgroundCounterColor()))),this._isDark=(0,ws.combine)((e=>"white"===e),this._backgroundCounterColor.weakReference()),this._watchedThemeSpawn.subscribe(this._updateBackgroundColor.bind(this)),this._symbolSourceResolvingActive.subscribe(this._recalcAdjustForDividendsAvailability),(0,Le.init)();const u=this._readOnly?new L.Property((0,j.defaults)("chartproperties.paneProperties.crossHairProperties")):this._properties.childs().paneProperties.childs().crossHairProperties;this.m_crossHairSource=new ps(this,u,this._options.crossHair),this._crossHairSelectPointMode=this.m_crossHairSource.selectPointMode().spawn(),this._crossHairSelectPointMode.subscribe((e=>{if(e!==Le.SelectPointMode.None&&this.lineBeingCreated()){const e=Le.tool.value();this.cancelCreatingLine(),Le.tool.setValue(e)}})),this._tagsChanged=new N.Delegate;const p=new A.DefaultProperty({defaultName:"chartproperties.mainSeriesProperties",excludedDefaultsKeys:["priceAxisProperties.lockScale","priceAxisProperties.percentage","priceAxisProperties.indexedTo100","priceAxisProperties.isInverted","priceAxisProperties.log","priceAxisProperties.logDisabled","priceAxisProperties.percentageDisabled","priceAxisProperties.autoScaleDisabled"]});p.merge(i.childs().mainSeriesProperties.state()),this._timeScale=new Bt(this,this._options.timeScale),this._timeScale.resetAvailable().subscribe(this._updateResetScalesAvailableValue);const _={countdownEnabled:this._options.countdownEnabled,lastPriceAnimationEnabled:this._options.lastPriceAnimationEnabled};this.m_mainSeries=new ye.Series(this,p,_,r),this.m_mainSeries.onStyleChanged().subscribe(this._timeScale,this._timeScale.invalidateVisibleBars);const m=()=>this.fullUpdate();this.m_mainSeries.properties().childs().showCountdown.subscribe(this,(()=>{this.m_mainSeries.updateAllViews((0,Qe.sourceChangeEvent)(this.m_mainSeries.id())),m()})),(0,H.currencyUnitVisibilityProperty)().subscribe(this,m),(0,z.autoLogButtonsVisibilityProperty)().subscribe(this,m),this._timeScale.visibleBarsStrictRangeChanged().subscribe(this.m_mainSeries,this.m_mainSeries.clearHighLowPriceCache),
this._timeScale.visibleBarsStrictRangeChanged().subscribe(this.m_mainSeries,this.m_mainSeries.clearAveragePriceCache),this.createPane(void 0,{axisProperties:p.childs().priceAxisProperties.state(["autoScale"])}),this._adjustForDividendsAvailability.subscribe(this._recalcAdjustForDividendsEnabled),this.mainSeries().properties().childs().dividendsAdjustment.subscribe(this,this._recalcAdjustForDividendsEnabled),this._recalcAdjustForDividendsEnabled(),this._boundUpdateStudiesMaxOffset=this._updateStudiesMaxOffset.bind(this),this.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,((e,t,i,s)=>{if(null!==this._lastAppliedGotoTimeRange&&null!==i&&s&&(0,si.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,i)){const e=this.appliedTimeFrame().value();null!==e&&!this._lastAppliedGotoTimeRange.actual&&(0,si.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,e.val)&&this.appliedTimeFrame().setValue(null),this._lastAppliedGotoTimeRange=null}})),this.mainSeries().dataEvents().completed().subscribe(this,(e=>{null===this._lastAppliedGotoTimeRange&&null!==this._lastGotoTimeRange&&(this.gotoTimeRange(this._lastGotoTimeRange.from,this._lastGotoTimeRange.to),this._lastGotoTimeRange=null)}));const g=this._panes[0];g.setStretchFactor(2*g.stretchFactor()),this._properties.listeners().subscribe(this,this.lightUpdate),this._properties.childs().timezone.subscribe(null,(()=>{this._chartApi&&this._chartApi.isConnected().value()&&this._chartApi.switchTimezone(this.timezone())})),g.addDataSource(this.m_mainSeries,g.findSuitableScale(this.m_mainSeries),!1),this._barsMarksSources=o(this);for(const e of this._barsMarksSources)e.setOwnerSource(this.m_mainSeries),g.addDataSource(e,this.m_mainSeries.priceScale(),!0);this.m_mainSeries.symbolResolved().subscribe(this,this._clearAvailablePriceSources),this.m_mainSeries.onSymbolIntervalChanged().subscribe(this,this._onSymbolIntervalChanged),this._createLollipopSourcesWatcher(),this._watermarkSource=this._options.watermarkEnabled?new Q(this):null,this._timezoneExceptExchange=(0,ws.combine)(((e,t)=>"exchange"!==e?e:t),(0,Cs.createWVFromProperty)(this._properties.childs().timezone).ownership(),(0,Cs.createWVFromGetterAndSubscription)((()=>{var e,t;return null!==(t=null===(e=this.mainSeries().symbolInfo())||void 0===e?void 0:e.timezone)&&void 0!==t?t:null}),this.mainSeries().symbolResolved()).ownership())}restart(){var e,t;this._chartApi.switchTimezone(this.timezone()),this._timeScale.reset(),this.m_mainSeries.restart();for(const e of this.dataSources())e.restart&&e!==this.m_mainSeries&&e.restart();null===(t=null===(e=this._sessions)||void 0===e?void 0:e.get())||void 0===t||t.restart()}version(){return 3}collapsed(){return this._hibernateWV}visibleRangeStudiesInputs(){return this._visibleRangeStudiesInputs.readonly()}chartSaveTime(){return this._chartSaveTime}setChartSaveTime(e){this._chartSaveTime=e}destroy(){var e;this._phantomSourceContainer.destroy(),this._hoveredSourceChanged.destroy(),null!==this._watermarkSource&&(this._watermarkSource.destroy(),this._watermarkSource=null),
Array.from(this._customSourcesMap.keys()).forEach(this._removeCustomSource,this),(0,o.assert)(0===this._topmostCustomSources.length),(0,o.assert)(0===this._fgCustomSources.length),(0,o.assert)(0===this._bgCustomSources.length),(0,o.assert)(0===this._allCustomSources.length),(0,o.assert)(0===this._customSourcesMap.size),null!==this._lollipopSourcesWatcher&&(this._lollipopSourcesWatcher.destroy(),this._lollipopSourcesWatcher=null),null!==this._alertsWatcher&&this._alertsWatcher.destroy(),this._properties.childs().paneProperties.childs().background.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundType.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.unsubscribeAll(this),this._watchedThemeSpawn.destroy(),this._lastHoveredHittestData=null,this._lastSelectedHittestData=null,(0,H.currencyUnitVisibilityProperty)().unsubscribeAll(this),(0,z.autoLogButtonsVisibilityProperty)().unsubscribeAll(this),this._crossHairSelectPointMode.destroy(),this.m_mainSeries.symbolResolved().unsubscribe(this,this._clearAvailablePriceSources),this.m_mainSeries.onSymbolIntervalChanged().unsubscribe(this,this._onSymbolIntervalChanged),this._timezoneExceptExchange.destroy(),null===(e=this._lollipopSourcesWatcherLoader)||void 0===e||e.destroy(),this._destroyed=!0}undoModel(){return this._undoModel}onData(e){switch(e.method){case"timescale_update":{const t=e.params;this._updateTimeScale({index:t.index,zoffset:t.zoffset,values:t.changes,indexDiffs:t.index_diff,baseIndex:t.baseIndex,marks:t.marks,clearFlag:t.clear});break}case"timescale_completed":{const t=Boolean(e.params[0]);this._timeScale.onTimeScaleCompleted(t);break}}}addStrategySource(e,t){1!==t&&-1===this._strategySources.indexOf(e)&&(this._strategySources.push(e),this._strategySourcesChange.fire(t),this.setActiveStrategySource(e))}removeStrategySource(e,t){if(1===t)return;const i=this._strategySources.indexOf(e);if(-1!==i){if(this._strategySources.splice(i,1)[0]===this._activeStrategySource.value()&&this.unsetActiveStrategySource(),this._strategySources.length>0){const e=this._strategySources[this._strategySources.length-1];this.setActiveStrategySource(e)}this._strategySourcesChange.fire(t)}}setActiveStrategySource(e){-1!==this._strategySources.indexOf(e)&&this._activeStrategySource.setValue(e)}unsetActiveStrategySource(){this._activeStrategySource.setValue(null)}activeStrategySource(){return this._activeStrategySource}strategySources(){return this._strategySources}strategySourcesChange(){return this._strategySourcesChange}replayStudyStrategy(){return this._replayStudyStrategy}setReplayStudyStrategy(e){this._replayStudyStrategy.setValue(e)}async replayStudyStrategyProperties(){if(null===this._replayStudyStrategyInputs){const e=await getReplayStrategyMetaInfo();if(null!==this._replayStudyStrategyInputs)return this._replayStudyStrategyInputs;this._replayStudyStrategyInputs=new A.DefaultProperty({
defaultName:"replayStudyStrategyInputs",factoryDefaultsSupplier:()=>(0,ae.clone)(e.defaults.inputs)})}return this._replayStudyStrategyInputs}clearReplayStudyStrategyProperties(){this._replayStudyStrategyInputs=null}setScrollEnabled(e){this._scrollEnabled=e}scrollEnabled(){return this._scrollEnabled}setZoomEnabled(e){this._zoomEnabled=e}zoomEnabled(){return this._zoomEnabled}zoomToViewport(e,t,i,s,r){this.setTimeViewport(e,t);let n=Math.min(i,s),o=Math.max(i,s);const a=r.defaultPriceScale();a.isPercentage()||a.setMode({autoScale:!1}),a.isLog()&&(n=a.priceToLogical(n),o=a.priceToLogical(o)),a.setPriceRange(new fe.PriceRange(n,o)),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.invalidate(this._paneInvalidationMask(r,W.InvalidationLevel.Light))}setTimeViewport(e,t){const i=this.appliedTimeFrame().value();null!==this._lastAppliedGotoTimeRange&&null!==i&&(0,si.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,i.val)&&!this._lastAppliedGotoTimeRange.actual||(this.timeScale().zoomToBarsRange(e,t),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction),this.lightUpdate())}onTagsChanged(){return this._tagsChanged}canZoomIn(){return this._timeScale.canZoomIn()&&this._zoomEnabled}canZoomOut(){return this._timeScale.canZoomOut()&&this._zoomEnabled}onPaneTagsChanged(){this._tagsChanged.fire()}panesCollectionChanged(){return this._panesCollectionChanged}dataSourceCollectionChanged(){return this._dataSourceCollectionChanged}symbolSourceCollectionChanged(){return this._symbolSourceCollectionChanged}symbolSourceResolved(){return this._symbolSourceResolved}symbolSourceResolvingActive(){return this._symbolSourceResolvingActive}adjustForDividendsAvailability(){return this._adjustForDividendsAvailability}adjustForDividendsEnabled(){return this._adjustForDividendsEnabled}paneCollapsingAvailable(){return this._paneCollapsingAvailable}sourcePropertiesChanged(){return this._sourceProperitesChanged}sourceZOrderChanged(){return this._sourceZOrderChanged}zoomTime(e,t,i){if(!this._zoomEnabled)return;const s=this.timeScale();if(s.isEmpty()||0===t)return;const r=s.width();e=Math.max(1,Math.min(e,r-2)),s.zoom(e,t,i),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.lightUpdate(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction)}lineBeingEdited(){return this._lineBeingEdited}linePointBeingEdited(){return this._linePointBeingEdited}activeItemBeingMoved(){return this._activeItemBeingMoved}linePointBeingChanged(){return this._linePointBeingChanged}mainSeries(){return this.m_mainSeries}updateAllPaneViews(e){var t;for(const t of this._panes)t.updateAllViews(e);null===(t=this._watermarkSource)||void 0===t||t.updateAllViews(e)}dataSources(){const e=[this.crossHairSource()];for(const t of this._panes)for(const i of t.dataSources())e.push(i);return e}priceDataSources(){const e=[];for(const t of this._panes)for(const i of t.priceDataSources())e.push(i);return e}symbolSources(){const e=[]
;for(const t of this._panes)for(const i of t.symbolSources())e.push(i);return e}orderedDataSources(e){let t=[this.m_crossHairSource];for(let i=0;ie.updateAllViews((0,Qe.selectionChangeEvent)())));let n=[];if(s.forEach((e=>{if((0,S.isLineTool)(e)){const i=e.hasAlert().value()&&e.getAlertSync();i&&!i.isPrice()&&i.setSelected(!1),!t&&e.shouldBeRemovedOnDeselect()&&n.push(e)}})),r.forEach((e=>{const t=(0,S.isLineTool)(e)&&e.hasAlert&&e.hasAlert().value()&&e.getAlertSync();t&&t.setSelected(!0)})),1===r.length){const[e]=r;(0,S.isLineTool)(e)&&e.hasAlert().value()&&0===e.alertStatus().value()&&e.synchronizeAlert().catch((()=>{}))}n=n.filter((e=>null!==this.dataSourceForId(e.id()))),n.length>0&&this._undoModel.removeSources(n,!1,xs),this.lightUpdate(),(s.length>0||r.length>0)&&this._selectedSourceChanged.fire()}onSelectedSourceChanged(){return this._selectedSourceChanged}checkLineToolSelection(){const e=this.selection().allSources();this._selection.checkLineToolSelection(),e.length!==this.selection().allSources().length&&this._selectedSourceChanged.fire()}lineToolsGroupModel(){return this._lineToolsGroupModel}restoreLineToolsGroups(e){this._lineToolsGroupModel=Wt.fromState(this,e)}realignLineTools(e){for(const t of this._panes)(void 0===e||t.hasDataSource(e))&&t.realignLineTools(e)&&this._dataSourceCollectionChanged.fire(t)}copyToOtherCharts(e,t){const i=this.mainSeries(),s=i.syncModel(),r=this.timeScale();if(s)for(const n of e){if(!n.isSynchronizable())continue;const e=n.linkKey().value()||(0,se.randomHash)();n.linkKey().setValue(e);const a=n.state(!1),l=n.normalizedPoints(),c=n.normalizedPointsForCreating(),h=n.properties().interval.value(),d=i.interval(),u=e=>{if(M.Interval.isEqual(h,d))return e.map((e=>{const t=(0,o.ensureNotNull)(r.timePointToIndex(e.time_t))+e.offset;return{price:e.price,timeStamp:(0,o.ensureNotNull)(this.externalTimeStamp(t))}}));{const t=s.createNewModelWithResolution(h);return e.map((e=>({price:e.price,timeStamp:0===e.offset?e.time_t:t.projectTime(e.time_t,e.offset)})))}},p=u(l),_=u(c),m={...a,id:n.id(),linkKey:e,points:p,pointsForCreating:_,linetool:n.toolname,model:this,symbol:i.symbol(),withUndo:t,zOrder:n.zorder(),finalState:{points:l,interval:h},pointPositionPercents:n.isFixed()?n.calcPositionPercents():void 0,sharingMode:n.sharingMode().value()};(0,Le.copyLineTool)(m)}}isSnapshot(){return this._isSnapshot}onWidget(){return this._options.onWidget}hideIdeas(){return this._options.hideIdeas}updateSource(e){
const t=this._invalidationMaskForSource(e);null!==t&&this.invalidate(t)}updateSourcePriceScale(e){const t=this._invalidationMaskForSourcePriceScale(e);null!==t&&this.invalidate(t)}updatePane(e){this.invalidate(this._paneInvalidationMask(e))}updateTimeScaleBaseIndex(e){const t=this.mainSeries().bars();t.isEmpty()||this._updateBaseIndex((0,o.ensureNotNull)(t.lastIndex()),!!(e&&e.index>0))}setInterval(e,t){const i=setInterval(e,t);return this._modelIntervals.push(i),i}clearInterval(e){clearInterval(e);const t=this._modelIntervals.indexOf(e);t>-1&&this._modelIntervals.splice(t,1)}clearIntervals(){for(let e=0;e{
i.ownerSource()===e&&i.setOwnerSource(t)})),this._invalidateBarColorerCaches(),t.start(),this.recalculatePane(i,(0,Qe.sourceChangeEvent)(t.id())),this.fullUpdate(),!0}insertStudyStub(e,t,i,s){const r=void 0!==t,n=new T.StudyStub(this,null!=i?i:null,e,r,null!=s?s:null);let a;if(t||!r){a=(0,o.ensureNotNull)(this.mainPane());const e=!0===t?this.mainSeries().priceScale():a.createPriceScaleAtPosition("overlay");a.addDataSource(n,e,!1)}else a=this.createPane(),a.addDataSource(n,null,!1);return n.setZorder(a.newStudyZOrder()),this.recalculatePane(a,(0,Qe.sourceChangeEvent)(n.id())),this.fullUpdate(),n}removeStudyStub(e){const t=this.dataSourceForId(e);return null===t?(Ms.logNormal("StudyStub id="+e+" is not found in chart model"),!1):(this.removeSource(t),!0)}restoreStudyStub(e){var t;const i=this.insertStudyStub(e.title,e.isOverlay,e.descriptor);return null===(t=this.paneForSource(i))||void 0===t||t.changeSourceId(i,e.id),i.setStatus(e.status),i}allLineTools(){return this._getAllSources(S.isLineTool)}setHoveredSource(e,t=null,i){const s=this._hoveredSource!==e;if(this._hoveredSourceOrigin=null!=i?i:null,!s&&(0,$t.hitTestResultDataAreEqual)(this._lastHoveredHittestData,t))return;this._lastHoveredHittestData=t;let r=null;if(this._hoveredSource){this._hoveredSource.updateAllViews((0,Qe.selectionChangeEvent)()),r=new W.InvalidationMask(W.InvalidationLevel.Cursor);const e=this._invalidationMaskForSource(this._hoveredSource,W.InvalidationLevel.Light);null!==e&&r.merge(e)}if(this._hoveredSource=e,e){e.updateAllViews((0,Qe.selectionChangeEvent)()),r||(r=new W.InvalidationMask(W.InvalidationLevel.Cursor));const t=this._invalidationMaskForSource(e,W.InvalidationLevel.Light);null!==t&&r.merge(t)}r&&this.invalidate(r),s&&this._hoveredSourceChanged.fire(e)}properties(){return this._properties}chartApi(){return this._chartApi}disconnect(){var e,t;null===(t=null===(e=this._sessions)||void 0===e?void 0:e.get())||void 0===t||t.stop();for(const e of this.dataSources())e.disconnect&&e.disconnect();this._timeScale.disconnect()}crossHairSource(){return this.m_crossHairSource}gridSource(){return this._gridSource}publishedChartsTimelineSource(){return null}hoveredSource(){return this._hoveredSource}hoveredSourceOrigin(){return this._hoveredSourceOrigin}hoveredSourceChanged(){return this._hoveredSourceChanged}lastHittestData(){return this._lastHoveredHittestData}lastSelectedHittestData(){return this._lastSelectedHittestData}lightUpdate(){this.invalidate(W.InvalidationMask.light())}fullUpdate(){this.invalidate(W.InvalidationMask.full())}syncTimeWithModel(e,t){const i=this.mainSeries().syncModel();if(null===i)return;const s=1e3*this.createSyncPoint(e,i.syncSourceTarget()).sourceTimeToTargetTime(t/1e3),r=(0,Ht.get_timezone)(this.timezone());let n=(0,Ht.utc_to_cal)(r,s);this.mainSeries().isDWM()&&(n=i.getSession().spec.correctTradingDay(n),(0,Ht.set_hms)(n,0,0,0,0,(0,Ht.get_timezone)("Etc/UTC"))),this._gotoTimeImpl(n.getTime(),{centerIfVisible:!1})}gotoTime(e){return this._gotoTimeImpl(e,{centerIfVisible:!0})}recalculatePane(e,t){
null==e||e.recalculate(t)}recalculateAllPanes(e){this._panes.forEach((t=>t.recalculate(e))),this.updateAllPaneViews(e),this.crossHairSource().updateAllViews(e)}gotoTimeRange(e,t){const i=this.timeScale(),s=i.tickMarks(),r=this.mainSeries();if(void 0===s.minIndex)return void(this._lastGotoTimeRange={from:e,to:t});let n=e,a=t;if(null!==r.symbolInfo()){const i=(0,o.ensureNotNull)(this.timezoneExceptExchange().value()),s=(0,Ht.get_timezone)(i),l=(0,Ht.utc_to_cal)(s,e),c=(0,Ht.utc_to_cal)(s,t);if(r.isDWM()){const e=(0,Ht.get_timezone)("Etc/UTC");(0,Ht.set_hms)(l,0,0,0,0,e),(0,Ht.set_hms)(c,0,0,0,0,e)}n=l.getTime(),a=c.getTime()}const l=(0,o.ensureDefined)(s.maxIndex),c=(0,o.ensureDefined)(s.minIndex);if(n>=(0,o.ensureNotNull)(s.indexToTime(c)).valueOf()||r.endOfData()){const e=(e,t)=>e(0,o.ensureNotNull)(s.indexToTime(e)).valueOf(),h=(0,y.lowerboundExt)(t,n,e,s.nearestIndex(n),l);let d=n===a?h:(0,y.lowerboundExt)(t,a,e,s.nearestIndex(a),l);this._lastGotoTimeRange=null,null!==this._lastAppliedGotoTimeRange&&(this._lastAppliedGotoTimeRange.actual=!1);const u=i.baseIndex();if(h+Math.max(d-h+1,i.minVisibleBarCount())>u){const e=i.targetDefaultRightOffset();d-u=0;t--)if(this._panes[t].hasDataSource(e))return this._panes[t];return e instanceof Yt.BarsMarksContainer?this.paneForSource(this.mainSeries()):null}mainPane(){var e;return null!==(e=this._panes.find((e=>e.isMainPane())))&&void 0!==e?e:null}lastPane(){return this._panes[this._panes.length-1]}removeSource(e,t){this.selectionMacro((t=>t.removeSourceFromSelection(e)),!0),this._hoveredSource===e&&(this._hoveredSource=null,this._lastHoveredHittestData=null),this._sourcesBeingMoved.includes(e)&&(this._sourcesBeingMoved=this._sourcesBeingMoved.filter((t=>t!==e)),this._sourcesBeingMoved.length||(this._activeItemBeingMoved=null)),e===this._lineBeingEdited&&(this._lineBeingEdited=null,Le.isToolEditingNow.setValue(!1)),e===this.lineBeingCreated()&&(this._lineBeingCreated=null,Le.isToolCreatingNow.setValue(!1)),!t&&e.stop&&e.stop();const i=this.detachSource(e),s=this.mainSeries().priceScale();return(0,R.isStudy)(e)&&(0,Se.isActingAsSymbolSource)(e)&&e.priceScale()===s&&s.isPercentage()&&1===s.seriesLikeSources().filter(Se.isActingAsSymbolSource).length&&s.setMode({percentage:!1}),this.fullUpdate(),this._invalidateBarColorerCaches(),(0,R.isStudy)(e)&&((0,m.emit)("study_event",e.id(),"remove"),e.isChildStudy()&&e.parentSources().forEach((t=>t.unsetChild(e))),e.maxOffset().unsubscribe(this._boundUpdateStudiesMaxOffset)),
!t&&e.destroy&&e.destroy(),(0,S.isLineTool)(e)&&(e.removeAlert(),(0,m.emit)("drawing_event",e.id(),"remove")),i}timezone(){return this._properties.childs().timezone.value()}timezoneExceptExchange(){return this._timezoneExceptExchange}allStudies(e){const t=e?e=>(0,R.isStudy)(e)&&!0:R.isStudy;return this._getAllSources(t)}studiesWV(e){return e?this._studiesExcludeInternalWV.readonly():this._studiesWV.readonly()}listUserStudies(e){const t=[];for(const i of this._panes)for(const s of i.priceDataSources())if((0,R.isStudy)(s)&&!(0,R.isFundamentalStudy)(s)&&s.showInObjectTree()){const{id:i,shortDescription:r}=s.metaInfo();if(e.dontCountVolume&&"Volume@tv-basicstudies"===i||e.dontCountCompare&&"Compare@tv-basicstudies"===i||e.dontCountOverlay&&"Overlay@tv-basicstudies"===i)continue;t.push(r)}return t}findNonOverlayStudyWithGroupingKey(e,t){const i=void 0!==t?[t]:this._panes;for(const t of i){const i=t.dataSources().find((i=>(0,R.isStudy)(i)&&i.metaInfo().groupingKey===e&&!t.isOverlay(i)));if(void 0!==i)return{pane:t,study:i}}return null}movePaneUp(e){this.movePane(e,e-1)}movePaneDown(e){this.movePane(e,e+1)}movePane(e,t){const i=this._panes[e];this._panes.splice(e,1),this._panes.splice(t,0,i),this._panesCollectionChanged.fire(this._panes),this._onRearrangePanes.fire(),this.invalidate(W.InvalidationMask.panesOrder())}toggleCollapsedPane(e){const t=this._panes[e];t.collapsed().setValue(!t.collapsed().value()),this.fullUpdate()}backgroundColor(){return this._backgroundColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(e){const t=this.backgroundColor().value(),i=this.backgroundTopColor().value();if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==i||this._gradientColorsCache.bottomColor!==t)this._gradientColorsCache={topColor:i,bottomColor:t,colors:new Map};else{const t=this._gradientColorsCache.colors.get(e);if(void 0!==t)return t}const s=(0,Kt.gradientColorAtPercent)(i,t,e/100);return this._gradientColorsCache.colors.set(e,s),s}backgroundCounterColor(){return this._backgroundCounterColor.readonly()}dark(){return this._isDark}readOnly(){return this._readOnly}defaultResolutions(){return this.chartApi().defaultResolutions()}availableCurrencies(){const e=this._getAvailableCurrencies();return e.length!==this._availableCurrencies.size()&&(this._availableCurrencies=new Jt(e)),this._availableCurrencies}currencyConversionEnabled(){return this._options.currencyConversionEnabled}availableUnits(){const e=this._getAvailableUnits();return this._availableUnits.unitsChanged(e)&&(this._availableUnits=new Qt(e)),this._availableUnits}unitConversionEnabled(){return this._options.unitConversionEnabled}availablePriceSources(e){const t=this._getAvailablePriceSources(e);return null!==t&&this._availablePriceSources.priceSourcesChanged(t)&&(this._availablePriceSources=new bs(t)),this._availablePriceSources}resetDeferredStudies(){Ge.instance(this).reset()}waitForStudy(e){return Ge.instance(this).get(e)}resetWaitForStudy(e){
Ge.instance(this).delete(e)}isJustClonedChart(){return this._undoModel.isJustClonedChart()}studyTemplate(e,t,i){const s={panes:[],version:this.version()};for(const e of this.panes())s.panes.push(e.state(!0,!1,!0));const r=this.mainSeries();return e&&(s.symbol=r.symbol(),this.currencyConversionEnabled()&&i&&(s.currency=r.currency()),this.unitConversionEnabled()&&i&&(s.unit=r.unit())),t&&(s.interval=r.interval()),s}getStudyById(e){const t=this.dataSourceForId(e);return null!==t&&(0,R.isStudy)(t)?t:null}getLineToolById(e){const t=this.dataSourceForId(e);return null!==t&&(0,S.isLineTool)(t)?t:null}restoreLineToolState(e,t,i){var s;e.restorePoints(t.points,t.indexes||[]),t.state.intervalsVisibilities=(0,$e.mergeIntervalVisibilitiesDefaults)(t.state.intervalsVisibilities),e.properties().merge(t.state),e.restoreData&&e.restoreData(t),e.linkKey().setValue(t.linkKey||null),e.createServerPoints(),e.setZorder(null!==(s=t.zorder)&&void 0!==s?s:e.zorder()),this.fullUpdate();const r=e.linkKey().value();null!==r&&i&&(0,Le.restoreLineToolState)({model:this,linkKey:r,state:t})}restoreFactoryDefaults(e){e.restoreFactoryDefaults(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction)}preferences(){return(0,ms.preferencesByWhiteList)(this,this.mainSeries())}applyPreferences(e){for(const[t,i]of Object.entries(e)){const e=this._properties.child(t);void 0!==i&&void 0!==e&&e.mergeAndFire(i)}if(void 0!==e.timeScale){const t=e.timeScale;this._timeScale.defaultRightOffset().setValue(t.defaultRightOffset),this._timeScale.defaultRightOffsetPercentage().setValue(t.defaultRightOffsetPercentage),this._timeScale.usePercentageRightOffset().setValue(t.usePercentageRightOffset)}this._properties.saveDefaults(),this.m_mainSeries.applyPreferences(e.mainSeries),this.sessions().restoreState({properties:e.sessions},!1),this.recalculateAllPanes((0,Qe.globalChangeEvent)()),this.fullUpdate()}restoreTheme(e,t,i){e.mainSourceProperties.hollowCandleStyle||(e.mainSourceProperties.hollowCandleStyle=e.mainSourceProperties.candleStyle),this._undoModel.chartLoadTheme(e,t,i)}onResetScales(){return this._resetScales}startMovingSources(e,t,i,s,r,n){this._sourcesBeingMoved=e,this._activeItemBeingMoved=i;let a=!1;if(this._sourcesBeingMoved.forEach((e=>{!a&&(0,R.isStudy)(e)&&(a=!0);const l=(0,o.ensureNotNull)(this.paneForSource(e)),c=(0,S.isLineTool)(e),h=c&&e.linkKey().value();if(!1!==h&&null!==h&&s.has(h)&&c&&e.isFixed()){const t=(0,o.ensureDefined)(s.get(h)),a={screen:this._percentPositionToPoint(t,l)};e.startMoving(a,i,r,n)}else e.startMoving(t,i,r,n);const d=this._paneInvalidationMask(l,W.InvalidationLevel.Light);this.invalidate(d)})),!n){const s=e.filter(S.isLineTool).filter((e=>e.linkKey().value()&&e.isSynchronizable())).map((e=>e.linkKey().value()));if(s.length&&t.logical){const n=this.externalTimeStamp(t.logical.index),a={linkKeys:s,model:this,symbol:this.mainSeries().symbol(),point:{price:t.logical.price,timeStamp:n},activeItem:null!==i?i:void 0,envState:r,pointPositionPercents:new Map};e.forEach((e=>{if((0,S.isLineTool)(e)){
const i=e.linkKey().value();if(i&&e.isSynchronizable()&&e.isFixed()){const s=(0,o.ensureNotNull)(this.paneForSource(e));a.pointPositionPercents.set(i,this._pointToPercentPosition((0,o.ensureDefined)(t.screen),s))}}})),(0,Le.startMovingLineTool)(a)}}Le.isToolMovingNow.setValue(!0),a&&Le.isStudyEditingNow.setValue(!0)}moveSources(e,t,i,s){if(this._sourcesBeingMoved.filter((e=>!e.isLocked||!e.isLocked())).forEach((r=>{const n=(0,S.isLineTool)(r)?r.linkKey().value():null;if(null!==n&&t.has(n)){const e=(0,o.ensureNotNull)(this.paneForSource(r)),a=(0,o.ensureDefined)(t.get(n)),l={screen:this._percentPositionToPoint(a,e)};r.move(l,this._activeItemBeingMoved,i,s)}else r.move(e,this._activeItemBeingMoved,i,s)})),this.lightUpdate(),!s&&e.logical){const t=this._sourcesBeingMoved.filter(S.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),s=this.externalTimeStamp(e.logical.index),r={linkKeys:t,model:this,point:{price:e.logical.price,timeStamp:s},envState:i,pointPositionPercents:new Map};this._sourcesBeingMoved.filter(S.isLineTool).forEach((t=>{if(t.linkKey().value()&&t.isSynchronizable()&&t.isFixed()){const i=(0,o.ensureNotNull)(this.paneForSource(t));r.pointPositionPercents.set(t.linkKey().value(),this._pointToPercentPosition((0,o.ensureDefined)(e.screen),i))}})),(0,Le.moveLineTool)(r)}}endMovingSources(e,t,i){const s=this._sourcesBeingMoved.map((s=>{const r=(0,o.ensureNotNull)(this.paneForSource(s)),n=s.endMoving(e,t,i),a=this._paneInvalidationMask(r,W.InvalidationLevel.Light);return a.invalidateAll(W.InvalidationLevel.Light),this.invalidate(a),n})),r=this._sourcesBeingMoved.filter(S.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),n=this._sourcesBeingMoved.filter(S.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey)).map((e=>{const t={points:e.normalizedPoints(),interval:this.mainSeries().interval()};return e.isFixed()&&(t.pointPositionPercents=e.calcPositionPercents()),t}));r.length&&(0,Le.finishMovingLineTool)({linkKeys:r,model:this,finalStates:n,changes:s}),this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,Le.isToolMovingNow.setValue(!1),Le.isStudyEditingNow.setValue(!1)}sourcesBeingMoved(){return this._sourcesBeingMoved}setMovingCustomSource(e,t){this._customSourceBeingMoved=e,this._customSourceBeingMovedHitTestData=null!==t?{beingMoved:!1,cancelled:!1,...t}:null}processingCustomSourceMove(){null!==this._customSourceBeingMovedHitTestData&&(this._customSourceBeingMovedHitTestData.beingMoved=!0)}customSourceMovingHitTestData(){return this._customSourceBeingMovedHitTestData}customSourceBeingMoved(){return null!==this._customSourceBeingMovedHitTestData&&this._customSourceBeingMovedHitTestData.beingMoved?this._customSourceBeingMoved:null}lineToolsSynchronizer(){return this._lineToolsSynchronizer}setLineToolsSynchronizer(e){this._lineToolsSynchronizer=e}width(){return this._width}setWidth(e,t){(this._panes.reduce(((t,i)=>i.setWidth(e)||t),!1)||this._width!==e)&&(this._width=e,this._timeScale.setWidth(e,t),
this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction))}setPaneHeight(e,t){e.setHeight(t),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.lightUpdate()}resetScalesAvailable(){return this._resetScalesAvailable.readonly()}panes(){return this._panes}paneForId(e){return this._panes.find((t=>t.id()===e))||null}createPane(e,t,i){this._undoModel.hideMaximizedPaneIfRequired();const s=this._properties.childs().paneProperties;t&&s.merge(t);const r=new at(this._timeScale,s,this,i);return void 0!==e?this._panes.splice(e,0,r):this._panes.push(r),r.onTagsChanged().subscribe(this,Rs.prototype.onPaneTagsChanged),r.dataSourcesCollectionChanged().subscribe(this,(()=>this._dataSourceCollectionChanged.fire(r))),r.symbolSourceCollectionChanged().subscribe(this,(()=>this._onSymbolSourceCollectionChanged(r))),r.priceSourcesCollectionChanged().subscribe(this,(()=>this._onPriceSourcesCollectionChanged(r))),r.sourcePropertiesChanged().subscribe(this,(e=>this._sourceProperitesChanged.fire(r,e))),r.sourceZOrderChanged().subscribe(this,(e=>this._sourceZOrderChanged.fire(r,e))),r.symbolSourceResolved().subscribe(this,(e=>this._symbolSourceResolved.fire(r,e))),r.symbolSourceResolvingActive().subscribe(this._recalcSymbolResolvingActive),r.collapsed().subscribe(this._recalcPaneCollapsingAvailable),r.resetPriceScalesAvailable().subscribe(this._updateResetScalesAvailableValue,{callWithLast:!0}),this._recalcPaneCollapsingAvailable(),this._panesCollectionChanged.fire(this._panes),this.invalidate(W.InvalidationMask.panesOrder()),r}removePane(e){this._undoModel.hideMaximizedPaneIfRequired();const t=e;t.destroy();const i=this._panes.indexOf(t);-1!==i&&(this._panes.splice(i,1),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.symbolSourceCollectionChanged().unsubscribeAll(this),e.priceSourcesCollectionChanged().unsubscribeAll(this),e.sourcePropertiesChanged().unsubscribeAll(this),e.onTagsChanged().unsubscribeAll(this),e.symbolSourceResolved().unsubscribeAll(this),t.symbolSourceResolvingActive().unsubscribe(this._recalcSymbolResolvingActive),e.collapsed().unsubscribe(this._recalcPaneCollapsingAvailable),e.resetPriceScalesAvailable().unsubscribe(this._updateResetScalesAvailableValue),this._recalcPaneCollapsingAvailable(!0)),this._updateResetScalesAvailableValue();this.crossHairSource().pane===e&&this.clearCurrentPosition(),this._panesCollectionChanged.fire(this._panes),this.invalidate(W.InvalidationMask.panesOrder())}changePanesHeight(e,t){if(this._panes.length<2)return;(0,o.assert)(e>=0&&ee+t.stretchFactor()),0),r=this._panes.reduce(((e,t)=>e+t.height()),0),n=r-30*(this._panes.length-1);t=Math.min(n,Math.max(30,t));const a=s/r,l=i.height();i.setStretchFactor(t*a);let c=t-l,h=this._panes.length-1;for(const e of this._panes)if(e!==i){const t=Math.min(n,Math.max(30,e.height()-c/h));c-=e.height()-t,h-=1;const i=t*a;e.setStretchFactor(i)}this.fullUpdate()}
clearCurrentPosition(){const e=this.crossHairSource();e.clearPosition(),(0,o.ensureNotNull)(e.dataWindowView()).update(),ks(this._panes),this.invalidate(W.InvalidationMask.cursor()),this._undoModel.syncCrosshair(null),this._phantomSourceContainer.onCursorPositionUpdated()}setAndSaveCurrentPosition(e,t,i,s){this.crossHairSource().saveOriginCoords(e,t),this.setCurrentPosition(e,t,i,s)}setCurrentPosition(e,t,i,s){var r,n,a,l,c,h;let d=NaN;const u=this._timeScale.coordinateToVisibleIndex(e),p=null!==(a=null===(n=null!==(r=this._lineBeingEdited)&&void 0!==r?r:this.lineBeingCreated())||void 0===n?void 0:n.priceScale())&&void 0!==a?a:i.defaultPriceScale();let _=null;!p.isEmpty()&&Number.isFinite(t)&&(_=(0,o.ensureNotNull)(i.mainDataSource()).firstValue(),null!==_&&(d=p.coordinateToPrice(t,_)));const m=this._crossHairSelectPointMode.value()!==Le.SelectPointMode.None,g=this.currentTool(),f=this.mainSeries(),v=this.crossHairSource(),y=v.index,S=v.price,b=m||Le.isStudyEditingNow.value(),w=p===this.m_mainSeries.priceScale()&&(this._lineBeingCreated||this._lineBeingEdited||(0,ge.isLineToolName)(g)||(0,Le.toolIsMeasure)(g)||b);!this._isSettingsExternalPosition&&w?(d=this._magnet.align(d,u,i),null!==_&&this._setCorrectedPositionToCrosshair(u,d,i)):this._magnet.resetLastValue();let C=null;if(isNaN(d)||(C=i),this._isTimeScrolling){if(!this._isSettingsExternalPosition&&m){const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t);s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}}else v.setPosition(v.index,d,C);return}v.setOnHoveredChartWidget(!0),v.setPosition(u,d,C),(0,o.ensureNotNull)(v.dataWindowView()).update(),ks(this._panes);const P=f.syncModel();this.crossHairSource().startMeasurePoint()||this._lineBeingCreated?this.lightUpdate():this.invalidate(W.InvalidationMask.cursor());const x=this.lineBeingCreated();if(x){const e=x.linkKey().value();if(!this._isSettingsExternalPosition){const t=x.setLastPoint({index:u,price:d},s);if(x.updateAllViews((0,Qe.sourceChangeEvent)(x.id())),t.price===d&&t.index===u||this._setCorrectedPositionToCrosshair(t.index,t.price,i),P&&e){const i=this._timeScale.points().roughTime(t.index,P.projectTime.bind(P));(0,Le.setLineToolLastPoint)({model:this,linkKey:e,point:{timeStamp:(0,o.ensureNotNull)(i),price:t.price}})}}}if(!this._isSettingsExternalPosition&&null!==this._lineBeingEdited&&null!==this._linePointBeingEdited){const e={index:u,price:d};if(null===(l=this._linePointBeingChanged)||void 0===l?void 0:l.nonDiscreteIndex){const t=this.crossHairSource().originX();Number.isFinite(t)&&(e.index=this._timeScale.coordinateToFloatIndex(t))}this.changeLinePoint(e,s);const t=this._lineBeingEdited.alignCrossHairToAnchor(this._linePointBeingEdited)?this._lineBeingEdited.getPoint(this._linePointBeingEdited):e;null!==t&&this._setCorrectedPositionToCrosshair(t.index,t.price,i)}if(!this._isSettingsExternalPosition&&1===this._sourcesBeingMoved.length){const e=this._sourcesBeingMoved[0];if(null===(c=e.alignCrossHairToMovePoint)||void 0===c?void 0:c.call(e)){
const t=null===(h=e.currentMovingPoint)||void 0===h?void 0:h.call(e);t&&t.logical&&this._setCorrectedPositionToCrosshair(t.logical.index,t.logical.price,i)}}if(!this._isSettingsExternalPosition&&b){const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t);s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}}(y!==u||S!==d)&&this._syncCrosshair(s)}setExternalPosition(e,t){let i;const s=this.crossHairSource();if(s.setOnHoveredChartWidget(!1),null!==e&&(0,ae.isNumber)(e.timeStamp)){const t=this.mainSeries().syncModel();if(t){const s=this.createSyncPoint(e.syncSourceTarget,t.syncSourceTarget()).sourceTimeToTargetTime(e.timeStamp);i=this._timeScale.points().roughIndex(s,t.distance.bind(t))}}if(null!==e&&null!=i&&Number.isFinite(i)){this._isSettingsExternalPosition=!0;const r=(0,o.ensureNotNull)(this.paneForSource(this.mainSeries())),n=this._timeScale.indexToCoordinate(i),a=(0,o.ensureNotNull)(r.mainDataSource()).firstValue();if(null!==a){let i=NaN;void 0!==e.price&&Number.isFinite(e.price)&&(i=this.mainSeries().priceScale().priceToCoordinate(e.price,a)),s.clearOriginCoords(),this.setCurrentPosition(n,i,r,t)}return s.setOnHoveredChartWidget(!1),void(this._isSettingsExternalPosition=!1)}s.clearPosition(),(0,o.ensureNotNull)(s.dataWindowView()).update(),ks(this._panes),this.invalidate(W.InvalidationMask.cursor())}startScaleTime(e){this._timeScale.startScale(e)}scaleTimeTo(e){this._timeScale.scaleTo(e),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.lightUpdate()}endScaleTime(){this._timeScale.endScale(),this.lightUpdate(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction)}resetTimeScale(){this._timeScale.restoreDefault(),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction),this.lightUpdate(),this._resetScales.fire()}startScalePrice(e,t,i){e.startScalePrice(t,i)}scalePriceTo(e,t,i){e.scalePriceTo(t,i),this.mainSeries().priceScale().isLockScale()?this.lightUpdate():this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}endScalePrice(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}startTwoPointsScalePrice(e,t,i,s){t.startTwoPointsScale(i,s)}twoPointsScalePriceTo(e,t,i,s){t.twoPointsScale(i,s),this.invalidate(this._paneInvalidationMask(e))}endTwoPointsScalePrice(e,t){t.endTwoPointsScale(),this.invalidate(this._paneInvalidationMask(e))}resetPriceScale(e,t){e.resetPriceScale(t),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}restorePriceScaleState(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}currentTool(){return this._currentTool}setCurrentTool(e){this._currentTool!==e&&((0,ge.isLineToolName)(e)&&this.selectionMacro((e=>{e.clearSelection()})),this._currentTool=e,this._phantomSourceContainer.onToolChanged())}detachSource(e){const t=this.paneForSource(e)
;return!!t&&(t.removeDataSource(e),t.isEmpty()?(this._lineBeingCreated&&t===this._paneBeingCreatedLineOn&&this.cancelCreatingLine(),this.removePane(t),!0):(this.fullUpdate(),!1))}children(e,t){return this.dataSources().filter((i=>(0,R.isStudy)(i)?!t&&i.parentSources().includes(e):i.ownerSource()===e))}onRearrangePanes(){return this._onRearrangePanes}studyInserted(){return this._studyInserted}finishLineTool(e){const t=e.linkKey().value();(0,Le.drawOnAllCharts)().value()&&null!==t&&e.isSynchronizable()&&(0,Le.finishLineTool)({linkKey:t,model:this})}startChangingLinetool(e,t,i,s,r){this._lineBeingEdited=e,this._linePointBeingChanged=t||null,this._linePointBeingEdited=void 0===i?null:i,this._lineBeingEdited.startChanging(i,t,r),Le.isToolEditingNow.setValue(!0);const n=(0,o.ensureNotNull)(this.paneForSource(e));this._lineBeingEdited.startDragPoint&&void 0!==i&&void 0!==t&&this._lineBeingEdited.startDragPoint(i,t),r||void 0===i||void 0===t||this._lineBeingEdited.setPoint(i,t,s,r),this._lineBeingEdited.updateAllViews((0,Qe.sourceChangeEvent)(this._lineBeingEdited.id()));const a=this._paneInvalidationMask(n,W.InvalidationLevel.Light);this.invalidate(a);const l=e.linkKey().value();if(l&&e.isSynchronizable()&&void 0!==i&&void 0!==t){const e=(0,o.ensureNotNull)(this.externalTimeStamp(t.index));(0,Le.startChangingLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},pointIndex:i,envState:s||null})}}createLineTool(e){const{pane:t,point:i,linetool:s,linkKey:r=null,sharingMode:n=0,id:l,fromExternalModel:c}=e;let{properties:h,ownerSource:d}=e;if((0,o.assert)((0,ge.isLineToolName)(s),`Cannot create unknown line tool: ${s}`),h){const e={...gs.intervalsVisibilitiesDefaults},t=h.childs().intervalsVisibilities.state();(0,ae.merge)(e,null!=t?t:{});const i=h.state();i.intervalsVisibilities=e,h=(0,S.createLineToolProperties)(s,i,this)}const u=(0,S.createLineTool)(s,this,h,null,void 0,l);if("LineToolExecution"!==s){let e;switch(s){case"LineToolIcon":e=u.properties().childs().icon.value().toString(16).toUpperCase();break;case"LineToolEmoji":e=u.properties().childs().emoji.value();break;case"LineToolSticker":e=u.properties().childs().sticker.value()}(0,p.trackEvent)("drawings","Study_Drawing_"+s,e)}(0,S.isStudyLineTool)(u)&&(0,p.trackEvent)("studies",`Study_${u.metaInfo().id}`);const _=!u.linkKey().value()&&!r;d=(0,o.ensureDefined)(d||(0,o.ensureNotNull)(t.mainDataSource())),h||(0,S.prepareLineToolPropertiesByOwnerSource)(u.properties(),d),u.setOwnerSource(d);const m=d.priceScale();if(u.setPriceScale(m),Is&&d===this.mainSeries()&&u.share(n),t.addDataSource(u,m,!1),null!==u.preferredZOrder()&&t.insertAfter([u],this.mainSeries()),(0,Le.drawOnAllCharts)().value()){const e=u.isSynchronizable()?r||(0,se.randomHash)():null;u.linkKey().setValue(e)}else u.linkKey().setValue(r);let g;if(_&&u.enableCurrentIntervalVisibility(),u.isFixed()){const e=(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainDataSource()).firstValue()),s=this._timeScale.indexToCoordinate(i.index),r=(0,
o.ensureNotNull)(m).priceToCoordinate(i.price,e);g=u.addFixedPoint(new a.Point(s,r))}else g=u.addPoint(i);return g||(this._lineBeingCreated={lineDataSource:u,fromExternal:!!c},this._paneBeingCreatedLineOn=t,Le.isToolCreatingNow.setValue(!0)),this.fullUpdate(),u}endChangingLinetool(e,t){const i=(0,o.ensureNotNull)(this._lineBeingEdited),s=i.endChanging(!1,e,t);this._lineBeingEdited=null,Le.isToolEditingNow.setValue(!1),this._linePointBeingEdited=null,this._linePointBeingChanged=null,this.lightUpdate();const r={points:i.normalizedPoints(),interval:this.mainSeries().interval()},n=i.linkKey().value();null!==n&&i.isSynchronizable()&&!t&&(0,Le.finishChangingLineTool)({model:this,linkKey:n,symbol:this.mainSeries().symbol(),finalState:r,changes:s})}continueCreatingLine(e,t,i,s,r){const n=(0,o.ensureNotNull)(this.lineBeingCreated()),a=n.addPoint(e,t,i,r);n.updateAllViews((0,Qe.sourceChangeEvent)(n.id()));const l=new W.InvalidationMask(W.InvalidationLevel.Light);return a&&(this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,Le.isToolCreatingNow.setValue(!1)),this.invalidate(l),a}cancelCreatingLine(){const e=this.lineBeingCreated();e&&(this.removeSource(e),this._lineBeingCreated=null,this._lineCancelled.fire(),Le.isToolCreatingNow.setValue(!1),(0,Le.drawOnAllCharts)().value()&&e.isSynchronizable()&&(0,Le.cancelLineTool)({model:this}))}lineBeingCreated(){var e;return(null===(e=this._lineBeingCreated)||void 0===e?void 0:e.lineDataSource)||null}lineBeingCreateFromExternal(){var e;return(null===(e=this._lineBeingCreated)||void 0===e?void 0:e.fromExternal)||!1}paneBeingCreatedLineOn(){return this._paneBeingCreatedLineOn}lineCancelled(){return this._lineCancelled}isPhantomLine(e){return this._phantomSourceContainer.source()===e}changeLinePoint(e,t,i){const s=(0,o.ensureNotNull)(this._lineBeingEdited),r=(0,o.ensureNotNull)(this._linePointBeingEdited);let n=e.price,a=e.index;if(s.setPoint(r,e,t,i),!i){const t=s.alignCrossHairToAnchor(r)?s.getPoint(r):e;null!==t&&(a=t.index,n=t.price)}s.updateAllViews((0,Qe.sourceChangeEvent)(s.id())),this.lightUpdate();const l=s.linkKey().value();if(!i&&null!==l&&s.isSynchronizable()){const e=(0,o.ensureNotNull)(this._linePointBeingChanged),i={indexesChanged:a!==e.index,pricesChanged:n!==e.price},c=s.getChangePointForSync(r);if(null!==c){const e=this.externalTimeStamp(a);null!==e&&(n=c.price,(0,Le.changeLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:n,timeStamp:e},envState:t,changes:i}))}}}changeLinePoints(e,t,i){const s=e.points(),r=e.linkKey().value();!i&&r&&e.isSynchronizable()&&t.forEach(((t,i)=>{const n=s[i],a=n.price!==t.price,l=n.index!==t.index;if(e.getChangePointForSync(i)){const e=(0,o.ensureNotNull)(this.externalTimeStamp(t.index));(0,Le.changeLineTool)({linkKey:r,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},changes:{pricesChanged:a,indexesChanged:l}})}})),e.setPoints(t),e.updateAllViews((0,Qe.sourceChangeEvent)(e.id())),this.lightUpdate()}startScrollTime(e){this._timeScale.startScroll(e),this._isTimeScrolling=!0,
this.mainSeries().clearGotoDateResult()}scrollTimeTo(e){this._timeScale.scrollTo(e),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.lightUpdate()}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction),this._isTimeScrolling=!1}startScrollPrice(e,t,i){e.startScrollPrice(t,i)}scrollPriceTo(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}endScrollPrice(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}addCustomSource(e,t,i=f.CustomSourceLayer.Foreground){this._customSourcesMap.has(e)&&Ms.logWarn(`Attempt to add the same custom source multiple time "${e}"`),Ms.logNormal(`Adding custom source "${e}"`);const s=t(e,this);switch(i){case f.CustomSourceLayer.Background:this._bgCustomSources.push(s);break;case f.CustomSourceLayer.Foreground:this._fgCustomSources.push(s);break;case f.CustomSourceLayer.Topmost:this._topmostCustomSources.push(s);break;default:throw new Error(`Unknown custom sources layer ${i}`)}this._allCustomSources.push(s),this._customSourcesMap.set(e,s),this.lightUpdate()}removeCustomSource(e){this._removeCustomSource(e),this.lightUpdate()}hasCustomSource(e){return this._customSourcesMap.has(e)}customSourceForName(e){return this._customSourcesMap.get(e)||null}customSourceName(e){let t=null;return this._customSourcesMap.forEach(((i,s)=>{i===e&&(t=s)})),t}customSources(e){switch(e){case f.CustomSourceLayer.Background:return this._bgCustomSources;case f.CustomSourceLayer.Foreground:return this._fgCustomSources;case f.CustomSourceLayer.Topmost:return this._topmostCustomSources;default:return this._allCustomSources}}addMultiPaneSource(e){this._multiPaneSources.push(e),this._onMultipaneSourcesCollectionChanged.fire(),this.lightUpdate()}removeMultiPaneSource(e){const t=this._multiPaneSources.indexOf(e);-1===t?Ms.logWarn("Attempt to remove multi-pane source which does not exist in the model"):(this._onMultipaneSourcesCollectionChanged.fire(),this._multiPaneSources.splice(t,1)),this.lightUpdate()}multiPaneSources(e){return this._multiPaneSources.filter((t=>!e.hasDataSource(t)))}onMultipaneSourcesCollectionChanged(){return this._onMultipaneSourcesCollectionChanged}rendererOptionsProvider(){return this._rendererOptionsProvider}magnet(){return this._magnet}priceAxisRendererOptions(){return this._rendererOptionsProvider.options()}dateTimeFormatter(){return this._dateTimeFormatter}dateFormatter(){return this._dateFormatter}timeFormatter(){return this._timeFormatter}isUnmergeAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return(0,o.ensureNotNull)(this.paneForSource(e)).dataSources().filter(this._unmergeAvailable,this).length>1}isMergeDownAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;const t=this.paneForSource(e),i=this.panes();return t!==i[i.length-1]}isMergeUpAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return this.paneForSource(e)!==this.panes()[0]}sessions(){return(0,
o.ensureNotNull)(this._sessions)}createSessions(e){null===this._sessions&&(this._sessions=new B((async()=>{const t=await i.e(7539).then(i.bind(i,83943));return this.addCustomSource("sessions",((i,s)=>{const r=new t.Sessions(i,s,e);return r.start(),r}),f.CustomSourceLayer.Background),this.customSourceForName("sessions")})()))}createPrePostMarket(e){this.addCustomSource("prePostMarket",((t,i)=>new PrePostMarket(t,i,e)))}watermarkSource(){return this._watermarkSource}watermarkContentProvider(){return Ps.WatermarkApi.getInstance().provider()}replayStatus(){return this._replayStatus}setReplayStatus(e){this._replayStatus.setValue(e)}isInReplay(){return this.m_mainSeries.isInReplay()}getSymbolString(){return this.m_mainSeries.getSymbolString()}interval(){return this.m_mainSeries.interval()}switchToReplay(e,t){0}switchToRealtime(){0}async canChangeResolution(e){return this.m_mainSeries.canChangeResolution(e)}theme(){var e;const t=this.properties().childs().paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]);delete t.topMargin,delete t.bottomMargin;const i=(0,o.ensureDefined)(this.mainSeries().state().state);delete i.symbol,delete i.interval,delete i.currencyId,delete i.unitId;const s={mainSourceProperties:i,sessions:null===(e=this.sessions().get())||void 0===e?void 0:e.properties().state(),chartProperties:{paneProperties:t,scalesProperties:this.properties().childs().scalesProperties.state()},version:this.version()};return s.version=this.version(),s}onChartThemeLoaded(){return this._chartThemeLoaded}chartThemeLoaded(){this._chartThemeLoaded.fire()}async colorStudiesPropertiesReady(){this._recalcColorStudiesImpl(this._recalcVRStudiesParams);const e=this.allStudies(!0).filter((e=>e.metaInfo().inputs.filter(x.isStudyInputDependsOnChartColors).length>0));await Promise.all(e.map((e=>e.propertiesPatched())))}state(e,t,i,s){var r,n;const o=this.publishedChartsTimelineSource(),a=this.properties().childs(),l=a.tradingProperties.state(),c={panes:this._panes.map((r=>r.state(!0,e,!1,t,i,s))),timeScale:this._timeScale.state(e),chartProperties:{paneProperties:a.paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]),scalesProperties:a.scalesProperties.state(),publishedChartsTimelineProperties:o?o.state(e):void 0,chartEventsSourceProperties:null===(r=a.chartEventsSourceProperties)||void 0===r?void 0:r.state(),tradingProperties:l,priceScaleSelectionStrategyName:a.priceScaleSelectionStrategyName.value()},sessions:null!==(n=this.sessions().state(e))&&void 0!==n?n:void 0,version:this.version(),timezone:this.timezone(),shouldBeSavedEvenIfHidden:this._shouldBeSavedEvenIfHidden,linkingGroup:this._linkingGroupIndex.value()};return s||(c.lineToolsGroups=this.lineToolsGroupModel().state(t)),c}restoreState(e,t,i){var s;Ge.instance(this).reset();const r={};if(!e.panes)return void Ms.logDebug("ChartModel.restoreState: invalid state");if(!Array.isArray(e.panes))return void Ms.logDebug("ChartModel.restoreState: invalid state")
;if(e.panes.length<1)return void Ms.logDebug("ChartModel.restoreState: invalid state");for(const e of this._barsMarksSources)this.detachSource(e);if(this._shouldBeSavedEvenIfHidden=void 0===e.shouldBeSavedEvenIfHidden||e.shouldBeSavedEvenIfHidden,e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties){const i=(0,j.factoryDefaults)("chartproperties").scalesProperties;(0,ae.merge)(i,e.chartProperties.scalesProperties),!("showLastValue"in i)||"showSeriesLastValue"in i||"showStudyLastValue"in i||(i.showSeriesLastValueProperty=i.showLastValue,i.showStudyLastValueProperty=i.showLastValue),"showSeriesLastValue"in i&&(r.showSeriesLastValueProperty=!0),"showStudyLastValue"in i&&(r.showStudyLastValueProperty=!0),(!this.isSnapshot()&&!this.readOnly()&&"showCurrency"in i||"showUnit"in i)&&((0,H.migrateShowCurrencyAndShowUnitProperties)(i.showCurrency,i.showUnit),delete i.showCurrency,delete i.showUnit);{const{paneProperties:t}=e.chartProperties;t.vertGridProperties=t.vertGridProperties||(0,ae.clone)(t.gridProperties),t.horzGridProperties=t.horzGridProperties||(0,ae.clone)(t.gridProperties),"backgroundType"in t||(t.backgroundType=Zt.ColorType.Solid),"separatorColor"in t||(t.separatorColor=(0,u.getThemedColor)("color-chart-page-bg")),this._properties.childs().paneProperties.mergeAndFire(t)}this._properties.childs().scalesProperties.mergeAndFire(i),e.chartProperties.timezone&&this._properties.childs().timezone.setValue(e.chartProperties.timezone),e.chartProperties.chartEventsSourceProperties&&this._properties.hasChild("chartEventsSourceProperties")&&this._properties.childs().chartEventsSourceProperties.mergeAndFire(e.chartProperties.chartEventsSourceProperties),e.chartProperties.tradingProperties&&this._properties.hasChild("tradingProperties")&&(void 0===e.chartProperties.tradingProperties.horizontalAlignment&&(e.chartProperties.tradingProperties.horizontalAlignment=(n=e.chartProperties.tradingProperties.lineLength)<=40?f.TradedGroupHorizontalAlignment.Right:n>=60?f.TradedGroupHorizontalAlignment.Left:f.TradedGroupHorizontalAlignment.Center),this._properties.childs().tradingProperties.mergeAndFire(e.chartProperties.tradingProperties)),this._timeScale.restoreState(e.timeScale,t),this._updateDateTimeFormatter()}var n;if(e.timeScale&&this._timeScale.restoreState(e.timeScale,t),!this.readOnly()){const t=this._getExceedingChildStudies(e.panes);if(t.length){for(let i=e.panes.length-1;i>=0;--i){const s=e.panes[i];for(let e=s.sources.length-1;e>=0;--e){const i=s.sources[e];~t.indexOf(i)&&s.sources.splice(e,1)}s.sources.length||e.panes.splice(i,1)}0}}const a=e.version||0,l=e.panes;let c="_seriesId";for(const e of l){const t=e.sources.find((e=>"MainSeries"===e.type));if(t){c=t.id;break}}this.panes()[0].restoreState({state:l[0],withData:t,version:a,seriesId:c,settingsMigration:r,contentOverrides:i,restoreSilently:true,reason:2});let h=1;for(let s=1;sm&&p%100==0?{lines_limit_exceeded:!0,line_tools_count:p}:(this.panes().forEach((e=>this._dataSourceCollectionChanged.fire(e))),this._lineToolsGroupModel.fireChangedAll(),this._linkingGroupIndex.setValue(null!==(s=e.linkingGroup)&&void 0!==s?s:null),{})}shouldBeSavedEvenIfHidden(){return this._shouldBeSavedEvenIfHidden}setShouldBeSavedEvenIfHidden(e){this._shouldBeSavedEvenIfHidden=e}externalTimeStamp(e){const t=this.mainSeries().syncModel();return this.timeScale().points().roughTime(e,t&&t.projectTime.bind(t))}syncLollipopSources(){var e;null===(e=this._lollipopSourcesWatcherLoader)||void 0===e||e.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._lollipopSourcesWatcher.syncSources()}))}restoreChartEvents(e){var t;null===(t=this._lollipopSourcesWatcherLoader)||void 0===t||t.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._options.chartEventsEnabled&&this._lollipopSourcesWatcher.restoreChartEvents(e)}))}recalcVisibleRangeStudies(e){var t;if(this._recalcVRStudiesParams.reasons.add(e),this.m_mainSeries.isStarted()&&this.m_mainSeries.isCompleted()){const i=(0,o.ensureDefined)(Vs.get(e)).adapter,s=Math.min(...Array.from(this._recalcVRStudiesParams.reasons).map((e=>(0,o.ensureDefined)(Vs.get(e)))).filter((e=>e.adapter===i)).map((e=>e.timeout)));(0,o.ensureDefined)(null===(t=this._recalcVisibleRangeStudiesImplDebouncedByAdapter.get(i))||void 0===t?void 0:t.get(s))()}else this._recalcVisibleRangeStudiesImpl(this._recalcVRStudiesParams)}recalcColorStudies(e){this._recalcColorStudiesParams.force=this._recalcColorStudiesParams.force||Boolean(e),this._recalcColorStudiesImplDebounced()}recalcStudyBasedLineTools(){this.dataSources().forEach((e=>{(0,S.isStudyLineTool)(e)&&e.recalcStudyIfNeeded()}))}alertsWatcher(){return this._alertsWatcher}showLegend(){return this._showLegendProperty}id(){return this._id}selectPointMode(){
return this._crossHairSelectPointMode}cancelRequestSelectPoint(){this.m_crossHairSource.cancelRequestSelectPoint()}requestSelectPoint(e){return this.m_crossHairSource.requestSelectPoint(e)}onPointSelected(){return this.m_crossHairSource.onPointSelected()}recalculatePriceRangeOnce(){const e=this.mainSeries();for(const t of this._panes)for(const i of t.priceDataSources())i.symbolSource()===e&&i.disablePriceRangeReady()}invalidate(e){var t;null===(t=this._invalidateHandler)||void 0===t||t.call(this,e)}appliedTimeFrame(){return this._appliedTimeFrame.appliedTimeFrame()}barsMarksSources(){return this._barsMarksSources}createSyncPoint(e,t){return(0,_s.getDefault2Lazy)(this._syncPointCache,e.uniqueId,t.uniqueId,(()=>new qt(e,t)))}isAutoSaveEnabled(){return this._isAutoSaveEnabled}linkingGroupIndex(){return this._linkingGroupIndex}studyAwareDefaultRightOffset(){return this._timeScale.usePercentageRightOffset().value()?this._timeScale.percentsToBarIndexLength(this.studyAwareDefaultRightOffsetPercentage()):Math.max(this._timeScale.defaultRightOffset().value(),this._cachedStudiesMaxOffset)}studyAwareDefaultRightOffsetPercentage(){return this._timeScale.usePercentageRightOffset().value()?Math.max(this._timeScale.defaultRightOffsetPercentage().value(),this._timeScale.barIndexLengthToPercents(this._cachedStudiesMaxOffset)):this._timeScale.barIndexLengthToPercents(this.studyAwareDefaultRightOffset())}clearAllStudies(){this.dataSources().forEach((e=>{var t;return null===(t=e.clearData)||void 0===t?void 0:t.call(e)}))}setTimeScaleAnimation(e,t){const i=W.InvalidationMask.light(),s=this._timeScale;i.setTimeScaleAnimation(e,null!=t?t:s.width()-s.indexToCoordinate(s.baseIndex())),this.invalidate(i)}stopTimeScaleAnimation(){this._timeScale.endScroll();const e=W.InvalidationMask.light();e.stopTimeScaleAnimation(),this.invalidate(e)}lollipopSourcesOptions(){const e=this._options;return{chartEventsEnabled:!this._options.isSnapshot&&this._options.chartEventsEnabled,esdEnabled:e.esdEnabled,newsNotificationsEnabled:e.newsNotificationsEnabled,continuousContractSwitchesEnabled:e.continuousContractSwitchesEnabled,futuresContractExpirationEnabled:e.futuresContractExpirationEnabled,latestUpdatesEnabled:e.latestUpdatesEnabled}}onSymbolIntervalChanged(){return this._symbolIntervalChanged}_initAlertsList(){throw new Error("Not implemented")}_updateStudiesMaxOffset(){const e=Math.max(...this.allStudies().map((e=>e.maxOffset().value())));this._cachedStudiesMaxOffset=e;const t=this._timeScale.rightOffset();if(t<0)return;if(e<=t)return;const i=this._timeScale.logicalRange();i?this._timeScale.zoomToBarsRange(i.left(),this._timeScale.baseIndex()+Math.max(this._timeScale.rightOffset(),e)):this._timeScale.setRightOffset(Math.max(t,e))}_updateBaseIndex(e,t){const i=this._timeScale,s=i.baseIndex(),r=i.logicalRange();if(null!==r&&t){const t=r.contains(s),n=e-s,o=t?null:i.rightOffset()-n;if(!this._options.shiftVisibleRangeOnNewBar&&t){const e=i.width()/i.barSpacing(),t=e/(e+n),s=Math.max(i.minBarSpacing(),i.barSpacing()*t);i.setBarSpacing(s)}
null!==o&&i.setRightOffset(o)}i.setBaseIndex(e)}async _createLollipopSourcesWatcher(){}_updateDateTimeFormatter(){const e=Ot.dateFormatProperty.value(),t=void 0;if(this._dateFormatter=new Nt.DateFormatter(e,t),this.mainSeries().isDWM())this._dateTimeFormatter=new Nt.DateFormatter(e,t),this._timeFormatter=new xt.TimeFormatter((0,Tt.getHourMinuteFormat)(Pt.timeHoursFormatProperty.value()));else{const i=M.Interval.parse(this.mainSeries().interval()),s=(0,Tt.getTimeFormatForInterval)(i,Pt.timeHoursFormatProperty.value());this._dateTimeFormatter=new Rt.DateTimeFormatter({dateFormat:e,withWeekday:t,timeFormat:s,dateTimeSeparator:" "}),this._timeFormatter=new xt.TimeFormatter(s)}}_invalidationMaskForSource(e,t=W.InvalidationLevel.Light){if(e===this.crossHairSource())return W.InvalidationMask.cursor();if(this._watermarkSource===e)return this._paneInvalidationMask((0,o.ensureNotNull)(this.paneForSource(this.mainSeries())),t);if(-1!==this._allCustomSources.indexOf(e)){const e=new W.InvalidationMask;return e.invalidateAll(t),e}if(!(0,v.isDataSource)(e))return null;if(e.isMultiPaneEnabled())return new W.InvalidationMask(t);const i=this.paneForSource(e);return null!==i?this._paneInvalidationMask(i,t):null}_paneInvalidationMask(e,t=W.InvalidationLevel.Light){const i=new W.InvalidationMask,s=this._panes.indexOf(e);return i.invalidateAllPane(s,t),i}_invalidationMaskForSourcePriceScale(e,t=W.InvalidationLevel.Light){if(!(0,v.isDataSource)(e))return new W.InvalidationMask(t);const i=this.paneForSource(e);if(null===i)return null;let s=e.priceScale();if(null===s)return null;const r=this._panes.indexOf(i);let n=i.priceScalePosition(s);if("overlay"===n){const e=this._panes[r].defaultPriceScale();s=e,n=i.priceScalePosition(e)}const o=i.priceScaleIndex(s,n);if(void 0===o)return null;const a=new W.InvalidationMask;return a.invalidatePriceScale(r,n,o,t),a}_removeCustomSource(e){const t=this._customSourcesMap.get(e);if(void 0===t)return void Ms.logWarn(`Attempt to remove custom source which does not exist in the model - "${e}"`);Ms.logNormal(`Removing custom source "${e}"`),this.selectionMacro((e=>{e.removeSourceFromSelection(t)})),this._hoveredSource===t&&this.setHoveredSource(null),this._customSourceBeingMoved===t&&this.setMovingCustomSource(null,null);const i=Ls(this._bgCustomSources,t),s=Ls(this._fgCustomSources,t),r=Ls(this._topmostCustomSources,t),n=Ls(this._allCustomSources,t);(0,o.assert)(i||s||r,"Source should be presented in one of the layers"),(0,o.assert)(n,"Source should be presented in the array"),this._customSourcesMap.delete(e),t.destroy()}_updateShowLegendProperty(){const e=this._properties.childs().paneProperties.childs().legendProperties.childs().showLegend,t=this._showLegendProperty;if(e.value())t.setValue(!0);else{for(const e of this._panes){let i=0;for(const s of e.priceDataSources())if(null!==s.statusView()&&(i++,i>=2))return void t.setValue(!1)}t.setValue(!0)}}_pointToPercentPosition(e,t){return{x:e.x/this._timeScale.width(),y:e.y/(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainDataSource()).priceScale()).height()}}
_percentPositionToPoint(e,t){const i=e.x*this._timeScale.width(),s=e.y*(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainDataSource()).priceScale()).height();return new a.Point(i,s)}_recalcVisibleRangeStudiesImpl(e){var t,i;if(!this.m_mainSeries.isStarted()||!this.m_mainSeries.isCompleted())return void this._visibleRangeStudiesInputs.setValue(null);if(this.timeScale().isEmpty())return;const s=this.timeScale().visibleBarsStrictRange();if(null===s)return;const r=this.m_mainSeries.bars(),n=r.search(s.firstBar(),It.PlotRowSearchMode.NearestRight),o=r.search(s.lastBar(),It.PlotRowSearchMode.NearestLeft),a=r.lastIndex(),l=n?n.index:void 0,c=o?o.index:void 0,h=l===e.oldStartVisibleIndex,d=c===e.oldEndVisibleIndex,u=[f.RecalcVisibleRangeStudiesReason.SeriesRestart,f.RecalcVisibleRangeStudiesReason.SeriesCompleted,f.RecalcVisibleRangeStudiesReason.StudyCreation].some((t=>e.reasons.has(t)));h&&d&&!u||(e.reasons.clear(),e.oldStartVisibleIndex=void 0!==l?l:NaN,e.oldEndVisibleIndex=void 0!==c?c:NaN,this._visibleRangeStudiesInputs.setValue({firstVisibleBarTime:1e3*(null!==(t=null==n?void 0:n.value[0])&&void 0!==t?t:0),lastVisibleBarTime:1e3*(null!==(i=null==o?void 0:o.value[0])&&void 0!==i?i:0),subscribeRealtime:(null==o?void 0:o.index)===a}))}_recalcColorStudiesImpl(e){var t;const i=this.backgroundColorAtYPercentFromTop(.5),s=this.dark().value()?c.colorsPalette["color-cold-gray-200"]:c.colorsPalette["color-cold-gray-900"],r=i===e.oldBgColor,n=s===e.oldFgColor;if(r&&n&&!e.force)return;e.force=!1,e.oldBgColor=i,e.oldFgColor=s;const o=null!==(t=e.studies)&&void 0!==t?t:this.priceDataSources();e.studies=void 0;for(const e of o)if((0,R.isStudy)(e)){const t=e.metaInfo().inputs.filter(x.isStudyInputDependsOnChartColors),r=e.properties().childs().inputs;t.forEach((e=>{const t=e.id===x.ChartColorDependentStudyInputNames.FgColor?s:i;r.childs()[e.id].setValueSilently(t)})),t.length>0&&r.listeners().fire(r,"")}}_getAllSources(e){const t=[];for(const i of this._panes){const s=i.sourcesByGroup().allWithoutMultipane();for(const i of s)e(i)&&t.push(i)}return t}_invalidateBarColorerCaches(){this.mainSeries().invalidateBarColorerCache()}_addAlertLabelToChart(e){throw new Error("Not implemented")}_removeAlertLabelFromChart(e){throw new Error("Not implemented")}_removeAllAlertLabelsFromChart(){throw new Error("Not implemented")}_updateTimeScale(e){var t,i,s,r;const{index:n,zoffset:o,values:a,indexDiffs:l,baseIndex:c,marks:h,clearFlag:d}=e;if(d){this._timeScale.reset();for(const e of this.dataSources())null===(t=e.clearData)||void 0===t||t.call(e)}if(l.length>0)for(const e of this.dataSources())null===(i=e.moveData)||void 0===i||i.call(e,l);const u=this._timeScale.indexToTimePoint(this._timeScale.baseIndex()),p=this._timeScale.canNormalize();this._timeScale.update(n,o,a,h);const _=this._timeScale.points().range().value();let m="ChartModel.prototype._updateTimeScale("+n+","+o+","+a.length+","+l.length+","+h.length+","+d+")"
;if(m+="TimeScale: {first:"+(null!==(s=null==_?void 0:_.firstIndex)&&void 0!==s?s:null)+",last:"+(null!==(r=null==_?void 0:_.lastIndex)&&void 0!==r?r:null)+"}",null===c){this._timeScale.resetBaseIndex();const e=this._timeScale.rightOffset();e<0?this._timeScale.setRightOffset(this.studyAwareDefaultRightOffset()):this._timeScale.setRightOffset(Math.max(e,this._cachedStudiesMaxOffset))}else if(void 0!==c){const e=this._timeScale.indexToTimePoint(c),t=null!==u&&null!==e&&e>u;this._updateBaseIndex(c,t)}if(Ms.logDebug(m),!p&&p!==this._timeScale.canNormalize())for(const e of this.dataSources())!(0,S.isLineTool)(e)||e.isFixed()||e.isSourceHidden()||e.processHibernate();for(const e of this.dataSources())e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0});this.recalculateAllPanes((0,Qe.globalChangeEvent)()),this.lightUpdate()}_getAvailableCurrencies(){return!this.currencyConversionEnabled()||this.isSnapshot()?[]:(0,ae.isArray)(this._availableCurrenciesList)?this._availableCurrenciesList:(null!==this._availableCurrenciesList||(this._availableCurrenciesList=this.chartApi().availableCurrencies(),this._availableCurrenciesList.then((e=>{this._destroyed||(this._availableCurrenciesList=e,this.fullUpdate())})).catch((e=>{Ms.logWarn(`An error occurred while getting currencies config: ${e}`)}))),[])}_getAvailableUnits(){return!this.unitConversionEnabled()||this.isSnapshot()?{}:this._availableUnitsObject instanceof Promise||null===this._availableUnitsObject?(null!==this._availableUnitsObject||(this._availableUnitsObject=this.chartApi().availableUnits(),this._availableUnitsObject.then((e=>{this._destroyed||(this._availableUnitsObject=e,this.fullUpdate())})).catch((e=>{Ms.logWarn(`An error occurred while getting units config: ${e}`)}))),{}):this._availableUnitsObject}_getAvailablePriceSources(e){const t=this._availablePriceSourcesBySymbol.get(e);if(Array.isArray(t))return t;if((0,ae.isPromise)(t))return[];const i=this.chartApi().availablePriceSources(e);return this._availablePriceSourcesBySymbol.set(e,i),i.then((t=>{this._destroyed||(this._availablePriceSourcesBySymbol.set(e,t),this.fullUpdate())})).catch((e=>{Ms.logWarn(`An error occurred while getting price sources config: ${e}`)})),[]}_clearAvailablePriceSources(){this._availablePriceSourcesBySymbol.clear()}_onSymbolIntervalChanged(){this._symbolIntervalChanged.fire()}_getBackgroundColor(e){const t=this._properties.childs().paneProperties.childs();if(t.backgroundType.value()===Zt.ColorType.Gradient){const i=t.backgroundGradientStartColor.value(),s=t.backgroundGradientEndColor.value();return e?i:s}return t.background.value()}_getBackgroundCounterColor(){const e=this.backgroundColor().value();return"black"===(0,l.rgbToBlackWhiteString)((0,l.parseRgb)(e),150)?"white":"black"}_updateBackgroundColor(){this._backgroundColor.setValue(this._getBackgroundColor()),this._backgroundTopColor.setValue(this._getBackgroundColor(!0))}_syncCrosshair(e){if(!this._isSettingsExternalPosition){
const t=this._undoModel.mainSeries(),i=t.syncModel(),s=this._undoModel.crossHairSource(),r=s.pane;if(null!==i&&null!==r){const n={timeStamp:this._timeScale.points().roughTime(s.index,i.projectTime.bind(i)),syncSourceTarget:i.syncSourceTarget()};r.mainDataSource()===t&&(n.price=s.price,n.symbol=t.symbol());let o=this._lineBeingCreated||null!==this._linePointBeingEdited||Boolean(this._sourcesBeingMoved.length);o=o&&(0,Le.drawOnAllCharts)().value(),this._undoModel.syncCrosshair(n,o,e)}this._phantomSourceContainer.onCursorPositionUpdated()}}_gotoTimeImpl(e,t){const i=this.timeScale(),s=this.mainSeries();let r;if(void 0!==e){if(this._scrollingState&&this._scrollingState.deferred.reject(),r=(0,_.createDeferredPromise)(),r.promise.catch((()=>{})),!s.isDWM()){const t=s.symbolInfo();if(null!==t){const i=(0,o.ensureNotNull)(this.timezoneExceptExchange().value()),r=(0,Ht.cal_to_utc)((0,Ht.get_timezone)(i),new Date(e)),n=(0,ai.createTimeToBarTimeAligner)(s.interval(),t)(r);e=(0,Ht.utc_to_cal)((0,Ht.get_timezone)(i),n).getTime()}}this._scrollingState={targetDate:e,deferred:r,centerIfVisible:t.centerIfVisible}}else{if(!this._scrollingState)return Ms.logError("scrollTo called without an argument"),Promise.reject();e=this._scrollingState.targetDate,r=this._scrollingState.deferred}if(void 0===i.tickMarks().minIndex)return r.resolve(void 0),r.promise;this.stopTimeScaleAnimation();let n=((e,t)=>{if((e=>(0,o.ensureNotNull)(i.tickMarks().indexToTime((0,o.ensureDefined)(i.tickMarks().minIndex))).valueOf()-e)(t)<0){let r=i.tickMarks().nearestIndex(t);const n=s.bars().lastIndex();if(null===n)return null;r=Math.min(r,n);let a=(0,o.ensureNotNull)(i.tickMarks().indexToTime(r)).valueOf();for(;ae.hasDataSource(this.m_mainSeries)))&&(this._studiesWV.setValue(this.allStudies()),this._studiesExcludeInternalWV.setValue(this.allStudies(!0)))}_unmergeAvailable(e){return e===this.m_mainSeries||(0,R.isStudy)(e)&&!e.isLinkedToSeries()&&!(0,ys.isNonSeriesStudy)(e)&&e.showInObjectTree()}_getExceedingChildStudies(e){let t=[];for(let i=0;i1&&s.push(e)),n=(n+1)%t.length}return s}}},42989:(e,t,i)=>{"use strict";i.d(t,{allChartStyles:()=>r});var s=i(56570);function r(){return function(){const e=[0,1,9,13,2,14,15,3,16,10];return s.enabled("chart_style_hilo")&&e.push(12),e}().concat((s.enabled("japanese_chart_styles"),[8]))}},51804:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(93815).ChartModelBase,n=i(630).isLineTool,o=i(49483).CheckMobile,a=i(62288).InvalidationLevel,l=i(52033).Delegate;const{sourceChangeEvent:c}=i(44672);var h=i(72708).isStudy,d=i(928),u=i(64442).MainSeriesScaleRatioProperty,p=i(59769).scaleRatio,_=i(72396).StudyInserter,m=i(63829).dateFormatProperty,g=i(11497).timeHoursFormatProperty,f=i(76422),v=i(93567).StudyColorRotatorFactory,y=i(56570),S=i(12974).AppliedTimeFrame;y.enabled("fix_left_edge");class b extends r{constructor(e,t,i,s,r,n,o,a,l,c){super(e,t,i,s,r,n,o,a,l,c);var h=this;this._mainSeriesScaleRatioProperty=new u(this),this.m_mainSeries.dataEvents().completed().subscribe(this,function(){this._scrollingState&&this.gotoTime()}.bind(this)),this.m_mainSeries.onIntervalChanged().subscribe(this,(function(){this._recalcVRStudiesParams.oldStartVisibleIndex=NaN,this._recalcVRStudiesParams.oldEndVisibleIndex=NaN})),this._readOnly||(this.m_mainSeries.properties().addChild("priceAxisProperties",this.m_mainSeries.priceScale().properties()),this._properties.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,(function(e){e.value()||h._properties.paneProperties.legendProperties.showStudyArguments.setValue(!1)}))),d.hideAllDrawings().subscribe(this,this._onDrawingsVisibilityChanged),d.hideAllIndicators().subscribe(this,this._onIndicatorsVisibilityChanged),this._properties.scalesProperties.listeners().subscribe(this,b.prototype.fullUpdate),this._studyShiftColorStartOffset=void 0,m.subscribe(this,this._updateDateTimeFormatter),g.subscribe(this,this._updateDateTimeFormatter),this.mainSeries().properties().interval.subscribe(this,this._updateDateTimeFormatter),this._updateDateTimeFormatter(),this._studyColorRotatorFactory=new v(this),this._dataSourceCollectionChanged.subscribe(this,this._updateShowLegendProperty.bind(this)),this._properties.paneProperties.legendProperties.showLegend.subscribe(this,this._updateShowLegendProperty),this._appliedTimeFrame=new S(this),this.mainSeries().onTimeFrameApplied().subscribe(this,(function(e){var t=null!==e?{
res:this.mainSeries().interval(),val:e}:null;this.appliedTimeFrame().setValue(t)}))}startNotStartedStudies(){if(!this.m_mainSeries.isStarted())throw new Error("Cannot start studies: main series is not started");for(var e=this.dataSources(),t=0;t0),n?{left:0,right:1,totallySlots:i}:{left:1,right:0,totallySlots:i}}return{left:e,right:t,totallySlots:e+t}}setPriceAutoScale(e,t,i){e.setPriceAutoScale(t,i),this.invalidate(this._paneInvalidationMask(e,a.Light))}updateScales(e,t){this._undoModel._chartWidget._updateScalesActions()}mainSeriesScaleRatioProperty(){return this._mainSeriesScaleRatioProperty}mainSeriesScaleRatioPropertyOnChanged(){this._mainSeriesScaleRatioProperty.listeners().fire(this._mainSeriesScaleRatioProperty)}mainSeriesScaleRatio(){return p(this._timeScale,this.m_mainSeries.priceScale())}setMainSeriesScaleRatio(e){this.paneForSource(this.m_mainSeries).applyPriceScaleRatio(this.m_mainSeries.priceScale(),e)}dataSourceForId(e){for(var t,i=0;ithis.removeSource(e))),Array.from(this._customSourcesMap.keys()).forEach(this._removeCustomSource,this),s(0===this._topmostCustomSources.length),s(0===this._fgCustomSources.length),s(0===this._bgCustomSources.length),s(0===this._allCustomSources.length),s(0===this._customSourcesMap.size);for(var e=0;e{"use strict";var s=i(68979).makeFont,r=i(68979).parseFont,n=i(31955).getLogger;const{drawPoly:o}=i(37743);var a=n("Model.ChartTradingUtils"),l={_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)):a.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=l},46088:(e,t,i)=>{"use strict";var s;i.d(t,{ColorType:()=>s}),function(e){e.Solid="solid",e.Gradient="gradient"}(s||(s={}))},50788:(e,t,i)=>{"use strict";i.d(t,{actualCurrencyUnitVisibility:()=>h,currencyUnitVisibilityOptions:()=>l,currencyUnitVisibilityProperty:()=>a,migrateShowCurrencyAndShowUnitProperties:()=>u,restoreCurrencyUnitVisibilitySettingsValue:()=>c});var s,r=i(17656),n=i(56840),o=i.n(n);!function(e){e.SettingsKey="PriceAxisCurrencyAndUnit.visibility"}(s||(s={}));const{property:a,availableValues:l,restoreDefaultValue:c,actualBehavior:h}=(0,r.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let d=!1;function u(e,t){d||(d=!0,void 0===o().getValue("PriceAxisCurrencyAndUnit.visibility")&&a().setValue(e||t?"alwaysOn":"alwaysOff"))}},98272:(e,t,i)=>{"use strict";i.d(t,{sourceNewCurrencyOnPinningToPriceScale:()=>r});var s=i(60074);function r(e,t,i,r){let n=null;if(i.currencyConversionEnabled()&&(0,s.isActingAsSymbolSource)(e)){const s=i.availableCurrencies(),o=t.currency(s),a=e.currency()
;null!==o&&null!==o.selectedCurrency&&!o.allCurrenciesAreOriginal&&o.selectedCurrency!==a&&(r&&null===a||null!==a&&s.convertible(a))&&(n=o.selectedCurrency)}return n}},28120:(e,t,i)=>{"use strict";i.d(t,{CustomSourceBase:()=>s});class s{constructor(e,t){this._id=e,this._model=t}id(){return this._id}isHoveredEnabled(){return!0}isSelectionEnabled(){return!1}priceScale(){return null}paneViews(e){return[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateViewsForPane(e,t){e.containsMainSeries()&&this.updateAllViews(t)}}},36915:(e,t,i)=>{"use strict";i.d(t,{isLineToolState:()=>o,isMainSeriesState:()=>r,isStudyLineToolState:()=>a,isStudyState:()=>n});var s=i(15764);function r(e){return"MainSeries"===e.type}function n(e){return Boolean(e.type)&&e.type.toLowerCase().startsWith("study")}function o(e){return Boolean(e.type)&&(0,s.isLineToolName)(e.type)}function a(e){return Boolean(e.type)&&(0,s.isStudyLineToolName)(e.type)}},29137:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>l,getTranslatedStringForSource:()=>a});var s=i(45126),r=i(92184),n=i(52033),o=i(64147);function a(e,t){return new s.TranslatedString(t.name(),t.title(e))}class l{constructor(e){this._isDestroyed=!1,this._hasAlert=new o.WatchedValue(!1),this._alertStatus=new o.WatchedValue(0),this._alertCreationAvailable=new o.WatchedValue(!1),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)}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!1}idForAlert(){return this._id}alertStatus(){return this._alertStatus.readonly()}_getAlertCreationAvailable(){return!1}_updateAlertCreationAvailable(){0}}},7576:(e,t,i)=>{"use strict";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(){}}},63829:(e,t,i)=>{"use strict";i.d(t,{dateFormatProperty:()=>l,restoreDateFormatSettingsValue:()=>c});var s=i(56840),r=i(17625),n=i(47462);const o="date_format";function a(){return s.getValue(o,(0,n.defaultDateFormat)())}const l=(0,r.createPrimitiveProperty)(a());function c(){l.setValue((0,n.defaultDateFormat)()),s.remove(o)}s.onSync.subscribe(null,(()=>l.setValue(a()))),l.subscribe(null,(()=>s.setValue(o,l.value())))},55917:(e,t,i)=>{"use strict";i.d(t,{DefaultProperty:()=>D,allowSavingDefaults:()=>C,createDefaultsState:()=>b,extractAllPropertiesKeys:()=>P,extractState:()=>T});var s=i(27788),r=i(14314),n=i(40405),o=i(38004),a=i(48828),l=i(49984),c=i(16230),h=i(38651),d=i(98279),u=i(26843),p=i(45345),_=i(35039),m=i(52033),g=i(12168),f=i(12988),v=i(50151);const y=(0,g.getLogger)("ThemedDefaults");function S(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,d.default)(i)||0!==Object.keys(i).length)break;(0,n.default)(e,t),t.pop()}}}function b(e,t,i,n){const o=e?_.defaults:_.factoryDefaults,a=t.startsWith("study_")?(0,s.default)(o("study")):{};let l=(0,s.default)(o(t,n));return t.startsWith("study_")&&l.inputs&&delete l.inputs.symbol,"linetoolicon"===t&&e&&(l.icon=(0,_.defaults)(t).icon),"linetooemoji"===t&&e&&(l.emoji=(0,_.defaults)(t).emoji),"linetoolsticker"===t&&e&&(l.sticker=(0,_.defaults)(t).sticker),l=(0,s.default)(l),S(l,i),(0,r.default)(a,l),a}
let w=!1;function C(e){w=e}function P(e){const t=Object.keys(e),i=[];return t.forEach((t=>{const s=e[t];if((0,d.default)(s)){P(s).forEach((e=>i.push(`${t}.${e}`)))}else i.push(t)})),i}function x(e,t,i=""){const s={};for(const r of t){const n=r.split("."),o=n[0],a=e[o],l=""===i?o:`${i}.${o}`;if(e.hasOwnProperty(o))if(n.length>1){if(!(0,d.default)(a)){y.logError(`path ${l} 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]=x(a,e,l)}}else{if((0,d.default)(a)){y.logError(`path ${l} must be a primitive, but it is an object`);continue}s[o]=a}}return s}function T(e,t,i){if(!e)return{};let s=e;return t&&(s=x(e,t)),i&&S(s,i,!0),s}function I(e,t){e.includes(t)||e.push(t)}function M(e,t){const i=e.indexOf(t);-1!==i&&e.splice(i,1)}function A(e,t){const i=(0,l.default)(e,((e,i,s)=>{if(void 0===t[s])return e;if(!(0,c.default)(i,t[s]))if((0,d.default)(i)&&(0,d.default)(t[s])){const r=A(i,t[s]);void 0!==r&&(e[s]=r)}else e[s]=i;return e}),{});return(0,h.default)(i)?void 0:i}var L;function k(e){return e===u.StdTheme.Dark?1:0}!function(e){e[e.DefaultsKey=1]="DefaultsKey",e[e.StateKey=2]="StateKey"}(L||(L={}));class D extends f.Property{constructor(e){const{defaultName:t,nonThemedDefaultsKeys:i,themedDefaultsKeys:s,excludedDefaultsKeys:n=[],themedColors:o,allStateKeys:a,excludedStateKeys:l=[],state:c,useUserPreferences:h=!0,saveNonDefaultUserPreferencesOnly:d=!1,ignoreAllowSavingDefaults:u=!1,saveDefaultsConsumer:p=_.saveDefaults,factoryDefaultsSupplier:g=(()=>b(!1,t,[],null))}=e;super(),this._themedColors=[],this._restoreFactoryDefaultsEvent=new m.Delegate,this._defaultName=t,this._useUserPreferences=h,this._saveNonDefaultUserPreferencesOnly=d,this._ignoreAllowSavingDefaults=u,this._saveDefaultsConsumer=p,this._factoryDefaultsSupplier=g,this._allStateKeys=a,this._excludedStateKeys=l,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,v.assert)(void 0===this._allDefaultsKeys||0===this._excludedDefaultsKeys.length,"Defaults keys and excluded defaults keys cannot be used at the same time"),(0,v.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(),T(c,a,l))),this._restoreFactoryDefaultsEvent=new m.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 T(super.state(this._excludedDefaultsKeys),this._allDefaultsKeys)}mergePreferences(e){this.mergeAndFire(T(e,this._allDefaultsKeys,this._excludedDefaultsKeys))}addExcludedKey(e,t){1&t&&I(this._excludedDefaultsKeys,e),2&t&&I(this._excludedStateKeys,e)}removeExcludedKey(e,t){1&t&&M(this._excludedDefaultsKeys,e),2&t&&M(this._excludedStateKeys,e)}restoreFactoryDefaults(){
const e=this._factoryDefaultsSupplier();if(S(e,this._excludedDefaultsKeys),this._themedColors){const t=k(p.watchedTheme.value());for(const i of this._themedColors)(0,a.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&&!w||this._defaultName.startsWith("replayStudyStrategy")||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=A(T(t,this._nonThemedDefaultsKeys),T(i,this._nonThemedDefaultsKeys,this._excludedDefaultsKeys));const s=T(i,this._themedDefaultsKeys,this._excludedDefaultsKeys),n=T(t,this._themedDefaultsKeys),o=A(n,s);(0,h.default)(o)||(e=null!=e?e:{},(0,r.default)(e,n))}else e=this.preferences();this._saveDefaultsConsumer(this._defaultName,e)}clone(e){return new D(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===u.StdTheme.Light?u.StdTheme.Dark:u.StdTheme.Light;for(const s of this._themedColors){const r=(0,v.ensureDefined)(this.childByPath(s.path)),n=s.colors[k(i)];!e&&r.value()!==n&&r.value()||r.setValue(s.colors[k(t)])}}state(e){return T(super.state([...this._excludedStateKeys,...null!=e?e:[]]),this._allStateKeys)}_userSettings(){if(!this._useUserPreferences)return;const e=b(!0,this._defaultName,[],null);return e?T((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}}}},35039:(e,t,i)=>{"use strict";var s=i(91140).PlDisplay;const{getHexColorByName:r}=i(19625),{generateColor:n,applyAlpha:o}=i(19063)
;var a=i(91140).TradedGroupHorizontalAlignment,l=i(5171),c=i(96333).LineToolPitchforkStyle,h=i(67467).LineToolBarsPatternMode,d=i(94113),u=d.LineStudyPlotStyle,p=d.STUDYPLOTDISPLAYTARGET,_=i(55158),m=i(94164).PriceAxisLastValueMode,g=i(92693).MagnetMode,f=i(49857).LineEnd,v=i(46088).ColorType,y=i(20596).RangeBarStyle;const{LineStyle:S}=i(85904);i(64671).VolumeFootprintTypeValues;var b=i(39429).StatsPosition,w=i(6290).sessionsPreferencesDefault,C=i(57596).axisLabelBackgroundColor;const{LINESTYLE_SOLID:P,LINESTYLE_DOTTED:x,LINESTYLE_DASHED:T}=i(51056);var I=i(31955).getLogger("Chart.Defaults");const M=r("color-black"),A=r("color-white"),L=n(A,75),k=r("color-tv-blue-50"),D=(r("color-tv-blue-400"),r("color-tv-blue-500")),E=(n(D,30),n(D,70)),V=n(D,72),B=n(D,75),R=n(D,80),N=r("color-tv-blue-600"),O=r("color-deep-blue-200"),F=r("color-deep-blue-300"),W=(r("color-deep-blue-a400"),r("color-deep-blue-500")),H=n(W,80),z=r("color-sky-blue-500"),U=n(z,80),j=r("color-sky-blue-700"),G=n(j,30),q=r("color-youtube"),$=r("color-ripe-red-200"),K=r("color-ripe-red-300"),Y=r("color-ripe-red-400"),Z=n(Y,95),X=r("color-ripe-red-500"),J=n(X,70),Q=n(X,80),ee=n(X,72),te=n(X,95),ie=r("color-ripe-red-600"),se=r("color-grapes-purple-500"),re=n(se,100),ne=n(se,80),oe=n(se,30),ae=r("color-berry-pink-500"),le=n(ae,80),ce=r("color-minty-green-100"),he=r("color-minty-green-500"),de=n(he,80),ue=n(he,72),pe=n(he,95),_e=r("color-iguana-green-300"),me=r("color-iguana-green-500"),ge=n(me,80),fe=(r("color-iguana-green-a700"),r("color-tan-orange-300")),ve=r("color-tan-orange-500"),ye=n(ve,80),Se=r("color-tan-orange-600"),be=r("color-tan-orange-700"),we=r("color-cold-gray-150"),Ce=r("color-cold-gray-300"),Pe=r("color-cold-gray-400"),xe=r("color-cold-gray-450"),Te=r("color-cold-gray-500"),Ie=r("color-cold-gray-800"),Me=n(Ie,94),Ae=n(Ie,100),Le=r("color-cold-gray-900"),ke=r("color-cold-gray-750"),De=r("color-forest-green-300"),Ee=n(De,95);var Ve=function(e){var t=function(e,t){return{color:e,visible:t}},i=function(e,t,i,s){const r={coeff:e,color:t,visible:i};return s&&(r.text=""),r},r=function(e,t,i,s,r){return{coeff:e,color:t,visible:i,linestyle:void 0===s?P:s,linewidth:void 0===r?2:r}},o=function(e,t,i){return{color:e,width:void 0===i?2:i,visible:t}},d=function(e,t,i,s,r){return{color:e,visible:t,width:i,x:s,y:r}},I=function(e,t,i,s,r,n){return{coeff1:e,coeff2:t,color:i,visible:s,linestyle:void 0===r?P:r,linewidth:void 0===n?2:n}};if(void 0===TradingView.defaultProperties){var Ie;switch(window.locale){case"ar_AE":Ie="Asia/Dubai";break;case"au":Ie="Australia/Sydney";break;case"br":Ie="America/Sao_Paulo";break;case"ca":Ie="America/Toronto";break;case"de_DE":case"it":Ie="Europe/Berlin";break;case"es":Ie="Europe/Madrid";break;case"fa_IR":Ie="Asia/Tehran";break;case"fr":case"sv_SE":Ie="Europe/Paris";break;case"he_IL":case"tr":Ie="Europe/Athens";break;case"hu_HU":case"pl":Ie="Europe/Warsaw";break;case"id":case"th_TH":case"vi_VN":Ie="Asia/Bangkok";break;case"in":Ie="Asia/Kolkata";break;case"ja":case"kr":Ie="Asia/Tokyo";break;case"ms_MY":Ie="Asia/Singapore";break
;case"ru":Ie="Europe/Moscow";break;case"uk":Ie="Europe/London";break;case"zh_CN":case"zh_TW":Ie="Asia/Shanghai";break;default:Ie="Etc/UTC"}TradingView.defaultProperties={chartproperties:{timezone:Ie,priceScaleSelectionStrategyName:"auto",paneProperties:{backgroundType:v.Solid,background:A,backgroundGradientStartColor:A,backgroundGradientEndColor:A,gridLinesMode:"both",vertGridProperties:{color:Me,style:P},horzGridProperties:{color:Me,style:P},crossHairProperties:{color:Pe,style:T,transparency:0,width:1},topMargin:10,bottomMargin:8,axisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,alignLabels:!0,isInverted:!1},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0,showLastDayChange:!1,showBarChange:!0,showVolume:!1,showBackground:!0,showPriceSource:!0,backgroundTransparency:50,showLogo:!0},separatorColor:we},scalesProperties:{backgroundColor:A,lineColor:Ae,textColor:Le,fontSize:12,scaleSeriesOnly:!1,showSeriesLastValue:!0,seriesLastValueMode:m.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!0,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalNameLabel:!1,showFundamentalLastValue:!0,barSpacing:_.DEFAULT_BAR_SPACING,axisHighlightColor:B,axisLineToolLabelBackgroundColorCommon:C.common,axisLineToolLabelBackgroundColorActive:C.active,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0,crosshairLabelBgColorLight:Le,crosshairLabelBgColorDark:ke},mainSeriesProperties:{style:l.STYLE_CANDLES,esdShowDividends:!0,esdShowSplits:!0,esdShowEarnings:!0,esdShowBreaks:!1,esdFlagSize:2,showContinuousContractSwitches:!0,showContinuousContractSwitchesBreaks:!1,showFuturesContractExpiration:!0,showLastNews:!0,showCountdown:!0,bidAsk:{visible:!1,lineStyle:x,lineWidth:1,bidLineColor:D,askLineColor:Y},prePostMarket:{visible:!0,lineStyle:x,lineWidth:1,preMarketColor:Se,postMarketColor:D},highLowAvgPrice:{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLineVisible:!1,averageClosePriceLabelVisible:!1,highLowPriceLinesColor:"",highLowPriceLinesWidth:1,averagePriceLineColor:"",averagePriceLineWidth:1},visible:!0,showPriceLine:!0,priceLineWidth:1,priceLineColor:"",baseLineColor:Ce,showPrevClosePriceLine:!1,prevClosePriceLineWidth:1,prevClosePriceLineColor:"#555555",minTick:"default",dividendsAdjustment:void 0,backAdjustment:!1,settlementAsClose:!0,sessionId:"regular",sessVis:!1,statusViewStyle:{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"},candleStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,barColorsOnPrevClose:!1,drawBody:!0},volCandlesStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,barColorsOnPrevClose:!1,
drawBody:!0},hollowCandleStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,drawBody:!0},haStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,showRealLastPrice:!1,barColorsOnPrevClose:!1,inputs:{},inputInfo:{},drawBody:!0},barStyle:{upColor:he,downColor:X,barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},hiloStyle:{color:D,showBorders:!0,borderColor:D,showLabels:!0,labelColor:D,drawBody:!0},columnStyle:{upColor:n(he,50),downColor:n(X,50),barColorsOnPrevClose:!0,priceSource:"close"},lineStyle:{color:D,linestyle:P,linewidth:2,priceSource:"close"},tpoStyle:{},svpStyle:{},lineWithMarkersStyle:{color:D,linestyle:P,linewidth:2,priceSource:"close"},steplineStyle:{color:D,linestyle:P,linewidth:2,priceSource:"close"},areaStyle:{color1:V,color2:D,linecolor:D,linestyle:P,linewidth:2,priceSource:"close",transparency:100},hlcAreaStyle:{highLineColor:he,highLineStyle:P,highLineWidth:2,lowLineColor:X,lowLineStyle:P,lowLineWidth:2,closeLineColor:xe,closeLineStyle:P,closeLineWidth:2,highCloseFillColor:de,closeLowFillColor:Q},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,isInverted:!1,alignLabels:!0},renkoStyle:{upColor:he,downColor:X,borderUpColor:he,borderDownColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",borderUpColorProjection:"#a9dcc3",borderDownColorProjection:"#f5a6ae",wickUpColor:he,wickDownColor:X,inputs:{source:"close",sources:"Close",boxSize:3,style:"ATR",atrLength:14,percentageLTP:1,wicks:!0},inputInfo:{source:{name:"Source"},sources:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR length"},percentageLTP:{name:"Percentage"},wicks:{name:"Wicks"}}},pbStyle:{upColor:he,downColor:X,borderUpColor:he,borderDownColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",borderUpColorProjection:"#a9dcc3",borderDownColorProjection:"#f5a6ae",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:he,downColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",inputs:{source:"close",style:"ATR",atrLength:14,percentageLTP:1,reversalAmount:1},inputInfo:{source:{name:"Source"},style:{name:"Style"},atrLength:{name:"ATR length"},percentageLTP:{name:"Percentage"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:he,downColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",inputs:{sources:"Close",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14,percentageLTP:1,oneStepBackBuilding:!1},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR length"},percentageLTP:{name:"Percentage"},oneStepBackBuilding:{name:"One step back building"}}},baselineStyle:{baselineColor:xe,topFillColor1:ue,
topFillColor2:pe,bottomFillColor1:te,bottomFillColor2:ee,topLineColor:he,bottomLineColor:X,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},rangeStyle:{barStyle:y.Bars,upColor:he,downColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",thinBars:!0,candlesUpColor:he,candlesDownColor:X,candlesBorderUpColor:he,candlesBorderDownColor:X,candlesWickUpColor:he,candlesWickDownColor:X,inputs:{range:10,phantomBars:!1},inputInfo:{range:{name:"Range"},phantomBars:{name:"Phantom bars"}}},volFootprintStyle:{}},chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"#555555",visible:!1,style:T,width:1}},tradingProperties:{showPositions:!0,positionPL:{visibility:!0,display:s.Money},bracketsPL:{visibility:!0,display:s.Money},showOrders:!0,showExecutions:!0,showExecutionsLabels:!1,showReverse:!0,horizontalAlignment:a.Right,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:P},editorFontsList:["Verdana","Courier New","Times New Roman","Arial"],volumePaneSize:"large"},sessions:w,drawings:{magnet:!1,magnetMode:g.WeakMagnet,stayInDrawingMode:!1,drawOnAllCharts:!0,drawOnAllChartsMode:1},linetoolorder:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineColor:q,lineActiveBuyColor:"#4094e8",lineInactiveBuyColor:"rgba(64, 148, 232, 0.5)",lineActiveSellColor:"#e75656",lineInactiveSellColor:"rgba(231, 86, 86, 0.5)",lineStyle:"inherit",lineWidth:"inherit",bodyBorderActiveBuyColor:"#4094e8",bodyBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyBorderActiveSellColor:"#e75656",bodyBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyBackgroundColor:L,bodyBackgroundTransparency:25,bodyTextInactiveLimitColor:"rgba(38, 140, 2, 0.5)",bodyTextActiveLimitColor:"#268c02",bodyTextInactiveStopColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveStopColor:"#e75656",bodyTextInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyTextActiveBuyColor:"#4094e8",bodyTextInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveSellColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderActiveBuyColor:"#4094e8",quantityBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBorderActiveSellColor:"#e75656",quantityBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBackgroundActiveBuyColor:"#4094e8",quantityBackgroundInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundActiveSellColor:"#e75656",quantityTextColor:A,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderActiveBuyColor:"#4094e8",cancelButtonBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonBorderActiveSellColor:"#e75656",cancelButtonBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",cancelButtonBackgroundColor:L,cancelButtonBackgroundTransparency:25,cancelButtonIconActiveBuyColor:"#4094e8",cancelButtonIconInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonIconActiveSellColor:"#e75656",
cancelButtonIconInactiveSellColor:"rgba(231, 86, 86, 0.5)",tooltip:"",modifyTooltip:"",cancelTooltip:""},linetoolposition:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineBuyColor:"#4094e8",lineSellColor:"#e75656",lineStyle:"inherit",lineWidth:"inherit",bodyBorderBuyColor:"#4094e8",bodyBorderSellColor:"#e75656",bodyBackgroundColor:L,bodyBackgroundTransparency:25,bodyTextPositiveColor:"#268c02",bodyTextNeutralColor:"#646464",bodyTextNegativeColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderBuyColor:"#4094e8",quantityBorderSellColor:"#e75656",quantityBackgroundBuyColor:"#4094e8",quantityBackgroundSellColor:"#e75656",quantityTextColor:A,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderBuyColor:"#4094e8",reverseButtonBorderSellColor:"#e75656",reverseButtonBackgroundColor:L,reverseButtonBackgroundTransparency:25,reverseButtonIconBuyColor:"#4094e8",reverseButtonIconSellColor:"#e75656",closeButtonBorderBuyColor:"#4094e8",closeButtonBorderSellColor:"#e75656",closeButtonBackgroundColor:L,closeButtonBackgroundTransparency:25,closeButtonIconBuyColor:"#4094e8",closeButtonIconSellColor:"#e75656",tooltip:"",protectTooltip:"",closeTooltip:"",reverseTooltip:""},linetoolexecution:{direction:"buy",arrowHeight:8,arrowSpacing:1,arrowBuyColor:"#4094e8",arrowSellColor:"#e75656",text:"",textColor:M,textTransparency:0,fontFamily:"Verdana",fontSize:10,fontBold:!1,fontItalic:!1,tooltip:""},linetoolicon:{color:D,size:40,icon:61720,angle:.5*Math.PI},linetoolemoji:{size:40,emoji:"😀",angle:.5*Math.PI},linetoolsticker:{size:110,sticker:"bitcoin",angle:.5*Math.PI},linetoolimage:{transparency:0,cssWidth:0,cssHeight:0,angle:0},linetoolbezierquadro:{linecolor:D,linewidth:2,fillBackground:!1,backgroundColor:R,transparency:50,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal},linetoolbeziercubic:{linecolor:W,linewidth:2,fillBackground:!1,backgroundColor:H,transparency:80,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal},linetooltrendline:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:b.Right},linetoolinfoline:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!0,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!0,showPercentPriceRange:!0,showPipsPriceRange:!0,showBarsRange:!0,showDateTimeRange:!0,showDistance:!0,showAngle:!0,statsPosition:b.Center},linetooltimecycles:{linecolor:"#159980",linewidth:2,
fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:P},linetoolsineline:{linecolor:"#159980",linewidth:2,linestyle:P},linetooltrendangle:{linecolor:D,linewidth:2,linestyle:P,textcolor:D,fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1,statsPosition:b.Right},linetooldisjointangle:{linecolor:he,linewidth:2,linestyle:P,fillBackground:!0,backgroundColor:de,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,textcolor:he,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:he,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolflatbottom:{linecolor:ve,linewidth:2,linestyle:P,fillBackground:!0,backgroundColor:ye,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,textcolor:ve,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ve,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolriskrewardshort:{linecolor:Te,linewidth:1,textcolor:A,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:Q,profitBackground:de,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolriskrewardlong:{linecolor:Te,linewidth:1,textcolor:A,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:Q,profitBackground:de,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolarrow:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Arrow,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:b.Right},linetoolray:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!0,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:b.Right},linetoolextended:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!0,extendRight:!0,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",
vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:b.Right},linetoolhorzline:{linecolor:D,linewidth:2,linestyle:P,showPrice:!0,showLabel:!1,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle"},linetoolhorzray:{linecolor:D,linewidth:2,linestyle:P,showPrice:!0,showLabel:!1,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{linecolor:D,linewidth:2,linestyle:P,extendLine:!0,showTime:!0,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle",textcolor:D,textOrientation:"vertical",fontsize:14,bold:!1,italic:!1},linetoolcrossline:{linecolor:D,linewidth:2,linestyle:P,showPrice:!0,showTime:!0},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",showLabels:!0,fillBackground:!1,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:T},level1:r(0,Te,!0),level2:r(1,D,!0),level3:r(2,D,!0),level4:r(3,D,!0),level5:r(5,D,!0),level6:r(8,D,!0),level7:r(13,D,!0),level8:r(21,D,!0),level9:r(34,D,!0),level10:r(55,D,!0),level11:r(89,D,!0)},linetooltext:{color:D,fontsize:14,fillBackground:!1,backgroundColor:"rgba(91, 133, 191, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"#667b8b",bold:!1,italic:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:200},linetooltextabsolute:{color:D,fontsize:14,fillBackground:!1,backgroundColor:"rgba(155, 190, 213, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"#667b8b",bold:!1,italic:!1,fixedSize:!1,wordWrap:!1,wordWrapWidth:200},linetoolballoon:{color:A,backgroundColor:oe,borderColor:re,fontsize:14,transparency:30},linetoolcomment:{color:A,backgroundColor:D,borderColor:D,fontsize:16,transparency:0},linetoolbrush:{linecolor:z,linewidth:2,linestyle:P,smooth:5,fillBackground:!1,backgroundColor:z,transparency:50,leftEnd:f.Normal,rightEnd:f.Normal},linetoolhighlighter:{linecolor:Q,smooth:5,transparency:80},linetoolpolyline:{linecolor:z,linewidth:2,linestyle:P,fillBackground:!0,backgroundColor:U,transparency:80,filled:!1},linetoolsignpost:{emoji:"🙂",showImage:!1,plateColor:D,fontSize:12,bold:!1,italic:!1},linetoolpath:{lineColor:D,lineWidth:2,lineStyle:P,leftEnd:f.Normal,rightEnd:f.Arrow},linetoolarrowmarkleft:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkup:{color:he,arrowColor:he,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkright:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkdown:{color:ie,arrowColor:ie,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolflagmark:{flagColor:D},linetoolpricelabel:{color:A,backgroundColor:D,borderColor:D,fontWeight:"bold",fontsize:14,transparency:0},linetoolarrowmarker:{backgroundColor:N,textColor:N,bold:!0,italic:!1,fontsize:16,showLabel:!0},linetoolrectangle:{color:se,fillBackground:!0,backgroundColor:ne,linewidth:2,
transparency:50,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle",textColor:se,fontSize:14,bold:!1,italic:!1,extendLeft:!1,extendRight:!1,middleLine:{showLine:!1,lineWidth:1,lineColor:se,lineStyle:S.Dashed}},linetoolrotatedrectangle:{color:me,fillBackground:!0,backgroundColor:ge,transparency:50,linewidth:2},linetoolcircle:{color:ve,backgroundColor:ye,fillBackground:!0,linewidth:2,showLabel:!1,textColor:ve,fontSize:14,bold:!1,italic:!1},linetoolellipse:{color:X,fillBackground:!0,backgroundColor:Q,transparency:50,linewidth:2,showLabel:!1,textColor:X,fontSize:14,bold:!1,italic:!1},linetoolarc:{color:ae,fillBackground:!0,backgroundColor:le,transparency:80,linewidth:2},linetoolprediction:{linecolor:D,linewidth:2,sourceBackColor:D,sourceTextColor:A,sourceStrokeColor:D,targetStrokeColor:D,targetBackColor:D,targetTextColor:A,successBackground:me,successTextColor:A,failureBackground:X,failureTextColor:A,intermediateBackColor:"#ead289",intermediateTextColor:"#6d4d22",transparency:10,centersColor:"#202020"},linetooltriangle:{color:he,fillBackground:!0,backgroundColor:de,transparency:80,linewidth:2},linetoolcallout:{color:A,backgroundColor:G,transparency:50,linewidth:2,fontsize:14,bordercolor:j,bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:200},linetoolparallelchannel:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:R,transparency:20,showMidline:!0,midlinecolor:D,midlinewidth:1,midlinestyle:T,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:D,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolelliottimpulse:{degree:7,showWave:!0,color:"#3d85c6",linewidth:2},linetoolelliotttriangle:{degree:7,showWave:!0,color:ve,linewidth:2},linetoolelliotttriplecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:2},linetoolelliottcorrection:{degree:7,showWave:!0,color:"#3d85c6",linewidth:2},linetoolelliottdoublecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:2},linetoolbarspattern:{color:D,mode:h.Bars,mirrored:!1,flipped:!1},linetoolghostfeed:{averageHL:20,variance:50,candleStyle:{upColor:ce,downColor:$,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:Te},transparency:50},study:{inputs:{},styles:{},bands:{},graphics:{},ohlcPlots:{},palettes:{},filledAreasStyle:{},filledAreas:{},visible:!0,showLegendValues:!0,showLabelsOnPriceScale:!0,precision:"default"},linetoolpitchfork:{fillBackground:!0,transparency:80,style:c.Original,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolpitchfan:{fillBackground:!0,transparency:80,median:{visible:!0,color:X,linewidth:2,linestyle:P},level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,z,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolgannfan:{linewidth:2,showLabels:!0,fillBackground:!0,
transparency:80,level1:I(1,8,ve,!0),level2:I(1,4,he,!0),level3:I(1,3,me,!0),level4:I(1,2,he,!0),level5:I(1,1,z,!0),level6:I(2,1,D,!0),level7:I(3,1,se,!0),level8:I(4,1,ae,!0),level9:I(8,1,X,!0)},linetoolganncomplex:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,scaleRatio:"",showLabels:!0,labelsStyle:{fontSize:12,bold:!1,italic:!1},levels:[o(Te,!0),o(ve,!0),o(z,!0),o(me,!0),o(he,!0),o(Te,!0)],fanlines:[d(O,!1,2,8,1),d(X,!1,2,5,1),d(Te,!1,2,4,1),d(ve,!1,2,3,1),d(z,!0,2,2,1),d(me,!0,2,1,1),d(he,!0,2,1,2),d(he,!1,2,1,3),d(D,!1,2,1,4),d(F,!1,2,1,5),d(O,!1,2,1,8)],arcs:[d(ve,!0,2,1,0),d(ve,!0,2,1,1),d(ve,!0,2,1.5,0),d(z,!0,2,2,0),d(z,!0,2,2,1),d(me,!0,2,3,0),d(me,!0,2,3,1),d(he,!0,2,4,0),d(he,!0,2,4,1),d(D,!0,2,5,0),d(D,!0,2,5,1)]},linetoolgannfixed:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,levels:[o(Te,!0),o(ve,!0),o(z,!0),o(me,!0),o(he,!0),o(Te,!0)],fanlines:[d(O,!1,2,8,1),d(X,!1,2,5,1),d(Te,!1,2,4,1),d(ve,!1,2,3,1),d(z,!0,2,2,1),d(me,!0,2,1,1),d(he,!0,2,1,2),d(he,!1,2,1,3),d(D,!1,2,1,4),d(F,!1,2,1,5),d(O,!1,2,1,8)],arcs:[d(ve,!0,2,1,0),d(ve,!0,2,1,1),d(ve,!0,2,1.5,0),d(z,!0,2,2,0),d(z,!0,2,2,1),d(me,!0,2,3,0),d(me,!0,2,3,1),d(he,!0,2,4,0),d(he,!0,2,4,1),d(D,!0,2,5,0),d(D,!0,2,5,1)]},linetoolgannsquare:{color:"rgba(21, 56, 153, 0.8)",linewidth:2,linestyle:P,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,reverse:!1,fans:t(Pe,!1),hlevel1:i(0,Te,!0),hlevel2:i(.25,ve,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,he,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Te,!0),vlevel1:i(0,Te,!0),vlevel2:i(.25,ve,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,he,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Te,!0)},linetoolfibspeedresistancefan:{fillBackground:!0,transparency:80,grid:{color:"rgba(21, 56, 153, 0.8)",linewidth:1,linestyle:P,visible:!0},linewidth:2,linestyle:P,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,reverse:!1,hlevel1:i(0,Te,!0),hlevel2:i(.25,ve,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,he,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Te,!0),vlevel1:i(0,Te,!0),vlevel2:i(.25,ve,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,he,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Te,!0)},linetoolfibretracement:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},levelsStyle:{linewidth:2,linestyle:P},level1:i(0,Te,!0,!0),level2:i(.236,X,!0,!0),level3:i(.382,ve,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,he,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Te,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,X,!0,!0),level10:i(3.618,se,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ve,!1,!0),level13:i(1.414,X,!1,!0),
level16:i(2,he,!1,!0),level14:i(2.272,ve,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Te,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,X,!1,!0),level21:i(4.272,se,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ve,!1,!0),level24:i(4.764,he,!1,!0)},linetoolfibchannel:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",coeffsAsPercents:!1,labelFontSize:12,levelsStyle:{linewidth:2,linestyle:P},level1:i(0,Te,!0),level2:i(.236,X,!0),level3:i(.382,ve,!0),level4:i(.5,me,!0),level5:i(.618,he,!0),level6:i(.786,z,!0),level7:i(1,Te,!0),level8:i(1.618,D,!0),level9:i(2.618,X,!0),level10:i(3.618,se,!0),level11:i(4.236,ae,!0),level12:i(1.272,ve,!1),level13:i(1.414,X,!1),level16:i(2,he,!1),level14:i(2.272,ve,!1),level15:i(2.414,me,!1),level17:i(3,z,!1),level18:i(3.272,Te,!1),level19:i(3.414,D,!1),level20:i(4,X,!1),level21:i(4.272,se,!1),level22:i(4.414,ae,!1),level23:i(4.618,ve,!1),level24:i(4.764,he,!1)},linetoolprojection:{showCoeffs:!0,fillBackground:!0,transparency:80,color1:R,color2:ne,linewidth:2,trendline:{visible:!0,color:Pe,linestyle:P},level1:r(1,"#808080",!0)},linetool5pointspattern:{color:D,textcolor:A,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolcypherpattern:{color:D,textcolor:A,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetooltrianglepattern:{color:W,textcolor:A,fillBackground:!0,backgroundColor:W,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolabcd:{color:he,textcolor:A,fontsize:12,bold:!1,italic:!1,linewidth:2},linetoolthreedrivers:{color:W,textcolor:A,fillBackground:!0,backgroundColor:"rgba(149, 40, 204, 0.5)",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolheadandshoulders:{color:he,textcolor:A,fillBackground:!0,backgroundColor:he,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolfibwedge:{showCoeffs:!0,fillBackground:!0,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:2,linestyle:P},level1:r(.236,X,!0),level2:r(.382,ve,!0),level3:r(.5,me,!0),level4:r(.618,he,!0),level5:r(.786,z,!0),level6:r(1,Te,!0),level7:r(1.618,D,!1),level8:r(2.618,X,!1),level9:r(3.618,W,!1),level10:r(4.236,ae,!1),level11:r(4.618,ae,!1)},linetoolfibcircles:{showCoeffs:!0,fillBackground:!0,transparency:80,coeffsAsPercents:!1,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},level1:r(.236,X,!0),level2:r(.382,ve,!0),level3:r(.5,he,!0),level4:r(.618,me,!0),level5:r(.786,z,!0),level6:r(1,Te,!0),level7:r(1.618,D,!0),level8:r(2.618,ae,!0),level9:r(3.618,D,!0),level10:r(4.236,ae,!0),level11:r(4.618,X,!0)},linetoolfibspeedresistancearcs:{showCoeffs:!0,fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},level1:r(.236,X,!0),level2:r(.382,ve,!0),level3:r(.5,he,!0),level4:r(.618,me,!0),level5:r(.786,z,!0),level6:r(1,Te,!0),level7:r(1.618,D,!0),level8:r(2.618,ae,!0),level9:r(3.618,D,!0),level10:r(4.236,ae,!0),
level11:r(4.618,X,!0)},linetooltrendbasedfibextension:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},levelsStyle:{linewidth:2,linestyle:P},level1:i(0,Te,!0,!0),level2:i(.236,X,!0,!0),level3:i(.382,ve,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,he,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Te,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,X,!0,!0),level10:i(3.618,se,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ve,!1,!0),level13:i(1.414,X,!1,!0),level16:i(2,he,!1,!0),level14:i(2.272,ve,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Te,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,X,!1,!0),level21:i(4.272,se,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ve,!1,!0),level24:i(4.764,he,!1,!0)},linetooltrendbasedfibtime:{showCoeffs:!0,fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},level1:r(0,Te,!0),level2:r(.382,X,!0),level3:r(.5,_e,!1),level4:r(.618,me,!0),level5:r(1,he,!0),level6:r(1.382,z,!0),level7:r(1.618,Te,!0),level8:r(2,D,!0),level9:r(2.382,ae,!0),level10:r(2.618,se,!0),level11:r(3,W,!0)},linetoolschiffpitchfork:{fillBackground:!0,transparency:80,style:c.Schiff,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolschiffpitchfork2:{fillBackground:!0,transparency:80,style:c.Schiff2,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolinsidepitchfork:{fillBackground:!0,transparency:80,style:c.Inside,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolregressiontrend:{linewidth:1,linestyle:P,styles:{upLine:{display:p.All,color:E,linestyle:P,linewidth:2},downLine:{display:p.All,color:E,linestyle:P,linewidth:2},baseLine:{display:p.All,color:J,linestyle:T,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}},Re(TradingView.defaultProperties.chartproperties),Oe()}if(void 0===TradingView.defaultProperties["study_MA@tv-basicstudies"]&&(TradingView.defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{display:p.All,color:D,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0,title:"MA"}}}),
void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={fontsize:10,borderColor:D,backColor:k,textColor:Le}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){var Ve=!0;TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:Ve,"S1/R1":Ve,"S2/R2":Ve,"S3/R3":Ve,"S4/R4":Ve,"S5/R5":Ve},colors:{P:Se,"S1/R1":Se,"S2/R2":Se,"S3/R3":Se,"S4/R4":Se,"S5/R5":Se},widths:{P:1,"S1/R1":1,"S2/R2":1,"S3/R3":1,"S4/R4":1,"S5/R5":1}}}}if(void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:D,linewidth:2}),void 0===TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]={styles:{splitByBlocks:!1},graphics:{tpoLevels:{tpo:{tpoPoc:{color:""},tpoPoorHigh:{color:""},tpoPoorLow:{color:""},tpoSingleprints:{color:""},tpoVah:{color:""},tpoVal:{color:""}}}}}),void 0===TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]={styles:{splitByBlocks:!1}}),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t(q,!1),level1:t("#008000",!1),level2:t("#0000ff",!1),level3:t("#ff00ff",!1),level4:t("#0080ff",!0),level5:t(q,!0),level6:t("#008000",!0),level7:t("#0000ff",!0),level8:t("#ff00ff",!0)}),void 0===TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]&&(TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]={styles:{upLine:{display:p.All,color:E,linestyle:P,linewidth:1},downLine:{display:p.All,color:E,linestyle:P,linewidth:1},baseLine:{display:p.All,color:J,linestyle:P,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba(153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_Compare@tv-basicstudies"]&&(TradingView.defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"}),void 0===TradingView.defaultProperties["study_Overlay@tv-basicstudies"]){TradingView.defaultProperties["study_Overlay@tv-basicstudies"]={style:l.STYLE_LINE,allowExtendTimeScale:!1,showPriceLine:!1,minTick:"default",candleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",wickUpColor:"#737375",wickDownColor:"#737375",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",wickUpColor:"#737375",wickDownColor:"#737375",barColorsOnPrevClose:!1},barStyle:{upColor:"#6ba583",downColor:"#d75442",barColorsOnPrevClose:!1,dontDrawOpen:!1,
thinBars:!0},lineStyle:{color:be,linestyle:P,linewidth:2,priceSource:"close"},lineWithMarkersStyle:{color:be,linestyle:P,linewidth:2,priceSource:"close"},steplineStyle:{color:be,linestyle:P,linewidth:2,priceSource:"close"},areaStyle:{color1:D,color2:D,linecolor:D,linestyle:P,linewidth:2,priceSource:"close",transparency:95},baselineStyle:{baselineColor:xe,topFillColor1:Ee,topFillColor2:Ee,bottomFillColor1:Z,bottomFillColor2:Z,topLineColor:De,bottomLineColor:Y,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},hiloStyle:{color:D,showBorders:!0,borderColor:D,showLabels:!0,labelColor:D,drawBody:!0},columnStyle:{upColor:n(he,50),downColor:n(X,50),barColorsOnPrevClose:!0,priceSource:"close"},hlcAreaStyle:{highLineColor:he,highLineStyle:P,highLineWidth:2,lowLineColor:X,lowLineStyle:P,lowLineWidth:2,closeLineColor:xe,closeLineStyle:P,closeLineWidth:2,highCloseFillColor:de,closeLowFillColor:Q},styles:{open:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0},high:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0},low:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0},close:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0}}}}for(var Be=e.split("."),Ne=TradingView.defaultProperties,Fe=0;Fe1?h(e[r],t.slice(1),i):(e[r]&&e[r].setValue?e[r].setValue(i):e[r]=i,!0))}function d(e){i||I.logWarn("Path `"+e+"` does not exist.")}}function Re(e,t,i,s){window.__defaultsOverrides&&Be(e,t,i,window.__defaultsOverrides,s)}function Ne(e,t){window.__settingsOverrides&&Be(e,null,!1,window.__settingsOverrides,t)}function Oe(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach((function(t){e.test(t)&&Re(TradingView.defaultProperties[t],null,!1,t)}))}function Fe(e,t){return t?function(e,t){var i=Ve(e);if(!window._UNIT_TESTS){var s=TradingView.clone(TVSettings.getJSON(e,null));if(function(e){var t=new Set(["linetoolregressiontrend"]);return e.startsWith("study_")||t.has(e)}(e)&&s&&function(e){if(!e)return!1;e=e.toString();var t=new RegExp("\\d+").exec(e);return null!==t&&t[0]===e}(s.version)){var r=s.inputs,n=t.updateStudyInputs(s.id,s.version,"last",r,null);s.inputs=n,s=t.updateStudyState(s,s)}TradingView.merge(i,s),Ne(i,e)}return i}(e,t):function(e){var t=Ve(e);if(!window._UNIT_TESTS){var i=TradingView.clone(TVSettings.getJSON(e,null));if(i){TradingView.merge(t,i);const s=e.split(".");Ne(t,void 0===s[1]?e:s[1])}}return t}(e)}Fe.create=function(e,t){if(t){var i=Ve(e);TradingView.defaultProperties[e]=TradingView.merge(t,i)}},Fe.remove=function(e){TradingView.defaultProperties[e]=void 0},
TradingView.saveDefaults=function(e,t){void 0===t?TVSettings.remove(e):TVSettings.setJSON(e,t)},TradingView.factoryDefaults=Ve,window.applyDefaultOverridesToLinetools=Oe,window.applyDefaultsOverrides=Re,window.applyPropertiesOverrides=Be,window.defaults=Fe,t.applyDefaultOverridesToLinetools=Oe,t.applyDefaultsOverrides=Re,t.applyPropertiesOverrides=Be,t.defaults=Fe,t.factoryDefaults=Ve,t.saveDefaults=TradingView.saveDefaults,t.createDefaults=Fe.create,t.removeDefaults=Fe.remove},928:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DrawingSyncMode:()=>s,SelectPointMode:()=>r,activePointSelectionMode:()=>$,barTimesUnderCursor:()=>Y,beenSetLineToolLastPoint:()=>V,cancelLineTool:()=>ee,cancelledLineTool:()=>E,changeLineStyle:()=>he,changeLineTool:()=>oe,changedLineStyle:()=>U,changedLineTool:()=>F,continueLineTool:()=>Q,continuedLineTool:()=>D,copiedLineTool:()=>j,copyLineTool:()=>de,createLineTool:()=>J,createdLineTool:()=>k,crosshairLock:()=>b,cursorTool:()=>T,drawOnAllCharts:()=>Ce,drawOnAllChartsMode:()=>Pe,emojiTool:()=>P,finishChangingLineTool:()=>ae,finishLineTool:()=>ce,finishMovingLineTool:()=>re,finishedChangingLineTool:()=>W,finishedLineTool:()=>z,finishedMovingLineTool:()=>N,hideAllDrawings:()=>ye,hideAllIndicators:()=>Se,hideMarksOnBars:()=>we,iconTool:()=>C,init:()=>ge,isDirectionalMovementActive:()=>L,isStudyEditingNow:()=>K,isToolCreatingNow:()=>I,isToolEditingNow:()=>M,isToolMovingNow:()=>A,lockDrawings:()=>be,moveLineTool:()=>se,movedLineTool:()=>R,properties:()=>ve,removeLineTool:()=>le,removedLineTool:()=>H,resetToCursor:()=>m,restoreLineTool:()=>ue,restoreLineToolState:()=>pe,restoredLineTool:()=>G,restoredLineToolState:()=>q,runOnDrawingStateReady:()=>fe,setLineToolLastPoint:()=>te,startChangingLineTool:()=>ne,startMovingLineTool:()=>ie,startedChangingLineTool:()=>O,startedMovingLineTool:()=>B,stickerTool:()=>x,tool:()=>w,toolIsCursor:()=>p,toolIsMeasure:()=>_});var s,r,n=i(50151),o=i(17625),a=i(55917),l=i(64147),c=i(91676),h=i(52033),d=i(56840),u=i(76422);function p(e){return"cursor"===e||"arrow"===e||"dot"===e||"performance"===e}function _(e){return"measure"===e}function m(e=!1){if(!e&&g){if(g.childs().stayInDrawingMode.value())return}w.setValue(T.value())}!function(e){e[e.Layout=1]="Layout",e[e.Global=2]="Global"}(s||(s={})),function(e){e[e.None=0]="None",e[e.Replay=1]="Replay",e[e.Study=2]="Study"}(r||(r={}));let g=null,f=null,v=null,y=null,S=null;const b=new c.WatchedObject(null),w=new l.WatchedValue,C=new l.WatchedValue,P=new l.WatchedValue,x=new l.WatchedValue,T=new l.WatchedValue,I=new l.WatchedValue(!1),M=new l.WatchedValue(!1),A=new l.WatchedValue(!1),L=new l.WatchedValue(!1),k=new h.Delegate,D=new h.Delegate,E=new h.Delegate,V=new h.Delegate,B=new h.Delegate,R=new h.Delegate,N=new h.Delegate,O=new h.Delegate,F=new h.Delegate,W=new h.Delegate,H=new h.Delegate,z=new h.Delegate,U=new h.Delegate,j=new h.Delegate,G=new h.Delegate,q=new h.Delegate,$=new l.WatchedValue(r.None),K=new l.WatchedValue(!1),Y=new Map;function Z(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}
const X={value:!1},J=Z(k,X),Q=Z(D,X),ee=Z(E,X),te=Z(V,X),ie=Z(B),se=Z(R),re=Z(N),ne=Z(O),oe=Z(F),ae=Z(W),le=Z(H),ce=Z(z),he=Z(U,X),de=Z(j,X),ue=Z(G),pe=Z(q);let _e=!1,me=[];function ge(){_e||(w.setValue(d.getValue("chart.cursorPreference","cursor")),w.subscribe((e=>p(e)&&T.setValue(e)),{callWithLast:!0}),T.subscribe((e=>{e&&"performance"!==e&&d.setValue("chart.cursorPreference",e)})),g=new a.DefaultProperty({defaultName:"drawings"}),f=(0,o.createPrimitiveProperty)(),v=(0,o.createPrimitiveProperty)(),y=(0,o.createPrimitiveProperty)(),S=(0,o.createPrimitiveProperty)(),f.setValue(!1),v.setValue(!1),y.setValue(!1),S.setValue(!d.getBool("BarsMarksContainer.visibile",!0)),w.subscribe((e=>{(0,u.emit)("onSelectedLineToolChanged")})),_e=!0,me.forEach((e=>e())),me=[])}function fe(e){_e?e():me.push(e)}function ve(){return(0,n.ensureNotNull)(g)}function ye(){return(0,n.ensureNotNull)(f)}function Se(){return(0,n.ensureNotNull)(v)}function be(){return(0,n.ensureNotNull)(y)}function we(){return(0,n.ensureNotNull)(S)}function Ce(){return ve().childs().drawOnAllCharts}function Pe(){return ve().childs().drawOnAllChartsMode}},28331:(e,t,i)=>{"use strict";i.d(t,{EnvironmentState:()=>r});var s=i(49483);class r{constructor(e,t=!1){this._shift=!1,this._mod=!1,this._alt=!1,void 0!==e&&(this._shift=Boolean(e.shiftKey),this._mod=Boolean((0,s.isMac)()?e.metaKey:e.ctrlKey),this._alt=Boolean(e.altKey)),this._isApiEvent=t}shift(){return this._shift}mod(){return this._mod}alt(){return this._alt}shiftOnly(){return this._shift&&!this._mod&&!this._alt}modOnly(){return this._mod&&!this._shift&&!this._alt}altOnly(){return this._alt&&!this._shift&&!this._mod}modShift(){return this._shift&&this._mod&&!this._alt}isApiEvent(){return this._isApiEvent}static create(e=!1,t=!1,i=!1){return new r({shiftKey:e,ctrlKey:t,metaKey:t,altKey:i})}}},73698:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEFAULT_ADJUSTMENT:()=>r,DEFAULT_SESSION:()=>s,DEFAULT_SETTLEMENT_AS_CLOSE:()=>n,compareSymbols:()=>m,decodeExtendedSymbol:()=>u,encodeExtendedSymbolOrGetSimpleSymbolString:()=>h,isEncodedExtendedSymbol:()=>d,isReplaySymbol:()=>c,isStudySymbol:()=>l,unwrapSimpleSymbol:()=>p});const s="regular",r="splits",n=!0;function o(e){return"="+JSON.stringify(a(e))}function a(e){return Object.keys(e).sort().reduce(((t,i)=>("[object Object]"===Object.prototype.toString.call(e[i])?t[i]=a(e[i]):t[i]=e[i],t)),{})}function l(e){return Boolean(e.inputs)}function c(e){return Boolean(e.replay)}function h(e){return o(e)}function d(e){return"="===e[0]}function u(e){if(!d(e))return{symbol:e};try{return JSON.parse(e.slice(1))}catch(t){return{symbol:e}}}function p(e){return"string"==typeof e?e:p(e.symbol)}const _=["symbol","session","unit-id","currency-id","adjustment","backadjustment","settlement-as-close"];function m(e,t){return _.every((i=>e[i]===t[i]))}},24526:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null,studyFormatterFactory:null}},47462:(e,t,i)=>{"use strict";i.d(t,{availableDateFormats:()=>f,
dateFormatFunctions:()=>m,defaultDateFormat:()=>v,getDateFormatWithWeekday:()=>g});var s=i(11542),r=i(28865),n=i(58683);const o={1:()=>s.t(null,void 0,i(62310)),2:()=>s.t(null,void 0,i(2507)),3:()=>s.t(null,void 0,i(92767)),4:()=>s.t(null,void 0,i(27072)),5:()=>s.t(null,{context:"short"},i(13132)),6:()=>s.t(null,void 0,i(429)),7:()=>s.t(null,void 0,i(53786)),8:()=>s.t(null,void 0,i(46450)),9:()=>s.t(null,void 0,i(6816)),10:()=>s.t(null,void 0,i(12179)),11:()=>s.t(null,void 0,i(26899)),12:()=>s.t(null,void 0,i(32084))},a=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,l=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),c=e=>e.toLocaleDateString(window.language?(0,r.getIsoLanguageCodeFromLanguage)(window.language):void 0,{weekday:"short",timeZone:"UTC"}),h=(e,t)=>(0,n.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),d=(e,t)=>o[a(e,t)](),u=(e,t)=>(0,n.numberToStringWithLeadingZero)(a(e,t),2),p=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t)%100,2),_=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t),4),m={"dd MMM 'yy":(e,t)=>`${h(e,t)} ${d(e,t)} '${p(e,t)}`,"MMM 'yy":(e,t)=>`${d(e,t)} '${p(e,t)}`,"MMM dd, yyyy":(e,t)=>`${d(e,t)} ${h(e,t)}, ${_(e,t)}`,"MMM yyyy":(e,t)=>`${d(e,t)} ${_(e,t)}`,"MMM dd":(e,t)=>`${d(e,t)} ${h(e,t)}`,"dd MMM":(e,t)=>`${h(e,t)} ${d(e,t)}`,"yyyy-MM-dd":(e,t)=>`${_(e,t)}-${u(e,t)}-${h(e,t)}`,"yy-MM-dd":(e,t)=>`${p(e,t)}-${u(e,t)}-${h(e,t)}`,"yy/MM/dd":(e,t)=>`${p(e,t)}/${u(e,t)}/${h(e,t)}`,"yyyy/MM/dd":(e,t)=>`${_(e,t)}/${u(e,t)}/${h(e,t)}`,"dd-MM-yyyy":(e,t)=>`${h(e,t)}-${u(e,t)}-${_(e,t)}`,"dd-MM-yy":(e,t)=>`${h(e,t)}-${u(e,t)}-${p(e,t)}`,"dd/MM/yy":(e,t)=>`${h(e,t)}/${u(e,t)}/${p(e,t)}`,"dd/MM/yyyy":(e,t)=>`${h(e,t)}/${u(e,t)}/${_(e,t)}`,"MM/dd/yy":(e,t)=>`${u(e,t)}/${h(e,t)}/${p(e,t)}`,"MM/dd/yyyy":(e,t)=>`${u(e,t)}/${h(e,t)}/${_(e,t)}`};function g(e){return"ja"===window.language?(t,i)=>`${m[e](t,i)} (${c(t)})`:(t,i)=>`${c(t)} ${m[e](t,i)}`}const f=Object.keys(m),v=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},82826:(e,t,i)=>{"use strict";i.d(t,{DateFormatter:()=>n});var s=i(24526),r=i(47462);class n{constructor(e="yyyy-MM-dd",t=!1){this._dateFormatFunc=t?(0,r.getDateFormatWithWeekday)(e):r.dateFormatFunctions[e]}format(e){return s.customFormatters&&s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!1)}formatLocal(e){return s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.formatLocal?s.customFormatters.dateFormatter.formatLocal(e):s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!0)}parse(e){if(""===e)return{res:!1};let t=e;return s.customFormatters&&s.customFormatters.dateFormatter&&!s.customFormatters.dateFormatter.parse&&console.warn("You need to provide a `parse` function as part of `dateFormatter`"),s.customFormatters&&s.customFormatters.dateFormatter&&s.customFormatters.dateFormatter.parse&&(t=String(s.customFormatters.dateFormatter.parse(e))),{res:!0,value:t}}}},52388:(e,t,i)=>{"use strict";i.d(t,{DateTimeFormatter:()=>o})
;var s=i(15344),r=i(82826);const n={dateFormat:"yyyy-MM-dd",withWeekday:!1,timeFormat:s.hourMinuteSecondFormat,dateTimeSeparator:" "};class o{constructor(e={}){const t=Object.assign({},n,e);this._dateFormatter=new r.DateFormatter(t.dateFormat,t.withWeekday),this._timeFormatter=new s.TimeFormatter(t.timeFormat),this._separator=t.dateTimeSeparator}format(e){return`${this._dateFormatter.format(e)}${this._separator}${this._timeFormatter.format(e)}`}formatLocal(e){return`${this._dateFormatter.formatLocal(e)}${this._separator}${this._timeFormatter.formatLocal(e)}`}}},58683:(e,t,i)=>{"use strict";i.d(t,{numDependencyFormatter:()=>n,numberToStringWithLeadingZero:()=>r});var s=i(37265);function r(e,t){if(!(0,s.isNumber)(e))return"n/a";if(!(0,s.isInteger)(t))throw new TypeError("invalid length");if(t<0||t>24)throw new TypeError("invalid length");if(0===t)return e.toString();return("0000000000000000"+e.toString()).slice(-t)}function n(e){const t=new Map;return i=>{const s=null!=i?i:-1;let r=t.get(s);return r||(r=e(i),t.set(s,r)),r}}},73866:(e,t,i)=>{"use strict";i.d(t,{LimitedPrecisionNumericFormatter:()=>n});var s,r=i(59623);!function(e){e[e.DefaultPrecision=1]="DefaultPrecision"}(s||(s={}));class n{constructor(e,t){this._precision=null!=e?e:1,this._numericFormatter=new r.NumericFormatter({precision:this._precision,ignoreLocaleNumberFormat:t})}format(e,t){const i=e.toFixed(this._precision),s=Math.pow(10,-this._precision);return this._numericFormatter.format(Math.max(parseFloat(i),s),t)}parse(e,t){const i=this._numericFormatter.parse(e,t);return i.res?{res:!0,value:i.value,suggest:this.format(i.value)}:i}}},53085:(e,t,i)=>{"use strict";i.d(t,{formatNumber:()=>r,parseNumber:()=>o});var s=i(60521);function r(e,t,i,r,n){if(!Number.isFinite(e))return`${e}`;const o=-1===Math.sign(e)?"-":"";e=Math.abs(e);let a=void 0===i?e.toString():e.toFixed(i);if(a.includes("e")){if(!r)return`${o}${a.replace(".",t.decimalSign)}`;{const t=new s.Big(e);a=t.lt(1)?t.toFixed():t.toString()}}const l=a.split("."),c=l[0];let h=l[1];const d=function(e,t){let i=e.length;const s=[];for(;i>0;)s.unshift(e.slice(Math.max(i-3,0),i)),i-=3;return s.join(t)}(c,t.groupingSeparator);return void 0!==i&&(h=0===i?void 0:e.toFixed(i).slice(-i)),void 0!==n&&void 0!==h&&(h=function(e,t){let i=e.length-1;for(let s=i;s>=t&&"0"===e[s];s-=1)i-=1;return e.slice(0,i+1)}(h,n)),h?`${o}${d}${t.decimalSign}${h}`:`${o}${d}`}const n=(0,i(48874).default)((e=>{const t=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return new RegExp(t,"gm")}));function o(e,t){if(/^(NaN|[+|-]?Infinity)$/.test(e))return parseFloat(e);const i=n(t.groupingSeparator);return i&&(e=e.replace(i,"")),e=e.replace(t.decimalSign,"."),/^(\+|-)?\d+(\.\d+|\.)?(e(\+|-)?\d+)?$/.test(e)?parseFloat(e):NaN}},11345:(e,t,i)=>{"use strict";let s;i.d(t,{formatterOptions:()=>r,formatterOptionsLibraryOverrides:()=>n,getNumberFormat:()=>d});const r={decimalSign:".",decimalSignFractional:"'"},n={};const o={groupingSeparator:",",decimalSign:"."},a={groupingSeparator:".",decimalSign:","},l={groupingSeparator:" ",decimalSign:","},c={
groupingSeparator:"",decimalSign:"."},h=new Map([["en",o],["th",o],["ja",o],["ko",o],["zh",o],["zh_TW",o],["ar",o],["he_IL",o],["ms_MY",o],["de",a],["es",a],["it",a],["tr",a],["pt",a],["id_ID",a],["vi",a],["fr",l],["pl",l],["ru",l]]);function d(e){var t;return{...null!==(t=h.get(s||window.language||""))&&void 0!==t?t:c,...n}}},59623:(e,t,i)=>{"use strict";i.d(t,{NumericFormatter:()=>n});var s=i(53085),r=i(11345);class n{constructor(e={}){this._options=e}format(e,t){if(!Number.isFinite(e))return String(e);const{ignoreLocaleNumberFormat:i,precision:o,minPrecision:a}=this._options,l=(0,r.getNumberFormat)(i||(null==t?void 0:t.ignoreLocaleNumberFormat));return void 0===o?n._formatNoEImpl(e,l,o,a):(0,s.formatNumber)(e,l,o,void 0,a)}parse(e,t){const{ignoreLocaleNumberFormat:i,precision:n}=this._options,o=(0,r.getNumberFormat)(i||(null==t?void 0:t.ignoreLocaleNumberFormat));let a=(0,s.parseNumber)(e,o);return Number.isFinite(a)?(n&&(a=+a.toFixed(n)),{res:!0,value:a}):{res:!1}}static formatNoE(e,t){return this._formatNoEImpl(e,t)}static _formatNoEImpl(e,t,i,r){return Number.isFinite(e)?(t=null!=t?t:{groupingSeparator:"",decimalSign:"."},(0,s.formatNumber)(e,t,i,!0,r)):String(e)}}},719:(e,t,i)=>{"use strict";i.d(t,{PercentageFormatter:()=>n});var s=i(725),r=i(63273);class n extends s.PriceFormatter{constructor(e={}){void 0!==e.decimalPlaces&&(e.priceScale=Math.pow(10,e.decimalPlaces)),super(e),this.type="percentage"}state(){return{...super.state(),percent:!0}}parse(e,t){return e=e.replace("%",""),super.parse(e,t)}format(e,t={}){const{useRtlFormat:i=!0}=t,s=super.format(e,{...t,useRtlFormat:!1})+"%";return i?(0,r.forceLTRStr)(s):s}static serialize(e){return e.state()}static deserialize(e){return new n(e)}}},725:(e,t,i)=>{"use strict";i.d(t,{PriceFormatter:()=>x});var s=i(60521),r=i(31955),n=i(50151),o=i(11542),a=i(50335),l=i(37265);function c(e){return e?(0,s.Big)(e.minMove).div(e.priceScale).toNumber():NaN}function h(e){const{minTick:t,price:i,variableMinTickData:s,shouldCheckForEquality:r}=e,n=(0,a.isNumber)(t)?d(t):t;return void 0===s?n:function(e,t,i=!1){for(let s=0;s(0,l.isEven)(t)?function(e){const t=Number(e);if(Number.isFinite(t))return d(t);{const t=e.split("/");if(t.length<2||t.length>3)throw new Error(`Unexpected mintick: ${e}`);const i=Number(t[1]),s=Number(t[0]);if(!Number.isFinite(i)||!Number.isFinite(s))throw new Error(`Unexpected mintick: ${e}`);const r=3===t.length?Number(t[2]):void 0;if(void 0!==r&&!Number.isFinite(r))throw new Error(`Unexpected mintick: ${e}`);const n={priceScale:i,minMove:s};return void 0!==r&&(n.minMove2=r),n}}(e):function(e){const t=Number(e)
;if(Number.isNaN(t))throw new Error(`Unexpected price limit: ${e}`);return t}(e)));if((0,l.isEven)(e.length))throw new Error("Theme must not be event number of elements");const a=[];for(let t=0;t0&&t>0){let t=e;for(i&&s&&(t/=s);t>1;)t/=10,r++}return r}function g(e,t,i){const s=(0,n.ensureNotNull)(h({price:i,minTick:null,variableMinTickData:t,shouldCheckForEquality:!0})),{priceScale:r,minMove:o,minMove2:a}=s;return{priceScale:r,minMove:o,fractionalLength:m(r,o,e,a)}}class f{constructor(e){this._formatterErrors={custom:o.t(null,void 0,i(66123)),fraction:o.t(null,void 0,i(39643)),secondFraction:o.t(null,void 0,i(70784))};const{priceScale:t,minMove:s,minMove2:r,ignoreMinMove:n,variableMinTick:a,fractionalLength:l}=e;this._priceScale=t,this._minMove=s,this._minMove2=r,this._ignoreMinMove=n,this._variableMinTickData=void 0===a?void 0:u({priceScale:t,minMove:s,minMove2:r},a),this._fractionalLength=l}formatImpl(e,t={}){const{signPositive:i,signNegative:s=!0,tailSize:r,cutFractionalByPrecision:n=!1,useRtlFormat:o=!0,variableMinTickDataPrice:a,ignoreLocaleNumberFormat:l,removeAllEndingZeros:c}=t;let h="";e<0?h=!1===s?"":"−":e&&!0===i&&(h="+");const d=h+this._formatUnsigned(Math.abs(e),r,n,a,l,c);return o?(0,p.forceLTRStr)(d):d}parse(e,t){return"+"===(e=(e=(0,p.stripLTRMarks)(e)).replace("−","-"))[0]&&(e=e.substring(1)),this._parseUnsigned(e,t)}_removeEndingZeros(e,t){for(let i=0;i=1e21)return t.toString().replace(".",h.decimalSign);if(i>1e15)return this._formatAsExponential(t,h);const d=Math.pow(10,o)*i/(a?1:r),u=1/d;let p;if(d>1)p=Math.floor(t);else{const e=Math.floor(Math.round(t/u)*u);p=0===Math.round((t-e)/u)?e:e+u}let _="";if(d>1){let e=a?new s.Big(t).mul(d).round(void 0,0).minus(new s.Big(p).mul(d)).toNumber():parseFloat((Math.round(t*d)-p*d).toFixed(n));e>=d&&(e-=d,p+=1),e=a?new s.Big(e).round(n,0).toNumber():parseFloat(e.toFixed(n))*r;const i=(0,y.numberToStringWithLeadingZero)(e,n+o),l=this._removeEndingZeros(i,c?i.length:o);_=l?h.decimalSign+l:l}return(0,v.formatNumber)(p,h)+_}_parseAsDecimal(e,t={}){const{ignoreLocaleNumberFormat:i}=t,s=(0,S.getNumberFormat)(this._ignoreLocaleNumberFormat||i),r=(0,v.parseNumber)(e,s);return Number.isFinite(r)?{value:r,res:!0,suggest:this.formatImpl(r)}:{error:this._formatterErrors.custom,res:!1}}}const C=(0,r.getLogger)("Chart.FractionalPriceFormatter");class P extends f{constructor(e){super(e);const{minMove2:t}=e;null!=t&&t>0&&2!==t&&4!==t&&8!==t&&C.logDebug("invalid minmove2")}hasForexAdditionalPrecision(){return!1}_parseUnsigned(e){return this._minMove2?this._parseAsDoubleFractional(e):this._parseAsSingleFractional(e)}_formatUnsigned(e,t,i,s){const r={price:Math.abs(e),priceScale:this._priceScale,minMove:this._minMove,minMove2:this._minMove2,fractionalLength:(0,n.ensureDefined)(this._fractionalLength),tailSize:t};return void 0!==this._variableMinTickData&&Object.assign(r,g(!0,this._variableMinTickData,null!=s?s:r.price)),this._formatAsFractional(r)}_parseAsSingleFractional(e){let t=_.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+S.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=this._priceScale,r=this._patchFractPart(parseInt(t[3]),1,s);if(r>=s||r<0)return{error:this._formatterErrors.fraction,res:!1};let n=i+r/s;return e&&(n=-n),{value:n,res:!0,suggest:this.formatImpl(n)}}return{error:this._formatterErrors.custom,res:!1}}_parseAsDoubleFractional(e){let t=_.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+S.formatterOptions.decimalSignFractional+"([0-9]+)\\"+S.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=void 0!==this._minMove2&&null!==this._minMove2?this._minMove2:NaN,r=this._priceScale/s,n=this._minMove2,o=this._patchFractPart(parseInt(t[3]),1,r),a=this._patchFractPart(parseInt(t[4]),2,n);if(o>=r||o<0)return{error:this._formatterErrors.fraction,res:!1};if(null!=n&&a>=n||a<0)return{error:this._formatterErrors.secondFraction,res:!1};let l=null!=n?i+o/r+a/(r*n):NaN;return e&&(l=-l),{value:l,res:!0,suggest:this.formatImpl(l)}}return{error:this._formatterErrors.custom,res:!1}}
_patchFractPart(e,t,i){const s={0:0,5:1},r={0:0,2:1,5:2,7:3},n={0:0,1:1,2:2,3:3,5:4,6:5,7:6,8:7};return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===r[e]?-1:r[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}_formatAsFractional(e){const{price:t,tailSize:i,priceScale:s,minMove:r,minMove2:n,fractionalLength:o}=e,a=s/r;let l=Math.floor(t),c=i?Math.floor(t*a)-l*a:Math.round(t*a)-l*a;c===a&&(c=0,l+=1);let h="";if(i){let e=(t-l-c/a)*a;e=Math.round(e*Math.pow(10,i)),h=(0,y.numberToStringWithLeadingZero)(e,i),h=this._removeEndingZeros(h,i)}if(!o)throw new Error("_fractionalLength is not calculated");let d="";if(n){const e=c%n;c=(c-e)/n;const t=(0,y.numberToStringWithLeadingZero)(c,o),i=this._getFractPart(e,2,n);d=t+S.formatterOptions.decimalSignFractional+i}else c=this._getFractPart(c,1,s),d=(0,y.numberToStringWithLeadingZero)(c*r,o);return l.toString()+S.formatterOptions.decimalSignFractional+d+h}_getFractPart(e,t,i){const s=[0,5],r=[0,2,5,7],n=[0,1,2,3,5,6,7,8];return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===r[e]?-1:r[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}}class x{constructor(e={}){this.type="price";const{minMove2:t,fractional:i,variableMinTick:s,ignoreMinMove:r,ignoreLocaleNumberFormat:n}=e,o=!e.minMove||r?1:e.minMove,a=(0,l.isNumber)(e.priceScale)&&(0,l.isInteger)(e.priceScale)?e.priceScale:100,c=m(a,o,i,t),h={...e,minMove:o,priceScale:a,fractionalLength:c};if(a<0)throw new TypeError("invalid base");this._priceScale=a,this._minMove=o,this._minMove2=t,this._fractional=i,this._variableMinTick=s,this._ignoreMinMove=r,this._fractionalLength=c,this._ignoreLocaleNumberFormat=n,this._implementation=i?new P(h):new w(h)}isFractional(){return!!this._fractional}state(){return{minMove:this._minMove,minMove2:this._minMove2,priceScale:this._priceScale,variableMinTick:this._variableMinTick,ignoreMinMove:this._ignoreMinMove,fractional:this._fractional}}formatChange(e,t,i){return this._implementation.formatImpl(e-t,{...i,variableMinTickDataPrice:Math.min(Math.abs(e),Math.abs(t))})}format(e,t){return this._implementation.formatImpl(e,t)}parse(e,t){return this._implementation.parse(e,t)}hasForexAdditionalPrecision(){return this._implementation.hasForexAdditionalPrecision()}static serialize(e){return e.state()}static deserialize(e){return new x(e)}}},15344:(e,t,i)=>{"use strict";i.d(t,{TimeFormatter:()=>p,hourMinuteFormat:()=>l,hourMinuteNonZeroSecondFormat:()=>o,hourMinuteSecondFormat:()=>n,hourMinuteSecondMillisecFormat:()=>a,twelveHourMinuteFormat:()=>d,twelveHourMinuteNonZeroSecondFormat:()=>h,twelveHourMinuteSecondFormat:()=>c});var s=i(24526),r=i(58683);const n="%h:%m:%s",o="%h:%m:%s+",a="%h:%m:%s.%ss+",l="%h:%m",c="%h:%m:%s %ampm",h="%h:%m:%s+ %ampm",d="%h:%m %ampm";var u;!function(e){e.TwentyFourHours="24-hours",e.TwelveHours="12-hours"}(u||(u={}));class p{constructor(e){this._isTwelveHoursFormat=!1,this._valuesAndDelimeters=[];const t=e||n,i=new RegExp("%h|%m|%s\\+|%ss\\+|%ss|%ampm|%s","g");let s=i.exec(t),r=0;for(;null!==s;){const e=s[0];"%ampm"===e&&(this._isTwelveHoursFormat=!0);const n=t.substring(r,s.index)
;""!==n&&this._valuesAndDelimeters.push(n),this._valuesAndDelimeters.push(e),r=s.index+e.length,s=i.exec(t)}}format(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.format(e):this._formatTime(e,!1)}formatLocal(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.formatLocal?s.customFormatters.timeFormatter.formatLocal(e):s.customFormatters.timeFormatter.format(e):this._formatTime(e,!0)}_formatTime(e,t){let i=t?e.getHours():e.getUTCHours();const s=t?e.getMinutes():e.getUTCMinutes(),n=t?e.getSeconds():e.getUTCSeconds(),o=t?e.getMilliseconds():e.getUTCMilliseconds();let a="";this._isTwelveHoursFormat&&(a=i>=12?"PM":"AM",i%=12,i=i||12);let l="",c=!1;for(let e=this._valuesAndDelimeters.length-1;e>=0;e--){const t=this._valuesAndDelimeters[e];let h;switch(t){case"%h":h=(0,r.numberToStringWithLeadingZero)(i,2);break;case"%m":h=(0,r.numberToStringWithLeadingZero)(s,2);break;case"%s+":0!==n?h=(0,r.numberToStringWithLeadingZero)(n,2):(h="",c=!0);break;case"%s":h=(0,r.numberToStringWithLeadingZero)(n,2);break;case"%ss":h=(0,r.numberToStringWithLeadingZero)(o,3);break;case"%ss+":0!==o?h=(0,r.numberToStringWithLeadingZero)(o,3):(h="",c=!0);break;case"%ampm":h=a;break;default:if(c){c=!1;continue}h=t}l=h+l}return l}}},92953:(e,t,i)=>{"use strict";i.d(t,{TimeSpanFormatter:()=>o});var s=i(11542),r=i(53085),n=i(11345);class o{format(e,t){const o=e<0;e=Math.abs(e);const a=Math.floor(e/86400);e-=86400*a;const l=Math.floor(e/3600);e-=3600*l;const c=Math.floor(e/60);e-=60*c;let h="";if(a){const e=(0,n.getNumberFormat)(null==t?void 0:t.ignoreLocaleNumberFormat);h+=(0,r.formatNumber)(a,e)+s.t(null,{context:"dates"},i(85886))+" "}return l&&(h+=l+s.t(null,{context:"dates"},i(44634))+" "),c&&(h+=c+s.t(null,{context:"dates"},i(5977))+" "),e&&(h+=e+s.t(null,{context:"dates"},i(21492))+" "),o&&(h="-"+h),h.trim()}}},46084:(e,t,i)=>{"use strict";i.d(t,{VolumeFormatter:()=>o});var s=i(11542),r=i(59623),n=i(37265);class o{constructor(e={}){this.type="volume";const{precision:t,minPrecision:i,dimensionPrecision:s,dimensionMinPrecision:n,ignoreLocaleNumberFormat:o,removeSpaceBeforeDimension:a}=e;this._precision=null!=t?t:0,this._formatter=new r.NumericFormatter({ignoreLocaleNumberFormat:o,precision:this._precision,minPrecision:null!=i?i:0}),this._dimensionPrecision=null!=s?s:3,this._dimensionFormatter=new r.NumericFormatter({ignoreLocaleNumberFormat:o,precision:this._dimensionPrecision,minPrecision:null!=n?n:0}),this._fractionalValues=void 0!==t&&t>0,this._spaceBeforeDimension=a?"":" ",this._options=e}state(){const{ignoreLocaleNumberFormat:e,...t}=this._options;return t}format(e,t){if(!(0,n.isNumber)(e))return"---";if(Math.abs(e)>=1e100)return s.t(null,void 0,i(96935));const r=Math.abs(e);let o="";(e=r<1e3?+e.toFixed(this._precision):r<1e6?1e3*+(e/1e3).toFixed(this._dimensionPrecision):r<1e9?1e6*+(e/1e6).toFixed(this._dimensionPrecision):r<1e12?1e9*+(e/1e9).toFixed(this._dimensionPrecision):1e12*+(e/1e12).toFixed(this._dimensionPrecision))<0?o="−":e>0&&(null==t?void 0:t.signPositive)&&(o="+"),
e=Math.abs(e);const a=!!(null==t?void 0:t.ignoreLocaleNumberFormat);let l,c;return e<1e3?l=this._formatNumber(e,a,this._formatter):e<1e6?(l=this._formatNumber(e/1e3,a,this._dimensionFormatter),c="K"):e<1e9?(l=this._formatNumber(e/1e6,a,this._dimensionFormatter),c="M"):e<1e12?(l=this._formatNumber(e/1e9,a,this._dimensionFormatter),c="B"):(l=this._formatNumber(e/1e12,a,this._dimensionFormatter),c="T"),c?`${o}${l}${this._spaceBeforeDimension}${c}`:`${o}${l}`}parse(e,t){if("---"===e)return{error:"not a number",res:!1,value:NaN};const i={K:1e3,M:1e6,B:1e9,T:1e12},s=(e=e.replace("−","-")).slice(-1);if(i.hasOwnProperty(s)){const r=this._formatter.parse(e.slice(0,-1).trim(),t),o=r.res?r.value:NaN;return(0,n.isNumber)(o)?{res:!0,value:o*i[s]}:{error:"not a number",res:!1,value:NaN}}{const i=this._formatter.parse(e.trim(),t),s=i.res?i.value:NaN;return(0,n.isNumber)(s)?{res:!0,value:s}:{error:"not a number",res:!1,value:NaN}}}static serialize(e){return e.state()}static deserialize(e){return new o(e)}_formatNumber(e,t,i){if(this._fractionalValues&&0!==e){const t=14-Math.ceil(Math.log10(e)),i=Math.pow(10,t);e=Math.round(e*i)/i}return i.format(e,{ignoreLocaleNumberFormat:t})}}},41991:(e,t,i)=>{"use strict";i.d(t,{getPriceValueFormatterForSource:()=>l,getPriceValueFormatterForStudy:()=>c,shouldBeFormattedAsIndexedTo100:()=>o,shouldBeFormattedAsPercent:()=>n});var s=i(68805),r=i(60074);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 a(e){const t=e.priceScale();return o(e)&&null!==t?(i,s)=>{var r;return t.formatPriceIndexedTo100(i,null!==(r=e.firstValue())&&void 0!==r?r:100,s)}:n(e)&&null!==t?(i,s)=>{var r;return t.formatPricePercentage(i,null!==(r=e.firstValue())&&void 0!==r?r:100,s)}:null}function l(e){const t=a(e);if(t)return t;const i=e.formatter();return i.format.bind(i)}function c(e,t){const i=a(e);if(i)return i;const s=e.plotFormatter(t);return s.format.bind(s)}},56468:(e,t,i)=>{"use strict";i.d(t,{AreaName:()=>s,HitTarget:()=>n,HitTestResult:()=>h,hitTestResultDataAreEqual:()=>c,shouldDefaultActionBeExecuted:()=>l,tryCallHandler:()=>a});var s,r,n,o=i(50151);function a(e,t,i,s){if(e.isTouch){if(void 0!==s)return s(e,t),!0}else if(void 0!==i)return i(e,t),!0;return!1}function l(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}function c(e,t){return e&&t&&e.equals&&t.equals?e.equals(t):e===t}!function(e){e.Style="Style",e.Text="Text",e.Line="Line",e.Tooltip="Tooltip",e.Button="Button",e.SourceItemMove="SourceItemMove",e.AnchorPoint="AnchorPoint"}(s||(s={})),function(e){e[e.Both=0]="Both",e[e.Horz=1]="Horz",e[e.Vert=2]="Vert"}(r||(r={})),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"}(n||(n={}));class h{constructor(e,t,i){this._target=e,this._data=t||null,this._eraseMarker=i}target(){return this._target}data(){return this._data}mergeData(e){this._data={...(0,o.ensureNotNull)(this._data),...e}}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,t){return null!==this._data&&a(e,t,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e,t){return null!==this._data&&a(e,t,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e,t){return null!==this._data&&a(e,t,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e,t){return null!==this._data&&a(e,t,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}},52397:(e,t,i)=>{"use strict";i.d(t,{HorizontalLinePaneView:()=>n});var s=i(50600),r=i(51056);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}}},91140:(e,t,i)=>{"use strict";var s,r,n;i.d(t,{CustomSourceLayer:()=>a,PlDisplay:()=>r,RecalcVisibleRangeStudiesReason:()=>c,TradedGroupHorizontalAlignment:()=>n,tradingPreferencesDefault:()=>o}),function(e){e[e.Initial=2]="Initial",e[e.SeriesZOrderIsAlwaysZero=3]="SeriesZOrderIsAlwaysZero",e[e.Current=3]="Current"}(s||(s={})),function(e){e[e.Money=0]="Money",e[e.Pips=1]="Pips",e[e.Percentage=2]="Percentage"}(r||(r={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(n||(n={}));const o={showPositions:!1,positionPL:{visibility:!1,display:r.Money},bracketsPL:{visibility:!1,display:r.Money},showOrders:!1,showExecutions:!1,showExecutionsLabels:!1,showReverse:!1,extendLeft:!1,lineLength:0,horizontalAlignment:n.Right,lineWidth:0,lineStyle:0};var a,l,c,h;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(a||(a={})),function(e){e[e.Unavailable=0]="Unavailable",e[e.AvailableReadonlyAlwaysDisabled=1]="AvailableReadonlyAlwaysDisabled",e[e.AvailableReadonlyAlwaysEnabled=2]="AvailableReadonlyAlwaysEnabled",e[e.Available=3]="Available"}(l||(l={})),function(e){e[e.ViewportChangeUserAction=0]="ViewportChangeUserAction",
e[e.DataUpdate=1]="DataUpdate",e[e.SeriesRestart=2]="SeriesRestart",e[e.SeriesCompleted=3]="SeriesCompleted",e[e.StudyCreation=4]="StudyCreation"}(c||(c={})),function(e){e[e.Chart=0]="Chart"}(h||(h={}))},19466:(e,t,i)=>{"use strict";var s,r,n;i.d(t,{TitleDisplayTarget:()=>n}),function(e){e[e.AfterMainSeries=0]="AfterMainSeries"}(s||(s={})),function(e){e[e.Idle=0]="Idle",e[e.Processing=1]="Processing",e[e.Active=2]="Active",e[e.Stopped=3]="Stopped"}(r||(r={})),function(e){e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine"}(n||(n={}))},85049:(e,t,i)=>{"use strict";i.d(t,{Interval:()=>h,ResolutionKind:()=>n,SpecialResolutionKind:()=>o,isHour:()=>u});const s=/^(\d*)([TSHDWMR])$/,r=/^(\d+)$/;var n,o;!function(e){e.Ticks="ticks",e.Seconds="seconds",e.Minutes="minutes",e.Days="days",e.Weeks="weeks",e.Months="months",e.Range="range",e.Invalid="invalid"}(n||(n={})),function(e){e.Hours="hours"}(o||(o={}));const a={};a[n.Ticks]=1e3,a[n.Seconds]=1e3,a[n.Minutes]=60*a[n.Seconds],a[n.Days]=1440*a[n.Minutes],a[n.Weeks]=7*a[n.Days];const l={T:n.Ticks,S:n.Seconds,D:n.Days,W:n.Weeks,M:n.Months,R:n.Range},c=new Set([n.Ticks,n.Seconds,n.Minutes]);class h{constructor(e,t){this._kind=n.Invalid,this._multiplier=0,e!==n.Invalid&&t>0&&(this._kind=e,this._multiplier=t)}kind(){return this._kind}multiplier(){return this._multiplier}isValid(){return this.kind()!==n.Invalid&&this.multiplier()>0}isDWM(){return this.isValid()&&!this.isRange()&&!this.isIntraday()&&!this.isTicks()}isIntraday(){const e=c.has(this.kind());return this.isValid()&&e}isSeconds(){return this.kind()===n.Seconds}isMinutes(){return this.kind()===n.Minutes}isMinuteHours(){return this.kind()===n.Minutes&&u(this.multiplier())}isDays(){return this.kind()===n.Days}isWeeks(){return this.kind()===n.Weeks}isMonths(){return this.kind()===n.Months}isRange(){return this.kind()===n.Range}isTicks(){return this.kind()===n.Ticks}is1Tick(){return this.isTicks()&&1===this.multiplier()}isTimeBased(){return!this.isRange()}letter(){return this.isValid()&&this.kind()!==n.Minutes?this.kind()[0].toUpperCase():""}value(){return this.isValid()?this.kind()===n.Minutes?this.multiplier()+"":this.multiplier()+this.letter():""}isEqualTo(e){if(!(e instanceof h))throw new Error("Argument is not an Interval");return!(!this.isValid()||!e.isValid())&&(this.kind()===e.kind()&&this.multiplier()===e.multiplier())}inMilliseconds(e=Date.now()){if(!this.isValid()||this.isRange())return NaN;if(this.isMonths()){const t=new Date(e);t.setUTCMonth(t.getUTCMonth()+(this.multiplier()||1));return+t-e}const t=this.multiplier();return a[this.kind()]*t}static isEqual(e,t){return e===t||h.parse(e).isEqualTo(h.parse(t))}static parseExt(e){e=(e+"").toUpperCase().split(",")[0];let t=s.exec(e);return null!==t?"H"===t[2]?{interval:new h(n.Minutes,60*d(t[1])),guiResolutionKind:o.Hours}:{interval:new h(l[t[2]],d(t[1])),guiResolutionKind:l[t[2]]}:(t=r.exec(e),null!==t?{interval:new h(n.Minutes,d(t[1])),guiResolutionKind:n.Minutes}:{interval:new h(n.Invalid,0),guiResolutionKind:n.Invalid})}static parse(e){
return h.parseExt(e).interval}static kind(e){return h.parse(e).kind()}static isValid(e){return h.parse(e).isValid()}static isDWM(e){return h.parse(e).isDWM()}static isIntraday(e){return h.parse(e).isIntraday()}static isSeconds(e){return h.parse(e).isSeconds()}static isMinutes(e){return h.parse(e).isMinutes()}static isMinuteHours(e){return h.parse(e).isMinuteHours()}static isDays(e){return h.parse(e).isDays()}static isWeeks(e){return h.parse(e).isWeeks()}static isMonths(e){return h.parse(e).isMonths()}static isRange(e){return h.parse(e).isRange()}static isTicks(e){return h.parse(e).isTicks()}static isTimeBased(e){return h.parse(e).isTimeBased()}static normalize(e){const t=h.parse(e);return t.isValid()?t.value():null}}function d(e){return 0===e.length?1:parseInt(e,10)}function u(e){return e>=60&&!(e%60)}},31229:(e,t,i)=>{"use strict";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}},94260:(e,t,i)=>{"use strict";i.d(t,{IntervalsVisibilitiesProperty:()=>r});var s=i(12988);i(10892);class r extends s.Property{state(e){return super.state(e)}storeStateIfUndefined(){return!1}}},10892:(e,t,i)=>{"use strict";i.d(t,{getIntervalsVisibilitiesForMode:()=>p,isActualInterval:()=>d,makeIntervalsVisibilitiesVisibleAtInterval:()=>c,mergeIntervalVisibilitiesDefaults:()=>u});var s,r=i(14314),n=i(27788),o=i(50151),a=i(85049),l=i(31229);function c(e,t){let i=t.multiplier();if(t.isTicks()&&(e.ticks=!0),t.isSeconds()&&(i<60?(e.seconds=!0,e.secondsFrom=Math.min(e.secondsFrom,i),e.secondsTo=Math.max(e.secondsTo,i)):(i=Math.floor(i/60),t=new a.Interval(a.ResolutionKind.Minutes,i))),t.isMinutes())if(i<60)e.minutes=!0,e.minutesFrom=Math.min(e.minutesFrom,i),e.minutesTo=Math.max(e.minutesTo,i);else{const t=Math.floor(i/60);e.hours=!0,e.hoursFrom=Math.min(e.hoursFrom,t),e.hoursTo=Math.max(e.hoursTo,t)}t.isDays()&&(e.days=!0,e.daysFrom=Math.min(e.daysFrom,i),e.daysTo=Math.max(e.daysTo,i)),t.isWeeks()&&(e.weeks=!0,e.weeksFrom=Math.min(e.weeksFrom,i),e.weeksTo=Math.max(e.weeksTo,i)),t.isMonths()&&(e.months=!0,e.monthsFrom=Math.min(e.monthsFrom,i),e.monthsTo=Math.max(e.monthsTo,i)),t.isRange()&&(e.ranges=!0)}function h(e,t,i,s){return e&&s>=t&&s<=i}function d(e,t){const i=t.childs();switch(e.kind()){case a.ResolutionKind.Ticks:return i.ticks.value();case a.ResolutionKind.Seconds:if(e.multiplier()<60)return h(i.seconds.value(),i.secondsFrom.value(),i.secondsTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),t)}case a.ResolutionKind.Minutes:if(e.multiplier()<60)return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.hours.value(),i.hoursFrom.value(),i.hoursTo.value(),t)}case a.ResolutionKind.Days:
return h(i.days.value(),i.daysFrom.value(),i.daysTo.value(),e.multiplier());case a.ResolutionKind.Weeks:return h(i.weeks.value(),i.weeksFrom.value(),i.weeksTo.value(),e.multiplier());case a.ResolutionKind.Months:return h(i.months.value(),i.monthsFrom.value(),i.monthsTo.value(),e.multiplier());case a.ResolutionKind.Range:return i.ranges.value()}return(0,o.assert)(!1,`Unsupported resolution: ${e.value()}`),!1}function u(e){return(0,r.default)((0,n.default)(l.intervalsVisibilitiesDefaults),null!=e?e:{})}function p(e,t){if(0===t||e.isTicks()&&3===t||e.isRange()&&2===t)return u();let i=!1;const s={ticks:!1,seconds:!1,minutes:!1,hours:!1,days:!1,weeks:!1,months:!1,ranges:!1},r=e=>e.multiplier();return[{checker:e=>e.isTicks(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.ticks=!0}},{checker:e=>e.isSeconds()&&e.multiplier()<60,getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.seconds=!0,s.secondsFrom=e,s.secondsTo=t}},{checker:e=>e.isSeconds()&&e.multiplier()>=60,getIntervalMultiplier:e=>Math.floor(e.multiplier()/60),markIntervalAsVisible:(e,t)=>{s.minutes=!0,s.minutesFrom=e,s.minutesTo=t}},{checker:e=>e.isMinutes()&&e.multiplier()<60,getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.minutes=!0,s.minutesFrom=e,s.minutesTo=t}},{checker:e=>e.isMinutes()&&e.multiplier()>=60,getIntervalMultiplier:e=>Math.floor(e.multiplier()/60),markIntervalAsVisible:(e,t)=>{s.hours=!0,s.hoursFrom=e,s.hoursTo=t}},{checker:e=>e.isDays(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.days=!0,s.daysFrom=e,s.daysTo=t}},{checker:e=>e.isWeeks(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.weeks=!0,s.weeksFrom=e,s.weeksTo=t}},{checker:e=>e.isMonths(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.months=!0,s.monthsFrom=e,s.monthsTo=t}},{checker:e=>e.isRange(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.ranges=!0}}].forEach((s=>{if(s.checker(e)){i=!0;const r=s.getIntervalMultiplier(e);1===t?s.markIntervalAsVisible(r,r):3===t?s.markIntervalAsVisible(r,void 0):s.markIntervalAsVisible(void 0,r)}else(!i&&2===t||i&&3===t)&&s.markIntervalAsVisible(void 0,void 0)})),u(s)}!function(e){e[e.All=0]="All",e[e.OnlyCurrent=1]="OnlyCurrent",e[e.CurrentAndBelow=2]="CurrentAndBelow",e[e.CurrentAndAbove=3]="CurrentAndAbove"}(s||(s={}))},8025:(e,t,i)=>{"use strict";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={}))},66666:(e,t,i)=>{"use strict";function s(e){return Boolean(e.showInObjectTree)}i.d(t,{isDataSource:()=>s})},4340:(e,t,i)=>{"use strict";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"},60074:(e,t,i)=>{"use strict";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})},23486:(e,t,i)=>{"use strict";i.d(t,{alwaysShowLastPriceAndLastDayChange:()=>s,lastDayChangeAvailable:()=>r});i(56570);const s=!1,r=!1},15399:(e,t,i)=>{"use strict";i.d(t,{LevelsProperty:()=>m});var s=i(27788),r=i(14314),n=i(37265),o=i(55917),a=i(35039);const l={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 h(e,t,i,s){return s[t]=i[e],s}function d(){return[]}function u(){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:u,fill:h,typecheck:t.typecheck.unpack},t)}class m extends o.DefaultProperty{constructor(e){const{levelsIterator:t=p,map:i={},...s}=e,r={...l,...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:d,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,a.saveDefaults)(this._defaultName,this.preferences())}clone(){return new m(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}}}},85719:(e,t,i)=>{"use strict";i.d(t,{lineToolsDoNotAffectChartInvalidation:()=>s});const s=!1},62839:(e,t,i)=>{"use strict";i.d(t,{LineToolsGroup:()=>l});var s=i(52033),r=i(64147),n=i(92184);function o(e){return e.properties().visible.value()}function a(e){return!o(e)}class l{constructor(e,t,i){this._instanceId=(0,n.randomHashN)(6),this._onChanged=new s.Delegate,this._lineToolsSet=new Set,this._lineTools=[...e],this._lineToolsSet=new Set(this._lineTools),this._name=new r.WatchedValue(t),this.id=i||(0,n.randomHashN)(6)}instanceId(){return this._instanceId}lineTools(){return this._lineTools}name(){return this._name}setName(e){this._doAndFireOnChange((()=>{this._name.setValue(e)}))}isActualSymbol(){return this._lineTools.length>0&&this._lineTools[0].isActualSymbol()&&this._lineTools[0].isActualCurrency()&&this._lineTools[0].isActualUnit()}symbol(){return this._lineTools[0].symbol()}currencyId(){var e;return null!==(e=this._lineTools[0].properties().childs().currencyId.value())&&void 0!==e?e:null}unitId(){var e;return null!==(e=this._lineTools[0].properties().childs().unitId.value())&&void 0!==e?e:null}sharingMode(){return this._lineTools[0].sharingMode()}share(e){this._lineTools.forEach((t=>t.share(e)))}containsLineTool(e){return this._lineToolsSet.has(e)}addLineTools(e){this._doAndFireOnChange((t=>{
e.forEach((e=>this._lineToolsSet.add(e))),this._lineTools.push(...e),t.push(...e.map((e=>e.id())))}))}excludeLineTool(e){this._doAndFireOnChange((t=>{this._lineToolsSet.delete(e);const i=this._lineTools.indexOf(e);this._lineTools.splice(i,1),t.push(e.id())}))}excludeLineTools(e){this._doAndFireOnChange((t=>{const i=new Set(e);e.forEach((e=>this._lineToolsSet.delete(e))),this._lineTools=this._lineTools.filter((e=>!i.has(e))),t.push(...e.map((e=>e.id())))}))}state(){return{id:this.id,name:this._name.value(),tools:this._lineTools.map((e=>e.id()))}}visibility(){const e=this._lineTools.some(o),t=this._lineTools.some(a);return e&&!t?"Visible":t&&!e?"Invisible":"Partial"}locked(){const e=this._lineTools.some((e=>e.properties().frozen.value())),t=this._lineTools.some((e=>!e.properties().frozen.value()));return e&&!t?"Locked":t&&!e?"Unlocked":"Partial"}isActualInterval(){const e=this._lineTools.some((e=>e.isActualInterval())),t=this._lineTools.some((e=>!e.isActualInterval()));return e&&!t?"IsActualInterval":t&&!e?"IsNotActualInterval":"Partial"}onChanged(){return this._onChanged}static fromState(e,t){const i=[];for(const s of t.tools){const t=e.dataSourceForId(s);null!==t&&i.push(t)}return i.length>0?new l(i,t.name,t.id):null}_doAndFireOnChange(e){const t=[],i=this.visibility(),s=this.locked(),r=this.isActualInterval();e(t),this._onChanged.fire({affectedLineTools:t,visibilityChanged:i!==this.visibility(),lockedChanged:s!==this.locked(),isActualIntervalChanged:r!==this.isActualInterval()})}}},17658:(e,t,i)=>{"use strict";i.d(t,{LineTool5PointsPattern:()=>a});var s=i(50151),r=i(55917),n=i(29875),o=i(73305);class a extends n.LineDataSource{constructor(e,t,i,s){super(e,t||a.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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,35737)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}_loadPaneViews(e){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,77142)).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"))]))}}},30906:(e,t,i)=>{"use strict";i.d(t,{LineToolABCD:()=>a});var s=i(50151),r=i(55917),n=i(29875),o=i(73305);class a extends n.LineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,76441)).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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,66085)).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"))]))}}},87654:(e,t,i)=>{"use strict";i.d(t,{LineToolArc:()=>d});var s,r=i(50151),n=i(4652),o=i(86441),a=i(25422),l=i(55917),c=i(29875),h=i(73305);!function(e){e[e.ArcWithTwoPoints=1]="ArcWithTwoPoints",e[e.ArcWithTheePoints=2]="ArcWithTheePoints",e[e.TheLatest=2]="TheLatest"}(s||(s={}));class d extends c.LineDataSource{constructor(e,t,s,r){const n=t||d.createProperties();super(e,n,s,r),this.version=2,this._dist=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,15190)).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,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,n.distanceToLine)(e,t,i).distance;const s=t.subtract(e),a=new o.Point(-s.y,s.x),l=e.add(t).scaled(.5);i.subtract(l).dotProduct(a)<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},s=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1]));switch(e){case 0:{const e=(0,r.ensureNotNull)(this._dist),t=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),s=l.subtract(t),n=t.add(l).scaled(.5);let a=new o.Point(-s.y,s.x);a=a.normalized();const c=n.add(a.scaled(e));this._points[0]=i,this._points[2]=(0,r.ensureNotNull)(this.screenPointToPoint(c));break}case 1:{const e=(0,r.ensureNotNull)(this._dist),t=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),n=t.subtract(s),a=s.add(t).scaled(.5),l=new o.Point(-n.y,n.x).normalized(),c=a.add(l.scaled(e));this._points[1]=i,this._points[2]=(0,r.ensureNotNull)(this.screenPointToPoint(c));break}case 2:{let e=(0,r.ensureNotNull)(this.pointToScreenPoint(i));const t=(0,n.distanceToLine)(s,l,e).distance,c=l.subtract(s),h=s.add(l).scaled(.5),d=new o.Point(-c.y,c.x).normalized(),u=h.add(d.scaled(t)),p=h.add(d.scaled(-t)),_=c.length(),m=c.x/_,g=c.y/_;let f=Math.acos(m);g<0&&(f=-f);let v=(0,a.translationMatrix)(-h.x,-h.y);e=(0,a.transformPoint)(v,e);let y=(0,a.transformPoint)(v,u);v=(0,a.rotationMatrix)(-f),e=(0,a.transformPoint)(v,e),y=(0,a.transformPoint)(v,y),v=(0,a.scalingMatrix)(1,_/(2*t)),e=(0,a.transformPoint)(v,e),y=(0,a.transformPoint)(v,y);const S=e.y*y.y>=0?new o.Point(u.x,u.y):new o.Point(p.x,p.y);this._points[2]=(0,r.ensureNotNull)(this.screenPointToPoint(S));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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,90490))).GeneralFiguresDefinitionsViewModelBase}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new h.LineToolColorsProperty([e.childs().color]))}}},27621:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMark:()=>a,LineToolArrowMarkDown:()=>d,LineToolArrowMarkLeft:()=>l,LineToolArrowMarkRight:()=>h,LineToolArrowMarkUp:()=>c});var s=i(55917),r=i(29875),n=i(12988),o=i(73305);class a extends r.LineDataSource{constructor(e,t,s,r,n){const o=t||a.createProperties(null,s);super(e,o,r,n),this._textPaneView=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,54176)).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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,67675)).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)}}a.version=2;class l extends a{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 a{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 h extends a{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 d extends a{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")}}},66403:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMarker:()=>o});var s=i(29875),r=i(55917),n=i(12988);class o extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,34823)).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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,86658)).then((e=>e.ArrowMarkerDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new n.Property("")),e.addExcludedKey("text",1)}}},96068:(e,t,i)=>{"use strict";i.d(t,{LineToolArrow:()=>r});var s=i(99294);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}}},11924:(e,t,i)=>{"use strict";i.d(t,{LineToolBalloon:()=>h});var s=i(50151),r=i(11542),n=i(55917),o=i(10568),a=i(12988),l=i(73305);const c=r.t(null,void 0,i(9818));class h extends o.InplaceTextLineDataSource{constructor(e,t,i,s){super(e,t||h.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()}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}static createProperties(e){const t=new n.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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,18046)).then((e=>e.BalloonDefinitionsViewModel))}_createPaneView(){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,82462)).then((e=>{this._setPaneViews([new e.BalloonPaneView(this,this._model)])}))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new a.Property(this._defaultText)),e.addExcludedKey("text",1),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new l.LineToolColorsProperty([e.childs().color]))}}h._defaultText=c},67467:(e,t,i)=>{"use strict";var s;i.d(t,{
LineToolBarsPatternMode:()=>s}),function(e){e[e.Bars=0]="Bars",e[e.Line=1]="Line",e[e.OpenClose=2]="OpenClose",e[e.LineOpen=3]="LineOpen",e[e.LineHigh=4]="LineHigh",e[e.LineLow=5]="LineLow",e[e.LineHL2=6]="LineHL2"}(s||(s={}))},81756:(e,t,i)=>{"use strict";i.d(t,{LineToolBarsPattern:()=>b});var s,r=i(50151),n=i(11542),o=i(45126),a=i(37265),l=i(97702),c=i(55917),h=i(8025),d=i(29875),u=i(67467),p=i(44672),_=i(85719);!function(e){e[e.InitialVersion=1]="InitialVersion",e[e.CorrectedPrice=2]="CorrectedPrice",e[e.TheLatest=2]="TheLatest"}(s||(s={}));const m=new o.TranslatedString("mirror bars pattern",n.t(null,void 0,i(20965))),g=new o.TranslatedString("flip bars pattern",n.t(null,void 0,i(82349))),f=n.t(null,void 0,i(28941)),v=n.t(null,void 0,i(63271)),y={0:2,1:4,2:1,3:1,4:2,5:3,6:-1},S={0:3,1:4,2:4,3:1,4:2,5:3,6:-1};class b extends d.LineDataSource{constructor(e,t=b.createProperties(),s,r){super(e,t,s,r),this._pattern=[],this._scale=1,this._pointsCoordinatePricesDiff=null;const n=t.childs().mode.value();(0,a.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(2870),i.e(1583)]).then(i.bind(i,52666)).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(),m,_.lineToolsDoNotAffectChartInvalidation),this.updateAllViews((0,p.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:v,onExecute:()=>{e.setProperty(this.properties().childs().flipped,!this.properties().childs().flipped.value(),g,_.lineToolsDoNotAffectChartInvalidation),this.updateAllViews((0,p.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,a.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()===u.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[S[e.value()]]:i[y[e.value()]]}lastPatternPrice(){const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[this._pattern.length-1]
;return e.value()===u.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[y[e.value()]]:i[S[e.value()]]}addPoint(e,t,i){const s=super.addPoint(e,t,!0);if(s){const e=this._model.mainSeries(),[{index:t},{index:i}]=this.points(),s=(0,r.ensureDefined)(e.nearestIndex(Math.min(t,i),h.PlotRowSearchMode.NearestRight)),n=(0,r.ensureDefined)(e.nearestIndex(Math.max(t,i),h.PlotRowSearchMode.NearestLeft));this._pattern=this._createPattern(s,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-s),this._normalizePoints(),this.createServerPoints()),this._updatePointsCoordinatePricesDiff()}return s}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 c.DefaultProperty({defaultName:"linetoolbarspattern",state:e});return this._configureProperties(t),t}_preparePoint(e,t){var i;const s=this._alignPointToRangeOfActualData(e),n=this._model.mainSeries(),o=(0,r.ensureNotNull)(n.bars().valueAt(s.index));this.properties().childs().mode.value()===u.LineToolBarsPatternMode.Bars?s.price=(0,r.ensure)(o[2]):s.price=(0,r.ensure)(o[4]);const a=(0,r.ensureNotNull)(this.priceScale()),l=(0,r.ensure)(null===(i=this.ownerSource())||void 0===i?void 0:i.firstValue()),c=.05*a.height(),h=a.priceToCoordinate(s.price,l)-c;return s.price=a.coordinateToPrice(h,l),super._preparePoint(s,t)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,1847))).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(),s=[];for(let n=e;n<=t;n++)s.push((0,a.clone)((0,r.ensureNotNull)(i.valueAt(n))));return s}_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;ss-(e-s);for(let t=0;ts.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())}}},20925:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierCubic:()=>o});var s=i(50151),r=i(55917),n=i(29875);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(2870),i.e(1583)]).then(i.bind(i,12487)).then((t=>{this._setPaneViews([new t.BezierCubicPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Double Curve"}normalizedPointsForCreating(){const e=super.normalizedPointsForCreating();return[e[0],e[e.length-1]]}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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,86622)).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),a=n.subtract(i);return[(0,s.ensureNotNull)(this.screenPointToPoint(o)),(0,s.ensureNotNull)(this.screenPointToPoint(a))]}}},28904:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierQuadro:()=>o});var s=i(50151),r=i(55917),n=i(29875);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(2870),i.e(1583)]).then(i.bind(i,38581)).then((t=>{this._setPaneViews([new t.BezierQuadroPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Curve"}normalizedPointsForCreating(){const e=super.normalizedPointsForCreating();return[e[0],e[e.length-1]]}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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,86622)).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))}}},64195:(e,t,i)=>{"use strict";i.d(t,{LineToolBrushBase:()=>n});var s=i(50151),r=i(29875);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}}},28462:(e,t,i)=>{"use strict";i.d(t,{LineToolBrush:()=>o});var s=i(55917),r=i(64195),n=i(73305);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(2870),i.e(1583)]).then(i.bind(i,68716)).then((t=>{this._setPaneViews([new t.BrushPaneView(this,e)])}))}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,32364)).then((e=>e.BrushDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor],e.childs().fillBackground))}}},62828:(e,t,i)=>{"use strict";i.d(t,{LineToolCallout:()=>l});var s,r=i(12988),n=i(55917),o=i(73305),a=i(10568);!function(e){e[e.PointsCount=2]="PointsCount",e.Name="Callout"}(s||(s={}));class l extends a.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._barOffset=0,this._dragStartLeftEdgeIndex=NaN,this._timeScale=e.timeScale(),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,31463)).then((e=>{this._paneView=new e.CalloutPaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this)),this._setPaneViews([this._paneView])}))}pointsCount(){return 2}name(){return"Callout"}getBarOffset(){return this._barOffset}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.color,wordWrap:e.wordWrap}}removeIfEditableTextIsEmpty(){return!0}activateEditingOnCreation(){return!0}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(e.length1&&(this._barOffset=this.points()[1].index-this.points()[0].index)}}},17333:(e,t,i)=>{"use strict";i.d(t,{LineToolCircle:()=>a});var s=i(12988),r=i(55917),n=i(73305),o=i(10568);class a extends o.InplaceTextLineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,38401)).then((({CirclePaneView:t})=>{const i=[new t(this,e,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))];this._setPaneViews(i)}))}pointsCount(){return 2}name(){return"Circle"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textColor,textVisible:e.showLabel}}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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,99458))).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 n.LineToolColorsProperty([e.childs().color])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor])),e.addChild("textsColors",new n.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)}}},74451:(e,t,i)=>{"use strict";i.d(t,{LineToolComment:()=>n});var s=i(55917),r=i(11924);class n extends r.LineToolBalloon{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Comment"}activateEditingOnCreation(){return!0}editableTextProperties(){return{text:this.properties().childs().text,textColor:this.properties().childs().color}}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolcomment",state:e});return n._configureProperties(t),t}_createPaneView(){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,39157)).then((e=>{this._setPaneViews([new e.CommentPaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}}n._defaultText=""},92007:(e,t,i)=>{"use strict";i.d(t,{LineToolCrossLine:()=>a});var s=i(55917),r=i(36590),n=i(52690),o=i(29875);class a extends o.LineDataSource{constructor(e,t,s,o){super(e,t||a.createProperties(),s,o),this._priceAxisView=new r.LineToolHorzLinePriceAxisView(this),this._timeAxisView=new n.LineToolVertLineTimeAxisView(this),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,17551)).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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,9805)).then((e=>e.CrossLineDefinitionsViewModel))}}},82407:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolCyclicLines:()=>S});var s=i(29875),r=i(50151),n=i(51056),o=i(31229),a=i(6590),l=i(26843),c=i(55917),h=i(11402),d=i(38039),u=i(73305);const p={intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},linewidth:2,linestyle:n.LINESTYLE_SOLID},_={
linecolor:"#80ccdb"},m=new Map([[l.StdTheme.Light,_],[l.StdTheme.Dark,_]]),g=(0,c.extractAllPropertiesKeys)((0,r.ensureDefined)(m.get(l.StdTheme.Light))),f=(0,c.extractAllPropertiesKeys)(p),v=[...g,...f,...a.commonLineToolPropertiesStateKeys];class y extends d.LineDataSourceProperty{constructor(e){super(e),this.addChild("linesColors",new u.LineToolColorsProperty([(0,r.ensureDefined)(this.child("linecolor"))])),this.addChild("linesWidths",new u.LineToolWidthsProperty([(0,r.ensureDefined)(this.child("linewidth"))]))}static create(e){return new this({defaultName:"linetoolcirclelines",factoryDefaultsSupplier:()=>(0,h.factoryDefaultsForCurrentTheme)(p,m),nonThemedDefaultsKeys:f,themedDefaultsKeys:g,allStateKeys:v,state:e})}}class S extends s.LineDataSource{constructor(e,t,s,r){super(e,t||S.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,6074)).then((({LineToolCyclicLinesPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 2}name(){return"Cyclic Lines"}template(){return this._properties.template()}static createProperties(e){const t=y.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,19298))).CyclicAndSineLinesPatternDefinitionsViewModel}static _addCollectedProperties(e){}}},16628:(e,t,i)=>{"use strict";i.d(t,{LineToolCypherPattern:()=>n});var s=i(17658),r=i(55917);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(2870),i.e(1583)]).then(i.bind(i,8198)).then((t=>{this._setPaneViews([new t.CypherPaneView(this,e)])}))}}},76607:(e,t,i)=>{"use strict";i.d(t,{DateAndPriceBaseProperties:()=>p,allPropertiesStateKeysBase:()=>u,nonThemedFactoryDefaultsBase:()=>h,themedFactoryDefaultsBase:()=>d});var s=i(19625),r=i(24633),n=i(19063),o=i(31229),a=i(12988),l=i(38039);const c=(0,s.getHexColorByName)("color-tv-blue-500"),h={linewidth:2,fontsize:12,fillLabelBackground:!0,fillBackground:!0,backgroundTransparency:60,intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},customText:{visible:!1,fontsize:12,bold:!1,italic:!1}},d=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}}]]),u=["customText.text"];class p extends l.LineDataSourceProperty{constructor({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,...i}){var s,r,n;super({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,
templateKeys:[...null!=e?e:[],...null!=t?t:[],...u],...i});const o=null===(s=i.state)||void 0===s?void 0:s.customText;this._textProperty=new a.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}}},70791:(e,t,i)=>{"use strict";i.d(t,{LineToolDateAndPriceRange:()=>y});var s=i(50151),r=i(29875),n=i(61105),o=i(24633),a=i(19625),l=i(55917),c=i(11402),h=i(6590),d=i(76607);const u=(0,a.getHexColorByName)("color-tv-blue-500"),p={...d.nonThemedFactoryDefaultsBase,drawBorder:!1,borderWidth:1},_=new Map([[o.StdTheme.Light,{...d.themedFactoryDefaultsBase.get(o.StdTheme.Light),borderColor:u}],[o.StdTheme.Dark,{...d.themedFactoryDefaultsBase.get(o.StdTheme.Dark),borderColor:u}]]),m=(0,l.extractAllPropertiesKeys)((0,s.ensureDefined)(_.get(o.StdTheme.Light))),g=(0,l.extractAllPropertiesKeys)(p),f=[...m,...g,...h.commonLineToolPropertiesStateKeys,...d.allPropertiesStateKeysBase];class v extends d.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldateandpricerange",factoryDefaultsSupplier:()=>(0,c.factoryDefaultsForCurrentTheme)(p,_),nonThemedDefaultsKeys:g,themedDefaultsKeys:m,allStateKeys:f,state:e})}}class y extends r.LineDataSource{constructor(e,t,s,r){super(e,t||y.createProperties(),s,r),this._volumeCalculator=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,93955)).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=v.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,14336))).GeneralDatePriceRangeDefinitionsViewModel}}},42214:(e,t,i)=>{"use strict";i.d(t,{LineToolDateRange:()=>f});var s=i(50151),r=i(29875),n=i(61105),o=i(24633),a=i(55917),l=i(11402),c=i(76607),h=i(6590);const d={...c.nonThemedFactoryDefaultsBase,extendTop:!1,extendBottom:!1},u=c.themedFactoryDefaultsBase,p=(0,a.extractAllPropertiesKeys)((0,s.ensureDefined)(u.get(o.StdTheme.Light))),_=(0,a.extractAllPropertiesKeys)(d),m=[...p,..._,...h.commonLineToolPropertiesStateKeys,...c.allPropertiesStateKeysBase];class g extends c.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldaterange",factoryDefaultsSupplier:()=>(0,l.factoryDefaultsForCurrentTheme)(d,u),nonThemedDefaultsKeys:_,themedDefaultsKeys:p,
allStateKeys:m,state:e})}}class f extends r.LineDataSource{constructor(e,t,s,r){super(e,t||f.createProperties(),s,r),this._volumeCalculator=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,33406)).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=g.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,14336))).GeneralDatePriceRangeDefinitionsViewModel}}},57897:(e,t,i)=>{"use strict";i.d(t,{LineToolDisjointChannel:()=>a});var s=i(29875),r=i(55917),n=i(37265),o=i(12988);class a extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),this.version=1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,41376)).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 a,l,c,h;s.index<=r.index?(o.push(s),o.push(r)):(o.push(r),o.push(s)),i[0].price>o[0].price?(a=i,l=o):o[0].price>i[0].price||o[1].price>i[1].price?(a=o,l=i):(a=i,l=o);const d=this.properties().childs().extendLeft.value(),u=this.properties().childs().extendRight.value();return e.index<=t.index?(c=d,h=u):(c=u,h=d),[this._linePointsToAlertPlot(a,"Upper",c,h),this._linePointsToAlertPlot(l,"Lower",c,h)].filter(n.notNull)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,41585))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.Property("")),e.addExcludedKey("labelText",1)}}},65365:(e,t,i)=>{"use strict";i.d(t,{LineToolElliott:()=>m,LineToolElliottCorrection:()=>x,LineToolElliottDoubleCombo:()=>I,LineToolElliottImpulse:()=>v,LineToolElliottTriangle:()=>S,LineToolElliottTripleCombo:()=>w});var s,r,n=i(11542),o=i(45126),a=i(29875),l=i(97702),c=i(55917),h=i(73305),d=i(85719);!function(e){e[e.Supermillennium=0]="Supermillennium",e[e.Millennium=1]="Millennium",e[e.Submillennium=2]="Submillennium",e[e.GrandSupercycle=3]="GrandSupercycle",e[e.Supercycle=4]="Supercycle",e[e.Cycle=5]="Cycle",e[e.Primary=6]="Primary",e[e.Intermediate=7]="Intermediate",e[e.Minor=8]="Minor",e[e.Minute=9]="Minute",e[e.Minuette=10]="Minuette",e[e.Subminuette=11]="Subminuette",e[e.Micro=12]="Micro",e[e.Submicro=13]="Submicro",e[e.Minuscule=14]="Minuscule"}(s||(s={})),function(e){e[e.Current=4]="Current"}(r||(r={}));const u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],p=new o.TranslatedString("change Elliott degree",n.t(null,void 0,i(47977))),_=[{value:0,title:n.t(null,void 0,i(3348))},{value:1,title:n.t(null,void 0,i(87957))},{value:2,title:n.t(null,void 0,i(63375))},{value:3,title:n.t(null,void 0,i(57726))},{value:4,title:n.t(null,void 0,i(67948))},{value:5,title:n.t(null,void 0,i(87380))},{value:6,title:n.t(null,void 0,i(59189))},{value:7,title:n.t(null,void 0,i(10268))},{value:8,title:n.t(null,{context:"wave"},i(51077))},{value:9,title:n.t(null,{context:"wave"},i(922))},{value:10,title:n.t(null,void 0,i(14724))},{value:11,title:n.t(null,void 0,i(30585))},{value:12,title:n.t(null,void 0,i(24866))},{value:13,title:n.t(null,void 0,i(1145))},{value:14,title:n.t(null,void 0,i(78273))}];class m extends a.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:m.createProperties(),s,r),this.version=4,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,98424)).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 l.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:n.t(null,void 0,i(23403)),subItems:u.map((t=>{const i=_.filter((e=>e.value===t))[0];return new l.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,p,d.lineToolsDoNotAffectChartInvalidation)}}})}))}})]}label(e){const t=u.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 _}static createProperties(e){const t=new c.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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,70491))).ElliottPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new h.LineToolColorsProperty([e.childs().color])),e.addExcludedKey("linesColors",3)}}class g extends m{pointsCount(){return 6}}const f=[["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 v extends g{constructor(e,t,i,s){super(e,t||v.createProperties(),i,s)}name(){return"Elliott Impulse Wave (12345)"}labelsGroup(){return f}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliottimpulse",state:e});return this._configureProperties(t),t}}const y=[["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 S extends g{constructor(e,t,i,s){super(e,t||S.createProperties(),i,s)}name(){return"Elliott Triangle Wave (ABCDE)"}labelsGroup(){return y}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliotttriangle",state:e});return this._configureProperties(t),t}}const b=[["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 w extends g{constructor(e,t,i,s){
super(e,null!=t?t:w.createProperties(),i,s)}name(){return"Elliott Triple Combo Wave (WXYXZ)"}labelsGroup(){return b}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliotttriplecombo",state:e});return this._configureProperties(t),t}}class C extends m{pointsCount(){return 4}}const P=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]];class x extends C{constructor(e,t,i,s){super(e,null!=t?t:x.createProperties(),i,s)}name(){return"Elliott Correction Wave (ABC)"}labelsGroup(){return P}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliottcorrection",state:e});return this._configureProperties(t),t}}const T=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]];class I extends C{constructor(e,t,i,s){super(e,null!=t?t:I.createProperties(),i,s)}name(){return"Elliott Double Combo Wave (WXY)"}labelsGroup(){return T}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliottdoublecombo",state:e});return this._configureProperties(t),t}}},59002:(e,t,i)=>{"use strict";i.d(t,{LineToolEllipse:()=>h});var s=i(50151),r=i(4652),n=i(86441),o=i(12988),a=i(55917),l=i(73305),c=i(10568);class h extends c.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this.version=2,this._dist=null,this._fakePointAdded=!1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,75649)).then((({EllipsePaneView:e})=>{this._setPaneViews([new e(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}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 a={...t};let l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),h=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));switch(e){case 0:{if(i&&i.shift()){this._snapPoint45Degree(a,this._points[1]),this._points[0]=a,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}l=(0,s.ensureNotNull)(this.pointToScreenPoint(a));const e=c.subtract(l),t=l.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();h=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[0]=a,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 1:{if(i&&i.shift()){this._snapPoint45Degree(a,this._points[0]),this._points[1]=a,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(a));const e=c.subtract(l),t=l.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();h=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[1]=a,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 2:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(a)),t=(0,r.distanceToLine)(l,c,e).distance,i=c.subtract(l),o=l.add(c).scaled(.5),d=new n.Point(-i.y,i.x).normalized();h=o.add(d.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 3:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(a)),t=(0,r.distanceToLine)(l,c,e).distance,i=c.subtract(l),o=l.add(c).scaled(.5),d=new n.Point(-i.y,i.x).normalized();h=o.add(d.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));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}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textColor,textVisible:e.showLabel}}static createProperties(e){const t=new a.DefaultProperty({defaultName:"linetoolellipse",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,99458))).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 l.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new l.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])),a=o.x-t.x,l=o.y-t.y,c=Math.sqrt(a*a+l*l)/2,h=o.subtract(t),d=t.add(o).scaled(.5),u=new n.Point(-h.y,h.x).normalized(),p=d.add(u.scaled(c));r=(0,s.ensureNotNull)(this.screenPointToPoint(p)),(isNaN(r.price)||isNaN(r.index))&&(r=(0,s.ensureNotNull)(this.screenPointToPoint(d)))}}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)),a=this._model.timeScale(),l=a.indexToCoordinate(e.index),c=a.indexToCoordinate(i.index);let h=2*Math.abs(l-c);h*=t.price>e.price?1:-1,e.price=(0,s.ensureNotNull)(this.screenPointToPoint(new n.Point(r.x,o.y+h))).price}}},72939:(e,t,i)=>{"use strict";i.d(t,{LineToolEmoji:()=>C});var s=i(19365),r=i(31955),n=i(67580),o=i(928),a=i(12027),l=i(22329),c=i(27788),h=i(14314),d=i(38039),u=i(31229),p=i(55917),_=i(6590);const m={intervalsVisibilities:{...u.intervalsVisibilitiesDefaults},size:40},g={emoji:"😀",angle:.5*Math.PI},f=(0,p.extractAllPropertiesKeys)(m),v=(0,p.extractAllPropertiesKeys)(g),y=[...f,...v,..._.commonLineToolPropertiesStateKeys];class S extends d.LineDataSourceProperty{constructor(e){super(e)}static create(e,t){return new this({defaultName:"linetoolemoji",factoryDefaultsSupplier:()=>(0,c.default)(m),nonThemedDefaultsKeys:f,themedDefaultsKeys:[],state:(0,h.default)({},g,{emoji:t},null!=e?e:{}),allStateKeys:y})}}const b=(0,r.getLogger)("Chart.LineToolEmoji");var w;!function(e){e[e.Version=1]="Version"}(w||(w={}));class C extends l.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||C.createProperties(),i,s),this.version=1,this._loadViews()}name(){return"Emoji"}template(){return this.properties().template()}static createProperties(e){const t=S.create(e,o.emojiTool.value());return C._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,18009))).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(2870),i.e(1583)]).then(i.bind(i,98633))]);if(!this._isDestroyed){this._svgContent=s,this._onIconChanged.fire();const t=(0,a.svgRenderer)(s);null===t&&b.logWarn(`Couldn't create svg renderer for emoji ${e}`),this._setPaneViews([new r(this,this._model,t)])}}catch(t){b.logWarn(`An error ocurred while loading emoji content ${e}: ${t}`)}}}},56991:(e,t,i)=>{"use strict";i.d(t,{ExecutionsPositionController:()=>u,LineToolExecution:()=>_});var s=i(50151),r=i(29875),n=i(91920),o=i(55917),a=i(8025),l=i(56570),c=i(2718),h=i(44672);const d=c.sortSourcesPreOrdered.LineToolExecution;class u{constructor(e){this._pane=e}getXYCoordinate(e,t,i){let r=0
;const n=e.getDirection(),o="buy"===n,l=this._pane.model().mainSeries();if(l.bars){const e=o?10:-10,t=l.bars().search(i,a.PlotRowSearchMode.NearestLeft);if(null!==t){i=t.index;const n=o?t.value[3]:t.value[2],a=l.priceScale(),c=(0,s.ensureNotNull)(l.firstValue());r=a.priceToCoordinate(n,c)+e}}e.setAlignedTimePointIndex(i);const c=t.visibleBarsStrictRange();if(!isFinite(i)||null===c||i>c.lastBar()||i=0;--t){const s=h[t];if(!(s instanceof _)||s.adapter().alignedTimePointIndex()!==i||s.adapter().getDirection()!==n)continue;if(s===e.line())break;const a=s.adapter().height();r=o?r+a:r-a}return{x:t.indexToCoordinate(i),y:r}}static recreateOrderedByBarsSourcesCache(e){this.clearOrderedByBarsSourcesCache();const t=e.sourcesByGroup().all();for(const e of t){if(!(e instanceof _))continue;const t=e.adapter().alignedTimePointIndex();if(void 0===t)continue;const i=u._cachedByBarIndexOrderedExecutions[t]||[];u._cachedByBarIndexOrderedExecutions[t]=i,i.push(e)}}static clearOrderedByBarsSourcesCache(){u._cachedByBarIndexOrderedExecutions={}}}u._cachedByBarIndexOrderedExecutions={};class p{constructor(e,t){this._unixtime=NaN,this._line=e,this._model=t}alignedTimePointIndex(){return this._alignedTimePointIndex}setAlignedTimePointIndex(e){this._alignedTimePointIndex=e}line(){return this._line}getIndex(){return this._model.timeScale().baseIndex()-this._line.points()[0].index}setIndex(e){const t=this._model.timeScale().baseIndex()-Math.abs(e);this._line.startMoving({logical:this._line.points()[0]});const i={...this._line.points()[0]};return i.index=t,this._line.move({logical:i}),this._line.endMoving(!1),this}getTime(){return this._unixtime}setTime(e){return this._unixtime=e,this._line.restorePoints([{offset:0,price:this.getPrice(),time_t:this._unixtime}],[]),this._line.createServerPoints(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line.normalizedPoints().length>0?this._line.normalizedPoints()[0].price:NaN}setPrice(e){return this._line.points().length>0&&(this._line.points()[0].price=e),this._line.normalizedPoints().length>0&&(this._line.normalizedPoints()[0].price=e),this}getText(){return this._line.properties().childs().text.value()}setText(e){return this._line.properties().childs().text.setValue(e||""),this._line.updateAllViewsAndRedraw((0,h.sourceChangeEvent)(this._line.id())),this}getArrowHeight(){return this._line.properties().childs().arrowHeight.value()}setArrowHeight(e){return this._line.properties().childs().arrowHeight.setValue(e||5),this}getArrowSpacing(){return this._line.properties().childs().arrowSpacing.value()}setArrowSpacing(e){return this._line.properties().childs().arrowSpacing.setValue(e||1),this}getDirection(){return this._line.properties().childs().direction.value()}setDirection(e){return this._line.properties().childs().direction.setValue(e||"buy"),this}getArrowColor(){const e=this._line.properties().childs()
;return"buy"===this.getDirection()?e.arrowBuyColor.value():e.arrowSellColor.value()}setArrowColor(e){return"buy"===this.getDirection()?this.setArrowBuyColor(e):this.setArrowSellColor(e),this}setArrowBuyColor(e){return this._line.properties().childs().arrowBuyColor.setValue(e),this}setArrowSellColor(e){return this._line.properties().childs().arrowSellColor.setValue(e),this}getTextColor(){const e=this._line.properties().childs();return n.getColorFromProperties(e.textColor,e.textTransparency)}setTextColor(e){const t=this._line.properties().childs();return n.setColorToProperties(e,t.textColor,t.textTransparency),this}getFont(){const e=this._line.properties().childs();return n.getFontFromProperties(e.fontFamily,e.fontSize,e.fontBold,e.fontItalic)}setFont(e){const t=this._line.properties().childs();return n.setFontToProperties(e,t.fontFamily,t.fontSize,t.fontBold,t.fontItalic),this}setTooltip(e){return null==e?e="":e+="",this._line.properties().childs().tooltip.setValue(e),this}getTooltip(){return this._line.properties().childs().tooltip.value()}remove(){this._model.removeSource(this._line)}getPoints(){return this._line.points()}height(){const e=this.getArrowHeight(),t=this.getArrowSpacing();let i=0;this.getText()&&(i=n.fontHeight(this.getFont()));return e+t+i+10}}class _ extends r.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:_.createProperties(),s,r),this._adapter=new p(this,e),this.customization.forcePriceAxisLabel=!1,this.customization.disableErasing=!0,this.setSelectionEnabled(!1),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,256)).then((e=>{this._setPaneViews([new e.ExecutionPaneView(this,this._model)])}))}adapter(){return this._adapter}zorder(){return d}isSpeciallyZOrderedSource(){return!0}pointsCount(){return 1}name(){return"Execution"}hasContextMenu(){return!1}state(){return{}}updateAllViews(e){if(this._isVisible())return super.updateAllViews(e)}priceAxisViews(e,t){return this._isVisible()?super.priceAxisViews(e,t):null}paneViews(){return window.TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._isVisible()?super.paneViews():null}userEditEnabled(){return!1}showInObjectTree(){return!1}cloneable(){return!1}copiable(){return!1}isSynchronizable(){return!1}static createProperties(e){const t=new o.DefaultProperty({defaultName:"linetoolexecution",state:e,useUserPreferences:!1});return _._configureProperties(t),t}_isVisible(){return this._model.properties().childs().tradingProperties.childs().showExecutions.value()}}},6921:(e,t,i)=>{"use strict";i.d(t,{LineToolExtended:()=>r});var s=i(99294);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}}},96851:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWithInplaceTextBase:()=>c,getLevelProps:()=>a});var s=i(50151),r=i(12988),n=i(10568);const o=new r.Property(!1);function a(e,t){return(0,s.ensureDefined)(e.child(`level${t}`))}
class l extends n.InplaceTextUndoCommand{constructor(e,t,i,s,r){super(e,t,i,s),this._levelIndex=r}_textProperty(e){return a(e.properties(),this._levelIndex).childs().text}}class c extends n.InplaceTextLineDataSource{constructor(){super(...arguments),this._inplaceEditLevelIndex=1}editableTextStyle(){return{...super.editableTextStyle(),forbidLineBreaks:!0,maxLength:50}}editableTextProperties(){const e=this.properties().childs();return{text:e.editableText,textColor:e.editableTextColor,wordWrap:o}}setInplaceEditLevelIndex(e){var t;null===(t=this._destroyEditableTextSubscriptions)||void 0===t||t.call(this);const i=this.properties(),r=i.childs().editableText,n=i.childs().editableTextColor,o=a(i,e),l=(0,s.ensureDefined)(o).childs().text,c=(0,s.ensureDefined)(o).childs().color,h={};r.setValue(l.value()),n.setValue(c.value()),r.subscribe(h,(()=>l.setValue(r.value()))),l.subscribe(h,(()=>r.setValue(l.value()))),n.subscribe(h,(()=>c.setValue(n.value()))),c.subscribe(h,(()=>n.setValue(c.value()))),this._destroyEditableTextSubscriptions=()=>{r.unsubscribeAll(h),l.unsubscribeAll(h),n.unsubscribeAll(h),c.unsubscribeAll(h)},this._inplaceEditLevelIndex=e,this._editableText.setValue(r.value())}_changeEditableTextUndoCommand(e,t){return new l(this._model,this,e,t,this._inplaceEditLevelIndex)}static _configureProperties(e){super._configureProperties(e),e.addChild("editableText",new r.Property("")),e.addChild("editableTextColor",new r.Property("")),e.addExcludedKey("editableText",3),e.addExcludedKey("editableTextColor",3)}}},42851:(e,t,i)=>{"use strict";i.d(t,{LineToolFibChannel:()=>p});var s,r,n=i(50151),o=i(11542),a=i(45126),l=i(85719),c=i(15399),h=i(73305),d=i(10568);!function(e){e[e.FibChannelWithReverse=1]="FibChannelWithReverse",e[e.FibChannelWithoutReverse=2]="FibChannelWithoutReverse",e[e.TheLatest=2]="TheLatest"}(s||(s={})),function(e){e[e.LevelsCount=24]="LevelsCount"}(r||(r={}));const u=new a.TranslatedString("erase level line",o.t(null,void 0,i(35111)));class p extends d.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||p.createProperties(),s,r),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,93143)).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,u,l.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,n.assert)(!1,"unexpected method call")}static createProperties(e){const t=new c.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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,75450))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[];for(let i=1;i<=24;i++){const s=(0,
n.ensureDefined)(e.child("level"+i));t.push((0,n.ensureDefined)(s.child("color")))}e.addChild("linesColors",new h.LineToolColorsProperty(t))}}},57994:(e,t,i)=>{"use strict";i.d(t,{LineToolFibCircles:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(15399),a=i(73305),l=i(85719),c=i(10568);const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.LevelsCount=11]="LevelsCount"}(d||(d={}));class u extends c.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,83201)).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,h,l.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetoolfibcircles",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,41618))).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))}}},33168:(e,t,i)=>{"use strict";i.d(t,{LineToolFibRetracement:()=>u});var s,r,n=i(11542),o=i(45126),a=i(15399),l=i(85719),c=i(73305),h=i(96851);!function(e){e[e.FibRetracement=1]="FibRetracement",e[e.FibRetracementV2=2]="FibRetracementV2",e[e.Latest=2]="Latest"}(s||(s={})),function(e){e[e.LevelsCount=24]="LevelsCount",e[e.PointsCount=2]="PointsCount",e.Name="Fib Retracement"}(r||(r={}));const d=new o.TranslatedString("erase level line",n.t(null,void 0,i(35111)));class u extends h.LineToolFibWithInplaceTextBase{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,65343)).then((e=>{this._paneView=new e.FibRetracementPaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this)),this._setPaneViews([this._paneView])}))}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,d,l.lineToolsDoNotAffectChartInvalidation)}fibLevelsBasedOnLogScale(){var e
;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&!!(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}template(){const e=super.template();for(let t=1;t<=24;t++){const i=(0,h.getLevelProps)(this._properties,t);e[`level${t}`][3]=i.childs().text.value()}return e}static createProperties(e){const t=new a.LevelsProperty({defaultName:"linetoolfibretracement",state:e,map:{range:[1,24],names:["coeff","color","visible","text"]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,75450))).FibDrawingsWith24LevelsDefinitionsViewModel}_applyTemplateImpl(e){var t;for(let i=1;i<=24;i++){const s=(0,h.getLevelProps)(this._properties,i),r=e[`level${i}`];s.childs().text.setValue(null!==(t=r[3])&&void 0!==t?t:"")}super._applyTemplateImpl(e)}static _configureProperties(e){super._configureProperties(e);const t=[e.childs().trendline.childs().linewidth,e.childs().levelsStyle.childs().linewidth],i=[e.childs().trendline.childs().color];for(let t=1;t<=24;t++){const s=(0,h.getLevelProps)(e,t);i.push(s.childs().color),e.addExcludedKey(`level${t}.text`,1)}e.addChild("linesColors",new c.LineToolColorsProperty(i)),e.addChild("linesWidths",new c.LineToolWidthsProperty(t))}}},88588:(e,t,i)=>{"use strict";i.d(t,{LineToolFibSpeedResistanceArcs:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(15399),a=i(73305),l=i(85719),c=i(10568);const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.LevelsCount=11]="LevelsCount"}(d||(d={}));class u extends c.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,66152)).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,h,l.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetoolfibspeedresistancearcs",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,20875))).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))}}},20701:(e,t,i)=>{"use strict";i.d(t,{LineToolFibSpeedResistanceFan:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(29875),a=i(15399),l=i(73305),c=i(85719)
;const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.HLevelsCount=7]="HLevelsCount",e[e.VLevelsCount=7]="VLevelsCount"}(d||(d={}));class u extends o.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,66832)).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,h,c.lineToolsDoNotAffectChartInvalidation)}static createProperties(e){e&&void 0===e.reverse&&(e.reverse=!0);const t=new a.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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,72605))).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 l.LineToolColorsProperty(r)),e.addExcludedKey("linesColors",3)}}},84023:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolFibSpiral:()=>b});var s=i(29875),r=i(50151),n=i(51056),o=i(31229),a=i(6590),l=i(19625),c=i(26843),h=i(55917),d=i(11402),u=i(38039),p=i(73305);const _={intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},counterclockwise:!1,linewidth:2,linestyle:n.LINESTYLE_SOLID},m={linecolor:(0,l.getHexColorByName)("color-sky-blue-500")},g=new Map([[c.StdTheme.Light,m],[c.StdTheme.Dark,m]]),f=(0,h.extractAllPropertiesKeys)((0,r.ensureDefined)(g.get(c.StdTheme.Light))),v=(0,h.extractAllPropertiesKeys)(_),y=[...f,...v,...a.commonLineToolPropertiesStateKeys];class S extends u.LineDataSourceProperty{constructor(e){super(e),this.addChild("linesColors",new p.LineToolColorsProperty([(0,r.ensureDefined)(this.child("linecolor"))])),this.addChild("linesWidths",new p.LineToolWidthsProperty([(0,r.ensureDefined)(this.child("linewidth"))]))}static create(e){return new this({defaultName:"linetoolfibspiral",factoryDefaultsSupplier:()=>(0,d.factoryDefaultsForCurrentTheme)(_,g),nonThemedDefaultsKeys:v,themedDefaultsKeys:f,allStateKeys:y,state:e})}}class b extends s.LineDataSource{constructor(e,t,s,r){super(e,t||b.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,39029)).then((({FibSpiralPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 2}name(){return"Fib Spiral"}template(){return this._properties.template()}static createProperties(e){
const t=S.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,24277))).FibSpiralDefinitionsViewModel}static _addCollectedProperties(e){}}},8532:(e,t,i)=>{"use strict";i.d(t,{LineToolFibTimeZone:()=>p});var s=i(11542),r=i(45126),n=i(73305),o=i(15399),a=i(85719),l=i(29875);const c=new r.TranslatedString("erase level line",s.t(null,void 0,i(35111)));var h,d,u;!function(e){e[e.InitVersion=1]="InitVersion",e[e.SecondVersion=2]="SecondVersion",e[e.CurrentVersion=2]="CurrentVersion"}(h||(h={})),function(e){e[e.LevelsCount=11]="LevelsCount",e[e.PointsCount=2]="PointsCount"}(d||(d={})),function(e){e.Name="Fib Time Zone"}(u||(u={}));class p extends l.LineDataSource{constructor(e,t,s,r){super(e,t||p.createProperties(),s,r),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,18449)).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,c,a.lineToolsDoNotAffectChartInvalidation)}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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,23720))).FibTimezoneDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[],i=[],s=[];for(let r=1;r<=11;r++){const n=e.childs()["level"+r].childs();t.push(n.linewidth),i.push(n.color),s.push(n.linestyle)}e.addChild("linesColors",new n.LineToolColorsProperty(i)),e.addChild("linesWidths",new n.LineToolWidthsProperty(t)),e.addChild("linesStyles",new n.LineToolCollectedProperty(s)),e.hasChild("baselinecolor")&&e.removeProperty("baselinecolor"),e.hasChild("linecolor")&&e.removeProperty("linecolor"),e.hasChild("linewidth")&&e.removeProperty("linewidth"),e.hasChild("linestyle")&&e.removeProperty("linestyle")}}},90882:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWedgeBase:()=>o});var s=i(50151),r=i(86441),n=i(10568);class o extends n.InplaceTextLineDataSource{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)),a=this._pointsProperty.childs().points[1];a.childs().price.setValue(o.price),a.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 a=(0,s.ensureNotNull)(this.screenPointToPoint(i)),l=this._pointsProperty.childs().points[2];l.childs().price.setValue(a.price),l.childs().bar.setValue(a.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 a=(0,s.ensureNotNull)(this.ownerSource()),l=(0,s.ensureNotNull)(a.firstValue()),c=(0,s.ensureNotNull)(this.priceScale()).coordinateToPrice(r.y,l);e={index:Math.round(this._model.timeScale().coordinateToIndex(r.x)),price:c}}return super.addPoint(e)}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}}},23591:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWedge:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(90882),a=i(15399),l=i(73305),c=i(85719);const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.LevelsCount=11]="LevelsCount"}(d||(d={}));class u extends o.LineToolFibWedgeBase{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,84417)).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,h,c.lineToolsDoNotAffectChartInvalidation)}static createProperties(e){const t=new a.LevelsProperty({defaultName:"linetoolfibwedge",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,49267))).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 l.LineToolColorsProperty(i)),e.addChild("linesWidths",new l.LineToolWidthsProperty(t))}}},41124:(e,t,i)=>{"use strict";i.d(t,{LineToolFlagMark:()=>a});var s=i(86441),r=i(29875),n=i(55917),o=i(73305);class a extends r.LineDataSource{constructor(e,t,r,n){
super(e,t||a.createProperties(),r,n),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,36134)).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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,11138)).then((e=>e.FlagMarkDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().flagColor])),e.addExcludedKey("backgroundsColors",3)}}a.version=2},90921:(e,t,i)=>{"use strict";i.d(t,{LineToolFlatBottom:()=>a});var s=i(29875),r=i(55917),n=i(37265),o=i(12988);class a extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),this.version=1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,73050)).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 a,l,c,h;s.index<=r.index?(o.push(s),o.push(r)):(o.push(r),o.push(s)),i[0].price>o[0].price?(a=i,l=o):o[0].price>i[0].price||o[1].price>i[1].price?(a=o,l=i):(a=i,l=o);const d=this.properties().childs().extendLeft.value(),u=this.properties().childs().extendRight.value();return e.index<=t.index?(c=d,h=u):(c=u,h=d),[this._linePointsToAlertPlot(a,"Upper",c,h),this._linePointsToAlertPlot(l,"Lower",d,h)].filter(n.notNull)}async _getPropertyDefinitionsViewModelClass(){
return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,41585))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.Property("")),e.addExcludedKey("labelText",1)}}},12121:(e,t,i)=>{"use strict";i.d(t,{createPropertiesObject:()=>a});var s=i(37265),r=i(15399);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 a(e,t){return new o(e,t)}},99083:(e,t,i)=>{"use strict";i.d(t,{LineToolGannComplex:()=>u});var s,r=i(86441),n=i(50151),o=i(73866),a=i(29875),l=i(59769),c=i(12121),h=i(73305),d=i(15938);!function(e){e[e.ScaleRatioStep=1e-7]="ScaleRatioStep",e[e.ScaleRatioPrecision=7]="ScaleRatioPrecision",e.ScaleRatioInitialValue=""}(s||(s={}));class u extends a.LineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),this.version=2,this._scaleRatioFormatter=new o.LimitedPrecisionNumericFormatter(7),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,73017)).then((({GannComplexPaneView:e})=>{this._setPaneViews([new e(this,this.model())])}));const n=this.properties();this._adjustScaleRatio(n),n.subscribe(this,this._adjustScaleRatio),n.childs().scaleRatio.subscribe(this,this._correctFirstPoint),this._syncStateExclusions=["scaleRatio"],n.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),r=this.priceScale();return!(0,n.ensureNotNull)(r).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,n.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;se.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;r0,o=s.index-r.index>0;let a=n&&!o||!n&&o?-1:1;0===e&&(a=-a),s.price=r.price+a*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().length0){s=s.normalized();let e=Math.acos(s.x);return s.y>0&&(e=-e),e}return null}}},85259:(e,t,i)=>{"use strict";var s=i(45126).TranslatedString,r=i(85719).lineToolsDoNotAffectChartInvalidation,n=i(29875).LineDataSource,o=i(15399).LevelsProperty,a=i(73305),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new s("erase level line",i.i18next(null,void 0,i(35111)));class d extends n{constructor(e,t,s,r){super(e,t||d.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,79890)).then((({GannFanPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return d.LevelsCount}pointsCount(){return 2}name(){return"Gann Fan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h,r)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,72443))).GannFanDefinitionsViewModel}static createProperties(e){var t=new o({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 c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=9,t.LineToolGannFan=d},8308:(e,t,i)=>{"use strict";i.d(t,{LineToolGannFixed:()=>l});var s=i(86441),r=i(50151),n=i(29875),o=i(73305),a=i(12121);class l extends n.LineDataSource{
constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._constructor="LineToolGannFixed",Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,57736)).then((({GannFixedPaneView:e})=>{this._setPaneViews([new e(this,this.model())])})),this.properties().childs().reverse.subscribe(this,this._reversePoints)}pointsCount(){return 2}name(){return"Gann Square Fixed"}axisPoints(){const e=this.points(),t=this.getScreenPoints();return e.length<2||t.length<2?[]:[e[0],(0,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)),a=(0,r.ensureNotNull)(this.pointToScreenPoint(n)),l=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2)),c=new s.Point(Math.cos(t),-Math.sin(t)),h=c.normalized(),d=h.x<0?-1:1,u=h.y<0?-1:1;return[o.addScaled(c,l),o.add(new s.Point(5*l*d,5*l*u))]}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;se.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r0&&(o=-o),o}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this._normalizePoints(),this.restart()}}},9770:(e,t,i)=>{"use strict";var s=i(29875).LineDataSource,r=i(15399).LevelsProperty,n=i(73305).LineToolColorsProperty,o=[4.5,9,11.25,18,22.5,36,45],a=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 et?1:0})),e}();class l extends s{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.t.bind(i,10349,19)).then((({GannSquarePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}hLevelsCount(){return l.HLevelsCount}vLevelsCount(){return l.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,a=Math.abs(i);a=0&&!(o[c]*n=0?l:-l),e}_alignTimeOnPattern(e,t){var i=e.index-t.index;if(0===i)return 0;for(var s=a.length-2;s>=0&&!(a[s]0?1:0,e.index=t.index+a[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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,27340))).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)}}l.HLevelsCount=7,l.VLevelsCount=7,t.LineToolGannSquare=l},37968:(e,t,i)=>{"use strict";i.d(t,{LineToolGhostFeed:()=>c})
;var s=i(55917),r=i(29875),n=i(50151),o=i(37265);class a{constructor(e,t,i){this._source=e,this._segmentIndex=t,this._bars=null!=i?i:[]}setBars(e){this._bars=e}clone(e){return new a(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._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 a(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;e1&&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