@barchart/chart-lib 2.403.0 → 2.404.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
chart-lib/barchart.chart.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=function(e){return e[e.Browser=0]=`Browser`,e[e.NodeJs=1]=`NodeJs`,e}({}),u=function(e){return e[e.UsePrevious=0]=`UsePrevious`,e[e.UseNext=1]=`UseNext`,e[e.UseNone=2]=`UseNone`,e}({}),d=function(e){return e[e.Minimum=0]=`Minimum`,e[e.Everything=1]=`Everything`,e[e.Manual=2]=`Manual`,e}({}),f=function(e){return e[e.NoAction=0]=`NoAction`,e[e.IgnoreTimelineOnly=1]=`IgnoreTimelineOnly`,e[e.ModelTransformRequired=2]=`ModelTransformRequired`,e}({}),p=function(e){return e[e.Down=0]=`Down`,e[e.Up=1]=`Up`,e[e.Same=2]=`Same`,e}({}),m=function(e){return e[e.ChangeBased=0]=`ChangeBased`,e[e.OpenVsClose=1]=`OpenVsClose`,e}({}),h=function(e){return e[e.OHLC=0]=`OHLC`,e[e.Line=1]=`Line`,e[e.Candlestick=2]=`Candlestick`,e[e.Area=3]=`Area`,e[e.Column=4]=`Column`,e[e.Dots=5]=`Dots`,e[e.HLC=6]=`HLC`,e[e.HL=7]=`HL`,e[e.Ribbon=8]=`Ribbon`,e[e.Step=9]=`Step`,e[e.HollowCandles=10]=`HollowCandles`,e[e.HeikinAshi=11]=`HeikinAshi`,e[e.ElderImpulseSystem=12]=`ElderImpulseSystem`,e[e.Renko=13]=`Renko`,e[e.Range=14]=`Range`,e[e.LineBreak=15]=`LineBreak`,e[e.Kagi=16]=`Kagi`,e[e.PointAndFigure=17]=`PointAndFigure`,e[e.Baseline=18]=`Baseline`,e[e.PercentChange=19]=`PercentChange`,e[e.MultiColumn=20]=`MultiColumn`,e[e.StackedColumn=21]=`StackedColumn`,e}({}),g=function(e){return e[e.Tick=0]=`Tick`,e[e.Intraday=1]=`Intraday`,e[e.Day=2]=`Day`,e[e.Week=3]=`Week`,e[e.Month=4]=`Month`,e[e.Quarter=5]=`Quarter`,e[e.Year=6]=`Year`,e}({}),_=function(e){return e[e.None=0]=`None`,e[e.Nearest=1]=`Nearest`,e[e.Continue=2]=`Continue`,e[e.PerCount=3]=`PerCount`,e[e.PerVolume=4]=`PerVolume`,e[e.PerRange=5]=`PerRange`,e[e.PerSeconds=6]=`PerSeconds`,e[e.TopOfBook=7]=`TopOfBook`,e}({}),v=function(e){return e[e.Number=0]=`Number`,e[e.String=1]=`String`,e[e.Date=2]=`Date`,e}({}),y=function(e){return e[e.FromMetaData=0]=`FromMetaData`,e[e.AsInteger=1]=`AsInteger`,e[e.UseMetricUnit=2]=`UseMetricUnit`,e[e.AsPercent=3]=`AsPercent`,e}({}),b=function(e){return e[e.Common=0]=`Common`,e[e.Study=1]=`Study`,e[e.BalanceSheet=2]=`BalanceSheet`,e[e.IncomeStatement=3]=`IncomeStatement`,e[e.Forward=4]=`Forward`,e[e.Seasonal=5]=`Seasonal`,e[e.Event=6]=`Event`,e[e.Option=7]=`Option`,e}({}),x=function(e){return e[e.None=0]=`None`,e[e.Value=1]=`Value`,e[e.Percent=2]=`Percent`,e}({}),S=function(e){return e[e.Linear=0]=`Linear`,e[e.Logarithmic=1]=`Logarithmic`,e}({}),C=function(e){return e[e.Symbol=0]=`Symbol`,e[e.Expression=1]=`Expression`,e[e.Study=2]=`Study`,e[e.Forward=3]=`Forward`,e[e.BalanceSheet=4]=`BalanceSheet`,e[e.IncomeStatement=5]=`IncomeStatement`,e[e.Seasonal=6]=`Seasonal`,e}({}),w=function(e){return e[e.Normal=0]=`Normal`,e[e.Forward=1]=`Forward`,e[e.HistoricalForward=2]=`HistoricalForward`,e[e.Study=3]=`Study`,e[e.BalanceSheet=4]=`BalanceSheet`,e[e.IncomeStatement=5]=`IncomeStatement`,e[e.Events=6]=`Events`,e[e.Options=7]=`Options`,e}({}),T=function(e){return e[e.Left=0]=`Left`,e[e.Center=1]=`Center`,e[e.Right=2]=`Right`,e}({}),ee=function(e){return e[e.Arrow=0]=`Arrow`,e[e.Crosshair=1]=`Crosshair`,e[e.Move=2]=`Move`,e[e.Hand=3]=`Hand`,e[e.ResizeVertical=4]=`ResizeVertical`,e[e.Grabbing=5]=`Grabbing`,e[e.ResizeHorizontal=6]=`ResizeHorizontal`,e}({}),E=function(e){return e[e.NotApplicable=0]=`NotApplicable`,e[e.Left=1]=`Left`,e[e.Middle=2]=`Middle`,e[e.Right=3]=`Right`,e}({}),D=function(e){return e[e.Shift=0]=`Shift`,e[e.Alt=1]=`Alt`,e[e.Control=2]=`Control`,e[e.Meta=3]=`Meta`,e}({}),te=function(e){return e[e.None=0]=`None`,e[e.Horizontal=1]=`Horizontal`,e[e.Vertical=2]=`Vertical`,e[e.Both=3]=`Both`,e}({}),ne=function(e){return e[e.Unspecified=0]=`Unspecified`,e[e.GBE=1]=`GBE`,e[e.cmdtyView=2]=`cmdtyView`,e[e.DemoSite=3]=`DemoSite`,e[e.InternalFeed=4]=`InternalFeed`,e[e.Widget=5]=`Widget`,e[e.FreeWidget=6]=`FreeWidget`,e[e.EqPlus=7]=`EqPlus`,e}({}),re=function(e){return e[e.Unspecified=0]=`Unspecified`,e[e.Head=1]=`Head`,e[e.Tail=2]=`Tail`,e}({}),ie=function(e){return e[e.wheel=0]=`wheel`,e[e[`wheel+shift`]=1]=`wheel+shift`,e[e.none=2]=`none`,e}({}),ae=function(e){return e[e.Page=0]=`Page`,e[e.Application=1]=`Application`,e}({}),O=function(e){return e[e.None=0]=`None`,e[e.Created=1]=`Created`,e[e.Deleted=2]=`Deleted`,e[e.Moved=3]=`Moved`,e[e.PointMoved=4]=`PointMoved`,e[e.TextChanged=5]=`TextChanged`,e[e.Undo=6]=`Undo`,e[e.Redo=7]=`Redo`,e[e.Cancelled=8]=`Cancelled`,e[e.Executed=9]=`Executed`,e[e.Reordered=10]=`Reordered`,e}({}),oe=function(e){return e[e.None=0]=`None`,e[e.Min=1]=`Min`,e[e.Max=2]=`Max`,e}({});function se(e,t){return function(...n){return e.apply(this,[t,...n])}}function ce(e,t,n){return function(...r){return e.apply(this,[t,n,...r])}}function le(...e){let t=e?e.length:0,n=this;return function(...r){let i=0,a=t?e[i].apply(n,r):r[0];for(;++i<t;)a=e[i].call(n,a);return a}}function ue(e){return e}function de(e){return e!==null}function fe(e){let t=new Map;return(...n)=>{let r=JSON.stringify(n);return t.has(r)||t.set(r,e(...n).catch(e=>(t.delete(r),Promise.reject(e)))),t.get(r)}}function pe(e){return e.reduce((e,t)=>e+t,0)}function me(e){let t=e.length;return t>0?pe(e)/t:0}function k(e){return e.every(e=>e!==null)}function he(e,t){return Array.from(Array(t)).map((t,n)=>n+e)}function A(e,t){let n=[],r=[];return e.forEach(e=>{t(e)?n.push(e):r.push(e)}),{yes:n,no:r}}function ge(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e===t)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}function _e(e,t){let n=ve(e,t);return n===-1?null:e[n]}function ve(e,t){if(e.length<1)return-1;for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function ye(e,t){let n=e?e.slice():[];return t.forEach(e=>{n.includes(e)||n.push(e)}),n}function j(e,t){return e.filter(e=>!t.includes(e))}function be(e,t,n=ue){let r=[];return e.forEach(e=>{let i=n(e);!r.map(n).includes(i)&&t.map(n).includes(i)&&r.push(e)}),r}function xe(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function Se(e){if(!(e.length<1))return e[0]}function Ce(e,t,n=null){if(e.length<1)return-1;let r=Number.isFinite(n)&&n<e.length?n:e.length-1;for(let n=r;n>=0;--n)if(t(e[n]))return n;return-1}var we=(e,t)=>e[t];function Te(e,t,n=e=>e,r=we,i=0,a=e.length-1){let o=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN;for(;i<a;){let s=i+a>>>1;o(n(r(e,s)),t)<0?i=s+1:a=s}return i}function Ee(e,t=0,n=e.length-1,r=(e,t)=>e){if(t<0||n>=e.length)return[null,null];let i=null,a=null;for(let o=t;o<=n;o++){let t=r(e[o],o);t!=null&&t>=t&&(i==null?i=a=t:(i>t&&(i=t),a<t&&(a=t)))}return[i,a]}function De(e,t){return Array.from({length:e},(e,n)=>t(n))}function M(e,t){let n=P;if(!n(e)||!n(t))return;let[r,i]=e,[a,o]=t;(n(a,r)&&r<a||n(r)&&!n(a))&&(t[0]=r),(n(o,i)&&i>o||n(i)&&!n(o))&&(t[1]=i)}function Oe(e){let t=[];for(let n of e)t.includes(n)||t.push(n);return t}function ke(e,t){return Math.min(Math.max(t,0),e.length-1)}function Ae(e,t){return e[t%e.length]}function je(e,t){let n=e.length;for(let r=1;r<n;++r){let n=e[r],i=r-1;for(;i>=0&&t(e[i],n);)e[i+1]=e[i],--i;e[i+1]=n}}var Me=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Ne=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Me[n[e]&63];return t};function Pe(e,t,n){if(n===void 0||+n==0)return Math[e](t);if(t=+t,n=+n,isNaN(t)||!(typeof n==`number`&&n%1==0))return NaN;let r=t.toString().split(`e`),i=Math[e](+(r[0]+`e`+(r[1]?+r[1]-n:-n))).toString().split(`e`);return+(i[0]+`e`+(i[1]?+i[1]+n:n))}var Fe=null;function Ie(){return Fe===null&&(Fe=`ontouchstart`in globalThis),Fe}function Le(e,t){return e===`Backspace`||e===`Delete`||t===8||t===46}function Re(e,t){return e===`Escape`||t===27}function ze(e,t){return e===`F2`||t===113}function Be(e,t){return e===`ArrowLeft`||t===37}function Ve(e,t){return e===`ArrowRight`||t===39}function He(e,t){return e===`z`||t===90}function Ue(e,t){return e===`r`||t===82}function We(e,t){return e===`y`||t===89}function Ge(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function Ke(e,t=100){return Je(t=>Ge(e,t),t)}function qe(e,t=100){return Ye(t=>Ge(e,t),t)}function Je(e,t){let n=null;return function(...r){let i=this;clearTimeout(n),n=setTimeout(function(){e.apply(i,r)},t)}}function Ye(e,t){let n=!1;return function(...r){if(!n){let i=this;e.apply(i,r),n=!0,setTimeout(function(){n=!1},t)}}}function N(e){return e!=null}function P(...e){return e.every(e=>e!=null)}function Xe(e,t){return Pe(`round`,e,-t)}function Ze(e){return P(e)&&Number.isFinite(e)}function Qe(e){let t=e===`both`;return[t||e===`vertical`,t||e===`horizontal`]}function $e(e,t){let n=e=>typeof e==`boolean`,r=e=>P(e)&&n(e)&&e,i=r(e),a=r(t);return i&&a?`both`:i?`vertical`:a?`horizontal`:`none`}function et(e,t,n){return t.includes(e)?e:n}function tt(e,t){return P(e)?e:t}function nt(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function rt(e,t,...n){if(!P(e))return t;let r=e;for(let e of n){if(!P(r)||!nt(r,e))return t;r=r[e]}return r}function it(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function at(e){return it(e)}function ot(e){Object.keys(e).forEach(t=>!P(e[t])&&delete e[t])}function F(e){return e==null?e:JSON.parse(JSON.stringify(e))}function st(e){return Object.assign({},e)}function ct(e,t,n=!0){let r=Object.keys(t),i=Object.keys(e),a=e=>n?i.includes(e):!0;for(let n of r)if(a(n)){let r=e[n];r===void 0||typeof r!=`object`||Array.isArray(r)?e[n]=t[n]:lt(e[n],t[n])}}function lt(e,t){ct(e,t)}function ut(e,t){let n=Object.keys(t);for(let r of n)e[r]=e[r]||t[r]}function dt(e=[]){return e.reduce((e,t)=>(e[t.name]=t.value,e),{})}function ft(e){return Object.keys(e).map(t=>({name:t,value:e[t]}))}function pt(e){return e?new Date(e):null}function mt(e){let t=``;for(let n in e){let r=`${n}=${encodeURIComponent(e[n])}`;t+=(t.length>0?`&`:``)+r}return t}function ht(e,t){ct(e,t,!1)}var gt=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,_t=[1e3,60,60,24,7,30/7,12];function vt(e){let t=gt.exec(e);if(!P(t))return null;let n=t.slice(2,9).map(e=>P(e)?parseFloat(e):0).reverse();return _t.forEach((e,t)=>{for(let r=t;r<n.length;r++)n[r]=n[r]*e}),Math.floor(pe(n))}function yt(e,t,n,r){let i=e,a=t;return i===0||a===0?(i=n,a=i/2):i>r?(a=r/i*a,i=r):i<n&&(a=n/i*a,i=n),[i,a]}function bt(){return Ne(12)}function xt(e,t,n){return Math.min(Math.max(n,e),t)}function I(e,t=`info`,...n){let r=globalThis.console;r[r[t]===void 0?`log`:t](e,...n)}function St(e){return typeof e==`number`&&!isNaN(e)}function Ct(e){return typeof e==`number`&&!isNaN(e)&&(e|0)===e}function wt(e){return typeof e==`string`}function Tt(e){return e instanceof Date}function Et(e){return e instanceof RegExp}function Dt(e){return typeof e==`function`}function Ot(e){return Array.isArray(e)}function kt(e){return typeof e==`boolean`}function At(e,t,n,r,i){n===String?wt(e)||jt(t,`string`,i):n===Number?St(e)||jt(t,`number`,i):n===Function?Dt(e)||jt(t,`function`,i):n===Boolean?kt(e)||jt(t,`boolean`,i):n===Date?Tt(e)||jt(t,`date`,i):n===RegExp?Et(e)||jt(t,`RegExp`,i):n===Array?Ot(e)||jt(t,`array`,i):e instanceof(n||Object)||jt(t,r,i)}function jt(e,t,n){let r;throw r=typeof n==`number`?`The argument [ ${e||`unspecified`} ], at index [ ${n.toString()} ] must be a [ ${t||`unknown`} ]`:`The argument [ ${e||`unspecified`} ] must be a [ ${t||`Object`} ]`,Error(r)}function Mt(e,t){throw Error(`The argument [ ${e||`unspecified`} ] failed a validation check [ ${t||`No description available`} ]`)}function Nt(e,t,n,r){At(e,t,n,r)}function Pt(e,t,n,r,i,a){e!=null&&(At(e,t,n,r),Dt(i)&&!i(e)&&Mt(t,a))}function Ft(e,t,n,r){n(e)||Mt(t,r)}var It={};It.camel={},It.camel.violations=/\b[A-Z]/g;function Lt(e,t,n){if(Nt(e,`s`,String),Nt(t,`length`,Number),Nt(n,`character`,String),n.length!==1)throw Error(`The "character" argument must be one character in length.`);return n.repeat(t-e.length)+e}var Rt=new Map,zt=class e{#e;#t;#n;constructor(t,n,r){Nt(t,`code`,String),Nt(n,`description`,String),Pt(r,`mapping`,Number),St(r)&&Ft(r,`mapping`,Ct,`must be an integer`),this.#e=t,this.#t=n,St(r)?this.#n=r:this.#n=null;let i=this.constructor;Rt.has(i)||Rt.set(i,[]),e.fromCode(i,this.#e)===null&&(this.#n===null||e.fromMapping(i,this.#n)===null)&&Rt.get(i).push(this)}get code(){return this.#e}get description(){return this.#t}get mapping(){return this.#n}equals(t){return t===this||t instanceof e&&t.constructor===this.constructor&&t.code===this.code}toJSON(){return this.code}static fromCode(t,n){return e.getItems(t).find(e=>e.code===n)||null}static fromMapping(t,n){return n===null?null:e.getItems(t).find(e=>e.mapping===n)||null}static getItems(e){return Rt.get(e)||[]}toString(){return`[Enum]`}},Bt=class e extends zt{#e;constructor(e,t,n){super(e,t),this.#e=n}get id(){return this.#e}toJSON(){return this.#e}static parse(t){return zt.fromCode(e,t)}static fromId(t){return zt.getItems(e).find(e=>e.id===t)||null}static get STOCK(){return Vt}static get STOCK_OPTION(){return Ht}static get FUTURE(){return Ut}static get FUTURE_OPTION(){return Wt}static get FOREX(){return Gt}static get CMDTY_STATS(){return Kt}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}},Vt=new Bt(`STK`,`U.S. Equity`,1),Ht=new Bt(`STKOPT`,`Equity Option`,34),Ut=new Bt(`FUT`,`Future`,2),Wt=new Bt(`FUTOPT`,`Future Option`,12),Gt=new Bt(`FOREX`,`FOREX`,10),Kt=new Bt(`CMDTY`,`cmdtyStats`,24),qt={F:`A`,G:`B`,H:`C`,J:`D`,K:`E`,M:`I`,N:`L`,Q:`O`,U:`P`,V:`R`,X:`S`,Z:`T`},Jt={A:`F`,B:`G`,C:`H`,D:`J`,E:`K`,I:`M`,L:`N`,O:`Q`,P:`U`,R:`V`,S:`X`,T:`Z`},Yt={F:1,G:2,H:3,J:4,K:5,M:6,N:7,Q:8,U:9,V:10,X:11,Z:12},Xt={bats:/^(.*)\.BZ$/i,percent:/(\.RT)$/,pit:/\(P(it)?\)/},L={bids:/^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i,c3:{alias:/^(C3:)(.*)$/i,concrete:/(\.C3)$/i},cmdty:{stats:/(\.CS)$/i,internal:/(\.CM)$/i,external:/(\.CP)$/i},crypto:/^\^([A-Z]{3})([A-Z]{3,4})$/i,equities:{options:/^([A-Z$][A-Z-]{0,}(\.[A-Z]{1})?)([0-9]?)(\.[A-Z]{2})?\|([0-9]{4})([0-9]{2})([0-9]{2})\|([0-9]+\.[0-9]+)[P|W]?(C|P)/i},forex:/^\^([A-Z]{3})([A-Z]{3})$/i,funds:{canadian:/(.*)(\.CF)$/i},futures:{alias:/^([A-Z][A-Z0-9$!.-]{0,2})(\*{1})([0-9]{1,2})$/i,concrete:/^([A-Z][A-Z0-9$!.-]{0,3})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,spread:/^_S_/i,cash:/(.*)(Y00)$/,options:{historical:/^([A-Z][A-Z0-9$!.-]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,long:/^([A-Z][A-Z0-9$!.-]{0,2})([A-Z])([0-9]{1,4})\|(-?[0-9]{1,5})(C|P)$/i,short:/^([A-Z][A-Z0-9$!.-]?)([A-Z])([0-9]{1,4})([A-Z])$/i}},indicies:{external:/^\$(.*)$/i,sector:/^-(.*)$/i},platts:{alias:/^(PLATTS:)(.*)$/i,concrete:/^(.*)(\.PT)$/i}};function Zt(){return new Date().getMonth()+1}function Qt(){return new Date().getFullYear()}function $t(e,t){let n=e.toString();return n.substring(n.length-t,n.length)}function en(e){return Jt[e]||e}function tn(e,t){let n=Qt(),r=parseInt(e);if(r===0&&t===`Y`)r=Math.floor(n/100)*100+100;else if(r<10&&e.length===1){let e=+(r<n%10);r=Math.floor(n/10)*10+r+e*10}else r<100&&(r=Math.floor(n/100)*100+r,n+25<r&&(r-=100));return r}function nn(e){return e===`call`?`C`:e===`put`?`P`:null}var rn=class e{static getIsConcrete(t){return wt(t)&&!e.getIsReference(t)}static getIsReference(e){return wt(e)&&L.futures.alias.test(e)}static getIsFuture(e){return wt(e)&&(L.futures.concrete.test(e)||L.futures.alias.test(e))}static getIsCash(t){return e.getIsFuture(t)&&L.futures.cash.test(t)}static getIsFutureSpread(e){return wt(e)&&L.futures.spread.test(e)}static getIsFutureOption(e){return wt(e)&&(L.futures.options.short.test(e)||L.futures.options.long.test(e)||L.futures.options.historical.test(e))}static getIsForex(e){return wt(e)&&L.forex.test(e)}static getIsCrypto(e){return wt(e)&&L.crypto.test(e)}static getIsIndex(e){return wt(e)&&L.indicies.external.test(e)}static getIsSector(e){return wt(e)&&L.indicies.sector.test(e)}static getIsCanadianFund(e){return wt(e)&&L.funds.canadian.test(e)}static getIsCmdty(e){return wt(e)&&(L.cmdty.stats.test(e)||L.cmdty.internal.test(e)||L.cmdty.external.test(e))}static getIsCmdtyStats(e){return wt(e)&&L.cmdty.stats.test(e)}static getIsBats(e){return wt(e)&&Xt.bats.test(e)}static getIsEquityOption(e){return wt(e)&&L.equities.options.test(e)}static getIsExpired(t){let n=e.parseInstrumentType(t);if(n!==null&&n.year&&n.month){let e=Qt();if(n.year<e)return!0;if(n.year===e&&Object.hasOwn(Yt,n.month))return Zt()>Yt[n.month]}return!1}static getIsC3(e){return wt(e)&&(L.c3.concrete.test(e)||L.c3.alias.test(e))}static getIsPlatts(e){return wt(e)&&(L.platts.concrete.test(e)||L.platts.alias.test(e))}static getIsPit(e,t){return wt(e)&&wt(t)&&Xt.pit.test(t)}static getIsGrainBid(e){return wt(e)&&L.bids.test(e)}static parseInstrumentType(e){if(!wt(e))return null;for(let t of an){let n=t(e);if(n!==null)return n}return null}static getProducerSymbol(e){if(!wt(e))return null;for(let t of on){let n=t(e);if(n!==null)return n}return null}static getFuturesOptionPipelineFormat(t){let n=e.parseInstrumentType(t);if(n.type===`future_option`){let e=nn(n.option_type);return`${n.root}${n.month}${$t(n.year,1)}|${n.strike}${e}`}return null}static getFuturesExplicitFormat(t){if(e.getIsFuture(t)&&e.getIsConcrete(t)){let n=e.parseInstrumentType(t);return`${n.root}${n.month}${Lt(Math.floor(n.year%100).toString(),2,`0`)}`}return null}static getFuturesYear(e,t){return tn(e,t)}static displayUsingPercent(e){return wt(e)&&Xt.percent.test(e)}toString(){return`[SymbolParser]`}},an=[e=>L.futures.spread.test(e)?{symbol:e,type:`future_spread`}:null,e=>{let t=e.match(L.futures.concrete);return t===null?null:{symbol:e,type:`future`,asset:Bt.FUTURE,dynamic:!1,root:t[1],month:t[2],year:tn(t[3],t[2])}},e=>{let t=e.match(L.futures.alias);return t===null?null:{symbol:e,type:`future`,asset:Bt.FUTURE,dynamic:!0,root:t[1],dynamicCode:t[3]}},e=>L.forex.test(e)?{symbol:e,type:`forex`,asset:Bt.FOREX}:null,e=>{let t=e.match(L.equities.options);if(t!==null){let n=t[4]===void 0?``:t[4];return{symbol:e,type:`equity_option`,asset:Bt.STOCK_OPTION,option_type:t[9]===`C`?`call`:`put`,strike:parseFloat(t[8]),root:`${t[1]}${n}`,month:parseInt(t[6]),day:parseInt(t[7]),year:parseInt(t[5]),adjusted:t[3]!==``}}return null},e=>L.indicies.external.test(e)?{symbol:e,type:`index`}:null,e=>L.indicies.sector.test(e)?{symbol:e,type:`sector`}:null,e=>{let t=e.match(L.futures.options.short);if(t!==null){let n=t[4].charCodeAt(0),r=n<80;return{symbol:e,type:`future_option`,asset:Bt.FUTURE_OPTION,option_type:r?`call`:`put`,strike:parseInt(t[3]),root:t[1],month:t[2],year:Qt()+n-(r?67:80)}}return null},e=>{let t=e.match(L.futures.options.long)||e.match(L.futures.options.historical);return t===null?null:{symbol:e,type:`future_option`,asset:Bt.FUTURE_OPTION,option_type:t[5]===`C`?`call`:`put`,strike:parseInt(t[4]),root:t[1],month:en(t[2]),year:tn(t[3])}},e=>L.cmdty.stats.test(e)?{symbol:e,type:`cmdtyStats`,asset:Bt.CMDTY_STATS}:null],on=[e=>{if(rn.getIsFuture(e)&&rn.getIsConcrete(e)){let t=e.match(L.futures.concrete);if(t!==null){let e=t[1],n=t[2],r=tn(t[3],n);if(r>Qt()+9){let t=qt[n];if(t)return`${e}${t}${$t(r,1)}`}}}return null},e=>rn.getIsFuture(e)&&rn.getIsConcrete(e)&&e.replace(/(.{1,4})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,`$1$2$4`)||null,e=>{if(rn.getIsFutureOption(e)){let t=rn.parseInstrumentType(e),n=nn(t.option_type);if(t.root.length<3){let e=n.charCodeAt(0);return`${t.root}${t.month}${t.strike}${String.fromCharCode(e+t.year-Qt())}`}return`${t.root}${t.month}${$t(t.year,1)}|${t.strike}${n}`}return null},e=>L.c3.alias.test(e)?e.replace(L.c3.alias,`$2.C3`):null,e=>L.platts.alias.test(e)?e.replace(L.platts.alias,`$2.PT`):null,e=>e],sn=o(((e,t)=>{t.exports=(()=>{let e={},t={};function n(n,r,i){e[n]=r,t[n]=i}return n(`F`,`January`,1),n(`G`,`February`,2),n(`H`,`March`,3),n(`J`,`April`,4),n(`K`,`May`,5),n(`M`,`June`,6),n(`N`,`July`,7),n(`Q`,`August`,8),n(`U`,`September`,9),n(`V`,`October`,10),n(`X`,`November`,11),n(`Z`,`December`,12),n(`Y`,`Cash`,0),{getCodeToNameMap:()=>Object.assign({},e),getCodeToNumberMap:()=>Object.assign({},t)}})()}));function cn(e){"@babel/helpers - typeof";return cn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},cn(e)}function ln(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function R(e,t){if(t.length<e)throw TypeError(e+` argument`+(e>1?`s`:``)+` required, but only `+t.length+` present`)}function z(e){R(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||cn(e)===`object`&&t===`[object Date]`?new Date(e.getTime()):typeof e==`number`||t===`[object Number]`?new Date(e):((typeof e==`string`||t===`[object String]`)&&typeof console<`u`&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(Error().stack)),new Date(NaN))}function un(e,t){R(2,arguments);var n=z(e),r=ln(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function dn(e,t){R(2,arguments);var n=z(e),r=ln(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var i=n.getDate(),a=new Date(n.getTime());return a.setMonth(n.getMonth()+r+1,0),i>=a.getDate()?a:(n.setFullYear(a.getFullYear(),a.getMonth(),i),n)}function fn(e,t){if(R(2,arguments),!t||cn(t)!==`object`)return new Date(NaN);var n=t.years?ln(t.years):0,r=t.months?ln(t.months):0,i=t.weeks?ln(t.weeks):0,a=t.days?ln(t.days):0,o=t.hours?ln(t.hours):0,s=t.minutes?ln(t.minutes):0,c=t.seconds?ln(t.seconds):0,l=z(e),u=r||n?dn(l,r+n*12):l,d=a||i?un(u,a+i*7):u,f=(c+(s+o*60)*60)*1e3;return new Date(d.getTime()+f)}function pn(e,t){R(2,arguments);var n=z(e).getTime(),r=ln(t);return new Date(n+r)}var mn={};function hn(){return mn}function gn(e,t){var n;R(1,arguments);var r=hn(),i=ln(t?.weekStartsOn??(t==null||(n=t.locale)==null?void 0:n.options?.weekStartsOn)??r.weekStartsOn??r.locale?.options?.weekStartsOn??0);if(!(i>=0&&i<=6))throw RangeError(`weekStartsOn must be between 0 and 6 inclusively`);var a=z(e),o=a.getDay(),s=(o<i?7:0)+o-i;return a.setDate(a.getDate()-s),a.setHours(0,0,0,0),a}function _n(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function vn(e){R(1,arguments);var t=z(e);return t.setHours(0,0,0,0),t}var yn=864e5;function bn(e,t){R(2,arguments);var n=vn(e),r=vn(t),i=n.getTime()-_n(n),a=r.getTime()-_n(r);return Math.round((i-a)/yn)}var xn=6e4;function Sn(e,t){return R(2,arguments),pn(e,ln(t)*xn)}function Cn(e,t){return R(2,arguments),dn(e,ln(t)*3)}function wn(e,t){return R(2,arguments),pn(e,ln(t)*1e3)}function Tn(e,t){return R(2,arguments),un(e,ln(t)*7)}function En(e,t){return R(2,arguments),dn(e,ln(t)*12)}function Dn(e,t){R(2,arguments);var n=z(e),r=z(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}var On=365.2425,kn=10**8*24*60*60*1e3,An=6e4,jn=36e5;-kn;var Mn=3600*24;Mn*7,Mn*On/12*3;function Nn(e,t){R(2,arguments);var n=vn(e),r=vn(t);return n.getTime()===r.getTime()}function Pn(e){return R(1,arguments),e instanceof Date||cn(e)===`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Fn(e){if(R(1,arguments),!Pn(e)&&typeof e!=`number`)return!1;var t=z(e);return!isNaN(Number(t))}function In(e,t){R(2,arguments);var n=z(e),r=z(t),i=n.getFullYear()-r.getFullYear(),a=n.getMonth()-r.getMonth();return i*12+a}function Ln(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getFullYear()-r.getFullYear()}function Rn(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function zn(e,t){R(2,arguments);var n=z(e),r=z(t),i=Rn(n,r),a=Math.abs(bn(n,r));n.setDate(n.getDate()-i*a);var o=i*(a-Number(Rn(n,r)===-i));return o===0?0:o}function Bn(e,t){return R(2,arguments),z(e).getTime()-z(t).getTime()}var Vn={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},Hn=`trunc`;function Un(e){return e?Vn[e]:Vn[Hn]}function Wn(e,t,n){R(2,arguments);var r=Bn(e,t)/jn;return Un(n?.roundingMethod)(r)}function Gn(e,t,n){R(2,arguments);var r=Bn(e,t)/An;return Un(n?.roundingMethod)(r)}function Kn(e){R(1,arguments);var t=z(e);return t.setHours(23,59,59,999),t}function qn(e){R(1,arguments);var t=z(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Jn(e){R(1,arguments);var t=z(e);return Kn(t).getTime()===qn(t).getTime()}function Yn(e,t){R(2,arguments);var n=z(e),r=z(t),i=Dn(n,r),a=Math.abs(In(n,r)),o;if(a<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*a);var s=Dn(n,r)===-i;Jn(z(e))&&a===1&&Dn(e,r)===1&&(s=!1),o=i*(a-Number(s))}return o===0?0:o}function Xn(e,t,n){R(2,arguments);var r=Bn(e,t)/1e3;return Un(n?.roundingMethod)(r)}function Zn(e,t){R(2,arguments);var n=z(e),r=z(t),i=Dn(n,r),a=Math.abs(Ln(n,r));n.setFullYear(1584),r.setFullYear(1584);var o=Dn(n,r)===-i,s=i*(a-Number(o));return s===0?0:s}function Qn(e){R(1,arguments);var t=z(e);return t.setSeconds(0,0),t}function $n(e){R(1,arguments);var t=z(e),n=t.getMonth(),r=n-n%3;return t.setMonth(r,1),t.setHours(0,0,0,0),t}function er(e){R(1,arguments);var t=z(e);return t.setDate(1),t.setHours(0,0,0,0),t}function tr(e){R(1,arguments);var t=z(e),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(23,59,59,999),t}function nr(e){R(1,arguments);var t=z(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function rr(e,t){return R(2,arguments),pn(e,-ln(t))}var ir=864e5;function ar(e){R(1,arguments);var t=z(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=n-t.getTime();return Math.floor(r/ir)+1}function or(e){R(1,arguments);var t=1,n=z(e),r=n.getUTCDay(),i=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}function sr(e){R(1,arguments);var t=z(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var i=or(r),a=new Date(0);a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0);var o=or(a);return t.getTime()>=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function cr(e){R(1,arguments);var t=sr(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),or(n)}var lr=6048e5;function ur(e){R(1,arguments);var t=z(e),n=or(t).getTime()-cr(t).getTime();return Math.round(n/lr)+1}function dr(e,t){var n;R(1,arguments);var r=hn(),i=ln(t?.weekStartsOn??(t==null||(n=t.locale)==null?void 0:n.options?.weekStartsOn)??r.weekStartsOn??r.locale?.options?.weekStartsOn??0);if(!(i>=0&&i<=6))throw RangeError(`weekStartsOn must be between 0 and 6 inclusively`);var a=z(e),o=a.getUTCDay(),s=(o<i?7:0)+o-i;return a.setUTCDate(a.getUTCDate()-s),a.setUTCHours(0,0,0,0),a}function fr(e,t){var n;R(1,arguments);var r=z(e),i=r.getUTCFullYear(),a=hn(),o=ln(t?.firstWeekContainsDate??(t==null||(n=t.locale)==null?void 0:n.options?.firstWeekContainsDate)??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1);if(!(o>=1&&o<=7))throw RangeError(`firstWeekContainsDate must be between 1 and 7 inclusively`);var s=new Date(0);s.setUTCFullYear(i+1,0,o),s.setUTCHours(0,0,0,0);var c=dr(s,t),l=new Date(0);l.setUTCFullYear(i,0,o),l.setUTCHours(0,0,0,0);var u=dr(l,t);return r.getTime()>=c.getTime()?i+1:r.getTime()>=u.getTime()?i:i-1}function pr(e,t){var n;R(1,arguments);var r=hn(),i=ln(t?.firstWeekContainsDate??(t==null||(n=t.locale)==null?void 0:n.options?.firstWeekContainsDate)??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1),a=fr(e,t),o=new Date(0);return o.setUTCFullYear(a,0,i),o.setUTCHours(0,0,0,0),dr(o,t)}var mr=6048e5;function hr(e,t){R(1,arguments);var n=z(e),r=dr(n,t).getTime()-pr(n,t).getTime();return Math.round(r/mr)+1}function gr(e,t){for(var n=e<0?`-`:``,r=Math.abs(e).toString();r.length<t;)r=`0`+r;return n+r}var _r={y:function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return gr(t===`yy`?r%100:r,t.length)},M:function(e,t){var n=e.getUTCMonth();return t===`M`?String(n+1):gr(n+1,2)},d:function(e,t){return gr(e.getUTCDate(),t.length)},a:function(e,t){var n=e.getUTCHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h:function(e,t){return gr(e.getUTCHours()%12||12,t.length)},H:function(e,t){return gr(e.getUTCHours(),t.length)},m:function(e,t){return gr(e.getUTCMinutes(),t.length)},s:function(e,t){return gr(e.getUTCSeconds(),t.length)},S:function(e,t){var n=t.length,r=e.getUTCMilliseconds();return gr(Math.floor(r*10**(n-3)),t.length)}},vr={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},yr={G:function(e,t,n){var r=+(e.getUTCFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){var r=e.getUTCFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:`year`})}return _r.y(e,t)},Y:function(e,t,n,r){var i=fr(e,r),a=i>0?i:1-i;return t===`YY`?gr(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):gr(a,t.length)},R:function(e,t){return gr(sr(e),t.length)},u:function(e,t){return gr(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return gr(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return gr(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case`M`:case`MM`:return _r.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case`L`:return String(r+1);case`LL`:return gr(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){var i=hr(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):gr(i,t.length)},I:function(e,t,n){var r=ur(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):gr(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getUTCDate(),{unit:`date`}):_r.d(e,t)},D:function(e,t,n){var r=ar(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):gr(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){var i=e.getUTCDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return gr(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){var i=e.getUTCDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return gr(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){var r=e.getUTCDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return gr(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){var r=e.getUTCHours(),i=r===12?vr.noon:r===0?vr.midnight:r/12>=1?`pm`:`am`;switch(t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){var r=e.getUTCHours(),i=r>=17?vr.evening:r>=12?vr.afternoon:r>=4?vr.morning:vr.night;switch(t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){var r=e.getUTCHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:`hour`})}return _r.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getUTCHours(),{unit:`hour`}):_r.H(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):gr(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):gr(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getUTCMinutes(),{unit:`minute`}):_r.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getUTCSeconds(),{unit:`second`}):_r.s(e,t)},S:function(e,t){return _r.S(e,t)},X:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();if(i===0)return`Z`;switch(t){case`X`:return xr(i);case`XXXX`:case`XX`:return Sr(i);default:return Sr(i,`:`)}},x:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();switch(t){case`x`:return xr(i);case`xxxx`:case`xx`:return Sr(i);default:return Sr(i,`:`)}},O:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+br(i,`:`);default:return`GMT`+Sr(i,`:`)}},z:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+br(i,`:`);default:return`GMT`+Sr(i,`:`)}},t:function(e,t,n,r){var i=r._originalDate||e;return gr(Math.floor(i.getTime()/1e3),t.length)},T:function(e,t,n,r){return gr((r._originalDate||e).getTime(),t.length)}};function br(e,t){var n=e>0?`-`:`+`,r=Math.abs(e),i=Math.floor(r/60),a=r%60;if(a===0)return n+String(i);var o=t||``;return n+String(i)+o+gr(a,2)}function xr(e,t){return e%60==0?(e>0?`-`:`+`)+gr(Math.abs(e)/60,2):Sr(e,t)}function Sr(e,t){var n=t||``,r=e>0?`-`:`+`,i=Math.abs(e),a=gr(Math.floor(i/60),2),o=gr(i%60,2);return r+a+n+o}var Cr=function(e,t){switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},wr=function(e,t){switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},Tr={p:wr,P:function(e,t){var n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Cr(e,t);var a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Cr(r,t)).replace(`{{time}}`,wr(i,t))}},Er=[`D`,`DD`],Dr=[`YY`,`YYYY`];function Or(e){return Er.indexOf(e)!==-1}function kr(e){return Dr.indexOf(e)!==-1}function Ar(e,t,n){if(e===`YYYY`)throw RangeError(`Use \`yyyy\` instead of \`YYYY\` (in \`${t}\`) for formatting years to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(e===`YY`)throw RangeError(`Use \`yy\` instead of \`YY\` (in \`${t}\`) for formatting years to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(e===`D`)throw RangeError(`Use \`d\` instead of \`D\` (in \`${t}\`) for formatting days of the month to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(e===`DD`)throw RangeError(`Use \`dd\` instead of \`DD\` (in \`${t}\`) for formatting days of the month to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`)}var jr={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Mr=function(e,t,n){var r,i=jr[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Nr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Pr={date:Nr({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Nr({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Nr({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Fr={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Ir=function(e,t,n,r){return Fr[e]};function Lr(e){return function(t,n){var r=n!=null&&n.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):a;i=e.formattingValues[o]||e.formattingValues[a]}else{var s=e.defaultWidth,c=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[c]||e.values[s]}var l=e.argumentCallback?e.argumentCallback(t):t;return i[l]}}var Rr={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Lr({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Lr({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:function(e){return e-1}}),month:Lr({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Lr({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Lr({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function zr(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;var o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Vr(s,function(e){return e.test(o)}):Br(s,function(e){return e.test(o)}),l=e.valueCallback?e.valueCallback(c):c;l=n.valueCallback?n.valueCallback(l):l;var u=t.slice(o.length);return{value:l,rest:u}}}function Br(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function Vr(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function Hr(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var i=r[0],a=t.match(e.parsePattern);if(!a)return null;var o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;var s=t.slice(i.length);return{value:o,rest:s}}}var Ur={code:`en-US`,formatDistance:Mr,formatLong:Pr,formatRelative:Ir,localize:Rr,match:{ordinalNumber:Hr({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:zr({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:zr({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:function(e){return e+1}}),month:zr({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:zr({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:zr({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Wr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Gr=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Kr=/^'([^]*?)'?$/,qr=/''/g,Jr=/[a-zA-Z]/;function Yr(e,t,n){var r,i;R(2,arguments);var a=String(t),o=hn(),s=n?.locale??o.locale??Ur,c=ln(n?.firstWeekContainsDate??(n==null||(r=n.locale)==null?void 0:r.options?.firstWeekContainsDate)??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1);if(!(c>=1&&c<=7))throw RangeError(`firstWeekContainsDate must be between 1 and 7 inclusively`);var l=ln(n?.weekStartsOn??(n==null||(i=n.locale)==null?void 0:i.options?.weekStartsOn)??o.weekStartsOn??o.locale?.options?.weekStartsOn??0);if(!(l>=0&&l<=6))throw RangeError(`weekStartsOn must be between 0 and 6 inclusively`);if(!s.localize)throw RangeError(`locale must contain localize property`);if(!s.formatLong)throw RangeError(`locale must contain formatLong property`);var u=z(e);if(!Fn(u))throw RangeError(`Invalid time value`);var d=rr(u,_n(u)),f={firstWeekContainsDate:c,weekStartsOn:l,locale:s,_originalDate:u};return a.match(Gr).map(function(e){var t=e[0];if(t===`p`||t===`P`){var n=Tr[t];return n(e,s.formatLong)}return e}).join(``).match(Wr).map(function(r){if(r===`''`)return`'`;var i=r[0];if(i===`'`)return Xr(r);var a=yr[i];if(a)return!(n!=null&&n.useAdditionalWeekYearTokens)&&kr(r)&&Ar(r,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&Or(r)&&Ar(r,t,String(e)),a(d,r,s.localize,f);if(i.match(Jr))throw RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");return r}).join(``)}function Xr(e){var t=e.match(Kr);return t?t[1].replace(qr,`'`):e}var Zr=[`years`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`];function Qr(e,t){if(arguments.length<1)throw TypeError(`1 argument required, but only ${arguments.length} present`);var n=hn(),r=t?.locale??n.locale??Ur,i=t?.format??Zr,a=t?.zero??!1,o=t?.delimiter??` `;return r.formatDistance?i.reduce(function(t,n){var i=`x${n.replace(/(^.)/,function(e){return e.toUpperCase()})}`,o=e[n];return typeof o==`number`&&(a||e[n])?t.concat(r.formatDistance(i,o)):t},[]).join(o):``}function $r(e){return R(1,arguments),z(e).getDay()}function ei(e){R(1,arguments);var t=z(e);return bn(t,nr(t))+1}function ti(e){return R(1,arguments),z(e).getMinutes()}function ni(e){return R(1,arguments),z(e).getFullYear()}function ri(e){R(1,arguments);var t=z(e.start),n=z(e.end);if(isNaN(t.getTime()))throw RangeError(`Start Date is invalid`);if(isNaN(n.getTime()))throw RangeError(`End Date is invalid`);var r={};r.years=Math.abs(Zn(n,t));var i=Dn(n,t),a=fn(t,{years:i*r.years});r.months=Math.abs(Yn(n,a));var o=fn(a,{months:i*r.months});r.days=Math.abs(zn(n,o));var s=fn(o,{days:i*r.days});r.hours=Math.abs(Wn(n,s));var c=fn(s,{hours:i*r.hours});r.minutes=Math.abs(Gn(n,c));var l=fn(c,{minutes:i*r.minutes});return r.seconds=Math.abs(Xn(n,l)),r}function ii(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getTime()>r.getTime()}function ai(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getTime()<r.getTime()}function oi(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getTime()===r.getTime()}function si(e){R(1,arguments);var t=z(e);return t.setMinutes(0,0,0),t}function ci(e,t){R(2,arguments);var n=si(e),r=si(t);return n.getTime()===r.getTime()}function li(e,t,n){R(2,arguments);var r=gn(e,n),i=gn(t,n);return r.getTime()===i.getTime()}function ui(e,t){R(2,arguments);var n=Qn(e),r=Qn(t);return n.getTime()===r.getTime()}function di(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function fi(e,t){R(2,arguments);var n=$n(e),r=$n(t);return n.getTime()===r.getTime()}function pi(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getFullYear()===r.getFullYear()}function mi(e,t){return R(2,arguments),un(e,-ln(t))}function hi(e,t){return R(2,arguments),dn(e,-ln(t))}function gi(e,t){return R(2,arguments),wn(e,-ln(t))}function _i(e,t){return R(2,arguments),En(e,-ln(t))}var vi=c(sn(),1);function yi(e){return rn.parseInstrumentType(e)}async function bi(e){let t=await Wi(e);if(!Array.isArray(t))throw Error(`Invalid server response`);let n=t.find(e=>e.isNearest)?.name||``;return{symbols:t.map(e=>e.name),nearest:n}}var xi=()=>ei(Date.now());function Si(e){let t=fe((t,n)=>e(t));return e=>t(e,xi())}var Ci=Si(bi);async function wi(e){if(!Vi(e))return e;let{root:t,dynamic:n,dynamicCode:r}=yi(e);if(!P(t,n,r))return null;let{symbols:i,nearest:a}=await Ci(t),o=parseInt(r);if(o===0)return a;let s=o-1;return s<i.length?i[s]:null}function Ti(e){return rn.getIsFutureOption(e)}function Ei(e){return rn.getIsFuture(e)}var Di=/^_S_SP_([^_]+)_([^_]+)$/;function Oi(e){let t=e.match(Di);return!t||t.length!==3?!1:Ei(t[1])&&Ei(t[2])}var ki=/^([A-Z]{2}(?:B|P)(?:F|G|H|J|K|M|N|Q|U|V|X|Z))(1[4-9]|[2-9][0-9])([A-Z0-9-]+\.CM)$/;function Ai(e){return ki.test(e)}function ji(e){return rn.getIsEquityOption(e)}function Mi(e){return Ei(e)?`${Gi(e)}Y00`:null}function Ni(e){return Ei(e)?yi(e).month===`Y`:!1}function Pi(e){return String(e%100).padStart(2,`0`)}function Fi(e,t,n,r=!1){return`${e}${t}${r?n:Pi(n)}`}async function Ii(e,t,n){let r=await Ci(e),i=r?.symbols??[];if(i.length===0||!r?.nearest||i.includes(n))return[n,!1];for(let e of i)if(yi(e).month===t)return[e,!0];return[r.nearest,!0]}async function Li(e){let t=await sF(`extras`,`/json/options/?root=${encodeURIComponent(e)}`);try{let n=JSON.parse(t);return Object.values(n?.[e]??{})}catch(t){return I(`Failed to parse futures options response`,`warn`,{root:e,error:t}),[]}}var Ri=Si(Li);async function zi(e){let t=yi(e),n=await Ri(t.root);if(n.length===0||n.some(t=>e in(t.strikes??{})))return[e,!1];let r=n.find(e=>e.month===t.month)??n[0],i=Object.entries(r.strikes??{}),a=t.option_type===`call`?`C`:`P`,o=i.find(([,e])=>e.type===a&&e.strike===t.strike)?.[0]??i.find(([,e])=>e.type===a)?.[0]??i[0]?.[0];return o?[o,o!==e]:[e,!1]}function Bi(e,t=!1){if(!Ei(e))return e;let n=yi(e);return Fi(n.root,n.month,n.year,t)}function Vi(e){let t=yi(e);return P(t)&&t.dynamic===!0}function Hi(e){let t=Ei(e)||Ti(e),n=e.substring(0,2)===`_S_`;return(t||ji(e))&&!n}function Ui(e){return Ei(e)?`America/Chicago`:`America/New_York`}async function Wi(e){let t=await sF(`futures`,`?root=${e}`),n;try{n=JSON.parse(t)}catch(t){return I(`Failed to parse futures contracts response`,`warn`,{root:e,error:t}),[]}return n[e]?n[e].contracts.filter(e=>e.month!==`Y`).sort((e,t)=>e.expires-t.expires).map(t=>({month:t.month,year:t.year,expires:new Date(t.expires),isNearest:t.isnearest,name:`${e}${t.month}${t.year%100}`})):[]}function Gi(e){return Ei(e)?yi(e).root:null}function Ki(e){if(!Ei(e))return null;let t=yi(e),n=vi.default.getCodeToNumberMap()[t.month];return er(new Date(t.year,n-1))}function qi(e,t){let n=yi(e),r=(n.year+t)%100;return`${n.root}${n.month}${Pi(r)}`}function Ji(e,t){let n=ki.exec(e),r=Number.parseInt(n[2]),i=r+(r>79?1900:2e3),a=ni(En(new Date(i,0,1),t));return`${n[1]}${Pi(a)}${n[3]}`}function Yi(e,t){let n=e.match(Di);return`_S_SP_${qi(n[1],t)}_${qi(n[2],t)}`}function Xi(e,t){let n=Ei(e),r=Ai(e),i=Oi(e);return n?qi(e,t):r?Ji(e,t):i?Yi(e,t):null}async function Zi(e){let t=e=>[e,!1,!1],n=Ei(e),r=Ti(e),i=Ai(e),a=Ni(e);if(!n&&!r&&!i||a)return t(e);if(n){let{root:t,month:n}=yi(e);if(Vi(e)){let t=await wi(e);return[t??e,!0,t!==e]}let[r,i]=await Ii(t,n,e);return[r,!0,i]}if(r){let[t,n]=await zi(e);return[t,!1,n]}if(i){let n=ki.exec(e);return t(`${n[1]}${Pi(ni(new Date))}${n[3]}`)}return t(e)}function Qi(e,t){if(!Ei(e))return e;let n=yi(e);return t.find(e=>yi(e).root===n.root)||e}function $i(e){let t=e.getRootNode();return t===document?document.body:t}function ea(e,t=document){let n=na(e,t);return P(n)?n.innerHTML:null}function ta(e){e.remove()}function na(e,t=document){return ca(e,t)[0]}function ra(e,t){for(let n in t)e.style[n]=t[n]}function ia(e,t){for(let n in t)e.setAttribute(n,t[n])}function aa(e,t,n){let r=na(`#${e}`,t);if(P(r))return r;let i=sa(t,n);return i.id=e,i}function oa(e,t){typeof t==`string`?e.className=t:Array.isArray(t)?e.className=t.join(` `):typeof t==`object`&&(e.className=``,Object.keys(t).forEach(n=>{t[n]&&e.classList.add(n)}))}function sa(e,t){return e.appendChild(document.createElement(t))}function ca(e,t=document){return t.querySelectorAll(e)}function la(e,t){e&&(e.innerHTML=t)}function ua(e){return new Promise(t=>{let n=()=>{!e||e.naturalWidth===void 0||e.naturalWidth===0||!e.complete?setTimeout(n,150):t()};n()})}async function da(e,t=`asyncReadyWork`){P(this[t])||(this[t]={});let n=this[t];return P(n.result)?Promise.resolve(n.result):(P(n.promise)||(n.promise=e.call(this),n.promise.then(e=>{n.result=e})),n.promise)}function fa(e=`asyncReadyWork`){P(this[e])&&delete this[e]}var pa=class{_whenCompleted;_resolve=null;_reject=null;_completed=!1;constructor(){this._whenCompleted=new Promise((e,t)=>{this._resolve=e,this._reject=t})}onResolve=e=>{this._completed=!0,this._resolve?.(e)};onError=e=>{this._completed=!0,this._reject?.(e)};get completed(){return this._completed}get whenCompleted(){return this._whenCompleted}get resolve(){return this.onResolve}get reject(){return this.onError}},ma=globalThis.devicePixelRatio||1,ha=(e,t=20)=>(Ie()?t:e)*ma,B={YTD_PERIOD:`YTD`,EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:ha(5),PLOT_HIT_TEST_TOLERANCE:ha(7),CONTINUOUS_LINE_HIT_TEST_RADIUS:4,PLOT_HOVER_DIM_ALPHA:.2,HALF_ANN_POINT_DIMENSION:Ie()?10:6,OUT_OF_SCREEN:8192,DEFAULT_SYMBOL_WIDTH_HEIGHT:32,PANE_SPLITTER_PERCENT_HEIGHT:.75,BASIS_MAIN:`$main`,INPUT_PERIOD:`Period`,INPUT_PERIOD1:`Period1`,INPUT_PERIOD2:`Period2`,INPUT_PERIOD3:`Period3`,INPUT_SYMBOL:`Symbol`,INPUT_SMOOTHING:`Smoothing`,INPUT_SOURCE:`Source`,INPUT_WIDTH:`Width`,EMPTY_ARRAY:[],CHART_DEFINITION:`chart.def.json`,CHART_SCHEMA:`chart.schema.json`,STUDIES_SCHEMA:`studies.schema.json`,STUDIES_LIST:`studies.lst.json`,FIELDS_SCHEMA:`fields.schema.json`,FIELDS_LIST:`fields.lst.json`,ACCESSOR_SCHEMA:`accessor.schema.json`,EVENTS:[`dividends`,`earnings`,`splits`,`custom`],EVENT_PROPERTIES:[`show`,`color`,`title`],PLACEHOLDER_SYMBOL_NAME:`PLACEHOLDER`,REALTIME_INITIAL_QUOTE:`REFRESH_QUOTE`,REALTIME_TRADE:`TRADE`,REALTIME_VOLUME:`VOLUME`,TOOLTIP_X_OFFSET:15,TOOLTIP_Y_OFFSET:30,TOOLTIP_TOGGLE_SIDE_ANIM_MS:300,TOOLTIP_TOGGLE_DISTANCE_TOLERANCE:10,TOOLTIP_STUDY_VALUES_PER_ROW:3,CARDS_X_OFFSET:5,CARDS_Y_OFFSET:5,PANE_CAP_MAX_PADDING_PERCENT:.15,PANE_CAP_MIN_PADDING_PERCENT:.075,PANE_TINY_PADDING_PIXELS:5,STANDARD_VISIBLE_BARS:130,ACTION_GET:`Get`,ACTION_DELETE:`Delete`,ACTION_TEMPLATE:`Template`,ACTION_AGGREGATION:`Aggregation`,ACTION_PLOT:`Plot`,MINIMUM_BAR_WIDTH:.02,MINIMUM_WIDE_BAR_WIDTH:.15,MAXIMUM_BAR_WIDTH:180,MINIMUM_BARS_VISIBLE:5,MIN_POSITION_PRICE_PRECISION:2,COLOR_TRANSPARENT:`rgba(0, 0, 0, 0)`,AT_LINE:`line`,AT_LINE_2:`line2`,AT_LINE_3:`line3`,AT_FILL:`fill`,AT_FILL2:`fill2`,AT_FILL3:`fill3`,AT_FILL4:`fill4`,AT_FILL5:`fill5`,AT_FILL6:`fill6`,AT_FILL7:`fill7`,AT_FILL_TEXT:`fillText`,AT_SINGLE_STYLE:`singleStyle`,AT_SHOW_BACKGROUND:`showBackground`,AT_BACKGROUND_OPACITY:`backgroundOpacity`,AT_COMPACT:`compact`,AT_SHOWN:`shown`,AT_VALUE:`value`,AT_ACCOUNT_SIZE:`accountSize`,AT_RISK:`risk`,AT_REWARD:`reward`,AT_RATIO:`ratio`,AT_KIND:`kind`,AT_ARROW:`arrow`,AT_VERTEX:`vertex`,AT_VERTEX_START:`start`,AT_VERTEX_END:`end`,AT_VERTEX_BOTH:`both`,AT_VERTEX_NONE:`none`,AT_TEXT_ITEM:`textItem`,AT_RISK_IS_PERCENT:`riskIsPercent`,AT_SHOW_PRICES:`showPrices`,AT_USE_52WEEK_PRICES:`use52WeekPrices`,AT_SHOW_LEVELS:`showLevels`,AT_LEVELS_KIND:`levelsKind`,AT_LEVELS_VALUES:`Values`,AT_LEVELS_PERCENTS:`Percents`,AT_LABELS:`labels`,AT_LABELS_LEFT:`Left`,AT_LABELS_CENTER:`Center`,AT_LABELS_RIGHT:`Right`,AT_SHOW_BARCOUNT:`showBarCount`,AT_EXTEND_PT_1:`extendPoint1`,AT_EXTEND_PT_2:`extendPoint2`,AT_EXTEND_LEFT:`extendLeft`,AT_EXTEND_RIGHT:`extendRight`,AT_TEXT_LINES:`textLines`,AT_SHOW_TIMESTAMPS:`showTimestamps`,AT_SHOW_TRENDLINE:`showTrendline`,AT_SHOW_PERCENTDIFF:`showPercentDiff`,AT_FACTORS:`factors`,AT_FACTOR_ITEM:`factorItem`,AT_MARKER:`marker`,AT_DRAW_LINES:`drawLines`,AT_DRAW_BORDER:`drawBorder`,AT_ALLOW_PRICES_CHANGE_UI:`allowPricesChangeUI`,AT_PRICES_ON_SCALE:`pricesOnScale`,AT_PRICE_LEVELS:`priceLevels`,AT_TIME_LEVELS:`timeLevels`,AT_SHOW_LABELS:`showLabels`,AT_SHOW_LEFT_LABELS:`showLeftLabels`,AT_SHOW_RIGHT_LABELS:`showRightLabels`,AT_SHOW_TOP_LABELS:`showTopLabels`,AT_SHOW_BOTTOM_LABELS:`showBottomLabels`,AT_SHOW_ANGLES:`showAngles`,AT_REVERSE:`reverse`,AT_LEVELS:`levels`,AT_FANS:`fans`,AT_ARCS:`arcs`,AT_SHOW_RANGES_RATIO:`showRangesRatio`,AT_PRICE_BAR_RATIO:`priceBarRatio`,AT_ANGLES:`angles`,AT_NUM_CONTRACTS:`numContracts`,AT_POSITION:`position`,AT_POSITION_SHORT:`Short`,AT_POSITION_LONG:`Long`,AT_PROFIT_LOSS:`profitLoss`,AT_LEVELS_RESPECT_LOG_SCALE:`levelsRespectLogScale`,ANN_ACTION_ID:`Annotation`,ANN_DUPLICATE_OFFSET:20,DEFAULT_ADORN_OFFSET:{x:-5,y:-10},LAYOUT_THROTTLE_DELAY:100,MINIMUM_PANE_HEIGHT:10,DEBUG_TIME_FORMAT:`yyyy-LL-dd HH:mm:ss.SSS`,DEBUG_SYMBOL:`NOTASYMBOL`,DEBUG_CHART_ID:`root`,COLOR_DEFAULT_OHLC:`#808080`,COLOR_DEFAULT_VARY:[`#d33e32`,`#19ab52`],COLOR_DEFAULT_AREA:`#2d76b3`,TOOLTIP_STD:`standard`,TOOLTIP_CARDS:`cards`,TOOLTIP_BUBBLE:`bubble`,TOOLTIP_EXTERNAL:`external`,NS_SVG:`http://www.w3.org/2000/svg`,NS_XLINK:`http://www.w3.org/1999/xlink`,NULL_OBJECT:{magic:8247764655136229},CROSSHAIR_ID:`crosshair_elem_id`,ZOOM_X_AXIS_PERCENT:.02,DEFAULT_MAX_RECORDS:640,SEASONAL_FUTURES_FETCH_YEARS:5,TICK_CUSTOM_AGG_MULTIPLIER:25,SNAP_PROXIMITY_PIXELS:18,LONG_PRESS_TIMEOUT_MILLIS:750,LONG_PRESS_DELAY_MILLIS:750,MINIMUM_THROTTLE:25,BACKGROUND_TAB_THROTTLE:2e3,INTERNAL_GC_MILLIS:300*1e3,US_TRADING_DAYS_PER_YEAR:251,INLINE_DATA_ELEMENT_ID:`barchart-www-inline-data`,META_DATA_GET_TIMETOUT:3e3,FMT_US_DATE_ONLY:`LL/dd/yyyy`,FMT_ISO_DATE_ONLY:`yyyy-LL-dd`,FMT_HIST_FEED_PARAM_DATE_ONLY:`yyyyLLdd`,FMT_HIST_FEED_PARAM_DATE_TIME:`yyyyLLddHHmmss`,FMT_HIST_FEED_INTRADAY:`yyyy-LL-dd HH:mm`,FMT_HIST_FEED_TICK:`yyyy-LL-dd HH:mm:ss.SSS`,FMT_EXPORT_ALL_BUT_MILLIS:`yyyy-LL-dd HH:mm:ss`,LINE_HEIGHT_MULTIPLIER:1.2,SVG_ICONS_DOM_NODE:`bchart-svg-icons-placeholder`,DEFAULT_BAR_WIDTH:10,DEFAULT_BAR_SPACING:5,LINE_DASH_PROP_NAME:`lineDash`,MARKER_ARROW_ANGLE:45,MARKER_ARROW_LENGTH:20,TIMELINE_PROLOG_PADDING_BARS:5e3,TIMELINE_EPILOG_PADDING_BARS:1e3,NO_DATA_TEXT:`No data to display`,DEFAULT_PRICE_AXIS_WIDTH:70,SPECIAL_BUILDER_REQUIRED:[h.Renko,h.LineBreak,h.Kagi,h.PointAndFigure],INTRA_THRESHOLD:vt(`P30D`),ONE_DAY_MILLIS:vt(`P1D`),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:vt(`P50Y`),BC_EVENT_LOGGED_IN:`login success`,BC_EVENT_DISCONNECTED:`disconnect`,BC_EVENT_FEED_PAUSED:`feed paused`,BC_EVENT_FEED_RESUMED:`feed resumed`,BC_EVENT_DISCONNECTING:`disconnecting`,HEADER_SIZE_PLACEHOLDER_ID:`header_size_helper_placeholder`,CURVE_STYLE_DOTS_RADIUS:2,DEFAULT_ACCESSOR_SUBACTION:`Update`,MIN_EVENT_RADIUS:8,AUTO_COLORS:`#5b9bd5.#8abc21.#c93030.#2f7ed8.#42ccdc.#bf95df.#d946a8.#e5daa3.#4682e8.#aaa9c1.#f08080.#f66b00.#d875be.#e84b46.#3fbc6f.#daa520.#9370db.#d2691e.#48d1cc.#cd5c5c.#6495ed.#da70d6.#ff8c00.#66cdaa.#ba55d3.#bc8f8f.#5f9ea0.#e9967a.#8fbc8f.#dc143c.#7eb3d4.#a8d46f.#e06c75.#61afef.#80d4e0.#d4a5e8.#ea6bb8.#f0d89e.#70a4f4.#c4b5d8.#f5a3a3.#ffa347.#e8a3d1.#f57c7c.#6bd49a.#e8c547.#b08fd6.#e89a6f.#7dd9d4.#d98989.#8db3f0.#e8a3e8.#ffb366.#8de0c2.#d68fd9.#d4afa4.#7dbfc7.#f0b399.#a8d4a8.#e86b7a`.split(`.`),PHP_TO_UNICODE_TS_35_MAP:{a:`EEE`,A:`EEEE`,d:`dd`,e:`d`,w:`c`,b:`MMM`,B:`MMMM`,m:`MM`,y:`yy`,Y:`yyyy`,H:`HH`,k:`H`,I:`hh`,l:`h`,M:`mm`,p:`aaa`,P:`aaaaa`,S:`ss`,L:`SSS`},AUTOFIT_PERIOD:`P50Y`,BARCHART_HIST_SRV_TICKS_PAGE_NAME:`queryticks.ashx`,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:`queryminutes.ashx`,BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:`querynearbyminutes.ashx`,BARCHART_HIST_SRV_EOD_PAGE_NAME:`queryeod.ashx`,DOUBLE_CLICK_DURATION_MILLIS:500,TOOLTIP_STD_LEGACY_CLASS:`highcharts-tooltip`,TOOLTIP_STD_CLASS:`bcharts-tooltip`,TOOLTIP_BUBBLE_CLASS:`bcharts-bubble`,TOOLTIP_BUBBLE_OFFSET:.2,EVENTS_BUILT_IN:[`dividends`,`earnings`,`splits`,`custom`],NOT_APPLICABLE:`N/A`,BARCHART_INTERNAL_FEED_DATA_ENDPOINT:`https://barchart.websol.barchart.com`,DEFAULT_RENKO_INPUTS:[{name:`Method`,value:`ATR`},{name:`Period`,integer:!0,value:14},{name:`Source`,value:`Close`},{name:`BrickSize`,value:10}],DEFAULT_LINEBREAK_INPUTS:[{name:`LineCount`,integer:!0,value:3}],DEFAULT_BASELINE_INPUTS:[{name:`BaseLevel`,value:50}],RENKO_MAX_BARS:35e3,RENKO_KAGI_NAMES:{ATR:`ATR`,TRD:`Traditional`,CLS:`Close`,HL:`High/Low`,PCT:`Percentage`},DEFAULT_KAGI_INPUTS:[{name:`BoxSizeMethod`,value:`ATR`},{name:`Period`,integer:!0,value:14},{name:`ReversalAmount`,value:30}],DEFAULT_PNF_INPUTS:[{name:`Source`,value:`Close`},{name:`BoxSizeMethod`,value:`ATR`},{name:`Period`,integer:!0,value:14},{name:`BoxSize`,value:20},{name:`ReversalAmount`,integer:!0,value:3},{name:`OneStepBack`,value:`No`}],START_OF_LAST_CENTURY:new Date(1900,0,1),NEXT_CENTURY:new Date(2100,0,1),FAKE_CUSTOM_EVENT:`___FCE___`,FETCH_TICK_CHUNK_RETRY_COUNT:6,MINIMUM_ZOOM_DIMENSION:50,SERVER_COMPUTED_STUDY_BAR_MULTIPLIER:8,BARKIND_O:0,BARKIND_X:1,BARKIND_OX:2,BARKIND_XO:3,OPTIONS_DATA_BASE:1622844e6,OPTIONS_DATA_INCREMENT:864e4,ZERO_DATE:new Date(0),OFFSCREEN_OFFSET:{x:-1,y:-1},DEFAULT_DETACHED_SCALE_MARGINS:{top:.05,bottom:.01},VOLUME_DETACHED_SCALE_MARGINS:{top:.8,bottom:.001},MARKER_SIZE:3,MAX_INTRADAY_BARS:1e5,FAKE_SYMBOL_PREFIX:`CUSTOM-FABRICATED-SYMBOL-PREFIX`,CLIENT_SIDE_SEASONAL_AVERAGE_DISTRIBUTED_STUDIES:new Set([`MA`,`MAEXP`,`MASMO`,`MATRI`,`MAWEI`,`HMA`,`DEMA`,`TEMA`,`OSCI`,`WGALPH`,`BWIDTH`,`ADJATR`,`ROC`,`TRIX`,`DPO`,`MSD`,`PCTCHG`,`HV`,`PERF`,`MOVLR`])},ga=o(((e,t)=>{t.exports={number(e){return typeof e==`number`&&!isNaN(e)},nan(e){return typeof e==`number`&&isNaN(e)},integer(e){return typeof e==`number`&&!isNaN(e)&&(e|0)===e},large(e){return typeof e==`number`&&!isNaN(e)&&isFinite(e)&&Math.floor(e)===e},positive(e){return this.number(e)&&e>0},negative(e){return this.number(e)&&e<0},iterable(e){return!this.null(e)&&!this.undefined(e)&&this.fn(e[Symbol.iterator])},string(e){return typeof e==`string`},date(e){return e instanceof Date},fn(e){return typeof e==`function`},array(e){return Array.isArray(e)},boolean(e){return typeof e==`boolean`},object(e){return typeof e==`object`&&!!e},null(e){return e===null},undefined(e){return e===void 0},zeroLengthString(e){return this.string(e)&&e.length===0},extension(e,t){return this.fn(e)&&this.fn(t)&&t.prototype instanceof e}}})),_a=o(((e,t)=>{var n=ga();t.exports=(()=>{function e(e,t,r,i){if(!n.number(e))return``;(!n.string(r)||r.length>1)&&(r=``);let a=e<0&&i===!0;a&&(e=0-e);let o=e.toFixed(t);if(r&&(e<-999||e>999)){let n=o.length,i=e<0,s=t===0,c=0,l=[];for(let e=n-1;!(e<0);e--){c===3&&!(i&&e===0)&&(l.unshift(r),c=0);let t=o.charAt(e);l.unshift(t),s?c+=1:t===`.`&&(s=!0)}a&&(l.unshift(`(`),l.push(`)`)),o=l.join(``)}else a&&(o=`(`+o+`)`);return o}return e})()})),va=o(((e,t)=>{var n=ga();t.exports=(()=>{function e(e,t){let n=Math.floor(e);return n===0&&t===``?``:n}function t(e){return e-Math.floor(e)}function r(e,t){return[`000`,Math.floor(e)].join(``).substr(-1*t)}function i(i,a,o,s,c){if(!n.number(i)||!n.number(a)||!n.number(o))return``;(!n.string(s)||s.length>1)&&(s=`.`);let l=Math.abs(i),u=e(l,s),d=t(l)*a,f=r(Math.floor(parseFloat(d.toFixed(1))),o),p,m;return i<0?(c=n.boolean(c)&&c,c?(p=`(`,m=`)`):(p=`-`,m=``)):(p=``,m=``),[p,u,s,f,m].join(``)}return i})()})),ya=o(((e,t)=>{var n=ga();t.exports=(()=>{function e(e,r,i,a,o){i===String?n.string(e)||t(r,`string`,o):i===Number?n.number(e)||t(r,`number`,o):i===Function?n.fn(e)||t(r,`function`,o):i===Boolean?n.boolean(e)||t(r,`boolean`,o):i===Date?n.date(e)||t(r,`date`,o):i===Array?n.array(e)||t(r,`array`,o):e instanceof(i||Object)||t(r,a,o)}function t(e,t,n){let r;throw r=typeof n==`number`?`The argument [ ${e||`unspecified`} ], at index [ ${n.toString()} ] must be a [ ${t||`unknown`} ]`:`The argument [ ${e||`unspecified`} ] must be a [ ${t||`Object`} ]`,Error(r)}function r(e,t){throw Error(`The argument [ ${e||`unspecified`} ] failed a validation check [ ${t||`No description available`} ]`)}return{argumentIsRequired(t,n,r,i){e(t,n,r,i)},argumentIsOptional(t,i,a,o,s,c){t!=null&&(e(t,i,a,o),n.fn(s)&&!s(t)&&r(i,c))},argumentIsArray(t,n,r,i){if(this.argumentIsRequired(t,n,Array),r){let a;a=typeof r==`function`&&r!==Function?(e,t)=>r.prototype!==void 0&&e instanceof r||r(e,`${n}[${t}]`):(t,a)=>e(t,n,r,i,a),t.forEach((e,t)=>{a(e,t)})}},argumentIsValid(e,t,n,i){n(e)||r(t,i)},areEqual(e,t,n,r){if(e!==t)throw Error(`The objects must be equal [${n||e.toString()}] and [${r||t.toString()}]`)},areNotEqual(e,t,n,r){if(e===t)throw Error(`The objects cannot be equal [${n||e.toString()}] and [${r||t.toString()}]`)}}})()})),ba=o(((e,t)=>{var n=ya(),r=ga();t.exports=(()=>{let e=new Map;class t{constructor(i,a,o){n.argumentIsRequired(i,`code`,String),n.argumentIsRequired(a,`description`,String),n.argumentIsOptional(o,`mapping`,Number),r.number(o)&&n.argumentIsValid(o,`mapping`,r.integer,`must be an integer`),this._code=i,this._description=a,r.number(o)?this._mapping=o:this._mapping=null;let s=this.constructor;e.has(s)||e.set(s,[]),t.fromCode(s,this._code)===null&&(this._mapping===null||t.fromMapping(s,this._mapping)===null)&&e.get(s).push(this)}get code(){return this._code}get description(){return this._description}get mapping(){return this._mapping}equals(e){return e===this||e instanceof t&&e.constructor===this.constructor&&e.code===this.code}toJSON(){return this.code}static fromCode(e,n){return t.getItems(e).find(e=>e.code===n)||null}static fromMapping(e,n){return n===null?null:t.getItems(e).find(e=>e.mapping===n)||null}static getItems(t){return e.get(t)||[]}toString(){return`[Enum]`}}return t})()})),xa=o(((e,t)=>{(function(e){var n,r=20,i=1,a=1e6,o=1e6,s=-7,c=21,l=!1,u=`[big.js] `,d=u+`Invalid `,f=d+`decimal places`,p=d+`rounding mode`,m=u+`Division by zero`,h={},g=void 0,_=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function v(){function e(t){var n=this;if(!(n instanceof e))return t===g?v():new e(t);if(t instanceof e)n.s=t.s,n.e=t.e,n.c=t.c.slice();else{if(typeof t!=`string`){if(e.strict===!0&&typeof t!=`bigint`)throw TypeError(d+`value`);t=t===0&&1/t<0?`-0`:String(t)}y(n,t)}n.constructor=e}return e.prototype=h,e.DP=r,e.RM=i,e.NE=s,e.PE=c,e.strict=l,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}function y(e,t){var n,r,i;if(!_.test(t))throw Error(d+`number`);for(e.s=t.charAt(0)==`-`?(t=t.slice(1),-1):1,(n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),i=t.length,r=0;r<i&&t.charAt(r)==`0`;)++r;if(r==i)e.c=[e.e=0];else{for(;i>0&&t.charAt(--i)==`0`;);for(e.e=n-r-1,e.c=[],n=0;r<=i;)e.c[n++]=+t.charAt(r++)}return e}function b(e,t,n,r){var i=e.c;if(n===g&&(n=e.constructor.RM),n!==0&&n!==1&&n!==2&&n!==3)throw Error(p);if(t<1)r=n===3&&(r||!!i[0])||t===0&&(n===1&&i[0]>=5||n===2&&(i[0]>5||i[0]===5&&(r||i[1]!==g))),i.length=1,r?(e.e=e.e-t+1,i[0]=1):i[0]=e.e=0;else if(t<i.length){if(r=n===1&&i[t]>=5||n===2&&(i[t]>5||i[t]===5&&(r||i[t+1]!==g||i[t-1]&1))||n===3&&(r||!!i[0]),i.length=t,r){for(;++i[--t]>9;)if(i[t]=0,t===0){++e.e,i.unshift(1);break}}for(t=i.length;!i[--t];)i.pop()}return e}function x(e,t,n){var r=e.e,i=e.c.join(``),a=i.length;if(t)i=i.charAt(0)+(a>1?`.`+i.slice(1):``)+(r<0?`e`:`e+`)+r;else if(r<0){for(;++r;)i=`0`+i;i=`0.`+i}else if(r>0)if(++r>a)for(r-=a;r--;)i+=`0`;else r<a&&(i=i.slice(0,r)+`.`+i.slice(r));else a>1&&(i=i.charAt(0)+`.`+i.slice(1));return e.s<0&&n?`-`+i:i}h.abs=function(){var e=new this.constructor(this);return e.s=1,e},h.cmp=function(e){var t,n=this,r=n.c,i=(e=new n.constructor(e)).c,a=n.s,o=e.s,s=n.e,c=e.e;if(!r[0]||!i[0])return r[0]?a:i[0]?-o:0;if(a!=o)return a;if(t=a<0,s!=c)return s>c^t?1:-1;for(o=(s=r.length)<(c=i.length)?s:c,a=-1;++a<o;)if(r[a]!=i[a])return r[a]>i[a]^t?1:-1;return s==c?0:s>c^t?1:-1},h.div=function(e){var t=this,n=t.constructor,r=t.c,i=(e=new n(e)).c,o=t.s==e.s?1:-1,s=n.DP;if(s!==~~s||s<0||s>a)throw Error(f);if(!i[0])throw Error(m);if(!r[0])return e.s=o,e.c=[e.e=0],e;var c,l,u,d,p,h=i.slice(),_=c=i.length,v=r.length,y=r.slice(0,c),x=y.length,S=e,C=S.c=[],w=0,T=s+(S.e=t.e-e.e)+1;for(S.s=o,o=T<0?0:T,h.unshift(0);x++<c;)y.push(0);do{for(u=0;u<10;u++){if(c!=(x=y.length))d=c>x?1:-1;else for(p=-1,d=0;++p<c;)if(i[p]!=y[p]){d=i[p]>y[p]?1:-1;break}if(d<0){for(l=x==c?i:h;x;){if(y[--x]<l[x]){for(p=x;p&&!y[--p];)y[p]=9;--y[p],y[x]+=10}y[x]-=l[x]}for(;!y[0];)y.shift()}else break}C[w++]=d?u:++u,y[0]&&d?y[x]=r[_]||0:y=[r[_]]}while((_++<v||y[0]!==g)&&o--);return!C[0]&&w!=1&&(C.shift(),S.e--,T--),w>T&&b(S,T,n.RM,y[0]!==g),S},h.eq=function(e){return this.cmp(e)===0},h.gt=function(e){return this.cmp(e)>0},h.gte=function(e){return this.cmp(e)>-1},h.lt=function(e){return this.cmp(e)<0},h.lte=function(e){return this.cmp(e)<1},h.minus=h.sub=function(e){var t,n,r,i,a=this,o=a.constructor,s=a.s,c=(e=new o(e)).s;if(s!=c)return e.s=-c,a.plus(e);var l=a.c.slice(),u=a.e,d=e.c,f=e.e;if(!l[0]||!d[0])return d[0]?e.s=-c:l[0]?e=new o(a):e.s=1,e;if(s=u-f){for((i=s<0)?(s=-s,r=l):(f=u,r=d),r.reverse(),c=s;c--;)r.push(0);r.reverse()}else for(n=((i=l.length<d.length)?l:d).length,s=c=0;c<n;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,e.s=-e.s),(c=(n=d.length)-(t=l.length))>0)for(;c--;)l[t++]=0;for(c=t;n>s;){if(l[--n]<d[n]){for(t=n;t&&!l[--t];)l[t]=9;--l[t],l[n]+=10}l[n]-=d[n]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--f;return l[0]||(e.s=1,l=[f=0]),e.c=l,e.e=f,e},h.mod=function(e){var t,n=this,r=n.constructor,i=n.s,a=(e=new r(e)).s;if(!e.c[0])throw Error(m);return n.s=e.s=1,t=e.cmp(n)==1,n.s=i,e.s=a,t?new r(n):(i=r.DP,a=r.RM,r.DP=r.RM=0,n=n.div(e),r.DP=i,r.RM=a,this.minus(n.times(e)))},h.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},h.plus=h.add=function(e){var t,n,r,i=this,a=i.constructor;if(e=new a(e),i.s!=e.s)return e.s=-e.s,i.minus(e);var o=i.e,s=i.c,c=e.e,l=e.c;if(!s[0]||!l[0])return l[0]||(s[0]?e=new a(i):e.s=i.s),e;if(s=s.slice(),t=o-c){for(t>0?(c=o,r=l):(t=-t,r=s),r.reverse();t--;)r.push(0);r.reverse()}for(s.length-l.length<0&&(r=l,l=s,s=r),t=l.length,n=0;t;s[t]%=10)n=(s[--t]=s[t]+l[t]+n)/10|0;for(n&&(s.unshift(n),++c),t=s.length;s[--t]===0;)s.pop();return e.c=s,e.e=c,e},h.pow=function(e){var t=this,n=new t.constructor(`1`),r=n,i=e<0;if(e!==~~e||e<-o||e>o)throw Error(d+`exponent`);for(i&&(e=-e);e&1&&(r=r.times(t)),e>>=1,e;)t=t.times(t);return i?n.div(r):r},h.prec=function(e,t){if(e!==~~e||e<1||e>a)throw Error(d+`precision`);return b(new this.constructor(this),e,t)},h.round=function(e,t){if(e===g)e=0;else if(e!==~~e||e<-a||e>a)throw Error(f);return b(new this.constructor(this),e+this.e+1,t)},h.sqrt=function(){var e,t,n,r=this,i=r.constructor,a=r.s,o=r.e,s=new i(`0.5`);if(!r.c[0])return new i(r);if(a<0)throw Error(u+`No square root`);a=Math.sqrt(+x(r,!0,!0)),a===0||a===1/0?(t=r.c.join(``),t.length+o&1||(t+=`0`),a=Math.sqrt(t),o=((o+1)/2|0)-(o<0||o&1),e=new i((a==1/0?`5e`:(a=a.toExponential()).slice(0,a.indexOf(`e`)+1))+o)):e=new i(a+``),o=e.e+(i.DP+=4);do n=e,e=s.times(n.plus(r.div(n)));while(n.c.slice(0,o).join(``)!==e.c.slice(0,o).join(``));return b(e,(i.DP-=4)+e.e+1,i.RM)},h.times=h.mul=function(e){var t,n=this,r=n.constructor,i=n.c,a=(e=new r(e)).c,o=i.length,s=a.length,c=n.e,l=e.e;if(e.s=n.s==e.s?1:-1,!i[0]||!a[0])return e.c=[e.e=0],e;for(e.e=c+l,o<s&&(t=i,i=a,a=t,l=o,o=s,s=l),t=Array(l=o+s);l--;)t[l]=0;for(c=s;c--;){for(s=0,l=o+c;l>c;)s=t[l]+a[c]*i[l-c-1]+s,t[l--]=s%10,s=s/10|0;t[l]=s}for(s?++e.e:t.shift(),c=t.length;!t[--c];)t.pop();return e.c=t,e},h.toExponential=function(e,t){var n=this,r=n.c[0];if(e!==g){if(e!==~~e||e<0||e>a)throw Error(f);for(n=b(new n.constructor(n),++e,t);n.c.length<e;)n.c.push(0)}return x(n,!0,!!r)},h.toFixed=function(e,t){var n=this,r=n.c[0];if(e!==g){if(e!==~~e||e<0||e>a)throw Error(f);for(n=b(new n.constructor(n),e+n.e+1,t),e=e+n.e+1;n.c.length<e;)n.c.push(0)}return x(n,!1,!!r)},h.toJSON=h.toString=function(){var e=this,t=e.constructor;return x(e,e.e<=t.NE||e.e>=t.PE,!!e.c[0])},h.toNumber=function(){var e=+x(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(e.toString()))throw Error(u+`Imprecise conversion`);return e},h.toPrecision=function(e,t){var n=this,r=n.constructor,i=n.c[0];if(e!==g){if(e!==~~e||e<1||e>a)throw Error(d+`precision`);for(n=b(new r(n),e,t);n.c.length<e;)n.c.push(0)}return x(n,e<=n.e||n.e<=r.NE||n.e>=r.PE,!!i)},h.valueOf=function(){var e=this,t=e.constructor;if(t.strict===!0)throw Error(u+`valueOf disallowed`);return x(e,e.e<=t.NE||e.e>=t.PE,!0)},n=v(),n.default=n.Big=n,typeof define==`function`&&define.amd?define(function(){return n}):t!==void 0&&t.exports?t.exports=n:e.Big=n})(e)})),Sa=o(((e,t)=>{var n=ya(),r=ba(),i=ga(),a=xa();t.exports=(()=>{class e{constructor(e){this._big=d(e)}add(t){return new e(this._big.plus(d(t)))}subtract(t){return new e(this._big.minus(d(t)))}multiply(t){return new e(this._big.times(d(t)))}divide(t){return new e(this._big.div(d(t)))}raise(t){return n.argumentIsRequired(t,`exponent`,Number),new e(this._big.pow(t))}round(t,r){n.argumentIsRequired(t,`places`,Number),n.argumentIsOptional(r,`mode`,f,`RoundingMode`);let i=r||f.NORMAL;return new e(this._big.round(t,i.value))}mod(t){return new e(this._big.mod(d(t)))}absolute(){return new e(this._big.abs())}opposite(){return this.multiply(-1)}getIsZero(e,r){return n.argumentIsOptional(e,`approximate`,Boolean),n.argumentIsOptional(r,`places`,Number),this._big.eq(t)||i.boolean(e)&&e&&this.round(r||a.DP,f.NORMAL).getIsZero()}getIsPositive(){return this._big.gt(t)}getIsNegative(){return this._big.lt(t)}getIsGreaterThan(e){return this._big.gt(d(e))}getIsGreaterThanOrEqual(e){return this._big.gte(d(e))}getIsLessThan(e){return this._big.lt(d(e))}getIsLessThanOrEqual(e){return this._big.lte(d(e))}getIsBetween(e,t,r){return n.argumentIsOptional(r,`exclusive`,Boolean),i.boolean(r)&&r?this.getIsGreaterThan(e)&&this.getIsLessThan(t):this.getIsGreaterThanOrEqual(e)&&this.getIsLessThanOrEqual(t)}getIsEqual(e){return this._big.eq(d(e))}getIsApproximate(t,n){if(n===0)return this.getIsEqual(t);let r=this.subtract(t).absolute(),i=e.ONE.divide(new e(10).raise(n));return r.getIsLessThan(i)}getIsInteger(){return this.getIsEqual(this.round(0))}getDecimalPlaces(){let e=this.toFixed().match(/-?\d*\.(\d*)/),t;return t=e===null?0:e[1].length,t}toFloat(e){return n.argumentIsOptional(e,`places`,Number),parseFloat(this._big.toFixed(e||16))}toFixed(){return this._big.toFixed()}toNumber(){return this._big.toNumber()}toJSON(){return this.toFixed()}static clone(t){return n.argumentIsRequired(t,`value`,e,`Decimal`),new e(t._big)}static parse(t){return new e(t)}static get ZERO(){return c}static get ONE(){return l}static get NEGATIVE_ONE(){return u}static get ROUNDING_MODE(){return f}static getIsZero(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsZero()}static getIsNotZero(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),!t.getIsZero()}static getIsPositive(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsPositive()}static getIsNotPositive(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsNegative()}static getIsNotNegative(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,r){return n.argumentIsRequired(t,`a`,e,`Decimal`),n.argumentIsRequired(r,`b`,e,`Decimal`),t._big.gt(r._big)?1:t._big.lt(r._big)?-1:0}toString(){return`[Decimal]`}}let t=new a(0),o=new a(1),s=new a(-1),c=new e(t),l=new e(o),u=new e(s);function d(t){return t instanceof a?t:t instanceof e?t._big:new a(t)}class f extends r{constructor(e,t){super(e.toString(),t),this._value=e}get value(){return this._value}static get UP(){return p}static get DOWN(){return m}static get NORMAL(){return h}toString(){return`[RoundingMode]`}}let p=new f(3,`up`),m=new f(0,`down`),h=new f(1,`normal`);return e})()})),Ca=o(((e,t)=>{var n=ya(),r=Sa(),i=ga(),a=ba();t.exports=(()=>{class e extends a{constructor(e,t,n,r,i,a,o,s){super(e,e),this._baseCode=t,this._decimalDigits=n,this._supportsFractions=r,r?(this._fractionFactor=i,this._fractionDigits=a,this._fractionFactorSpecial=o||i,this._fractionDigitsSpecial=s||a):(this._fractionFactor=void 0,this._fractionDigits=void 0,this._fractionFactorSpecial=void 0,this._fractionDigitsSpecial=void 0)}get baseCode(){return this._baseCode}get unitCode(){return this._code}get decimalDigits(){return this._decimalDigits}get supportsFractions(){return this._supportsFractions}get fractionFactor(){return this._fractionFactor}get fractionDigits(){return this._fractionDigits}get fractionFactorSpecial(){return this._fractionFactorSpecial}get fractionDigitsSpecial(){return this._fractionDigitsSpecial}getFractionFactor(e){return e===!0?this._fractionFactorSpecial:this._fractionFactor}getFractionDigits(e){return e===!0?this._fractionDigitsSpecial:this._fractionDigits}getMinimumTick(e){n.argumentIsValid(e,`tickIncrement`,i.integer,`must be an integer`);let t=new r(1),a=new r(10),o;return o=this.supportsFractions?t.divide(this._fractionFactor):t.divide(a.raise(this._decimalDigits)),o.multiply(e).toFloat()}getMinimumTickValue(e,t){return n.argumentIsValid(e,`tickIncrement`,i.integer,`must be an integer`),n.argumentIsValid(t,`pointValue`,i.number,`must be a number`),new r(this.getMinimumTick(e)).multiply(t).toFloat()}roundToNearestTick(e,t,a){n.argumentIsValid(e,`value`,e=>i.number(e)||e instanceof r,`must be a number primitive or a Decimal instance`),n.argumentIsValid(t,`minimumTick`,e=>i.number(e)||e instanceof r,`must be a number primitive or a Decimal instance`),n.argumentIsOptional(a,`roundToZero`,Boolean);let o;o=e instanceof r?e:new r(e);let s=o.divide(t);return o.mod(t).getIsZero()||(s=s.round(0,i.boolean(a)&&a?r.ROUNDING_MODE.DOWN:r.ROUNDING_MODE.NORMAL)),s.multiply(t).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(t){return a.fromCode(e,t)}static fromBaseCode(t){return a.getItems(e).find(e=>e.baseCode===t)||null}}return new e(`2`,-1,3,!0,8,1),new e(`3`,-2,4,!0,16,2),new e(`4`,-3,5,!0,32,2),new e(`5`,-4,6,!0,64,2,320,3),new e(`6`,-5,7,!0,128,3,320,3),new e(`7`,-6,8,!0,256,3,320,3),new e(`8`,0,0,!1),new e(`9`,1,1,!1),new e(`A`,2,2,!1),new e(`B`,3,3,!1),new e(`C`,4,4,!1),new e(`D`,5,5,!1),new e(`E`,6,6,!1),new e(`F`,7,7,!1),e})()})),wa=o(((e,t)=>{var n=ga(),r=_a(),i=va(),a=Ca();t.exports=(()=>{function e(e,t,o,s,c,l){if(!n.number(e))return``;let u=a.parse(t);return u===null?``:((!n.string(o)||o.length>1)&&(o=`.`),s=n.boolean(s)&&s,l=n.boolean(l)&&l,!u.supportsFractions||o===`.`?r(e,u.decimalDigits,c,l):i(e,u.getFractionFactor(s),u.getFractionDigits(s),o,l))}return e})()})),Ta=o(((e,t)=>{var n=ba();t.exports=(()=>{class e extends n{constructor(e,t,n){super(e,t),this._id=n}get id(){return this._id}toJSON(){return this._id}static parse(t){return n.fromCode(e,t)}static fromId(t){return n.getItems(e).find(e=>e.id===t)||null}static get STOCK(){return t}static get STOCK_OPTION(){return r}static get FUTURE(){return i}static get FUTURE_OPTION(){return a}static get FOREX(){return o}static get CMDTY_STATS(){return s}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}let t=new e(`STK`,`U.S. Equity`,1),r=new e(`STKOPT`,`Equity Option`,34),i=new e(`FUT`,`Future`,2),a=new e(`FUTOPT`,`Future Option`,12),o=new e(`FOREX`,`FOREX`,10),s=new e(`CMDTY`,`cmdtyStats`,24);return e})()})),Ea=o(((e,t)=>{var n=Ta(),r=va(),i=wa();t.exports=(()=>{let e={};e.ZB=/^BB\d$/,e.ZT=/^BT\d$/,e.ZF=/^BF\d$/,e.ZN=/^BN\d$/;function t(t,a,o){if(o.asset===n.FUTURE_OPTION){let n=o.root;if(n===`ZB`||n===`ZN`||e.ZB.test(n)||e.ZN.test(n))return r(t,64,2,`-`,!1);if(n===`ZT`||n===`ZF`||e.ZT.test(n)||e.ZF.test(n))return r(t,640,3,`-`,!1)}return i(t,a,`-`,!0,`,`)}return t})()})),Da=c(wa(),1),Oa=c(_a(),1),ka=c(Ea(),1),Aa=[{min:0,divider:1,suffix:``,decimals:0},{min:1e5,divider:1e3,suffix:`K`,decimals:0},{min:1e6,divider:1e6,suffix:`M`,decimals:2},{min:1e9,divider:1e9,suffix:`B`,decimals:3},{min:0xe8d4a51000,divider:0xe8d4a51000,suffix:`T`,decimals:3}];function ja(e,t,n){let r=$().config;return r.mode===ne[ne.cmdtyView]&&n!=null?(0,ka.default)(e,t,n):(0,Da.default)(e,t,`-`,r.isAlt64,`,`,!1)}function Ma(e){if(P(e)){let t=$().config,n=rt(t,null,`overrides`,`symbology`,`translateSymbol`);if(P(n)&&typeof n==`function`)try{let t=n(e);if(P(t))return t}catch(t){I(`Failed translating the symbol '${e}', error is ${t.message}`,`warn`)}}return e}function Na(e,t,n){if(e==null)return``;if(!this.isReady)return e.toFixed(0);if(t.format===y.FromMetaData)return ja(e,this.unitCode,this._profile);switch(t.format){case y.AsInteger:return e.toFixed();case y.UseMetricUnit:{n||={};let t=Object.assign({},{range:[e,e],allDigits:!1},n);if(n.allDigits)return Ia(e,0);(!Array.isArray(t.range)||!t.range.length)&&(t.range=[e,e]);let r=Math.max(Math.abs(t.range[0]),Math.abs(t.range[1])),i=_e(Aa,e=>r>e.min)||Aa[0];return`${(e/i.divider).toFixed(i.decimals)}${i.suffix}`}case y.AsPercent:return`${(e*100).toFixed(2)}%`;default:return``}}function Pa(e,t,n){let r=n?.overridePrecision;return Number.isFinite(r)&&r>=0?Ia(e,r):null}var Fa=class{symbol;name=``;unitCode=``;exchange=``;pointValue=1;tickIncrement=1;symbolType=`Unknown`;timeZone;expiration=``;resolved;_profile;_minMovement=null;constructor(e){this.resolved=this.symbol=e,this.timeZone=Ui(Ma(this.symbol)),this._profile=null}initialize(e){this._minMovement=null,za(e)||lt(this,e),this._profile=e}get isReady(){return this.unitCode.length>0}get minMovement(){if(!this.isReady)return 0;if(this._minMovement==null){let e=Number.parseInt(this.unitCode,16),t=1/(e<8?2<<e:10**(e-8));this._minMovement=this.tickIncrement*t}return this._minMovement}format(e,t,n){let r=Pa(e,t,n);return r===null?Na.call(this,e,t,n):r}parse(e){throw Error(`Not implemented yet`)}getInlineMetadata(e){if(typeof document>`u`)return null;let t=ea(`#${B.INLINE_DATA_ELEMENT_ID}`);if(!P(t))return null;let n;try{n=JSON.parse(t)}catch(e){return I(`Failed to parse inline metadata JSON, error is ${e.message}`,`warn`),null}let r=e,i=e=>e in n;return!i(r)&&(r=Qi(e,Object.keys(n)),!i(r))?null:n[r].instrument}getFallbackApi(){return`getInstrumentDefinition`}processFallback(e){return{name:e.symbolName,exchange:e.exchange,unitCode:e.baseCode,pointValue:e.pointValue,tickIncrement:e.tickIncrement}}async getFallbackMetadata(e){try{let t=encodeURIComponent(e),n=await sF(`ondemand`,`/${this.getFallbackApi()}.json?symbols=${t}`),r=JSON.parse(n);if(r.status.code===200&&r.results.length===1){let e=r.results[0];return await this.processFallback(e)}}catch(t){I(`Failed fetching the metadata for ${e}, error is ${t.message}`,`warn`)}return this.emptyFallbackProfile()}emptyFallbackProfile(){return{name:``,exchange:``,unitCode:`A`,pointValue:1,tickIncrement:1}}};function Ia(e,t){return(0,Oa.default)(e,t,`,`,!1)}function La(e,t=!1){return new Ka(e,t)}var Ra=class extends Fa{shutdown(){}async ready(){return da.call(this,async()=>{let e=Ma(this.symbol),t=this.getInlineMetadata(e);return za(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0})}getCacheableEntities(e){e.add(this)}};function za(e){return!N(e)||!P(e.unitCode,e.name,e.exchange)||e.unitCode.length===0}var Ba=class extends Fa{shutdown(){}refresh(){this.isReady||(fa.call(this),this.ready())}async ready(){return da.call(this,async()=>{let e=Ma(this.symbol),t=await(Vi(e)?wi(e):e);this.resolved=Bi(t);let n=Ti(this.resolved),[r,i]=await Zi(this.resolved),a=new Promise(e=>{setTimeout(()=>e(null),B.META_DATA_GET_TIMETOUT)}),o=null;try{o=await Promise.race([a,this.getProfile(r)])}catch(e){I(`Failed fetching the metadata for ${r}, error is ${e.message}`,`warn`)}return za(o)&&(o=this.getInlineMetadata(r)),za(o)&&(o=await this.getFallbackMetadata(r)),o?.symbolType===`Unknown`&&i&&(o.symbolType=`Future`),o?.symbolType===`Unknown`&&n&&(o.symbolType=`FutureOption`),this.initialize(o),this.isReady})}async getProfile(e){return Promise.reject(Error(`Method shold be implemented in the derived class.`))}getCacheableEntities(e){e.add(this)}},Va=class extends Ba{getType(e){if(!e)return`Unknown`;switch(e.code){case`STK`:return`Equity`;case`STKOPT`:return`EquityOption`;case`FUT`:return`Future`;case`FUTOPT`:return`FutureOption`;case`FOREX`:return`Forex`;default:return`Unknown`}}async getProfile(e){let t=await $().connection.getMarketState().getProfile(e);return{symbolType:this.getType(t.asset),name:t.name,exchange:t.exchange,unitCode:t.unitCode,pointValue:t.pointValue,tickIncrement:t.tickIncrement,timeZone:t.exchangeRef?.timeZoneDdf}}},Ha=function(e){return e[e.UNKNOWN_INSTRUMENT_TYPE=0]=`UNKNOWN_INSTRUMENT_TYPE`,e[e.FOREX=1]=`FOREX`,e[e.INDEX=2]=`INDEX`,e[e.EQUITY=3]=`EQUITY`,e[e.FUTURE=4]=`FUTURE`,e[e.OPTION=5]=`OPTION`,e[e.SPREAD=6]=`SPREAD`,e[e.MUTUAL_FUND=7]=`MUTUAL_FUND`,e[e.MONEY_MARKET_FUND=8]=`MONEY_MARKET_FUND`,e[e.USER_DEFINED_SPREAD=9]=`USER_DEFINED_SPREAD`,e[e.EQUITY_OPTION=10]=`EQUITY_OPTION`,e[e.OTHER=99]=`OTHER`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}(Ha||{}),Ua=class extends Ba{_profileSource=new pa;hasInstrumentDefinitionProfile=!1;priceDenominator=1;quantityDenominator=1;priceScaling=1;expirationDate;get isReady(){return super.isReady&&this.hasInstrumentDefinitionProfile}resetProfile(){this.hasInstrumentDefinitionProfile=!1,this.priceDenominator=this.quantityDenominator=this.priceScaling=1}refresh(){this.isReady||(this.resetProfile(),fa.call(this),this.ready())}asPrice(e){return e===void 0?null:e.toNumber()/this.priceDenominator*this.priceScaling}asQuantity(e){return e===void 0?null:Math.floor(e.toNumber()/this.quantityDenominator)}get profileSource(){return this._profileSource}getRequest(e){return{symbol:e,instrumentType:[],spreadType:[]}}getType(e){switch(e){case 3:return`Equity`;case 4:return`Future`;case 5:return`FutureOption`;case 1:return`Forex`;case 2:return`Index`;case 10:return`EquityOption`;default:return`Unknown`}}getFallbackApi(){return`getOFInstrumentDefinition`}async processFallback(e){let t=e.definition;return t.instrumentType=Ha[t.instrumentType],this.completeFormatting(this.getProfileFromInstrumentDefinition(t),this.resolved)}async completeFormatting(e,t){if(e.unitCode)return e;try{let n=await sF(`ondemand`,`/getInstrumentDefinition.json?symbols=${encodeURIComponent(t)}`),r=JSON.parse(n);if(r.status.code===200&&r.results.length===1){let t=await super.processFallback(r.results[0]);e.unitCode=t.unitCode,e.name||=t.name,e.exchange||=t.exchange,e.pointValue||=t.pointValue,e.tickIncrement||=t.tickIncrement}}catch(e){I(`Failed fetching formatting metadata for ${t}, error is ${e.message}`,`warn`)}return e}getProfileFromInstrumentDefinition(e){this.hasInstrumentDefinitionProfile=!0,this.expirationDate=e.symbolExpiration;let{priceDenominator:t,priceScalingExponent:n,quantityDenominator:r}=e;if(t!==0&&(this.priceDenominator=t),r!==0&&(this.quantityDenominator=r),n&&n!==0){let e=1;n<0?e/=10**-n:e*=10**n,this.priceScaling=e}return{symbolType:this.getType(e.instrumentType),pointValue:e.contractPointValue,tickIncrement:e.minimumPriceIncrement,exchange:e.barchartExchange,name:e.description,unitCode:e.barchartBaseCode,timeZone:e.timeZoneName}}async getProfile(e){let t=await $().getAdapter()?.getInstrument(this.getRequest(e))??[];return t.length<1?null:this.completeFormatting(this.getProfileFromInstrumentDefinition(t[0]),e)}},Wa=class{_decimals;unitCode;pointValue=1;tickIncrement=1;minMovement=0;symbol=``;symbolType=`Unknown`;resolved=``;name=``;exchange=``;constructor(e){this._decimals=e,this.unitCode=(8+e).toString(16).toUpperCase()}shutdown(){throw Error(`Method not implemented.`)}get isReady(){return!0}async ready(){return!0}format(e,t,n){if(e==null)return``;let r=Pa(e,t,n);return r===null?Ia(e,this._decimals):r}getCacheableEntities(e){}},Ga=class{unitCode=``;minMovement=0;pointValue=0;tickIncrement=0;symbol=``;symbolType=`Unknown`;resolved=``;name=``;exchange=``;async ready(){return!1}get isReady(){return!1}shutdown(){}format(e,t,n){return e==null?``:P(e)?e.toFixed(0):``}getCacheableEntities(e){}},Ka=class{inner;forceDecimals;unitCode=``;pointValue=1;tickIncrement=1;minMovement=0;symbol=``;symbolType=`Unknown`;resolved=``;name=``;exchange=``;constructor(e,t=!1){let n=$().getMetaDataSource();this.inner=e.map(e=>n.getMetaData(e)),this.forceDecimals=t}get isReady(){return this.unitCode!=null}async ready(){return da.call(this,async()=>{let e=(await Promise.all(this.inner.map(e=>e.ready()))).every(ue);if(e){let e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:n,no:r}=A(this.inner,e=>t(e)>=8),i=this.inner.length,a=e=>Math.max(...e).toString(16).toUpperCase();if(!this.forceDecimals&&(n.length===i||r.length===i))this.unitCode=a(this.inner.map(t));else{let i=n.map(t).concat(r.map(t).map(e=>String.fromCharCode(e-2+66)).map(e));this.unitCode=a(i)}this.minMovement=Math.min(...this.inner.map(e=>e.minMovement))}return e})}format(e,t,n){let r=Pa(e,t,n);return r===null?Na.call(this,e,t,n):r}getCacheableEntities(e){this.inner.forEach(t=>e.add(t))}shutdown(){}},qa=class{metaDataCache;constructor(){this.metaDataCache=new Map}getMetaData(e){if(e===B.PLACEHOLDER_SYMBOL_NAME)return new Ga;if(this.metaDataCache.has(e))return this.metaDataCache.get(e);{let t=this.metaDataCreator(e);return this.metaDataCache.set(e,t),t}}evictUnused(e){for(let[t,n]of this.metaDataCache)e.has(n)||(n.shutdown(),this.metaDataCache.delete(t))}refresh(){for(let e of this.metaDataCache.values())e.refresh?.()}},Ja=class extends qa{metaDataCreator(e){return new Ra(e)}},Ya=class extends qa{metaDataCreator(e){return new Va(e)}},Xa=class extends qa{metaDataCreator(e){return new Ua(e)}},Za=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,Qa=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,$a=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,eo={r:255,g:255,b:255,a:1},to={r:0,g:0,b:0,a:1};function no(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function ro(e,t){return-(e.y-t.y)/(e.x-t.x)}function io(e,t){let n=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);return Math.sqrt(n*n+r*r)}function ao(e,t){return{x:e.x-t.x,y:e.y-t.y}}function oo(e,t){return{x:e.x+t.x,y:e.y+t.y}}function so(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function co(e,t,n){let[r,i]=e,a=i.x-r.x,o=i.y-r.y,s=t.x-r.x,c=t.y-r.y;if(a===0&&o===0)return Math.abs(s)<=n&&Math.abs(c)<=n;let l=Math.atan2(o,a),u=Math.sqrt(a*a+o*o),d=Math.atan2(c,s),f=Math.sqrt(s*s+c*c),p=f*Math.cos(d-l),m=f*Math.sin(d-l);return Math.abs(m)<=n&&-n<=p&&p<=u+n}function lo(e){return e.toLowerCase().replace(`shortdashdotdot`,`3,1,1,1,1,1,`).replace(`shortdashdot`,`3,1,1,1`).replace(`shortdot`,`1,1,`).replace(`shortdash`,`3,1,`).replace(`longdash`,`8,3,`).replace(`sparsedot`,`1,8,`).replace(/dot/g,`1,3,`).replace(`dash`,`4,3,`).replace(/,$/,``).replace(`solid`,``).split(`,`).map(Number).filter(ue)}function uo(e){return Co(vo(e))}function fo(e,t){let n=vo(e);return n.a=t,So(n)}function po(e,t,n,r=!1){let i=e.a,a=r=>Math.floor(e[r]+(t[r]-e[r])*n);return{r:a(`r`),g:a(`g`),b:a(`b`),a:Math.min(1,(1+(r?n:0))*i)}}function mo({r:e,g:t,b:n,a:r}){return{r:255-e,g:255-t,b:255-n,a:r}}var ho=e=>{let t=vo(e);return So(po(mo(t),t,.7))},go=(e,t=!1)=>le(vo,n=>po(n,to,e,t),So);function _o(e,t=!1){return le(vo,n=>po(n,eo,e,t),So)}function vo(e){if([`r`,`g`,`b`,`a`].map(t=>e[t]).every(e=>P(e)))return e;let t=P(e.linearGradient)?e._refColor:e,n=Za.exec(t);if(n!==null){let e=P(n[2]),t=n[1]+(n[2]||``),r=n=>e?parseInt(t.substr(n*2,2),16):parseInt(t.charAt(n),16)*17;return{r:r(0),g:r(1),b:r(2),a:1}}else{let e=$a.exec(t),n=Qa.exec(t),r=(e,t)=>P(e)&&e.length===t,i=r(e,5),a=r(n,4);if(!i&&!a)throw Error(`Color is neither a hex color nor a rgba one.`);let o=i?e:n,s=e=>parseInt(o[e]),c=parseFloat(o[4]);return{r:s(1),g:s(2),b:s(3),a:i?c:1}}}function yo(e){return e<=.008856?e*903.3:e**(1/3)*116-16}function bo(e){let{r:t,g:n,b:r}=vo(e),[i,a,o]=[t,n,r].map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return yo(.2126*i+.7152*a+.0722*o)}function xo(e){return bo(e)>66.66?`#000`:`#fff`}function So(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function Co(e){let t=e=>{let t=e.toString(16);return t.length===2?t:`0`+t};return`#${t(e.r)}${t(e.g)}${t(e.b)}`}function wo(e,t,n){return e.x-=t,e.y-=n,e.width+=2*t,e.height+=2*n,e}function To(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}var Eo=class e{x;y;width;height;constructor(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r}contains(e){return e.x>=this.x&&e.x<=this.x+this.width&&e.y>=this.y&&e.y<=this.y+this.height}get centerX(){return this.x+this.width/2}get centerY(){return this.y+this.height/2}duplicate(){return new e(this.x,this.y,this.width,this.height)}},Do=class{cx;cy;radiusX;radiusY;constructor(e,t,n,r){this.cx=e,this.cy=t,this.radiusX=n,this.radiusY=r}contains(e){let t=Math.abs(e.x-this.cx)/this.radiusX,n=Math.abs(e.y-this.cy)/this.radiusY;return Math.sqrt(t*t+n*n)<=1}};function Oo(e,t){e.moveTo(t.x,t.y)}function ko(e,t){e.lineTo(t.x,t.y)}function Ao(e,t,n){e.rect(t.x,t.y,n.x-t.x,n.y-t.y)}function jo(e,t=B.LINE_HEIGHT_MULTIPLIER){return t*e.measureText(`M`).width}function Mo(e,t=!1,n=1){let r=No(e,t,n).y;return r-Math.sign(r)*B.DEFAULT_ADORN_OFFSET.y}function No(e,t=!1,n=1){let r={...B.DEFAULT_ADORN_OFFSET};return t&&(r.y=-(n*jo(e,1)+r.y)),r}function Po(e,t,n,r=T.Left){let i=Array.isArray(t)?t:[t],a=jo(e,1),o=Math.max(...i.map(t=>e.measureText(t).width)),s=a*i.length,c=n.x;r===T.Right&&(c-=o),r===T.Center&&(c-=o/2);let l=n.y-a;return wo(new Eo(c,l,o,s),4,4)}function Fo(e,t,n,r=T.Left,i,a){e.save();let o=Array.isArray(t)?t:[t],s=jo(e,1);if(P(a)){let i=Po(e,t,n,r);e.fillStyle=a,Lo(e,i,!1)}P(i)&&(e.fillStyle=i);let c=n.x,l=n.y;o.forEach(t=>{e.textAlign=T[r].toLowerCase(),e.fillText(t,c,l),l+=s}),e.restore()}function Io(e,t){e.beginPath(),e.ellipse(t.cx,t.cy,t.radiusX,t.radiusY,0,0,2*Math.PI),e.stroke(),e.fill()}function Lo(e,t,n=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),n&&e.stroke(),e.fill()}function Ro(e,t,n,r=0,i=Math.PI,a=!1,o=!1){e.beginPath(),o&&e.moveTo(t.x,t.y),e.arc(t.x,t.y,Math.abs(n),r,i,a),e.stroke(),o&&e.fill()}function zo(e,{x:t,y:n},{x:r,y:i}){e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke()}function Bo(e,t,n,r){zo(e,{x:t,y:n},{x:t,y:r})}function Vo(e,t,n,r){zo(e,{x:n,y:t},{x:r,y:t})}function Ho(e,{x:t,y:n,r,color:i,text:a},o){let s=r;e.fillStyle=i,e.beginPath();let c=r+r,l=c,u=new Eo(t-r,n-s-l,c,l);return e.fillRect(u.x,u.y,u.width,u.height),e.font=`700 ${(r*1.6).toFixed(0)}px "${o}"`,e.fillStyle=`#fff`,e.textAlign=`center`,e.textBaseline=`middle`,e.beginPath(),e.fillText(a,t,n-l*.9),u}function Uo(e,t,n){switch(t){case`zero`:Wo(e,n,`0`);break;case`one`:Wo(e,n,`1`);break;case`two`:Wo(e,n,`2`);break;case`three`:Wo(e,n,`3`);break;case`four`:Wo(e,n,`4`);break;case`five`:Wo(e,n,`5`);break;case`six`:Wo(e,n,`6`);break;case`seven`:Wo(e,n,`7`);break;case`eight`:Wo(e,n,`8`);break;case`nine`:Wo(e,n,`9`);break;case`question`:Wo(e,n,`?`);break;case`fish_hook`:rs(e,n);break;case`arrow_up`:Go(e,n);break;case`arrow_down`:Ko(e,n);break;case`arrow_right`:Jo(e,n);break;case`arrow_left`:qo(e,n);break;case`arrow_horizontal`:Yo(e,n);break;case`arrow_vertical`:Xo(e,n);break;case`arc_down`:$o(e,n);break;case`arc_up`:Qo(e,n);break;case`thumbs_up`:ts(e,n);break;case`thumbs_down`:ns(e,n);break;case`letter_b`:Wo(e,n,`B`);break;case`letter_s`:Wo(e,n,`S`);break;case`letter_a`:Wo(e,n,`A`);break;case`letter_c`:Wo(e,n,`C`);break;case`letter_d`:Wo(e,n,`D`);break;case`letter_e`:Wo(e,n,`E`);break;default:break}}function Wo(e,t,n){e.save();let r=t.centerX,i=t.centerY,a=Math.floor(Math.min(t.width/2,t.height/2));e.strokeStyle=e.fillStyle,e.lineWidth=Math.max(1,a*.1),Ro(e,{x:r,y:i},a,0,Math.PI*2),e.textAlign=`center`,e.font=`${a*2}px Arial`,e.textBaseline=`middle`,e.fillText(n,r,i+a*.15),e.restore()}function Go(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(a,r),e.lineTo(n,o),e.lineTo(i,r),e.lineTo(Math.floor(n-c),r),e.lineTo(Math.floor(n-c),s),e.lineTo(Math.floor(n+c),s),e.lineTo(Math.floor(n+c),r),e.closePath(),e.fill(),e.restore()}function Ko(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(a,r),e.lineTo(n,s),e.lineTo(i,r),e.lineTo(Math.floor(n-c),r),e.lineTo(Math.floor(n-c),o),e.lineTo(Math.floor(n+c),o),e.lineTo(Math.floor(n+c),r),e.closePath(),e.fill(),e.restore()}function qo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(n,o),e.lineTo(i,r),e.lineTo(n,s),e.lineTo(n,Math.floor(r+c)),e.lineTo(a,Math.floor(r+c)),e.lineTo(a,Math.floor(r-c)),e.lineTo(n,Math.floor(r-c)),e.closePath(),e.fill(),e.restore()}function Jo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(n,o),e.lineTo(a,r),e.lineTo(n,s),e.lineTo(n,Math.floor(r+c)),e.lineTo(i,Math.floor(r+c)),e.lineTo(i,Math.floor(r-c)),e.lineTo(n,Math.floor(r-c)),e.closePath(),e.fill(),e.restore()}function Yo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t,3/2),l=Math.floor(n-(n-i)/3),u=Math.floor(n+(n-i)/3);e.beginPath(),e.moveTo(l,o),e.lineTo(i,r),e.lineTo(l,s),e.lineTo(l,Math.floor(r+c)),e.lineTo(u,Math.floor(r+c)),e.lineTo(u,s),e.lineTo(a,r),e.lineTo(u,o),e.lineTo(u,Math.floor(r-c)),e.lineTo(l,Math.floor(r-c)),e.lineTo(l,o),e.closePath(),e.fill(),e.restore()}function Xo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t,2/3),l=Math.floor(r-(r-o)/3),u=Math.floor(r+(r-o)/3);e.beginPath(),e.moveTo(a,l),e.lineTo(n,o),e.lineTo(i,l),e.lineTo(Math.floor(n-c),l),e.lineTo(Math.floor(n-c),u),e.lineTo(i,u),e.lineTo(n,s),e.lineTo(a,u),e.lineTo(Math.floor(n+c),u),e.lineTo(Math.floor(n+c),l),e.lineTo(a,l),e.closePath(),e.fill(),e.restore()}function Zo(e,t=1){let n=Math.floor(e.centerX),r=Math.floor(e.centerY),{width:i,height:a}=e;return i=.9*Math.min(i,a*t),a=i/t,{cx:n,cy:r,left:Math.floor(n-i/2),right:Math.floor(n+i/2),top:Math.floor(r-a/2),bottom:Math.floor(r+a/2),halfBaseSize:Math.min(i,a)*.21}}function Qo(e,t){let{cx:n,cy:r,left:i,right:a,deflection:o,arcWidth:s}=es(t);e.save(),e.beginPath(),e.moveTo(a,r);let c=n+o,l=r-o,u=n-o,d=r-o;e.bezierCurveTo(c,l,u,d,i,r),e.lineTo(i,r-s),e.bezierCurveTo(u,d-s,c,l-s,a,r-s),e.closePath(),e.fill(),e.restore()}function $o(e,t){let{cx:n,cy:r,left:i,right:a,deflection:o,arcWidth:s}=es(t);e.save(),e.beginPath(),e.moveTo(a,r);let c=n+o,l=r+o,u=n-o,d=r+o;e.bezierCurveTo(c,l,u,d,i,r),e.lineTo(i,r+s),e.bezierCurveTo(u,d+s,c,l+s,a,r+s),e.closePath(),e.fill(),e.restore()}function es(e){let t=Math.floor(e.centerX),n=Math.floor(e.centerY),{width:r,height:i}=e,a=Math.floor(Math.min(r,i));return a*=.9,{cx:t,cy:n,left:Math.floor(t-a/2),right:Math.floor(t+a/2),arcWidth:a*.075,deflection:a*.3}}function ts(e,t){e.save(),e.translate(t.x,t.y),e.lineWidth=.05;let n=Math.min(t.width,t.height)/18;e.scale(n,n),e.lineCap=`butt`,e.save(),e.save(),e.beginPath(),e.moveTo(3.23,8.96),e.lineTo(4.17,8.96),e.bezierCurveTo(4.73,8.81,5.91,6.45,6.45,5.82),e.bezierCurveTo(6.88,5.33,7.66,5.09,8.48,3.7),e.bezierCurveTo(9.11,2.78,8.38,1.49,10.06,1.17),e.bezierCurveTo(10.9,1.01,11.86,2.61,11.58,4.11),e.bezierCurveTo(11.49,4.6,11.25,5.14,11.07,5.54),e.bezierCurveTo(10.63,6.5,10.05,6.58,10.17,7.23),e.bezierCurveTo(10.98,7.25,11.79,7.32,12.67,7.27),e.bezierCurveTo(14.33,7.17,15.55,9.08,14.43,10.38),e.bezierCurveTo(14.9,11.12,14.79,12.33,14.14,12.81),e.bezierCurveTo(14.42,13.58,14.25,14.45,13.67,14.8),e.bezierCurveTo(14.13,16.77,12.36,16.87,11.77,16.84),e.lineTo(4.65,16.84),e.bezierCurveTo(3.87,16.77,3.95,16.28,3.5,16.27),e.bezierCurveTo(3.39,16.26,3.3,16.26,3.3,16.26),e.bezierCurveTo(3.18,16.26,3.19,15.7,3.28,15.7),e.bezierCurveTo(3.36,15.69,3.61,15.68,3.87,15.71),e.bezierCurveTo(4.03,15.79,4.4,16.26,4.75,16.27),e.lineTo(12.12,16.26),e.bezierCurveTo(13.13,16.27,13.67,15.11,12.8,14.56),e.bezierCurveTo(13.85,14.53,13.98,12.98,13.19,12.6),e.bezierCurveTo(14.35,12.49,14.5,10.65,13.44,10.41),e.bezierCurveTo(14.8,9.97,14.39,7.59,12.35,7.83),e.bezierCurveTo(11.42,7.77,9.87,7.94,9.68,7.62),e.bezierCurveTo(9.41,6.82,9.684,6.45,10.17,5.88),e.bezierCurveTo(10.5,5.46,11.02,4.6,11.04,3.64),e.bezierCurveTo(11.05,2.5,10.41,1.23,9.58,1.98),e.bezierCurveTo(9.38,2.21,9.36,3.47,8.94,4.02),e.bezierCurveTo(8.09,5.52,7.3,5.66,6.95,6.15),e.bezierCurveTo(6.27,6.86,4.93,9.52,4.36,9.52),e.bezierCurveTo(3.98,9.52,3.243,9.52,3.24,9.52),e.bezierCurveTo(3.12,9.52,3.08,8.98,3.22,8.95),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}function ns(e,t){e.save(),e.translate(t.x,t.y),e.lineWidth=.05;let n=Math.min(t.width,t.height)/18;e.scale(n,n),e.lineCap=`butt`,e.save(),e.save(),e.beginPath(),e.moveTo(14.77,9.04),e.lineTo(13.82,9.04),e.bezierCurveTo(13.27,9.18,12.09,11.55,11.54,12.17),e.bezierCurveTo(11.12,12.66,10.34,12.9,9.52,14.29),e.bezierCurveTo(8.88,15.21,9.62,16.51,7.93,16.82),e.bezierCurveTo(7.1,16.98,6.13,15.39,6.42,13.88),e.bezierCurveTo(6.51,13.4,6.75,12.855,6.93,12.46),e.bezierCurveTo(7.37,11.49,7.95,11.41,7.82,10.76),e.bezierCurveTo(7.02,10.75,6.21,10.68,5.33,10.73),e.bezierCurveTo(3.66,10.83,2.44,8.91,3.57,7.62),e.bezierCurveTo(3.09,6.88,3.2,5.67,3.85,5.19),e.bezierCurveTo(3.57,4.42,3.74,3.55,4.33,3.2),e.bezierCurveTo(3.87,1.22,5.64,1.13,6.22,1.16),e.lineTo(13.35,1.16),e.bezierCurveTo(14.12,1.22,14.04,1.71,14.49,1.73),e.bezierCurveTo(14.6,1.73,14.7,1.73,14.7,1.73),e.bezierCurveTo(14.82,1.74,14.8,2.29,14.72,2.3),e.bezierCurveTo(14.63,2.31,14.39,2.32,14.12,2.28),e.bezierCurveTo(13.96,2.21,13.6,1.74,13.25,1.73),e.lineTo(5.88,1.73),e.bezierCurveTo(4.86,1.73,4.33,2.88,5.19,3.44),e.bezierCurveTo(4.14,3.47,4.01,5.02,4.8,5.39),e.bezierCurveTo(3.64,5.5,3.49,7.35,4.55,7.58),e.bezierCurveTo(3.19,8.02,3.6,10.4,5.64,10.16),e.bezierCurveTo(6.57,10.23,8.12,10.05,8.32,10.37),e.bezierCurveTo(8.58,11.17,8.32,11.54,7.82,12.11),e.bezierCurveTo(7.49,12.54,6.97,13.39,6.96,14.36),e.bezierCurveTo(6.94,15.49,7.59,16.76,8.41,16.01),e.bezierCurveTo(8.62,15.78,8.63,14.52,9.05,13.97),e.bezierCurveTo(9.9,12.47,10.69,12.33,11.04,11.84),e.bezierCurveTo(11.72,11.13,13.06,8.47,13.637,8.47),e.bezierCurveTo(14.01,8.47,14.75,8.47,14.75,8.47),e.bezierCurveTo(14.87,8.47,14.91,9.01,14.77,9.04),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}function rs(e,t){e.save(),e.translate(t.x,t.y);let n=Math.min(t.width,t.height)/560;e.scale(n,n),e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=4,e.save(),e.save(),e.miterLimit=10,e.beginPath(),e.moveTo(377.8,354.8),e.bezierCurveTo(377.8,354.8,401.8,517.8,290.6,507),e.bezierCurveTo(173.2,495.5,171.5,50.39,171.5,50.39),e.bezierCurveTo(171.5,50.39,191.7,252.59,212.3,351),e.bezierCurveTo(212.3,351,230.9,472.8,286.7,488.7),e.bezierCurveTo(350.4,507,369.5,452.7,377.8,354.79),e.closePath(),e.fill(),e.restore(),e.save(),e.miterLimit=10,e.beginPath(),e.moveTo(378.3,351.1),e.lineTo(341.1,446.6),e.lineTo(371.2,436.7),e.lineTo(378.3,351.1),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}function is(){let e=$().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?Xe(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}var as=(e,t)=>!0,os=(e,t)=>e.map((e,n)=>({shown:t(e,n),value:e,line:{width:1,color:ss(n),dashStyle:`Solid`}})),ss=e=>Ae(gs,e),cs=e=>e.filter(e=>e.shown),ls={width:1,color:`#000`,dashStyle:`Solid`},us={width:1,color:`rgba(136,136,136,0.75)`,dashStyle:`Dash`},ds={color:B.COLOR_TRANSPARENT},fs={[B.AT_SINGLE_STYLE]:!0,[B.AT_SHOW_BACKGROUND]:!1};function ps(e,t){let n=F(rt(e,ls,`annotationTraits`,`line`)),r=F(rt(e,us,`annotationTraits`,`line2`)),i=F(rt(e,ds,`annotationTraits`,`fill`)),a=Bs[t],o=a?.defaults||{};$().config.colorfulAnnotations||(lt(o,fs),(t===`GannBox`||t===`GannSquare`)&&(o[B.AT_SHOW_BACKGROUND]=!0));let s=a?.editable.includes(B.AT_LINE_2),c=P(o[B.AT_LINE_2]),l={line:n,fill:i,...o};return s&&!c&&(l.line2=r),l}function ms(e,t){Object.keys(t).forEach(n=>{n===B.LINE_DASH_PROP_NAME?e.setLineDash(t[n]):e[n]=t[n]})}function hs(e){let t=le(vo,So);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:lo(e.line.dashStyle)}}var gs=[`rgba(121, 123, 133, 1)`,`rgba(223,72,76,1)`,`rgba(145,197,138,1)`,`rgba(103,173,92,1)`,`rgba(69,151,130,1)`,`rgba(120,179,241,1)`,`rgba(121,123,133,1)`,`rgba(56,97,246,1)`,`rgba(243,171,71,1)`,`rgba(144,49,170,1)`,`rgba(214,56,101,1)`,`rgba(175,108,195,1)`],_s=[B.AT_LINE,B.AT_ALLOW_PRICES_CHANGE_UI],vs=[B.AT_FILL,B.AT_ALLOW_PRICES_CHANGE_UI],ys=[B.AT_LINE,B.AT_FILL,B.AT_ALLOW_PRICES_CHANGE_UI],bs=[...ys,B.AT_FILL_TEXT],xs=[B.AT_TEXT_LINES,B.AT_FILL,B.AT_ALLOW_PRICES_CHANGE_UI],Ss=[..._s,B.AT_LINE_2,B.AT_SHOW_PRICES,B.AT_SHOW_LEVELS,B.AT_LEVELS_KIND,B.AT_LABELS,B.AT_EXTEND_LEFT,B.AT_EXTEND_RIGHT,B.AT_SHOW_TRENDLINE,B.AT_FACTORS,B.AT_PRICES_ON_SCALE,B.AT_REVERSE,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY,B.AT_LEVELS_RESPECT_LOG_SCALE],Cs=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],ws=e=>({[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_PRICES]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_EXTEND_LEFT]:!1,[B.AT_EXTEND_RIGHT]:!1,[B.AT_SHOW_TRENDLINE]:!0,[B.AT_FACTORS]:os(Cs.slice(2),(t,n)=>0<=t&&t<=e),[B.AT_PRICES_ON_SCALE]:!1,[B.AT_REVERSE]:!1,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),Ts=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_SHOW_TRENDLINE,type:`bool`},{id:B.AT_LINE_2,type:`line`,enabledIf:B.AT_SHOW_TRENDLINE},{id:B.AT_EXTEND_LEFT,type:`bool`},{id:B.AT_EXTEND_RIGHT,type:`bool`},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`},{id:B.AT_SHOW_PRICES,type:`bool`},{id:B.AT_PRICES_ON_SCALE,type:`bool`},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LEVELS_KIND,type:`string`,enum:[B.AT_LEVELS_PERCENTS,B.AT_LEVELS_VALUES],enabledIf:B.AT_SHOW_LEVELS},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]},{id:B.AT_LEVELS_RESPECT_LOG_SCALE,type:`bool`}],Es={[B.AT_LINE]:{color:`#3861f6`,width:1,dashStyle:`Solid`},[B.AT_FILL]:{color:`rgba(56, 97, 246, 0.2)`},[B.AT_FILL_TEXT]:{color:`#f0f0f0`},[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},Ds=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_FILL,type:`color`},{id:B.AT_FILL_TEXT,type:`color`}],Os=[0,.25,.382,.5,.618,.75,1],ks=[`8x1`,`5x1`,`4x1`,`3x1`,`2x1`,`1x1`,`1x2`,`1x3`,`1x4`,`1x5`,`1x8`],As=[`1x0`,`1x1`,`1.5x0`,`2x0`,`2x1`,`3x0`,`3x1`,`4x0`,`4x1`,`5x0`,`5x1`],js=[0,1,2,3,5,8,13,21,34,55,89,144],Ms=[8,4,3,2,1].map(e=>`1/${e}`).concat([2,3,4,8].map(e=>`${e}/1`)),Ns=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_SHOW_PRICES,type:`bool`},{id:B.AT_RATIO,type:`bool`},{id:B.AT_SHOW_PERCENTDIFF,type:`bool`},{id:B.AT_SHOW_BARCOUNT,type:`bool`},{id:B.AT_EXTEND_PT_1,type:`bool`},{id:B.AT_EXTEND_PT_2,type:`bool`},{id:B.AT_MARKER,type:`object`,properties:[{id:B.AT_KIND,type:`string`,enum:[B.AT_ARROW]},{id:B.AT_VERTEX,type:`string`,enum:[B.AT_VERTEX_NONE,B.AT_VERTEX_START,B.AT_VERTEX_END,B.AT_VERTEX_BOTH]}]}],Ps=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`}],Fs=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_FILL,type:`color`}],Is=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_FILL,type:`color`},{id:B.AT_FILL2,type:`color`},{id:B.AT_FILL_TEXT,type:`color`},{id:B.AT_COMPACT,type:`bool`},{id:B.AT_ACCOUNT_SIZE,type:`number`},{id:B.AT_RISK,type:`number`},{id:B.AT_RISK_IS_PERCENT,type:`bool`}],Ls=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_FILL,type:`color`}],Rs={[B.AT_KIND]:B.AT_ARROW,[B.AT_VERTEX]:B.AT_VERTEX_NONE},zs=[B.AT_LINE,B.AT_RATIO,B.AT_SHOW_PRICES,B.AT_ALLOW_PRICES_CHANGE_UI,B.AT_SHOW_BARCOUNT,B.AT_SHOW_PERCENTDIFF,B.AT_EXTEND_PT_1,B.AT_EXTEND_PT_2,B.AT_MARKER],Bs={Line:{editable:zs,defaults:{[B.AT_SHOW_PRICES]:!1,[B.AT_SHOW_BARCOUNT]:!1,[B.AT_SHOW_PERCENTDIFF]:!1,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!1,[B.AT_MARKER]:Rs,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Ns,numPoints:2},Ray:{editable:zs,defaults:{[B.AT_SHOW_PRICES]:!1,[B.AT_SHOW_BARCOUNT]:!1,[B.AT_SHOW_PERCENTDIFF]:!1,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!0,[B.AT_MARKER]:Rs,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Ns,numPoints:2},VerticalLine:{editable:[B.AT_LINE,B.AT_SHOW_TIMESTAMPS,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_SHOW_TIMESTAMPS]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_SHOW_TIMESTAMPS,type:`bool`}],numPoints:1},HorizontalLine:{editable:[B.AT_LINE,B.AT_SHOW_PRICES,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_SHOW_PRICES]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:1},TrendChannel:{editable:[..._s,B.AT_EXTEND_PT_1,B.AT_EXTEND_PT_2],defaults:{[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!1,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...Ps,{id:B.AT_EXTEND_PT_1,type:`bool`},{id:B.AT_EXTEND_PT_2,type:`bool`}],numPoints:3},GannLine:{editable:zs,defaults:{[B.AT_SHOW_PRICES]:!1,[B.AT_SHOW_BARCOUNT]:!1,[B.AT_SHOW_PERCENTDIFF]:!1,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!0,[B.AT_MARKER]:Rs,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Ns,numPoints:2},SpeedResistanceArcs:{editable:_s,types:Ps,numPoints:2},SpeedResistanceFan:{editable:_s,types:Ps,numPoints:2},AndrewsPitchfork:{editable:_s,types:Ps,numPoints:3},Rectangle:{editable:ys,types:Fs,numPoints:2},Ellipse:{editable:ys,types:Fs,numPoints:2},DateRange:{editable:bs,defaults:Es,types:Ds,numPoints:2},PriceRange:{editable:bs,defaults:Es,types:Ds,numPoints:2},DatePriceRange:{editable:[...bs,B.AT_DRAW_BORDER],defaults:{...Es,[B.AT_DRAW_BORDER]:!1},types:[...Ds,{id:B.AT_DRAW_BORDER,type:`bool`}],numPoints:2},GannBox:{editable:[B.AT_LINE,B.AT_LINE_2,B.AT_ALLOW_PRICES_CHANGE_UI,B.AT_PRICE_LEVELS,B.AT_TIME_LEVELS,B.AT_SHOW_LEFT_LABELS,B.AT_SHOW_RIGHT_LABELS,B.AT_SHOW_TOP_LABELS,B.AT_SHOW_BOTTOM_LABELS,B.AT_SHOW_ANGLES,B.AT_REVERSE,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_LINE]:{color:`#33776b`,width:1,dashStyle:`Solid`},[B.AT_LINE_2]:{color:`#33776b`,width:1,dashStyle:`Solid`},[B.AT_PRICE_LEVELS]:os(Os,as),[B.AT_TIME_LEVELS]:os(Os,as),[B.AT_SHOW_LEFT_LABELS]:!0,[B.AT_SHOW_RIGHT_LABELS]:!0,[B.AT_SHOW_TOP_LABELS]:!0,[B.AT_SHOW_BOTTOM_LABELS]:!0,[B.AT_SHOW_ANGLES]:!1,[B.AT_REVERSE]:!1,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_PRICE_LEVELS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_LEFT_LABELS,type:`bool`},{id:B.AT_SHOW_RIGHT_LABELS,type:`bool`},{id:B.AT_TIME_LEVELS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_TOP_LABELS,type:`bool`},{id:B.AT_SHOW_BOTTOM_LABELS,type:`bool`},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`},{id:B.AT_SHOW_ANGLES,type:`bool`},{id:B.AT_LINE_2,type:`line`,enabledIf:B.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[..._s,B.AT_LEVELS,B.AT_FANS,B.AT_ARCS,B.AT_REVERSE,B.AT_SHOW_RANGES_RATIO,B.AT_PRICE_BAR_RATIO,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_LINE]:{color:`#712b9c`,width:1,dashStyle:`Solid`},[B.AT_LEVELS]:os([0,1,2,3,4,5],as),[B.AT_FANS]:os(ks,(e,t)=>t>3&&t<7),[B.AT_ARCS]:os(As,as),[B.AT_REVERSE]:!1,[B.AT_SHOW_RANGES_RATIO]:!0,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_LEVELS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_FANS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_ARCS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`},{id:B.AT_PRICE_BAR_RATIO,type:`number`,editable:!0},{id:B.AT_SHOW_RANGES_RATIO,type:`bool`}],numPoints:2},LongPosition:{editable:[B.AT_LINE,B.AT_FILL,B.AT_FILL2,B.AT_FILL_TEXT,B.AT_COMPACT,B.AT_ACCOUNT_SIZE,B.AT_RISK,B.AT_RISK_IS_PERCENT,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_FILL]:{color:`rgba(0, 160, 0, 0.2)`},[B.AT_FILL2]:{color:`rgba(205, 0, 0, 0.2)`},[B.AT_FILL_TEXT]:{color:`#fff`},[B.AT_COMPACT]:!1,[B.AT_ACCOUNT_SIZE]:1e3,[B.AT_RISK]:25,[B.AT_RISK_IS_PERCENT]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Is,numPoints:4},ShortPosition:{editable:[B.AT_LINE,B.AT_FILL,B.AT_FILL2,B.AT_FILL_TEXT,B.AT_COMPACT,B.AT_ACCOUNT_SIZE,B.AT_RISK,B.AT_RISK_IS_PERCENT,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_FILL]:{color:`rgba(205, 0, 0, 0.2)`},[B.AT_FILL2]:{color:`rgba(0, 160, 0, 0.2)`},[B.AT_FILL_TEXT]:{color:`#fff`},[B.AT_COMPACT]:!1,[B.AT_ACCOUNT_SIZE]:1e3,[B.AT_RISK]:25,[B.AT_RISK_IS_PERCENT]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Is,numPoints:4},FiftyPercentLine:{editable:[B.AT_USE_52WEEK_PRICES,B.AT_LINE,B.AT_LINE_2,B.AT_SHOW_PRICES,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_USE_52WEEK_PRICES]:!1,[B.AT_SHOW_PRICES]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_USE_52WEEK_PRICES,type:`bool`},{id:B.AT_LINE,type:`line`},{id:B.AT_LINE_2,type:`line`},{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:2},FibonacciRetracement:{editable:Ss,defaults:ws(1),types:Ts,numPoints:2},TrendBasedFibExtension:{editable:Ss,defaults:ws(5),types:Ts,numPoints:3},FibonacciFan:{editable:[..._s,B.AT_SHOW_LEVELS,B.AT_LABELS,B.AT_FACTORS,B.AT_REVERSE,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_REVERSE]:!1,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_FACTORS]:os(Cs.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`}],numPoints:2},FibonacciArcs:{editable:[..._s,B.AT_LINE_2,B.AT_SHOW_TRENDLINE,B.AT_FACTORS,B.AT_SHOW_LEVELS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_TRENDLINE]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_FACTORS]:os(Cs.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_SHOW_TRENDLINE,type:`bool`},{id:B.AT_LINE_2,type:`line`,enabledIf:B.AT_SHOW_TRENDLINE},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_LEVELS,type:`bool`}],numPoints:2},FibonacciChannel:{editable:[..._s,B.AT_SHOW_PRICES,B.AT_SHOW_LEVELS,B.AT_LEVELS_KIND,B.AT_LABELS,B.AT_EXTEND_PT_1,B.AT_EXTEND_PT_2,B.AT_FACTORS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_PRICES]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!1,[B.AT_FACTORS]:os(Cs.slice(2),as),[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_EXTEND_PT_1,type:`bool`},{id:B.AT_EXTEND_PT_2,type:`bool`},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_PRICES,type:`bool`},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LEVELS_KIND,type:`string`,enum:[B.AT_LEVELS_PERCENTS,B.AT_LEVELS_VALUES],enabledIf:B.AT_SHOW_LEVELS},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[..._s,B.AT_ANGLES,B.AT_SHOW_LEVELS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_ANGLES]:os(Ms,as)},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_ANGLES,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_LEVELS,type:`bool`}],numPoints:2},SymbolArrowUp:{editable:vs,types:Ls,numPoints:1},SymbolArrowDown:{editable:vs,types:Ls,numPoints:1},SymbolArrowRight:{editable:vs,types:Ls,numPoints:1},SymbolArrowLeft:{editable:vs,types:Ls,numPoints:1},SymbolArrowHorizontal:{editable:vs,types:Ls,numPoints:1},SymbolArrowVertical:{editable:vs,types:Ls,numPoints:1},SymbolArcDown:{editable:vs,types:Ls,numPoints:1},SymbolArcUp:{editable:vs,types:Ls,numPoints:1},SymbolThumbsUp:{editable:vs,types:Ls,numPoints:1},SymbolThumbsDown:{editable:vs,types:Ls,numPoints:1},SymbolZero:{editable:vs,types:Ls,numPoints:1},SymbolOne:{editable:vs,types:Ls,numPoints:1},SymbolTwo:{editable:vs,types:Ls,numPoints:1},SymbolThree:{editable:vs,types:Ls,numPoints:1},SymbolFour:{editable:vs,types:Ls,numPoints:1},SymbolFive:{editable:vs,types:Ls,numPoints:1},SymbolSix:{editable:vs,types:Ls,numPoints:1},SymbolSeven:{editable:vs,types:Ls,numPoints:1},SymbolEight:{editable:vs,types:Ls,numPoints:1},SymbolNine:{editable:vs,types:Ls,numPoints:1},SymbolQuestion:{editable:vs,types:Ls,numPoints:1},SymbolFishHook:{editable:vs,types:Ls,numPoints:1},SymbolLetterB:{editable:vs,types:Ls,numPoints:1},SymbolLetterS:{editable:vs,types:Ls,numPoints:1},SymbolLetterA:{editable:vs,types:Ls,numPoints:1},SymbolLetterC:{editable:vs,types:Ls,numPoints:1},SymbolLetterD:{editable:vs,types:Ls,numPoints:1},SymbolLetterE:{editable:vs,types:Ls,numPoints:1},FibonacciTimeZones:{editable:[..._s,B.AT_FACTORS,B.AT_SHOW_LEVELS,B.AT_LABELS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_FACTORS]:os(js,as),[B.AT_SHOW_LEVELS]:!0,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:xs,types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_TEXT_LINES,type:`array`,items:{ref:B.AT_TEXT_ITEM}},{id:B.AT_TEXT_ITEM,type:`string`},{id:B.AT_FILL,type:`color`}],numPoints:2},ProfitLoss:{editable:[...ys,B.AT_SHOW_PRICES,B.AT_NUM_CONTRACTS,B.AT_POSITION,B.AT_PROFIT_LOSS],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!1,[B.AT_SHOW_PRICES]:!0,[B.AT_NUM_CONTRACTS]:1,[B.AT_POSITION]:B.AT_POSITION_LONG,[B.AT_PROFIT_LOSS]:void 0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_PROFIT_LOSS,type:`number`,editable:!1},{id:B.AT_NUM_CONTRACTS,type:`number`},{id:B.AT_POSITION,type:`string`,enum:[B.AT_POSITION_SHORT,B.AT_POSITION_LONG]},...Fs,{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:2},RewardRisk:{editable:[...ys,B.AT_SHOW_PRICES,B.AT_NUM_CONTRACTS,B.AT_POSITION,B.AT_RISK,B.AT_REWARD,B.AT_RATIO],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!1,[B.AT_SHOW_PRICES]:!0,[B.AT_NUM_CONTRACTS]:1,[B.AT_POSITION]:B.AT_POSITION_LONG,[B.AT_RISK]:void 0,[B.AT_REWARD]:void 0,[B.AT_RATIO]:void 0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_REWARD,type:`number`,editable:!1},{id:B.AT_RISK,type:`number`,editable:!1},{id:B.AT_RATIO,type:`number`,editable:!1},{id:B.AT_NUM_CONTRACTS,type:`number`},{id:B.AT_POSITION,type:`string`,enum:[B.AT_POSITION_SHORT,B.AT_POSITION_LONG]},...Fs,{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:2}};function Vs(e){return e?Bs[e].editable:Bs}var Hs={$schema:`http://json-schema.org/draft-04/schema#`,title:`JSON schema for Barchart HTML5 Charts`,definitions:JSON.parse(`{"color":{"type":"string","pattern":"^(#([0-9a-fA-F]{3}){1,2})|(rgba\\\\((\\\\s*\\\\d{1,3}\\\\s*,){3}\\\\s*[01]+(\\\\.\\\\d+)?\\\\))|(rgb\\\\((\\\\s*\\\\d{1,3}\\\\s*)(,\\\\s*\\\\d{1,3}\\\\s*){2}\\\\))$"},"orientationChoice":{"type":"string","enum":["vertical","horizontal","both","none"]},"dashStyle":{"type":"string","enum":["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","SparseDot","Dot","Dash","LongDash","DashDot","LongDashDot","LongDashDotDot"]},"aggUnit":{"type":"string","enum":["Tick","Intraday","Day","Week","Month","Quarter","Year"]},"aggSpec":{"type":"string","enum":["None","Nearest","Continue","PerCount","PerVolume","PerRange","PerSeconds","TopOfBook"]},"isoPeriod":{"type":"string","pattern":"^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$"},"period":{"type":"string","oneOf":[{"$ref":"#/definitions/isoPeriod"},{"enum":["YTD"]}]},"density":{"type":"integer","minimum":5},"precision":{"type":"integer","minimum":0},"curveAttr":{"type":"string","enum":["ChangeBased","OpenVsClose"]},"paddingPercent":{"type":"number","minimum":0.001,"maximum":0.999},"fundamental":{"type":"string","enum":["AccountsPayable","AccruedExpenses","Cash","CommonShares","SharesOutstanding","DeferredIncomeTax","DeferredLongRevenues","EquityOtherInvestments","IncomeTaxPayable","Intangibles","Inventories","LongTermDebt","MarketableSec","OtherCurrentAssets","OtherCurrentLiabilities","OtherEquity","OtherNonCurrentAssets","OtherNonCurrentLiabilities","PpeNet","PrepaidExpenses","Receivables","RetainedEarnings","ShorttermDebt","TotalAssets","TotalCurrentAssets","TotalCurrentLiabilities","TotalLiabilities","TotalLiabilitiesAndEquity","TotalNonCurrentAssets","TotalNonCurrentLiabilities","TotalShareholdersEquity","BasicEpsContOp","BasicEpsTotalOp","CostGoods","DilutedEpsContOp","DilutedEpsTotalOp","Ebitda","GrossProfit","IncomeTax","InterestExpense","NetIncome","OperatingExpenses","OperatingIncome","OtherIncomeExpenses","PreTaxIncome","Sales"]},"studyField":{"type":"string","enum":["HL/2","OC/2","HLC/3","OHLC/4","HLCC/4","AVG","MA","MA1","MA2","MA3","MA4","MA5","MA6","MA7","MA8","MA9","MA10","MAS","MAL","EMA","MAHI","MALO","MACD","MACDS","MACDH","MACDV","MACDVS","MACDVH","ENVU","ENVD","ENVEXPU","ENVEXPD","ENVSMOU","ENVSMOD","SMA","TMA","WMA","VOLMA","OSC","VOSC","RSI","RSIAVG","RSA","RSAAVG","STORSI","STORSIAVG","HH","LL","PercK","PercD","PercR","WGCL","BOLLBU","BOLLBL","BOLLBM","BOLLW","BOLLP","BOLLBW","BOLLBWA","OBVOL","OBVOLAVG","ATR","ADR","ADRP","ATRP","PDI","MDI","ADX","ADXM","ADL","ADWM","ADWMMA","CHAOSC","TP","KCUP","KCMID","KCLOW","KBUP","KBMID","KBLOW","DONUP","DONMID","DONLOW","DONW","PVT","ROC","TRIX","PVPT","PVPTR","PVPTS","ARNUP","ARNLOW","ARNOSC","TCHNUP","TCHNLOW","ALJAW","ALTEETH","ALLIPS","PLTLN","AWOS","AWOSMA","MFMUL","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","EMVMA","ERBLPOW","ERBRPOW","FI","MI","MOM","MOMMA","MFI","MSD","NVI","NVIEMA","PVI","PVIEMA","PPO","PPOS","PPOH","PVO","PVOS","PVOH","HV","PERF","WASI","WWVSARU","WWVSARD","PARSARS","PARSARL","MOVLR","TRSP1","TRSP2","TARGP","PPTPIV","PPTR1","PPTR2","PPTR3","PPTS1","PPTS2","PPTS3","COTLCCMSP","COTLCLGSP","COTLCSMSP","COTDAGPRO","COTDAGSPD","COTDAGMNM","COTDAGOTH","COTFTRDLI","COTFTRASM","COTFTRLVF","COTFTROTH","TR","IMPVOL","CTM","CPMI","CTLTM","CTLTMF","DEMA","EOSC","TEMA","TSI","TSISIG","ADJATR","COTR","GMMA3","GMMA5","GMMA8","GMMA10","GMMA12","GMMA15","GMMA30","GMMA35","GMMA40","GMMA45","GMMA50","GMMA60","MCGD","HMA","COPP","CPPH4","CPPH3","CPPH2","CPPH1","CPPL1","CPPL2","CPPL3","CPPL4","REATRS","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","ATRMA","STOMOMIX","CHDMOMOSC","CHDMOMOSCAVG","VSTOPUP","VSTOPLOW","SUPTR","BARCOLIX","BARKIND","CONVLN","BASELN","LEADSP1","LEADSP2","LAGGSP","VWAP","VWAPSD1U","VWAPSD1L","VWAPSD2U","VWAPSD2L","PLVI","MNVI","DIFA","DOSCH","DOSCS","TTMSQZON","TTMSQZOFF","TTMSQZOSC","CRS","CRSAVG","JPIB","JPIS","DRS","MRS","PMO","PMOS","RVOL","WGALPH","UPVOL","DNVOL","TOTVOL","POC","VAREA","BARBACK","AVWAP","KST","KSTSIG","STC","MCCLO","NHLAI","CMBCI","CMBCIF","CMBCIS","COTI","CHEXL","CHEXS","MBBUO","MBBUI","MBBM","MBBLI","MBBLO","CHOP","MACLD1","MACLD2","BTI","PCUP1","PCDN1","PCUP2","PCDN2","PCUP3","PCDN3","PCTD","PCTP","TDIPRC","TDITSL","TDIMBL","TDIUPR","TDILWR","PPS","FRAMA","FISHER","FISHTRG","RCI","RCISIG","ZZPIVOT","BOP","BOPAVG","CORR","RVI","RVISIG","ATREXTAVG","ATREXTUP","ATREXTLOW"]},"generalField":{"type":"string","enum":["DateTime","Open","High","Low","Close","TradeSize","Volume","OpenInterest","Last","Bid","BidSize","Ask","AskSize","Symbol","Change","PercentChange","TradingDay","PreviousOpen","PreviousClose","PreviousHigh","PreviousLow","WeekPreviousClose","WeekPreviousHigh","WeekPreviousLow","MonthPreviousClose","MonthPreviousHigh","MonthPreviousLow","YearHigh","YearLow","Projection","BarIndex"]},"optionField":{"type":"string","enum":["Call","Put","WeighImplVolHigh","WeighImplVolLow","WeighImplVol","WeighImplVolHigh5D","WeighImplVolLow5D","WeighImplVol5D","WeighImplVolHigh1M","WeighImplVolLow1M","WeighImplVol1M","WeighImplVolHigh3M","WeighImplVolLow3M","WeighImplVol3M","WeighImplVolHigh6M","WeighImplVolLow6M","WeighImplVol6M","WeighImplVolHigh1Y","WeighImplVolLow1Y","WeighImplVol1Y","WeighImplVolHighYTD","WeighImplVolLowYTD","WeighImplVolYTD","WeighImplVolChg","ImplVolRank5D","ImplVolRank1M","ImplVolRank3M","ImplVolRank6M","ImplVolRank1Y","ImplVolRankYTD","ImplVolPerc5D","ImplVolPerc1M","ImplVolPerc3M","ImplVolPerc6M","ImplVolPerc1Y","ImplVolPercYTD","OptTotVol","OptCallVol","OptPutVol","PutCallVolRatio","TotalOpenInt","CallOpenInt","PutOpenInt","PutCallOIRatio","CallIVCurve","PutIVCurve","CallTheoretical","PutTheoretical","Delta","Gamma","Theta","Vega"]},"previousField":{"type":"string","enum":["PreviousOpen","PreviousClose","PreviousHigh","PreviousLow"]},"eventField":{"type":"string","enum":["Dividends","Splits","Earnings","Buy","Sell","Custom"]},"curveField":{"anyOf":[{"$ref":"#/definitions/generalField"},{"$ref":"#/definitions/studyField"},{"$ref":"#/definitions/fundamental"},{"$ref":"#/definitions/optionField"}]},"curveStyle":{"type":"string","enum":["OHLC","Line","Candlestick","Area","Column","Dots","HLC","HL","Ribbon","Step","HollowCandles","HeikinAshi","ElderImpulseSystem","Renko","Range","LineBreak","Kagi","PointAndFigure","Baseline","PercentChange","MultiColumn","StackedColumn"]},"paneHeight":{"type":"number","minimum":0.01},"plotPlacement":{"type":"string","enum":["WithSeries","TimeAxis"],"default":"WithSeries"},"comparison":{"type":"string","enum":["None","Value","Percent"],"default":"None"},"scale":{"type":"string","enum":["Linear","Logarithmic"],"default":"Linear"},"study":{"type":"string","enum":["MA","MACROSS","PACROSS","MAEXP","MAHLC","MACD","MACDEXP","MACDV","VOL","MAENV","MAENVEXP","MAENVSMO","MASMO","MATRI","MAWEI","MAVOL","OSCI","OSCIVOL","RSI","RSIMOD","RSISTO","RSA","STOCHF","STOCHS","WPERCR","HHLL","WGCL","BBANDS","BWIDTH","BPERC","BBANDW","OBVOL","ATR","ADR","ADRP","ATRP","ADX","ADXMOD","ADL","ADWM","CHAOSC","TP","KELCHN","KELBND","DONCHN","DONWIDTH","PVT","ROC","TRIX","PPMOV","ARNUPDW","ARNOSC","TCHN","ALLG","PLTLN","AWEOSC","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","ERBLPOW","ERBRPOW","FI","MI","MOM","MFI","MSD","NVI","PVI","PPO","PVO","HV","PERF","WASI","WWVOL","PARTP","MOVLR","TRSP","TARGP","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","EOSC","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRS","LINRCHN","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","OPINT","STOMOMIX","CHDMOMOSC","VSTOP","SUPTR","ICHCLD","VWAP","VOIN","DIFA","DOSC","MARIB","HASMO","TTMSQZ","CRS","JPI","CTTP","CTTI","DRS","MRS","PMO","RVOL","WGALPH","VOLAP","AVWAP","KST","STC","MCCLO","NHLAI","CMBCI","COTI","CHEXI","MBBANDS","OPTIV","IVRANK","IVPCTL","OPTVOLPC","OPTOIPC","OPTVOL","OPTOI","CHOP","MACLD","BTI","PC","GREEKS","PVACP","TDI","PPS","FRAMA","FISHER","RCI","ZIGZAG","BOP","CORR","RVI","ATREXT"]},"annId":{"type":"string","enum":["Line","Ray","GannLine","VerticalLine","HorizontalLine","FiftyPercentLine","LongPosition","ShortPosition","FibonacciRetracement","TrendBasedFibExtension","FibonacciFan","FibonacciArcs","FibonacciChannel","GannFan","SpeedResistanceFan","SpeedResistanceArcs","AndrewsPitchfork","Rectangle","Ellipse","TrendChannel","SymbolArrowUp","SymbolArrowDown","SymbolArrowRight","SymbolArrowLeft","SymbolArrowHorizontal","SymbolArrowVertical","SymbolArcDown","SymbolArcUp","SymbolThumbsUp","SymbolThumbsDown","SymbolZero","SymbolOne","SymbolTwo","SymbolThree","SymbolFour","SymbolFive","SymbolSix","SymbolSeven","SymbolEight","SymbolNine","SymbolQuestion","SymbolFishHook","SymbolLetterA","SymbolLetterB","SymbolLetterS","SymbolLetterC","SymbolLetterD","SymbolLetterE","FibonacciTimeZones","Text","ProfitLoss","RewardRisk","DateRange","PriceRange","DatePriceRange","GannBox","GannSquare"]},"aggregation":{"type":"object","additionalProperties":false,"properties":{"size":{"type":"integer","minimum":1,"multipleOf":1,"default":1},"unit":{"$ref":"#/definitions/aggUnit","default":"Day"},"spec":{"$ref":"#/definitions/aggSpec","default":"None"},"isContractVolume":{"type":"boolean","default":false},"dividendsAdjust":{"type":"boolean","default":false},"backAdjust":{"type":"boolean","default":false},"daysToExpiration":{"type":"integer","minimum":0,"maximum":60,"default":1},"contractRoll":{"type":"string","enum":["expiration","combined"],"default":"combined"}},"required":["unit"]},"gridLines":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean","default":true},"color":{"type":"string","default":"#d8d8d8"},"lineWidth":{"type":"number","default":1},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"range":{"type":"object","additionalProperties":false,"properties":{"from":{"type":"number"},"to":{"type":"number"}}},"crosshair":{"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean","default":true},"snap":{"type":"boolean","default":false},"showValue":{"type":"boolean","default":true},"color":{"$ref":"#/definitions/color","default":"#c0c0c0"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"},"format":{"type":"string"}}},"displayAxis":{"type":"object","properties":{"visible":{"type":"boolean","default":true},"gridLines":{"$ref":"#/definitions/gridLines"},"minorGridLines":{"$ref":"#/definitions/gridLines"},"textColor":{"$ref":"#/definitions/color","default":"#000"},"crosshair":{"$ref":"#/definitions/crosshair"},"fontSize":{"type":"number","default":12},"preventLabelOverlap":{"type":"boolean","default":false}}},"displayChart":{"type":"object","additionalProperties":false,"properties":{"backgroundColor":{"$ref":"#/definitions/color","default":"#fff"},"plotBorderColor":{"$ref":"#/definitions/color"},"fontFamily":{"type":"string","default":"\\"Lucida Grande\\", \\"Lucida Sans Unicode\\", Verdana, Arial, Helvetica, sans-serif"},"fontSize":{"type":"number","default":13},"previous":{"$ref":"#/definitions/previous"},"exportUrl":{"type":"string"},"showMinMaxArc":{"type":"boolean","default":true},"showGoToLatest":{"type":"boolean","default":false},"showLegend":{"type":"boolean"},"showNoDataText":{"type":"boolean"},"newPaneHeight":{"$ref":"#/definitions/paneHeight","default":1},"plotHover":{"type":"boolean","default":false},"bar":{"$ref":"#/definitions/barMetrics"},"zooming":{"$ref":"#/definitions/orientationChoice","default":"both"},"studyBasisFocus":{"type":"boolean"}}},"barMetrics":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number"},"spacing":{"type":"number"}}},"previous":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color","default":"#888"},"lineWidth":{"type":"number","minimum":1,"default":1},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"},"forceVisible":{"type":"boolean","default":false},"field":{"$ref":"#/definitions/previousField","default":"PreviousClose"}}},"scrollbar":{"type":"object","additionalProperties":false,"properties":{"barColor":{"$ref":"#/definitions/color","default":"#bfc8d1"},"buttonColor":{"$ref":"#/definitions/color","default":"#ebe7e8"},"trackColor":{"$ref":"#/definitions/color","default":"#eee"},"visible":{"type":"boolean","default":true}}},"tooltip":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean","default":true},"mode":{"type":"string","enum":["standard","cards","bubble","external"],"default":"standard"},"showMainPlot":{"type":"boolean","default":false},"backgroundColor":{"$ref":"#/definitions/color","default":"rgba(255, 255, 255, 0.85)"},"borderColor":{"$ref":"#/definitions/color","default":"#000"},"hideSymbols":{"type":"boolean"},"revealingClose":{"type":"boolean"},"showMainTitle":{"type":"boolean","default":true},"mainTitle":{"type":"string","enum":["Name","Description"],"default":"Name"}}},"data":{"type":"object","additionalProperties":false,"properties":{"aggregation":{"$ref":"#/definitions/aggregation"},"maxDataPoints":{"type":"number"},"range":{"$ref":"#/definitions/range"},"checkRange":{"type":"boolean"},"exprSkipLeadingEmpty":{"type":"boolean"},"useLastTrade":{"type":"boolean","default":false},"extendedHours":{"type":"boolean"},"realTimeCboeBzx":{"type":"boolean"},"buildContinuation":{"type":"boolean"}},"required":["aggregation"]},"display":{"type":"object","additionalProperties":false,"properties":{"period":{"$ref":"#/definitions/period"},"density":{"$ref":"#/definitions/density"},"chart":{"$ref":"#/definitions/displayChart"},"scrollbar":{"$ref":"#/definitions/scrollbar"},"scrollBehavior":{"type":"string","enum":["wheel","wheel+shift","none"],"default":"wheel"},"tooltip":{"$ref":"#/definitions/tooltip"},"yAxis":{"allOf":[{"$ref":"#/definitions/displayAxis"},{"properties":{"showLastValue":{"type":"string","enum":["None","All","Main"],"default":"All"},"includePercentChangeWithLastValue":{"type":"boolean","default":false},"snapAnnotationsToPrices":{"type":"boolean","default":false},"minPaddingPercent":{"$ref":"#/definitions/paddingPercent"},"maxPaddingPercent":{"$ref":"#/definitions/paddingPercent"},"primaryOnTheLeft":{"type":"boolean"}}}]},"xAxis":{"allOf":[{"$ref":"#/definitions/displayAxis"},{"properties":{"format":{"type":"string","minLength":1},"minTickInterval":{"type":"number","default":0},"tickPixelInterval":{"type":"number","default":0},"visibleRange":{"$ref":"#/definitions/range"},"position":{"type":"string","enum":["bottom","top","both"],"default":"bottom"},"equidistant":{"type":"boolean","default":true},"marginBars":{"type":"number","minimum":0,"default":0},"zoom":{"type":"number","default":0},"resizeHandles":{"type":"boolean","default":false},"forceTicksVisible":{"type":"boolean"},"panning":{"type":"boolean"},"isOrdinal":{"type":"boolean"},"nonEodLabelWithDate":{"type":"boolean"},"ordinalName":{"type":"string"},"contractTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","fillColor":"rgba(119,119,119,0.1)","dashStyle":"LongDashDot"}},"cycleTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","fillColor":"rgba(119,119,119,0.1)","dashStyle":"ShortDashDot"}}}}]},"annotationTraits":{"$ref":"#/definitions/annTraits"},"curveTraits":{"type":"array","items":{"$ref":"#/definitions/curveTrait"}},"allAnnotationsLocked":{"type":"boolean","default":false},"hiddenItems":{"$ref":"#/definitions/hiddenItems","default":"None"}}},"hiddenItems":{"type":"string","enum":["None","Annotations","Studies","All"]},"curveZone":{"type":"object","additionalProperties":false,"properties":{"value":{"type":"number"},"colors":{"type":"number"},"gradient":{"type":"string","enum":["linLighten","linDarken"]}}},"curveNonStrict":{"type":"object","additionalProperties":false,"properties":{"attributes":{"type":"array","items":{"$ref":"#/definitions/curveAttr"}},"colors":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/color"}},"fields":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curveField"}},"style":{"$ref":"#/definitions/curveStyle","default":"Line"},"lineWidth":{"type":"number","default":2},"lineMarker":{"type":"string","enum":["Circle","Square","Diamond","TriangleUp","TriangleDown"]},"lineSmoothing":{"type":"integer"},"dashStyle":{"$ref":"#/definitions/dashStyle"},"varyColorPerBar":{"type":"boolean","default":false},"visible":{"type":"boolean","default":true},"zones":{"type":"array","items":{"$ref":"#/definitions/curveZone"}},"shift":{"type":"integer"}}},"curve":{"allOf":[{"$ref":"#/definitions/curveNonStrict"}],"required":["colors","fields"]},"plotEventDividends":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#037c27"},"title":{"type":"string","default":"D"}},"required":["show"]},"plotEventEarnings":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#08a0c9"},"title":{"type":"string","default":"E"}},"required":["show"]},"plotEventSplits":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#de7726"},"title":{"type":"string","default":"S"}},"required":["show"]},"plotEventCustom":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#be7404"},"title":{"type":"string","default":"C"}},"required":["show"]},"plotEvents":{"type":"object","additionalProperties":false,"properties":{"dividends":{"$ref":"#/definitions/plotEventDividends"},"earnings":{"$ref":"#/definitions/plotEventEarnings"},"splits":{"$ref":"#/definitions/plotEventSplits"},"custom":{"$ref":"#/definitions/plotEventCustom"},"placement":{"$ref":"#/definitions/plotPlacement","default":"WithSeries"}}},"fundamentalFrequency":{"type":"string","enum":["Quarter","Year"]},"numberInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"number"},"integer":{"type":"boolean","enum":[false]}}},"stringInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"string"}}},"input":{"type":"object","oneOf":[{"$ref":"#/definitions/integerInput"},{"$ref":"#/definitions/numberInput"},{"$ref":"#/definitions/stringInput"}]},"inputs":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/input"}},"curves":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curve"}},"uid":{"type":"string","minLength":1},"symbolType":{"type":"string","pattern":"Symbol"},"symbolPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"symbol":{"type":"string"},"events":{"$ref":"#/definitions/plotEvents"},"showPrevious":{"type":"boolean","default":false},"uid":{"$ref":"#/definitions/uid"},"type":{"$ref":"#/definitions/symbolType"},"main":{"type":"boolean","default":false},"inputs":{"$ref":"#/definitions/inputs"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","curves","symbol","type"]},"fundamentalType":{"type":"string","enum":["BalanceSheet","IncomeStatement"]},"fundamentalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"symbol":{"type":"string"},"fundamental":{"$ref":"#/definitions/fundamentalFrequency","default":"Quarter"},"uid":{"$ref":"#/definitions/uid"},"type":{"$ref":"#/definitions/fundamentalType"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","curves","symbol","type"]},"studyLevels":{"type":"array","items":{"$ref":"#/definitions/studyLevel"}},"studyLevel":{"type":"object","additionalProperties":false,"properties":{"value":{"type":"number"},"line":{"$ref":"#/definitions/lineTrait"},"name":{"type":"string"},"visible":{"type":"boolean","default":true}},"required":["value","line"]},"studyBands":{"type":"array","items":{"$ref":"#/definitions/studyBand"}},"studyBand":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"#/definitions/range"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["range","fill"]},"studyType":{"type":"string","pattern":"Study"},"studyBasisMain":{"type":"object","additionalProperties":false,"properties":{"kind":{"type":"string","enum":["main"]}},"required":["kind"]},"studyBasisSeasonal":{"type":"object","additionalProperties":false,"properties":{"kind":{"type":"string","enum":["seasonal"]},"uid":{"$ref":"#/definitions/uid"},"offset":{"type":"number"}},"required":["kind","uid","offset"]},"studyBasis":{"oneOf":[{"$ref":"#/definitions/studyBasisMain"},{"$ref":"#/definitions/studyBasisSeasonal"}]},"studyPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"basis":{"$ref":"#/definitions/studyBasis","default":{"kind":"main"}},"study":{"$ref":"#/definitions/study"},"uid":{"$ref":"#/definitions/uid"},"source":{"$ref":"#/definitions/curveField"},"inputs":{"$ref":"#/definitions/inputs"},"type":{"$ref":"#/definitions/studyType"},"levels":{"$ref":"#/definitions/studyLevels"},"bands":{"$ref":"#/definitions/studyBands"},"detachedScale":{"type":"boolean"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["uid","study","type"]},"exprType":{"type":"string","pattern":"Expression"},"exprPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"expression":{"type":"string"},"uid":{"$ref":"#/definitions/uid"},"type":{"$ref":"#/definitions/exprType"},"main":{"type":"boolean","default":false},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","expression","type"]},"forwardType":{"type":"string","pattern":"Forward"},"intOffset":{"type":"integer","multipleOf":1},"intOffsets":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/intOffset"}},"forwardPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"forward":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"uid":{"$ref":"#/definitions/uid"},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/forwardType"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","forward","type"]},"seasonalType":{"type":"string","pattern":"Seasonal"},"seasonalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"seasonal":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"uid":{"$ref":"#/definitions/uid"},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/seasonalType"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","seasonal","type"]},"annPoint":{"type":"object","additionalProperties":false,"properties":{"price":{"type":"number"},"time":{"type":"number"}},"required":["price","time"]},"lineTrait":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number","minimum":0,"default":1},"color":{"$ref":"#/definitions/color","default":"#000"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"transitionLine":{"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean"},"width":{"type":"number","minimum":1},"color":{"$ref":"#/definitions/color"},"fillColor":{"$ref":"#/definitions/color"},"dashStyle":{"$ref":"#/definitions/dashStyle"}}},"fillTrait":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color"}}},"markerTrait":{"type":"object","additionalProperties":false,"properties":{"vertex":{"enum":["start","end","both","none"]},"kind":{"enum":["arrow"],"default":"arrow"}},"required":["vertex"]},"curveTrait":{"type":"object","additionalProperties":false,"properties":{"curveStyle":{"$ref":"#/definitions/curveStyle"},"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["curveStyle"]},"annTraits":{"type":"object","additionalProperties":true,"properties":{"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"},"marker":{"$ref":"#/definitions/markerTrait"},"zIndex":{"type":"number","minimum":1}}},"annotation":{"type":"object","additionalProperties":false,"properties":{"id":{"$ref":"#/definitions/annId"},"uid":{"$ref":"#/definitions/uid"},"visible":{"type":"boolean","default":true},"locked":{"type":"boolean","default":false},"points":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/annPoint"}},"traits":{"$ref":"#/definitions/annTraits"}},"required":["id","uid","points"]},"plot":{"type":"object","oneOf":[{"$ref":"#/definitions/seasonalPlot"},{"$ref":"#/definitions/forwardPlot"},{"$ref":"#/definitions/exprPlot"},{"$ref":"#/definitions/symbolPlot"},{"$ref":"#/definitions/fundamentalPlot"},{"$ref":"#/definitions/studyPlot"}]},"annCacheEntry":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"},"annotations":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/annotation"}}},"required":["symbol","annotations"]},"axis":{"type":"object","additionalProperties":false,"properties":{"comparison":{"$ref":"#/definitions/comparison","default":"None"},"plots":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/plot"}},"annotations":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/annotation"}},"scale":{"$ref":"#/definitions/scale","default":"Linear"},"annCache":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/annCacheEntry"}},"label":{"type":"string"}},"required":["plots"]},"pane":{"type":"object","additionalProperties":false,"properties":{"axes":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/axis"}},"height":{"$ref":"#/definitions/paneHeight","default":1},"alignOnExpirations":{"type":"boolean","default":false}},"required":["axes"]},"integerInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"integer"},"integer":{"type":"boolean","enum":[true]}},"required":["name","value","integer"]}}`),type:`object`,additionalProperties:!1,properties:{data:{$ref:`#/definitions/data`},display:{$ref:`#/definitions/display`},panes:{type:`array`,minItems:1,items:{$ref:`#/definitions/pane`}},version:{type:`integer`,minimum:182,multipleOf:1}},required:[`panes`,`version`]},Us={$schema:`http://json-schema.org/draft-04/schema#`,title:`JSON schema for Barchart studies for HTML5 Charts`,definitions:{studyMetadata:{type:`object`,additionalProperties:!1,properties:{title:{type:`string`},overlay:{type:`boolean`,default:!0},decimals:{type:`number`},shiftable:{type:`boolean`},singleFieldBased:{type:`boolean`,default:!1},range:{type:`object`,additionalProperties:!1,properties:{min:{type:`number`},max:{type:`number`}}},enumerations:{type:`array`,minItems:1,items:{$ref:`#/definitions/enumeration`}}},required:[`title`]},enumeration:{type:`object`,additionalProperties:!1,properties:{input:{type:`string`},values:{type:`array`,items:{type:`string`}}}},studyDefaults:{type:`object`,additionalProperties:!1,properties:{curves:{$ref:`chart.schema.json#/definitions/curves`},source:{$ref:`chart.schema.json#/definitions/curveField`},inputs:{description:`Input defaults. Declare discrete numeric inputs with integer: true; their defaults must be integers.`,$ref:`chart.schema.json#/definitions/inputs`},levels:{$ref:`chart.schema.json#/definitions/studyLevels`},bands:{$ref:`chart.schema.json#/definitions/studyBands`}},required:[`curves`]},studyDefinition:{type:`object`,additionalProperties:!1,properties:{id:{$ref:`chart.schema.json#/definitions/study`},meta:{$ref:`#/definitions/studyMetadata`},defaults:{$ref:`#/definitions/studyDefaults`}},required:[`id`,`meta`,`defaults`]}},type:`array`,minItems:1,items:{$ref:`#/definitions/studyDefinition`}},Ws={$schema:`http://json-schema.org/draft-04/schema#`,title:`JSON schema for Barchart fields for HTML5 Charts`,definitions:{valueType:{type:`string`,enum:[`Number`,`String`,`Date`],default:`Number`},fieldCategory:{type:`string`,enum:[`Common`,`Study`,`BalanceSheet`,`IncomeStatement`,`Event`,`Option`],default:`Common`},fieldFormat:{type:`string`,enum:[`FromMetaData`,`AsInteger`,`UseMetricUnit`,`AsPercent`],default:`FromMetaData`},fieldDefinition:{type:`object`,additionalProperties:!1,properties:{id:{anyOf:[{$ref:`chart.schema.json#/definitions/curveField`},{$ref:`chart.schema.json#/definitions/eventField`}]},type:{$ref:`#/definitions/valueType`},category:{$ref:`#/definitions/fieldCategory`},name:{type:`string`,default:null},shortName:{type:`string`,default:null},format:{$ref:`#/definitions/fieldFormat`}},required:[`id`]}},type:`array`,minItems:1,items:{$ref:`#/definitions/fieldDefinition`}},Gs={$schema:`http://json-schema.org/draft-04/schema`,title:`JSON schema for the Barchart API of the HTML5 Charts`,definitions:JSON.parse(`{"curvesNonStrict":{"type":"array","maxItems":1,"items":{"$ref":"chart.schema.json#/definitions/curveNonStrict"}},"mainPlotSymbolContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"symbol":{"type":"string"}},"required":["symbol"]},"mainPlotExpressionContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"expression":{"type":"string"}},"required":["expression"]},"mainPlotForwardContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"forward":{"type":"string"}},"required":["forward"]},"mainPlotSeasonalContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"seasonal":{"type":"string"}},"required":["seasonal"]},"mainPlotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MainPlot"},"context":{"oneOf":[{"$ref":"#/definitions/mainPlotSymbolContext"},{"$ref":"#/definitions/mainPlotExpressionContext"},{"$ref":"#/definitions/mainPlotForwardContext"},{"$ref":"#/definitions/mainPlotSeasonalContext"}]}},"required":["id","context"]},"aggregationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Aggregation"},"context":{"$ref":"chart.schema.json#/definitions/aggregation"}},"required":["id","context"]},"periodContext":{"type":"object","additionalProperties":false,"properties":{"period":{"$ref":"chart.schema.json#/definitions/period"}},"required":["period"]},"rangeContext":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"chart.schema.json#/definitions/range"}},"required":["range"]},"densityContext":{"type":"object","additionalProperties":false,"properties":{"density":{"$ref":"chart.schema.json#/definitions/density"}},"required":["density"]},"periodAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Period"},"context":{"oneOf":[{"$ref":"#/definitions/periodContext"},{"$ref":"#/definitions/rangeContext"},{"$ref":"#/definitions/densityContext"}]}},"required":["id","context"]},"crosshairProperties":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"chart.schema.json#/definitions/color"},"dashStyle":{"$ref":"chart.schema.json#/definitions/dashStyle"}},"required":["color"]},"crosshairAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Crosshair"},"context":{"type":"object","additionalProperties":false,"properties":{"crosshair":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"horizontal":{"$ref":"#/definitions/crosshairProperties"},"vertical":{"$ref":"#/definitions/crosshairProperties"}},"required":["crosshair"]}},"required":["id","context"]},"tooltipAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Tooltip"},"context":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean"},"mode":{"type":"string","enum":["standard","cards","external"]}},"required":["visible"]}},"required":["id","context"]},"eventsAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Events"},"context":{"type":"object","additionalProperties":false,"properties":{"dividends":{"type":"boolean"},"earnings":{"type":"boolean"},"splits":{"type":"boolean"},"custom":{"type":"boolean"}}}},"required":["id","context"]},"axisPadding":{"type":"number","minimum":0.001,"maximum":1},"scaleAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Scale"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"scale":{"type":"string","enum":["Linear","Logarithmic"]},"marginBars":{"type":"number","minimum":0},"minPadding":{"$ref":"#/definitions/axisPadding"},"maxPadding":{"$ref":"#/definitions/axisPadding"},"preventLabelOverlap":{"type":"boolean"},"snapAnnotationsToPrices":{"type":"boolean"},"horizontalAxisPosition":{"type":"string","enum":["bottom","top","both"]},"primaryOnTheLeft":{"type":"boolean"}}}},"required":["id","context"]},"otherAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Other"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"useLastTrade":{"type":"boolean"},"percentChange":{"type":"boolean"},"comparisonMode":{"type":"string","enum":["None","Percent","Value"]},"showLastValue":{"type":"string","enum":["None","All","Main"]},"hiddenItems":{"$ref":"chart.schema.json#/definitions/hiddenItems"},"gridLines":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"minorGridLines":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"newPaneHeight":{"type":"number","minimum":0.01},"showNavigator":{"type":"boolean"},"plotHover":{"type":"boolean"}}}},"required":["id","context"]},"placement":{"type":"string","enum":["overlay","standalone","withMain","clone"]},"plotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Plot"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Add","Get","Delete","Update"]},"type":{"type":"string","enum":["Symbol","Study","IncomeStatement","BalanceSheet","Expression","Forward","Seasonal"]},"main":{"type":"boolean"},"index":{"$ref":"chart.schema.json#/definitions/intOffset"},"uid":{"type":"string"},"studyId":{"$ref":"chart.schema.json#/definitions/study"},"fundamentalId":{"$ref":"chart.schema.json#/definitions/fundamental"},"expression":{"type":"string"},"forward":{"type":"string"},"seasonal":{"type":"string"},"frequency":{"$ref":"chart.schema.json#/definitions/fundamentalFrequency","default":"Quarter"},"inputs":{"$ref":"#/definitions/inputValues"},"curves":{"$ref":"#/definitions/curvesNonStrict"},"levels":{"$ref":"chart.schema.json#/definitions/studyLevels"},"bands":{"$ref":"chart.schema.json#/definitions/studyBands"},"basis":{"$ref":"chart.schema.json#/definitions/studyBasis"},"placement":{"$ref":"#/definitions/placement"},"cloneIndex":{"$ref":"chart.schema.json#/definitions/intOffset"},"cloneUid":{"type":"string"},"oppositeScale":{"type":"boolean","default":false},"paneIndex":{"$ref":"chart.schema.json#/definitions/intOffset"},"offsets":{"$ref":"chart.schema.json#/definitions/intOffsets"}},"required":["id"]}},"required":["id","context"]},"curveOptional":{},"compareSymbol":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"},"leftScale":{"type":"boolean","default":false},"curves":{"$ref":"#/definitions/curvesNonStrict"}},"required":["symbol"]},"comparePlot":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"type":{"type":"string","enum":["Symbol","Expression","Seasonal"]},"symbol":{"type":"string"},"expression":{"type":"string"},"seasonal":{"type":"string"},"leftScale":{"type":"boolean","default":false},"oppositeScale":{"type":"boolean","default":false},"curves":{"$ref":"#/definitions/curvesNonStrict"}},"required":["type"]},"compareAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Compare"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"symbols":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/compareSymbol"}},"plots":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/comparePlot"}},"alignOnExpirations":{"type":"boolean"}},"anyOf":[{"required":["id"]},{"required":["symbols"]},{"required":["plots"]}]}},"required":["id","context"]},"annotationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"^Annotation$"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Add","Get","Delete","Update","Duplicate","List","Cache","FlipHorizontal","FlipVertical"]},"uid":{"type":"string","default":""},"visible":{"type":"boolean"},"locked":{"type":"boolean"},"traits":{"$ref":"chart.schema.json#/definitions/annTraits"},"extras":{"type":"object","additionalProperties":true},"points":{"type":"array","items":{"$ref":"chart.schema.json#/definitions/annPoint"}},"annotation":{"$ref":"chart.schema.json#/definitions/annotation"},"index":{"type":"integer"}},"required":["id"]}},"required":["id","context"]},"movePaneAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MovePane"},"context":{"type":"object","additionalProperties":false,"properties":{"from":{"$ref":"chart.schema.json#/definitions/intOffset"},"to":{"$ref":"chart.schema.json#/definitions/intOffset"}},"required":["from","to"]}},"required":["id","context"]},"movePlotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MovePlot"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"type":{"type":"string","enum":["Symbol","Study","IncomeStatement","BalanceSheet","Expression","Forward","Seasonal"]},"uid":{"type":"string"},"index":{"$ref":"chart.schema.json#/definitions/intOffset"},"targetPane":{"type":"string","enum":["ExistingAbove","NewAbove","ExistingBelow","NewBelow"]}},"required":["type"],"anyOf":[{"required":["uid"]},{"required":["index"]}]}},"required":["id","context"]},"pinPlotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"PinPlot"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"type":{"type":"string","enum":["Symbol","Study","IncomeStatement","BalanceSheet","Expression","Forward","Seasonal"]},"uid":{"type":"string"},"index":{"$ref":"chart.schema.json#/definitions/intOffset"},"targetAxis":{"type":"string","enum":["PrimaryAxis","SecondaryAxis","NoAxis"]}},"required":["type"],"anyOf":[{"required":["uid"]},{"required":["index"]}]}},"required":["id","context"]},"templateAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Template"},"context":{"type":"object","additionalProperties":false,"properties":{"strip":{"type":"object","additionalProperties":false,"properties":{"main":{"type":"boolean","default":true},"annotations":{"type":"boolean","default":false},"compare":{"type":"boolean","default":false}}}},"required":["strip"]}},"required":["id","context"]},"outlineAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Outline"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Get"}},"required":["id"]}},"required":["id","context"]},"themeAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Theme"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"backgroundColor":{"$ref":"chart.schema.json#/definitions/color"},"axis":{"type":"object","additionalProperties":false,"properties":{"gridLinesColor":{"$ref":"chart.schema.json#/definitions/color"},"gridLinesStyle":{"$ref":"chart.schema.json#/definitions/dashStyle"},"textColor":{"$ref":"chart.schema.json#/definitions/color"},"crosshairColor":{"$ref":"chart.schema.json#/definitions/color"}}},"fontSize":{"type":"object","additionalProperties":false,"properties":{"chart":{"type":"number"},"xAxis":{"type":"number"},"yAxis":{"type":"number"}}}}}}},"annotationManipulationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["AnnotationManipulation"]},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"uid":{"type":"string"},"preview":{"type":"boolean"},"selected":{"type":"boolean"},"position":{"oneOf":[{"type":"integer","minimum":0},{"type":"string","enum":["Front","Back"]}]}}}},"required":["id","context"]},"inputValues":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":["number","string"]},"integer":{"type":"boolean"}}}}}`),type:`object`,oneOf:[{$ref:`#/definitions/mainPlotAccessor`},{$ref:`#/definitions/aggregationAccessor`},{$ref:`#/definitions/periodAccessor`},{$ref:`#/definitions/crosshairAccessor`},{$ref:`#/definitions/tooltipAccessor`},{$ref:`#/definitions/eventsAccessor`},{$ref:`#/definitions/scaleAccessor`},{$ref:`#/definitions/otherAccessor`},{$ref:`#/definitions/plotAccessor`},{$ref:`#/definitions/compareAccessor`},{$ref:`#/definitions/annotationAccessor`},{$ref:`#/definitions/movePaneAccessor`},{$ref:`#/definitions/movePlotAccessor`},{$ref:`#/definitions/pinPlotAccessor`},{$ref:`#/definitions/templateAccessor`},{$ref:`#/definitions/outlineAccessor`},{$ref:`#/definitions/themeAccessor`},{$ref:`#/definitions/annotationManipulationAccessor`}]},Ks=JSON.parse(`[{"id":"MA","meta":{"title":"Moving Average","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MA"]}]}},{"id":"CSHO","meta":{"title":"Cash Overlay","overlay":true},"defaults":{"source":"Symbol","curves":[{"colors":["#834c3f"],"fields":["CSHO"]}]}},{"id":"CSHB","meta":{"title":"Cash Basis","overlay":false},"defaults":{"source":"Symbol","curves":[{"colors":["#b2b900"],"fields":["CSHB"]}]}},{"id":"MKTCAP","meta":{"title":"Market Capitalization","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#3498db"],"fields":["MKTCAP"]}]}},{"id":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10,"integer":true},{"name":"BarColoring","value":"LikeMain"}],"curves":[{"colors":["#9075d6"],"fields":["VOLMA"]},{"colors":["#ef4226","#00b04b","#1f4bb6"],"fields":["Volume"],"style":"Column","varyColorPerBar":true}]}},{"id":"OSCI","meta":{"title":"Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#ae272d"],"fields":["OSC"]}]}},{"id":"OSCIVOL","meta":{"title":"Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#9326ff"],"fields":["VOSC"]}]}},{"id":"MAENV","meta":{"title":"Moving Average Envelope","overlay":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVU"]},{"colors":["#25329b"],"fields":["ENVD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVU","ENVD"],"style":"Ribbon","lineWidth":0}]}},{"id":"LINRCHN","meta":{"title":"Linear Regression Channel","overlay":true,"enumerations":[{"input":"ExtendLines","values":["None","Left","Right","Both"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100,"integer":true},{"name":"Width","value":2},{"name":"ExtendLines","value":"None"}],"curves":[{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRUP"]},{"colors":["rgba(255, 0, 0, 0.3)"],"fields":["LINRMID"]},{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRLOW"]},{"colors":["rgba(0, 0, 255, 0.1)"],"fields":["LINRUP","LINRMID"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 0, 0, 0.1)"],"fields":["LINRMID","LINRLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVEXP","meta":{"title":"Moving Average Envelope Exponential","overlay":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVEXPU"]},{"colors":["#25329b"],"fields":["ENVEXPD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVEXPU","ENVEXPD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVSMO","meta":{"title":"Moving Average Envelope Smoothed","overlay":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVSMOU"]},{"colors":["#25329b"],"fields":["ENVSMOD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVSMOU","ENVSMOD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAEXP","meta":{"title":"Moving Average Exponential","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#ae272d"],"fields":["EMA"]}]}},{"id":"MASMO","meta":{"title":"Moving Average Smoothed","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":9,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#743800"],"fields":["SMA"]}]}},{"id":"MATRI","meta":{"title":"Moving Average Triangular","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#888"],"fields":["TMA"]}]}},{"id":"MAWEI","meta":{"title":"Moving Average Weighted","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#bc41ce"],"fields":["WMA"]}]}},{"id":"MAHLC","meta":{"title":"Moving Average High/Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":8,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["MAHI"]},{"colors":["#ef4226"],"fields":["MALO"]}]}},{"id":"MACD","meta":{"title":"MACD Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MACD"]},{"colors":["#9326ff"],"fields":["MACDS"]},{"colors":["rgba(119, 17, 17, 0.3)","#771111","rgba(0, 170, 170, 0.3)","#00aaaa"],"fields":["MACDH"],"style":"Column","varyColorPerBar":true}],"levels":[{"value":1,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-1,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MACDEXP","meta":{"title":"MACD Oscillator Exponential","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MACD"]},{"colors":["#bc41ce"],"fields":["MACDS"]},{"colors":["rgba(119, 17, 17, 0.3)","#771111","rgba(0, 170, 170, 0.3)","#00aaaa"],"fields":["MACDH"],"style":"Column","varyColorPerBar":true}],"levels":[{"value":1,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-1,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MACDV","meta":{"title":"MACD-V Oscillator","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true},{"name":"Average","value":"EMA"}],"curves":[{"colors":["#808080"],"fields":["MACDV"]},{"colors":["#9326ff"],"fields":["MACDVS"]},{"colors":["rgba(119, 17, 17, 0.3)","#771111","rgba(0, 170, 170, 0.3)","#00aaaa"],"fields":["MACDVH"],"style":"Column","varyColorPerBar":true}],"levels":[{"value":150,"name":"Overbought","line":{"color":"#606060","dashStyle":"LongDashDot"}},{"value":50,"name":"Neutral (upper)","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-50,"name":"Neutral (lower)","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-150,"name":"Oversold","line":{"color":"#606060","dashStyle":"LongDashDot"}}]}},{"id":"VOL","meta":{"title":"Volume","overlay":true,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"inputs":[{"name":"BarColoring","value":"LikeMain"}],"curves":[{"colors":["rgba(239,66,38, 0.5)","rgba(0,176,75, 0.5)","rgba(31,75,182, 0.5)"],"fields":["Volume"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(187,69,204, 0.5)"],"fields":["OpenInterest"]}]}},{"id":"OPINT","meta":{"title":"Open Interest","overlay":false,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#bb45cc"],"fields":["OpenInterest"]}]}},{"id":"RSI","meta":{"title":"Relative Strength Index (RSI)","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2,"range":{"min":0,"max":100},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSI"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["RSIAVG"]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSA","meta":{"title":"Relative Strength Average","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2,"range":{"min":0,"max":100},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":9,"integer":true},{"name":"Period2","value":45,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSA"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["RSAAVG"]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSIMOD","meta":{"title":"Relative Strength Index (RSI) Modified","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2,"range":{"min":0,"max":100},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSI"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["RSIAVG"]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSISTO","meta":{"title":"Stochastic RSI","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":3,"range":{"min":0,"max":1},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true},{"name":"Range","value":20,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["STORSI"],"zones":[{"value":0.2,"colors":1},{"value":0.8,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["STORSIAVG"]}],"levels":[{"value":0.2,"name":"Oversold","line":{"color":"#444"}},{"value":0.5,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":0.8,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"HHLL","meta":{"title":"Highest High Lowest Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["HH"]},{"colors":["#ef4226"],"fields":["LL"]}]}},{"id":"WGCL","meta":{"title":"Weighted Close","overlay":true},"defaults":{"curves":[{"colors":["#f18900"],"fields":["WGCL"]}]}},{"id":"WGALPH","meta":{"title":"Weighted Alpha","overlay":false,"decimals":2,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"colors":["rgba(182, 52, 0, 1)","rgba(36, 173, 84, 1)"],"fields":["WGALPH"],"style":"Line","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"WPERCR","meta":{"title":"Williams Percent Range","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#ff6e00"],"fields":["PercR"]}],"levels":[{"value":-80,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-20,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":-80,"to":-20}}]}},{"id":"STOCHF","meta":{"title":"Stochastic, Fast","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"Period1","value":14,"integer":true},{"name":"Period2","value":3,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["PercK"],"zones":[{"value":20,"colors":1},{"value":80,"colors":2},{"colors":100}]},{"colors":["#f08f4c"],"fields":["PercD"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"STOCHS","meta":{"title":"Stochastic, Slow","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"Period1","value":14,"integer":true},{"name":"Period2","value":3,"integer":true},{"name":"Period3","value":3,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["PercK"],"zones":[{"value":20,"colors":1},{"value":80,"colors":2},{"colors":100}]},{"colors":["#f08f4c"],"fields":["PercD"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#445"}}]}},{"id":"BBANDS","meta":{"title":"Bollinger Bands","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2},{"name":"Offset","value":0,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["BOLLBU"]},{"colors":["#89211e"],"fields":["BOLLBM"]},{"colors":["#00aaab"],"fields":["BOLLBL"]},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["BOLLBU","BOLLBL"],"style":"Ribbon","lineWidth":0}]}},{"id":"MBBANDS","meta":{"title":"Bollinger Bands Modified","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"MultInside","value":3},{"name":"MultOutside","value":4},{"name":"Offset","value":0,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["MBBUO"],"lineWidth":2},{"colors":["#9075d6"],"fields":["MBBUI"],"lineWidth":1},{"colors":["#89211e"],"fields":["MBBM"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLI"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLO"],"lineWidth":2},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["MBBUI","MBBLI"],"style":"Ribbon","lineWidth":0}]}},{"id":"BWIDTH","meta":{"title":"Bollinger Width","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2}],"curves":[{"colors":["#f18900"],"fields":["BOLLW"]}]}},{"id":"BPERC","meta":{"title":"Bollinger Bands %B","decimals":4,"overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2}],"curves":[{"colors":["#138484"],"fields":["BOLLP"]}],"levels":[{"value":0,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":1,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(19, 132, 132, 0.1)"},"range":{"from":0,"to":1}}]}},{"id":"OBVOL","meta":{"title":"On Balance Volume","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#2284dd"],"fields":["OBVOL"]},{"colors":["#896fc3"],"fields":["OBVOLAVG"]}]}},{"id":"ATR","meta":{"title":"Average True Range (ATR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"SMA"},{"name":"Period2","value":20,"integer":true}],"curves":[{"colors":["#ffaf1c"],"fields":["ATR"]},{"colors":["#1c6cff"],"fields":["ATRMA"]}]}},{"id":"ADR","meta":{"title":"Average Daily Range (ADR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#ffaf1c"],"fields":["ADR"]}]}},{"id":"ADRP","meta":{"title":"Average Daily Range Percent (ADRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#fb1cff"],"fields":["ADRP"]}]}},{"id":"ATRP","meta":{"title":"Average True Range Percent (ATRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"SMA"}],"curves":[{"colors":["#fb1cff"],"fields":["ATRP"]}]}},{"id":"ADJATR","meta":{"title":"Average True Range Adjusted (ADJATR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#ffaf1c"],"fields":["ADJATR"]}]}},{"id":"COTR","meta":{"title":"Change over True Range","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]},{"input":"TypeOfATR","values":["ATR","ADJATR"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"SMA"},{"name":"TypeOfATR","value":"ATR"}],"curves":[{"colors":["#ffaf1c"],"fields":["COTR"]}]}},{"id":"ADX","meta":{"title":"Average Directional Index (ADX)","overlay":false},"defaults":{"inputs":[{"name":"AdxSmoothing","value":14,"integer":true},{"name":"DiLength","value":14,"integer":true}],"curves":[{"colors":["#bc41ce"],"fields":["MDI"]},{"colors":["#ffaf1c"],"fields":["PDI"]},{"colors":["#00aaab"],"fields":["ADX"]}],"levels":[{"value":20,"name":"Trendless","line":{"color":"#7f7f7f","dashStyle":"Dash"}},{"value":25,"name":"Trending","line":{"color":"#7f7f7f","dashStyle":"LongDash"}}]}},{"id":"ADXMOD","meta":{"title":"Average Directional Index (ADX) Modified","overlay":false},"defaults":{"inputs":[{"name":"AdxSmoothing","value":14,"integer":true},{"name":"DiLength","value":14,"integer":true}],"curves":[{"colors":["#25329b"],"fields":["MDI"]},{"colors":["#ffaf1c"],"fields":["PDI"]},{"colors":["#9326ff"],"fields":["ADXM"]}],"levels":[{"value":20,"name":"Trendless","line":{"color":"#7f7f7f","dashStyle":"Dash"}},{"value":25,"name":"Trending","line":{"color":"#7f7f7f","dashStyle":"LongDash"}}]}},{"id":"ADL","meta":{"title":"Chaikin Accumulation Distribution","overlay":false},"defaults":{"curves":[{"colors":["#f18900"],"fields":["ADL"]}]}},{"id":"ADWM","meta":{"title":"Accumulation/Distribution Williams","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#f18900"],"fields":["ADWM"]},{"colors":["#00aaab"],"fields":["ADWMMA"]}]}},{"id":"CHAOSC","meta":{"title":"Chaikin Oscillator","overlay":false},"defaults":{"curves":[{"colors":["#2284dd"],"fields":["CHAOSC"]}]}},{"id":"TP","meta":{"title":"Typical Price","overlay":true},"defaults":{"curves":[{"colors":["#bc41ce"],"fields":["TP"]}]}},{"id":"KELCHN","meta":{"title":"Keltner Channel","overlay":true,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Average","value":"MA"}],"curves":[{"colors":["#f18900"],"fields":["KCUP"]},{"colors":["#2284dd"],"fields":["KCMID"]},{"colors":["#480048"],"fields":["KCLOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KCUP","KCLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"KELBND","meta":{"title":"Keltner Bands","overlay":true,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Multiplier","value":2.5},{"name":"Average","value":"EMA"}],"curves":[{"colors":["#f18900"],"fields":["KBUP"]},{"colors":["#2284dd"],"fields":["KBMID"]},{"colors":["#480048"],"fields":["KBLOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KBUP","KBLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"DONCHN","meta":{"title":"Donchian Channel","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["DONUP"]},{"colors":["#ff6a00"],"fields":["DONMID"]},{"colors":["#0c32ff"],"fields":["DONLOW"]},{"colors":["rgba(12, 50, 255, 0.1)"],"fields":["DONUP","DONLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"DONWIDTH","meta":{"title":"Donchian Width","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#480048"],"fields":["DONW"]}]}},{"id":"PVT","meta":{"title":"Price Volume Trend","overlay":false},"defaults":{"curves":[{"colors":["#ae272d"],"fields":["PVT"]}]}},{"id":"ROC","meta":{"title":"Rate Of Change","overlay":false,"decimals":2,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#2284dd"],"fields":["ROC"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"TRIX","meta":{"title":"Triple Exponential","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":15,"integer":true}],"curves":[{"colors":["#743800"],"fields":["TRIX"]}]}},{"id":"DEMA","meta":{"title":"Moving Average Exponential DEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":15,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#743800"],"fields":["DEMA"]}]}},{"id":"EOSC","meta":{"title":"Exponential Oscillator","overlay":false,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":10,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#ff6f00"],"fields":["EOSC"]}]}},{"id":"TEMA","meta":{"title":"Moving Average Exponential TEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":15,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#743800"],"fields":["TEMA"]}]}},{"id":"TSI","meta":{"title":"True Strength Index","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":25,"integer":true},{"name":"Period2","value":13,"integer":true},{"name":"Period3","value":7,"integer":true}],"curves":[{"colors":["#3bb3e4"],"fields":["TSI"]},{"colors":["#ff006e"],"fields":["TSISIG"]}],"levels":[{"value":-25,"name":"Oversold","line":{"color":"#606060"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":25,"name":"Overbought","line":{"color":"#606060"}}]}},{"id":"PPMOV","meta":{"title":"Pivot Points Bands","overlay":true},"defaults":{"curves":[{"colors":["#ffaf1c"],"fields":["PVPTR"]},{"colors":["#f18900"],"fields":["PVPT"]},{"colors":["#00aaab"],"fields":["PVPTS"]}]}},{"id":"ARNUPDW","meta":{"title":"Aroon Up/Down","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":25,"integer":true}],"curves":[{"colors":["#005716"],"fields":["ARNUP"]},{"colors":["#ae272d"],"fields":["ARNLOW"]}]}},{"id":"ARNOSC","meta":{"title":"Aroon Oscillator","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":25,"integer":true}],"curves":[{"colors":["#808080"],"fields":["ARNOSC"]}]}},{"id":"TCHN","meta":{"title":"Turtle Channel","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodUpper","value":14,"integer":true},{"name":"PeriodLower","value":14,"integer":true},{"name":"Range","value":"High/Low"}],"curves":[{"colors":["#005716"],"fields":["TCHNUP"]},{"colors":["#ae272d"],"fields":["TCHNLOW"]}]}},{"id":"TCHRE","meta":{"title":"Turtle Channel Retracement","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]},{"input":"Retracement","values":["Long","Short"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100,"integer":true},{"name":"Retracement","value":"Long"},{"name":"Adjustment","value":5},{"name":"Range","value":"High/Low"}],"curves":[{"colors":["#2799f6"],"fields":["TCHRE"]}]}},{"id":"ALLG","meta":{"title":"Alligator","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":13,"integer":true},{"name":"Period2","value":8,"integer":true},{"name":"Period3","value":5,"integer":true}],"curves":[{"colors":["#25329b"],"fields":["ALJAW"],"shift":8},{"colors":["#7f8000"],"fields":["ALTEETH"],"shift":5},{"colors":["#9326ff"],"fields":["ALLIPS"],"shift":3}]}},{"id":"PLTLN","meta":{"title":"Plot Line","overlay":true},"defaults":{"inputs":[{"name":"Position","value":700}],"curves":[{"colors":["#808080"],"fields":["PLTLN"]}]}},{"id":"AWEOSC","meta":{"title":"Awesome Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":34,"integer":true},{"name":"Period3","value":10,"integer":true}],"curves":[{"colors":["#711","#0aa"],"fields":["AWOS"],"style":"Column","varyColorPerBar":true},{"colors":["#ef4226"],"fields":["AWOSMA"]}]}},{"id":"CLV","meta":{"title":"Close Location Value","overlay":false},"defaults":{"curves":[{"colors":["#00aaab"],"fields":["CLV"]}]}},{"id":"CHAMF","meta":{"title":"Chaikin Money Flow","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["CHAMF"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"CHAVOL","meta":{"title":"Chaikin Volatility","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#808080"],"fields":["CHAVOL"]}]}},{"id":"DPO","meta":{"title":"Detrended Price Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["rgba(136, 136, 136, 0.3)","rgba(136, 136, 136, 0.3)"],"fields":["DPO"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MCGD","meta":{"title":"McGinley Dynamic","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#3bb3e4"],"fields":["MCGD"],"style":"Line"}]}},{"id":"HMA","meta":{"title":"Hull Moving Average","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#674ea7"],"fields":["HMA"],"style":"Line"}]}},{"id":"COPP","meta":{"title":"Coppock Curve","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodWma","value":10,"integer":true},{"name":"PeriodRocLong","value":14,"integer":true},{"name":"PeriodRocShort","value":11,"integer":true}],"curves":[{"colors":["#ff2014","#77dd77"],"fields":["COPP"],"style":"Line","zones":[{"value":0,"colors":1},{"colors":1}]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CCI","meta":{"title":"Commodity Channel Index (CCI)","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#7f8000","rgba(12, 50, 255, 0.3)"],"fields":["CCI"],"zones":[{"value":-100,"colors":1},{"value":100,"colors":2},{"colors":1}]}],"levels":[{"value":-100,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Center","line":{"color":"#606060","dashStyle":"DashDot"}},{"value":100,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(127, 128, 0, 0)"},"range":{"from":-100,"to":100}}]}},{"id":"EMV","meta":{"title":"Ease Of Movement","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#9326ff"],"fields":["EMV"]},{"colors":["#808080"],"fields":["EMVMA"]}]}},{"id":"ERBLPOW","meta":{"title":"Elder Ray Bull Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#005716"],"fields":["ERBLPOW"],"style":"Column"}]}},{"id":"ERBRPOW","meta":{"title":"Elder Ray Bear Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#ae272d"],"fields":["ERBRPOW"],"style":"Column"}]}},{"id":"FI","meta":{"title":"Force Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":13,"integer":true}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["FI"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"MI","meta":{"title":"Mass Index","overlay":false},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["MI"]}]}},{"id":"MOM","meta":{"title":"Momentum","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Movement","value":20,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MOM"]},{"colors":["#505050"],"fields":["MOMMA"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MFI","meta":{"title":"Money Flow Index","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#543daa"],"fields":["MFI"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#787878","dashStyle":"Dash"}},{"value":50,"name":"Center","line":{"color":"rgba(120, 120, 120, 0.5)","dashStyle":"Dash"}},{"value":80,"name":"Overbought","line":{"color":"#787878","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(126, 87, 194, 0.1)"},"range":{"from":20,"to":80}}]}},{"id":"MSD","meta":{"title":"Moving Standard Deviation","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#0c32ff"],"fields":["MSD"]}]}},{"id":"PCTCHG","meta":{"title":"Percent Change","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"colors":["#037d27"],"fields":["PCTCHG"]}]}},{"id":"NVI","meta":{"title":"Negative Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255,"integer":true}],"curves":[{"colors":["#480048"],"fields":["NVI"]},{"colors":["#7f8000"],"fields":["NVIEMA"]}]}},{"id":"PVI","meta":{"title":"Positive Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["PVI"]},{"colors":["#005716"],"fields":["PVIEMA"]}]}},{"id":"PPO","meta":{"title":"Percentage Price Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["PPO"]},{"colors":["#bc41ce"],"fields":["PPOS"]},{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["PPOH"],"style":"Column","varyColorPerBar":true}]}},{"id":"PVO","meta":{"title":"Percentage Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["PVO"]},{"colors":["#bc41ce"],"fields":["PVOS"]},{"colors":["#9075d6"],"fields":["PVOH"],"style":"Column"}]}},{"id":"HV","meta":{"title":"Historical Volatility","overlay":false,"decimals":2,"enumerations":[{"input":"Calculation","values":["Percentage","Absolute"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Calculation","value":"Percentage"},{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#7f8000"],"fields":["HV"]}]}},{"id":"PERF","meta":{"title":"Price Performance","overlay":false,"decimals":2,"enumerations":[{"input":"Anchor","values":["SeriesStart","VisibleStart"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Anchor","value":"SeriesStart"}],"curves":[{"colors":["#00aaab"],"fields":["PERF"]}]}},{"id":"WASI","meta":{"title":"Wilder Accumulative Swing Index","overlay":false},"defaults":{"inputs":[{"name":"Limit","value":3}],"curves":[{"colors":["#bc41ce"],"fields":["WASI"]}]}},{"id":"WWVOL","meta":{"title":"Welles Wilder Volatility","overlay":true},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Constant","value":3}],"curves":[{"colors":["#9326ff"],"fields":["WWVSARD"],"style":"Dots"},{"colors":["#f18900"],"fields":["WWVSARU"],"style":"Dots"}]}},{"id":"PARTP","meta":{"title":"Parabolic Time/Price (SAR)","overlay":true},"defaults":{"inputs":[{"name":"Acceleration","value":50},{"name":"Limit","value":5}],"curves":[{"colors":["#25329b"],"fields":["PARSARS"],"style":"Dots"},{"colors":["#00aaab"],"fields":["PARSARL"],"style":"Dots"}]}},{"id":"REATRS","meta":{"title":"Retracement ATR Stop","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]}]},"defaults":{"source":"Close","inputs":[{"name":"Direction","value":"Long"},{"name":"PeriodAdjATR","value":20,"integer":true},{"name":"PeriodTurtleChn","value":100,"integer":true},{"name":"TurtleChnField","value":"High/Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#981e7a"],"fields":["REATRS"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#480048"],"fields":["MOVLR"]}]}},{"id":"TRSP","meta":{"title":"Trend Seeker®","overlay":true,"enumerations":[{"input":"VelocityUpTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocitySideTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocityDownTrend","values":["1","2","3","4","5","6","7","8","9"]}]},"defaults":{"inputs":[{"name":"VelocityUpTrend","value":"3"},{"name":"VelocitySideTrend","value":"3"},{"name":"VelocityDownTrend","value":"3"}],"curves":[{"colors":["#24ad54"],"fields":["TRSP1"],"style":"Dots"},{"colors":["#ec4533"],"fields":["TRSP2"],"style":"Dots"}]}},{"id":"TARGP","meta":{"title":"Target Price","overlay":true},"defaults":{"curves":[{"colors":["#ff5252","#4cb050"],"fields":["TARGP"],"style":"Line","varyColorPerBar":true}]}},{"id":"COTLC","meta":{"title":"Commitment of Traders (COT) Chart","overlay":false,"decimals":0,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTLCCMSP"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTLCLGSP"],"style":"Step"},{"colors":["#403daf"],"fields":["COTLCSMSP"],"style":"Step"}]}},{"id":"COTDAG","meta":{"title":"Commitment of Traders (COT) Disaggregated","overlay":false,"decimals":0,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTDAGPRO"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTDAGSPD"],"style":"Step"},{"colors":["#403daf"],"fields":["COTDAGMNM"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTDAGOTH"],"style":"Step"}]}},{"id":"COTFTR","meta":{"title":"Commitment of Traders (COT) Financial","overlay":false,"decimals":0,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTFTRDLI"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTFTRASM"],"style":"Step"},{"colors":["#403daf"],"fields":["COTFTRLVF"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTFTROTH"],"style":"Step"}]}},{"id":"PIVPTS","meta":{"title":"Pivot Points","overlay":true,"enumerations":[{"input":"Previous","values":["Day","Week","Month"]}]},"defaults":{"inputs":[{"name":"Previous","value":"Day"}],"curves":[{"colors":["#79a2e3"],"fields":["PPTR3"]},{"colors":["#f08f4c"],"fields":["PPTR2"]},{"colors":["#492c6e"],"fields":["PPTR1"]},{"colors":["#28adcc"],"fields":["PPTPIV"]},{"colors":["#8f040a"],"fields":["PPTS1"]},{"colors":["#8cba32"],"fields":["PPTS2"]},{"colors":["#0e2339"],"fields":["PPTS3"]}]}},{"id":"CPP","meta":{"title":"Camarilla Pivot Points","overlay":true},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["CPPH4"]},{"colors":["#00b04b"],"fields":["CPPH3"]},{"colors":["#00b04b"],"fields":["CPPH2"]},{"colors":["#00b04b"],"fields":["CPPH1"]},{"colors":["#d47928"],"fields":["CPPL1"]},{"colors":["#d47928"],"fields":["CPPL2"]},{"colors":["#d47928"],"fields":["CPPL3"]},{"colors":["#d47928"],"fields":["CPPL4"]}]}},{"id":"IMPVOL","meta":{"title":"Implied Volatility (Futures)","overlay":false,"decimals":2,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#ffc270"],"fields":["IMPVOL"]}]}},{"id":"CTM","meta":{"title":"CommodityTrends Cycle Trading Momentum","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CTM"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]},{"colors":["#9326ff"],"fields":["CTLTM"]}]}},{"id":"CPMI","meta":{"title":"CommodityTrends Principal Momentum Indicator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CPMI"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}]}},{"id":"CTPI","meta":{"title":"CommodityTrends Turning Point Indicator","overlay":false,"decimals":2,"range":{"min":0,"max":100}},"defaults":{"curves":[{"colors":["#ef4226","#2642ef"],"fields":["CTPI"],"zones":[{"value":50,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}],"levels":[{"value":25,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":75,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"GMMA","meta":{"title":"Guppy Multiple Moving Average","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":3,"integer":true},{"name":"Period2","value":5,"integer":true},{"name":"Period3","value":8,"integer":true},{"name":"Period4","value":10,"integer":true},{"name":"Period5","value":12,"integer":true},{"name":"Period6","value":15,"integer":true},{"name":"Period7","value":30,"integer":true},{"name":"Period8","value":35,"integer":true},{"name":"Period9","value":40,"integer":true},{"name":"Period10","value":45,"integer":true},{"name":"Period11","value":50,"integer":true},{"name":"Period12","value":60,"integer":true}],"curves":[{"colors":["#008ae6"],"fields":["GMMA3"]},{"colors":["#008ae6"],"fields":["GMMA5"]},{"colors":["#008ae6"],"fields":["GMMA8"]},{"colors":["#008ae6"],"fields":["GMMA10"]},{"colors":["#008ae6"],"fields":["GMMA12"]},{"colors":["#008ae6"],"fields":["GMMA15"]},{"colors":["#b32400"],"fields":["GMMA30"]},{"colors":["#b32400"],"fields":["GMMA35"]},{"colors":["#b32400"],"fields":["GMMA40"]},{"colors":["#b32400"],"fields":["GMMA45"]},{"colors":["#b32400"],"fields":["GMMA50"]},{"colors":["#b32400"],"fields":["GMMA60"]}]}},{"id":"STOMOMIX","meta":{"title":"Stochastic Momentum Index","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":3,"integer":true}],"curves":[{"colors":["#3bb4e5"],"fields":["STOMOMIX"]}],"levels":[{"value":-40,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":40,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CHDMOMOSC","meta":{"title":"Chande Momentum Oscillator","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":9,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":9,"integer":true}],"curves":[{"colors":["#27c6da"],"fields":["CHDMOMOSC"]},{"colors":["#f08f4c"],"fields":["CHDMOMOSCAVG"]}],"levels":[{"value":-50,"name":"Oversold","line":{"color":"#606060"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":50,"name":"Overbought","line":{"color":"#606060"}}]}},{"id":"VSTOP","meta":{"title":"ATR Volatility Stop","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Multiplier","value":2}],"curves":[{"colors":["#50cc52"],"fields":["VSTOPUP"],"style":"Dots"},{"colors":["#d46757"],"fields":["VSTOPLOW"],"style":"Dots"}]}},{"id":"SUPTR","meta":{"title":"Supertrend","overlay":true},"defaults":{"inputs":[{"name":"Period","value":7,"integer":true},{"name":"Multiplier","value":4}],"curves":[{"colors":["#ff5252","#4cb050"],"fields":["SUPTR"],"style":"Line","varyColorPerBar":true}]}},{"id":"ICHCLD","meta":{"title":"Ichimoku Clouds","overlay":true},"defaults":{"inputs":[{"name":"PeriodConversionLine","value":9,"integer":true},{"name":"PeriodBaseLine","value":26,"integer":true},{"name":"PeriodLaggingSpan2","value":52,"integer":true},{"name":"Displacement","value":26,"integer":true}],"curves":[{"colors":["#0080cd"],"fields":["CONVLN"],"style":"Line"},{"colors":["#cd0000"],"fields":["BASELN"],"style":"Line"},{"colors":["#009900"],"fields":["LAGGSP"],"style":"Line"},{"colors":["#00cd00"],"fields":["LEADSP1"],"style":"Line"},{"colors":["#ff0000"],"fields":["LEADSP2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["LEADSP1","LEADSP2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"VWAP","meta":{"title":"Volume Weighted Average Price (VWAP)","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"AnchorPeriod","values":["Session","Week","Month","Quarter","Year","Decade","Century"]}]},"defaults":{"inputs":[{"name":"Source","value":"HLC/3"},{"name":"AnchorPeriod","value":"Session"},{"name":"Stdev1stMultiplier","value":1},{"name":"Stdev2ndMultiplier","value":2},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#ee762f"],"fields":["VWAP"],"style":"Line"},{"colors":["#ffe44e"],"fields":["VWAPSD1U"],"style":"Line"},{"colors":["#ffe44e"],"fields":["VWAPSD1L"],"style":"Line"},{"colors":["#4aa34e"],"fields":["VWAPSD2U"],"style":"Line"},{"colors":["#4aa34e"],"fields":["VWAPSD2L"],"style":"Line"}]}},{"id":"AVWAP","meta":{"title":"Anchored Volume Weighted Average Price (VWAP)","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Anchor","value":1664496000000,"integer":true},{"name":"Source","value":"HLC/3"}],"curves":[{"colors":["#ee762f"],"fields":["AVWAP"],"style":"Line"}]}},{"id":"MACROSS","meta":{"title":"Moving Averages Crossover","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"ShowSignals","values":["Yes","No"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":9,"integer":true},{"name":"Period2","value":18,"integer":true},{"name":"ShowSignals","value":"Yes"}],"curves":[{"colors":["#ef4226","#00b04b"],"fields":["MAS"],"style":"Line","varyColorPerBar":true},{"colors":["#3479df"],"fields":["MAL"]}]}},{"id":"PACROSS","meta":{"title":"Price/Average Crossover","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"ShowSignals","values":["Yes","No"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period","value":20,"integer":true},{"name":"ShowSignals","value":"Yes"}],"curves":[{"colors":["#ef4226","#00b04b"],"fields":["AVG"],"style":"Line","varyColorPerBar":true}]}},{"id":"VOIN","meta":{"title":"Vortex Indicator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#60b1df"],"fields":["PLVI"]},{"colors":["#ea336f"],"fields":["MNVI"]}]}},{"id":"DIFA","meta":{"title":"Distance From Average","overlay":false,"decimals":2,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Distance","values":["Amount","Percentage"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":200,"integer":true},{"name":"Average","value":"MA"},{"name":"Distance","value":"Percentage"}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["DIFA"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["DIFA"],"style":"Area","visible":false,"zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"PeriodRsi","value":14,"integer":true},{"name":"PeriodEma1","value":5,"integer":true},{"name":"PeriodEma2","value":3,"integer":true},{"name":"PeriodMa","value":9,"integer":true},{"name":"PeriodSig","value":9,"integer":true}],"curves":[{"colors":["#ef5350","#26a69a"],"fields":["DOSCH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]},{"colors":["#cc66ff"],"fields":["DOSCS"]}]}},{"id":"BBANDW","meta":{"title":"Bollinger BandWidth","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"colors":["#3d8283"],"fields":["BOLLBW"]},{"colors":["#f08f4c"],"fields":["BOLLBWA"]}]}},{"id":"MARIB","meta":{"title":"Moving Average Ribbon","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":20,"integer":true},{"name":"Increment","value":5,"integer":true},{"name":"Count","value":10,"integer":true},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#c4291c"],"fields":["MA1"]},{"colors":["#ea3323"],"fields":["MA2"]},{"colors":["#ef8433"],"fields":["MA3"]},{"colors":["#f3cc46"],"fields":["MA4"]},{"colors":["#fffd55"],"fields":["MA5"]},{"colors":["#75f94c"],"fields":["MA6"]},{"colors":["#41904f"],"fields":["MA7"]},{"colors":["#86338b"],"fields":["MA8"]},{"colors":["#ea3df7"],"fields":["MA9"]},{"colors":["#2e72b8"],"fields":["MA10"]}]}},{"id":"HASMO","meta":{"title":"Heikin-Ashi Smoothed","overlay":true,"enumerations":[{"input":"Smoothing1","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Smoothing2","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Smoothing1","value":"EMA"},{"name":"Period1","value":10,"integer":true},{"name":"Smoothing2","value":"EMA"},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#b63400","#007f3e","#1664db","#333","#777"],"fields":["Open","High","Low","Close","Change"],"style":"Candlestick","varyColorPerBar":true,"lineWidth":1}]}},{"id":"TTMSQZ","meta":{"title":"TTM Squeeze","overlay":false},"defaults":{"inputs":[{"name":"PeriodBollinger","value":20,"integer":true},{"name":"WidthBollinger","value":2},{"name":"PeriodEmaKeltner","value":20,"integer":true},{"name":"MultiplierKeltner","value":1.5},{"name":"PeriodAtrKeltner","value":20,"integer":true},{"name":"PeriodMomentum","value":12,"integer":true}],"curves":[{"colors":["rgba(204,0,204,0.7)","rgba(255,155,255,0.7)","rgba(85,136,255,0.7)","rgba(153,204,255,0.7)"],"fields":["TTMSQZOSC"],"style":"Column","varyColorPerBar":true},{"colors":["#24ad54"],"fields":["TTMSQZOFF"],"style":"Dots","lineWidth":4},{"colors":["#ec4533"],"fields":["TTMSQZON"],"style":"Dots","lineWidth":4}]}},{"id":"CRS","meta":{"title":"Comparative Relative Strength","overlay":false,"decimals":4,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Display","values":["Regular","PercentChange"]}]},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"},{"name":"Average","value":"MA"},{"name":"Period","value":20,"integer":true},{"name":"Display","value":"Regular"}],"curves":[{"colors":["#dc9b56"],"fields":["CRS"],"style":"Line"},{"colors":["#865371"],"fields":["CRSAVG"],"style":"Line"}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"JPI","meta":{"title":"Jim Prince Indicator","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Height","values":["Fixed","Performance"]}]},"defaults":{"source":"Close","inputs":[{"name":"FastPeriod","value":8,"integer":true},{"name":"SlowPeriod","value":17,"integer":true},{"name":"HandbrakePeriod","value":40,"integer":true},{"name":"Average","value":"MA"},{"name":"Height","value":"Fixed"}],"curves":[{"colors":["#005716","#efb372"],"fields":["JPIB"],"style":"Column","varyColorPerBar":true},{"colors":["#ae272d","#6faef0"],"fields":["JPIS"],"style":"Column","varyColorPerBar":true}]}},{"id":"CTTP","meta":{"title":"CommodityTrends Trading Plan","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#005716","#efb372"],"fields":["JPIB"],"style":"Column","varyColorPerBar":true},{"colors":["#ae272d","#6faef0"],"fields":["JPIS"],"style":"Column","varyColorPerBar":true}]}},{"id":"CTTI","meta":{"title":"CommodityTrends Trinetic Indicator","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#005716","#efb372"],"fields":["JPIB"],"style":"Column","varyColorPerBar":true},{"colors":["#ae272d","#6faef0"],"fields":["JPIS"],"style":"Column","varyColorPerBar":true}]}},{"id":"DRS","meta":{"title":"Dorsey Relative Strength","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"}],"curves":[{"colors":["#dc9b56"],"fields":["DRS"],"style":"Line"}]}},{"id":"MRS","meta":{"title":"Mansfield Relative Strength","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"},{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["rgba(182, 52, 0, 0.3)","rgba(36, 173, 84, 0.3)"],"fields":["MRS"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"PMO","meta":{"title":"Price Momentum Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":35,"integer":true},{"name":"Period2","value":20,"integer":true},{"name":"Period3","value":10,"integer":true}],"curves":[{"colors":["#4ac93d"],"fields":["PMO"],"style":"Line"},{"colors":["#bbe4b6"],"fields":["PMOS"],"style":"Line"}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"RVOL","meta":{"title":"Relative Volume","overlay":false,"decimals":2,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Smoothing","value":"MA"},{"name":"Period","value":50,"integer":true}],"curves":[{"colors":["#b63400","#24ad54"],"fields":["RVOL"],"style":"Column","zones":[{"value":1,"colors":1},{"colors":1}]}],"levels":[{"value":1,"name":"Baseline","line":{"color":"#444"}}]}},{"id":"VOLAP","meta":{"title":"Volume At Closing Price","overlay":true,"enumerations":[{"input":"Position","values":["Left","Right"]},{"input":"Volume","values":["Up/Down","Total"]},{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]},{"input":"LevelMode","values":["Count","MinIncrements"]}]},"defaults":{"source":"Close","inputs":[{"name":"LevelMode","value":"Count"},{"name":"LevelSize","integer":true,"value":24},{"name":"Volume","value":"Up/Down"},{"name":"BarColoring","value":"LikeMain"},{"name":"Position","value":"Left"},{"name":"WidthPercent","value":40},{"name":"ValueRangePercent","value":70}],"curves":[{"colors":["rgba(239, 65, 38, 0.3)","rgba(0, 176, 76, 0.3)","rgba(31, 74, 182, 0.3)"],"fields":["DNVOL","UPVOL","TOTVOL"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(226,49,240, 0.8)"],"lineWidth":2,"dashStyle":"Solid","fields":["POC"]},{"colors":["rgba(239, 65, 38, 0.6)","rgba(0, 176, 76, 0.6)","rgba(31, 74, 182, 0.6)"],"fields":["VAREA"],"style":"Column","varyColorPerBar":true}]}},{"id":"PVACP","meta":{"title":"Periodic Volume At Closing Price","overlay":true,"enumerations":[{"input":"Position","values":["Left","Right"]},{"input":"Volume","values":["Up/Down","Total"]},{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]},{"input":"LevelMode","values":["Count","MinIncrements"]},{"input":"PeriodType","values":["Bars","Days"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodType","value":"Bars"},{"name":"Period","value":1,"integer":true},{"name":"LevelMode","value":"Count"},{"name":"LevelSize","integer":true,"value":24},{"name":"Volume","value":"Up/Down"},{"name":"BarColoring","value":"LikeMain"},{"name":"Position","value":"Left"},{"name":"WidthPercent","value":40},{"name":"ValueRangePercent","value":70}],"curves":[{"colors":["rgba(239, 65, 38, 0.3)","rgba(0, 176, 76, 0.3)","rgba(31, 74, 182, 0.3)"],"fields":["DNVOL","UPVOL","TOTVOL"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(226,49,240, 0.8)"],"lineWidth":2,"dashStyle":"Solid","fields":["POC"]},{"colors":["rgba(239, 65, 38, 0.6)","rgba(0, 176, 76, 0.6)","rgba(31, 74, 182, 0.6)"],"fields":["VAREA"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(31, 74, 182, 0.1)"],"style":"Column","fields":["BARBACK"]}]}},{"id":"KST","meta":{"title":"Know Sure Thing","enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"overlay":false},"defaults":{"inputs":[{"name":"PeriodRoc1","value":10,"integer":true},{"name":"PeriodRoc2","value":15,"integer":true},{"name":"PeriodRoc3","value":20,"integer":true},{"name":"PeriodRoc4","value":30,"integer":true},{"name":"PeriodMa1","value":10,"integer":true},{"name":"PeriodMa2","value":10,"integer":true},{"name":"PeriodMa3","value":10,"integer":true},{"name":"PeriodMa4","value":15,"integer":true},{"name":"PeriodSig","value":9,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#5f338a"],"fields":["KST"]},{"colors":["#d73737"],"fields":["KSTSIG"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Solid"}}]}},{"id":"STC","meta":{"title":"Schaff Trend Cycle","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"PeriodShort","value":23,"integer":true},{"name":"PeriodLong","value":50,"integer":true},{"name":"PeriodStoch1","value":10,"integer":true},{"name":"PeriodStoch2","value":3,"integer":true},{"name":"Smoothing","value":"EMA"}],"curves":[{"style":"Area","colors":["rgba(120, 120, 120, 0.3)","rgba(0,0,0,0)","#787878","rgba(120, 120, 120, 0.3)"],"fields":["STC"],"zones":[{"value":25,"colors":1},{"value":75,"colors":2},{"colors":1}]}],"levels":[{"value":25,"name":"Lower","line":{"color":"#aaa","dashStyle":"Dash"}},{"value":75,"name":"Upper","line":{"color":"#aaa","dashStyle":"Dash"}}]}},{"id":"MCCLO","meta":{"title":"McClellan Oscillator","overlay":false,"decimals":2,"enumerations":[{"input":"RatioAdjusted","values":["Yes","No"]},{"input":"Source","values":["TotalStocks","NYSEStocks","NasdaqStocks"]}]},"defaults":{"inputs":[{"name":"Period1","value":19,"integer":true},{"name":"Period2","value":39,"integer":true},{"name":"RatioAdjusted","value":"No"},{"name":"Source","value":"TotalStocks"}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["MCCLO"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"BTI","meta":{"title":"Breadth Thrust Indicator","overlay":false,"decimals":4,"enumerations":[{"input":"Source","values":["TotalStocks","NYSEStocks","NasdaqStocks"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":10,"integer":true},{"name":"Average","value":"MA"},{"name":"Source","value":"TotalStocks"}],"curves":[{"colors":["#ff7f50"],"fields":["BTI"]}],"levels":[{"value":0.4,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":0.615,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"NHLAI","meta":{"title":"New High/Low Accumulation Index","overlay":false,"decimals":0,"enumerations":[{"input":"Source","values":["PriceIndex","MarketCapIndex"]}]},"defaults":{"inputs":[{"name":"Period","value":5,"integer":true},{"name":"Source","value":"PriceIndex"}],"curves":[{"colors":["rgb(43, 53, 139)"],"fields":["NHLAI"],"style":"Line"}],"levels":[{"value":-4000,"name":"Lower","line":{"color":"rgb(71, 137, 58)","dashStyle":"DashDot"}},{"value":0,"name":"Zero","line":{"color":"rgb(173, 70, 64)","dashStyle":"DashDot"}},{"value":1000,"name":"Upper","line":{"color":"rgb(71, 137, 58)","dashStyle":"DashDot"}}]}},{"id":"CMBCI","meta":{"title":"Constance Brown Composite Index","overlay":false},"defaults":{"inputs":[{"name":"Period1Rsi","value":14,"integer":true},{"name":"Period1Mom","value":9,"integer":true},{"name":"Period2Rsi","value":3,"integer":true},{"name":"Period2Ma","value":3,"integer":true},{"name":"PeriodFastMa","value":13,"integer":true},{"name":"PeriodSlowMa","value":33,"integer":true}],"curves":[{"colors":["#2c73ee"],"fields":["CMBCI"]},{"colors":["#2b7119"],"fields":["CMBCIF"]},{"colors":["#e2413e"],"fields":["CMBCIS"]}]}},{"id":"COTI","meta":{"title":"Commitment of Traders (COT) Index","overlay":false,"enumerations":[{"input":"History","values":["6M","1Y","2Y","3Y","4Y","5Y","10Y"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"History","value":"3Y"}],"curves":[{"colors":["#e2413e"],"fields":["COTI"]}]}},{"id":"CHEXI","meta":{"title":"Chandelier Exit Indicator","overlay":true,"enumerations":[{"input":"Direction","values":["Long","Short"]}]},"defaults":{"inputs":[{"name":"Direction","value":"Long"},{"name":"Period","value":22,"integer":true},{"name":"Multiplier","value":3}],"curves":[{"colors":["#51b44c"],"fields":["CHEXL"]},{"colors":["#eb484b"],"fields":["CHEXS"]}]}},{"id":"OPTIV","meta":{"title":"Implied Volatility","overlay":false,"enumerations":[{"input":"TimeFrame","values":["Implied Volatility","5-Day Average IV","1-Month Average IV","3-Month Average IV","6-Month Average IV","1-Year Average IV","YTD Average IV"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"Implied Volatility"}],"curves":[{"colors":["#2284dd"],"visible":false,"fields":["WeighImplVolHigh"]},{"colors":["#f58621"],"fields":["WeighImplVol"]},{"colors":["#480048"],"visible":false,"fields":["WeighImplVolLow"]}]}},{"id":"IVRANK","meta":{"title":"Implied Volatility Rank","overlay":false,"enumerations":[{"input":"TimeFrame","values":["5-Day","1-Month","3-Month","6-Month","1-Year","YTD"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"1-Year"}],"curves":[{"colors":["#027d26"],"fields":["ImplVolRank1Y"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"IVPCTL","meta":{"title":"Implied Volatility Percentile","overlay":false,"enumerations":[{"input":"TimeFrame","values":["5-Day","1-Month","3-Month","6-Month","1-Year","YTD"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"1-Year"}],"curves":[{"colors":["#b62594"],"fields":["ImplVolPerc1Y"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"OPTVOLPC","meta":{"title":"Put Call Volume Ratio","overlay":false},"defaults":{"curves":[{"colors":["#808080"],"fields":["PutCallVolRatio"]}]}},{"id":"OPTOIPC","meta":{"title":"Put Call Open Interest Ratio","overlay":false},"defaults":{"curves":[{"colors":["#0a7fff"],"fields":["PutCallOIRatio"]}]}},{"id":"OPTVOL","meta":{"title":"Options Volume","overlay":false},"defaults":{"curves":[{"style":"Column","colors":["#844105"],"fields":["OptTotVol"]},{"style":"StackedColumn","colors":["#fe2322"],"fields":["OptPutVol"]},{"style":"StackedColumn","colors":["#1fcc20"],"fields":["OptCallVol"]}]}},{"id":"OPTOI","meta":{"title":"Options Open Interest","overlay":false},"defaults":{"curves":[{"style":"Column","colors":["#5f2f04"],"fields":["TotalOpenInt"]},{"style":"StackedColumn","colors":["#ce0201"],"fields":["PutOpenInt"]},{"style":"StackedColumn","colors":["#169317"],"fields":["CallOpenInt"]}]}},{"id":"CHOP","meta":{"title":"Choppiness Index","overlay":false,"shiftable":true,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#1c6cff"],"fields":["CHOP"]}],"levels":[{"value":38.2,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}},{"value":50,"name":"Middle","line":{"color":"rgba(96, 96, 96, 0.5)","dashStyle":"Dash"}},{"value":61.8,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":38.2,"to":61.8}}]}},{"id":"MACLD","meta":{"title":"Moving Average Cloud","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":21,"integer":true},{"name":"Period2","value":34,"integer":true}],"curves":[{"colors":["#00cd00"],"fields":["MACLD1"],"style":"Line"},{"colors":["#ff0000"],"fields":["MACLD2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["MACLD1","MACLD2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"PC","meta":{"title":"Probability Cones","overlay":true,"enumerations":[{"input":"Volatility","values":["HV 30","HV 60","HV 90","HV 180","Custom"]},{"input":"StandardDeviations","values":["1","2","3"]}]},"defaults":{"inputs":[{"name":"Volatility","value":"HV 90"},{"name":"VolatilityPercent","value":20},{"name":"StandardDeviations","value":"3"},{"name":"PeriodForecast","value":45,"integer":true},{"name":"PeriodTarget","value":30,"integer":true},{"name":"TargetPrice1","value":0},{"name":"TargetPrice2","value":0}],"curves":[{"colors":["#5db660"],"fields":["PCUP1"],"style":"Line","dashStyle":"Dash"},{"colors":["#5db660"],"fields":["PCDN1"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCUP2"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCDN2"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCUP3"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCDN3"],"style":"Line","dashStyle":"Dash"},{"colors":["rgba(93, 182, 96, 0.1)"],"fields":["PCUP1","PCDN1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCUP2","PCUP1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCDN1","PCDN2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCUP3","PCUP2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCDN2","PCDN3"],"style":"Ribbon","lineWidth":0},{"colors":["#ff54e2"],"fields":["PCTD"],"lineWidth":2,"dashStyle":"Solid"},{"colors":["#ffaf2c"],"fields":["PCTP"],"lineWidth":2,"dashStyle":"Solid"}]}},{"id":"GREEKS","meta":{"title":"Greeks","overlay":false,"decimals":4},"defaults":{"curves":[{"colors":["#7ca685"],"fields":["Delta"]},{"colors":["#c16a6a"],"fields":["Gamma"]},{"colors":["#5a7ca9"],"fields":["Theta"]},{"colors":["#e4a76b"],"fields":["Vega"]}]}},{"id":"TDI","meta":{"title":"Traders Dynamic Index","overlay":false,"range":{"min":0,"max":100},"decimals":2,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"PeriodRSI","value":13,"integer":true},{"name":"PeriodTradeSignal","value":7,"integer":true},{"name":"PeriodMarketBase","value":34,"integer":true},{"name":"PeriodBB","value":34,"integer":true},{"name":"MultiplierBB","value":1.6185},{"name":"Source","value":"Close"}],"curves":[{"colors":["#0088ff"],"fields":["TDIUPR"]},{"colors":["#0088ff"],"fields":["TDILWR"]},{"colors":["rgba(0, 136, 255, 0.1)"],"fields":["TDIUPR","TDILWR"],"style":"Ribbon","lineWidth":0},{"colors":["#00c853"],"fields":["TDIPRC"],"lineWidth":2},{"colors":["#ff1744"],"fields":["TDITSL"],"lineWidth":2},{"colors":["#ff9100"],"fields":["TDIMBL"],"lineWidth":2}],"levels":[{"value":70,"name":"Overbought","line":{"color":"#808080","dashStyle":"Dash"}},{"value":30,"name":"Oversold","line":{"color":"#808080","dashStyle":"Dash"}}]}},{"id":"PPS","meta":{"title":"Price Percent Stop","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]},{"input":"Type","values":["Percent","Price"]}]},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Range","value":"High/Low"},{"name":"Direction","value":"Long"},{"name":"Type","value":"Percent"},{"name":"StopValue","value":10}],"curves":[{"colors":["#fc0d1b","#00b04b"],"fields":["PPS"],"varyColorPerBar":true}]}},{"id":"FRAMA","meta":{"title":"Fractal Adaptive Moving Average","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":16,"integer":true},{"name":"Source","value":"HL/2"}],"curves":[{"colors":["#ef4226"],"fields":["FRAMA"]}]}},{"id":"FISHER","meta":{"title":"Fisher Transform","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":9,"integer":true}],"curves":[{"colors":["#2962FF"],"fields":["FISHER"]},{"colors":["#FF6D00"],"fields":["FISHTRG"]}],"levels":[{"value":1.5,"name":"1.5","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":0.75,"name":"0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":0,"name":"0","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":-0.75,"name":"-0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":-1.5,"name":"-1.5","line":{"color":"#E91E63","dashStyle":"Dash"}}]}},{"id":"RCI","meta":{"title":"Spearman Rank Correlation Index","overlay":false,"decimals":2,"range":{"min":-100,"max":100},"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":10,"integer":true},{"name":"PeriodSignal","value":3,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#2196F3"],"fields":["RCI"],"lineWidth":2},{"colors":["#FF9800"],"fields":["RCISIG"]}],"levels":[{"value":80,"name":"+80","line":{"color":"#808080","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#808080","dashStyle":"DashDot"}},{"value":-80,"name":"-80","line":{"color":"#808080","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":-80,"to":80}}]}},{"id":"ZIGZAG","meta":{"title":"ZigZag","overlay":true,"enumerations":[{"input":"PercentMode","values":["Fixed","ATR"]},{"input":"Method","values":["High/Low","Source"]},{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"ReversalChange","values":["None","Absolute","Percent"]}]},"defaults":{"inputs":[{"name":"PercentMode","value":"ATR"},{"name":"Method","value":"High/Low"},{"name":"Source","value":"Close"},{"name":"ReversalChange","value":"None"},{"name":"Percent","value":5},{"name":"PeriodAtr","value":14,"integer":true},{"name":"MultiplierAtr","value":2.5}],"curves":[{"colors":["#2962FF"],"fields":["ZZPIVOT"]}]}},{"id":"BOP","meta":{"title":"Balance of Power","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#ef4226"],"fields":["BOP"]},{"colors":["#896fc3"],"fields":["BOPAVG"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CORR","meta":{"title":"Correlation Coefficient","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"},{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#2196F3"],"fields":["CORR"]}],"levels":[{"value":1,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-1,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"RVI","meta":{"title":"Relative Vigor Index","overlay":false,"decimals":4},"defaults":{"inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#2196F3"],"fields":["RVI"]},{"colors":["#FF9800"],"fields":["RVISIG"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"ATREXT","meta":{"title":"ATR Extension","overlay":true,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"PeriodAverage","value":50,"integer":true},{"name":"PeriodATR","value":20,"integer":true},{"name":"Multiplier","value":5}],"curves":[{"colors":["#0000ff"],"fields":["ATREXTAVG"],"style":"Line"},{"colors":["#50cc52"],"fields":["ATREXTUP"],"style":"Dots"},{"colors":["#d46757"],"fields":["ATREXTLOW"],"style":"Dots"}]}}]`);function qs(e){switch(e){case`Renko`:return B.DEFAULT_RENKO_INPUTS;case`Kagi`:return B.DEFAULT_KAGI_INPUTS;case`PointAndFigure`:return B.DEFAULT_PNF_INPUTS;case`LineBreak`:return B.DEFAULT_LINEBREAK_INPUTS;case`Baseline`:return B.DEFAULT_BASELINE_INPUTS}}function Js(e,t){for(let n of e??[]){let e=t?.find(e=>e.name===n.name);e?.integer===!0?n.integer=!0:e&&delete n.integer;let r=e?.value,i=typeof r==`number`&&Number.isFinite(r),a=typeof n.value!=`number`||!Number.isFinite(n.value);i&&a&&(n.value=r),n.integer===!0&&typeof n.value==`number`&&Number.isFinite(n.value)&&(n.value=Math.ceil(n.value))}}function Ys(e){let t=rc(!0);for(let n of e.panes??[])for(let e of n.axes??[])for(let n of e.plots??[])n.type===`Study`?Js(n.inputs,t.find(e=>e.id===n.study)?.defaults.inputs):n.type===`Symbol`&&Js(n.inputs,qs(n.curves?.[0]?.style));return e}function Xs(e){switch(e){case B.CHART_SCHEMA:return Hs;case B.STUDIES_SCHEMA:return Us;case B.FIELDS_SCHEMA:return Ws;case B.ACCESSOR_SCHEMA:return Gs;default:throw Error(`Unknown schema name: ${e}`)}}var Zs=[],Qs=!1,$s=!0;function ec(e){$s=e}function tc(e){Zs=Zs.concat(Mf(e,B.STUDIES_SCHEMA))}var nc=new Map;function rc(e=!1){Qs||=(tc(Ks),!0);let t=ne[$()?.config.mode??`Unspecified`];if(e||!$s)return Zs;if(!nc.has(t)){let e=se(uc,t);nc.set(t,Zs.filter(e))}return nc.get(t)}function V(e){return F(ac(e))}function ic(e){return ps(pF().display,e)}function ac(e){return rc().find(t=>t.id===e)}function oc(e){return ac(e)!==void 0}function sc(e){let t=[G.Open,G.High,G.Low,G.Close,G.Volume].map(e=>e.id);return e.defaults.source&&!t.includes(e.defaults.source)}function cc(e){return e.meta.singleFieldBased===!0}function lc(e){return[ne.DemoSite,ne.cmdtyView].includes(e)}function uc(e,t){let n=t.id;if(n===`PVACP`)return[ne.cmdtyView,ne.DemoSite].includes(e);let r=[`CPMI`,`CTPI`,`CTM`,`JPI`,`CTTP`,`CTTI`],i=[ne.GBE,ne.cmdtyView];return!(r.includes(n)&&!i.includes(e))}var dc=null,fc=!1;function pc(){if(!fc){let e=[b.Study,b.BalanceSheet,b.IncomeStatement],t=e.reduce((e,t)=>(e[t]=[],e),{});Object.values(G).filter(t=>e.includes(t.category)).map(e=>{t[e.category].push({id:e.id,name:e.name,shortName:e.shortName})});let n=Object.keys(h).filter(e=>{let t=parseInt(e);if(Number.isFinite(t))return h[t]}),r=F(rc()).sort((e,t)=>e.meta.overlay===t.meta.overlay?e.meta.title<t.meta.title?-1:1:e.meta.overlay<t.meta.overlay?1:-1),i=Vs(),a=Object.entries(i).map(([e,t])=>({id:e,options:t.editable,defaults:t.defaults??{},types:t.types,numPoints:t.numPoints})),o=[`Renko`,`Kagi`,`PointAndFigure`,`LineBreak`,`Baseline`].map(e=>[e,F(qs(e))]);dc={studies:r,incomeStatements:t[b.IncomeStatement],balanceSheets:t[b.BalanceSheet],studyFields:t[b.Study],curveStyles:n,curveStyleInputs:Object.fromEntries(o),annotations:a},fc=!0}return dc}var mc=o(((e,t)=>{(function(){var e={PATH:1,SELECTOR:2,OBJ_PRED:3,POS_PRED:4,LOGICAL_EXPR:5,COMPARISON_EXPR:6,MATH_EXPR:7,CONCAT_EXPR:8,UNARY_EXPR:9,POS_EXPR:10,LITERAL:11},n=(function(){var t={ID:1,NUM:2,STR:3,BOOL:4,NULL:5,PUNCT:6,EOP:7},n={UNEXP_TOKEN:`Unexpected token "%0"`,UNEXP_EOP:`Unexpected end of path`},r,i,a,o;function s(e){r=e.split(``),i=0,a=null,o=r.length;var n=c(),s=O();return s.type!==t.EOP&&me(s),n}function c(){for(var t=l(),n;E(`|`);)O(),(n||=[t]).push(l());return n?{type:e.CONCAT_EXPR,args:n}:t}function l(){return E(`(`)?u():f()}function u(){re(`(`);var t=c();re(`)`);for(var n=[],r;r=d();)n.push(r);return n.length?t.type===e.PATH?(t.parts=t.parts.concat(n),t):(n.unshift(t),{type:e.PATH,parts:n}):t}function d(){if(E(`[`))return h();if(E(`{`))return g();if(E(`(`))return u()}function f(){D()||me(O());var t=!1,n;E(`^`)?(O(),t=!0):ne()&&(n=O().val.substr(1));for(var r=[],i;i=p();)r.push(i);return{type:e.PATH,fromRoot:t,subst:n,parts:r}}function p(){return te()?m():d()}function m(){var n=O().val,r=ie(),i;return(E(`*`)||r.type===t.ID||r.type===t.STR)&&(i=O().val),{type:e.SELECTOR,selector:n,prop:i}}function h(){re(`[`);var t=C();return re(`]`),{type:e.POS_PRED,arg:t}}function g(){re(`{`);var t=_();return re(`}`),{type:e.OBJ_PRED,arg:t}}function _(){for(var t=v(),n;E(`||`);)O(),(n||=[t]).push(v());return n?{type:e.LOGICAL_EXPR,op:`||`,args:n}:t}function v(){for(var t=y(),n;E(`&&`);)O(),(n||=[t]).push(y());return n?{type:e.LOGICAL_EXPR,op:`&&`,args:n}:t}function y(){for(var t=b();E(`==`)||E(`!=`)||E(`===`)||E(`!==`)||E(`^==`)||E(`==^`)||E(`^=`)||E(`=^`)||E(`$==`)||E(`==$`)||E(`$=`)||E(`=$`)||E(`*==`)||E(`==*`)||E(`*=`)||E(`=*`);)t={type:e.COMPARISON_EXPR,op:O().val,args:[t,y()]};return t}function b(){for(var t=x();E(`<`)||E(`>`)||E(`<=`)||E(`>=`);)t={type:e.COMPARISON_EXPR,op:O().val,args:[t,b()]};return t}function x(){for(var t=S();E(`+`)||E(`-`);)t={type:e.MATH_EXPR,op:O().val,args:[t,S()]};return t}function S(){for(var t=w();E(`*`)||E(`/`)||E(`%`);)t={type:e.MATH_EXPR,op:O().val,args:[t,S()]};return t}function C(){if(E(`:`))return O(),{type:e.POS_EXPR,toIdx:w()};var t=w();return E(`:`)?(O(),E(`]`)?{type:e.POS_EXPR,fromIdx:t}:{type:e.POS_EXPR,fromIdx:t,toIdx:w()}):{type:e.POS_EXPR,idx:t}}function w(){return E(`!`)||E(`-`)?{type:e.UNARY_EXPR,op:O().val,arg:w()}:T()}function T(){var n=ie().type;return n===t.STR||n===t.NUM||n===t.BOOL||n===t.NULL?{type:e.LITERAL,val:O().val}:D()?f():E(`(`)?ee():me(O())}function ee(){re(`(`);var e=_();return re(`)`),e}function E(e){var n=ie();return n.type===t.PUNCT&&n.val===e}function D(){return te()||ne()||E(`^`)}function te(){var e=ie();if(e.type===t.PUNCT){var n=e.val;return n===`.`||n===`..`}return!1}function ne(){var e=ie();return e.type===t.ID&&e.val[0]===`$`}function re(e){var n=O();(n.type!==t.PUNCT||n.val!==e)&&me(n)}function ie(){if(a!==null)return a;var e=i;return a=ae(),i=e,a}function ae(){for(;se(r[i]);)++i;if(i>=o)return{type:t.EOP,range:[i,i]};var e=pe();if((e||=ue())||(e=de())||(e=fe()))return e;e={range:[i,i]},i>=o?e.type=t.EOP:e.val=r[i],me(e)}function O(){var e;return a?(i=a.range[1],e=a,a=null,e):ae()}function oe(e){return`0123456789`.indexOf(e)>=0}function se(e){return` \r
|
|
2
|
-
`.indexOf(e)>-1}function ce(e){return e===`$`||e===`@`||e===`_`||e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}function le(e){return ce(e)||e>=`0`&&e<=`9`}function ue(){var e=r[i];if(ce(e)){for(var n=i,a=e;++i<o&&(e=r[i],le(e));)a+=e;switch(a){case`true`:case`false`:return{type:t.BOOL,val:a===`true`,range:[n,i]};case`null`:return{type:t.NULL,val:null,range:[n,i]};default:return{type:t.ID,val:a,range:[n,i]}}}}function de(){if(!(r[i]!==`"`&&r[i]!==`'`)){for(var e=r[i],n=++i,a=``,s=!1,c;i<o;){if(c=r[i++],c===`\\`)c=r[i++];else if((c===`"`||c===`'`)&&c===e){s=!0;break}a+=c}if(s)return{type:t.STR,val:a,range:[n,i]}}}function fe(){var e=i,n=r[i],a=n===`.`;if(a||oe(n)){for(var s=n;++i<o;){if(n=r[i],n===`.`){if(a)return;a=!0}else if(!oe(n))break;s+=n}return{type:t.NUM,val:a?parseFloat(s):parseInt(s,10),range:[e,i]}}}function pe(){var e=i,n=r[i],a=r[i+1];if(n===`.`)return oe(a)?void 0:r[++i]===`.`?{type:t.PUNCT,val:`..`,range:[e,++i]}:{type:t.PUNCT,val:`.`,range:[e,i]};if(a===`=`){var o=r[i+2];if(o===`=`){if(`=!^$*`.indexOf(n)>=0)return{type:t.PUNCT,val:n+a+o,range:[e,i+=3]}}else if(`^$*`.indexOf(o)>=0){if(n===`=`)return{type:t.PUNCT,val:n+a+o,range:[e,i+=3]}}else if(`=!^$*><`.indexOf(n)>=0)return{type:t.PUNCT,val:n+a,range:[e,i+=2]}}else if(n===`=`&&`^$*`.indexOf(a)>=0)return{type:t.PUNCT,val:n+a,range:[e,i+=2]};if(n===a&&(n===`|`||n===`&`))return{type:t.PUNCT,val:n+a,range:[e,i+=2]};if(`:{}()[]^+-*/%!><|`.indexOf(n)>=0)return{type:t.PUNCT,val:n,range:[e,++i]}}function me(e){e.type===t.EOP&&k(e,n.UNEXP_EOP),k(e,n.UNEXP_TOKEN,e.val)}function k(e,t){var n=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,function(e,t){return n[t]||``}),i=Error(r);throw i.column=e.range[0],i}return s})(),r=(function(){var t,n,r,i;function a(){if(i.length)return i.shift();var e=`v`+ ++r;return n.push(e),e}function o(){for(var e=arguments,t=e.length;t--;)i.push(e[t])}function s(a){if(t=[],n=[`res`],r=0,i=[],p(a,`res`,`data`),t.unshift(`var `,Array.isArray?`isArr = Array.isArray`:`toStr = Object.prototype.toString, isArr = function(o) { return toStr.call(o) === "[object Array]"; }`,`, concat = Array.prototype.concat`,`,`,n.join(`,`),`;`),a.type===e.PATH){var o=a.parts[a.parts.length-1];o&&o.type===e.POS_PRED&&`idx`in o.arg&&t.push(`res = res[0];`)}return t.push(`return res;`),t.join(``)}function c(n,r,i){var a=n.parts,o=0,s=a.length;for(t.push(r,`=`,n.fromRoot?`data`:n.subst?`subst.`+n.subst:i,`;`,`isArr(`+r+`) || (`+r+` = [`+r+`]);`);o<s;){var c=a[o++];switch(c.type){case e.SELECTOR:c.selector===`..`?u(c,r,r):l(c,r,r);break;case e.OBJ_PRED:d(c,r,r);break;case e.POS_PRED:f(c,r,r);break;case e.CONCAT_EXPR:b(c,r,r);break}}}function l(e,n,r){if(e.prop){var i=x(e.prop),s=a(),c=a(),l=a(),u=a(),d=a(),f=a(),p=a();t.push(s,`= [];`,c,`= 0;`,l,`=`,r,`.length;`,p,`= [];`,`while(`,c,`<`,l,`) {`,u,`=`,r,`[`,c,`++];`,`if(`,u,`!= null) {`),e.prop===`*`?(t.push(`if(typeof `,u,`=== "object") {`,`if(isArr(`,u,`)) {`,s,`=`,s,`.concat(`,u,`);`,`}`,`else {`,`for(`,d,` in `,u,`) {`,`if(`,u,`.hasOwnProperty(`,d,`)) {`,f,`=`,u,`[`,d,`];`),S(s,f),t.push(`}`,`}`,`}`,`}`)):(t.push(f,`=`,u,`[`,i,`];`),S(s,f,p,l)),t.push(`}`,`}`,n,`=`,l,`> 1 &&`,p,`.length?`,p,`.length > 1?`,`concat.apply(`,s,`,`,p,`) :`,s,`.concat(`,p,`[0]) :`,s,`;`),o(s,c,l,u,d,f,p)}}function u(e,n,r){var i=e.prop,s=a(),c=a(),l=a(),u=a(),d=a(),f=a(),p=a(),m=a();t.push(s,`=`,r,`.slice(),`,m,`= [];`,`while(`,s,`.length) {`,c,`=`,s,`.shift();`),i?t.push(`if(typeof `,c,`=== "object" &&`,c,`) {`):t.push(`if(typeof `,c,`!= null) {`),t.push(l,`= [];`,`if(isArr(`,c,`)) {`,u,`= 0,`,p,`=`,c,`.length;`,`while(`,u,`<`,p,`) {`,f,`=`,c,`[`,u,`++];`),i&&t.push(`if(typeof `,f,`=== "object") {`),S(l,f),i&&t.push(`}`),t.push(`}`,`}`,`else {`),i?i!==`*`&&(t.push(f,`=`,c,`["`+i+`"];`),S(m,f)):(S(m,c),t.push(`if(typeof `,c,`=== "object") {`)),t.push(`for(`,d,` in `,c,`) {`,`if(`,c,`.hasOwnProperty(`,d,`)) {`,f,`=`,c,`[`,d,`];`),S(l,f),i===`*`&&S(m,f),t.push(`}`,`}`),i||t.push(`}`),t.push(`}`,l,`.length &&`,s,`.unshift.apply(`,s,`,`,l,`);`,`}`,`}`,n,`=`,m,`;`),o(s,c,l,u,d,f,p,m)}function d(e,n,r){var i=a(),s=a(),c=a(),l=a(),u=a();t.push(i,`= [];`,s,`= 0;`,c,`=`,r,`.length;`,`while(`,s,`<`,c,`) {`,u,`=`,r,`[`,s,`++];`),p(e.arg,l,u),t.push(w(e.arg,l),`&&`,i,`.push(`,u,`);`,`}`,n,`=`,i,`;`),o(i,s,c,u,l)}function f(e,n,r){var i=e.arg,s,c;if(i.idx){var l=a();return p(i.idx,l,r),t.push(l,`< 0 && (`,l,`=`,r,`.length +`,l,`);`,n,`=`,r,`[`,l,`] == null? [] : [`,r,`[`,l,`]];`),o(l),!1}else i.fromIdx?i.toIdx?(p(i.fromIdx,s=a(),r),p(i.toIdx,c=a(),r),t.push(n,`=`,r,`.slice(`,s,`,`,c,`);`),o(s,c)):(p(i.fromIdx,s=a(),r),t.push(n,`=`,r,`.slice(`,s,`);`),o(s)):(p(i.toIdx,c=a(),r),t.push(n,`=`,r,`.slice(0,`,c,`);`),o(c))}function p(n,r,i){switch(n.type){case e.PATH:c(n,r,i);break;case e.CONCAT_EXPR:b(n,r,i);break;case e.COMPARISON_EXPR:h(n,r,i);break;case e.MATH_EXPR:v(n,r,i);break;case e.LOGICAL_EXPR:_(n,r,i);break;case e.UNARY_EXPR:y(n,r,i);break;case e.LITERAL:t.push(r,`=`),m(n.val),t.push(`;`);break}}function m(e){t.push(typeof e==`string`?x(e):e===null?`null`:e)}function h(n,r,i){var s=a(),c=a(),l=a(),u=a(),d=a(),f=a(),m=a(),h=a(),_=n.args[0],v=n.args[1];t.push(r,`= false;`),p(_,s,i),p(v,c,i);var y=_.type===e.PATH,b=v.type===e.LITERAL;t.push(l,`=`),y?t.push(`true;`):t.push(`isArr(`,s,`);`),t.push(u,`=`),b?t.push(`false;`):t.push(`isArr(`,c,`);`),t.push(`if(`),y||t.push(l,`&&`),t.push(s,`.length === 1) {`,s,`=`,s,`[0];`,l,`= false;`,`}`),b||t.push(`if(`,u,`&&`,c,`.length === 1) {`,c,`=`,c,`[0];`,u,`= false;`,`}`),t.push(d,`= 0;`,`if(`,l,`) {`,m,`=`,s,`.length;`),b||(t.push(`if(`,u,`) {`,h,`=`,c,`.length;`,`while(`,d,`<`,m,`&& !`,r,`) {`,f,`= 0;`,`while(`,f,`<`,h,`) {`),g(n.op,[s,`[`,d,`]`].join(``),[c,`[`,f,`]`].join(``)),t.push(r,`= true;`,`break;`,`}`,`++`,f,`;`,`}`,`++`,d,`;`,`}`,`}`,`else {`)),t.push(`while(`,d,`<`,m,`) {`),g(n.op,[s,`[`,d,`]`].join(``),c),t.push(r,`= true;`,`break;`,`}`,`++`,d,`;`,`}`),b||t.push(`}`),t.push(`}`),b||(t.push(`else if(`,u,`) {`,h,`=`,c,`.length;`,`while(`,d,`<`,h,`) {`),g(n.op,s,[c,`[`,d,`]`].join(``)),t.push(r,`= true;`,`break;`,`}`,`++`,d,`;`,`}`,`}`)),t.push(`else {`,r,`=`,ie[n.op](s,c),`;`,`}`),o(s,c,l,u,d,f,m,h)}function g(e,n,r){t.push(`if(`,ie[e](n,r),`) {`)}function _(e,n,r){var i=[],s=e.args,c=s.length,l=0,u;switch(t.push(n,`= false;`),e.op){case`&&`:for(;l<c;)i.push(u=a()),p(s[l],u,r),t.push(`if(`,w(s[l++],u),`) {`);t.push(n,`= true;`);break;case`||`:for(;l<c;)i.push(u=a()),p(s[l],u,r),t.push(`if(`,w(s[l],u),`) {`,n,`= true;`,`}`),l+++1<c&&t.push(`else {`);--c;break}for(;c--;)t.push(`}`);o.apply(null,i)}function v(e,n,r){var i=a(),s=a(),c=e.args;p(c[0],i,r),p(c[1],s,r),t.push(n,`=`,ie[e.op](T(c[0],i),T(c[1],s)),`;`),o(i,s)}function y(e,n,r){var i=a(),s=e.arg;switch(p(s,i,r),e.op){case`!`:t.push(n,`= !`,w(s,i)+`;`);break;case`-`:t.push(n,`= -`,T(s,i)+`;`);break}o(i)}function b(e,n,r){for(var i=[],s=e.args,c=s.length,l=0;l<c;)i.push(a()),p(s[l],i[l++],r);t.push(n,`= concat.call(`,i.join(`,`),`);`),o.apply(null,i)}function x(e){return`'`+e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)+`'`}function S(e,n,r,i){t.push(`if(typeof `,n,`!== "undefined") {`,`if(isArr(`,n,`)) {`),r&&(t.push(i,`> 1?`),C(r,n),t.push(`:`)),t.push(e,`=`,e,`.length?`,e,`.concat(`,n,`) :`,n,`.slice()`,`;`,`}`,`else {`),r&&t.push(`if(`,r,`.length) {`,e,`= concat.apply(`,e,`,`,r,`);`,r,`= [];`,`}`),C(e,n),t.push(`;`,`}`,`}`)}function C(e,n){t.push(e,`.length?`,e,`.push(`,n,`) :`,e,`[0] =`,n)}function w(t,n){switch(t.type){case e.LOGICAL_EXPR:return n;case e.LITERAL:return`!!`+n;case e.PATH:return n+`.length > 0`;default:return[`(typeof `,n,`=== "boolean"?`,n,`:`,`isArr(`,n,`)?`,n,`.length > 0 : !!`,n,`)`].join(``)}}function T(t,n){switch(t.type){case e.LITERAL:return n;case e.PATH:return n+`[0]`;default:return[`(isArr(`,n,`)?`,n,`[0] : `,n,`)`].join(``)}}function ee(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string" &&`,e,`.indexOf(`,t,`) === 0`].join(``)}function E(e,t){return[e,`!= null &&`,t,`!= null &&`,e,`.toString().toLowerCase().indexOf(`,t,`.toString().toLowerCase()) === 0`].join(``)}function D(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string" &&`,e,`.length >=`,t,`.length &&`,e,`.lastIndexOf(`,t,`) ===`,e,`.length -`,t,`.length`].join(``)}function te(e,t){return[e,`!= null &&`,t,`!= null &&`,`(`,e,`=`,e,`.toString()).length >=`,`(`,t,`=`,t,`.toString()).length &&`,`(`,e,`.toLowerCase()).lastIndexOf(`,`(`,t,`.toLowerCase())) ===`,e,`.length -`,t,`.length`].join(``)}function ne(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string" &&`,e,`.indexOf(`,t,`) > -1`].join(``)}function re(e,t){return[e,`!= null && `,t,`!= null &&`,e,`.toString().toLowerCase().indexOf(`,t,`.toString().toLowerCase()) > -1`].join(``)}var ie={"===":function(e,t){return e+`===`+t},"==":function(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string"?`,e,`.toLowerCase() ===`,t,`.toLowerCase() :`+e,`==`,t].join(``)},">=":function(e,t){return e+`>=`+t},">":function(e,t){return e+`>`+t},"<=":function(e,t){return e+`<=`+t},"<":function(e,t){return e+`<`+t},"!==":function(e,t){return e+`!==`+t},"!=":function(e,t){return e+`!=`+t},"^==":ee,"==^":function(e,t){return ee(t,e)},"^=":E,"=^":function(e,t){return E(t,e)},"$==":D,"==$":function(e,t){return D(t,e)},"$=":te,"=$":function(e,t){return te(t,e)},"*==":ne,"==*":function(e,t){return ne(t,e)},"=*":function(e,t){return re(t,e)},"*=":re,"+":function(e,t){return e+`+`+t},"-":function(e,t){return e+`-`+t},"*":function(e,t){return e+`*`+t},"/":function(e,t){return e+`/`+t},"%":function(e,t){return e+`%`+t}};return s})();function i(e){return Function(`data,subst`,r(n(e)))}var a={},o=[],s={cacheSize:100},c={cacheSize:function(e,t){if(t<e&&o.length>t)for(var n=o.splice(0,o.length-t),r=n.length;r--;)delete a[n[r]]}},l=function(e,t,n){return a[e]||(a[e]=i(e),o.push(e)>s.cacheSize&&delete a[o.shift()]),a[e](t,n||{})};l.version=`0.3.4`,l.params=function(e){if(!arguments.length)return s;for(var t in e)e.hasOwnProperty(t)&&(c[t]&&c[t](s[t],e[t]),s[t]=e[t])},l.compile=i,l.apply=l,typeof t==`object`&&typeof t.exports==`object`?t.exports=l:typeof modules==`object`?modules.define(`jspath`,function(e){e(l)}):typeof define==`function`?define(function(e,t,n){n.exports=l}):window.JSPath=l})()})),hc=o(((e,t)=>{t.exports=mc()}))();function gc(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===null}function _c(e,t,n){if(gc(e))return e;if(Array.isArray(e))return e.map(e=>_c(e,t,n)).filter(e=>e!==B.NULL_OBJECT);{let r=t.indexOf(e);if(r!==-1)return n[r];let i={};for(let r in e){let a=e[r];i[r]=_c(a,t,n)}return i}}function H(e,t,n){return[].concat((0,hc.apply)(t,e,n))}function U(e,t,n){let r=F(e),i=H(r,t),a=i.map(n);if(a.some(e=>e===void 0))throw Error(`Forgot to return transformed value from accessor ${n}`);return _c(r,i,a)}var vc=[`1D`,`5D`,`1M`,`3M`,`6M`,`1Y`,`5Y`,`Max`];function yc(e){let t=e.data.period;if(t!==null){let n=t===`Max`?B.AUTOFIT_PERIOD:`P${t}`,r=vc.findIndex(e=>e===t),i={unit:`Day`};r<2?i={unit:`Intraday`,size:15}:r>5&&(i={unit:`Month`}),delete e.data.period,e.display.period=n,e.data.aggregation=i,e.version=4}return e}function bc(e){let t=H(e,`..panes[0]..plots{.type === "Symbol"}[0].curves{.style === "Candlestick" && .attributes === "Hollow" }`);if(t.length===1){let e=t[0];e.attributes.splice(e.attributes.indexOf(`Hollow`),1),e.attributes.length===0&&delete e.attributes,e.style=`HollowCandles`,e.colors=F(B.COLOR_DEFAULT_VARY)}return e.version=5,e}function xc(e){let t=H(e,`..panes[0]..plots{.type === "Symbol"}[0]`);if(t.length===1){let e=t[0];e.main=!0}return e.version=6,e}function Sc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MAENV`,`BBANDS`,`KELCHN`,`KELEXP`,`DONCHN`]});return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>1){let t=e.curves.length-1,n=vo(e.curves[t].colors[0]);n.a=.1,e.curves.push({colors:[So(n)],fields:e.curves[0].fields.concat(e.curves[t].fields),lineWidth:0,style:`Ribbon`})}}),e.version=7,e}function Cc(e){let t=H(e,`..plots{.type === "Study" && (.study === "ADX" || .study === "ADXMOD")}`);return t.length>0&&t.forEach(e=>{if(e.inputs&&e.inputs.length===1&&e.inputs[0].name===B.INPUT_PERIOD){let t=e.inputs[0].value;e.inputs=[{name:`AdxSmoothing`,value:t},{name:`DiLength`,value:t}]}}),e.version=8,e}function wc(e){return e.length===1}function Tc(e){let t=H(e,`.display.yAxis`);if(wc(t)&&!wc(H(t,`.minorGridLines`))){let e=$().template,n=H(e,`.display.yAxis.minorGridLines`);wc(n)&&(t[0].minorGridLines=n[0])}return e.version=9,e}function Ec(e){return e.length===1}function Dc(e){let t=H(e,`.display.navigator`);if(Ec(t)&&!Ec(H(t,`.enabled`))){let e=$().template,n=H(e,`.display.navigator.enabled`);Ec(n)&&(t[0].enabled=n[0])}return e.version=10,e}function Oc(e){let t=H(e,`..plots{.type === "Study" && .study === "TCHN"}`);return t.length>0&&t.forEach(e=>{if(e.inputs&&e.inputs.length===1&&e.inputs[0].name===B.INPUT_PERIOD){let t=e.inputs[0].value;e.inputs=[{name:`PeriodUpper`,value:t},{name:`PeriodLower`,value:t},{name:`Range`,value:`High/Low`}]}}),e.version=11,e}function kc(e){let t=H(e,`.display.navigator`);if(t.length===1){let e=t[0];e.visible=e.enabled&&e.visible||!1,delete e.enabled}return e.version=12,e}function Ac(e){return H(e,`..annotations`).forEach(e=>{if(e.id===`AndrewsPitchfork`){let[t,n,r]=e.points;e.points=[n,t,r]}}),e.version=13,e}function jc(e){let t=H(e,`.display`);if(t.length===1){let e=t[0];e.scrollbar.visible=e.navigator.visible||!1,delete e.navigator}return e.version=14,e}var Mc={ATRLTR:`REATRHI`,ATRSTR:`REATRLO`,PeriodMARng:`PeriodAdjATR`,PeriodAdjATR:`FactorAdjATR`};function Nc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`ATRLTR`,`ATRSTR`]}),n=e=>nt(Mc,e)?Mc[e]:e;return t.length>0&&t.forEach(e=>{e.curves&&e.curves[0].fields&&(e.curves[0].fields=e.curves[0].fields.map(n)),e.inputs&&=e.inputs.map(e=>(e.name=n(e.name),e)),e.study=n(e.study)}),e.version=15,e}function Pc(e){let t=H(e,`..annotations`),n=`FibonacciRetracement`,r=e=>({shown:!1,value:e}),i=[-.618,-.236].map(r),a=[1.272,1.618,2.618].map(r);return t.forEach(e=>{if(e.id===n){let t=e.traits;if(P(t)&&P(t.factors)){let e=ps(null,n).factors,r=t.factors.map((t,n)=>{let r=!P(t);return{shown:!r,value:r?e[n+2].value:t}});t.factors=i.concat(r).concat(a)}}}),e.version=16,e}function Fc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`STOCHF`,`STOCHM`,`STOCHS`]});return t.length>0&&t.forEach(e=>{let t=e.study===`STOCHM`,n=V(t?`STOCHS`:e.study);P(e.inputs)?e.inputs.push({name:`Smoothing`,value:t?`EMA`:`MA`}):e.inputs=n.defaults.inputs.map(e=>(e.name===`Smoothing`&&t&&(e.value=`EMA`),e)),t&&(e.study=`STOCHS`)}),e.version=17,e}var Ic={BBANDS:{colors:[`#89211e`],fields:[`BOLLBM`],visible:!1},DONCHN:{colors:[`#ff6a00`],fields:[`DONMID`],visible:!1}};function Lc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`BBANDS`,`DONCHN`]});return t.length>0&&t.forEach(e=>{if(P(e.curves)&&e.curves?.length===3){let t=F(Ic[e.study]);e.curves.push(t)}}),e.version=18,e}function Rc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`REATRHI`,`REATRLO`]});return t.length>0&&t.forEach(e=>{e.inputs&&e.inputs.length===4&&e.inputs.push({name:`FactorATR`,value:2})}),e.version=19,e}function zc(e){let t=H(e,`.display.yAxis`);if(t.length===1){let e=t[0];P(e.showLastValue)&&(e.showLastValue=e.showLastValue?`All`:`None`)}return e.version=20,e}function Bc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CTMF`,`TPI`]});return t.length>0&&t.forEach(e=>{let t=e.study===`CTMF`?`GPMI`:`GTPI`;e.study=t,e.curves&&e.curves.length>0&&(e.curves.splice(1,1),e.curves[0].fields=[t])}),e.version=21,e}function Vc(e){let t=H(e,`..plots{.type === "Study" && .study === "AWEOSC"}`);return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>0&&e.curves[0].zones){let t=e.curves[0];delete t.zones,t.varyColorPerBar=!0}}),e.version=22,e}function Hc(e){let t=e.display.yAxis;return delete t.minPadding,delete t.maxPadding,e.version=23,e}function Uc(e){let t=H(e,`..plots{.type === "Study" && .study === "GTPI"}`);return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>0){let t=e.curves[0];t.colors=[`#ef4226`,`#2642ef`],t.zones=[{value:50,colors:1,gradient:`linDarken`},{colors:1,gradient:`linLighten`}]}}),e.version=24,e}function Wc(e){let t=H(e,`..plots{.type === "Study" && .study === "MOM"}`);if(t.length>0){let e=V(`MOM`);t.forEach(t=>{t.curves&&t.curves.length===1&&e.defaults.curves.length===2&&t.curves.push(e.defaults.curves[1]),t.inputs?.length===1&&e.defaults.inputs?.length===2&&t.inputs.push(e.defaults.inputs[1])})}return e.version=25,e}function Gc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MA`,`MAEXP`]});return t.length>0&&t.forEach(e=>{e.source&&delete e.source,e.inputs&&e.inputs.length===1?e.inputs.push({name:`Source`,value:`Close`}):e.inputs=V(e.study).defaults.inputs}),e.version=26,e}function Kc(e){let t=H(e,`..plots{.type === "Study" && .study === "ATR"}`);if(t.length>0){let e=V(`ATR`);t.forEach(t=>{t.curves&&t.curves.length===1&&e.defaults.curves.length===2&&t.curves.push(e.defaults.curves[1]),t.inputs?.length===2&&e.defaults.inputs?.length===3&&t.inputs.push(e.defaults.inputs[2])})}return e.version=27,e}function qc(e){let t=H(e,`..plots{.type === "Study"}`),n=V(`ALLG`),r=e=>{let t=n.defaults.curves.find(t=>t.fields[0]===e.fields[0]);if(P(t))return t.shift};return t.length>0&&t.forEach(e=>{delete e.shift,e.study===`ALLG`&&e.curves&&e.curves.forEach(e=>{let t=r(e);P(t)&&(e.shift=t)})}),e.version=28,e}function Jc(e){let t=Nf(U(e,`..plots{.type === "Study" && .study === "DEMARK"}`,e=>B.NULL_OBJECT));return t.version=29,t}function Yc(e){let t=Nf(U(e,`..plots{.type === "Study" && .study === "ULTOSC"}`,e=>B.NULL_OBJECT));return t.version=30,t}function Xc(e){let t=H(e,`..annotations`),n=`FibonacciRetracement`;return t.forEach(e=>{if(e.id===n){let[t,r]=e.points;t.time>r.time&&(e.points=[r,t]);let i=e.traits;P(i)&&(i.line2=ps(null,n).line2)}}),e.version=31,e}function Zc(e){return e.version=32,e}function Qc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:rc().filter(e=>e.meta.shiftable===!0).map(e=>e.id)});return t.length>0&&t.forEach(e=>{let t=0;e.curves&&(t=e.curves[0].shift??0,e.curves?.forEach(e=>delete e.shift)),e.inputs&&e.inputs.push({name:`Offset`,value:t})}),e.version=33,e}function $c(e){let t=H(e,`..plots{.type === "Study" && .study === "VWAP"}`),n=V(`VWAP`);return t.length>0&&t.forEach(e=>{P(e.inputs)||(e.inputs=n.defaults.inputs.slice()),e.curves?.length===1&&e.curves.push(...n.defaults.curves.slice(1))}),e.version=34,e}function el(e){let t=`OBVOL`,n=H(e,`..plots{.type === "Study" && .study === "${t}"}`);if(n.length>0){let e=V(t);n.forEach(t=>{t.curves&&t.curves.length===1&&e.defaults.curves.length===2&&t.curves.push(e.defaults.curves[1]),!t.inputs&&e.defaults.inputs&&(t.inputs=e.defaults.inputs)})}return e.version=35,e}function tl(e){return H(e,`..annotations`).forEach(e=>{e.uid=bt()}),e.version=36,e}function nl(e){return e.version=37,e}function rl(e){let t=H(e,`..plots{.type === "Study" && .study === "CRS"}`),n=V(`CRS`);return t.length>0&&t.forEach(e=>{e.inputs?.length===3&&e.inputs.push(n.defaults.inputs[3])}),e.version=38,e}function il(e){let t=H(e,`..plots{.type === "Study" && .study === "PERF"}`),n=V(`PERF`);return t.length>0&&t.forEach(e=>{e.inputs?.length===0&&(e.inputs=n.defaults.inputs)}),e.version=39,e}function al(e){return e.version=40,e}function ol(e){return e.version=41,e}function sl(e){return e.version=42,e}function cl(e){let t=H(e,`..annotations`),n=[`FibonacciTimeZones`,`FibonacciFan`,`FibonacciArcs`],r=Vs();return t.forEach(e=>{let t=e.id;n.includes(t)?e.traits.factors=F(r[t].defaults.factors):t===`GannFan`&&(e.traits.angles=F(r[t].defaults.angles))}),e.version=43,e}function ll(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`RSI`,`RSIMOD`,`RSISTO`,`STOCHF`,`STOCHS`,`GTPI`]});return t.length>0&&t.forEach(e=>{e.levels&&e.levels.length===3&&!e.levels[1].name&&(e.levels[1].name=`Center`)}),e.version=57,e}function ul(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`VOL`,`MAVOL`]}),n=V(`MAVOL`),r=e=>{if(!P(e)||e.length<1)return`LikeMain`;switch(e[0]){case`ChangeBased`:return`CloseToClose`;case`OpenVsClose`:return`OpenToClose`;default:return`LikeMain`}},i=e=>({name:`BarColoring`,value:r(e)});return t.length>0&&t.forEach(e=>{if(!P(e.curves))return;let t=e.study===`VOL`?0:1;P(e.inputs)||(e.inputs=[]),t===1&&e.curves?.length===1&&e.curves.push(F(n.defaults.curves[1])),e.inputs.push(i(e.curves[t].attributes)),delete e.curves[t].attributes}),e.version=60,e}function dl(e){let t=`DIFA`,n=H(e,`..plots{.type === "Study" && .study === "${t}"}`),r=V(t);return n.length>0&&n.forEach(e=>{e.inputs?.length===2&&e.inputs.push(r.defaults.inputs[2])}),e.version=65,e}function fl(e){return H(e,`..annotations`).forEach(e=>{if(e.id===`FibonacciTimeZones`){let t=e.points;if(t.length===1){let e=F(t[0]);e.time+=1,t.push(e)}}}),e.version=66,e}function pl(e){let t=H(e,`..plots{.type === "Study" && .study === "DPO"}`),n=V(`DPO`);return t.length>0&&t.forEach(e=>{if(P(e.curves)&&e.curves?.length===1&&!P(e.levels)){let t=e.curves[0];if(t.colors?.length===1&&!P(t.zones)){e.levels=n.defaults.levels,t.zones=n.defaults.curves[0].zones;let r=t.colors[0],i=fo(r,.3);t.colors=[i,i]}}}),e.version=68,e}function ml(e){let t=`RSISTO`,n=H(e,`..plots{.type === "Study" && .study === "${t}"}`),r=V(t);return n.length>0&&n.forEach(e=>{e.curves?.length===1&&e.inputs?.length===2&&(e.curves.push(r.defaults.curves[1]),e.inputs.push(...r.defaults.inputs.slice(2)))}),e.version=70,e}var hl={[B.AT_SINGLE_STYLE]:!0,[B.AT_SHOW_BACKGROUND]:!1,[B.AT_BACKGROUND_OPACITY]:.2},gl={[B.AT_SHOW_PRICES]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_LEFT,[B.AT_EXTEND_LEFT]:!1,[B.AT_EXTEND_RIGHT]:!0,[B.AT_REVERSE]:!1,...hl},_l={FibonacciFan:{[B.AT_SHOW_LEVELS]:!1,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_REVERSE]:!1,...hl},FibonacciArcs:{[B.AT_SHOW_LEVELS]:!1,...hl},FibonacciRetracement:{...gl},TrendBasedFibExtension:{...gl},FibonacciChannel:{[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_LEFT,...hl},FibonacciTimeZones:{[B.AT_SHOW_LEVELS]:!0,[B.AT_LABELS]:B.AT_LABELS_RIGHT,...hl},GannFan:{[B.AT_SHOW_LEVELS]:!1,...hl},GannBox:{...hl,[B.AT_SHOW_BACKGROUND]:!0},GannSquare:{...hl,[B.AT_SHOW_BACKGROUND]:!0}},vl=()=>({width:1,color:ss(Math.floor(Math.random()*100)),dashStyle:`Solid`}),yl=[`FibonacciFan`,`FibonacciArcs`,`FibonacciChannel`,`FibonacciTimeZones`,`FibonacciRetracement`,`TrendBasedFibExtension`],bl=[`GannFan`,`GannBox`,`GannSquare`],xl=[...yl,...bl],Sl=[`Line`,`Ray`,`GannLine`],Cl=[`ComputedText`,`ProfitLoss`,`RewardRisk`];function wl(e){return yl.includes(e)?[`factors`]:e===`GannFan`?[`angles`]:e===`GannBox`?[`priceLevels`,`timeLevels`]:e===`GannSquare`?[`levels`,`fans`,`arcs`]:[]}function Tl(e,t,n){let r=!nt(e,t)||!Array.isArray(e[t]),i=!r&&e[t].some(e=>!P(e.value));if(r||i)return e[t]=n[t],!0}function El(e,t){if(!P(t))return;let n=wl(e),r=ps(null,e);for(let e of n)if(!Tl(t,e,r))for(let n of t[e])Number.isFinite(n.value)&&(n.value=Xe(n.value,6))}function Dl(e,t,n=!1){let r=e===`FibonacciFan`,i=P(t);if(xl.includes(e)&&i){if(n){let n=_l[e];ut(t,n)}let i=wl(e),a=ps(null,e);for(let e of i)if(!Tl(t,e,a))for(let n of t[e]){let t=a[e].find(e=>e.value===n.value)||a[e].find(e=>e.value===Math.abs(n.value));P(n.line)||(n.line=t?t.line:vl()),r&&n.value===0&&!P(n.shown)&&(n.shown=!0)}e===`FibonacciChannel`&&t[B.AT_SHOW_LABELS]?(t[B.AT_SHOW_LEVELS]=t[B.AT_SHOW_LABELS],delete t[B.AT_SHOW_LABELS]):e===`FibonacciArcs`&&!t[B.AT_SHOW_TRENDLINE]&&(t[B.AT_SHOW_TRENDLINE]=!0)}Sl.includes(e)&&i&&!P(t[B.AT_MARKER])&&(t[B.AT_MARKER]={...Rs}),i&&(t[B.AT_ALLOW_PRICES_CHANGE_UI]=!Cl.includes(e))}function Ol(e){return H(e,`..annotations`).forEach(e=>Dl(e.id,e.traits,!0)),e.version=71,e}var kl=[3,4,5,6,7,8,9,10,11],Al=[12,13,14,15,16,17,18,19,20];function jl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`GTPI`,`GPMI`,`CBMI`]}),n=V(`JPI`);return t.length>0&&t.forEach(e=>{let t=t=>e.study===t,r=(t,n)=>{e.study=t,e.curves?.length&&e.curves.forEach(e=>{for(let t of n){let[n,r]=t;e.fields?.length===1&&e.fields[0]===n&&(e.fields[0]=r)}})};t(`GTPI`)?r(`CTPI`,[[`GTPI`,`CTPI`]]):t(`GPMI`)?r(`CPMI`,[[`GPMI`,`CPMI`]]):t(`CBMI`)&&(r(`JPI`,[[`CBMB`,`JPIB`],[`CBMS`,`JPIS`]]),e.inputs?.length===3&&(e.inputs=e.inputs.map(e=>e.name===`FastNumber`?{name:`FastPeriod`,value:kl[Number(e.value)-1]}:e.name===`SlowNumber`?{name:`SlowPeriod`,value:Al[Number(e.value)-1]}:e),e.inputs.splice(2,0,n.defaults.inputs[2])))}),e.version=72,e}function Ml(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`JPI`]}),n=V(`JPI`).defaults.inputs.find(e=>e.name===`HandbrakePeriod`);return t.length>0&&t.forEach(e=>{e.inputs?.length===4&&e.inputs.push(n)}),e.version=73,e}function Nl(e){let t=`COPP`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`${t}`]}),r=V(t);return n.length>0&&n.forEach(e=>{P(e.inputs)&&(e.curves=r.defaults.curves,e.levels=r.defaults.levels)}),e.version=77,e}function Pl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MFI`]}),n=V(`MFI`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels,e.bands=n.defaults.bands)}),e.version=78,e}function Fl(e){let t=`RSIMOD`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`RSI`,t]}),r=V(`RSI`),i=V(t);return n.length>0&&n.forEach(e=>{if(P(e.inputs)){let t=e.study===`RSI`?r.defaults:i.defaults;e.inputs.push(...t.inputs.slice(1)),e.curves.push(...t.curves.slice(1))}}),e.version=79,e}function Il(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CCI`]}),n=V(`CCI`);return t.length>0&&t.forEach(e=>{if(N(e.inputs)){let t=e.curves[0].colors[0],r=fo(t,.3);e.curves=n.defaults.curves;let i=e.curves[0].colors;i[0]=i[3]=r,i[2]=t,N(e.levels)?e.levels.splice(1,0,n.defaults.levels[1]):e.levels=n.defaults.levels,N(e.bands)||(e.bands=n.defaults.bands)}}),e.version=80,e}function Ll(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MACD`,`MACDEXP`]}),n=V(`MACD`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels)}),e.version=84,e}function Rl(e){let t=`BBANDS`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{e.inputs?.length===3&&e.inputs.push(r.defaults.inputs[3])}),e.version=87,e}function zl(e){let t=H(e,`..plots{.type === "Study" && .study === "EHLAI" }`);return t.length>0&&t.forEach(e=>{e.study=`NHLAI`,e.curves?.length===1&&e.curves[0].fields?.length===1&&(e.curves[0].fields[0]=`NHLAI`)}),e.version=90,e}function Bl(e){let t=`MCCLO`,n=H(e,`..plots{.type === "Study" && .study === "${t}" }`),r=V(t);return n.length>0&&n.forEach(e=>{e.inputs?.length===3&&e.inputs.push(r.defaults.inputs[3])}),e.version=91,e}function Vl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`PMO`]}),n=V(`PMO`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels)}),e.version=96,e}function Hl(e){return H(e,`..annotations`).forEach(e=>{if(e.id===`ComputedText`){e.points.splice(2);let[t,n]=[`ProfitLoss`,`RewardRisk`];e.traits.kind===t?e.id=t:e.traits.kind===n&&(e.id=n),e.traits[B.AT_SHOW_PRICES]=e.traits[B.AT_DRAW_LINES]??!0,delete e.traits[B.AT_DRAW_LINES],e.traits[B.AT_POSITION]=e.traits.pos??`Long`,delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[B.AT_ALLOW_PRICES_CHANGE_UI]=!1}}),e.version=102,e}function Ul(e){let t=`UseAllFields`;return H(e,`..curves{.attributes === "${t}"}`).forEach(e=>{let n=e.attributes.indexOf(t);e.attributes.splice(n,1),e.style===`Column`&&(e.style=`MultiColumn`,e.varyColorPerBar=!1)}),e.version=104,e}function Wl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MASMO`,`MATRI`,`MAWEI`,`DEMA`,`TEMA`,`HMA`,`MARIB`,`MA`,`MAEXP`]});return t.length>0&&t.forEach(e=>{let t=e.inputs;if(N(t)){let e=e=>t.findIndex(t=>t.name===e),n=(n,r,i)=>{if(e(n)>=0)return;let a={name:n,value:r};i<0?t.push(a):t.splice(i,0,a)};n(`Source`,`Close`,e(`Offset`)),n(`Offset`,0,-1)}}),e.version=106,e}var Gl=[{name:`Source`,value:`Close`},{name:`Average`,value:`MA`}];function Kl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MASIG`,`MACDSIG`]});return t.length>0&&t.forEach(e=>{let t=e.study===`MASIG`;e.study=t?`PACROSS`:`MACROSS`;let n=e.inputs;N(n)&&n.splice(0,0,...Gl);let r=e.curves;N(r)&&t&&(r[0].fields[0]=`AVG`)}),e.version=109,e}function ql(e){return H(e,`..annotations`).forEach(e=>{(e.id===`LongPosition`||e.id===`ShortPosition`)&&(e.traits[B.AT_ALLOW_PRICES_CHANGE_UI]=!0)}),e.version=111,e}function Jl(e){H(e,`..plots{.type === "Study" && .study === "CHEXI"}.inputs{.name === "Period" || .name === "Multiplier"}`).forEach(e=>{if(typeof e.value!=`string`||e.value.trim()===``)return;let t=Number(e.value);Number.isFinite(t)&&(e.value=t)})}function Yl(e){return Jl(e),e.version=113,e}function Xl(e){let t=H(e,`..plots{.detachedScale}`);return t.length>0&&t.forEach(e=>{e.detachedScale=!0}),e.version=114,e}function Zl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`STOCHF`,`STOCHS`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);N(e.inputs)&&N(e.curves)&&(e.curves[0]=t.curves[0],e.study===`STOCHF`&&e.curves[1].colors[0]===`#00b04b`&&(e.curves[1].colors[0]=t.curves[1].colors[0]))}),e.version=116,e}function Ql(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CHAMF`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);N(e.inputs)&&N(e.curves)&&(e.curves[0]=t.curves[0])}),e.version=117,e}function $l(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CHDMOMOSC`,`TSI`,`DIFA`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);if(N(e.inputs)&&N(e.curves))switch(e.study){case`CHDMOMOSC`:case`TSI`:{let n=e.levels?.[0];e.levels=t.levels,N(n)&&(e.levels[1]=n);break}case`DIFA`:{let[n,r]=e.curves[0].colors;e.curves=[t.curves[0]],e.curves[0].colors=[n,uo(n),r,uo(r)];break}}}),e.version=120,e}function eu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MACD`,`MACDEXP`,`PPO`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);if(N(e.inputs)&&N(e.curves))switch(e.study){case`MACD`:case`MACDEXP`:{let n=e.curves[2],r=n.colors;if(delete n.zones,r.length===2){let e=r.map(e=>fo(e,.3));n.colors=[e[0],r[0],e[1],r[1]]}else n.colors=t.curves[2].colors;n.varyColorPerBar=!0;break}case`PPO`:e.curves[2]=t.curves[2];break}}),e.version=125,e}function tu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CRS`]}),n=V(`CRS`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels)}),e.version=128,e}function nu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`PC`]}),n=V(`PC`);return t.length>0&&t.forEach(e=>{if(N(e.inputs)&&e.inputs.length===6){let t=e.inputs[0].value;e.inputs[0].name=n.defaults.inputs[0].name,e.inputs[0].value=`HV ${t}`,e.inputs.splice(1,0,n.defaults.inputs[1])}}),e.version=131,e}function ru(e){let t=`VOLAP`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{if(N(e.inputs)&&e.inputs.length===5){let t=e.inputs.find(e=>e.name===`Bars`);N(t)&&(t.name=`LevelSize`),e.inputs=[{name:`LevelMode`,value:`Count`},...e.inputs,{name:`ValueRangePercent`,value:70}]}if(N(e.curves)&&e.curves.length===1){let t=e.curves[0].colors.pop();e.curves.push(...r.defaults.curves.slice(1)),e.curves[1].colors=[t],e.curves[2].colors=e.curves[0].colors.map(e=>fo(e,.6))}}),e.version=137,e}function iu(e){let t=`ADXMOD`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`ADX`,t]}),r=V(`ADX`),i=V(t);return n.length>0&&n.forEach(e=>{P(e.inputs)&&(e.levels=[...(e.study===`ADX`?r.defaults:i.defaults).levels])}),e.version=140,e}function au(e){let t=`CHDMOMOSC`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{if(P(e.inputs)){let t=r.defaults;e.inputs.push(...t.inputs.slice(1,3)),e.curves.push(...t.curves.slice(1,2))}}),e.version=142,e}function ou(e){let t=`MACDV`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{if(N(e.inputs)){let t=r.defaults,n=e.levels[0];e.levels=[...t.levels],e.levels[2]=n}}),e.version=144,e}function su(e){let t=`KELCHN`,n=`KELEXP`,r=`KELBND`,i=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t,n,r]}),a=V(t),o=V(r);return i.length>0&&i.forEach(e=>{if(N(e.inputs))switch(e.study){case t:e.inputs.push(a.defaults.inputs[1]);break;case n:e.study=t,e.inputs.push(o.defaults.inputs[2]);for(let t=0;t<4;t++)e.curves[t].fields=a.defaults.curves[t].fields;break;case r:e.inputs.push(o.defaults.inputs[2]);break}}),e.version=145,e}function cu(e){let t=e.curves?.length??0,n=e.offsets?.length??0;if(!(t===0||n===0)&&t===n+1){let n=e.usesInAverage;Array.isArray(n)&&n.length===6?(e.curves.splice(1,5),e.offsets=[0,-5]):t>2?e.offsets?.push(-1):e.curves.splice(-1,1),delete e.usesInAverage}}function lu(e){let t=H(e,`..plots{.type === "Seasonal"}`);return t.length>0&&t.forEach(e=>{cu(e)}),e.version=149,e}function uu(e,t){let n=e.find(e=>e.name===`TurtleChnField`&&e.value===t);N(n)&&(n.value=`High/Low`)}function du(e){let t=`REATRHI`,n=`REATRLO`,r=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t,n]});return r.length>0&&r.forEach(e=>{if(N(e.inputs)){switch(e.study){case t:e.inputs.unshift({name:`Direction`,value:`Long`}),uu(e.inputs,`High`);break;case n:e.inputs.unshift({name:`Direction`,value:`Short`}),uu(e.inputs,`Low`);break}e.study=`REATRS`,e.curves[0].fields[0]=`REATRS`}}),e.version=151,e}var fu={colors:[`rgba(252, 13, 27, 0.3)`,`rgba(0, 176, 75, 0.3)`],fields:[`DIFA`],style:`Area`,visible:!1,zones:[{value:0,colors:1},{colors:1}]};function pu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`DIFA`]});return t.length>0&&t.forEach(e=>{N(e.curves)&&e.curves.push(fu)}),e.version=152,e}function mu(e){let t=[`BPERC`,`BSQUEEZE`,`BWIDTH`],n=[`BOLLP`,`BOLLBW`,`BOLLW`],r=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:t});return r.length>0&&r.forEach(e=>{let r=t.indexOf(e.study),i=e.study===`BSQUEEZE`;i&&(e.study=`BBANDW`),N(e.curves)&&(e.curves[0].fields[0]=n[r],i&&e.curves.push({colors:[`#f08f4c`],fields:[`BOLLBWA`]})),N(e.inputs)&&i&&e.inputs.push({name:`Average`,value:`MA`},{name:`PeriodAvg`,value:5})}),e.version=154,e}function hu(e){let t=H(e,`..plots{.type === "Study" && .study === "LINRCHN"}`);return t.length>0&&t.forEach(e=>{N(e.inputs)&&e.inputs.push({name:`ExtendLines`,value:`None`})}),e.version=161,e}function gu(e){let t=e.display?.xAxis?.cycleTransition,n=e.display?.xAxis?.contractTransition,r=e=>{P(e)&&!P(e.fillColor)&&(e.fillColor=`rgba(119,119,119,0.1)`)};return r(t),r(n),e.version=162,e}function _u(e){let t=`ZIGZAG`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t).defaults.inputs??[],i=r.find(e=>e.name===`ReversalChange`),a=r.findIndex(e=>e.name===`ReversalChange`);return n.length>0&&N(i)&&n.forEach(e=>{if(N(e.inputs)&&!e.inputs.some(e=>e.name===`ReversalChange`)){let t=a>=0?Math.min(a,e.inputs.length):e.inputs.length;e.inputs.splice(t,0,{...i})}}),e.version=166,e}function vu(e){return H(e,`..plots{.type === "Study" && .basis}`).forEach(e=>{e.basis={kind:`main`}}),e.version=167,e}function yu(e){let t=H(e,`..plots{.type === "Study" && .study === "TARGP"}`),n=V(`TARGP`).defaults;return t.length>0&&t.forEach(e=>{if(!N(e.curves))return;let t=e.curves[0]?.colors?.[0],r=e.curves[1]?.colors?.[0];e.curves=[F(n.curves[0])],N(r)&&N(t)&&(e.curves[0].colors=[r,t])}),e.version=170,e}var bu={"1-Day":`Implied Volatility`,"5-Day":`5-Day Average IV`,"1-Month":`1-Month Average IV`,"3-Month":`3-Month Average IV`,"6-Month":`6-Month Average IV`,"1-Year":`1-Year Average IV`,YTD:`YTD Average IV`};function xu(e){return H(e,`..plots{.type === "Study" && .study === "OPTIV"}`).forEach(e=>{let t=e.inputs?.find(e=>e.name===`TimeFrame`&&typeof e.value==`string`);N(t)&&(t.value=bu[t.value]??t.value)}),e.version=172,e}var Su={SymbolBuy:`SymbolLetterB`,SymbolSell:`SymbolLetterS`};function Cu(e){return H(e,`..annotations`).forEach(e=>{let t=Su[e.id];t&&(e.id=t)}),e.version=175,e}function wu(e){return H(e,`..plots{.type === "Study" && .study === "HV"}`).forEach(e=>{e.inputs&&e.inputs.unshift({name:`Calculation`,value:`Percentage`})}),e.version=176,e}function Tu(e){return H(e,`..plots{.type === "Study" && (.study === "MACROSS" || .study === "PACROSS")}`).forEach(e=>{if(e.inputs&&e.inputs.push({name:`ShowSignals`,value:`Yes`}),e.curves){let t=e.curves[0],n=t.colors[0];t.colors=[n,n],t.varyColorPerBar=!0}}),e.version=177,e}function Eu(e){return Jl(e),e.version=182,e}function W(e){return function(t){return t.version=e,t}}var Du={_3to4:yc,_4to5:bc,_5to6:xc,_6to7:Sc,_7to8:Cc,_8to9:Tc,_9to10:Dc,_10to11:Oc,_11to12:kc,_12to13:Ac,_13to14:jc,_14to15:Nc,_15to16:Pc,_16to17:Fc,_17to18:Lc,_18to19:Rc,_19to20:zc,_20to21:Bc,_21to22:Vc,_22to23:Hc,_23to24:Uc,_24to25:Wc,_25to26:Gc,_26to27:Kc,_27to28:qc,_28to29:Jc,_29to30:Yc,_30to31:Xc,_31to32:Zc,_32to33:Qc,_33to34:$c,_34to35:el,_35to36:tl,_36to37:nl,_37to38:rl,_38to39:il,_39to40:al,_40to41:ol,_41to42:sl,_42to43:cl,_43to44:W(44),_44to45:W(45),_45to46:W(46),_46to47:W(47),_47to48:W(48),_48to49:W(49),_49to50:W(50),_50to51:W(51),_51to52:W(52),_52to53:W(53),_53to54:W(54),_54to55:W(55),_55to56:W(56),_56to57:ll,_57to58:W(58),_58to59:W(59),_59to60:ul,_60to61:W(61),_61to62:W(62),_62to63:W(63),_63to64:W(64),_64to65:dl,_65to66:fl,_66to67:W(67),_67to68:pl,_68to69:W(69),_69to70:ml,_70to71:Ol,_71to72:jl,_72to73:Ml,_73to74:W(74),_74to75:W(75),_75to76:W(76),_76to77:Nl,_77to78:Pl,_78to79:Fl,_79to80:Il,_80to81:W(81),_81to82:W(82),_82to83:W(83),_83to84:Ll,_84to85:W(85),_85to86:W(86),_86to87:Rl,_87to88:W(88),_88to89:W(89),_89to90:zl,_90to91:Bl,_91to92:W(92),_92to93:W(93),_93to94:W(94),_94to95:W(95),_95to96:Vl,_96to97:W(97),_97to98:W(98),_98to99:W(99),_99to100:W(100),_100to101:W(101),_101to102:Hl,_102to103:W(103),_103to104:Ul,_104to105:W(105),_105to106:Wl,_106to107:W(107),_107to108:W(108),_108to109:Kl,_109to110:W(110),_110to111:ql,_111to112:W(112),_112to113:Yl,_113to114:Xl,_114to115:W(115),_115to116:Zl,_116to117:Ql,_117to118:W(118),_118to119:W(119),_119to120:$l,_120to121:W(121),_121to122:W(122),_122to123:W(123),_123to124:W(124),_124to125:eu,_125to126:W(126),_126to127:W(127),_127to128:tu,_128to129:W(129),_129to130:W(130),_130to131:nu,_131to132:W(132),_132to133:W(133),_133to134:W(134),_134to135:W(135),_135to136:W(136),_136to137:ru,_137to138:W(138),_138to139:W(139),_139to140:iu,_140to141:W(141),_141to142:au,_142to143:W(143),_143to144:ou,_144to145:su,_145to146:W(146),_146to147:W(147),_147to148:W(148),_148to149:lu,_149to150:W(150),_150to151:du,_151to152:pu,_152to153:W(153),_153to154:mu,_154to155:W(155),_155to156:W(156),_156to157:W(157),_157to158:W(158),_158to159:W(159),_159to160:W(160),_160to161:hu,_161to162:gu,_162to163:W(163),_163to164:W(164),_164to165:W(165),_165to166:_u,_166to167:vu,_167to168:W(168),_168to169:W(169),_169to170:yu,_170to171:W(171),_171to172:xu,_172to173:W(173),_173to174:W(174),_174to175:Cu,_175to176:wu,_176to177:Tu,_177to178:W(178),_178to179:W(179),_179to180:W(180),_180to181:W(181),_181to182:Eu};function Ou(e,t,n){let r=e;try{for(ec(!1);t<n;){let e=Du[`_${t}to${t+1}`];r=e(r),t+=1}}finally{ec(!0)}return r}function ku(e,t){if(t===B.CHART_SCHEMA){let n=H(Xs(t),`.properties.version.minimum`)[0],r=e.version;if(r<n)return Ou(e,r,n)}return e}function Au(e){return{unit:rt(e,`Day`,`unit`),size:rt(e,1,`size`),spec:rt(e,`None`,`spec`),isContractVolume:rt(e,!1,`isContractVolume`),dividendsAdjust:rt(e,!1,`dividendsAdjust`),backAdjust:rt(e,!1,`backAdjust`),daysToExpiration:rt(e,1,`daysToExpiration`),contractRoll:rt(e,`combined`,`contractRoll`)}}function ju(e){let t=Au(e);return new Ru(g[t.unit],t.size,_[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function Mu(e){switch(e.unit){case g.Tick:return Lu;case g.Intraday:case g.Day:return Nu;case g.Week:return Pu;case g.Month:return Fu;case g.Quarter:return Iu;case g.Year:return pi;default:return Lu}}function Nu(e,t){return Nn(e,t)&&Fu(e,t)}function Pu(e,t){return li(e,t)&&Fu(e,t)}function Fu(e,t){return di(e,t)&&pi(e,t)}function Iu(e,t){return fi(e,t)&&pi(e,t)}function Lu(e,t){return+e==+t}var Ru=class e{unit;size;spec;isContractVolume;dividendsAdjust;backAdjust;daysToExpiration;contractRoll;constructor(e=g.Day,t=1,n=_.None,r=!1,i=!1,a=!1,o=1,s=`combined`){this.unit=e,this.size=t,this.spec=n,this.isContractVolume=r,this.dividendsAdjust=i,this.backAdjust=a,this.daysToExpiration=o,this.contractRoll=s}duplicate(){return new e(this.unit,this.size,this.spec,this.isContractVolume,this.dividendsAdjust,this.backAdjust,this.daysToExpiration,this.contractRoll)}getHashKey(){return`[${this.unit}:${this.size}:${this.spec}:${this.isContractVolume}:${this.dividendsAdjust}:${this.backAdjust}:${this.daysToExpiration}:${this.contractRoll}]`}toShortString(){if(this.unit===g.Tick){let e=`T`,t=!0;switch(this.spec){case _.PerCount:e=`Tpb`;break;case _.PerVolume:e=`Vpb`;break;case _.PerRange:e=`Rpb`;break;case _.PerSeconds:e=`Spb`;break;case _.TopOfBook:e=`TOB`;break;default:t=!1;break}return`${t?this.size:``}${e}`}else if(this.unit===g.Intraday)return this.size%60==0?`${this.size/60}h`:`${this.size}`;else{let e=``;return this.spec===_.Nearest?e=`n`:this.spec===_.Continue&&(e=`c`),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e=``;switch(this.unit){case g.Tick:e=`Tick`;break;case g.Intraday:if(this.size%60==0){let t=this.size/60;e=`${t} hour${t>1?`s`:``}`}else e=`${this.size<10?` `:``}${this.size} minute${this.size>1?`s`:``}`;break;case g.Day:e=`Daily`;break;case g.Week:e=`Weekly`;break;case g.Month:e=`Monthly`;break;case g.Quarter:e=`Quarterly`;break;case g.Year:e=`Yearly`;break;default:break}return e}describe(){let e=this.unitToString();switch(this.spec){case _.Nearest:e+=` Nearest`;break;case _.Continue:e+=` Continue`;break;case _.PerCount:e=`Ticks Per Bar`;break;case _.PerVolume:e=`Volume Per Bar`;break;case _.PerRange:e=`Range Per Bar`;break;case _.PerSeconds:e=`Seconds Per Bar`;break;case _.TopOfBook:e=`Top Of Book`;break;case _.None:default:break}return e}get hasSpec(){return this.spec!==_.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===g.Tick}get isIntraday(){return this.unit===g.Intraday}get isMultiContract(){let e=this.spec===_.Nearest,t=this.spec===_.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}};function zu(e){delete e.display.chart.bar}function Bu(e){P(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,P(e.data.range)&&delete e.data.range,delete e.data.checkRange}function Vu(e){tf(e.display.period)&&delete e.display.period}function Hu(e){P(e.display.density)&&delete e.display.density}function Uu(e){let t=e.getDataStats();return t===null?null:t.dataRange}function Wu(e,t){return e.unit!==t.unit||e.size!==t.size||e.spec!==t.spec}function Gu(e,t,n){let r=P(t.period),i=P(t.range),a=P(t.density),o=e=>+!!e;if(o(r)+o(i)+o(a)>1)throw Error(`Cannot set more than one of: period, range, density.`);if(r&&(e.display.period=t.period,Bu(e),Hu(e)),i)if((!P(e.display.period)||tf(e.display.period))&&(e.display.xAxis.visibleRange=t.range),Vu(e),Hu(e),P(n)){let r=Uu(n),i=ju(e.data.aggregation),a=n.data.aggregation,o=Wu(i,a)||!P(r)||e.data.checkRange,s=o;if(!o){let{from:e,to:n}=r,{from:i,to:a}=t.range;s=i<e||i>n||a<e||a>n}s&&(e.data.range=t.range),delete e.data.checkRange}else e.data.checkRange=!0;return a&&(e.display.density=t.density,Bu(e),Vu(e)),(r||i||a)&&(zu(e),n&&(n.forceResetVisibleRange=!0)),e}function Ku(e){switch(h[e]){case h.OHLC:case h.HLC:case h.Candlestick:case h.HollowCandles:case h.HeikinAshi:case h.ElderImpulseSystem:case h.Range:case h.MultiColumn:return!0;default:return!1}}function qu(e){switch(h[e]){case h.Candlestick:case h.HollowCandles:case h.HeikinAshi:case h.ElderImpulseSystem:case h.Column:case h.Renko:case h.Range:case h.Kagi:case h.PointAndFigure:case h.LineBreak:case h.HLC:return!0;default:return!1}}function Ju(e){return e!==void 0&&e.length>0&&e.some(e=>e===m[m.ChangeBased]||e===m[m.OpenVsClose])}function Yu(){return{fields:[`Close`],style:`Line`,lineWidth:2,visible:!0,colors:[`#888`],varyColorPerBar:!1}}function Xu(e,t){let n=$().getDefaultMultiFieldCurve();if(n!==null&&n.style===e)return n;let r=e=>e.id,i=[G.Open,G.High,G.Low,G.Close,G.Change].map(r);h[e]===h.HLC&&i.splice(0,1);let a=[G.Close].map(r),o=F(B.COLOR_DEFAULT_AREA),s=F(B.COLOR_DEFAULT_OHLC),c=F(B.COLOR_DEFAULT_VARY),l={fields:i,colors:c,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch(h[e]){case h.OHLC:case h.HLC:case h.Renko:case h.LineBreak:case h.Range:case h.Kagi:case h.PointAndFigure:l.colors=t?c:[s];break;case h.Candlestick:case h.HollowCandles:case h.HeikinAshi:case h.MultiColumn:break;case h.ElderImpulseSystem:l.colors=c.concat(o);break;case h.Line:case h.PercentChange:l.fields=a,l.colors=[s];break;case h.Area:l.fields=a,l.colors=[fo(o,.5),o];break;case h.Baseline:l.fields=a,l.colors=c.map(e=>fo(e,.5)),l.zones=[{value:0,colors:1},{colors:1}];break;case h.Column:l.fields=a;break;default:throw Error(`Curve style "${e}" is not supported here.`)}return l}function Zu(e,t){switch(e){case C.Symbol:case C.Expression:{let e=t.style||`Candlestick`;return Xu(e,t.varyColorPerBar||qu(e))}case C.Forward:case C.Seasonal:return Yu();default:throw Error(`Unexpected plot type '${C[e]}', don't know its default curve.`)}}function Qu(e,t){Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||qu(e.style)||Ju(e.attributes));let n=Zu(C[t],e);return ht(n,e),n}var $u=[`Renko`,`Kagi`,`PointAndFigure`,`LineBreak`,`Baseline`];function ed(e,t){let n=t.curves[0],r=Hd(e);if(r.curves=[Qu(n,t.type)],t.isMultiCurveMain&&t.curves.length>1&&r.curves.push(...t.curves.slice(1)),t.type===`Symbol`&&P(n)&&$u.includes(n.style)){let e=r;P(t.inputs)?e.inputs=t.inputs:delete e.inputs}return e}function td(e,t,n){return n||=` `,e.length>t?e:(t-=e.length,n+=n.repeat(t),e+n.slice(0,t))}var nd=class e extends Error{static buildMessage(e,t){function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function r(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,e=>`\\x0`+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>`\\x`+n(e))}function i(e){return e.replace(/\\/g,`\\\\`).replace(/\]/g,`\\]`).replace(/\^/g,`\\^`).replace(/-/g,`\\-`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,e=>`\\x0`+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>`\\x`+n(e))}function a(e){switch(e.type){case`literal`:return`"`+r(e.text)+`"`;case`class`:let t=e.parts.map(e=>Array.isArray(e)?i(e[0])+`-`+i(e[1]):i(e));return`[`+(e.inverted?`^`:``)+t+`]`;case`any`:return`any character`;case`end`:return`end of input`;case`other`:return e.description}}function o(e){let t=e.map(a),n,r;if(t.sort(),t.length>0){for(n=1,r=1;n<t.length;n++)t[n-1]!==t[n]&&(t[r]=t[n],r++);t.length=r}switch(t.length){case 1:return t[0];case 2:return t[0]+` or `+t[1];default:return t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}}function s(e){return e?`"`+r(e)+`"`:`end of input`}return`Expected `+o(e)+` but `+s(t)+` found.`}message;expected;found;location;name;constructor(t,n,r,i){super(),this.message=t,this.expected=n,this.found=r,this.location=i,this.name=`SyntaxError`,typeof Object.setPrototypeOf==`function`?Object.setPrototypeOf(this,e.prototype):this.__proto__=e.prototype,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e)}format(e){let t=`Error: `+this.message;if(this.location){let n=null,r;for(r=0;r<e.length;r++)if(e[r].grammarSource===this.location.source){n=e[r].text.split(/\r\n|\n|\r/g);break}let i=this.location.start,a=this.location.source+`:`+i.line+`:`+i.column;if(n){let e=this.location.end,r=td(``,i.line.toString().length,` `),o=n[i.line-1],s=i.line===e.line?e.column:o.length+1;t+=`
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=function(e){return e[e.Browser=0]=`Browser`,e[e.NodeJs=1]=`NodeJs`,e}({}),u=function(e){return e[e.UsePrevious=0]=`UsePrevious`,e[e.UseNext=1]=`UseNext`,e[e.UseNone=2]=`UseNone`,e}({}),d=function(e){return e[e.Minimum=0]=`Minimum`,e[e.Everything=1]=`Everything`,e[e.Manual=2]=`Manual`,e}({}),f=function(e){return e[e.NoAction=0]=`NoAction`,e[e.IgnoreTimelineOnly=1]=`IgnoreTimelineOnly`,e[e.ModelTransformRequired=2]=`ModelTransformRequired`,e}({}),p=function(e){return e[e.Down=0]=`Down`,e[e.Up=1]=`Up`,e[e.Same=2]=`Same`,e}({}),m=function(e){return e[e.ChangeBased=0]=`ChangeBased`,e[e.OpenVsClose=1]=`OpenVsClose`,e}({}),h=function(e){return e[e.OHLC=0]=`OHLC`,e[e.Line=1]=`Line`,e[e.Candlestick=2]=`Candlestick`,e[e.Area=3]=`Area`,e[e.Column=4]=`Column`,e[e.Dots=5]=`Dots`,e[e.HLC=6]=`HLC`,e[e.HL=7]=`HL`,e[e.Ribbon=8]=`Ribbon`,e[e.Step=9]=`Step`,e[e.HollowCandles=10]=`HollowCandles`,e[e.HeikinAshi=11]=`HeikinAshi`,e[e.ElderImpulseSystem=12]=`ElderImpulseSystem`,e[e.Renko=13]=`Renko`,e[e.Range=14]=`Range`,e[e.LineBreak=15]=`LineBreak`,e[e.Kagi=16]=`Kagi`,e[e.PointAndFigure=17]=`PointAndFigure`,e[e.Baseline=18]=`Baseline`,e[e.PercentChange=19]=`PercentChange`,e[e.MultiColumn=20]=`MultiColumn`,e[e.StackedColumn=21]=`StackedColumn`,e}({}),g=function(e){return e[e.Tick=0]=`Tick`,e[e.Intraday=1]=`Intraday`,e[e.Day=2]=`Day`,e[e.Week=3]=`Week`,e[e.Month=4]=`Month`,e[e.Quarter=5]=`Quarter`,e[e.Year=6]=`Year`,e}({}),_=function(e){return e[e.None=0]=`None`,e[e.Nearest=1]=`Nearest`,e[e.Continue=2]=`Continue`,e[e.PerCount=3]=`PerCount`,e[e.PerVolume=4]=`PerVolume`,e[e.PerRange=5]=`PerRange`,e[e.PerSeconds=6]=`PerSeconds`,e[e.TopOfBook=7]=`TopOfBook`,e}({}),v=function(e){return e[e.Number=0]=`Number`,e[e.String=1]=`String`,e[e.Date=2]=`Date`,e}({}),y=function(e){return e[e.FromMetaData=0]=`FromMetaData`,e[e.AsInteger=1]=`AsInteger`,e[e.UseMetricUnit=2]=`UseMetricUnit`,e[e.AsPercent=3]=`AsPercent`,e}({}),b=function(e){return e[e.Common=0]=`Common`,e[e.Study=1]=`Study`,e[e.BalanceSheet=2]=`BalanceSheet`,e[e.IncomeStatement=3]=`IncomeStatement`,e[e.Forward=4]=`Forward`,e[e.Seasonal=5]=`Seasonal`,e[e.Event=6]=`Event`,e[e.Option=7]=`Option`,e}({}),x=function(e){return e[e.None=0]=`None`,e[e.Value=1]=`Value`,e[e.Percent=2]=`Percent`,e}({}),S=function(e){return e[e.Linear=0]=`Linear`,e[e.Logarithmic=1]=`Logarithmic`,e}({}),C=function(e){return e[e.Symbol=0]=`Symbol`,e[e.Expression=1]=`Expression`,e[e.Study=2]=`Study`,e[e.Forward=3]=`Forward`,e[e.BalanceSheet=4]=`BalanceSheet`,e[e.IncomeStatement=5]=`IncomeStatement`,e[e.Seasonal=6]=`Seasonal`,e}({}),w=function(e){return e[e.Normal=0]=`Normal`,e[e.Forward=1]=`Forward`,e[e.HistoricalForward=2]=`HistoricalForward`,e[e.Study=3]=`Study`,e[e.BalanceSheet=4]=`BalanceSheet`,e[e.IncomeStatement=5]=`IncomeStatement`,e[e.Events=6]=`Events`,e[e.Options=7]=`Options`,e}({}),T=function(e){return e[e.Left=0]=`Left`,e[e.Center=1]=`Center`,e[e.Right=2]=`Right`,e}({}),ee=function(e){return e[e.Arrow=0]=`Arrow`,e[e.Crosshair=1]=`Crosshair`,e[e.Move=2]=`Move`,e[e.Hand=3]=`Hand`,e[e.ResizeVertical=4]=`ResizeVertical`,e[e.Grabbing=5]=`Grabbing`,e[e.ResizeHorizontal=6]=`ResizeHorizontal`,e}({}),E=function(e){return e[e.NotApplicable=0]=`NotApplicable`,e[e.Left=1]=`Left`,e[e.Middle=2]=`Middle`,e[e.Right=3]=`Right`,e}({}),D=function(e){return e[e.Shift=0]=`Shift`,e[e.Alt=1]=`Alt`,e[e.Control=2]=`Control`,e[e.Meta=3]=`Meta`,e}({}),te=function(e){return e[e.None=0]=`None`,e[e.Horizontal=1]=`Horizontal`,e[e.Vertical=2]=`Vertical`,e[e.Both=3]=`Both`,e}({}),ne=function(e){return e[e.Unspecified=0]=`Unspecified`,e[e.GBE=1]=`GBE`,e[e.cmdtyView=2]=`cmdtyView`,e[e.DemoSite=3]=`DemoSite`,e[e.InternalFeed=4]=`InternalFeed`,e[e.Widget=5]=`Widget`,e[e.FreeWidget=6]=`FreeWidget`,e[e.EqPlus=7]=`EqPlus`,e}({}),re=function(e){return e[e.Unspecified=0]=`Unspecified`,e[e.Head=1]=`Head`,e[e.Tail=2]=`Tail`,e}({}),ie=function(e){return e[e.wheel=0]=`wheel`,e[e[`wheel+shift`]=1]=`wheel+shift`,e[e.none=2]=`none`,e}({}),ae=function(e){return e[e.Page=0]=`Page`,e[e.Application=1]=`Application`,e}({}),O=function(e){return e[e.None=0]=`None`,e[e.Created=1]=`Created`,e[e.Deleted=2]=`Deleted`,e[e.Moved=3]=`Moved`,e[e.PointMoved=4]=`PointMoved`,e[e.TextChanged=5]=`TextChanged`,e[e.Undo=6]=`Undo`,e[e.Redo=7]=`Redo`,e[e.Cancelled=8]=`Cancelled`,e[e.Executed=9]=`Executed`,e[e.Reordered=10]=`Reordered`,e}({}),oe=function(e){return e[e.None=0]=`None`,e[e.Min=1]=`Min`,e[e.Max=2]=`Max`,e}({});function se(e,t){return function(...n){return e.apply(this,[t,...n])}}function ce(e,t,n){return function(...r){return e.apply(this,[t,n,...r])}}function le(...e){let t=e?e.length:0,n=this;return function(...r){let i=0,a=t?e[i].apply(n,r):r[0];for(;++i<t;)a=e[i].call(n,a);return a}}function ue(e){return e}function de(e){return e!==null}function fe(e){let t=new Map;return(...n)=>{let r=JSON.stringify(n);return t.has(r)||t.set(r,e(...n).catch(e=>(t.delete(r),Promise.reject(e)))),t.get(r)}}function pe(e){return e.reduce((e,t)=>e+t,0)}function me(e){let t=e.length;return t>0?pe(e)/t:0}function k(e){return e.every(e=>e!==null)}function he(e,t){return Array.from(Array(t)).map((t,n)=>n+e)}function A(e,t){let n=[],r=[];return e.forEach(e=>{t(e)?n.push(e):r.push(e)}),{yes:n,no:r}}function ge(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e===t)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}function _e(e,t){let n=ve(e,t);return n===-1?null:e[n]}function ve(e,t){if(e.length<1)return-1;for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function ye(e,t){let n=e?e.slice():[];return t.forEach(e=>{n.includes(e)||n.push(e)}),n}function j(e,t){return e.filter(e=>!t.includes(e))}function be(e,t,n=ue){let r=[];return e.forEach(e=>{let i=n(e);!r.map(n).includes(i)&&t.map(n).includes(i)&&r.push(e)}),r}function xe(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function Se(e){if(!(e.length<1))return e[0]}function Ce(e,t,n=null){if(e.length<1)return-1;let r=Number.isFinite(n)&&n<e.length?n:e.length-1;for(let n=r;n>=0;--n)if(t(e[n]))return n;return-1}var we=(e,t)=>e[t];function Te(e,t,n=e=>e,r=we,i=0,a=e.length-1){let o=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN;for(;i<a;){let s=i+a>>>1;o(n(r(e,s)),t)<0?i=s+1:a=s}return i}function Ee(e,t=0,n=e.length-1,r=(e,t)=>e){if(t<0||n>=e.length)return[null,null];let i=null,a=null;for(let o=t;o<=n;o++){let t=r(e[o],o);t!=null&&t>=t&&(i==null?i=a=t:(i>t&&(i=t),a<t&&(a=t)))}return[i,a]}function De(e,t){return Array.from({length:e},(e,n)=>t(n))}function M(e,t){let n=P;if(!n(e)||!n(t))return;let[r,i]=e,[a,o]=t;(n(a,r)&&r<a||n(r)&&!n(a))&&(t[0]=r),(n(o,i)&&i>o||n(i)&&!n(o))&&(t[1]=i)}function Oe(e){let t=[];for(let n of e)t.includes(n)||t.push(n);return t}function ke(e,t){return Math.min(Math.max(t,0),e.length-1)}function Ae(e,t){return e[t%e.length]}function je(e,t){let n=e.length;for(let r=1;r<n;++r){let n=e[r],i=r-1;for(;i>=0&&t(e[i],n);)e[i+1]=e[i],--i;e[i+1]=n}}var Me=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Ne=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Me[n[e]&63];return t};function Pe(e,t,n){if(n===void 0||+n==0)return Math[e](t);if(t=+t,n=+n,isNaN(t)||!(typeof n==`number`&&n%1==0))return NaN;let r=t.toString().split(`e`),i=Math[e](+(r[0]+`e`+(r[1]?+r[1]-n:-n))).toString().split(`e`);return+(i[0]+`e`+(i[1]?+i[1]+n:n))}var Fe=null;function Ie(){return Fe===null&&(Fe=`ontouchstart`in globalThis),Fe}function Le(e,t){return e===`Backspace`||e===`Delete`||t===8||t===46}function Re(e,t){return e===`Escape`||t===27}function ze(e,t){return e===`F2`||t===113}function Be(e,t){return e===`ArrowLeft`||t===37}function Ve(e,t){return e===`ArrowRight`||t===39}function He(e,t){return e===`z`||t===90}function Ue(e,t){return e===`r`||t===82}function We(e,t){return e===`y`||t===89}function Ge(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function Ke(e,t=100){return Je(t=>Ge(e,t),t)}function qe(e,t=100){return Ye(t=>Ge(e,t),t)}function Je(e,t){let n=null;return function(...r){let i=this;clearTimeout(n),n=setTimeout(function(){e.apply(i,r)},t)}}function Ye(e,t){let n=!1;return function(...r){if(!n){let i=this;e.apply(i,r),n=!0,setTimeout(function(){n=!1},t)}}}function N(e){return e!=null}function P(...e){return e.every(e=>e!=null)}function Xe(e,t){return Pe(`round`,e,-t)}function Ze(e){return P(e)&&Number.isFinite(e)}function Qe(e){let t=e===`both`;return[t||e===`vertical`,t||e===`horizontal`]}function $e(e,t){let n=e=>typeof e==`boolean`,r=e=>P(e)&&n(e)&&e,i=r(e),a=r(t);return i&&a?`both`:i?`vertical`:a?`horizontal`:`none`}function et(e,t,n){return t.includes(e)?e:n}function tt(e,t){return P(e)?e:t}function nt(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function rt(e,t,...n){if(!P(e))return t;let r=e;for(let e of n){if(!P(r)||!nt(r,e))return t;r=r[e]}return r}function it(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function at(e){return it(e)}function ot(e){Object.keys(e).forEach(t=>!P(e[t])&&delete e[t])}function F(e){return e==null?e:JSON.parse(JSON.stringify(e))}function st(e){return Object.assign({},e)}function ct(e,t,n=!0){let r=Object.keys(t),i=Object.keys(e),a=e=>n?i.includes(e):!0;for(let n of r)if(a(n)){let r=e[n];r===void 0||typeof r!=`object`||Array.isArray(r)?e[n]=t[n]:lt(e[n],t[n])}}function lt(e,t){ct(e,t)}function ut(e,t){let n=Object.keys(t);for(let r of n)e[r]=e[r]||t[r]}function dt(e=[]){return e.reduce((e,t)=>(e[t.name]=t.value,e),{})}function ft(e){return Object.keys(e).map(t=>({name:t,value:e[t]}))}function pt(e){return e?new Date(e):null}function mt(e){let t=``;for(let n in e){let r=`${n}=${encodeURIComponent(e[n])}`;t+=(t.length>0?`&`:``)+r}return t}function ht(e,t){ct(e,t,!1)}var gt=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,_t=[1e3,60,60,24,7,30/7,12];function vt(e){let t=gt.exec(e);if(!P(t))return null;let n=t.slice(2,9).map(e=>P(e)?parseFloat(e):0).reverse();return _t.forEach((e,t)=>{for(let r=t;r<n.length;r++)n[r]=n[r]*e}),Math.floor(pe(n))}function yt(e,t,n,r){let i=e,a=t;return i===0||a===0?(i=n,a=i/2):i>r?(a=r/i*a,i=r):i<n&&(a=n/i*a,i=n),[i,a]}function bt(){return Ne(12)}function xt(e,t,n){return Math.min(Math.max(n,e),t)}function I(e,t=`info`,...n){let r=globalThis.console;r[r[t]===void 0?`log`:t](e,...n)}function St(e){return typeof e==`number`&&!isNaN(e)}function Ct(e){return typeof e==`number`&&!isNaN(e)&&(e|0)===e}function wt(e){return typeof e==`string`}function Tt(e){return e instanceof Date}function Et(e){return e instanceof RegExp}function Dt(e){return typeof e==`function`}function Ot(e){return Array.isArray(e)}function kt(e){return typeof e==`boolean`}function At(e,t,n,r,i){n===String?wt(e)||jt(t,`string`,i):n===Number?St(e)||jt(t,`number`,i):n===Function?Dt(e)||jt(t,`function`,i):n===Boolean?kt(e)||jt(t,`boolean`,i):n===Date?Tt(e)||jt(t,`date`,i):n===RegExp?Et(e)||jt(t,`RegExp`,i):n===Array?Ot(e)||jt(t,`array`,i):e instanceof(n||Object)||jt(t,r,i)}function jt(e,t,n){let r;throw r=typeof n==`number`?`The argument [ ${e||`unspecified`} ], at index [ ${n.toString()} ] must be a [ ${t||`unknown`} ]`:`The argument [ ${e||`unspecified`} ] must be a [ ${t||`Object`} ]`,Error(r)}function Mt(e,t){throw Error(`The argument [ ${e||`unspecified`} ] failed a validation check [ ${t||`No description available`} ]`)}function Nt(e,t,n,r){At(e,t,n,r)}function Pt(e,t,n,r,i,a){e!=null&&(At(e,t,n,r),Dt(i)&&!i(e)&&Mt(t,a))}function Ft(e,t,n,r){n(e)||Mt(t,r)}var It={};It.camel={},It.camel.violations=/\b[A-Z]/g;function Lt(e,t,n){if(Nt(e,`s`,String),Nt(t,`length`,Number),Nt(n,`character`,String),n.length!==1)throw Error(`The "character" argument must be one character in length.`);return n.repeat(t-e.length)+e}var Rt=new Map,zt=class e{#e;#t;#n;constructor(t,n,r){Nt(t,`code`,String),Nt(n,`description`,String),Pt(r,`mapping`,Number),St(r)&&Ft(r,`mapping`,Ct,`must be an integer`),this.#e=t,this.#t=n,St(r)?this.#n=r:this.#n=null;let i=this.constructor;Rt.has(i)||Rt.set(i,[]),e.fromCode(i,this.#e)===null&&(this.#n===null||e.fromMapping(i,this.#n)===null)&&Rt.get(i).push(this)}get code(){return this.#e}get description(){return this.#t}get mapping(){return this.#n}equals(t){return t===this||t instanceof e&&t.constructor===this.constructor&&t.code===this.code}toJSON(){return this.code}static fromCode(t,n){return e.getItems(t).find(e=>e.code===n)||null}static fromMapping(t,n){return n===null?null:e.getItems(t).find(e=>e.mapping===n)||null}static getItems(e){return Rt.get(e)||[]}toString(){return`[Enum]`}},Bt=class e extends zt{#e;constructor(e,t,n){super(e,t),this.#e=n}get id(){return this.#e}toJSON(){return this.#e}static parse(t){return zt.fromCode(e,t)}static fromId(t){return zt.getItems(e).find(e=>e.id===t)||null}static get STOCK(){return Vt}static get STOCK_OPTION(){return Ht}static get FUTURE(){return Ut}static get FUTURE_OPTION(){return Wt}static get FOREX(){return Gt}static get CMDTY_STATS(){return Kt}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}},Vt=new Bt(`STK`,`U.S. Equity`,1),Ht=new Bt(`STKOPT`,`Equity Option`,34),Ut=new Bt(`FUT`,`Future`,2),Wt=new Bt(`FUTOPT`,`Future Option`,12),Gt=new Bt(`FOREX`,`FOREX`,10),Kt=new Bt(`CMDTY`,`cmdtyStats`,24),qt={F:`A`,G:`B`,H:`C`,J:`D`,K:`E`,M:`I`,N:`L`,Q:`O`,U:`P`,V:`R`,X:`S`,Z:`T`},Jt={A:`F`,B:`G`,C:`H`,D:`J`,E:`K`,I:`M`,L:`N`,O:`Q`,P:`U`,R:`V`,S:`X`,T:`Z`},Yt={F:1,G:2,H:3,J:4,K:5,M:6,N:7,Q:8,U:9,V:10,X:11,Z:12},Xt={bats:/^(.*)\.BZ$/i,percent:/(\.RT)$/,pit:/\(P(it)?\)/},L={bids:/^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i,c3:{alias:/^(C3:)(.*)$/i,concrete:/(\.C3)$/i},cmdty:{stats:/(\.CS)$/i,internal:/(\.CM)$/i,external:/(\.CP)$/i},crypto:/^\^([A-Z]{3})([A-Z]{3,4})$/i,equities:{options:/^([A-Z$][A-Z-]{0,}(\.[A-Z]{1})?)([0-9]?)(\.[A-Z]{2})?\|([0-9]{4})([0-9]{2})([0-9]{2})\|([0-9]+\.[0-9]+)[P|W]?(C|P)/i},forex:/^\^([A-Z]{3})([A-Z]{3})$/i,funds:{canadian:/(.*)(\.CF)$/i},futures:{alias:/^([A-Z][A-Z0-9$!.-]{0,2})(\*{1})([0-9]{1,2})$/i,concrete:/^([A-Z][A-Z0-9$!.-]{0,3})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,spread:/^_S_/i,cash:/(.*)(Y00)$/,options:{historical:/^([A-Z][A-Z0-9$!.-]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,long:/^([A-Z][A-Z0-9$!.-]{0,2})([A-Z])([0-9]{1,4})\|(-?[0-9]{1,5})(C|P)$/i,short:/^([A-Z][A-Z0-9$!.-]?)([A-Z])([0-9]{1,4})([A-Z])$/i}},indicies:{external:/^\$(.*)$/i,sector:/^-(.*)$/i},platts:{alias:/^(PLATTS:)(.*)$/i,concrete:/^(.*)(\.PT)$/i}};function Zt(){return new Date().getMonth()+1}function Qt(){return new Date().getFullYear()}function $t(e,t){let n=e.toString();return n.substring(n.length-t,n.length)}function en(e){return Jt[e]||e}function tn(e,t){let n=Qt(),r=parseInt(e);if(r===0&&t===`Y`)r=Math.floor(n/100)*100+100;else if(r<10&&e.length===1){let e=+(r<n%10);r=Math.floor(n/10)*10+r+e*10}else r<100&&(r=Math.floor(n/100)*100+r,n+25<r&&(r-=100));return r}function nn(e){return e===`call`?`C`:e===`put`?`P`:null}var rn=class e{static getIsConcrete(t){return wt(t)&&!e.getIsReference(t)}static getIsReference(e){return wt(e)&&L.futures.alias.test(e)}static getIsFuture(e){return wt(e)&&(L.futures.concrete.test(e)||L.futures.alias.test(e))}static getIsCash(t){return e.getIsFuture(t)&&L.futures.cash.test(t)}static getIsFutureSpread(e){return wt(e)&&L.futures.spread.test(e)}static getIsFutureOption(e){return wt(e)&&(L.futures.options.short.test(e)||L.futures.options.long.test(e)||L.futures.options.historical.test(e))}static getIsForex(e){return wt(e)&&L.forex.test(e)}static getIsCrypto(e){return wt(e)&&L.crypto.test(e)}static getIsIndex(e){return wt(e)&&L.indicies.external.test(e)}static getIsSector(e){return wt(e)&&L.indicies.sector.test(e)}static getIsCanadianFund(e){return wt(e)&&L.funds.canadian.test(e)}static getIsCmdty(e){return wt(e)&&(L.cmdty.stats.test(e)||L.cmdty.internal.test(e)||L.cmdty.external.test(e))}static getIsCmdtyStats(e){return wt(e)&&L.cmdty.stats.test(e)}static getIsBats(e){return wt(e)&&Xt.bats.test(e)}static getIsEquityOption(e){return wt(e)&&L.equities.options.test(e)}static getIsExpired(t){let n=e.parseInstrumentType(t);if(n!==null&&n.year&&n.month){let e=Qt();if(n.year<e)return!0;if(n.year===e&&Object.hasOwn(Yt,n.month))return Zt()>Yt[n.month]}return!1}static getIsC3(e){return wt(e)&&(L.c3.concrete.test(e)||L.c3.alias.test(e))}static getIsPlatts(e){return wt(e)&&(L.platts.concrete.test(e)||L.platts.alias.test(e))}static getIsPit(e,t){return wt(e)&&wt(t)&&Xt.pit.test(t)}static getIsGrainBid(e){return wt(e)&&L.bids.test(e)}static parseInstrumentType(e){if(!wt(e))return null;for(let t of an){let n=t(e);if(n!==null)return n}return null}static getProducerSymbol(e){if(!wt(e))return null;for(let t of on){let n=t(e);if(n!==null)return n}return null}static getFuturesOptionPipelineFormat(t){let n=e.parseInstrumentType(t);if(n.type===`future_option`){let e=nn(n.option_type);return`${n.root}${n.month}${$t(n.year,1)}|${n.strike}${e}`}return null}static getFuturesExplicitFormat(t){if(e.getIsFuture(t)&&e.getIsConcrete(t)){let n=e.parseInstrumentType(t);return`${n.root}${n.month}${Lt(Math.floor(n.year%100).toString(),2,`0`)}`}return null}static getFuturesYear(e,t){return tn(e,t)}static displayUsingPercent(e){return wt(e)&&Xt.percent.test(e)}toString(){return`[SymbolParser]`}},an=[e=>L.futures.spread.test(e)?{symbol:e,type:`future_spread`}:null,e=>{let t=e.match(L.futures.concrete);return t===null?null:{symbol:e,type:`future`,asset:Bt.FUTURE,dynamic:!1,root:t[1],month:t[2],year:tn(t[3],t[2])}},e=>{let t=e.match(L.futures.alias);return t===null?null:{symbol:e,type:`future`,asset:Bt.FUTURE,dynamic:!0,root:t[1],dynamicCode:t[3]}},e=>L.forex.test(e)?{symbol:e,type:`forex`,asset:Bt.FOREX}:null,e=>{let t=e.match(L.equities.options);if(t!==null){let n=t[4]===void 0?``:t[4];return{symbol:e,type:`equity_option`,asset:Bt.STOCK_OPTION,option_type:t[9]===`C`?`call`:`put`,strike:parseFloat(t[8]),root:`${t[1]}${n}`,month:parseInt(t[6]),day:parseInt(t[7]),year:parseInt(t[5]),adjusted:t[3]!==``}}return null},e=>L.indicies.external.test(e)?{symbol:e,type:`index`}:null,e=>L.indicies.sector.test(e)?{symbol:e,type:`sector`}:null,e=>{let t=e.match(L.futures.options.short);if(t!==null){let n=t[4].charCodeAt(0),r=n<80;return{symbol:e,type:`future_option`,asset:Bt.FUTURE_OPTION,option_type:r?`call`:`put`,strike:parseInt(t[3]),root:t[1],month:t[2],year:Qt()+n-(r?67:80)}}return null},e=>{let t=e.match(L.futures.options.long)||e.match(L.futures.options.historical);return t===null?null:{symbol:e,type:`future_option`,asset:Bt.FUTURE_OPTION,option_type:t[5]===`C`?`call`:`put`,strike:parseInt(t[4]),root:t[1],month:en(t[2]),year:tn(t[3])}},e=>L.cmdty.stats.test(e)?{symbol:e,type:`cmdtyStats`,asset:Bt.CMDTY_STATS}:null],on=[e=>{if(rn.getIsFuture(e)&&rn.getIsConcrete(e)){let t=e.match(L.futures.concrete);if(t!==null){let e=t[1],n=t[2],r=tn(t[3],n);if(r>Qt()+9){let t=qt[n];if(t)return`${e}${t}${$t(r,1)}`}}}return null},e=>rn.getIsFuture(e)&&rn.getIsConcrete(e)&&e.replace(/(.{1,4})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,`$1$2$4`)||null,e=>{if(rn.getIsFutureOption(e)){let t=rn.parseInstrumentType(e),n=nn(t.option_type);if(t.root.length<3){let e=n.charCodeAt(0);return`${t.root}${t.month}${t.strike}${String.fromCharCode(e+t.year-Qt())}`}return`${t.root}${t.month}${$t(t.year,1)}|${t.strike}${n}`}return null},e=>L.c3.alias.test(e)?e.replace(L.c3.alias,`$2.C3`):null,e=>L.platts.alias.test(e)?e.replace(L.platts.alias,`$2.PT`):null,e=>e],sn=o(((e,t)=>{t.exports=(()=>{let e={},t={};function n(n,r,i){e[n]=r,t[n]=i}return n(`F`,`January`,1),n(`G`,`February`,2),n(`H`,`March`,3),n(`J`,`April`,4),n(`K`,`May`,5),n(`M`,`June`,6),n(`N`,`July`,7),n(`Q`,`August`,8),n(`U`,`September`,9),n(`V`,`October`,10),n(`X`,`November`,11),n(`Z`,`December`,12),n(`Y`,`Cash`,0),{getCodeToNameMap:()=>Object.assign({},e),getCodeToNumberMap:()=>Object.assign({},t)}})()}));function cn(e){"@babel/helpers - typeof";return cn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},cn(e)}function ln(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function R(e,t){if(t.length<e)throw TypeError(e+` argument`+(e>1?`s`:``)+` required, but only `+t.length+` present`)}function z(e){R(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||cn(e)===`object`&&t===`[object Date]`?new Date(e.getTime()):typeof e==`number`||t===`[object Number]`?new Date(e):((typeof e==`string`||t===`[object String]`)&&typeof console<`u`&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(Error().stack)),new Date(NaN))}function un(e,t){R(2,arguments);var n=z(e),r=ln(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function dn(e,t){R(2,arguments);var n=z(e),r=ln(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var i=n.getDate(),a=new Date(n.getTime());return a.setMonth(n.getMonth()+r+1,0),i>=a.getDate()?a:(n.setFullYear(a.getFullYear(),a.getMonth(),i),n)}function fn(e,t){if(R(2,arguments),!t||cn(t)!==`object`)return new Date(NaN);var n=t.years?ln(t.years):0,r=t.months?ln(t.months):0,i=t.weeks?ln(t.weeks):0,a=t.days?ln(t.days):0,o=t.hours?ln(t.hours):0,s=t.minutes?ln(t.minutes):0,c=t.seconds?ln(t.seconds):0,l=z(e),u=r||n?dn(l,r+n*12):l,d=a||i?un(u,a+i*7):u,f=(c+(s+o*60)*60)*1e3;return new Date(d.getTime()+f)}function pn(e,t){R(2,arguments);var n=z(e).getTime(),r=ln(t);return new Date(n+r)}var mn={};function hn(){return mn}function gn(e,t){var n;R(1,arguments);var r=hn(),i=ln(t?.weekStartsOn??(t==null||(n=t.locale)==null?void 0:n.options?.weekStartsOn)??r.weekStartsOn??r.locale?.options?.weekStartsOn??0);if(!(i>=0&&i<=6))throw RangeError(`weekStartsOn must be between 0 and 6 inclusively`);var a=z(e),o=a.getDay(),s=(o<i?7:0)+o-i;return a.setDate(a.getDate()-s),a.setHours(0,0,0,0),a}function _n(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function vn(e){R(1,arguments);var t=z(e);return t.setHours(0,0,0,0),t}var yn=864e5;function bn(e,t){R(2,arguments);var n=vn(e),r=vn(t),i=n.getTime()-_n(n),a=r.getTime()-_n(r);return Math.round((i-a)/yn)}var xn=6e4;function Sn(e,t){return R(2,arguments),pn(e,ln(t)*xn)}function Cn(e,t){return R(2,arguments),dn(e,ln(t)*3)}function wn(e,t){return R(2,arguments),pn(e,ln(t)*1e3)}function Tn(e,t){return R(2,arguments),un(e,ln(t)*7)}function En(e,t){return R(2,arguments),dn(e,ln(t)*12)}function Dn(e,t){R(2,arguments);var n=z(e),r=z(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}var On=365.2425,kn=10**8*24*60*60*1e3,An=6e4,jn=36e5;-kn;var Mn=3600*24;Mn*7,Mn*On/12*3;function Nn(e,t){R(2,arguments);var n=vn(e),r=vn(t);return n.getTime()===r.getTime()}function Pn(e){return R(1,arguments),e instanceof Date||cn(e)===`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Fn(e){if(R(1,arguments),!Pn(e)&&typeof e!=`number`)return!1;var t=z(e);return!isNaN(Number(t))}function In(e,t){R(2,arguments);var n=z(e),r=z(t),i=n.getFullYear()-r.getFullYear(),a=n.getMonth()-r.getMonth();return i*12+a}function Ln(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getFullYear()-r.getFullYear()}function Rn(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function zn(e,t){R(2,arguments);var n=z(e),r=z(t),i=Rn(n,r),a=Math.abs(bn(n,r));n.setDate(n.getDate()-i*a);var o=i*(a-Number(Rn(n,r)===-i));return o===0?0:o}function Bn(e,t){return R(2,arguments),z(e).getTime()-z(t).getTime()}var Vn={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},Hn=`trunc`;function Un(e){return e?Vn[e]:Vn[Hn]}function Wn(e,t,n){R(2,arguments);var r=Bn(e,t)/jn;return Un(n?.roundingMethod)(r)}function Gn(e,t,n){R(2,arguments);var r=Bn(e,t)/An;return Un(n?.roundingMethod)(r)}function Kn(e){R(1,arguments);var t=z(e);return t.setHours(23,59,59,999),t}function qn(e){R(1,arguments);var t=z(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Jn(e){R(1,arguments);var t=z(e);return Kn(t).getTime()===qn(t).getTime()}function Yn(e,t){R(2,arguments);var n=z(e),r=z(t),i=Dn(n,r),a=Math.abs(In(n,r)),o;if(a<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*a);var s=Dn(n,r)===-i;Jn(z(e))&&a===1&&Dn(e,r)===1&&(s=!1),o=i*(a-Number(s))}return o===0?0:o}function Xn(e,t,n){R(2,arguments);var r=Bn(e,t)/1e3;return Un(n?.roundingMethod)(r)}function Zn(e,t){R(2,arguments);var n=z(e),r=z(t),i=Dn(n,r),a=Math.abs(Ln(n,r));n.setFullYear(1584),r.setFullYear(1584);var o=Dn(n,r)===-i,s=i*(a-Number(o));return s===0?0:s}function Qn(e){R(1,arguments);var t=z(e);return t.setSeconds(0,0),t}function $n(e){R(1,arguments);var t=z(e),n=t.getMonth(),r=n-n%3;return t.setMonth(r,1),t.setHours(0,0,0,0),t}function er(e){R(1,arguments);var t=z(e);return t.setDate(1),t.setHours(0,0,0,0),t}function tr(e){R(1,arguments);var t=z(e),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(23,59,59,999),t}function nr(e){R(1,arguments);var t=z(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function rr(e,t){return R(2,arguments),pn(e,-ln(t))}var ir=864e5;function ar(e){R(1,arguments);var t=z(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=n-t.getTime();return Math.floor(r/ir)+1}function or(e){R(1,arguments);var t=1,n=z(e),r=n.getUTCDay(),i=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}function sr(e){R(1,arguments);var t=z(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var i=or(r),a=new Date(0);a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0);var o=or(a);return t.getTime()>=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function cr(e){R(1,arguments);var t=sr(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),or(n)}var lr=6048e5;function ur(e){R(1,arguments);var t=z(e),n=or(t).getTime()-cr(t).getTime();return Math.round(n/lr)+1}function dr(e,t){var n;R(1,arguments);var r=hn(),i=ln(t?.weekStartsOn??(t==null||(n=t.locale)==null?void 0:n.options?.weekStartsOn)??r.weekStartsOn??r.locale?.options?.weekStartsOn??0);if(!(i>=0&&i<=6))throw RangeError(`weekStartsOn must be between 0 and 6 inclusively`);var a=z(e),o=a.getUTCDay(),s=(o<i?7:0)+o-i;return a.setUTCDate(a.getUTCDate()-s),a.setUTCHours(0,0,0,0),a}function fr(e,t){var n;R(1,arguments);var r=z(e),i=r.getUTCFullYear(),a=hn(),o=ln(t?.firstWeekContainsDate??(t==null||(n=t.locale)==null?void 0:n.options?.firstWeekContainsDate)??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1);if(!(o>=1&&o<=7))throw RangeError(`firstWeekContainsDate must be between 1 and 7 inclusively`);var s=new Date(0);s.setUTCFullYear(i+1,0,o),s.setUTCHours(0,0,0,0);var c=dr(s,t),l=new Date(0);l.setUTCFullYear(i,0,o),l.setUTCHours(0,0,0,0);var u=dr(l,t);return r.getTime()>=c.getTime()?i+1:r.getTime()>=u.getTime()?i:i-1}function pr(e,t){var n;R(1,arguments);var r=hn(),i=ln(t?.firstWeekContainsDate??(t==null||(n=t.locale)==null?void 0:n.options?.firstWeekContainsDate)??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1),a=fr(e,t),o=new Date(0);return o.setUTCFullYear(a,0,i),o.setUTCHours(0,0,0,0),dr(o,t)}var mr=6048e5;function hr(e,t){R(1,arguments);var n=z(e),r=dr(n,t).getTime()-pr(n,t).getTime();return Math.round(r/mr)+1}function gr(e,t){for(var n=e<0?`-`:``,r=Math.abs(e).toString();r.length<t;)r=`0`+r;return n+r}var _r={y:function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return gr(t===`yy`?r%100:r,t.length)},M:function(e,t){var n=e.getUTCMonth();return t===`M`?String(n+1):gr(n+1,2)},d:function(e,t){return gr(e.getUTCDate(),t.length)},a:function(e,t){var n=e.getUTCHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h:function(e,t){return gr(e.getUTCHours()%12||12,t.length)},H:function(e,t){return gr(e.getUTCHours(),t.length)},m:function(e,t){return gr(e.getUTCMinutes(),t.length)},s:function(e,t){return gr(e.getUTCSeconds(),t.length)},S:function(e,t){var n=t.length,r=e.getUTCMilliseconds();return gr(Math.floor(r*10**(n-3)),t.length)}},vr={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},yr={G:function(e,t,n){var r=+(e.getUTCFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){var r=e.getUTCFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:`year`})}return _r.y(e,t)},Y:function(e,t,n,r){var i=fr(e,r),a=i>0?i:1-i;return t===`YY`?gr(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):gr(a,t.length)},R:function(e,t){return gr(sr(e),t.length)},u:function(e,t){return gr(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return gr(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return gr(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case`M`:case`MM`:return _r.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case`L`:return String(r+1);case`LL`:return gr(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){var i=hr(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):gr(i,t.length)},I:function(e,t,n){var r=ur(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):gr(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getUTCDate(),{unit:`date`}):_r.d(e,t)},D:function(e,t,n){var r=ar(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):gr(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){var i=e.getUTCDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return gr(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){var i=e.getUTCDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return gr(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){var r=e.getUTCDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return gr(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){var r=e.getUTCHours(),i=r===12?vr.noon:r===0?vr.midnight:r/12>=1?`pm`:`am`;switch(t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){var r=e.getUTCHours(),i=r>=17?vr.evening:r>=12?vr.afternoon:r>=4?vr.morning:vr.night;switch(t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){var r=e.getUTCHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:`hour`})}return _r.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getUTCHours(),{unit:`hour`}):_r.H(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):gr(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):gr(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getUTCMinutes(),{unit:`minute`}):_r.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getUTCSeconds(),{unit:`second`}):_r.s(e,t)},S:function(e,t){return _r.S(e,t)},X:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();if(i===0)return`Z`;switch(t){case`X`:return xr(i);case`XXXX`:case`XX`:return Sr(i);default:return Sr(i,`:`)}},x:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();switch(t){case`x`:return xr(i);case`xxxx`:case`xx`:return Sr(i);default:return Sr(i,`:`)}},O:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+br(i,`:`);default:return`GMT`+Sr(i,`:`)}},z:function(e,t,n,r){var i=(r._originalDate||e).getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+br(i,`:`);default:return`GMT`+Sr(i,`:`)}},t:function(e,t,n,r){var i=r._originalDate||e;return gr(Math.floor(i.getTime()/1e3),t.length)},T:function(e,t,n,r){return gr((r._originalDate||e).getTime(),t.length)}};function br(e,t){var n=e>0?`-`:`+`,r=Math.abs(e),i=Math.floor(r/60),a=r%60;if(a===0)return n+String(i);var o=t||``;return n+String(i)+o+gr(a,2)}function xr(e,t){return e%60==0?(e>0?`-`:`+`)+gr(Math.abs(e)/60,2):Sr(e,t)}function Sr(e,t){var n=t||``,r=e>0?`-`:`+`,i=Math.abs(e),a=gr(Math.floor(i/60),2),o=gr(i%60,2);return r+a+n+o}var Cr=function(e,t){switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},wr=function(e,t){switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},Tr={p:wr,P:function(e,t){var n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Cr(e,t);var a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Cr(r,t)).replace(`{{time}}`,wr(i,t))}},Er=[`D`,`DD`],Dr=[`YY`,`YYYY`];function Or(e){return Er.indexOf(e)!==-1}function kr(e){return Dr.indexOf(e)!==-1}function Ar(e,t,n){if(e===`YYYY`)throw RangeError(`Use \`yyyy\` instead of \`YYYY\` (in \`${t}\`) for formatting years to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(e===`YY`)throw RangeError(`Use \`yy\` instead of \`YY\` (in \`${t}\`) for formatting years to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(e===`D`)throw RangeError(`Use \`d\` instead of \`D\` (in \`${t}\`) for formatting days of the month to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(e===`DD`)throw RangeError(`Use \`dd\` instead of \`DD\` (in \`${t}\`) for formatting days of the month to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`)}var jr={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Mr=function(e,t,n){var r,i=jr[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Nr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Pr={date:Nr({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Nr({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Nr({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Fr={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Ir=function(e,t,n,r){return Fr[e]};function Lr(e){return function(t,n){var r=n!=null&&n.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):a;i=e.formattingValues[o]||e.formattingValues[a]}else{var s=e.defaultWidth,c=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[c]||e.values[s]}var l=e.argumentCallback?e.argumentCallback(t):t;return i[l]}}var Rr={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Lr({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Lr({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:function(e){return e-1}}),month:Lr({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Lr({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Lr({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function zr(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;var o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Vr(s,function(e){return e.test(o)}):Br(s,function(e){return e.test(o)}),l=e.valueCallback?e.valueCallback(c):c;l=n.valueCallback?n.valueCallback(l):l;var u=t.slice(o.length);return{value:l,rest:u}}}function Br(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function Vr(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function Hr(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var i=r[0],a=t.match(e.parsePattern);if(!a)return null;var o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;var s=t.slice(i.length);return{value:o,rest:s}}}var Ur={code:`en-US`,formatDistance:Mr,formatLong:Pr,formatRelative:Ir,localize:Rr,match:{ordinalNumber:Hr({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:zr({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:zr({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:function(e){return e+1}}),month:zr({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:zr({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:zr({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Wr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Gr=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Kr=/^'([^]*?)'?$/,qr=/''/g,Jr=/[a-zA-Z]/;function Yr(e,t,n){var r,i;R(2,arguments);var a=String(t),o=hn(),s=n?.locale??o.locale??Ur,c=ln(n?.firstWeekContainsDate??(n==null||(r=n.locale)==null?void 0:r.options?.firstWeekContainsDate)??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1);if(!(c>=1&&c<=7))throw RangeError(`firstWeekContainsDate must be between 1 and 7 inclusively`);var l=ln(n?.weekStartsOn??(n==null||(i=n.locale)==null?void 0:i.options?.weekStartsOn)??o.weekStartsOn??o.locale?.options?.weekStartsOn??0);if(!(l>=0&&l<=6))throw RangeError(`weekStartsOn must be between 0 and 6 inclusively`);if(!s.localize)throw RangeError(`locale must contain localize property`);if(!s.formatLong)throw RangeError(`locale must contain formatLong property`);var u=z(e);if(!Fn(u))throw RangeError(`Invalid time value`);var d=rr(u,_n(u)),f={firstWeekContainsDate:c,weekStartsOn:l,locale:s,_originalDate:u};return a.match(Gr).map(function(e){var t=e[0];if(t===`p`||t===`P`){var n=Tr[t];return n(e,s.formatLong)}return e}).join(``).match(Wr).map(function(r){if(r===`''`)return`'`;var i=r[0];if(i===`'`)return Xr(r);var a=yr[i];if(a)return!(n!=null&&n.useAdditionalWeekYearTokens)&&kr(r)&&Ar(r,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&Or(r)&&Ar(r,t,String(e)),a(d,r,s.localize,f);if(i.match(Jr))throw RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");return r}).join(``)}function Xr(e){var t=e.match(Kr);return t?t[1].replace(qr,`'`):e}var Zr=[`years`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`];function Qr(e,t){if(arguments.length<1)throw TypeError(`1 argument required, but only ${arguments.length} present`);var n=hn(),r=t?.locale??n.locale??Ur,i=t?.format??Zr,a=t?.zero??!1,o=t?.delimiter??` `;return r.formatDistance?i.reduce(function(t,n){var i=`x${n.replace(/(^.)/,function(e){return e.toUpperCase()})}`,o=e[n];return typeof o==`number`&&(a||e[n])?t.concat(r.formatDistance(i,o)):t},[]).join(o):``}function $r(e){return R(1,arguments),z(e).getDay()}function ei(e){R(1,arguments);var t=z(e);return bn(t,nr(t))+1}function ti(e){return R(1,arguments),z(e).getMinutes()}function ni(e){return R(1,arguments),z(e).getFullYear()}function ri(e){R(1,arguments);var t=z(e.start),n=z(e.end);if(isNaN(t.getTime()))throw RangeError(`Start Date is invalid`);if(isNaN(n.getTime()))throw RangeError(`End Date is invalid`);var r={};r.years=Math.abs(Zn(n,t));var i=Dn(n,t),a=fn(t,{years:i*r.years});r.months=Math.abs(Yn(n,a));var o=fn(a,{months:i*r.months});r.days=Math.abs(zn(n,o));var s=fn(o,{days:i*r.days});r.hours=Math.abs(Wn(n,s));var c=fn(s,{hours:i*r.hours});r.minutes=Math.abs(Gn(n,c));var l=fn(c,{minutes:i*r.minutes});return r.seconds=Math.abs(Xn(n,l)),r}function ii(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getTime()>r.getTime()}function ai(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getTime()<r.getTime()}function oi(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getTime()===r.getTime()}function si(e){R(1,arguments);var t=z(e);return t.setMinutes(0,0,0),t}function ci(e,t){R(2,arguments);var n=si(e),r=si(t);return n.getTime()===r.getTime()}function li(e,t,n){R(2,arguments);var r=gn(e,n),i=gn(t,n);return r.getTime()===i.getTime()}function ui(e,t){R(2,arguments);var n=Qn(e),r=Qn(t);return n.getTime()===r.getTime()}function di(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function fi(e,t){R(2,arguments);var n=$n(e),r=$n(t);return n.getTime()===r.getTime()}function pi(e,t){R(2,arguments);var n=z(e),r=z(t);return n.getFullYear()===r.getFullYear()}function mi(e,t){return R(2,arguments),un(e,-ln(t))}function hi(e,t){return R(2,arguments),dn(e,-ln(t))}function gi(e,t){return R(2,arguments),wn(e,-ln(t))}function _i(e,t){return R(2,arguments),En(e,-ln(t))}var vi=c(sn(),1);function yi(e){return rn.parseInstrumentType(e)}async function bi(e){let t=await Wi(e);if(!Array.isArray(t))throw Error(`Invalid server response`);let n=t.find(e=>e.isNearest)?.name||``;return{symbols:t.map(e=>e.name),nearest:n}}var xi=()=>ei(Date.now());function Si(e){let t=fe((t,n)=>e(t));return e=>t(e,xi())}var Ci=Si(bi);async function wi(e){if(!Vi(e))return e;let{root:t,dynamic:n,dynamicCode:r}=yi(e);if(!P(t,n,r))return null;let{symbols:i,nearest:a}=await Ci(t),o=parseInt(r);if(o===0)return a;let s=o-1;return s<i.length?i[s]:null}function Ti(e){return rn.getIsFutureOption(e)}function Ei(e){return rn.getIsFuture(e)}var Di=/^_S_SP_([^_]+)_([^_]+)$/;function Oi(e){let t=e.match(Di);return!t||t.length!==3?!1:Ei(t[1])&&Ei(t[2])}var ki=/^([A-Z]{2}(?:B|P)(?:F|G|H|J|K|M|N|Q|U|V|X|Z))(1[4-9]|[2-9][0-9])([A-Z0-9-]+\.CM)$/;function Ai(e){return ki.test(e)}function ji(e){return rn.getIsEquityOption(e)}function Mi(e){return Ei(e)?`${Gi(e)}Y00`:null}function Ni(e){return Ei(e)?yi(e).month===`Y`:!1}function Pi(e){return String(e%100).padStart(2,`0`)}function Fi(e,t,n,r=!1){return`${e}${t}${r?n:Pi(n)}`}async function Ii(e,t,n){let r=await Ci(e),i=r?.symbols??[];if(i.length===0||!r?.nearest||i.includes(n))return[n,!1];for(let e of i)if(yi(e).month===t)return[e,!0];return[r.nearest,!0]}async function Li(e){let t=await sF(`extras`,`/json/options/?root=${encodeURIComponent(e)}`);try{let n=JSON.parse(t);return Object.values(n?.[e]??{})}catch(t){return I(`Failed to parse futures options response`,`warn`,{root:e,error:t}),[]}}var Ri=Si(Li);async function zi(e){let t=yi(e),n=await Ri(t.root);if(n.length===0||n.some(t=>e in(t.strikes??{})))return[e,!1];let r=n.find(e=>e.month===t.month)??n[0],i=Object.entries(r.strikes??{}),a=t.option_type===`call`?`C`:`P`,o=i.find(([,e])=>e.type===a&&e.strike===t.strike)?.[0]??i.find(([,e])=>e.type===a)?.[0]??i[0]?.[0];return o?[o,o!==e]:[e,!1]}function Bi(e,t=!1){if(!Ei(e))return e;let n=yi(e);return Fi(n.root,n.month,n.year,t)}function Vi(e){let t=yi(e);return P(t)&&t.dynamic===!0}function Hi(e){let t=Ei(e)||Ti(e),n=e.substring(0,2)===`_S_`;return(t||ji(e))&&!n}function Ui(e){return Ei(e)?`America/Chicago`:`America/New_York`}async function Wi(e){let t=await sF(`futures`,`?root=${e}`),n;try{n=JSON.parse(t)}catch(t){return I(`Failed to parse futures contracts response`,`warn`,{root:e,error:t}),[]}return n[e]?n[e].contracts.filter(e=>e.month!==`Y`).sort((e,t)=>e.expires-t.expires).map(t=>({month:t.month,year:t.year,expires:new Date(t.expires),isNearest:t.isnearest,name:`${e}${t.month}${t.year%100}`})):[]}function Gi(e){return Ei(e)?yi(e).root:null}function Ki(e){if(!Ei(e))return null;let t=yi(e),n=vi.default.getCodeToNumberMap()[t.month];return er(new Date(t.year,n-1))}function qi(e,t){let n=yi(e),r=(n.year+t)%100;return`${n.root}${n.month}${Pi(r)}`}function Ji(e,t){let n=ki.exec(e),r=Number.parseInt(n[2]),i=r+(r>79?1900:2e3),a=ni(En(new Date(i,0,1),t));return`${n[1]}${Pi(a)}${n[3]}`}function Yi(e,t){let n=e.match(Di);return`_S_SP_${qi(n[1],t)}_${qi(n[2],t)}`}function Xi(e,t){let n=Ei(e),r=Ai(e),i=Oi(e);return n?qi(e,t):r?Ji(e,t):i?Yi(e,t):null}async function Zi(e){let t=e=>[e,!1,!1],n=Ei(e),r=Ti(e),i=Ai(e),a=Ni(e);if(!n&&!r&&!i||a)return t(e);if(n){let{root:t,month:n}=yi(e);if(Vi(e)){let t=await wi(e);return[t??e,!0,t!==e]}let[r,i]=await Ii(t,n,e);return[r,!0,i]}if(r){let[t,n]=await zi(e);return[t,!1,n]}if(i){let n=ki.exec(e);return t(`${n[1]}${Pi(ni(new Date))}${n[3]}`)}return t(e)}function Qi(e,t){if(!Ei(e))return e;let n=yi(e);return t.find(e=>yi(e).root===n.root)||e}function $i(e){let t=e.getRootNode();return t===document?document.body:t}function ea(e,t=document){let n=na(e,t);return P(n)?n.innerHTML:null}function ta(e){e.remove()}function na(e,t=document){return ca(e,t)[0]}function ra(e,t){for(let n in t)e.style[n]=t[n]}function ia(e,t){for(let n in t)e.setAttribute(n,t[n])}function aa(e,t,n){let r=na(`#${e}`,t);if(P(r))return r;let i=sa(t,n);return i.id=e,i}function oa(e,t){typeof t==`string`?e.className=t:Array.isArray(t)?e.className=t.join(` `):typeof t==`object`&&(e.className=``,Object.keys(t).forEach(n=>{t[n]&&e.classList.add(n)}))}function sa(e,t){return e.appendChild(document.createElement(t))}function ca(e,t=document){return t.querySelectorAll(e)}function la(e,t){e&&(e.innerHTML=t)}function ua(e){return new Promise(t=>{let n=()=>{!e||e.naturalWidth===void 0||e.naturalWidth===0||!e.complete?setTimeout(n,150):t()};n()})}async function da(e,t=`asyncReadyWork`){P(this[t])||(this[t]={});let n=this[t];return P(n.result)?Promise.resolve(n.result):(P(n.promise)||(n.promise=e.call(this),n.promise.then(e=>{n.result=e})),n.promise)}function fa(e=`asyncReadyWork`){P(this[e])&&delete this[e]}var pa=class{_whenCompleted;_resolve=null;_reject=null;_completed=!1;constructor(){this._whenCompleted=new Promise((e,t)=>{this._resolve=e,this._reject=t})}onResolve=e=>{this._completed=!0,this._resolve?.(e)};onError=e=>{this._completed=!0,this._reject?.(e)};get completed(){return this._completed}get whenCompleted(){return this._whenCompleted}get resolve(){return this.onResolve}get reject(){return this.onError}},ma=globalThis.devicePixelRatio||1,ha=(e,t=20)=>(Ie()?t:e)*ma,B={YTD_PERIOD:`YTD`,EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:ha(5),PLOT_HIT_TEST_TOLERANCE:ha(7),CONTINUOUS_LINE_HIT_TEST_RADIUS:4,PLOT_HOVER_DIM_ALPHA:.2,HALF_ANN_POINT_DIMENSION:Ie()?10:6,OUT_OF_SCREEN:8192,DEFAULT_SYMBOL_WIDTH_HEIGHT:32,PANE_SPLITTER_PERCENT_HEIGHT:.75,BASIS_MAIN:`$main`,INPUT_PERIOD:`Period`,INPUT_PERIOD1:`Period1`,INPUT_PERIOD2:`Period2`,INPUT_PERIOD3:`Period3`,INPUT_SYMBOL:`Symbol`,INPUT_SMOOTHING:`Smoothing`,INPUT_SOURCE:`Source`,INPUT_WIDTH:`Width`,EMPTY_ARRAY:[],CHART_DEFINITION:`chart.def.json`,CHART_SCHEMA:`chart.schema.json`,STUDIES_SCHEMA:`studies.schema.json`,STUDIES_LIST:`studies.lst.json`,FIELDS_SCHEMA:`fields.schema.json`,FIELDS_LIST:`fields.lst.json`,ACCESSOR_SCHEMA:`accessor.schema.json`,EVENTS:[`dividends`,`earnings`,`splits`,`custom`],EVENT_PROPERTIES:[`show`,`color`,`title`],PLACEHOLDER_SYMBOL_NAME:`PLACEHOLDER`,REALTIME_INITIAL_QUOTE:`REFRESH_QUOTE`,REALTIME_TRADE:`TRADE`,REALTIME_VOLUME:`VOLUME`,TOOLTIP_X_OFFSET:15,TOOLTIP_Y_OFFSET:30,TOOLTIP_TOGGLE_SIDE_ANIM_MS:300,TOOLTIP_TOGGLE_DISTANCE_TOLERANCE:10,TOOLTIP_STUDY_VALUES_PER_ROW:3,CARDS_X_OFFSET:5,CARDS_Y_OFFSET:5,PANE_CAP_MAX_PADDING_PERCENT:.15,PANE_CAP_MIN_PADDING_PERCENT:.075,PANE_TINY_PADDING_PIXELS:5,STANDARD_VISIBLE_BARS:130,ACTION_GET:`Get`,ACTION_DELETE:`Delete`,ACTION_TEMPLATE:`Template`,ACTION_AGGREGATION:`Aggregation`,ACTION_PLOT:`Plot`,MINIMUM_BAR_WIDTH:.02,MINIMUM_WIDE_BAR_WIDTH:.15,MAXIMUM_BAR_WIDTH:180,MINIMUM_BARS_VISIBLE:5,MIN_POSITION_PRICE_PRECISION:2,COLOR_TRANSPARENT:`rgba(0, 0, 0, 0)`,AT_LINE:`line`,AT_LINE_2:`line2`,AT_LINE_3:`line3`,AT_FILL:`fill`,AT_FILL2:`fill2`,AT_FILL3:`fill3`,AT_FILL4:`fill4`,AT_FILL5:`fill5`,AT_FILL6:`fill6`,AT_FILL7:`fill7`,AT_FILL_TEXT:`fillText`,AT_SINGLE_STYLE:`singleStyle`,AT_SHOW_BACKGROUND:`showBackground`,AT_BACKGROUND_OPACITY:`backgroundOpacity`,AT_COMPACT:`compact`,AT_SHOWN:`shown`,AT_VALUE:`value`,AT_ACCOUNT_SIZE:`accountSize`,AT_RISK:`risk`,AT_REWARD:`reward`,AT_RATIO:`ratio`,AT_KIND:`kind`,AT_ARROW:`arrow`,AT_VERTEX:`vertex`,AT_VERTEX_START:`start`,AT_VERTEX_END:`end`,AT_VERTEX_BOTH:`both`,AT_VERTEX_NONE:`none`,AT_TEXT_ITEM:`textItem`,AT_RISK_IS_PERCENT:`riskIsPercent`,AT_SHOW_PRICES:`showPrices`,AT_USE_52WEEK_PRICES:`use52WeekPrices`,AT_SHOW_LEVELS:`showLevels`,AT_LEVELS_KIND:`levelsKind`,AT_LEVELS_VALUES:`Values`,AT_LEVELS_PERCENTS:`Percents`,AT_LABELS:`labels`,AT_LABELS_LEFT:`Left`,AT_LABELS_CENTER:`Center`,AT_LABELS_RIGHT:`Right`,AT_SHOW_BARCOUNT:`showBarCount`,AT_EXTEND_PT_1:`extendPoint1`,AT_EXTEND_PT_2:`extendPoint2`,AT_EXTEND_LEFT:`extendLeft`,AT_EXTEND_RIGHT:`extendRight`,AT_TEXT_LINES:`textLines`,AT_SHOW_TIMESTAMPS:`showTimestamps`,AT_SHOW_TRENDLINE:`showTrendline`,AT_SHOW_PERCENTDIFF:`showPercentDiff`,AT_FACTORS:`factors`,AT_FACTOR_ITEM:`factorItem`,AT_MARKER:`marker`,AT_DRAW_LINES:`drawLines`,AT_DRAW_BORDER:`drawBorder`,AT_ALLOW_PRICES_CHANGE_UI:`allowPricesChangeUI`,AT_PRICES_ON_SCALE:`pricesOnScale`,AT_PRICE_LEVELS:`priceLevels`,AT_TIME_LEVELS:`timeLevels`,AT_SHOW_LABELS:`showLabels`,AT_SHOW_LEFT_LABELS:`showLeftLabels`,AT_SHOW_RIGHT_LABELS:`showRightLabels`,AT_SHOW_TOP_LABELS:`showTopLabels`,AT_SHOW_BOTTOM_LABELS:`showBottomLabels`,AT_SHOW_ANGLES:`showAngles`,AT_REVERSE:`reverse`,AT_LEVELS:`levels`,AT_FANS:`fans`,AT_ARCS:`arcs`,AT_SHOW_RANGES_RATIO:`showRangesRatio`,AT_PRICE_BAR_RATIO:`priceBarRatio`,AT_ANGLES:`angles`,AT_NUM_CONTRACTS:`numContracts`,AT_POSITION:`position`,AT_POSITION_SHORT:`Short`,AT_POSITION_LONG:`Long`,AT_PROFIT_LOSS:`profitLoss`,AT_LEVELS_RESPECT_LOG_SCALE:`levelsRespectLogScale`,ANN_ACTION_ID:`Annotation`,ANN_DUPLICATE_OFFSET:20,DEFAULT_ADORN_OFFSET:{x:-5,y:-10},LAYOUT_THROTTLE_DELAY:100,MINIMUM_PANE_HEIGHT:10,DEBUG_TIME_FORMAT:`yyyy-LL-dd HH:mm:ss.SSS`,DEBUG_SYMBOL:`NOTASYMBOL`,DEBUG_CHART_ID:`root`,COLOR_DEFAULT_OHLC:`#808080`,COLOR_DEFAULT_VARY:[`#d33e32`,`#19ab52`],COLOR_DEFAULT_AREA:`#2d76b3`,TOOLTIP_STD:`standard`,TOOLTIP_CARDS:`cards`,TOOLTIP_BUBBLE:`bubble`,TOOLTIP_EXTERNAL:`external`,NS_SVG:`http://www.w3.org/2000/svg`,NS_XLINK:`http://www.w3.org/1999/xlink`,NULL_OBJECT:{magic:8247764655136229},CROSSHAIR_ID:`crosshair_elem_id`,ZOOM_X_AXIS_PERCENT:.02,DEFAULT_MAX_RECORDS:640,SEASONAL_FUTURES_FETCH_YEARS:5,TICK_CUSTOM_AGG_MULTIPLIER:25,SNAP_PROXIMITY_PIXELS:18,LONG_PRESS_TIMEOUT_MILLIS:750,LONG_PRESS_DELAY_MILLIS:750,MINIMUM_THROTTLE:25,BACKGROUND_TAB_THROTTLE:2e3,INTERNAL_GC_MILLIS:300*1e3,US_TRADING_DAYS_PER_YEAR:251,INLINE_DATA_ELEMENT_ID:`barchart-www-inline-data`,META_DATA_GET_TIMETOUT:3e3,FMT_US_DATE_ONLY:`LL/dd/yyyy`,FMT_ISO_DATE_ONLY:`yyyy-LL-dd`,FMT_HIST_FEED_PARAM_DATE_ONLY:`yyyyLLdd`,FMT_HIST_FEED_PARAM_DATE_TIME:`yyyyLLddHHmmss`,FMT_HIST_FEED_INTRADAY:`yyyy-LL-dd HH:mm`,FMT_HIST_FEED_TICK:`yyyy-LL-dd HH:mm:ss.SSS`,FMT_EXPORT_ALL_BUT_MILLIS:`yyyy-LL-dd HH:mm:ss`,LINE_HEIGHT_MULTIPLIER:1.2,SVG_ICONS_DOM_NODE:`bchart-svg-icons-placeholder`,DEFAULT_BAR_WIDTH:10,DEFAULT_BAR_SPACING:5,LINE_DASH_PROP_NAME:`lineDash`,MARKER_ARROW_ANGLE:45,MARKER_ARROW_LENGTH:20,TIMELINE_PROLOG_PADDING_BARS:5e3,TIMELINE_EPILOG_PADDING_BARS:1e3,NO_DATA_TEXT:`No data to display`,DEFAULT_PRICE_AXIS_WIDTH:70,SPECIAL_BUILDER_REQUIRED:[h.Renko,h.LineBreak,h.Kagi,h.PointAndFigure],INTRA_THRESHOLD:vt(`P30D`),ONE_DAY_MILLIS:vt(`P1D`),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:vt(`P50Y`),BC_EVENT_LOGGED_IN:`login success`,BC_EVENT_DISCONNECTED:`disconnect`,BC_EVENT_FEED_PAUSED:`feed paused`,BC_EVENT_FEED_RESUMED:`feed resumed`,BC_EVENT_DISCONNECTING:`disconnecting`,HEADER_SIZE_PLACEHOLDER_ID:`header_size_helper_placeholder`,CURVE_STYLE_DOTS_RADIUS:2,DEFAULT_ACCESSOR_SUBACTION:`Update`,MIN_EVENT_RADIUS:8,AUTO_COLORS:`#5b9bd5.#8abc21.#c93030.#2f7ed8.#42ccdc.#bf95df.#d946a8.#e5daa3.#4682e8.#aaa9c1.#f08080.#f66b00.#d875be.#e84b46.#3fbc6f.#daa520.#9370db.#d2691e.#48d1cc.#cd5c5c.#6495ed.#da70d6.#ff8c00.#66cdaa.#ba55d3.#bc8f8f.#5f9ea0.#e9967a.#8fbc8f.#dc143c.#7eb3d4.#a8d46f.#e06c75.#61afef.#80d4e0.#d4a5e8.#ea6bb8.#f0d89e.#70a4f4.#c4b5d8.#f5a3a3.#ffa347.#e8a3d1.#f57c7c.#6bd49a.#e8c547.#b08fd6.#e89a6f.#7dd9d4.#d98989.#8db3f0.#e8a3e8.#ffb366.#8de0c2.#d68fd9.#d4afa4.#7dbfc7.#f0b399.#a8d4a8.#e86b7a`.split(`.`),PHP_TO_UNICODE_TS_35_MAP:{a:`EEE`,A:`EEEE`,d:`dd`,e:`d`,w:`c`,b:`MMM`,B:`MMMM`,m:`MM`,y:`yy`,Y:`yyyy`,H:`HH`,k:`H`,I:`hh`,l:`h`,M:`mm`,p:`aaa`,P:`aaaaa`,S:`ss`,L:`SSS`},AUTOFIT_PERIOD:`P50Y`,BARCHART_HIST_SRV_TICKS_PAGE_NAME:`queryticks.ashx`,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:`queryminutes.ashx`,BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:`querynearbyminutes.ashx`,BARCHART_HIST_SRV_EOD_PAGE_NAME:`queryeod.ashx`,DOUBLE_CLICK_DURATION_MILLIS:500,TOOLTIP_STD_LEGACY_CLASS:`highcharts-tooltip`,TOOLTIP_STD_CLASS:`bcharts-tooltip`,TOOLTIP_BUBBLE_CLASS:`bcharts-bubble`,TOOLTIP_BUBBLE_OFFSET:.2,EVENTS_BUILT_IN:[`dividends`,`earnings`,`splits`,`custom`],NOT_APPLICABLE:`N/A`,BARCHART_INTERNAL_FEED_DATA_ENDPOINT:`https://barchart.websol.barchart.com`,DEFAULT_RENKO_INPUTS:[{name:`Method`,value:`ATR`},{name:`Period`,integer:!0,value:14},{name:`Source`,value:`Close`},{name:`BrickSize`,value:10}],DEFAULT_LINEBREAK_INPUTS:[{name:`LineCount`,integer:!0,value:3}],DEFAULT_BASELINE_INPUTS:[{name:`BaseLevel`,value:50}],RENKO_MAX_BARS:35e3,RENKO_KAGI_NAMES:{ATR:`ATR`,TRD:`Traditional`,CLS:`Close`,HL:`High/Low`,PCT:`Percentage`},DEFAULT_KAGI_INPUTS:[{name:`BoxSizeMethod`,value:`ATR`},{name:`Period`,integer:!0,value:14},{name:`ReversalAmount`,value:30}],DEFAULT_PNF_INPUTS:[{name:`Source`,value:`Close`},{name:`BoxSizeMethod`,value:`ATR`},{name:`Period`,integer:!0,value:14},{name:`BoxSize`,value:20},{name:`ReversalAmount`,integer:!0,value:3},{name:`OneStepBack`,value:`No`}],START_OF_LAST_CENTURY:new Date(1900,0,1),NEXT_CENTURY:new Date(2100,0,1),FAKE_CUSTOM_EVENT:`___FCE___`,FETCH_TICK_CHUNK_RETRY_COUNT:6,MINIMUM_ZOOM_DIMENSION:50,SERVER_COMPUTED_STUDY_BAR_MULTIPLIER:8,BARKIND_O:0,BARKIND_X:1,BARKIND_OX:2,BARKIND_XO:3,OPTIONS_DATA_BASE:1622844e6,OPTIONS_DATA_INCREMENT:864e4,ZERO_DATE:new Date(0),OFFSCREEN_OFFSET:{x:-1,y:-1},DEFAULT_DETACHED_SCALE_MARGINS:{top:.05,bottom:.01},VOLUME_DETACHED_SCALE_MARGINS:{top:.8,bottom:.001},MARKER_SIZE:3,MAX_INTRADAY_BARS:1e5,FAKE_SYMBOL_PREFIX:`CUSTOM-FABRICATED-SYMBOL-PREFIX`,CLIENT_SIDE_SEASONAL_AVERAGE_DISTRIBUTED_STUDIES:new Set([`MA`,`MAEXP`,`MASMO`,`MATRI`,`MAWEI`,`HMA`,`DEMA`,`TEMA`,`OSCI`,`WGALPH`,`BWIDTH`,`ADJATR`,`ROC`,`TRIX`,`DPO`,`MSD`,`PCTCHG`,`HV`,`PERF`,`MOVLR`])},ga=o(((e,t)=>{t.exports={number(e){return typeof e==`number`&&!isNaN(e)},nan(e){return typeof e==`number`&&isNaN(e)},integer(e){return typeof e==`number`&&!isNaN(e)&&(e|0)===e},large(e){return typeof e==`number`&&!isNaN(e)&&isFinite(e)&&Math.floor(e)===e},positive(e){return this.number(e)&&e>0},negative(e){return this.number(e)&&e<0},iterable(e){return!this.null(e)&&!this.undefined(e)&&this.fn(e[Symbol.iterator])},string(e){return typeof e==`string`},date(e){return e instanceof Date},fn(e){return typeof e==`function`},array(e){return Array.isArray(e)},boolean(e){return typeof e==`boolean`},object(e){return typeof e==`object`&&!!e},null(e){return e===null},undefined(e){return e===void 0},zeroLengthString(e){return this.string(e)&&e.length===0},extension(e,t){return this.fn(e)&&this.fn(t)&&t.prototype instanceof e}}})),_a=o(((e,t)=>{var n=ga();t.exports=(()=>{function e(e,t,r,i){if(!n.number(e))return``;(!n.string(r)||r.length>1)&&(r=``);let a=e<0&&i===!0;a&&(e=0-e);let o=e.toFixed(t);if(r&&(e<-999||e>999)){let n=o.length,i=e<0,s=t===0,c=0,l=[];for(let e=n-1;!(e<0);e--){c===3&&!(i&&e===0)&&(l.unshift(r),c=0);let t=o.charAt(e);l.unshift(t),s?c+=1:t===`.`&&(s=!0)}a&&(l.unshift(`(`),l.push(`)`)),o=l.join(``)}else a&&(o=`(`+o+`)`);return o}return e})()})),va=o(((e,t)=>{var n=ga();t.exports=(()=>{function e(e,t){let n=Math.floor(e);return n===0&&t===``?``:n}function t(e){return e-Math.floor(e)}function r(e,t){return[`000`,Math.floor(e)].join(``).substr(-1*t)}function i(i,a,o,s,c){if(!n.number(i)||!n.number(a)||!n.number(o))return``;(!n.string(s)||s.length>1)&&(s=`.`);let l=Math.abs(i),u=e(l,s),d=t(l)*a,f=r(Math.floor(parseFloat(d.toFixed(1))),o),p,m;return i<0?(c=n.boolean(c)&&c,c?(p=`(`,m=`)`):(p=`-`,m=``)):(p=``,m=``),[p,u,s,f,m].join(``)}return i})()})),ya=o(((e,t)=>{var n=ga();t.exports=(()=>{function e(e,r,i,a,o){i===String?n.string(e)||t(r,`string`,o):i===Number?n.number(e)||t(r,`number`,o):i===Function?n.fn(e)||t(r,`function`,o):i===Boolean?n.boolean(e)||t(r,`boolean`,o):i===Date?n.date(e)||t(r,`date`,o):i===Array?n.array(e)||t(r,`array`,o):e instanceof(i||Object)||t(r,a,o)}function t(e,t,n){let r;throw r=typeof n==`number`?`The argument [ ${e||`unspecified`} ], at index [ ${n.toString()} ] must be a [ ${t||`unknown`} ]`:`The argument [ ${e||`unspecified`} ] must be a [ ${t||`Object`} ]`,Error(r)}function r(e,t){throw Error(`The argument [ ${e||`unspecified`} ] failed a validation check [ ${t||`No description available`} ]`)}return{argumentIsRequired(t,n,r,i){e(t,n,r,i)},argumentIsOptional(t,i,a,o,s,c){t!=null&&(e(t,i,a,o),n.fn(s)&&!s(t)&&r(i,c))},argumentIsArray(t,n,r,i){if(this.argumentIsRequired(t,n,Array),r){let a;a=typeof r==`function`&&r!==Function?(e,t)=>r.prototype!==void 0&&e instanceof r||r(e,`${n}[${t}]`):(t,a)=>e(t,n,r,i,a),t.forEach((e,t)=>{a(e,t)})}},argumentIsValid(e,t,n,i){n(e)||r(t,i)},areEqual(e,t,n,r){if(e!==t)throw Error(`The objects must be equal [${n||e.toString()}] and [${r||t.toString()}]`)},areNotEqual(e,t,n,r){if(e===t)throw Error(`The objects cannot be equal [${n||e.toString()}] and [${r||t.toString()}]`)}}})()})),ba=o(((e,t)=>{var n=ya(),r=ga();t.exports=(()=>{let e=new Map;class t{constructor(i,a,o){n.argumentIsRequired(i,`code`,String),n.argumentIsRequired(a,`description`,String),n.argumentIsOptional(o,`mapping`,Number),r.number(o)&&n.argumentIsValid(o,`mapping`,r.integer,`must be an integer`),this._code=i,this._description=a,r.number(o)?this._mapping=o:this._mapping=null;let s=this.constructor;e.has(s)||e.set(s,[]),t.fromCode(s,this._code)===null&&(this._mapping===null||t.fromMapping(s,this._mapping)===null)&&e.get(s).push(this)}get code(){return this._code}get description(){return this._description}get mapping(){return this._mapping}equals(e){return e===this||e instanceof t&&e.constructor===this.constructor&&e.code===this.code}toJSON(){return this.code}static fromCode(e,n){return t.getItems(e).find(e=>e.code===n)||null}static fromMapping(e,n){return n===null?null:t.getItems(e).find(e=>e.mapping===n)||null}static getItems(t){return e.get(t)||[]}toString(){return`[Enum]`}}return t})()})),xa=o(((e,t)=>{(function(e){var n,r=20,i=1,a=1e6,o=1e6,s=-7,c=21,l=!1,u=`[big.js] `,d=u+`Invalid `,f=d+`decimal places`,p=d+`rounding mode`,m=u+`Division by zero`,h={},g=void 0,_=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function v(){function e(t){var n=this;if(!(n instanceof e))return t===g?v():new e(t);if(t instanceof e)n.s=t.s,n.e=t.e,n.c=t.c.slice();else{if(typeof t!=`string`){if(e.strict===!0&&typeof t!=`bigint`)throw TypeError(d+`value`);t=t===0&&1/t<0?`-0`:String(t)}y(n,t)}n.constructor=e}return e.prototype=h,e.DP=r,e.RM=i,e.NE=s,e.PE=c,e.strict=l,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}function y(e,t){var n,r,i;if(!_.test(t))throw Error(d+`number`);for(e.s=t.charAt(0)==`-`?(t=t.slice(1),-1):1,(n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),i=t.length,r=0;r<i&&t.charAt(r)==`0`;)++r;if(r==i)e.c=[e.e=0];else{for(;i>0&&t.charAt(--i)==`0`;);for(e.e=n-r-1,e.c=[],n=0;r<=i;)e.c[n++]=+t.charAt(r++)}return e}function b(e,t,n,r){var i=e.c;if(n===g&&(n=e.constructor.RM),n!==0&&n!==1&&n!==2&&n!==3)throw Error(p);if(t<1)r=n===3&&(r||!!i[0])||t===0&&(n===1&&i[0]>=5||n===2&&(i[0]>5||i[0]===5&&(r||i[1]!==g))),i.length=1,r?(e.e=e.e-t+1,i[0]=1):i[0]=e.e=0;else if(t<i.length){if(r=n===1&&i[t]>=5||n===2&&(i[t]>5||i[t]===5&&(r||i[t+1]!==g||i[t-1]&1))||n===3&&(r||!!i[0]),i.length=t,r){for(;++i[--t]>9;)if(i[t]=0,t===0){++e.e,i.unshift(1);break}}for(t=i.length;!i[--t];)i.pop()}return e}function x(e,t,n){var r=e.e,i=e.c.join(``),a=i.length;if(t)i=i.charAt(0)+(a>1?`.`+i.slice(1):``)+(r<0?`e`:`e+`)+r;else if(r<0){for(;++r;)i=`0`+i;i=`0.`+i}else if(r>0)if(++r>a)for(r-=a;r--;)i+=`0`;else r<a&&(i=i.slice(0,r)+`.`+i.slice(r));else a>1&&(i=i.charAt(0)+`.`+i.slice(1));return e.s<0&&n?`-`+i:i}h.abs=function(){var e=new this.constructor(this);return e.s=1,e},h.cmp=function(e){var t,n=this,r=n.c,i=(e=new n.constructor(e)).c,a=n.s,o=e.s,s=n.e,c=e.e;if(!r[0]||!i[0])return r[0]?a:i[0]?-o:0;if(a!=o)return a;if(t=a<0,s!=c)return s>c^t?1:-1;for(o=(s=r.length)<(c=i.length)?s:c,a=-1;++a<o;)if(r[a]!=i[a])return r[a]>i[a]^t?1:-1;return s==c?0:s>c^t?1:-1},h.div=function(e){var t=this,n=t.constructor,r=t.c,i=(e=new n(e)).c,o=t.s==e.s?1:-1,s=n.DP;if(s!==~~s||s<0||s>a)throw Error(f);if(!i[0])throw Error(m);if(!r[0])return e.s=o,e.c=[e.e=0],e;var c,l,u,d,p,h=i.slice(),_=c=i.length,v=r.length,y=r.slice(0,c),x=y.length,S=e,C=S.c=[],w=0,T=s+(S.e=t.e-e.e)+1;for(S.s=o,o=T<0?0:T,h.unshift(0);x++<c;)y.push(0);do{for(u=0;u<10;u++){if(c!=(x=y.length))d=c>x?1:-1;else for(p=-1,d=0;++p<c;)if(i[p]!=y[p]){d=i[p]>y[p]?1:-1;break}if(d<0){for(l=x==c?i:h;x;){if(y[--x]<l[x]){for(p=x;p&&!y[--p];)y[p]=9;--y[p],y[x]+=10}y[x]-=l[x]}for(;!y[0];)y.shift()}else break}C[w++]=d?u:++u,y[0]&&d?y[x]=r[_]||0:y=[r[_]]}while((_++<v||y[0]!==g)&&o--);return!C[0]&&w!=1&&(C.shift(),S.e--,T--),w>T&&b(S,T,n.RM,y[0]!==g),S},h.eq=function(e){return this.cmp(e)===0},h.gt=function(e){return this.cmp(e)>0},h.gte=function(e){return this.cmp(e)>-1},h.lt=function(e){return this.cmp(e)<0},h.lte=function(e){return this.cmp(e)<1},h.minus=h.sub=function(e){var t,n,r,i,a=this,o=a.constructor,s=a.s,c=(e=new o(e)).s;if(s!=c)return e.s=-c,a.plus(e);var l=a.c.slice(),u=a.e,d=e.c,f=e.e;if(!l[0]||!d[0])return d[0]?e.s=-c:l[0]?e=new o(a):e.s=1,e;if(s=u-f){for((i=s<0)?(s=-s,r=l):(f=u,r=d),r.reverse(),c=s;c--;)r.push(0);r.reverse()}else for(n=((i=l.length<d.length)?l:d).length,s=c=0;c<n;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,e.s=-e.s),(c=(n=d.length)-(t=l.length))>0)for(;c--;)l[t++]=0;for(c=t;n>s;){if(l[--n]<d[n]){for(t=n;t&&!l[--t];)l[t]=9;--l[t],l[n]+=10}l[n]-=d[n]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--f;return l[0]||(e.s=1,l=[f=0]),e.c=l,e.e=f,e},h.mod=function(e){var t,n=this,r=n.constructor,i=n.s,a=(e=new r(e)).s;if(!e.c[0])throw Error(m);return n.s=e.s=1,t=e.cmp(n)==1,n.s=i,e.s=a,t?new r(n):(i=r.DP,a=r.RM,r.DP=r.RM=0,n=n.div(e),r.DP=i,r.RM=a,this.minus(n.times(e)))},h.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},h.plus=h.add=function(e){var t,n,r,i=this,a=i.constructor;if(e=new a(e),i.s!=e.s)return e.s=-e.s,i.minus(e);var o=i.e,s=i.c,c=e.e,l=e.c;if(!s[0]||!l[0])return l[0]||(s[0]?e=new a(i):e.s=i.s),e;if(s=s.slice(),t=o-c){for(t>0?(c=o,r=l):(t=-t,r=s),r.reverse();t--;)r.push(0);r.reverse()}for(s.length-l.length<0&&(r=l,l=s,s=r),t=l.length,n=0;t;s[t]%=10)n=(s[--t]=s[t]+l[t]+n)/10|0;for(n&&(s.unshift(n),++c),t=s.length;s[--t]===0;)s.pop();return e.c=s,e.e=c,e},h.pow=function(e){var t=this,n=new t.constructor(`1`),r=n,i=e<0;if(e!==~~e||e<-o||e>o)throw Error(d+`exponent`);for(i&&(e=-e);e&1&&(r=r.times(t)),e>>=1,e;)t=t.times(t);return i?n.div(r):r},h.prec=function(e,t){if(e!==~~e||e<1||e>a)throw Error(d+`precision`);return b(new this.constructor(this),e,t)},h.round=function(e,t){if(e===g)e=0;else if(e!==~~e||e<-a||e>a)throw Error(f);return b(new this.constructor(this),e+this.e+1,t)},h.sqrt=function(){var e,t,n,r=this,i=r.constructor,a=r.s,o=r.e,s=new i(`0.5`);if(!r.c[0])return new i(r);if(a<0)throw Error(u+`No square root`);a=Math.sqrt(+x(r,!0,!0)),a===0||a===1/0?(t=r.c.join(``),t.length+o&1||(t+=`0`),a=Math.sqrt(t),o=((o+1)/2|0)-(o<0||o&1),e=new i((a==1/0?`5e`:(a=a.toExponential()).slice(0,a.indexOf(`e`)+1))+o)):e=new i(a+``),o=e.e+(i.DP+=4);do n=e,e=s.times(n.plus(r.div(n)));while(n.c.slice(0,o).join(``)!==e.c.slice(0,o).join(``));return b(e,(i.DP-=4)+e.e+1,i.RM)},h.times=h.mul=function(e){var t,n=this,r=n.constructor,i=n.c,a=(e=new r(e)).c,o=i.length,s=a.length,c=n.e,l=e.e;if(e.s=n.s==e.s?1:-1,!i[0]||!a[0])return e.c=[e.e=0],e;for(e.e=c+l,o<s&&(t=i,i=a,a=t,l=o,o=s,s=l),t=Array(l=o+s);l--;)t[l]=0;for(c=s;c--;){for(s=0,l=o+c;l>c;)s=t[l]+a[c]*i[l-c-1]+s,t[l--]=s%10,s=s/10|0;t[l]=s}for(s?++e.e:t.shift(),c=t.length;!t[--c];)t.pop();return e.c=t,e},h.toExponential=function(e,t){var n=this,r=n.c[0];if(e!==g){if(e!==~~e||e<0||e>a)throw Error(f);for(n=b(new n.constructor(n),++e,t);n.c.length<e;)n.c.push(0)}return x(n,!0,!!r)},h.toFixed=function(e,t){var n=this,r=n.c[0];if(e!==g){if(e!==~~e||e<0||e>a)throw Error(f);for(n=b(new n.constructor(n),e+n.e+1,t),e=e+n.e+1;n.c.length<e;)n.c.push(0)}return x(n,!1,!!r)},h.toJSON=h.toString=function(){var e=this,t=e.constructor;return x(e,e.e<=t.NE||e.e>=t.PE,!!e.c[0])},h.toNumber=function(){var e=+x(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(e.toString()))throw Error(u+`Imprecise conversion`);return e},h.toPrecision=function(e,t){var n=this,r=n.constructor,i=n.c[0];if(e!==g){if(e!==~~e||e<1||e>a)throw Error(d+`precision`);for(n=b(new r(n),e,t);n.c.length<e;)n.c.push(0)}return x(n,e<=n.e||n.e<=r.NE||n.e>=r.PE,!!i)},h.valueOf=function(){var e=this,t=e.constructor;if(t.strict===!0)throw Error(u+`valueOf disallowed`);return x(e,e.e<=t.NE||e.e>=t.PE,!0)},n=v(),n.default=n.Big=n,typeof define==`function`&&define.amd?define(function(){return n}):t!==void 0&&t.exports?t.exports=n:e.Big=n})(e)})),Sa=o(((e,t)=>{var n=ya(),r=ba(),i=ga(),a=xa();t.exports=(()=>{class e{constructor(e){this._big=d(e)}add(t){return new e(this._big.plus(d(t)))}subtract(t){return new e(this._big.minus(d(t)))}multiply(t){return new e(this._big.times(d(t)))}divide(t){return new e(this._big.div(d(t)))}raise(t){return n.argumentIsRequired(t,`exponent`,Number),new e(this._big.pow(t))}round(t,r){n.argumentIsRequired(t,`places`,Number),n.argumentIsOptional(r,`mode`,f,`RoundingMode`);let i=r||f.NORMAL;return new e(this._big.round(t,i.value))}mod(t){return new e(this._big.mod(d(t)))}absolute(){return new e(this._big.abs())}opposite(){return this.multiply(-1)}getIsZero(e,r){return n.argumentIsOptional(e,`approximate`,Boolean),n.argumentIsOptional(r,`places`,Number),this._big.eq(t)||i.boolean(e)&&e&&this.round(r||a.DP,f.NORMAL).getIsZero()}getIsPositive(){return this._big.gt(t)}getIsNegative(){return this._big.lt(t)}getIsGreaterThan(e){return this._big.gt(d(e))}getIsGreaterThanOrEqual(e){return this._big.gte(d(e))}getIsLessThan(e){return this._big.lt(d(e))}getIsLessThanOrEqual(e){return this._big.lte(d(e))}getIsBetween(e,t,r){return n.argumentIsOptional(r,`exclusive`,Boolean),i.boolean(r)&&r?this.getIsGreaterThan(e)&&this.getIsLessThan(t):this.getIsGreaterThanOrEqual(e)&&this.getIsLessThanOrEqual(t)}getIsEqual(e){return this._big.eq(d(e))}getIsApproximate(t,n){if(n===0)return this.getIsEqual(t);let r=this.subtract(t).absolute(),i=e.ONE.divide(new e(10).raise(n));return r.getIsLessThan(i)}getIsInteger(){return this.getIsEqual(this.round(0))}getDecimalPlaces(){let e=this.toFixed().match(/-?\d*\.(\d*)/),t;return t=e===null?0:e[1].length,t}toFloat(e){return n.argumentIsOptional(e,`places`,Number),parseFloat(this._big.toFixed(e||16))}toFixed(){return this._big.toFixed()}toNumber(){return this._big.toNumber()}toJSON(){return this.toFixed()}static clone(t){return n.argumentIsRequired(t,`value`,e,`Decimal`),new e(t._big)}static parse(t){return new e(t)}static get ZERO(){return c}static get ONE(){return l}static get NEGATIVE_ONE(){return u}static get ROUNDING_MODE(){return f}static getIsZero(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsZero()}static getIsNotZero(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),!t.getIsZero()}static getIsPositive(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsPositive()}static getIsNotPositive(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsNegative()}static getIsNotNegative(t){return n.argumentIsRequired(t,`instance`,e,`Decimal`),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,r){return n.argumentIsRequired(t,`a`,e,`Decimal`),n.argumentIsRequired(r,`b`,e,`Decimal`),t._big.gt(r._big)?1:t._big.lt(r._big)?-1:0}toString(){return`[Decimal]`}}let t=new a(0),o=new a(1),s=new a(-1),c=new e(t),l=new e(o),u=new e(s);function d(t){return t instanceof a?t:t instanceof e?t._big:new a(t)}class f extends r{constructor(e,t){super(e.toString(),t),this._value=e}get value(){return this._value}static get UP(){return p}static get DOWN(){return m}static get NORMAL(){return h}toString(){return`[RoundingMode]`}}let p=new f(3,`up`),m=new f(0,`down`),h=new f(1,`normal`);return e})()})),Ca=o(((e,t)=>{var n=ya(),r=Sa(),i=ga(),a=ba();t.exports=(()=>{class e extends a{constructor(e,t,n,r,i,a,o,s){super(e,e),this._baseCode=t,this._decimalDigits=n,this._supportsFractions=r,r?(this._fractionFactor=i,this._fractionDigits=a,this._fractionFactorSpecial=o||i,this._fractionDigitsSpecial=s||a):(this._fractionFactor=void 0,this._fractionDigits=void 0,this._fractionFactorSpecial=void 0,this._fractionDigitsSpecial=void 0)}get baseCode(){return this._baseCode}get unitCode(){return this._code}get decimalDigits(){return this._decimalDigits}get supportsFractions(){return this._supportsFractions}get fractionFactor(){return this._fractionFactor}get fractionDigits(){return this._fractionDigits}get fractionFactorSpecial(){return this._fractionFactorSpecial}get fractionDigitsSpecial(){return this._fractionDigitsSpecial}getFractionFactor(e){return e===!0?this._fractionFactorSpecial:this._fractionFactor}getFractionDigits(e){return e===!0?this._fractionDigitsSpecial:this._fractionDigits}getMinimumTick(e){n.argumentIsValid(e,`tickIncrement`,i.integer,`must be an integer`);let t=new r(1),a=new r(10),o;return o=this.supportsFractions?t.divide(this._fractionFactor):t.divide(a.raise(this._decimalDigits)),o.multiply(e).toFloat()}getMinimumTickValue(e,t){return n.argumentIsValid(e,`tickIncrement`,i.integer,`must be an integer`),n.argumentIsValid(t,`pointValue`,i.number,`must be a number`),new r(this.getMinimumTick(e)).multiply(t).toFloat()}roundToNearestTick(e,t,a){n.argumentIsValid(e,`value`,e=>i.number(e)||e instanceof r,`must be a number primitive or a Decimal instance`),n.argumentIsValid(t,`minimumTick`,e=>i.number(e)||e instanceof r,`must be a number primitive or a Decimal instance`),n.argumentIsOptional(a,`roundToZero`,Boolean);let o;o=e instanceof r?e:new r(e);let s=o.divide(t);return o.mod(t).getIsZero()||(s=s.round(0,i.boolean(a)&&a?r.ROUNDING_MODE.DOWN:r.ROUNDING_MODE.NORMAL)),s.multiply(t).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(t){return a.fromCode(e,t)}static fromBaseCode(t){return a.getItems(e).find(e=>e.baseCode===t)||null}}return new e(`2`,-1,3,!0,8,1),new e(`3`,-2,4,!0,16,2),new e(`4`,-3,5,!0,32,2),new e(`5`,-4,6,!0,64,2,320,3),new e(`6`,-5,7,!0,128,3,320,3),new e(`7`,-6,8,!0,256,3,320,3),new e(`8`,0,0,!1),new e(`9`,1,1,!1),new e(`A`,2,2,!1),new e(`B`,3,3,!1),new e(`C`,4,4,!1),new e(`D`,5,5,!1),new e(`E`,6,6,!1),new e(`F`,7,7,!1),e})()})),wa=o(((e,t)=>{var n=ga(),r=_a(),i=va(),a=Ca();t.exports=(()=>{function e(e,t,o,s,c,l){if(!n.number(e))return``;let u=a.parse(t);return u===null?``:((!n.string(o)||o.length>1)&&(o=`.`),s=n.boolean(s)&&s,l=n.boolean(l)&&l,!u.supportsFractions||o===`.`?r(e,u.decimalDigits,c,l):i(e,u.getFractionFactor(s),u.getFractionDigits(s),o,l))}return e})()})),Ta=o(((e,t)=>{var n=ba();t.exports=(()=>{class e extends n{constructor(e,t,n){super(e,t),this._id=n}get id(){return this._id}toJSON(){return this._id}static parse(t){return n.fromCode(e,t)}static fromId(t){return n.getItems(e).find(e=>e.id===t)||null}static get STOCK(){return t}static get STOCK_OPTION(){return r}static get FUTURE(){return i}static get FUTURE_OPTION(){return a}static get FOREX(){return o}static get CMDTY_STATS(){return s}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}let t=new e(`STK`,`U.S. Equity`,1),r=new e(`STKOPT`,`Equity Option`,34),i=new e(`FUT`,`Future`,2),a=new e(`FUTOPT`,`Future Option`,12),o=new e(`FOREX`,`FOREX`,10),s=new e(`CMDTY`,`cmdtyStats`,24);return e})()})),Ea=o(((e,t)=>{var n=Ta(),r=va(),i=wa();t.exports=(()=>{let e={};e.ZB=/^BB\d$/,e.ZT=/^BT\d$/,e.ZF=/^BF\d$/,e.ZN=/^BN\d$/;function t(t,a,o){if(o.asset===n.FUTURE_OPTION){let n=o.root;if(n===`ZB`||n===`ZN`||e.ZB.test(n)||e.ZN.test(n))return r(t,64,2,`-`,!1);if(n===`ZT`||n===`ZF`||e.ZT.test(n)||e.ZF.test(n))return r(t,640,3,`-`,!1)}return i(t,a,`-`,!0,`,`)}return t})()})),Da=c(wa(),1),Oa=c(_a(),1),ka=c(Ea(),1),Aa=[{min:0,divider:1,suffix:``,decimals:0},{min:1e5,divider:1e3,suffix:`K`,decimals:0},{min:1e6,divider:1e6,suffix:`M`,decimals:2},{min:1e9,divider:1e9,suffix:`B`,decimals:3},{min:0xe8d4a51000,divider:0xe8d4a51000,suffix:`T`,decimals:3}];function ja(e,t,n){let r=$().config;return r.mode===ne[ne.cmdtyView]&&n!=null?(0,ka.default)(e,t,n):(0,Da.default)(e,t,`-`,r.isAlt64,`,`,!1)}function Ma(e){if(P(e)){let t=$().config,n=rt(t,null,`overrides`,`symbology`,`translateSymbol`);if(P(n)&&typeof n==`function`)try{let t=n(e);if(P(t))return t}catch(t){I(`Failed translating the symbol '${e}', error is ${t.message}`,`warn`)}}return e}function Na(e,t,n){if(e==null)return``;if(!this.isReady)return e.toFixed(0);if(t.format===y.FromMetaData)return ja(e,this.unitCode,this._profile);switch(t.format){case y.AsInteger:return e.toFixed();case y.UseMetricUnit:{n||={};let t=Object.assign({},{range:[e,e],allDigits:!1},n);if(n.allDigits)return Ia(e,0);(!Array.isArray(t.range)||!t.range.length)&&(t.range=[e,e]);let r=Math.max(Math.abs(t.range[0]),Math.abs(t.range[1])),i=_e(Aa,e=>r>e.min)||Aa[0];return`${(e/i.divider).toFixed(i.decimals)}${i.suffix}`}case y.AsPercent:return`${(e*100).toFixed(2)}%`;default:return``}}function Pa(e,t,n){let r=n?.overridePrecision;return Number.isFinite(r)&&r>=0?Ia(e,r):null}var Fa=class{symbol;name=``;unitCode=``;exchange=``;pointValue=1;tickIncrement=1;symbolType=`Unknown`;timeZone;expiration=``;resolved;_profile;_minMovement=null;constructor(e){this.resolved=this.symbol=e,this.timeZone=Ui(Ma(this.symbol)),this._profile=null}initialize(e){this._minMovement=null,za(e)||lt(this,e),this._profile=e}get isReady(){return this.unitCode.length>0}get minMovement(){if(!this.isReady)return 0;if(this._minMovement==null){let e=Number.parseInt(this.unitCode,16),t=1/(e<8?2<<e:10**(e-8));this._minMovement=this.tickIncrement*t}return this._minMovement}format(e,t,n){let r=Pa(e,t,n);return r===null?Na.call(this,e,t,n):r}parse(e){throw Error(`Not implemented yet`)}getInlineMetadata(e){if(typeof document>`u`)return null;let t=ea(`#${B.INLINE_DATA_ELEMENT_ID}`);if(!P(t))return null;let n;try{n=JSON.parse(t)}catch(e){return I(`Failed to parse inline metadata JSON, error is ${e.message}`,`warn`),null}let r=e,i=e=>e in n;return!i(r)&&(r=Qi(e,Object.keys(n)),!i(r))?null:n[r].instrument}getFallbackApi(){return`getInstrumentDefinition`}processFallback(e){return{name:e.symbolName,exchange:e.exchange,unitCode:e.baseCode,pointValue:e.pointValue,tickIncrement:e.tickIncrement}}async getFallbackMetadata(e){try{let t=encodeURIComponent(e),n=await sF(`ondemand`,`/${this.getFallbackApi()}.json?symbols=${t}`),r=JSON.parse(n);if(r.status.code===200&&r.results.length===1){let e=r.results[0];return await this.processFallback(e)}}catch(t){I(`Failed fetching the metadata for ${e}, error is ${t.message}`,`warn`)}return this.emptyFallbackProfile()}emptyFallbackProfile(){return{name:``,exchange:``,unitCode:`A`,pointValue:1,tickIncrement:1}}};function Ia(e,t){return(0,Oa.default)(e,t,`,`,!1)}function La(e,t=!1){return new Ka(e,t)}var Ra=class extends Fa{shutdown(){}async ready(){return da.call(this,async()=>{let e=Ma(this.symbol),t=this.getInlineMetadata(e);return za(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0})}getCacheableEntities(e){e.add(this)}};function za(e){return!N(e)||!P(e.unitCode,e.name,e.exchange)||e.unitCode.length===0}var Ba=class extends Fa{shutdown(){}refresh(){this.isReady||(fa.call(this),this.ready())}async ready(){return da.call(this,async()=>{let e=Ma(this.symbol),t=await(Vi(e)?wi(e):e);this.resolved=Bi(t);let n=Ti(this.resolved),[r,i]=await Zi(this.resolved),a=new Promise(e=>{setTimeout(()=>e(null),B.META_DATA_GET_TIMETOUT)}),o=null;try{o=await Promise.race([a,this.getProfile(r)])}catch(e){I(`Failed fetching the metadata for ${r}, error is ${e.message}`,`warn`)}return za(o)&&(o=this.getInlineMetadata(r)),za(o)&&(o=await this.getFallbackMetadata(r)),o?.symbolType===`Unknown`&&i&&(o.symbolType=`Future`),o?.symbolType===`Unknown`&&n&&(o.symbolType=`FutureOption`),this.initialize(o),this.isReady})}async getProfile(e){return Promise.reject(Error(`Method shold be implemented in the derived class.`))}getCacheableEntities(e){e.add(this)}},Va=class extends Ba{getType(e){if(!e)return`Unknown`;switch(e.code){case`STK`:return`Equity`;case`STKOPT`:return`EquityOption`;case`FUT`:return`Future`;case`FUTOPT`:return`FutureOption`;case`FOREX`:return`Forex`;default:return`Unknown`}}async getProfile(e){let t=await $().connection.getMarketState().getProfile(e);return{symbolType:this.getType(t.asset),name:t.name,exchange:t.exchange,unitCode:t.unitCode,pointValue:t.pointValue,tickIncrement:t.tickIncrement,timeZone:t.exchangeRef?.timeZoneDdf}}},Ha=function(e){return e[e.UNKNOWN_INSTRUMENT_TYPE=0]=`UNKNOWN_INSTRUMENT_TYPE`,e[e.FOREX=1]=`FOREX`,e[e.INDEX=2]=`INDEX`,e[e.EQUITY=3]=`EQUITY`,e[e.FUTURE=4]=`FUTURE`,e[e.OPTION=5]=`OPTION`,e[e.SPREAD=6]=`SPREAD`,e[e.MUTUAL_FUND=7]=`MUTUAL_FUND`,e[e.MONEY_MARKET_FUND=8]=`MONEY_MARKET_FUND`,e[e.USER_DEFINED_SPREAD=9]=`USER_DEFINED_SPREAD`,e[e.EQUITY_OPTION=10]=`EQUITY_OPTION`,e[e.OTHER=99]=`OTHER`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}(Ha||{}),Ua=class extends Ba{_profileSource=new pa;hasInstrumentDefinitionProfile=!1;priceDenominator=1;quantityDenominator=1;priceScaling=1;expirationDate;get isReady(){return super.isReady&&this.hasInstrumentDefinitionProfile}resetProfile(){this.hasInstrumentDefinitionProfile=!1,this.priceDenominator=this.quantityDenominator=this.priceScaling=1}refresh(){this.isReady||(this.resetProfile(),fa.call(this),this.ready())}asPrice(e){return e===void 0?null:e.toNumber()/this.priceDenominator*this.priceScaling}asQuantity(e){return e===void 0?null:Math.floor(e.toNumber()/this.quantityDenominator)}get profileSource(){return this._profileSource}getRequest(e){return{symbol:e,instrumentType:[],spreadType:[]}}getType(e){switch(e){case 3:return`Equity`;case 4:return`Future`;case 5:return`FutureOption`;case 1:return`Forex`;case 2:return`Index`;case 10:return`EquityOption`;default:return`Unknown`}}getFallbackApi(){return`getOFInstrumentDefinition`}async processFallback(e){let t=e.definition;return t.instrumentType=Ha[t.instrumentType],this.completeFormatting(this.getProfileFromInstrumentDefinition(t),this.resolved)}async completeFormatting(e,t){if(e.unitCode)return e;try{let n=await sF(`ondemand`,`/getInstrumentDefinition.json?symbols=${encodeURIComponent(t)}`),r=JSON.parse(n);if(r.status.code===200&&r.results.length===1){let t=await super.processFallback(r.results[0]);e.unitCode=t.unitCode,e.name||=t.name,e.exchange||=t.exchange,e.pointValue||=t.pointValue,e.tickIncrement||=t.tickIncrement}}catch(e){I(`Failed fetching formatting metadata for ${t}, error is ${e.message}`,`warn`)}return e}getProfileFromInstrumentDefinition(e){this.hasInstrumentDefinitionProfile=!0,this.expirationDate=e.symbolExpiration;let{priceDenominator:t,priceScalingExponent:n,quantityDenominator:r}=e;if(t!==0&&(this.priceDenominator=t),r!==0&&(this.quantityDenominator=r),n&&n!==0){let e=1;n<0?e/=10**-n:e*=10**n,this.priceScaling=e}return{symbolType:this.getType(e.instrumentType),pointValue:e.contractPointValue,tickIncrement:e.minimumPriceIncrement,exchange:e.barchartExchange,name:e.description,unitCode:e.barchartBaseCode,timeZone:e.timeZoneName}}async getProfile(e){let t=await $().getAdapter()?.getInstrument(this.getRequest(e))??[];return t.length<1?null:this.completeFormatting(this.getProfileFromInstrumentDefinition(t[0]),e)}},Wa=class{_decimals;unitCode;pointValue=1;tickIncrement=1;minMovement=0;symbol=``;symbolType=`Unknown`;resolved=``;name=``;exchange=``;constructor(e){this._decimals=e,this.unitCode=(8+e).toString(16).toUpperCase()}shutdown(){throw Error(`Method not implemented.`)}get isReady(){return!0}async ready(){return!0}format(e,t,n){if(e==null)return``;let r=Pa(e,t,n);return r===null?Ia(e,this._decimals):r}getCacheableEntities(e){}},Ga=class{unitCode=``;minMovement=0;pointValue=0;tickIncrement=0;symbol=``;symbolType=`Unknown`;resolved=``;name=``;exchange=``;async ready(){return!1}get isReady(){return!1}shutdown(){}format(e,t,n){return e==null?``:P(e)?e.toFixed(0):``}getCacheableEntities(e){}},Ka=class{inner;forceDecimals;unitCode=``;pointValue=1;tickIncrement=1;minMovement=0;symbol=``;symbolType=`Unknown`;resolved=``;name=``;exchange=``;constructor(e,t=!1){let n=$().getMetaDataSource();this.inner=e.map(e=>n.getMetaData(e)),this.forceDecimals=t}get isReady(){return this.unitCode!=null}async ready(){return da.call(this,async()=>{let e=(await Promise.all(this.inner.map(e=>e.ready()))).every(ue);if(e){let e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:n,no:r}=A(this.inner,e=>t(e)>=8),i=this.inner.length,a=e=>Math.max(...e).toString(16).toUpperCase();if(!this.forceDecimals&&(n.length===i||r.length===i))this.unitCode=a(this.inner.map(t));else{let i=n.map(t).concat(r.map(t).map(e=>String.fromCharCode(e-2+66)).map(e));this.unitCode=a(i)}this.minMovement=Math.min(...this.inner.map(e=>e.minMovement))}return e})}format(e,t,n){let r=Pa(e,t,n);return r===null?Na.call(this,e,t,n):r}getCacheableEntities(e){this.inner.forEach(t=>e.add(t))}shutdown(){}},qa=class{metaDataCache;constructor(){this.metaDataCache=new Map}getMetaData(e){if(e===B.PLACEHOLDER_SYMBOL_NAME)return new Ga;if(this.metaDataCache.has(e))return this.metaDataCache.get(e);{let t=this.metaDataCreator(e);return this.metaDataCache.set(e,t),t}}evictUnused(e){for(let[t,n]of this.metaDataCache)e.has(n)||(n.shutdown(),this.metaDataCache.delete(t))}refresh(){for(let e of this.metaDataCache.values())e.refresh?.()}},Ja=class extends qa{metaDataCreator(e){return new Ra(e)}},Ya=class extends qa{metaDataCreator(e){return new Va(e)}},Xa=class extends qa{metaDataCreator(e){return new Ua(e)}},Za=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,Qa=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,$a=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,eo={r:255,g:255,b:255,a:1},to={r:0,g:0,b:0,a:1};function no(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function ro(e,t){return-(e.y-t.y)/(e.x-t.x)}function io(e,t){let n=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);return Math.sqrt(n*n+r*r)}function ao(e,t){return{x:e.x-t.x,y:e.y-t.y}}function oo(e,t){return{x:e.x+t.x,y:e.y+t.y}}function so(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function co(e,t,n){let[r,i]=e,a=i.x-r.x,o=i.y-r.y,s=t.x-r.x,c=t.y-r.y;if(a===0&&o===0)return Math.abs(s)<=n&&Math.abs(c)<=n;let l=Math.atan2(o,a),u=Math.sqrt(a*a+o*o),d=Math.atan2(c,s),f=Math.sqrt(s*s+c*c),p=f*Math.cos(d-l),m=f*Math.sin(d-l);return Math.abs(m)<=n&&-n<=p&&p<=u+n}function lo(e){return e.toLowerCase().replace(`shortdashdotdot`,`3,1,1,1,1,1,`).replace(`shortdashdot`,`3,1,1,1`).replace(`shortdot`,`1,1,`).replace(`shortdash`,`3,1,`).replace(`longdash`,`8,3,`).replace(`sparsedot`,`1,8,`).replace(/dot/g,`1,3,`).replace(`dash`,`4,3,`).replace(/,$/,``).replace(`solid`,``).split(`,`).map(Number).filter(ue)}function uo(e){return Co(vo(e))}function fo(e,t){let n=vo(e);return n.a=t,So(n)}function po(e,t,n,r=!1){let i=e.a,a=r=>Math.floor(e[r]+(t[r]-e[r])*n);return{r:a(`r`),g:a(`g`),b:a(`b`),a:Math.min(1,(1+(r?n:0))*i)}}function mo({r:e,g:t,b:n,a:r}){return{r:255-e,g:255-t,b:255-n,a:r}}var ho=e=>{let t=vo(e);return So(po(mo(t),t,.7))},go=(e,t=!1)=>le(vo,n=>po(n,to,e,t),So);function _o(e,t=!1){return le(vo,n=>po(n,eo,e,t),So)}function vo(e){if([`r`,`g`,`b`,`a`].map(t=>e[t]).every(e=>P(e)))return e;let t=P(e.linearGradient)?e._refColor:e,n=Za.exec(t);if(n!==null){let e=P(n[2]),t=n[1]+(n[2]||``),r=n=>e?parseInt(t.substr(n*2,2),16):parseInt(t.charAt(n),16)*17;return{r:r(0),g:r(1),b:r(2),a:1}}else{let e=$a.exec(t),n=Qa.exec(t),r=(e,t)=>P(e)&&e.length===t,i=r(e,5),a=r(n,4);if(!i&&!a)throw Error(`Color is neither a hex color nor a rgba one.`);let o=i?e:n,s=e=>parseInt(o[e]),c=parseFloat(o[4]);return{r:s(1),g:s(2),b:s(3),a:i?c:1}}}function yo(e){return e<=.008856?e*903.3:e**(1/3)*116-16}function bo(e){let{r:t,g:n,b:r}=vo(e),[i,a,o]=[t,n,r].map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return yo(.2126*i+.7152*a+.0722*o)}function xo(e){return bo(e)>66.66?`#000`:`#fff`}function So(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function Co(e){let t=e=>{let t=e.toString(16);return t.length===2?t:`0`+t};return`#${t(e.r)}${t(e.g)}${t(e.b)}`}function wo(e,t,n){return e.x-=t,e.y-=n,e.width+=2*t,e.height+=2*n,e}function To(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}var Eo=class e{x;y;width;height;constructor(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r}contains(e){return e.x>=this.x&&e.x<=this.x+this.width&&e.y>=this.y&&e.y<=this.y+this.height}get centerX(){return this.x+this.width/2}get centerY(){return this.y+this.height/2}duplicate(){return new e(this.x,this.y,this.width,this.height)}},Do=class{cx;cy;radiusX;radiusY;constructor(e,t,n,r){this.cx=e,this.cy=t,this.radiusX=n,this.radiusY=r}contains(e){let t=Math.abs(e.x-this.cx)/this.radiusX,n=Math.abs(e.y-this.cy)/this.radiusY;return Math.sqrt(t*t+n*n)<=1}};function Oo(e,t){e.moveTo(t.x,t.y)}function ko(e,t){e.lineTo(t.x,t.y)}function Ao(e,t,n){e.rect(t.x,t.y,n.x-t.x,n.y-t.y)}function jo(e,t=B.LINE_HEIGHT_MULTIPLIER){return t*e.measureText(`M`).width}function Mo(e,t=!1,n=1){let r=No(e,t,n).y;return r-Math.sign(r)*B.DEFAULT_ADORN_OFFSET.y}function No(e,t=!1,n=1){let r={...B.DEFAULT_ADORN_OFFSET};return t&&(r.y=-(n*jo(e,1)+r.y)),r}function Po(e,t,n,r=T.Left){let i=Array.isArray(t)?t:[t],a=jo(e,1),o=Math.max(...i.map(t=>e.measureText(t).width)),s=a*i.length,c=n.x;r===T.Right&&(c-=o),r===T.Center&&(c-=o/2);let l=n.y-a;return wo(new Eo(c,l,o,s),4,4)}function Fo(e,t,n,r=T.Left,i,a){e.save();let o=Array.isArray(t)?t:[t],s=jo(e,1);if(P(a)){let i=Po(e,t,n,r);e.fillStyle=a,Lo(e,i,!1)}P(i)&&(e.fillStyle=i);let c=n.x,l=n.y;o.forEach(t=>{e.textAlign=T[r].toLowerCase(),e.fillText(t,c,l),l+=s}),e.restore()}function Io(e,t){e.beginPath(),e.ellipse(t.cx,t.cy,t.radiusX,t.radiusY,0,0,2*Math.PI),e.stroke(),e.fill()}function Lo(e,t,n=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),n&&e.stroke(),e.fill()}function Ro(e,t,n,r=0,i=Math.PI,a=!1,o=!1){e.beginPath(),o&&e.moveTo(t.x,t.y),e.arc(t.x,t.y,Math.abs(n),r,i,a),e.stroke(),o&&e.fill()}function zo(e,{x:t,y:n},{x:r,y:i}){e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke()}function Bo(e,t,n,r){zo(e,{x:t,y:n},{x:t,y:r})}function Vo(e,t,n,r){zo(e,{x:n,y:t},{x:r,y:t})}function Ho(e,{x:t,y:n,r,color:i,text:a},o){let s=r;e.fillStyle=i,e.beginPath();let c=r+r,l=c,u=new Eo(t-r,n-s-l,c,l);return e.fillRect(u.x,u.y,u.width,u.height),e.font=`700 ${(r*1.6).toFixed(0)}px "${o}"`,e.fillStyle=`#fff`,e.textAlign=`center`,e.textBaseline=`middle`,e.beginPath(),e.fillText(a,t,n-l*.9),u}function Uo(e,t,n){switch(t){case`zero`:Wo(e,n,`0`);break;case`one`:Wo(e,n,`1`);break;case`two`:Wo(e,n,`2`);break;case`three`:Wo(e,n,`3`);break;case`four`:Wo(e,n,`4`);break;case`five`:Wo(e,n,`5`);break;case`six`:Wo(e,n,`6`);break;case`seven`:Wo(e,n,`7`);break;case`eight`:Wo(e,n,`8`);break;case`nine`:Wo(e,n,`9`);break;case`question`:Wo(e,n,`?`);break;case`fish_hook`:rs(e,n);break;case`arrow_up`:Go(e,n);break;case`arrow_down`:Ko(e,n);break;case`arrow_right`:Jo(e,n);break;case`arrow_left`:qo(e,n);break;case`arrow_horizontal`:Yo(e,n);break;case`arrow_vertical`:Xo(e,n);break;case`arc_down`:$o(e,n);break;case`arc_up`:Qo(e,n);break;case`thumbs_up`:ts(e,n);break;case`thumbs_down`:ns(e,n);break;case`letter_b`:Wo(e,n,`B`);break;case`letter_s`:Wo(e,n,`S`);break;case`letter_a`:Wo(e,n,`A`);break;case`letter_c`:Wo(e,n,`C`);break;case`letter_d`:Wo(e,n,`D`);break;case`letter_e`:Wo(e,n,`E`);break;default:break}}function Wo(e,t,n){e.save();let r=t.centerX,i=t.centerY,a=Math.floor(Math.min(t.width/2,t.height/2));e.strokeStyle=e.fillStyle,e.lineWidth=Math.max(1,a*.1),Ro(e,{x:r,y:i},a,0,Math.PI*2),e.textAlign=`center`,e.font=`${a*2}px Arial`,e.textBaseline=`middle`,e.fillText(n,r,i+a*.15),e.restore()}function Go(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(a,r),e.lineTo(n,o),e.lineTo(i,r),e.lineTo(Math.floor(n-c),r),e.lineTo(Math.floor(n-c),s),e.lineTo(Math.floor(n+c),s),e.lineTo(Math.floor(n+c),r),e.closePath(),e.fill(),e.restore()}function Ko(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(a,r),e.lineTo(n,s),e.lineTo(i,r),e.lineTo(Math.floor(n-c),r),e.lineTo(Math.floor(n-c),o),e.lineTo(Math.floor(n+c),o),e.lineTo(Math.floor(n+c),r),e.closePath(),e.fill(),e.restore()}function qo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(n,o),e.lineTo(i,r),e.lineTo(n,s),e.lineTo(n,Math.floor(r+c)),e.lineTo(a,Math.floor(r+c)),e.lineTo(a,Math.floor(r-c)),e.lineTo(n,Math.floor(r-c)),e.closePath(),e.fill(),e.restore()}function Jo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t);e.beginPath(),e.moveTo(n,o),e.lineTo(a,r),e.lineTo(n,s),e.lineTo(n,Math.floor(r+c)),e.lineTo(i,Math.floor(r+c)),e.lineTo(i,Math.floor(r-c)),e.lineTo(n,Math.floor(r-c)),e.closePath(),e.fill(),e.restore()}function Yo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t,3/2),l=Math.floor(n-(n-i)/3),u=Math.floor(n+(n-i)/3);e.beginPath(),e.moveTo(l,o),e.lineTo(i,r),e.lineTo(l,s),e.lineTo(l,Math.floor(r+c)),e.lineTo(u,Math.floor(r+c)),e.lineTo(u,s),e.lineTo(a,r),e.lineTo(u,o),e.lineTo(u,Math.floor(r-c)),e.lineTo(l,Math.floor(r-c)),e.lineTo(l,o),e.closePath(),e.fill(),e.restore()}function Xo(e,t){e.save();let{cx:n,cy:r,left:i,right:a,top:o,bottom:s,halfBaseSize:c}=Zo(t,2/3),l=Math.floor(r-(r-o)/3),u=Math.floor(r+(r-o)/3);e.beginPath(),e.moveTo(a,l),e.lineTo(n,o),e.lineTo(i,l),e.lineTo(Math.floor(n-c),l),e.lineTo(Math.floor(n-c),u),e.lineTo(i,u),e.lineTo(n,s),e.lineTo(a,u),e.lineTo(Math.floor(n+c),u),e.lineTo(Math.floor(n+c),l),e.lineTo(a,l),e.closePath(),e.fill(),e.restore()}function Zo(e,t=1){let n=Math.floor(e.centerX),r=Math.floor(e.centerY),{width:i,height:a}=e;return i=.9*Math.min(i,a*t),a=i/t,{cx:n,cy:r,left:Math.floor(n-i/2),right:Math.floor(n+i/2),top:Math.floor(r-a/2),bottom:Math.floor(r+a/2),halfBaseSize:Math.min(i,a)*.21}}function Qo(e,t){let{cx:n,cy:r,left:i,right:a,deflection:o,arcWidth:s}=es(t);e.save(),e.beginPath(),e.moveTo(a,r);let c=n+o,l=r-o,u=n-o,d=r-o;e.bezierCurveTo(c,l,u,d,i,r),e.lineTo(i,r-s),e.bezierCurveTo(u,d-s,c,l-s,a,r-s),e.closePath(),e.fill(),e.restore()}function $o(e,t){let{cx:n,cy:r,left:i,right:a,deflection:o,arcWidth:s}=es(t);e.save(),e.beginPath(),e.moveTo(a,r);let c=n+o,l=r+o,u=n-o,d=r+o;e.bezierCurveTo(c,l,u,d,i,r),e.lineTo(i,r+s),e.bezierCurveTo(u,d+s,c,l+s,a,r+s),e.closePath(),e.fill(),e.restore()}function es(e){let t=Math.floor(e.centerX),n=Math.floor(e.centerY),{width:r,height:i}=e,a=Math.floor(Math.min(r,i));return a*=.9,{cx:t,cy:n,left:Math.floor(t-a/2),right:Math.floor(t+a/2),arcWidth:a*.075,deflection:a*.3}}function ts(e,t){e.save(),e.translate(t.x,t.y),e.lineWidth=.05;let n=Math.min(t.width,t.height)/18;e.scale(n,n),e.lineCap=`butt`,e.save(),e.save(),e.beginPath(),e.moveTo(3.23,8.96),e.lineTo(4.17,8.96),e.bezierCurveTo(4.73,8.81,5.91,6.45,6.45,5.82),e.bezierCurveTo(6.88,5.33,7.66,5.09,8.48,3.7),e.bezierCurveTo(9.11,2.78,8.38,1.49,10.06,1.17),e.bezierCurveTo(10.9,1.01,11.86,2.61,11.58,4.11),e.bezierCurveTo(11.49,4.6,11.25,5.14,11.07,5.54),e.bezierCurveTo(10.63,6.5,10.05,6.58,10.17,7.23),e.bezierCurveTo(10.98,7.25,11.79,7.32,12.67,7.27),e.bezierCurveTo(14.33,7.17,15.55,9.08,14.43,10.38),e.bezierCurveTo(14.9,11.12,14.79,12.33,14.14,12.81),e.bezierCurveTo(14.42,13.58,14.25,14.45,13.67,14.8),e.bezierCurveTo(14.13,16.77,12.36,16.87,11.77,16.84),e.lineTo(4.65,16.84),e.bezierCurveTo(3.87,16.77,3.95,16.28,3.5,16.27),e.bezierCurveTo(3.39,16.26,3.3,16.26,3.3,16.26),e.bezierCurveTo(3.18,16.26,3.19,15.7,3.28,15.7),e.bezierCurveTo(3.36,15.69,3.61,15.68,3.87,15.71),e.bezierCurveTo(4.03,15.79,4.4,16.26,4.75,16.27),e.lineTo(12.12,16.26),e.bezierCurveTo(13.13,16.27,13.67,15.11,12.8,14.56),e.bezierCurveTo(13.85,14.53,13.98,12.98,13.19,12.6),e.bezierCurveTo(14.35,12.49,14.5,10.65,13.44,10.41),e.bezierCurveTo(14.8,9.97,14.39,7.59,12.35,7.83),e.bezierCurveTo(11.42,7.77,9.87,7.94,9.68,7.62),e.bezierCurveTo(9.41,6.82,9.684,6.45,10.17,5.88),e.bezierCurveTo(10.5,5.46,11.02,4.6,11.04,3.64),e.bezierCurveTo(11.05,2.5,10.41,1.23,9.58,1.98),e.bezierCurveTo(9.38,2.21,9.36,3.47,8.94,4.02),e.bezierCurveTo(8.09,5.52,7.3,5.66,6.95,6.15),e.bezierCurveTo(6.27,6.86,4.93,9.52,4.36,9.52),e.bezierCurveTo(3.98,9.52,3.243,9.52,3.24,9.52),e.bezierCurveTo(3.12,9.52,3.08,8.98,3.22,8.95),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}function ns(e,t){e.save(),e.translate(t.x,t.y),e.lineWidth=.05;let n=Math.min(t.width,t.height)/18;e.scale(n,n),e.lineCap=`butt`,e.save(),e.save(),e.beginPath(),e.moveTo(14.77,9.04),e.lineTo(13.82,9.04),e.bezierCurveTo(13.27,9.18,12.09,11.55,11.54,12.17),e.bezierCurveTo(11.12,12.66,10.34,12.9,9.52,14.29),e.bezierCurveTo(8.88,15.21,9.62,16.51,7.93,16.82),e.bezierCurveTo(7.1,16.98,6.13,15.39,6.42,13.88),e.bezierCurveTo(6.51,13.4,6.75,12.855,6.93,12.46),e.bezierCurveTo(7.37,11.49,7.95,11.41,7.82,10.76),e.bezierCurveTo(7.02,10.75,6.21,10.68,5.33,10.73),e.bezierCurveTo(3.66,10.83,2.44,8.91,3.57,7.62),e.bezierCurveTo(3.09,6.88,3.2,5.67,3.85,5.19),e.bezierCurveTo(3.57,4.42,3.74,3.55,4.33,3.2),e.bezierCurveTo(3.87,1.22,5.64,1.13,6.22,1.16),e.lineTo(13.35,1.16),e.bezierCurveTo(14.12,1.22,14.04,1.71,14.49,1.73),e.bezierCurveTo(14.6,1.73,14.7,1.73,14.7,1.73),e.bezierCurveTo(14.82,1.74,14.8,2.29,14.72,2.3),e.bezierCurveTo(14.63,2.31,14.39,2.32,14.12,2.28),e.bezierCurveTo(13.96,2.21,13.6,1.74,13.25,1.73),e.lineTo(5.88,1.73),e.bezierCurveTo(4.86,1.73,4.33,2.88,5.19,3.44),e.bezierCurveTo(4.14,3.47,4.01,5.02,4.8,5.39),e.bezierCurveTo(3.64,5.5,3.49,7.35,4.55,7.58),e.bezierCurveTo(3.19,8.02,3.6,10.4,5.64,10.16),e.bezierCurveTo(6.57,10.23,8.12,10.05,8.32,10.37),e.bezierCurveTo(8.58,11.17,8.32,11.54,7.82,12.11),e.bezierCurveTo(7.49,12.54,6.97,13.39,6.96,14.36),e.bezierCurveTo(6.94,15.49,7.59,16.76,8.41,16.01),e.bezierCurveTo(8.62,15.78,8.63,14.52,9.05,13.97),e.bezierCurveTo(9.9,12.47,10.69,12.33,11.04,11.84),e.bezierCurveTo(11.72,11.13,13.06,8.47,13.637,8.47),e.bezierCurveTo(14.01,8.47,14.75,8.47,14.75,8.47),e.bezierCurveTo(14.87,8.47,14.91,9.01,14.77,9.04),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}function rs(e,t){e.save(),e.translate(t.x,t.y);let n=Math.min(t.width,t.height)/560;e.scale(n,n),e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=4,e.save(),e.save(),e.miterLimit=10,e.beginPath(),e.moveTo(377.8,354.8),e.bezierCurveTo(377.8,354.8,401.8,517.8,290.6,507),e.bezierCurveTo(173.2,495.5,171.5,50.39,171.5,50.39),e.bezierCurveTo(171.5,50.39,191.7,252.59,212.3,351),e.bezierCurveTo(212.3,351,230.9,472.8,286.7,488.7),e.bezierCurveTo(350.4,507,369.5,452.7,377.8,354.79),e.closePath(),e.fill(),e.restore(),e.save(),e.miterLimit=10,e.beginPath(),e.moveTo(378.3,351.1),e.lineTo(341.1,446.6),e.lineTo(371.2,436.7),e.lineTo(378.3,351.1),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}function is(){let e=$().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?Xe(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}var as=(e,t)=>!0,os=(e,t)=>e.map((e,n)=>({shown:t(e,n),value:e,line:{width:1,color:ss(n),dashStyle:`Solid`}})),ss=e=>Ae(gs,e),cs=e=>e.filter(e=>e.shown),ls={width:1,color:`#000`,dashStyle:`Solid`},us={width:1,color:`rgba(136,136,136,0.75)`,dashStyle:`Dash`},ds={color:B.COLOR_TRANSPARENT},fs={[B.AT_SINGLE_STYLE]:!0,[B.AT_SHOW_BACKGROUND]:!1};function ps(e,t){let n=F(rt(e,ls,`annotationTraits`,`line`)),r=F(rt(e,us,`annotationTraits`,`line2`)),i=F(rt(e,ds,`annotationTraits`,`fill`)),a=Bs[t],o=a?.defaults||{};$().config.colorfulAnnotations||(lt(o,fs),(t===`GannBox`||t===`GannSquare`)&&(o[B.AT_SHOW_BACKGROUND]=!0));let s=a?.editable.includes(B.AT_LINE_2),c=P(o[B.AT_LINE_2]),l={line:n,fill:i,...o};return s&&!c&&(l.line2=r),l}function ms(e,t){Object.keys(t).forEach(n=>{n===B.LINE_DASH_PROP_NAME?e.setLineDash(t[n]):e[n]=t[n]})}function hs(e){let t=le(vo,So);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:lo(e.line.dashStyle)}}var gs=[`rgba(121, 123, 133, 1)`,`rgba(223,72,76,1)`,`rgba(145,197,138,1)`,`rgba(103,173,92,1)`,`rgba(69,151,130,1)`,`rgba(120,179,241,1)`,`rgba(121,123,133,1)`,`rgba(56,97,246,1)`,`rgba(243,171,71,1)`,`rgba(144,49,170,1)`,`rgba(214,56,101,1)`,`rgba(175,108,195,1)`],_s=[B.AT_LINE,B.AT_ALLOW_PRICES_CHANGE_UI],vs=[B.AT_FILL,B.AT_ALLOW_PRICES_CHANGE_UI],ys=[B.AT_LINE,B.AT_FILL,B.AT_ALLOW_PRICES_CHANGE_UI],bs=[...ys,B.AT_FILL_TEXT],xs=[B.AT_TEXT_LINES,B.AT_FILL,B.AT_ALLOW_PRICES_CHANGE_UI],Ss=[..._s,B.AT_LINE_2,B.AT_SHOW_PRICES,B.AT_SHOW_LEVELS,B.AT_LEVELS_KIND,B.AT_LABELS,B.AT_EXTEND_LEFT,B.AT_EXTEND_RIGHT,B.AT_SHOW_TRENDLINE,B.AT_FACTORS,B.AT_PRICES_ON_SCALE,B.AT_REVERSE,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY,B.AT_LEVELS_RESPECT_LOG_SCALE],Cs=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],ws=e=>({[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_PRICES]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_EXTEND_LEFT]:!1,[B.AT_EXTEND_RIGHT]:!1,[B.AT_SHOW_TRENDLINE]:!0,[B.AT_FACTORS]:os(Cs.slice(2),(t,n)=>0<=t&&t<=e),[B.AT_PRICES_ON_SCALE]:!1,[B.AT_REVERSE]:!1,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),Ts=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_SHOW_TRENDLINE,type:`bool`},{id:B.AT_LINE_2,type:`line`,enabledIf:B.AT_SHOW_TRENDLINE},{id:B.AT_EXTEND_LEFT,type:`bool`},{id:B.AT_EXTEND_RIGHT,type:`bool`},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`},{id:B.AT_SHOW_PRICES,type:`bool`},{id:B.AT_PRICES_ON_SCALE,type:`bool`},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LEVELS_KIND,type:`string`,enum:[B.AT_LEVELS_PERCENTS,B.AT_LEVELS_VALUES],enabledIf:B.AT_SHOW_LEVELS},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]},{id:B.AT_LEVELS_RESPECT_LOG_SCALE,type:`bool`}],Es={[B.AT_LINE]:{color:`#3861f6`,width:1,dashStyle:`Solid`},[B.AT_FILL]:{color:`rgba(56, 97, 246, 0.2)`},[B.AT_FILL_TEXT]:{color:`#f0f0f0`},[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},Ds=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_FILL,type:`color`},{id:B.AT_FILL_TEXT,type:`color`}],Os=[0,.25,.382,.5,.618,.75,1],ks=[`8x1`,`5x1`,`4x1`,`3x1`,`2x1`,`1x1`,`1x2`,`1x3`,`1x4`,`1x5`,`1x8`],As=[`1x0`,`1x1`,`1.5x0`,`2x0`,`2x1`,`3x0`,`3x1`,`4x0`,`4x1`,`5x0`,`5x1`],js=[0,1,2,3,5,8,13,21,34,55,89,144],Ms=[8,4,3,2,1].map(e=>`1/${e}`).concat([2,3,4,8].map(e=>`${e}/1`)),Ns=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_SHOW_PRICES,type:`bool`},{id:B.AT_RATIO,type:`bool`},{id:B.AT_SHOW_PERCENTDIFF,type:`bool`},{id:B.AT_SHOW_BARCOUNT,type:`bool`},{id:B.AT_EXTEND_PT_1,type:`bool`},{id:B.AT_EXTEND_PT_2,type:`bool`},{id:B.AT_MARKER,type:`object`,properties:[{id:B.AT_KIND,type:`string`,enum:[B.AT_ARROW]},{id:B.AT_VERTEX,type:`string`,enum:[B.AT_VERTEX_NONE,B.AT_VERTEX_START,B.AT_VERTEX_END,B.AT_VERTEX_BOTH]}]}],Ps=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`}],Fs=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_FILL,type:`color`}],Is=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_FILL,type:`color`},{id:B.AT_FILL2,type:`color`},{id:B.AT_FILL_TEXT,type:`color`},{id:B.AT_COMPACT,type:`bool`},{id:B.AT_ACCOUNT_SIZE,type:`number`},{id:B.AT_RISK,type:`number`},{id:B.AT_RISK_IS_PERCENT,type:`bool`}],Ls=[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_FILL,type:`color`}],Rs={[B.AT_KIND]:B.AT_ARROW,[B.AT_VERTEX]:B.AT_VERTEX_NONE},zs=[B.AT_LINE,B.AT_RATIO,B.AT_SHOW_PRICES,B.AT_ALLOW_PRICES_CHANGE_UI,B.AT_SHOW_BARCOUNT,B.AT_SHOW_PERCENTDIFF,B.AT_EXTEND_PT_1,B.AT_EXTEND_PT_2,B.AT_MARKER],Bs={Line:{editable:zs,defaults:{[B.AT_SHOW_PRICES]:!1,[B.AT_SHOW_BARCOUNT]:!1,[B.AT_SHOW_PERCENTDIFF]:!1,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!1,[B.AT_MARKER]:Rs,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Ns,numPoints:2},Ray:{editable:zs,defaults:{[B.AT_SHOW_PRICES]:!1,[B.AT_SHOW_BARCOUNT]:!1,[B.AT_SHOW_PERCENTDIFF]:!1,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!0,[B.AT_MARKER]:Rs,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Ns,numPoints:2},VerticalLine:{editable:[B.AT_LINE,B.AT_SHOW_TIMESTAMPS,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_SHOW_TIMESTAMPS]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_SHOW_TIMESTAMPS,type:`bool`}],numPoints:1},HorizontalLine:{editable:[B.AT_LINE,B.AT_SHOW_PRICES,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_SHOW_PRICES]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_LINE,type:`line`},{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:1},TrendChannel:{editable:[..._s,B.AT_EXTEND_PT_1,B.AT_EXTEND_PT_2],defaults:{[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!1,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...Ps,{id:B.AT_EXTEND_PT_1,type:`bool`},{id:B.AT_EXTEND_PT_2,type:`bool`}],numPoints:3},GannLine:{editable:zs,defaults:{[B.AT_SHOW_PRICES]:!1,[B.AT_SHOW_BARCOUNT]:!1,[B.AT_SHOW_PERCENTDIFF]:!1,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!0,[B.AT_MARKER]:Rs,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Ns,numPoints:2},SpeedResistanceArcs:{editable:_s,types:Ps,numPoints:2},SpeedResistanceFan:{editable:_s,types:Ps,numPoints:2},AndrewsPitchfork:{editable:_s,types:Ps,numPoints:3},Rectangle:{editable:ys,types:Fs,numPoints:2},Ellipse:{editable:ys,types:Fs,numPoints:2},DateRange:{editable:bs,defaults:Es,types:Ds,numPoints:2},PriceRange:{editable:bs,defaults:Es,types:Ds,numPoints:2},DatePriceRange:{editable:[...bs,B.AT_DRAW_BORDER],defaults:{...Es,[B.AT_DRAW_BORDER]:!1},types:[...Ds,{id:B.AT_DRAW_BORDER,type:`bool`}],numPoints:2},GannBox:{editable:[B.AT_LINE,B.AT_LINE_2,B.AT_ALLOW_PRICES_CHANGE_UI,B.AT_PRICE_LEVELS,B.AT_TIME_LEVELS,B.AT_SHOW_LEFT_LABELS,B.AT_SHOW_RIGHT_LABELS,B.AT_SHOW_TOP_LABELS,B.AT_SHOW_BOTTOM_LABELS,B.AT_SHOW_ANGLES,B.AT_REVERSE,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_LINE]:{color:`#33776b`,width:1,dashStyle:`Solid`},[B.AT_LINE_2]:{color:`#33776b`,width:1,dashStyle:`Solid`},[B.AT_PRICE_LEVELS]:os(Os,as),[B.AT_TIME_LEVELS]:os(Os,as),[B.AT_SHOW_LEFT_LABELS]:!0,[B.AT_SHOW_RIGHT_LABELS]:!0,[B.AT_SHOW_TOP_LABELS]:!0,[B.AT_SHOW_BOTTOM_LABELS]:!0,[B.AT_SHOW_ANGLES]:!1,[B.AT_REVERSE]:!1,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_PRICE_LEVELS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_LEFT_LABELS,type:`bool`},{id:B.AT_SHOW_RIGHT_LABELS,type:`bool`},{id:B.AT_TIME_LEVELS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_TOP_LABELS,type:`bool`},{id:B.AT_SHOW_BOTTOM_LABELS,type:`bool`},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`},{id:B.AT_SHOW_ANGLES,type:`bool`},{id:B.AT_LINE_2,type:`line`,enabledIf:B.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[..._s,B.AT_LEVELS,B.AT_FANS,B.AT_ARCS,B.AT_REVERSE,B.AT_SHOW_RANGES_RATIO,B.AT_PRICE_BAR_RATIO,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_LINE]:{color:`#712b9c`,width:1,dashStyle:`Solid`},[B.AT_LEVELS]:os([0,1,2,3,4,5],as),[B.AT_FANS]:os(ks,(e,t)=>t>3&&t<7),[B.AT_ARCS]:os(As,as),[B.AT_REVERSE]:!1,[B.AT_SHOW_RANGES_RATIO]:!0,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_LEVELS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_FANS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_ARCS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`},{id:B.AT_PRICE_BAR_RATIO,type:`number`,editable:!0},{id:B.AT_SHOW_RANGES_RATIO,type:`bool`}],numPoints:2},LongPosition:{editable:[B.AT_LINE,B.AT_FILL,B.AT_FILL2,B.AT_FILL_TEXT,B.AT_COMPACT,B.AT_ACCOUNT_SIZE,B.AT_RISK,B.AT_RISK_IS_PERCENT,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_FILL]:{color:`rgba(0, 160, 0, 0.2)`},[B.AT_FILL2]:{color:`rgba(205, 0, 0, 0.2)`},[B.AT_FILL_TEXT]:{color:`#fff`},[B.AT_COMPACT]:!1,[B.AT_ACCOUNT_SIZE]:1e3,[B.AT_RISK]:25,[B.AT_RISK_IS_PERCENT]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Is,numPoints:4},ShortPosition:{editable:[B.AT_LINE,B.AT_FILL,B.AT_FILL2,B.AT_FILL_TEXT,B.AT_COMPACT,B.AT_ACCOUNT_SIZE,B.AT_RISK,B.AT_RISK_IS_PERCENT,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_FILL]:{color:`rgba(205, 0, 0, 0.2)`},[B.AT_FILL2]:{color:`rgba(0, 160, 0, 0.2)`},[B.AT_FILL_TEXT]:{color:`#fff`},[B.AT_COMPACT]:!1,[B.AT_ACCOUNT_SIZE]:1e3,[B.AT_RISK]:25,[B.AT_RISK_IS_PERCENT]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Is,numPoints:4},FiftyPercentLine:{editable:[B.AT_USE_52WEEK_PRICES,B.AT_LINE,B.AT_LINE_2,B.AT_SHOW_PRICES,B.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[B.AT_USE_52WEEK_PRICES]:!1,[B.AT_SHOW_PRICES]:!0,[B.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_USE_52WEEK_PRICES,type:`bool`},{id:B.AT_LINE,type:`line`},{id:B.AT_LINE_2,type:`line`},{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:2},FibonacciRetracement:{editable:Ss,defaults:ws(1),types:Ts,numPoints:2},TrendBasedFibExtension:{editable:Ss,defaults:ws(5),types:Ts,numPoints:3},FibonacciFan:{editable:[..._s,B.AT_SHOW_LEVELS,B.AT_LABELS,B.AT_FACTORS,B.AT_REVERSE,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_REVERSE]:!1,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_FACTORS]:os(Cs.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_REVERSE,type:`bool`}],numPoints:2},FibonacciArcs:{editable:[..._s,B.AT_LINE_2,B.AT_SHOW_TRENDLINE,B.AT_FACTORS,B.AT_SHOW_LEVELS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_TRENDLINE]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_FACTORS]:os(Cs.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_SHOW_TRENDLINE,type:`bool`},{id:B.AT_LINE_2,type:`line`,enabledIf:B.AT_SHOW_TRENDLINE},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_LEVELS,type:`bool`}],numPoints:2},FibonacciChannel:{editable:[..._s,B.AT_SHOW_PRICES,B.AT_SHOW_LEVELS,B.AT_LEVELS_KIND,B.AT_LABELS,B.AT_EXTEND_PT_1,B.AT_EXTEND_PT_2,B.AT_FACTORS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_PRICES]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_EXTEND_PT_1]:!1,[B.AT_EXTEND_PT_2]:!1,[B.AT_FACTORS]:os(Cs.slice(2),as),[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_EXTEND_PT_1,type:`bool`},{id:B.AT_EXTEND_PT_2,type:`bool`},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_PRICES,type:`bool`},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LEVELS_KIND,type:`string`,enum:[B.AT_LEVELS_PERCENTS,B.AT_LEVELS_VALUES],enabledIf:B.AT_SHOW_LEVELS},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[..._s,B.AT_ANGLES,B.AT_SHOW_LEVELS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2,[B.AT_ANGLES]:os(Ms,as)},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_ANGLES,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`string`,editable:!1,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_LEVELS,type:`bool`}],numPoints:2},SymbolArrowUp:{editable:vs,types:Ls,numPoints:1},SymbolArrowDown:{editable:vs,types:Ls,numPoints:1},SymbolArrowRight:{editable:vs,types:Ls,numPoints:1},SymbolArrowLeft:{editable:vs,types:Ls,numPoints:1},SymbolArrowHorizontal:{editable:vs,types:Ls,numPoints:1},SymbolArrowVertical:{editable:vs,types:Ls,numPoints:1},SymbolArcDown:{editable:vs,types:Ls,numPoints:1},SymbolArcUp:{editable:vs,types:Ls,numPoints:1},SymbolThumbsUp:{editable:vs,types:Ls,numPoints:1},SymbolThumbsDown:{editable:vs,types:Ls,numPoints:1},SymbolZero:{editable:vs,types:Ls,numPoints:1},SymbolOne:{editable:vs,types:Ls,numPoints:1},SymbolTwo:{editable:vs,types:Ls,numPoints:1},SymbolThree:{editable:vs,types:Ls,numPoints:1},SymbolFour:{editable:vs,types:Ls,numPoints:1},SymbolFive:{editable:vs,types:Ls,numPoints:1},SymbolSix:{editable:vs,types:Ls,numPoints:1},SymbolSeven:{editable:vs,types:Ls,numPoints:1},SymbolEight:{editable:vs,types:Ls,numPoints:1},SymbolNine:{editable:vs,types:Ls,numPoints:1},SymbolQuestion:{editable:vs,types:Ls,numPoints:1},SymbolFishHook:{editable:vs,types:Ls,numPoints:1},SymbolLetterB:{editable:vs,types:Ls,numPoints:1},SymbolLetterS:{editable:vs,types:Ls,numPoints:1},SymbolLetterA:{editable:vs,types:Ls,numPoints:1},SymbolLetterC:{editable:vs,types:Ls,numPoints:1},SymbolLetterD:{editable:vs,types:Ls,numPoints:1},SymbolLetterE:{editable:vs,types:Ls,numPoints:1},FibonacciTimeZones:{editable:[..._s,B.AT_FACTORS,B.AT_SHOW_LEVELS,B.AT_LABELS,B.AT_SINGLE_STYLE,B.AT_SHOW_BACKGROUND,B.AT_BACKGROUND_OPACITY],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!0,[B.AT_FACTORS]:os(js,as),[B.AT_SHOW_LEVELS]:!0,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_SINGLE_STYLE]:!1,[B.AT_SHOW_BACKGROUND]:!0,[B.AT_BACKGROUND_OPACITY]:.2},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_SINGLE_STYLE,type:`bool`},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SINGLE_STYLE},{id:B.AT_FACTORS,type:`array`,items:{ref:B.AT_FACTOR_ITEM}},{id:B.AT_FACTOR_ITEM,type:`object`,properties:[{id:B.AT_SHOWN,type:`bool`,label:!1},{id:B.AT_VALUE,type:`number`,editable:!0,enabledIf:B.AT_SHOWN},{id:B.AT_LINE,type:`line`,enabledIf:B.AT_SHOWN}]},{id:B.AT_SHOW_BACKGROUND,type:`bool`},{id:B.AT_BACKGROUND_OPACITY,type:`number`,min:0,max:1,enabledIf:B.AT_SHOW_BACKGROUND},{id:B.AT_SHOW_LEVELS,type:`bool`},{id:B.AT_LABELS,type:`string`,enum:[B.AT_LABELS_LEFT,B.AT_LABELS_CENTER,B.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:xs,types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_TEXT_LINES,type:`array`,items:{ref:B.AT_TEXT_ITEM}},{id:B.AT_TEXT_ITEM,type:`string`},{id:B.AT_FILL,type:`color`}],numPoints:2},ProfitLoss:{editable:[...ys,B.AT_SHOW_PRICES,B.AT_NUM_CONTRACTS,B.AT_POSITION,B.AT_PROFIT_LOSS],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!1,[B.AT_SHOW_PRICES]:!0,[B.AT_NUM_CONTRACTS]:1,[B.AT_POSITION]:B.AT_POSITION_LONG,[B.AT_PROFIT_LOSS]:void 0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_PROFIT_LOSS,type:`number`,editable:!1},{id:B.AT_NUM_CONTRACTS,type:`number`},{id:B.AT_POSITION,type:`string`,enum:[B.AT_POSITION_SHORT,B.AT_POSITION_LONG]},...Fs,{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:2},RewardRisk:{editable:[...ys,B.AT_SHOW_PRICES,B.AT_NUM_CONTRACTS,B.AT_POSITION,B.AT_RISK,B.AT_REWARD,B.AT_RATIO],defaults:{[B.AT_ALLOW_PRICES_CHANGE_UI]:!1,[B.AT_SHOW_PRICES]:!0,[B.AT_NUM_CONTRACTS]:1,[B.AT_POSITION]:B.AT_POSITION_LONG,[B.AT_RISK]:void 0,[B.AT_REWARD]:void 0,[B.AT_RATIO]:void 0},types:[{id:B.AT_ALLOW_PRICES_CHANGE_UI,type:`bool`,hidden:!0},{id:B.AT_REWARD,type:`number`,editable:!1},{id:B.AT_RISK,type:`number`,editable:!1},{id:B.AT_RATIO,type:`number`,editable:!1},{id:B.AT_NUM_CONTRACTS,type:`number`},{id:B.AT_POSITION,type:`string`,enum:[B.AT_POSITION_SHORT,B.AT_POSITION_LONG]},...Fs,{id:B.AT_SHOW_PRICES,type:`bool`}],numPoints:2}};function Vs(e){return e?Bs[e].editable:Bs}var Hs={$schema:`http://json-schema.org/draft-04/schema#`,title:`JSON schema for Barchart HTML5 Charts`,definitions:JSON.parse(`{"color":{"type":"string","pattern":"^(#([0-9a-fA-F]{3}){1,2})|(rgba\\\\((\\\\s*\\\\d{1,3}\\\\s*,){3}\\\\s*[01]+(\\\\.\\\\d+)?\\\\))|(rgb\\\\((\\\\s*\\\\d{1,3}\\\\s*)(,\\\\s*\\\\d{1,3}\\\\s*){2}\\\\))$"},"orientationChoice":{"type":"string","enum":["vertical","horizontal","both","none"]},"dashStyle":{"type":"string","enum":["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","SparseDot","Dot","Dash","LongDash","DashDot","LongDashDot","LongDashDotDot"]},"aggUnit":{"type":"string","enum":["Tick","Intraday","Day","Week","Month","Quarter","Year"]},"aggSpec":{"type":"string","enum":["None","Nearest","Continue","PerCount","PerVolume","PerRange","PerSeconds","TopOfBook"]},"isoPeriod":{"type":"string","pattern":"^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$"},"period":{"type":"string","oneOf":[{"$ref":"#/definitions/isoPeriod"},{"enum":["YTD"]}]},"density":{"type":"integer","minimum":5},"precision":{"type":"integer","minimum":0},"curveAttr":{"type":"string","enum":["ChangeBased","OpenVsClose"]},"paddingPercent":{"type":"number","minimum":0.001,"maximum":0.999},"fundamental":{"type":"string","enum":["AccountsPayable","AccruedExpenses","Cash","CommonShares","SharesOutstanding","DeferredIncomeTax","DeferredLongRevenues","EquityOtherInvestments","IncomeTaxPayable","Intangibles","Inventories","LongTermDebt","MarketableSec","OtherCurrentAssets","OtherCurrentLiabilities","OtherEquity","OtherNonCurrentAssets","OtherNonCurrentLiabilities","PpeNet","PrepaidExpenses","Receivables","RetainedEarnings","ShorttermDebt","TotalAssets","TotalCurrentAssets","TotalCurrentLiabilities","TotalLiabilities","TotalLiabilitiesAndEquity","TotalNonCurrentAssets","TotalNonCurrentLiabilities","TotalShareholdersEquity","BasicEpsContOp","BasicEpsTotalOp","CostGoods","DilutedEpsContOp","DilutedEpsTotalOp","Ebitda","GrossProfit","IncomeTax","InterestExpense","NetIncome","OperatingExpenses","OperatingIncome","OtherIncomeExpenses","PreTaxIncome","Sales"]},"studyField":{"type":"string","enum":["HL/2","OC/2","HLC/3","OHLC/4","HLCC/4","AVG","MA","MA1","MA2","MA3","MA4","MA5","MA6","MA7","MA8","MA9","MA10","MAS","MAL","EMA","MAHI","MALO","MACD","MACDS","MACDH","MACDV","MACDVS","MACDVH","ENVU","ENVD","ENVEXPU","ENVEXPD","ENVSMOU","ENVSMOD","SMA","TMA","WMA","VOLMA","OSC","VOSC","RSI","RSIAVG","RSA","RSAAVG","STORSI","STORSIAVG","HH","LL","PercK","PercD","PercR","WGCL","BOLLBU","BOLLBL","BOLLBM","BOLLW","BOLLP","BOLLBW","BOLLBWA","OBVOL","OBVOLAVG","ATR","ADR","ADRP","ATRP","PDI","MDI","ADX","ADXM","ADL","ADWM","ADWMMA","CHAOSC","TP","KCUP","KCMID","KCLOW","KBUP","KBMID","KBLOW","DONUP","DONMID","DONLOW","DONW","PVT","ROC","TRIX","PVPT","PVPTR","PVPTS","ARNUP","ARNLOW","ARNOSC","TCHNUP","TCHNLOW","ALJAW","ALTEETH","ALLIPS","PLTLN","AWOS","AWOSMA","MFMUL","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","EMVMA","ERBLPOW","ERBRPOW","FI","MI","MOM","MOMMA","MFI","MSD","NVI","NVIEMA","PVI","PVIEMA","PPO","PPOS","PPOH","PVO","PVOS","PVOH","HV","PERF","WASI","WWVSARU","WWVSARD","PARSARS","PARSARL","MOVLR","TRSP1","TRSP2","TARGP","PPTPIV","PPTR1","PPTR2","PPTR3","PPTS1","PPTS2","PPTS3","COTLCCMSP","COTLCLGSP","COTLCSMSP","COTDAGPRO","COTDAGSPD","COTDAGMNM","COTDAGOTH","COTFTRDLI","COTFTRASM","COTFTRLVF","COTFTROTH","TR","IMPVOL","CTM","CPMI","CTLTM","CTLTMF","DEMA","EOSC","TEMA","TSI","TSISIG","ADJATR","COTR","GMMA3","GMMA5","GMMA8","GMMA10","GMMA12","GMMA15","GMMA30","GMMA35","GMMA40","GMMA45","GMMA50","GMMA60","MCGD","HMA","COPP","CPPH4","CPPH3","CPPH2","CPPH1","CPPL1","CPPL2","CPPL3","CPPL4","REATRS","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","ATRMA","STOMOMIX","CHDMOMOSC","CHDMOMOSCAVG","VSTOPUP","VSTOPLOW","SUPTR","BARCOLIX","BARKIND","CONVLN","BASELN","LEADSP1","LEADSP2","LAGGSP","VWAP","VWAPSD1U","VWAPSD1L","VWAPSD2U","VWAPSD2L","PLVI","MNVI","DIFA","DOSCH","DOSCS","TTMSQZON","TTMSQZOFF","TTMSQZOSC","CRS","CRSAVG","JPIB","JPIS","DRS","MRS","PMO","PMOS","RVOL","WGALPH","UPVOL","DNVOL","TOTVOL","POC","VAREA","BARBACK","AVWAP","KST","KSTSIG","STC","MCCLO","NHLAI","CMBCI","CMBCIF","CMBCIS","COTI","CHEXL","CHEXS","MBBUO","MBBUI","MBBM","MBBLI","MBBLO","CHOP","MACLD1","MACLD2","BTI","PCUP1","PCDN1","PCUP2","PCDN2","PCUP3","PCDN3","PCTD","PCTP","TDIPRC","TDITSL","TDIMBL","TDIUPR","TDILWR","PPS","FRAMA","FISHER","FISHTRG","RCI","RCISIG","ZZPIVOT","BOP","BOPAVG","CORR","RVI","RVISIG","ATREXTAVG","ATREXTUP","ATREXTLOW","DIDIS","DIDIL","DIDIUP","DIDIDN"]},"generalField":{"type":"string","enum":["DateTime","Open","High","Low","Close","TradeSize","Volume","OpenInterest","Last","Bid","BidSize","Ask","AskSize","Symbol","Change","PercentChange","TradingDay","PreviousOpen","PreviousClose","PreviousHigh","PreviousLow","WeekPreviousClose","WeekPreviousHigh","WeekPreviousLow","MonthPreviousClose","MonthPreviousHigh","MonthPreviousLow","YearHigh","YearLow","Projection","BarIndex"]},"optionField":{"type":"string","enum":["Call","Put","WeighImplVolHigh","WeighImplVolLow","WeighImplVol","WeighImplVolHigh5D","WeighImplVolLow5D","WeighImplVol5D","WeighImplVolHigh1M","WeighImplVolLow1M","WeighImplVol1M","WeighImplVolHigh3M","WeighImplVolLow3M","WeighImplVol3M","WeighImplVolHigh6M","WeighImplVolLow6M","WeighImplVol6M","WeighImplVolHigh1Y","WeighImplVolLow1Y","WeighImplVol1Y","WeighImplVolHighYTD","WeighImplVolLowYTD","WeighImplVolYTD","WeighImplVolChg","ImplVolRank5D","ImplVolRank1M","ImplVolRank3M","ImplVolRank6M","ImplVolRank1Y","ImplVolRankYTD","ImplVolPerc5D","ImplVolPerc1M","ImplVolPerc3M","ImplVolPerc6M","ImplVolPerc1Y","ImplVolPercYTD","OptTotVol","OptCallVol","OptPutVol","PutCallVolRatio","TotalOpenInt","CallOpenInt","PutOpenInt","PutCallOIRatio","CallIVCurve","PutIVCurve","CallTheoretical","PutTheoretical","Delta","Gamma","Theta","Vega"]},"previousField":{"type":"string","enum":["PreviousOpen","PreviousClose","PreviousHigh","PreviousLow"]},"eventField":{"type":"string","enum":["Dividends","Splits","Earnings","Buy","Sell","Custom"]},"curveField":{"anyOf":[{"$ref":"#/definitions/generalField"},{"$ref":"#/definitions/studyField"},{"$ref":"#/definitions/fundamental"},{"$ref":"#/definitions/optionField"}]},"curveStyle":{"type":"string","enum":["OHLC","Line","Candlestick","Area","Column","Dots","HLC","HL","Ribbon","Step","HollowCandles","HeikinAshi","ElderImpulseSystem","Renko","Range","LineBreak","Kagi","PointAndFigure","Baseline","PercentChange","MultiColumn","StackedColumn"]},"paneHeight":{"type":"number","minimum":0.01},"plotPlacement":{"type":"string","enum":["WithSeries","TimeAxis"],"default":"WithSeries"},"comparison":{"type":"string","enum":["None","Value","Percent"],"default":"None"},"scale":{"type":"string","enum":["Linear","Logarithmic"],"default":"Linear"},"study":{"type":"string","enum":["MA","MACROSS","PACROSS","MAEXP","MAHLC","MACD","MACDEXP","MACDV","VOL","MAENV","MAENVEXP","MAENVSMO","MASMO","MATRI","MAWEI","MAVOL","OSCI","OSCIVOL","RSI","RSIMOD","RSISTO","RSA","STOCHF","STOCHS","WPERCR","HHLL","WGCL","BBANDS","BWIDTH","BPERC","BBANDW","OBVOL","ATR","ADR","ADRP","ATRP","ADX","ADXMOD","ADL","ADWM","CHAOSC","TP","KELCHN","KELBND","DONCHN","DONWIDTH","PVT","ROC","TRIX","PPMOV","ARNUPDW","ARNOSC","TCHN","ALLG","PLTLN","AWEOSC","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","ERBLPOW","ERBRPOW","FI","MI","MOM","MFI","MSD","NVI","PVI","PPO","PVO","HV","PERF","WASI","WWVOL","PARTP","MOVLR","TRSP","TARGP","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","EOSC","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRS","LINRCHN","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","OPINT","STOMOMIX","CHDMOMOSC","VSTOP","SUPTR","ICHCLD","VWAP","VOIN","DIFA","DOSC","MARIB","HASMO","TTMSQZ","CRS","JPI","CTTP","CTTI","DRS","MRS","PMO","RVOL","WGALPH","VOLAP","AVWAP","KST","STC","MCCLO","NHLAI","CMBCI","COTI","CHEXI","MBBANDS","OPTIV","IVRANK","IVPCTL","OPTVOLPC","OPTOIPC","OPTVOL","OPTOI","CHOP","MACLD","BTI","PC","GREEKS","PVACP","TDI","PPS","FRAMA","FISHER","RCI","ZIGZAG","BOP","CORR","RVI","ATREXT","DIDI"]},"annId":{"type":"string","enum":["Line","Ray","GannLine","VerticalLine","HorizontalLine","FiftyPercentLine","LongPosition","ShortPosition","FibonacciRetracement","TrendBasedFibExtension","FibonacciFan","FibonacciArcs","FibonacciChannel","GannFan","SpeedResistanceFan","SpeedResistanceArcs","AndrewsPitchfork","Rectangle","Ellipse","TrendChannel","SymbolArrowUp","SymbolArrowDown","SymbolArrowRight","SymbolArrowLeft","SymbolArrowHorizontal","SymbolArrowVertical","SymbolArcDown","SymbolArcUp","SymbolThumbsUp","SymbolThumbsDown","SymbolZero","SymbolOne","SymbolTwo","SymbolThree","SymbolFour","SymbolFive","SymbolSix","SymbolSeven","SymbolEight","SymbolNine","SymbolQuestion","SymbolFishHook","SymbolLetterA","SymbolLetterB","SymbolLetterS","SymbolLetterC","SymbolLetterD","SymbolLetterE","FibonacciTimeZones","Text","ProfitLoss","RewardRisk","DateRange","PriceRange","DatePriceRange","GannBox","GannSquare"]},"aggregation":{"type":"object","additionalProperties":false,"properties":{"size":{"type":"integer","minimum":1,"multipleOf":1,"default":1},"unit":{"$ref":"#/definitions/aggUnit","default":"Day"},"spec":{"$ref":"#/definitions/aggSpec","default":"None"},"isContractVolume":{"type":"boolean","default":false},"dividendsAdjust":{"type":"boolean","default":false},"backAdjust":{"type":"boolean","default":false},"daysToExpiration":{"type":"integer","minimum":0,"maximum":60,"default":1},"contractRoll":{"type":"string","enum":["expiration","combined"],"default":"combined"}},"required":["unit"]},"gridLines":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean","default":true},"color":{"type":"string","default":"#d8d8d8"},"lineWidth":{"type":"number","default":1},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"range":{"type":"object","additionalProperties":false,"properties":{"from":{"type":"number"},"to":{"type":"number"}}},"crosshair":{"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean","default":true},"snap":{"type":"boolean","default":false},"showValue":{"type":"boolean","default":true},"color":{"$ref":"#/definitions/color","default":"#c0c0c0"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"},"format":{"type":"string"}}},"displayAxis":{"type":"object","properties":{"visible":{"type":"boolean","default":true},"gridLines":{"$ref":"#/definitions/gridLines"},"minorGridLines":{"$ref":"#/definitions/gridLines"},"textColor":{"$ref":"#/definitions/color","default":"#000"},"crosshair":{"$ref":"#/definitions/crosshair"},"fontSize":{"type":"number","default":12},"preventLabelOverlap":{"type":"boolean","default":false}}},"displayChart":{"type":"object","additionalProperties":false,"properties":{"backgroundColor":{"$ref":"#/definitions/color","default":"#fff"},"plotBorderColor":{"$ref":"#/definitions/color"},"fontFamily":{"type":"string","default":"\\"Lucida Grande\\", \\"Lucida Sans Unicode\\", Verdana, Arial, Helvetica, sans-serif"},"fontSize":{"type":"number","default":13},"previous":{"$ref":"#/definitions/previous"},"exportUrl":{"type":"string"},"showMinMaxArc":{"type":"boolean","default":true},"showGoToLatest":{"type":"boolean","default":false},"showLegend":{"type":"boolean"},"showNoDataText":{"type":"boolean"},"newPaneHeight":{"$ref":"#/definitions/paneHeight","default":1},"plotHover":{"type":"boolean","default":false},"bar":{"$ref":"#/definitions/barMetrics"},"zooming":{"$ref":"#/definitions/orientationChoice","default":"both"},"studyBasisFocus":{"type":"boolean"}}},"barMetrics":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number"},"spacing":{"type":"number"}}},"previous":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color","default":"#888"},"lineWidth":{"type":"number","minimum":1,"default":1},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"},"forceVisible":{"type":"boolean","default":false},"field":{"$ref":"#/definitions/previousField","default":"PreviousClose"}}},"scrollbar":{"type":"object","additionalProperties":false,"properties":{"barColor":{"$ref":"#/definitions/color","default":"#bfc8d1"},"buttonColor":{"$ref":"#/definitions/color","default":"#ebe7e8"},"trackColor":{"$ref":"#/definitions/color","default":"#eee"},"visible":{"type":"boolean","default":true}}},"tooltip":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean","default":true},"mode":{"type":"string","enum":["standard","cards","bubble","external"],"default":"standard"},"showMainPlot":{"type":"boolean","default":false},"backgroundColor":{"$ref":"#/definitions/color","default":"rgba(255, 255, 255, 0.85)"},"borderColor":{"$ref":"#/definitions/color","default":"#000"},"hideSymbols":{"type":"boolean"},"revealingClose":{"type":"boolean"},"showMainTitle":{"type":"boolean","default":true},"mainTitle":{"type":"string","enum":["Name","Description"],"default":"Name"}}},"data":{"type":"object","additionalProperties":false,"properties":{"aggregation":{"$ref":"#/definitions/aggregation"},"maxDataPoints":{"type":"number"},"range":{"$ref":"#/definitions/range"},"checkRange":{"type":"boolean"},"exprSkipLeadingEmpty":{"type":"boolean"},"useLastTrade":{"type":"boolean","default":false},"extendedHours":{"type":"boolean"},"realTimeCboeBzx":{"type":"boolean"},"buildContinuation":{"type":"boolean"}},"required":["aggregation"]},"display":{"type":"object","additionalProperties":false,"properties":{"period":{"$ref":"#/definitions/period"},"density":{"$ref":"#/definitions/density"},"chart":{"$ref":"#/definitions/displayChart"},"scrollbar":{"$ref":"#/definitions/scrollbar"},"scrollBehavior":{"type":"string","enum":["wheel","wheel+shift","none"],"default":"wheel"},"tooltip":{"$ref":"#/definitions/tooltip"},"yAxis":{"allOf":[{"$ref":"#/definitions/displayAxis"},{"properties":{"showLastValue":{"type":"string","enum":["None","All","Main"],"default":"All"},"includePercentChangeWithLastValue":{"type":"boolean","default":false},"snapAnnotationsToPrices":{"type":"boolean","default":false},"minPaddingPercent":{"$ref":"#/definitions/paddingPercent"},"maxPaddingPercent":{"$ref":"#/definitions/paddingPercent"},"primaryOnTheLeft":{"type":"boolean"}}}]},"xAxis":{"allOf":[{"$ref":"#/definitions/displayAxis"},{"properties":{"format":{"type":"string","minLength":1},"minTickInterval":{"type":"number","default":0},"tickPixelInterval":{"type":"number","default":0},"visibleRange":{"$ref":"#/definitions/range"},"position":{"type":"string","enum":["bottom","top","both"],"default":"bottom"},"equidistant":{"type":"boolean","default":true},"marginBars":{"type":"number","minimum":0,"default":0},"zoom":{"type":"number","default":0},"resizeHandles":{"type":"boolean","default":false},"forceTicksVisible":{"type":"boolean"},"panning":{"type":"boolean"},"isOrdinal":{"type":"boolean"},"nonEodLabelWithDate":{"type":"boolean"},"ordinalName":{"type":"string"},"contractTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","fillColor":"rgba(119,119,119,0.1)","dashStyle":"LongDashDot"}},"cycleTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","fillColor":"rgba(119,119,119,0.1)","dashStyle":"ShortDashDot"}}}}]},"annotationTraits":{"$ref":"#/definitions/annTraits"},"curveTraits":{"type":"array","items":{"$ref":"#/definitions/curveTrait"}},"allAnnotationsLocked":{"type":"boolean","default":false},"hiddenItems":{"$ref":"#/definitions/hiddenItems","default":"None"}}},"hiddenItems":{"type":"string","enum":["None","Annotations","Studies","All"]},"curveZone":{"type":"object","additionalProperties":false,"properties":{"value":{"type":"number"},"colors":{"type":"number"},"gradient":{"type":"string","enum":["linLighten","linDarken"]}}},"curveNonStrict":{"type":"object","additionalProperties":false,"properties":{"attributes":{"type":"array","items":{"$ref":"#/definitions/curveAttr"}},"colors":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/color"}},"fields":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curveField"}},"style":{"$ref":"#/definitions/curveStyle","default":"Line"},"lineWidth":{"type":"number","default":2},"lineMarker":{"type":"string","enum":["Circle","Square","Diamond","TriangleUp","TriangleDown"]},"lineSmoothing":{"type":"integer"},"dashStyle":{"$ref":"#/definitions/dashStyle"},"varyColorPerBar":{"type":"boolean","default":false},"visible":{"type":"boolean","default":true},"zones":{"type":"array","items":{"$ref":"#/definitions/curveZone"}},"shift":{"type":"integer"}}},"curve":{"allOf":[{"$ref":"#/definitions/curveNonStrict"}],"required":["colors","fields"]},"plotEventDividends":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#037c27"},"title":{"type":"string","default":"D"}},"required":["show"]},"plotEventEarnings":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#08a0c9"},"title":{"type":"string","default":"E"}},"required":["show"]},"plotEventSplits":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#de7726"},"title":{"type":"string","default":"S"}},"required":["show"]},"plotEventCustom":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#be7404"},"title":{"type":"string","default":"C"}},"required":["show"]},"plotEvents":{"type":"object","additionalProperties":false,"properties":{"dividends":{"$ref":"#/definitions/plotEventDividends"},"earnings":{"$ref":"#/definitions/plotEventEarnings"},"splits":{"$ref":"#/definitions/plotEventSplits"},"custom":{"$ref":"#/definitions/plotEventCustom"},"placement":{"$ref":"#/definitions/plotPlacement","default":"WithSeries"}}},"fundamentalFrequency":{"type":"string","enum":["Quarter","Year"]},"numberInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"number"},"integer":{"type":"boolean","enum":[false]}}},"stringInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"string"}}},"input":{"type":"object","oneOf":[{"$ref":"#/definitions/integerInput"},{"$ref":"#/definitions/numberInput"},{"$ref":"#/definitions/stringInput"}]},"inputs":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/input"}},"curves":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curve"}},"uid":{"type":"string","minLength":1},"symbolType":{"type":"string","pattern":"Symbol"},"symbolPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"symbol":{"type":"string"},"events":{"$ref":"#/definitions/plotEvents"},"showPrevious":{"type":"boolean","default":false},"uid":{"$ref":"#/definitions/uid"},"type":{"$ref":"#/definitions/symbolType"},"main":{"type":"boolean","default":false},"inputs":{"$ref":"#/definitions/inputs"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","curves","symbol","type"]},"fundamentalType":{"type":"string","enum":["BalanceSheet","IncomeStatement"]},"fundamentalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"symbol":{"type":"string"},"fundamental":{"$ref":"#/definitions/fundamentalFrequency","default":"Quarter"},"uid":{"$ref":"#/definitions/uid"},"type":{"$ref":"#/definitions/fundamentalType"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","curves","symbol","type"]},"studyLevels":{"type":"array","items":{"$ref":"#/definitions/studyLevel"}},"studyLevel":{"type":"object","additionalProperties":false,"properties":{"value":{"type":"number"},"line":{"$ref":"#/definitions/lineTrait"},"name":{"type":"string"},"visible":{"type":"boolean","default":true}},"required":["value","line"]},"studyBands":{"type":"array","items":{"$ref":"#/definitions/studyBand"}},"studyBand":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"#/definitions/range"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["range","fill"]},"studyType":{"type":"string","pattern":"Study"},"studyBasisMain":{"type":"object","additionalProperties":false,"properties":{"kind":{"type":"string","enum":["main"]}},"required":["kind"]},"studyBasisSeasonal":{"type":"object","additionalProperties":false,"properties":{"kind":{"type":"string","enum":["seasonal"]},"uid":{"$ref":"#/definitions/uid"},"offset":{"type":"number"}},"required":["kind","uid","offset"]},"studyBasis":{"oneOf":[{"$ref":"#/definitions/studyBasisMain"},{"$ref":"#/definitions/studyBasisSeasonal"}]},"studyPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"basis":{"$ref":"#/definitions/studyBasis","default":{"kind":"main"}},"study":{"$ref":"#/definitions/study"},"uid":{"$ref":"#/definitions/uid"},"source":{"$ref":"#/definitions/curveField"},"inputs":{"$ref":"#/definitions/inputs"},"type":{"$ref":"#/definitions/studyType"},"levels":{"$ref":"#/definitions/studyLevels"},"bands":{"$ref":"#/definitions/studyBands"},"detachedScale":{"type":"boolean"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["uid","study","type"]},"exprType":{"type":"string","pattern":"Expression"},"exprPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"expression":{"type":"string"},"uid":{"$ref":"#/definitions/uid"},"type":{"$ref":"#/definitions/exprType"},"main":{"type":"boolean","default":false},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","expression","type"]},"forwardType":{"type":"string","pattern":"Forward"},"intOffset":{"type":"integer","multipleOf":1},"intOffsets":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/intOffset"}},"forwardPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"forward":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"uid":{"$ref":"#/definitions/uid"},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/forwardType"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","forward","type"]},"seasonalType":{"type":"string","pattern":"Seasonal"},"seasonalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"seasonal":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"uid":{"$ref":"#/definitions/uid"},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/seasonalType"},"precision":{"$ref":"#/definitions/precision"},"detachedScale":{"type":"boolean"},"visible":{"type":"boolean","default":true}},"required":["uid","seasonal","type"]},"annPoint":{"type":"object","additionalProperties":false,"properties":{"price":{"type":"number"},"time":{"type":"number"}},"required":["price","time"]},"lineTrait":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number","minimum":0,"default":1},"color":{"$ref":"#/definitions/color","default":"#000"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"transitionLine":{"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean"},"width":{"type":"number","minimum":1},"color":{"$ref":"#/definitions/color"},"fillColor":{"$ref":"#/definitions/color"},"dashStyle":{"$ref":"#/definitions/dashStyle"}}},"fillTrait":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color"}}},"markerTrait":{"type":"object","additionalProperties":false,"properties":{"vertex":{"enum":["start","end","both","none"]},"kind":{"enum":["arrow"],"default":"arrow"}},"required":["vertex"]},"curveTrait":{"type":"object","additionalProperties":false,"properties":{"curveStyle":{"$ref":"#/definitions/curveStyle"},"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["curveStyle"]},"annTraits":{"type":"object","additionalProperties":true,"properties":{"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"},"marker":{"$ref":"#/definitions/markerTrait"},"zIndex":{"type":"number","minimum":1}}},"annotation":{"type":"object","additionalProperties":false,"properties":{"id":{"$ref":"#/definitions/annId"},"uid":{"$ref":"#/definitions/uid"},"visible":{"type":"boolean","default":true},"locked":{"type":"boolean","default":false},"points":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/annPoint"}},"traits":{"$ref":"#/definitions/annTraits"}},"required":["id","uid","points"]},"plot":{"type":"object","oneOf":[{"$ref":"#/definitions/seasonalPlot"},{"$ref":"#/definitions/forwardPlot"},{"$ref":"#/definitions/exprPlot"},{"$ref":"#/definitions/symbolPlot"},{"$ref":"#/definitions/fundamentalPlot"},{"$ref":"#/definitions/studyPlot"}]},"annCacheEntry":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"},"annotations":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/annotation"}}},"required":["symbol","annotations"]},"axis":{"type":"object","additionalProperties":false,"properties":{"comparison":{"$ref":"#/definitions/comparison","default":"None"},"plots":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/plot"}},"annotations":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/annotation"}},"scale":{"$ref":"#/definitions/scale","default":"Linear"},"annCache":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/annCacheEntry"}},"label":{"type":"string"}},"required":["plots"]},"pane":{"type":"object","additionalProperties":false,"properties":{"axes":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/axis"}},"height":{"$ref":"#/definitions/paneHeight","default":1},"alignOnExpirations":{"type":"boolean","default":false}},"required":["axes"]},"integerInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"integer"},"integer":{"type":"boolean","enum":[true]}},"required":["name","value","integer"]}}`),type:`object`,additionalProperties:!1,properties:{data:{$ref:`#/definitions/data`},display:{$ref:`#/definitions/display`},panes:{type:`array`,minItems:1,items:{$ref:`#/definitions/pane`}},version:{type:`integer`,minimum:183,multipleOf:1}},required:[`panes`,`version`]},Us={$schema:`http://json-schema.org/draft-04/schema#`,title:`JSON schema for Barchart studies for HTML5 Charts`,definitions:{studyMetadata:{type:`object`,additionalProperties:!1,properties:{title:{type:`string`},overlay:{type:`boolean`,default:!0},decimals:{type:`number`},shiftable:{type:`boolean`},singleFieldBased:{type:`boolean`,default:!1},range:{type:`object`,additionalProperties:!1,properties:{min:{type:`number`},max:{type:`number`}}},enumerations:{type:`array`,minItems:1,items:{$ref:`#/definitions/enumeration`}}},required:[`title`]},enumeration:{type:`object`,additionalProperties:!1,properties:{input:{type:`string`},values:{type:`array`,items:{type:`string`}}}},studyDefaults:{type:`object`,additionalProperties:!1,properties:{curves:{$ref:`chart.schema.json#/definitions/curves`},source:{$ref:`chart.schema.json#/definitions/curveField`},inputs:{description:`Input defaults. Declare discrete numeric inputs with integer: true; their defaults must be integers.`,$ref:`chart.schema.json#/definitions/inputs`},levels:{$ref:`chart.schema.json#/definitions/studyLevels`},bands:{$ref:`chart.schema.json#/definitions/studyBands`}},required:[`curves`]},studyDefinition:{type:`object`,additionalProperties:!1,properties:{id:{$ref:`chart.schema.json#/definitions/study`},meta:{$ref:`#/definitions/studyMetadata`},defaults:{$ref:`#/definitions/studyDefaults`}},required:[`id`,`meta`,`defaults`]}},type:`array`,minItems:1,items:{$ref:`#/definitions/studyDefinition`}},Ws={$schema:`http://json-schema.org/draft-04/schema#`,title:`JSON schema for Barchart fields for HTML5 Charts`,definitions:{valueType:{type:`string`,enum:[`Number`,`String`,`Date`],default:`Number`},fieldCategory:{type:`string`,enum:[`Common`,`Study`,`BalanceSheet`,`IncomeStatement`,`Event`,`Option`],default:`Common`},fieldFormat:{type:`string`,enum:[`FromMetaData`,`AsInteger`,`UseMetricUnit`,`AsPercent`],default:`FromMetaData`},fieldDefinition:{type:`object`,additionalProperties:!1,properties:{id:{anyOf:[{$ref:`chart.schema.json#/definitions/curveField`},{$ref:`chart.schema.json#/definitions/eventField`}]},type:{$ref:`#/definitions/valueType`},category:{$ref:`#/definitions/fieldCategory`},name:{type:`string`,default:null},shortName:{type:`string`,default:null},format:{$ref:`#/definitions/fieldFormat`}},required:[`id`]}},type:`array`,minItems:1,items:{$ref:`#/definitions/fieldDefinition`}},Gs={$schema:`http://json-schema.org/draft-04/schema`,title:`JSON schema for the Barchart API of the HTML5 Charts`,definitions:JSON.parse(`{"curvesNonStrict":{"type":"array","maxItems":1,"items":{"$ref":"chart.schema.json#/definitions/curveNonStrict"}},"mainPlotSymbolContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"symbol":{"type":"string"}},"required":["symbol"]},"mainPlotExpressionContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"expression":{"type":"string"}},"required":["expression"]},"mainPlotForwardContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"forward":{"type":"string"}},"required":["forward"]},"mainPlotSeasonalContext":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"seasonal":{"type":"string"}},"required":["seasonal"]},"mainPlotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MainPlot"},"context":{"oneOf":[{"$ref":"#/definitions/mainPlotSymbolContext"},{"$ref":"#/definitions/mainPlotExpressionContext"},{"$ref":"#/definitions/mainPlotForwardContext"},{"$ref":"#/definitions/mainPlotSeasonalContext"}]}},"required":["id","context"]},"aggregationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Aggregation"},"context":{"$ref":"chart.schema.json#/definitions/aggregation"}},"required":["id","context"]},"periodContext":{"type":"object","additionalProperties":false,"properties":{"period":{"$ref":"chart.schema.json#/definitions/period"}},"required":["period"]},"rangeContext":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"chart.schema.json#/definitions/range"}},"required":["range"]},"densityContext":{"type":"object","additionalProperties":false,"properties":{"density":{"$ref":"chart.schema.json#/definitions/density"}},"required":["density"]},"periodAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Period"},"context":{"oneOf":[{"$ref":"#/definitions/periodContext"},{"$ref":"#/definitions/rangeContext"},{"$ref":"#/definitions/densityContext"}]}},"required":["id","context"]},"crosshairProperties":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"chart.schema.json#/definitions/color"},"dashStyle":{"$ref":"chart.schema.json#/definitions/dashStyle"}},"required":["color"]},"crosshairAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Crosshair"},"context":{"type":"object","additionalProperties":false,"properties":{"crosshair":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"horizontal":{"$ref":"#/definitions/crosshairProperties"},"vertical":{"$ref":"#/definitions/crosshairProperties"}},"required":["crosshair"]}},"required":["id","context"]},"tooltipAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Tooltip"},"context":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean"},"mode":{"type":"string","enum":["standard","cards","external"]}},"required":["visible"]}},"required":["id","context"]},"eventsAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Events"},"context":{"type":"object","additionalProperties":false,"properties":{"dividends":{"type":"boolean"},"earnings":{"type":"boolean"},"splits":{"type":"boolean"},"custom":{"type":"boolean"}}}},"required":["id","context"]},"axisPadding":{"type":"number","minimum":0.001,"maximum":1},"scaleAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Scale"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"scale":{"type":"string","enum":["Linear","Logarithmic"]},"marginBars":{"type":"number","minimum":0},"minPadding":{"$ref":"#/definitions/axisPadding"},"maxPadding":{"$ref":"#/definitions/axisPadding"},"preventLabelOverlap":{"type":"boolean"},"snapAnnotationsToPrices":{"type":"boolean"},"horizontalAxisPosition":{"type":"string","enum":["bottom","top","both"]},"primaryOnTheLeft":{"type":"boolean"}}}},"required":["id","context"]},"otherAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Other"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"useLastTrade":{"type":"boolean"},"percentChange":{"type":"boolean"},"comparisonMode":{"type":"string","enum":["None","Percent","Value"]},"showLastValue":{"type":"string","enum":["None","All","Main"]},"hiddenItems":{"$ref":"chart.schema.json#/definitions/hiddenItems"},"gridLines":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"minorGridLines":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"newPaneHeight":{"type":"number","minimum":0.01},"showNavigator":{"type":"boolean"},"plotHover":{"type":"boolean"}}}},"required":["id","context"]},"placement":{"type":"string","enum":["overlay","standalone","withMain","clone"]},"plotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Plot"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Add","Get","Delete","Update"]},"type":{"type":"string","enum":["Symbol","Study","IncomeStatement","BalanceSheet","Expression","Forward","Seasonal"]},"main":{"type":"boolean"},"index":{"$ref":"chart.schema.json#/definitions/intOffset"},"uid":{"type":"string"},"studyId":{"$ref":"chart.schema.json#/definitions/study"},"fundamentalId":{"$ref":"chart.schema.json#/definitions/fundamental"},"expression":{"type":"string"},"forward":{"type":"string"},"seasonal":{"type":"string"},"frequency":{"$ref":"chart.schema.json#/definitions/fundamentalFrequency","default":"Quarter"},"inputs":{"$ref":"#/definitions/inputValues"},"curves":{"$ref":"#/definitions/curvesNonStrict"},"levels":{"$ref":"chart.schema.json#/definitions/studyLevels"},"bands":{"$ref":"chart.schema.json#/definitions/studyBands"},"basis":{"$ref":"chart.schema.json#/definitions/studyBasis"},"placement":{"$ref":"#/definitions/placement"},"cloneIndex":{"$ref":"chart.schema.json#/definitions/intOffset"},"cloneUid":{"type":"string"},"oppositeScale":{"type":"boolean","default":false},"paneIndex":{"$ref":"chart.schema.json#/definitions/intOffset"},"offsets":{"$ref":"chart.schema.json#/definitions/intOffsets"}},"required":["id"]}},"required":["id","context"]},"curveOptional":{},"compareSymbol":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"},"leftScale":{"type":"boolean","default":false},"curves":{"$ref":"#/definitions/curvesNonStrict"}},"required":["symbol"]},"comparePlot":{"type":"object","additionalProperties":false,"properties":{"uid":{"type":"string"},"type":{"type":"string","enum":["Symbol","Expression","Seasonal"]},"symbol":{"type":"string"},"expression":{"type":"string"},"seasonal":{"type":"string"},"leftScale":{"type":"boolean","default":false},"oppositeScale":{"type":"boolean","default":false},"curves":{"$ref":"#/definitions/curvesNonStrict"}},"required":["type"]},"compareAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Compare"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"symbols":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/compareSymbol"}},"plots":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/comparePlot"}},"alignOnExpirations":{"type":"boolean"}},"anyOf":[{"required":["id"]},{"required":["symbols"]},{"required":["plots"]}]}},"required":["id","context"]},"annotationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"^Annotation$"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Add","Get","Delete","Update","Duplicate","List","Cache","FlipHorizontal","FlipVertical"]},"uid":{"type":"string","default":""},"visible":{"type":"boolean"},"locked":{"type":"boolean"},"traits":{"$ref":"chart.schema.json#/definitions/annTraits"},"extras":{"type":"object","additionalProperties":true},"points":{"type":"array","items":{"$ref":"chart.schema.json#/definitions/annPoint"}},"annotation":{"$ref":"chart.schema.json#/definitions/annotation"},"index":{"type":"integer"}},"required":["id"]}},"required":["id","context"]},"movePaneAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MovePane"},"context":{"type":"object","additionalProperties":false,"properties":{"from":{"$ref":"chart.schema.json#/definitions/intOffset"},"to":{"$ref":"chart.schema.json#/definitions/intOffset"}},"required":["from","to"]}},"required":["id","context"]},"movePlotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MovePlot"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"type":{"type":"string","enum":["Symbol","Study","IncomeStatement","BalanceSheet","Expression","Forward","Seasonal"]},"uid":{"type":"string"},"index":{"$ref":"chart.schema.json#/definitions/intOffset"},"targetPane":{"type":"string","enum":["ExistingAbove","NewAbove","ExistingBelow","NewBelow"]}},"required":["type"],"anyOf":[{"required":["uid"]},{"required":["index"]}]}},"required":["id","context"]},"pinPlotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"PinPlot"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"type":{"type":"string","enum":["Symbol","Study","IncomeStatement","BalanceSheet","Expression","Forward","Seasonal"]},"uid":{"type":"string"},"index":{"$ref":"chart.schema.json#/definitions/intOffset"},"targetAxis":{"type":"string","enum":["PrimaryAxis","SecondaryAxis","NoAxis"]}},"required":["type"],"anyOf":[{"required":["uid"]},{"required":["index"]}]}},"required":["id","context"]},"templateAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Template"},"context":{"type":"object","additionalProperties":false,"properties":{"strip":{"type":"object","additionalProperties":false,"properties":{"main":{"type":"boolean","default":true},"annotations":{"type":"boolean","default":false},"compare":{"type":"boolean","default":false}}}},"required":["strip"]}},"required":["id","context"]},"outlineAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Outline"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Get"}},"required":["id"]}},"required":["id","context"]},"themeAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Theme"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"backgroundColor":{"$ref":"chart.schema.json#/definitions/color"},"axis":{"type":"object","additionalProperties":false,"properties":{"gridLinesColor":{"$ref":"chart.schema.json#/definitions/color"},"gridLinesStyle":{"$ref":"chart.schema.json#/definitions/dashStyle"},"textColor":{"$ref":"chart.schema.json#/definitions/color"},"crosshairColor":{"$ref":"chart.schema.json#/definitions/color"}}},"fontSize":{"type":"object","additionalProperties":false,"properties":{"chart":{"type":"number"},"xAxis":{"type":"number"},"yAxis":{"type":"number"}}}}}}},"annotationManipulationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["AnnotationManipulation"]},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"uid":{"type":"string"},"preview":{"type":"boolean"},"selected":{"type":"boolean"},"position":{"oneOf":[{"type":"integer","minimum":0},{"type":"string","enum":["Front","Back"]}]}}}},"required":["id","context"]},"inputValues":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":["number","string"]},"integer":{"type":"boolean"}}}}}`),type:`object`,oneOf:[{$ref:`#/definitions/mainPlotAccessor`},{$ref:`#/definitions/aggregationAccessor`},{$ref:`#/definitions/periodAccessor`},{$ref:`#/definitions/crosshairAccessor`},{$ref:`#/definitions/tooltipAccessor`},{$ref:`#/definitions/eventsAccessor`},{$ref:`#/definitions/scaleAccessor`},{$ref:`#/definitions/otherAccessor`},{$ref:`#/definitions/plotAccessor`},{$ref:`#/definitions/compareAccessor`},{$ref:`#/definitions/annotationAccessor`},{$ref:`#/definitions/movePaneAccessor`},{$ref:`#/definitions/movePlotAccessor`},{$ref:`#/definitions/pinPlotAccessor`},{$ref:`#/definitions/templateAccessor`},{$ref:`#/definitions/outlineAccessor`},{$ref:`#/definitions/themeAccessor`},{$ref:`#/definitions/annotationManipulationAccessor`}]},Ks=JSON.parse(`[{"id":"MA","meta":{"title":"Moving Average","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MA"]}]}},{"id":"CSHO","meta":{"title":"Cash Overlay","overlay":true},"defaults":{"source":"Symbol","curves":[{"colors":["#834c3f"],"fields":["CSHO"]}]}},{"id":"CSHB","meta":{"title":"Cash Basis","overlay":false},"defaults":{"source":"Symbol","curves":[{"colors":["#b2b900"],"fields":["CSHB"]}]}},{"id":"MKTCAP","meta":{"title":"Market Capitalization","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#3498db"],"fields":["MKTCAP"]}]}},{"id":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10,"integer":true},{"name":"BarColoring","value":"LikeMain"}],"curves":[{"colors":["#9075d6"],"fields":["VOLMA"]},{"colors":["#ef4226","#00b04b","#1f4bb6"],"fields":["Volume"],"style":"Column","varyColorPerBar":true}]}},{"id":"OSCI","meta":{"title":"Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#ae272d"],"fields":["OSC"]}]}},{"id":"OSCIVOL","meta":{"title":"Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#9326ff"],"fields":["VOSC"]}]}},{"id":"MAENV","meta":{"title":"Moving Average Envelope","overlay":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVU"]},{"colors":["#25329b"],"fields":["ENVD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVU","ENVD"],"style":"Ribbon","lineWidth":0}]}},{"id":"LINRCHN","meta":{"title":"Linear Regression Channel","overlay":true,"enumerations":[{"input":"ExtendLines","values":["None","Left","Right","Both"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100,"integer":true},{"name":"Width","value":2},{"name":"ExtendLines","value":"None"}],"curves":[{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRUP"]},{"colors":["rgba(255, 0, 0, 0.3)"],"fields":["LINRMID"]},{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRLOW"]},{"colors":["rgba(0, 0, 255, 0.1)"],"fields":["LINRUP","LINRMID"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 0, 0, 0.1)"],"fields":["LINRMID","LINRLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVEXP","meta":{"title":"Moving Average Envelope Exponential","overlay":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVEXPU"]},{"colors":["#25329b"],"fields":["ENVEXPD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVEXPU","ENVEXPD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVSMO","meta":{"title":"Moving Average Envelope Smoothed","overlay":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVSMOU"]},{"colors":["#25329b"],"fields":["ENVSMOD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVSMOU","ENVSMOD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAEXP","meta":{"title":"Moving Average Exponential","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#ae272d"],"fields":["EMA"]}]}},{"id":"MASMO","meta":{"title":"Moving Average Smoothed","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":9,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#743800"],"fields":["SMA"]}]}},{"id":"MATRI","meta":{"title":"Moving Average Triangular","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#888"],"fields":["TMA"]}]}},{"id":"MAWEI","meta":{"title":"Moving Average Weighted","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#bc41ce"],"fields":["WMA"]}]}},{"id":"MAHLC","meta":{"title":"Moving Average High/Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":8,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["MAHI"]},{"colors":["#ef4226"],"fields":["MALO"]}]}},{"id":"MACD","meta":{"title":"MACD Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MACD"]},{"colors":["#9326ff"],"fields":["MACDS"]},{"colors":["rgba(119, 17, 17, 0.3)","#771111","rgba(0, 170, 170, 0.3)","#00aaaa"],"fields":["MACDH"],"style":"Column","varyColorPerBar":true}],"levels":[{"value":1,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-1,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MACDEXP","meta":{"title":"MACD Oscillator Exponential","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MACD"]},{"colors":["#bc41ce"],"fields":["MACDS"]},{"colors":["rgba(119, 17, 17, 0.3)","#771111","rgba(0, 170, 170, 0.3)","#00aaaa"],"fields":["MACDH"],"style":"Column","varyColorPerBar":true}],"levels":[{"value":1,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-1,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MACDV","meta":{"title":"MACD-V Oscillator","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true},{"name":"Average","value":"EMA"}],"curves":[{"colors":["#808080"],"fields":["MACDV"]},{"colors":["#9326ff"],"fields":["MACDVS"]},{"colors":["rgba(119, 17, 17, 0.3)","#771111","rgba(0, 170, 170, 0.3)","#00aaaa"],"fields":["MACDVH"],"style":"Column","varyColorPerBar":true}],"levels":[{"value":150,"name":"Overbought","line":{"color":"#606060","dashStyle":"LongDashDot"}},{"value":50,"name":"Neutral (upper)","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-50,"name":"Neutral (lower)","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-150,"name":"Oversold","line":{"color":"#606060","dashStyle":"LongDashDot"}}]}},{"id":"VOL","meta":{"title":"Volume","overlay":true,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"inputs":[{"name":"BarColoring","value":"LikeMain"}],"curves":[{"colors":["rgba(239,66,38, 0.5)","rgba(0,176,75, 0.5)","rgba(31,75,182, 0.5)"],"fields":["Volume"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(187,69,204, 0.5)"],"fields":["OpenInterest"]}]}},{"id":"OPINT","meta":{"title":"Open Interest","overlay":false,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#bb45cc"],"fields":["OpenInterest"]}]}},{"id":"RSI","meta":{"title":"Relative Strength Index (RSI)","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2,"range":{"min":0,"max":100},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSI"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["RSIAVG"]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSA","meta":{"title":"Relative Strength Average","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2,"range":{"min":0,"max":100},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":9,"integer":true},{"name":"Period2","value":45,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSA"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["RSAAVG"]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSIMOD","meta":{"title":"Relative Strength Index (RSI) Modified","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":2,"range":{"min":0,"max":100},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSI"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["RSIAVG"]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSISTO","meta":{"title":"Stochastic RSI","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"decimals":3,"range":{"min":0,"max":1},"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true},{"name":"Range","value":20,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["STORSI"],"zones":[{"value":0.2,"colors":1},{"value":0.8,"colors":2},{"colors":1}]},{"colors":["#f08f4c"],"fields":["STORSIAVG"]}],"levels":[{"value":0.2,"name":"Oversold","line":{"color":"#444"}},{"value":0.5,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":0.8,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"HHLL","meta":{"title":"Highest High Lowest Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["HH"]},{"colors":["#ef4226"],"fields":["LL"]}]}},{"id":"WGCL","meta":{"title":"Weighted Close","overlay":true},"defaults":{"curves":[{"colors":["#f18900"],"fields":["WGCL"]}]}},{"id":"WGALPH","meta":{"title":"Weighted Alpha","overlay":false,"decimals":2,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"colors":["rgba(182, 52, 0, 1)","rgba(36, 173, 84, 1)"],"fields":["WGALPH"],"style":"Line","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"WPERCR","meta":{"title":"Williams Percent Range","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#ff6e00"],"fields":["PercR"]}],"levels":[{"value":-80,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-20,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":-80,"to":-20}}]}},{"id":"STOCHF","meta":{"title":"Stochastic, Fast","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"Period1","value":14,"integer":true},{"name":"Period2","value":3,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["PercK"],"zones":[{"value":20,"colors":1},{"value":80,"colors":2},{"colors":100}]},{"colors":["#f08f4c"],"fields":["PercD"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"STOCHS","meta":{"title":"Stochastic, Slow","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"Period1","value":14,"integer":true},{"name":"Period2","value":3,"integer":true},{"name":"Period3","value":3,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["PercK"],"zones":[{"value":20,"colors":1},{"value":80,"colors":2},{"colors":100}]},{"colors":["#f08f4c"],"fields":["PercD"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#444"}},{"value":50,"name":"Center","line":{"color":"#444","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#445"}}]}},{"id":"BBANDS","meta":{"title":"Bollinger Bands","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2},{"name":"Offset","value":0,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["BOLLBU"]},{"colors":["#89211e"],"fields":["BOLLBM"]},{"colors":["#00aaab"],"fields":["BOLLBL"]},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["BOLLBU","BOLLBL"],"style":"Ribbon","lineWidth":0}]}},{"id":"MBBANDS","meta":{"title":"Bollinger Bands Modified","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"MultInside","value":3},{"name":"MultOutside","value":4},{"name":"Offset","value":0,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["MBBUO"],"lineWidth":2},{"colors":["#9075d6"],"fields":["MBBUI"],"lineWidth":1},{"colors":["#89211e"],"fields":["MBBM"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLI"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLO"],"lineWidth":2},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["MBBUI","MBBLI"],"style":"Ribbon","lineWidth":0}]}},{"id":"BWIDTH","meta":{"title":"Bollinger Width","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2}],"curves":[{"colors":["#f18900"],"fields":["BOLLW"]}]}},{"id":"BPERC","meta":{"title":"Bollinger Bands %B","decimals":4,"overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2}],"curves":[{"colors":["#138484"],"fields":["BOLLP"]}],"levels":[{"value":0,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":1,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(19, 132, 132, 0.1)"},"range":{"from":0,"to":1}}]}},{"id":"OBVOL","meta":{"title":"On Balance Volume","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#2284dd"],"fields":["OBVOL"]},{"colors":["#896fc3"],"fields":["OBVOLAVG"]}]}},{"id":"ATR","meta":{"title":"Average True Range (ATR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"SMA"},{"name":"Period2","value":20,"integer":true}],"curves":[{"colors":["#ffaf1c"],"fields":["ATR"]},{"colors":["#1c6cff"],"fields":["ATRMA"]}]}},{"id":"ADR","meta":{"title":"Average Daily Range (ADR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#ffaf1c"],"fields":["ADR"]}]}},{"id":"ADRP","meta":{"title":"Average Daily Range Percent (ADRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#fb1cff"],"fields":["ADRP"]}]}},{"id":"ATRP","meta":{"title":"Average True Range Percent (ATRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"SMA"}],"curves":[{"colors":["#fb1cff"],"fields":["ATRP"]}]}},{"id":"ADJATR","meta":{"title":"Average True Range Adjusted (ADJATR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#ffaf1c"],"fields":["ADJATR"]}]}},{"id":"COTR","meta":{"title":"Change over True Range","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]},{"input":"TypeOfATR","values":["ATR","ADJATR"]}]},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Smoothing","value":"SMA"},{"name":"TypeOfATR","value":"ATR"}],"curves":[{"colors":["#ffaf1c"],"fields":["COTR"]}]}},{"id":"ADX","meta":{"title":"Average Directional Index (ADX)","overlay":false},"defaults":{"inputs":[{"name":"AdxSmoothing","value":14,"integer":true},{"name":"DiLength","value":14,"integer":true}],"curves":[{"colors":["#bc41ce"],"fields":["MDI"]},{"colors":["#ffaf1c"],"fields":["PDI"]},{"colors":["#00aaab"],"fields":["ADX"]}],"levels":[{"value":20,"name":"Trendless","line":{"color":"#7f7f7f","dashStyle":"Dash"}},{"value":25,"name":"Trending","line":{"color":"#7f7f7f","dashStyle":"LongDash"}}]}},{"id":"ADXMOD","meta":{"title":"Average Directional Index (ADX) Modified","overlay":false},"defaults":{"inputs":[{"name":"AdxSmoothing","value":14,"integer":true},{"name":"DiLength","value":14,"integer":true}],"curves":[{"colors":["#25329b"],"fields":["MDI"]},{"colors":["#ffaf1c"],"fields":["PDI"]},{"colors":["#9326ff"],"fields":["ADXM"]}],"levels":[{"value":20,"name":"Trendless","line":{"color":"#7f7f7f","dashStyle":"Dash"}},{"value":25,"name":"Trending","line":{"color":"#7f7f7f","dashStyle":"LongDash"}}]}},{"id":"ADL","meta":{"title":"Chaikin Accumulation Distribution","overlay":false},"defaults":{"curves":[{"colors":["#f18900"],"fields":["ADL"]}]}},{"id":"ADWM","meta":{"title":"Accumulation/Distribution Williams","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#f18900"],"fields":["ADWM"]},{"colors":["#00aaab"],"fields":["ADWMMA"]}]}},{"id":"CHAOSC","meta":{"title":"Chaikin Oscillator","overlay":false},"defaults":{"curves":[{"colors":["#2284dd"],"fields":["CHAOSC"]}]}},{"id":"TP","meta":{"title":"Typical Price","overlay":true},"defaults":{"curves":[{"colors":["#bc41ce"],"fields":["TP"]}]}},{"id":"KELCHN","meta":{"title":"Keltner Channel","overlay":true,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Average","value":"MA"}],"curves":[{"colors":["#f18900"],"fields":["KCUP"]},{"colors":["#2284dd"],"fields":["KCMID"]},{"colors":["#480048"],"fields":["KCLOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KCUP","KCLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"KELBND","meta":{"title":"Keltner Bands","overlay":true,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Multiplier","value":2.5},{"name":"Average","value":"EMA"}],"curves":[{"colors":["#f18900"],"fields":["KBUP"]},{"colors":["#2284dd"],"fields":["KBMID"]},{"colors":["#480048"],"fields":["KBLOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KBUP","KBLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"DONCHN","meta":{"title":"Donchian Channel","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["DONUP"]},{"colors":["#ff6a00"],"fields":["DONMID"]},{"colors":["#0c32ff"],"fields":["DONLOW"]},{"colors":["rgba(12, 50, 255, 0.1)"],"fields":["DONUP","DONLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"DONWIDTH","meta":{"title":"Donchian Width","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#480048"],"fields":["DONW"]}]}},{"id":"PVT","meta":{"title":"Price Volume Trend","overlay":false},"defaults":{"curves":[{"colors":["#ae272d"],"fields":["PVT"]}]}},{"id":"ROC","meta":{"title":"Rate Of Change","overlay":false,"decimals":2,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#2284dd"],"fields":["ROC"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"TRIX","meta":{"title":"Triple Exponential","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":15,"integer":true}],"curves":[{"colors":["#743800"],"fields":["TRIX"]}]}},{"id":"DEMA","meta":{"title":"Moving Average Exponential DEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":15,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#743800"],"fields":["DEMA"]}]}},{"id":"EOSC","meta":{"title":"Exponential Oscillator","overlay":false,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":10,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#ff6f00"],"fields":["EOSC"]}]}},{"id":"TEMA","meta":{"title":"Moving Average Exponential TEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":15,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#743800"],"fields":["TEMA"]}]}},{"id":"TSI","meta":{"title":"True Strength Index","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":25,"integer":true},{"name":"Period2","value":13,"integer":true},{"name":"Period3","value":7,"integer":true}],"curves":[{"colors":["#3bb3e4"],"fields":["TSI"]},{"colors":["#ff006e"],"fields":["TSISIG"]}],"levels":[{"value":-25,"name":"Oversold","line":{"color":"#606060"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":25,"name":"Overbought","line":{"color":"#606060"}}]}},{"id":"PPMOV","meta":{"title":"Pivot Points Bands","overlay":true},"defaults":{"curves":[{"colors":["#ffaf1c"],"fields":["PVPTR"]},{"colors":["#f18900"],"fields":["PVPT"]},{"colors":["#00aaab"],"fields":["PVPTS"]}]}},{"id":"ARNUPDW","meta":{"title":"Aroon Up/Down","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":25,"integer":true}],"curves":[{"colors":["#005716"],"fields":["ARNUP"]},{"colors":["#ae272d"],"fields":["ARNLOW"]}]}},{"id":"ARNOSC","meta":{"title":"Aroon Oscillator","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":25,"integer":true}],"curves":[{"colors":["#808080"],"fields":["ARNOSC"]}]}},{"id":"TCHN","meta":{"title":"Turtle Channel","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodUpper","value":14,"integer":true},{"name":"PeriodLower","value":14,"integer":true},{"name":"Range","value":"High/Low"}],"curves":[{"colors":["#005716"],"fields":["TCHNUP"]},{"colors":["#ae272d"],"fields":["TCHNLOW"]}]}},{"id":"TCHRE","meta":{"title":"Turtle Channel Retracement","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]},{"input":"Retracement","values":["Long","Short"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100,"integer":true},{"name":"Retracement","value":"Long"},{"name":"Adjustment","value":5},{"name":"Range","value":"High/Low"}],"curves":[{"colors":["#2799f6"],"fields":["TCHRE"]}]}},{"id":"ALLG","meta":{"title":"Alligator","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":13,"integer":true},{"name":"Period2","value":8,"integer":true},{"name":"Period3","value":5,"integer":true}],"curves":[{"colors":["#25329b"],"fields":["ALJAW"],"shift":8},{"colors":["#7f8000"],"fields":["ALTEETH"],"shift":5},{"colors":["#9326ff"],"fields":["ALLIPS"],"shift":3}]}},{"id":"PLTLN","meta":{"title":"Plot Line","overlay":true},"defaults":{"inputs":[{"name":"Position","value":700}],"curves":[{"colors":["#808080"],"fields":["PLTLN"]}]}},{"id":"AWEOSC","meta":{"title":"Awesome Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":5,"integer":true},{"name":"Period2","value":34,"integer":true},{"name":"Period3","value":10,"integer":true}],"curves":[{"colors":["#711","#0aa"],"fields":["AWOS"],"style":"Column","varyColorPerBar":true},{"colors":["#ef4226"],"fields":["AWOSMA"]}]}},{"id":"CLV","meta":{"title":"Close Location Value","overlay":false},"defaults":{"curves":[{"colors":["#00aaab"],"fields":["CLV"]}]}},{"id":"CHAMF","meta":{"title":"Chaikin Money Flow","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["CHAMF"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"CHAVOL","meta":{"title":"Chaikin Volatility","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#808080"],"fields":["CHAVOL"]}]}},{"id":"DPO","meta":{"title":"Detrended Price Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["rgba(136, 136, 136, 0.3)","rgba(136, 136, 136, 0.3)"],"fields":["DPO"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MCGD","meta":{"title":"McGinley Dynamic","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#3bb3e4"],"fields":["MCGD"],"style":"Line"}]}},{"id":"HMA","meta":{"title":"Hull Moving Average","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Source","value":"Close"},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#674ea7"],"fields":["HMA"],"style":"Line"}]}},{"id":"COPP","meta":{"title":"Coppock Curve","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodWma","value":10,"integer":true},{"name":"PeriodRocLong","value":14,"integer":true},{"name":"PeriodRocShort","value":11,"integer":true}],"curves":[{"colors":["#ff2014","#77dd77"],"fields":["COPP"],"style":"Line","zones":[{"value":0,"colors":1},{"colors":1}]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CCI","meta":{"title":"Commodity Channel Index (CCI)","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#7f8000","rgba(12, 50, 255, 0.3)"],"fields":["CCI"],"zones":[{"value":-100,"colors":1},{"value":100,"colors":2},{"colors":1}]}],"levels":[{"value":-100,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Center","line":{"color":"#606060","dashStyle":"DashDot"}},{"value":100,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(127, 128, 0, 0)"},"range":{"from":-100,"to":100}}]}},{"id":"EMV","meta":{"title":"Ease Of Movement","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#9326ff"],"fields":["EMV"]},{"colors":["#808080"],"fields":["EMVMA"]}]}},{"id":"ERBLPOW","meta":{"title":"Elder Ray Bull Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#005716"],"fields":["ERBLPOW"],"style":"Column"}]}},{"id":"ERBRPOW","meta":{"title":"Elder Ray Bear Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#ae272d"],"fields":["ERBRPOW"],"style":"Column"}]}},{"id":"FI","meta":{"title":"Force Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":13,"integer":true}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["FI"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"MI","meta":{"title":"Mass Index","overlay":false},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["MI"]}]}},{"id":"MOM","meta":{"title":"Momentum","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true},{"name":"Movement","value":20,"integer":true}],"curves":[{"colors":["#808080"],"fields":["MOM"]},{"colors":["#505050"],"fields":["MOMMA"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MFI","meta":{"title":"Money Flow Index","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#543daa"],"fields":["MFI"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#787878","dashStyle":"Dash"}},{"value":50,"name":"Center","line":{"color":"rgba(120, 120, 120, 0.5)","dashStyle":"Dash"}},{"value":80,"name":"Overbought","line":{"color":"#787878","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(126, 87, 194, 0.1)"},"range":{"from":20,"to":80}}]}},{"id":"MSD","meta":{"title":"Moving Standard Deviation","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#0c32ff"],"fields":["MSD"]}]}},{"id":"PCTCHG","meta":{"title":"Percent Change","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"colors":["#037d27"],"fields":["PCTCHG"]}]}},{"id":"NVI","meta":{"title":"Negative Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255,"integer":true}],"curves":[{"colors":["#480048"],"fields":["NVI"]},{"colors":["#7f8000"],"fields":["NVIEMA"]}]}},{"id":"PVI","meta":{"title":"Positive Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255,"integer":true}],"curves":[{"colors":["#00b04b"],"fields":["PVI"]},{"colors":["#005716"],"fields":["PVIEMA"]}]}},{"id":"PPO","meta":{"title":"Percentage Price Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["PPO"]},{"colors":["#bc41ce"],"fields":["PPOS"]},{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["PPOH"],"style":"Column","varyColorPerBar":true}]}},{"id":"PVO","meta":{"title":"Percentage Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":12,"integer":true},{"name":"Period2","value":26,"integer":true},{"name":"Period3","value":9,"integer":true}],"curves":[{"colors":["#808080"],"fields":["PVO"]},{"colors":["#bc41ce"],"fields":["PVOS"]},{"colors":["#9075d6"],"fields":["PVOH"],"style":"Column"}]}},{"id":"HV","meta":{"title":"Historical Volatility","overlay":false,"decimals":2,"enumerations":[{"input":"Calculation","values":["Percentage","Absolute"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Calculation","value":"Percentage"},{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#7f8000"],"fields":["HV"]}]}},{"id":"PERF","meta":{"title":"Price Performance","overlay":false,"decimals":2,"enumerations":[{"input":"Anchor","values":["SeriesStart","VisibleStart"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Anchor","value":"SeriesStart"}],"curves":[{"colors":["#00aaab"],"fields":["PERF"]}]}},{"id":"WASI","meta":{"title":"Wilder Accumulative Swing Index","overlay":false},"defaults":{"inputs":[{"name":"Limit","value":3}],"curves":[{"colors":["#bc41ce"],"fields":["WASI"]}]}},{"id":"WWVOL","meta":{"title":"Welles Wilder Volatility","overlay":true},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Constant","value":3}],"curves":[{"colors":["#9326ff"],"fields":["WWVSARD"],"style":"Dots"},{"colors":["#f18900"],"fields":["WWVSARU"],"style":"Dots"}]}},{"id":"PARTP","meta":{"title":"Parabolic Time/Price (SAR)","overlay":true},"defaults":{"inputs":[{"name":"Acceleration","value":50},{"name":"Limit","value":5}],"curves":[{"colors":["#25329b"],"fields":["PARSARS"],"style":"Dots"},{"colors":["#00aaab"],"fields":["PARSARL"],"style":"Dots"}]}},{"id":"REATRS","meta":{"title":"Retracement ATR Stop","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]}]},"defaults":{"source":"Close","inputs":[{"name":"Direction","value":"Long"},{"name":"PeriodAdjATR","value":20,"integer":true},{"name":"PeriodTurtleChn","value":100,"integer":true},{"name":"TurtleChnField","value":"High/Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#981e7a"],"fields":["REATRS"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#480048"],"fields":["MOVLR"]}]}},{"id":"TRSP","meta":{"title":"Trend Seeker®","overlay":true,"enumerations":[{"input":"VelocityUpTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocitySideTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocityDownTrend","values":["1","2","3","4","5","6","7","8","9"]}]},"defaults":{"inputs":[{"name":"VelocityUpTrend","value":"3"},{"name":"VelocitySideTrend","value":"3"},{"name":"VelocityDownTrend","value":"3"}],"curves":[{"colors":["#24ad54"],"fields":["TRSP1"],"style":"Dots"},{"colors":["#ec4533"],"fields":["TRSP2"],"style":"Dots"}]}},{"id":"TARGP","meta":{"title":"Target Price","overlay":true},"defaults":{"curves":[{"colors":["#ff5252","#4cb050"],"fields":["TARGP"],"style":"Line","varyColorPerBar":true}]}},{"id":"COTLC","meta":{"title":"Commitment of Traders (COT) Chart","overlay":false,"decimals":0,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTLCCMSP"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTLCLGSP"],"style":"Step"},{"colors":["#403daf"],"fields":["COTLCSMSP"],"style":"Step"}]}},{"id":"COTDAG","meta":{"title":"Commitment of Traders (COT) Disaggregated","overlay":false,"decimals":0,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTDAGPRO"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTDAGSPD"],"style":"Step"},{"colors":["#403daf"],"fields":["COTDAGMNM"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTDAGOTH"],"style":"Step"}]}},{"id":"COTFTR","meta":{"title":"Commitment of Traders (COT) Financial","overlay":false,"decimals":0,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTFTRDLI"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTFTRASM"],"style":"Step"},{"colors":["#403daf"],"fields":["COTFTRLVF"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTFTROTH"],"style":"Step"}]}},{"id":"PIVPTS","meta":{"title":"Pivot Points","overlay":true,"enumerations":[{"input":"Previous","values":["Day","Week","Month"]}]},"defaults":{"inputs":[{"name":"Previous","value":"Day"}],"curves":[{"colors":["#79a2e3"],"fields":["PPTR3"]},{"colors":["#f08f4c"],"fields":["PPTR2"]},{"colors":["#492c6e"],"fields":["PPTR1"]},{"colors":["#28adcc"],"fields":["PPTPIV"]},{"colors":["#8f040a"],"fields":["PPTS1"]},{"colors":["#8cba32"],"fields":["PPTS2"]},{"colors":["#0e2339"],"fields":["PPTS3"]}]}},{"id":"CPP","meta":{"title":"Camarilla Pivot Points","overlay":true},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["CPPH4"]},{"colors":["#00b04b"],"fields":["CPPH3"]},{"colors":["#00b04b"],"fields":["CPPH2"]},{"colors":["#00b04b"],"fields":["CPPH1"]},{"colors":["#d47928"],"fields":["CPPL1"]},{"colors":["#d47928"],"fields":["CPPL2"]},{"colors":["#d47928"],"fields":["CPPL3"]},{"colors":["#d47928"],"fields":["CPPL4"]}]}},{"id":"IMPVOL","meta":{"title":"Implied Volatility (Futures)","overlay":false,"decimals":2,"singleFieldBased":true},"defaults":{"curves":[{"colors":["#ffc270"],"fields":["IMPVOL"]}]}},{"id":"CTM","meta":{"title":"CommodityTrends Cycle Trading Momentum","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CTM"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]},{"colors":["#9326ff"],"fields":["CTLTM"]}]}},{"id":"CPMI","meta":{"title":"CommodityTrends Principal Momentum Indicator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CPMI"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}]}},{"id":"CTPI","meta":{"title":"CommodityTrends Turning Point Indicator","overlay":false,"decimals":2,"range":{"min":0,"max":100}},"defaults":{"curves":[{"colors":["#ef4226","#2642ef"],"fields":["CTPI"],"zones":[{"value":50,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}],"levels":[{"value":25,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":75,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"GMMA","meta":{"title":"Guppy Multiple Moving Average","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":3,"integer":true},{"name":"Period2","value":5,"integer":true},{"name":"Period3","value":8,"integer":true},{"name":"Period4","value":10,"integer":true},{"name":"Period5","value":12,"integer":true},{"name":"Period6","value":15,"integer":true},{"name":"Period7","value":30,"integer":true},{"name":"Period8","value":35,"integer":true},{"name":"Period9","value":40,"integer":true},{"name":"Period10","value":45,"integer":true},{"name":"Period11","value":50,"integer":true},{"name":"Period12","value":60,"integer":true}],"curves":[{"colors":["#008ae6"],"fields":["GMMA3"]},{"colors":["#008ae6"],"fields":["GMMA5"]},{"colors":["#008ae6"],"fields":["GMMA8"]},{"colors":["#008ae6"],"fields":["GMMA10"]},{"colors":["#008ae6"],"fields":["GMMA12"]},{"colors":["#008ae6"],"fields":["GMMA15"]},{"colors":["#b32400"],"fields":["GMMA30"]},{"colors":["#b32400"],"fields":["GMMA35"]},{"colors":["#b32400"],"fields":["GMMA40"]},{"colors":["#b32400"],"fields":["GMMA45"]},{"colors":["#b32400"],"fields":["GMMA50"]},{"colors":["#b32400"],"fields":["GMMA60"]}]}},{"id":"STOMOMIX","meta":{"title":"Stochastic Momentum Index","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10,"integer":true},{"name":"Period2","value":3,"integer":true}],"curves":[{"colors":["#3bb4e5"],"fields":["STOMOMIX"]}],"levels":[{"value":-40,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":40,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CHDMOMOSC","meta":{"title":"Chande Momentum Oscillator","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":9,"integer":true},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":9,"integer":true}],"curves":[{"colors":["#27c6da"],"fields":["CHDMOMOSC"]},{"colors":["#f08f4c"],"fields":["CHDMOMOSCAVG"]}],"levels":[{"value":-50,"name":"Oversold","line":{"color":"#606060"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":50,"name":"Overbought","line":{"color":"#606060"}}]}},{"id":"VSTOP","meta":{"title":"ATR Volatility Stop","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Multiplier","value":2}],"curves":[{"colors":["#50cc52"],"fields":["VSTOPUP"],"style":"Dots"},{"colors":["#d46757"],"fields":["VSTOPLOW"],"style":"Dots"}]}},{"id":"SUPTR","meta":{"title":"Supertrend","overlay":true},"defaults":{"inputs":[{"name":"Period","value":7,"integer":true},{"name":"Multiplier","value":4}],"curves":[{"colors":["#ff5252","#4cb050"],"fields":["SUPTR"],"style":"Line","varyColorPerBar":true}]}},{"id":"ICHCLD","meta":{"title":"Ichimoku Clouds","overlay":true},"defaults":{"inputs":[{"name":"PeriodConversionLine","value":9,"integer":true},{"name":"PeriodBaseLine","value":26,"integer":true},{"name":"PeriodLaggingSpan2","value":52,"integer":true},{"name":"Displacement","value":26,"integer":true}],"curves":[{"colors":["#0080cd"],"fields":["CONVLN"],"style":"Line"},{"colors":["#cd0000"],"fields":["BASELN"],"style":"Line"},{"colors":["#009900"],"fields":["LAGGSP"],"style":"Line"},{"colors":["#00cd00"],"fields":["LEADSP1"],"style":"Line"},{"colors":["#ff0000"],"fields":["LEADSP2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["LEADSP1","LEADSP2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"VWAP","meta":{"title":"Volume Weighted Average Price (VWAP)","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"AnchorPeriod","values":["Session","Week","Month","Quarter","Year","Decade","Century"]}]},"defaults":{"inputs":[{"name":"Source","value":"HLC/3"},{"name":"AnchorPeriod","value":"Session"},{"name":"Stdev1stMultiplier","value":1},{"name":"Stdev2ndMultiplier","value":2},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#ee762f"],"fields":["VWAP"],"style":"Line"},{"colors":["#ffe44e"],"fields":["VWAPSD1U"],"style":"Line"},{"colors":["#ffe44e"],"fields":["VWAPSD1L"],"style":"Line"},{"colors":["#4aa34e"],"fields":["VWAPSD2U"],"style":"Line"},{"colors":["#4aa34e"],"fields":["VWAPSD2L"],"style":"Line"}]}},{"id":"AVWAP","meta":{"title":"Anchored Volume Weighted Average Price (VWAP)","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Anchor","value":1664496000000,"integer":true},{"name":"Source","value":"HLC/3"}],"curves":[{"colors":["#ee762f"],"fields":["AVWAP"],"style":"Line"}]}},{"id":"MACROSS","meta":{"title":"Moving Averages Crossover","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"ShowSignals","values":["Yes","No"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":9,"integer":true},{"name":"Period2","value":18,"integer":true},{"name":"ShowSignals","value":"Yes"}],"curves":[{"colors":["#ef4226","#00b04b"],"fields":["MAS"],"style":"Line","varyColorPerBar":true},{"colors":["#3479df"],"fields":["MAL"]}]}},{"id":"PACROSS","meta":{"title":"Price/Average Crossover","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"ShowSignals","values":["Yes","No"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period","value":20,"integer":true},{"name":"ShowSignals","value":"Yes"}],"curves":[{"colors":["#ef4226","#00b04b"],"fields":["AVG"],"style":"Line","varyColorPerBar":true}]}},{"id":"VOIN","meta":{"title":"Vortex Indicator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#60b1df"],"fields":["PLVI"]},{"colors":["#ea336f"],"fields":["MNVI"]}]}},{"id":"DIFA","meta":{"title":"Distance From Average","overlay":false,"decimals":2,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Distance","values":["Amount","Percentage"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":200,"integer":true},{"name":"Average","value":"MA"},{"name":"Distance","value":"Percentage"}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["DIFA"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["DIFA"],"style":"Area","visible":false,"zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false,"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"PeriodRsi","value":14,"integer":true},{"name":"PeriodEma1","value":5,"integer":true},{"name":"PeriodEma2","value":3,"integer":true},{"name":"PeriodMa","value":9,"integer":true},{"name":"PeriodSig","value":9,"integer":true}],"curves":[{"colors":["#ef5350","#26a69a"],"fields":["DOSCH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]},{"colors":["#cc66ff"],"fields":["DOSCS"]}]}},{"id":"BBANDW","meta":{"title":"Bollinger BandWidth","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"singleFieldBased":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20,"integer":true},{"name":"Width","value":2},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5,"integer":true}],"curves":[{"colors":["#3d8283"],"fields":["BOLLBW"]},{"colors":["#f08f4c"],"fields":["BOLLBWA"]}]}},{"id":"MARIB","meta":{"title":"Moving Average Ribbon","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":20,"integer":true},{"name":"Increment","value":5,"integer":true},{"name":"Count","value":10,"integer":true},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#c4291c"],"fields":["MA1"]},{"colors":["#ea3323"],"fields":["MA2"]},{"colors":["#ef8433"],"fields":["MA3"]},{"colors":["#f3cc46"],"fields":["MA4"]},{"colors":["#fffd55"],"fields":["MA5"]},{"colors":["#75f94c"],"fields":["MA6"]},{"colors":["#41904f"],"fields":["MA7"]},{"colors":["#86338b"],"fields":["MA8"]},{"colors":["#ea3df7"],"fields":["MA9"]},{"colors":["#2e72b8"],"fields":["MA10"]}]}},{"id":"HASMO","meta":{"title":"Heikin-Ashi Smoothed","overlay":true,"enumerations":[{"input":"Smoothing1","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Smoothing2","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Smoothing1","value":"EMA"},{"name":"Period1","value":10,"integer":true},{"name":"Smoothing2","value":"EMA"},{"name":"Period2","value":10,"integer":true}],"curves":[{"colors":["#b63400","#007f3e","#1664db","#333","#777"],"fields":["Open","High","Low","Close","Change"],"style":"Candlestick","varyColorPerBar":true,"lineWidth":1}]}},{"id":"TTMSQZ","meta":{"title":"TTM Squeeze","overlay":false},"defaults":{"inputs":[{"name":"PeriodBollinger","value":20,"integer":true},{"name":"WidthBollinger","value":2},{"name":"PeriodEmaKeltner","value":20,"integer":true},{"name":"MultiplierKeltner","value":1.5},{"name":"PeriodAtrKeltner","value":20,"integer":true},{"name":"PeriodMomentum","value":12,"integer":true}],"curves":[{"colors":["rgba(204,0,204,0.7)","rgba(255,155,255,0.7)","rgba(85,136,255,0.7)","rgba(153,204,255,0.7)"],"fields":["TTMSQZOSC"],"style":"Column","varyColorPerBar":true},{"colors":["#24ad54"],"fields":["TTMSQZOFF"],"style":"Dots","lineWidth":4},{"colors":["#ec4533"],"fields":["TTMSQZON"],"style":"Dots","lineWidth":4}]}},{"id":"CRS","meta":{"title":"Comparative Relative Strength","overlay":false,"decimals":4,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Display","values":["Regular","PercentChange"]}]},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"},{"name":"Average","value":"MA"},{"name":"Period","value":20,"integer":true},{"name":"Display","value":"Regular"}],"curves":[{"colors":["#dc9b56"],"fields":["CRS"],"style":"Line"},{"colors":["#865371"],"fields":["CRSAVG"],"style":"Line"}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"JPI","meta":{"title":"Jim Prince Indicator","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Height","values":["Fixed","Performance"]}]},"defaults":{"source":"Close","inputs":[{"name":"FastPeriod","value":8,"integer":true},{"name":"SlowPeriod","value":17,"integer":true},{"name":"HandbrakePeriod","value":40,"integer":true},{"name":"Average","value":"MA"},{"name":"Height","value":"Fixed"}],"curves":[{"colors":["#005716","#efb372"],"fields":["JPIB"],"style":"Column","varyColorPerBar":true},{"colors":["#ae272d","#6faef0"],"fields":["JPIS"],"style":"Column","varyColorPerBar":true}]}},{"id":"CTTP","meta":{"title":"CommodityTrends Trading Plan","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#005716","#efb372"],"fields":["JPIB"],"style":"Column","varyColorPerBar":true},{"colors":["#ae272d","#6faef0"],"fields":["JPIS"],"style":"Column","varyColorPerBar":true}]}},{"id":"CTTI","meta":{"title":"CommodityTrends Trinetic Indicator","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#005716","#efb372"],"fields":["JPIB"],"style":"Column","varyColorPerBar":true},{"colors":["#ae272d","#6faef0"],"fields":["JPIS"],"style":"Column","varyColorPerBar":true}]}},{"id":"DRS","meta":{"title":"Dorsey Relative Strength","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"}],"curves":[{"colors":["#dc9b56"],"fields":["DRS"],"style":"Line"}]}},{"id":"MRS","meta":{"title":"Mansfield Relative Strength","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"},{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["rgba(182, 52, 0, 0.3)","rgba(36, 173, 84, 0.3)"],"fields":["MRS"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"PMO","meta":{"title":"Price Momentum Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":35,"integer":true},{"name":"Period2","value":20,"integer":true},{"name":"Period3","value":10,"integer":true}],"curves":[{"colors":["#4ac93d"],"fields":["PMO"],"style":"Line"},{"colors":["#bbe4b6"],"fields":["PMOS"],"style":"Line"}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"RVOL","meta":{"title":"Relative Volume","overlay":false,"decimals":2,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Smoothing","value":"MA"},{"name":"Period","value":50,"integer":true}],"curves":[{"colors":["#b63400","#24ad54"],"fields":["RVOL"],"style":"Column","zones":[{"value":1,"colors":1},{"colors":1}]}],"levels":[{"value":1,"name":"Baseline","line":{"color":"#444"}}]}},{"id":"VOLAP","meta":{"title":"Volume At Closing Price","overlay":true,"enumerations":[{"input":"Position","values":["Left","Right"]},{"input":"Volume","values":["Up/Down","Total"]},{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]},{"input":"LevelMode","values":["Count","MinIncrements"]}]},"defaults":{"source":"Close","inputs":[{"name":"LevelMode","value":"Count"},{"name":"LevelSize","integer":true,"value":24},{"name":"Volume","value":"Up/Down"},{"name":"BarColoring","value":"LikeMain"},{"name":"Position","value":"Left"},{"name":"WidthPercent","value":40},{"name":"ValueRangePercent","value":70}],"curves":[{"colors":["rgba(239, 65, 38, 0.3)","rgba(0, 176, 76, 0.3)","rgba(31, 74, 182, 0.3)"],"fields":["DNVOL","UPVOL","TOTVOL"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(226,49,240, 0.8)"],"lineWidth":2,"dashStyle":"Solid","fields":["POC"]},{"colors":["rgba(239, 65, 38, 0.6)","rgba(0, 176, 76, 0.6)","rgba(31, 74, 182, 0.6)"],"fields":["VAREA"],"style":"Column","varyColorPerBar":true}]}},{"id":"PVACP","meta":{"title":"Periodic Volume At Closing Price","overlay":true,"enumerations":[{"input":"Position","values":["Left","Right"]},{"input":"Volume","values":["Up/Down","Total"]},{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]},{"input":"LevelMode","values":["Count","MinIncrements"]},{"input":"PeriodType","values":["Bars","Days"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodType","value":"Bars"},{"name":"Period","value":1,"integer":true},{"name":"LevelMode","value":"Count"},{"name":"LevelSize","integer":true,"value":24},{"name":"Volume","value":"Up/Down"},{"name":"BarColoring","value":"LikeMain"},{"name":"Position","value":"Left"},{"name":"WidthPercent","value":40},{"name":"ValueRangePercent","value":70}],"curves":[{"colors":["rgba(239, 65, 38, 0.3)","rgba(0, 176, 76, 0.3)","rgba(31, 74, 182, 0.3)"],"fields":["DNVOL","UPVOL","TOTVOL"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(226,49,240, 0.8)"],"lineWidth":2,"dashStyle":"Solid","fields":["POC"]},{"colors":["rgba(239, 65, 38, 0.6)","rgba(0, 176, 76, 0.6)","rgba(31, 74, 182, 0.6)"],"fields":["VAREA"],"style":"Column","varyColorPerBar":true},{"colors":["rgba(31, 74, 182, 0.1)"],"style":"Column","fields":["BARBACK"]}]}},{"id":"KST","meta":{"title":"Know Sure Thing","enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"overlay":false},"defaults":{"inputs":[{"name":"PeriodRoc1","value":10,"integer":true},{"name":"PeriodRoc2","value":15,"integer":true},{"name":"PeriodRoc3","value":20,"integer":true},{"name":"PeriodRoc4","value":30,"integer":true},{"name":"PeriodMa1","value":10,"integer":true},{"name":"PeriodMa2","value":10,"integer":true},{"name":"PeriodMa3","value":10,"integer":true},{"name":"PeriodMa4","value":15,"integer":true},{"name":"PeriodSig","value":9,"integer":true},{"name":"Source","value":"Close"}],"curves":[{"colors":["#5f338a"],"fields":["KST"]},{"colors":["#d73737"],"fields":["KSTSIG"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Solid"}}]}},{"id":"STC","meta":{"title":"Schaff Trend Cycle","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"PeriodShort","value":23,"integer":true},{"name":"PeriodLong","value":50,"integer":true},{"name":"PeriodStoch1","value":10,"integer":true},{"name":"PeriodStoch2","value":3,"integer":true},{"name":"Smoothing","value":"EMA"}],"curves":[{"style":"Area","colors":["rgba(120, 120, 120, 0.3)","rgba(0,0,0,0)","#787878","rgba(120, 120, 120, 0.3)"],"fields":["STC"],"zones":[{"value":25,"colors":1},{"value":75,"colors":2},{"colors":1}]}],"levels":[{"value":25,"name":"Lower","line":{"color":"#aaa","dashStyle":"Dash"}},{"value":75,"name":"Upper","line":{"color":"#aaa","dashStyle":"Dash"}}]}},{"id":"MCCLO","meta":{"title":"McClellan Oscillator","overlay":false,"decimals":2,"enumerations":[{"input":"RatioAdjusted","values":["Yes","No"]},{"input":"Source","values":["TotalStocks","NYSEStocks","NasdaqStocks"]}]},"defaults":{"inputs":[{"name":"Period1","value":19,"integer":true},{"name":"Period2","value":39,"integer":true},{"name":"RatioAdjusted","value":"No"},{"name":"Source","value":"TotalStocks"}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["MCCLO"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"BTI","meta":{"title":"Breadth Thrust Indicator","overlay":false,"decimals":4,"enumerations":[{"input":"Source","values":["TotalStocks","NYSEStocks","NasdaqStocks"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":10,"integer":true},{"name":"Average","value":"MA"},{"name":"Source","value":"TotalStocks"}],"curves":[{"colors":["#ff7f50"],"fields":["BTI"]}],"levels":[{"value":0.4,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":0.615,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"NHLAI","meta":{"title":"New High/Low Accumulation Index","overlay":false,"decimals":0,"enumerations":[{"input":"Source","values":["PriceIndex","MarketCapIndex"]}]},"defaults":{"inputs":[{"name":"Period","value":5,"integer":true},{"name":"Source","value":"PriceIndex"}],"curves":[{"colors":["rgb(43, 53, 139)"],"fields":["NHLAI"],"style":"Line"}],"levels":[{"value":-4000,"name":"Lower","line":{"color":"rgb(71, 137, 58)","dashStyle":"DashDot"}},{"value":0,"name":"Zero","line":{"color":"rgb(173, 70, 64)","dashStyle":"DashDot"}},{"value":1000,"name":"Upper","line":{"color":"rgb(71, 137, 58)","dashStyle":"DashDot"}}]}},{"id":"CMBCI","meta":{"title":"Constance Brown Composite Index","overlay":false},"defaults":{"inputs":[{"name":"Period1Rsi","value":14,"integer":true},{"name":"Period1Mom","value":9,"integer":true},{"name":"Period2Rsi","value":3,"integer":true},{"name":"Period2Ma","value":3,"integer":true},{"name":"PeriodFastMa","value":13,"integer":true},{"name":"PeriodSlowMa","value":33,"integer":true}],"curves":[{"colors":["#2c73ee"],"fields":["CMBCI"]},{"colors":["#2b7119"],"fields":["CMBCIF"]},{"colors":["#e2413e"],"fields":["CMBCIS"]}]}},{"id":"COTI","meta":{"title":"Commitment of Traders (COT) Index","overlay":false,"enumerations":[{"input":"History","values":["6M","1Y","2Y","3Y","4Y","5Y","10Y"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"History","value":"3Y"}],"curves":[{"colors":["#e2413e"],"fields":["COTI"]}]}},{"id":"CHEXI","meta":{"title":"Chandelier Exit Indicator","overlay":true,"enumerations":[{"input":"Direction","values":["Long","Short"]}]},"defaults":{"inputs":[{"name":"Direction","value":"Long"},{"name":"Period","value":22,"integer":true},{"name":"Multiplier","value":3}],"curves":[{"colors":["#51b44c"],"fields":["CHEXL"]},{"colors":["#eb484b"],"fields":["CHEXS"]}]}},{"id":"OPTIV","meta":{"title":"Implied Volatility","overlay":false,"enumerations":[{"input":"TimeFrame","values":["Implied Volatility","5-Day Average IV","1-Month Average IV","3-Month Average IV","6-Month Average IV","1-Year Average IV","YTD Average IV"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"Implied Volatility"}],"curves":[{"colors":["#2284dd"],"visible":false,"fields":["WeighImplVolHigh"]},{"colors":["#f58621"],"fields":["WeighImplVol"]},{"colors":["#480048"],"visible":false,"fields":["WeighImplVolLow"]}]}},{"id":"IVRANK","meta":{"title":"Implied Volatility Rank","overlay":false,"enumerations":[{"input":"TimeFrame","values":["5-Day","1-Month","3-Month","6-Month","1-Year","YTD"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"1-Year"}],"curves":[{"colors":["#027d26"],"fields":["ImplVolRank1Y"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"IVPCTL","meta":{"title":"Implied Volatility Percentile","overlay":false,"enumerations":[{"input":"TimeFrame","values":["5-Day","1-Month","3-Month","6-Month","1-Year","YTD"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"1-Year"}],"curves":[{"colors":["#b62594"],"fields":["ImplVolPerc1Y"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"OPTVOLPC","meta":{"title":"Put Call Volume Ratio","overlay":false},"defaults":{"curves":[{"colors":["#808080"],"fields":["PutCallVolRatio"]}]}},{"id":"OPTOIPC","meta":{"title":"Put Call Open Interest Ratio","overlay":false},"defaults":{"curves":[{"colors":["#0a7fff"],"fields":["PutCallOIRatio"]}]}},{"id":"OPTVOL","meta":{"title":"Options Volume","overlay":false},"defaults":{"curves":[{"style":"Column","colors":["#844105"],"fields":["OptTotVol"]},{"style":"StackedColumn","colors":["#fe2322"],"fields":["OptPutVol"]},{"style":"StackedColumn","colors":["#1fcc20"],"fields":["OptCallVol"]}]}},{"id":"OPTOI","meta":{"title":"Options Open Interest","overlay":false},"defaults":{"curves":[{"style":"Column","colors":["#5f2f04"],"fields":["TotalOpenInt"]},{"style":"StackedColumn","colors":["#ce0201"],"fields":["PutOpenInt"]},{"style":"StackedColumn","colors":["#169317"],"fields":["CallOpenInt"]}]}},{"id":"CHOP","meta":{"title":"Choppiness Index","overlay":false,"shiftable":true,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14,"integer":true},{"name":"Offset","value":0,"integer":true}],"curves":[{"colors":["#1c6cff"],"fields":["CHOP"]}],"levels":[{"value":38.2,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}},{"value":50,"name":"Middle","line":{"color":"rgba(96, 96, 96, 0.5)","dashStyle":"Dash"}},{"value":61.8,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":38.2,"to":61.8}}]}},{"id":"MACLD","meta":{"title":"Moving Average Cloud","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":21,"integer":true},{"name":"Period2","value":34,"integer":true}],"curves":[{"colors":["#00cd00"],"fields":["MACLD1"],"style":"Line"},{"colors":["#ff0000"],"fields":["MACLD2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["MACLD1","MACLD2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"PC","meta":{"title":"Probability Cones","overlay":true,"enumerations":[{"input":"Volatility","values":["HV 30","HV 60","HV 90","HV 180","Custom"]},{"input":"StandardDeviations","values":["1","2","3"]}]},"defaults":{"inputs":[{"name":"Volatility","value":"HV 90"},{"name":"VolatilityPercent","value":20},{"name":"StandardDeviations","value":"3"},{"name":"PeriodForecast","value":45,"integer":true},{"name":"PeriodTarget","value":30,"integer":true},{"name":"TargetPrice1","value":0},{"name":"TargetPrice2","value":0}],"curves":[{"colors":["#5db660"],"fields":["PCUP1"],"style":"Line","dashStyle":"Dash"},{"colors":["#5db660"],"fields":["PCDN1"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCUP2"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCDN2"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCUP3"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCDN3"],"style":"Line","dashStyle":"Dash"},{"colors":["rgba(93, 182, 96, 0.1)"],"fields":["PCUP1","PCDN1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCUP2","PCUP1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCDN1","PCDN2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCUP3","PCUP2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCDN2","PCDN3"],"style":"Ribbon","lineWidth":0},{"colors":["#ff54e2"],"fields":["PCTD"],"lineWidth":2,"dashStyle":"Solid"},{"colors":["#ffaf2c"],"fields":["PCTP"],"lineWidth":2,"dashStyle":"Solid"}]}},{"id":"GREEKS","meta":{"title":"Greeks","overlay":false,"decimals":4},"defaults":{"curves":[{"colors":["#7ca685"],"fields":["Delta"]},{"colors":["#c16a6a"],"fields":["Gamma"]},{"colors":["#5a7ca9"],"fields":["Theta"]},{"colors":["#e4a76b"],"fields":["Vega"]}]}},{"id":"TDI","meta":{"title":"Traders Dynamic Index","overlay":false,"range":{"min":0,"max":100},"decimals":2,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"PeriodRSI","value":13,"integer":true},{"name":"PeriodTradeSignal","value":7,"integer":true},{"name":"PeriodMarketBase","value":34,"integer":true},{"name":"PeriodBB","value":34,"integer":true},{"name":"MultiplierBB","value":1.6185},{"name":"Source","value":"Close"}],"curves":[{"colors":["#0088ff"],"fields":["TDIUPR"]},{"colors":["#0088ff"],"fields":["TDILWR"]},{"colors":["rgba(0, 136, 255, 0.1)"],"fields":["TDIUPR","TDILWR"],"style":"Ribbon","lineWidth":0},{"colors":["#00c853"],"fields":["TDIPRC"],"lineWidth":2},{"colors":["#ff1744"],"fields":["TDITSL"],"lineWidth":2},{"colors":["#ff9100"],"fields":["TDIMBL"],"lineWidth":2}],"levels":[{"value":70,"name":"Overbought","line":{"color":"#808080","dashStyle":"Dash"}},{"value":30,"name":"Oversold","line":{"color":"#808080","dashStyle":"Dash"}}]}},{"id":"PPS","meta":{"title":"Price Percent Stop","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]},{"input":"Type","values":["Percent","Price"]}]},"defaults":{"inputs":[{"name":"Period","value":20,"integer":true},{"name":"Range","value":"High/Low"},{"name":"Direction","value":"Long"},{"name":"Type","value":"Percent"},{"name":"StopValue","value":10}],"curves":[{"colors":["#fc0d1b","#00b04b"],"fields":["PPS"],"varyColorPerBar":true}]}},{"id":"FRAMA","meta":{"title":"Fractal Adaptive Moving Average","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":16,"integer":true},{"name":"Source","value":"HL/2"}],"curves":[{"colors":["#ef4226"],"fields":["FRAMA"]}]}},{"id":"FISHER","meta":{"title":"Fisher Transform","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":9,"integer":true}],"curves":[{"colors":["#2962FF"],"fields":["FISHER"]},{"colors":["#FF6D00"],"fields":["FISHTRG"]}],"levels":[{"value":1.5,"name":"1.5","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":0.75,"name":"0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":0,"name":"0","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":-0.75,"name":"-0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":-1.5,"name":"-1.5","line":{"color":"#E91E63","dashStyle":"Dash"}}]}},{"id":"RCI","meta":{"title":"Spearman Rank Correlation Index","overlay":false,"decimals":2,"range":{"min":-100,"max":100},"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}],"singleFieldBased":true},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":10,"integer":true},{"name":"PeriodSignal","value":3,"integer":true},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#2196F3"],"fields":["RCI"],"lineWidth":2},{"colors":["#FF9800"],"fields":["RCISIG"]}],"levels":[{"value":80,"name":"+80","line":{"color":"#808080","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#808080","dashStyle":"DashDot"}},{"value":-80,"name":"-80","line":{"color":"#808080","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":-80,"to":80}}]}},{"id":"ZIGZAG","meta":{"title":"ZigZag","overlay":true,"enumerations":[{"input":"PercentMode","values":["Fixed","ATR"]},{"input":"Method","values":["High/Low","Source"]},{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"ReversalChange","values":["None","Absolute","Percent"]}]},"defaults":{"inputs":[{"name":"PercentMode","value":"ATR"},{"name":"Method","value":"High/Low"},{"name":"Source","value":"Close"},{"name":"ReversalChange","value":"None"},{"name":"Percent","value":5},{"name":"PeriodAtr","value":14,"integer":true},{"name":"MultiplierAtr","value":2.5}],"curves":[{"colors":["#2962FF"],"fields":["ZZPIVOT"]}]}},{"id":"BOP","meta":{"title":"Balance of Power","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":14,"integer":true}],"curves":[{"colors":["#ef4226"],"fields":["BOP"]},{"colors":["#896fc3"],"fields":["BOPAVG"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CORR","meta":{"title":"Correlation Coefficient","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Symbol","value":"$SPX"},{"name":"Period","value":20,"integer":true}],"curves":[{"colors":["#2196F3"],"fields":["CORR"]}],"levels":[{"value":1,"name":"Upper","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-1,"name":"Lower","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"RVI","meta":{"title":"Relative Vigor Index","overlay":false,"decimals":4},"defaults":{"inputs":[{"name":"Period","value":10,"integer":true}],"curves":[{"colors":["#2196F3"],"fields":["RVI"]},{"colors":["#FF9800"],"fields":["RVISIG"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"ATREXT","meta":{"title":"ATR Extension","overlay":true,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"PeriodAverage","value":50,"integer":true},{"name":"PeriodATR","value":20,"integer":true},{"name":"Multiplier","value":5}],"curves":[{"colors":["#0000ff"],"fields":["ATREXTAVG"],"style":"Line"},{"colors":["#50cc52"],"fields":["ATREXTUP"],"style":"Dots"},{"colors":["#d46757"],"fields":["ATREXTLOW"],"style":"Dots"}]}},{"id":"DIDI","meta":{"title":"DIDI Index","overlay":false,"decimals":4,"singleFieldBased":true,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"PeriodShort","value":3,"integer":true},{"name":"PeriodMedium","value":8,"integer":true},{"name":"PeriodLong","value":20,"integer":true},{"name":"Average","value":"MA"},{"name":"Source","value":"Close"}],"curves":[{"colors":["#00b04b"],"fields":["DIDIS"]},{"colors":["#ef4226"],"fields":["DIDIL"]},{"colors":["rgba(239, 66, 38, 0.2)","rgba(0, 176, 75, 0.2)"],"fields":["DIDIS","DIDIL"],"style":"Ribbon","varyColorPerBar":true},{"colors":["rgba(0, 176, 75, 0.8)"],"fields":["DIDIUP"],"style":"Dots","lineWidth":4},{"colors":["rgba(239, 66, 38, 0.8)"],"fields":["DIDIDN"],"style":"Dots","lineWidth":4}],"levels":[{"value":1,"name":"Medium","line":{"color":"#606060","dashStyle":"Dash"}}]}}]`);function qs(e){switch(e){case`Renko`:return B.DEFAULT_RENKO_INPUTS;case`Kagi`:return B.DEFAULT_KAGI_INPUTS;case`PointAndFigure`:return B.DEFAULT_PNF_INPUTS;case`LineBreak`:return B.DEFAULT_LINEBREAK_INPUTS;case`Baseline`:return B.DEFAULT_BASELINE_INPUTS}}function Js(e,t){for(let n of e??[]){let e=t?.find(e=>e.name===n.name);e?.integer===!0?n.integer=!0:e&&delete n.integer;let r=e?.value,i=typeof r==`number`&&Number.isFinite(r),a=typeof n.value!=`number`||!Number.isFinite(n.value);i&&a&&(n.value=r),n.integer===!0&&typeof n.value==`number`&&Number.isFinite(n.value)&&(n.value=Math.ceil(n.value))}}function Ys(e){let t=rc(!0);for(let n of e.panes??[])for(let e of n.axes??[])for(let n of e.plots??[])n.type===`Study`?Js(n.inputs,t.find(e=>e.id===n.study)?.defaults.inputs):n.type===`Symbol`&&Js(n.inputs,qs(n.curves?.[0]?.style));return e}function Xs(e){switch(e){case B.CHART_SCHEMA:return Hs;case B.STUDIES_SCHEMA:return Us;case B.FIELDS_SCHEMA:return Ws;case B.ACCESSOR_SCHEMA:return Gs;default:throw Error(`Unknown schema name: ${e}`)}}var Zs=[],Qs=!1,$s=!0;function ec(e){$s=e}function tc(e){Zs=Zs.concat(Mf(e,B.STUDIES_SCHEMA))}var nc=new Map;function rc(e=!1){Qs||=(tc(Ks),!0);let t=ne[$()?.config.mode??`Unspecified`];if(e||!$s)return Zs;if(!nc.has(t)){let e=se(uc,t);nc.set(t,Zs.filter(e))}return nc.get(t)}function V(e){return F(ac(e))}function ic(e){return ps(pF().display,e)}function ac(e){return rc().find(t=>t.id===e)}function oc(e){return ac(e)!==void 0}function sc(e){let t=[G.Open,G.High,G.Low,G.Close,G.Volume].map(e=>e.id);return e.defaults.source&&!t.includes(e.defaults.source)}function cc(e){return e.meta.singleFieldBased===!0}function lc(e){return[ne.DemoSite,ne.cmdtyView].includes(e)}function uc(e,t){let n=t.id;if(n===`PVACP`)return[ne.cmdtyView,ne.DemoSite].includes(e);let r=[`CPMI`,`CTPI`,`CTM`,`JPI`,`CTTP`,`CTTI`],i=[ne.GBE,ne.cmdtyView];return!(r.includes(n)&&!i.includes(e))}var dc=null,fc=!1;function pc(){if(!fc){let e=[b.Study,b.BalanceSheet,b.IncomeStatement],t=e.reduce((e,t)=>(e[t]=[],e),{});Object.values(G).filter(t=>e.includes(t.category)).map(e=>{t[e.category].push({id:e.id,name:e.name,shortName:e.shortName})});let n=Object.keys(h).filter(e=>{let t=parseInt(e);if(Number.isFinite(t))return h[t]}),r=F(rc()).sort((e,t)=>e.meta.overlay===t.meta.overlay?e.meta.title<t.meta.title?-1:1:e.meta.overlay<t.meta.overlay?1:-1),i=Vs(),a=Object.entries(i).map(([e,t])=>({id:e,options:t.editable,defaults:t.defaults??{},types:t.types,numPoints:t.numPoints})),o=[`Renko`,`Kagi`,`PointAndFigure`,`LineBreak`,`Baseline`].map(e=>[e,F(qs(e))]);dc={studies:r,incomeStatements:t[b.IncomeStatement],balanceSheets:t[b.BalanceSheet],studyFields:t[b.Study],curveStyles:n,curveStyleInputs:Object.fromEntries(o),annotations:a},fc=!0}return dc}var mc=o(((e,t)=>{(function(){var e={PATH:1,SELECTOR:2,OBJ_PRED:3,POS_PRED:4,LOGICAL_EXPR:5,COMPARISON_EXPR:6,MATH_EXPR:7,CONCAT_EXPR:8,UNARY_EXPR:9,POS_EXPR:10,LITERAL:11},n=(function(){var t={ID:1,NUM:2,STR:3,BOOL:4,NULL:5,PUNCT:6,EOP:7},n={UNEXP_TOKEN:`Unexpected token "%0"`,UNEXP_EOP:`Unexpected end of path`},r,i,a,o;function s(e){r=e.split(``),i=0,a=null,o=r.length;var n=c(),s=O();return s.type!==t.EOP&&me(s),n}function c(){for(var t=l(),n;E(`|`);)O(),(n||=[t]).push(l());return n?{type:e.CONCAT_EXPR,args:n}:t}function l(){return E(`(`)?u():f()}function u(){re(`(`);var t=c();re(`)`);for(var n=[],r;r=d();)n.push(r);return n.length?t.type===e.PATH?(t.parts=t.parts.concat(n),t):(n.unshift(t),{type:e.PATH,parts:n}):t}function d(){if(E(`[`))return h();if(E(`{`))return g();if(E(`(`))return u()}function f(){D()||me(O());var t=!1,n;E(`^`)?(O(),t=!0):ne()&&(n=O().val.substr(1));for(var r=[],i;i=p();)r.push(i);return{type:e.PATH,fromRoot:t,subst:n,parts:r}}function p(){return te()?m():d()}function m(){var n=O().val,r=ie(),i;return(E(`*`)||r.type===t.ID||r.type===t.STR)&&(i=O().val),{type:e.SELECTOR,selector:n,prop:i}}function h(){re(`[`);var t=C();return re(`]`),{type:e.POS_PRED,arg:t}}function g(){re(`{`);var t=_();return re(`}`),{type:e.OBJ_PRED,arg:t}}function _(){for(var t=v(),n;E(`||`);)O(),(n||=[t]).push(v());return n?{type:e.LOGICAL_EXPR,op:`||`,args:n}:t}function v(){for(var t=y(),n;E(`&&`);)O(),(n||=[t]).push(y());return n?{type:e.LOGICAL_EXPR,op:`&&`,args:n}:t}function y(){for(var t=b();E(`==`)||E(`!=`)||E(`===`)||E(`!==`)||E(`^==`)||E(`==^`)||E(`^=`)||E(`=^`)||E(`$==`)||E(`==$`)||E(`$=`)||E(`=$`)||E(`*==`)||E(`==*`)||E(`*=`)||E(`=*`);)t={type:e.COMPARISON_EXPR,op:O().val,args:[t,y()]};return t}function b(){for(var t=x();E(`<`)||E(`>`)||E(`<=`)||E(`>=`);)t={type:e.COMPARISON_EXPR,op:O().val,args:[t,b()]};return t}function x(){for(var t=S();E(`+`)||E(`-`);)t={type:e.MATH_EXPR,op:O().val,args:[t,S()]};return t}function S(){for(var t=w();E(`*`)||E(`/`)||E(`%`);)t={type:e.MATH_EXPR,op:O().val,args:[t,S()]};return t}function C(){if(E(`:`))return O(),{type:e.POS_EXPR,toIdx:w()};var t=w();return E(`:`)?(O(),E(`]`)?{type:e.POS_EXPR,fromIdx:t}:{type:e.POS_EXPR,fromIdx:t,toIdx:w()}):{type:e.POS_EXPR,idx:t}}function w(){return E(`!`)||E(`-`)?{type:e.UNARY_EXPR,op:O().val,arg:w()}:T()}function T(){var n=ie().type;return n===t.STR||n===t.NUM||n===t.BOOL||n===t.NULL?{type:e.LITERAL,val:O().val}:D()?f():E(`(`)?ee():me(O())}function ee(){re(`(`);var e=_();return re(`)`),e}function E(e){var n=ie();return n.type===t.PUNCT&&n.val===e}function D(){return te()||ne()||E(`^`)}function te(){var e=ie();if(e.type===t.PUNCT){var n=e.val;return n===`.`||n===`..`}return!1}function ne(){var e=ie();return e.type===t.ID&&e.val[0]===`$`}function re(e){var n=O();(n.type!==t.PUNCT||n.val!==e)&&me(n)}function ie(){if(a!==null)return a;var e=i;return a=ae(),i=e,a}function ae(){for(;se(r[i]);)++i;if(i>=o)return{type:t.EOP,range:[i,i]};var e=pe();if((e||=ue())||(e=de())||(e=fe()))return e;e={range:[i,i]},i>=o?e.type=t.EOP:e.val=r[i],me(e)}function O(){var e;return a?(i=a.range[1],e=a,a=null,e):ae()}function oe(e){return`0123456789`.indexOf(e)>=0}function se(e){return` \r
|
|
2
|
+
`.indexOf(e)>-1}function ce(e){return e===`$`||e===`@`||e===`_`||e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}function le(e){return ce(e)||e>=`0`&&e<=`9`}function ue(){var e=r[i];if(ce(e)){for(var n=i,a=e;++i<o&&(e=r[i],le(e));)a+=e;switch(a){case`true`:case`false`:return{type:t.BOOL,val:a===`true`,range:[n,i]};case`null`:return{type:t.NULL,val:null,range:[n,i]};default:return{type:t.ID,val:a,range:[n,i]}}}}function de(){if(!(r[i]!==`"`&&r[i]!==`'`)){for(var e=r[i],n=++i,a=``,s=!1,c;i<o;){if(c=r[i++],c===`\\`)c=r[i++];else if((c===`"`||c===`'`)&&c===e){s=!0;break}a+=c}if(s)return{type:t.STR,val:a,range:[n,i]}}}function fe(){var e=i,n=r[i],a=n===`.`;if(a||oe(n)){for(var s=n;++i<o;){if(n=r[i],n===`.`){if(a)return;a=!0}else if(!oe(n))break;s+=n}return{type:t.NUM,val:a?parseFloat(s):parseInt(s,10),range:[e,i]}}}function pe(){var e=i,n=r[i],a=r[i+1];if(n===`.`)return oe(a)?void 0:r[++i]===`.`?{type:t.PUNCT,val:`..`,range:[e,++i]}:{type:t.PUNCT,val:`.`,range:[e,i]};if(a===`=`){var o=r[i+2];if(o===`=`){if(`=!^$*`.indexOf(n)>=0)return{type:t.PUNCT,val:n+a+o,range:[e,i+=3]}}else if(`^$*`.indexOf(o)>=0){if(n===`=`)return{type:t.PUNCT,val:n+a+o,range:[e,i+=3]}}else if(`=!^$*><`.indexOf(n)>=0)return{type:t.PUNCT,val:n+a,range:[e,i+=2]}}else if(n===`=`&&`^$*`.indexOf(a)>=0)return{type:t.PUNCT,val:n+a,range:[e,i+=2]};if(n===a&&(n===`|`||n===`&`))return{type:t.PUNCT,val:n+a,range:[e,i+=2]};if(`:{}()[]^+-*/%!><|`.indexOf(n)>=0)return{type:t.PUNCT,val:n,range:[e,++i]}}function me(e){e.type===t.EOP&&k(e,n.UNEXP_EOP),k(e,n.UNEXP_TOKEN,e.val)}function k(e,t){var n=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,function(e,t){return n[t]||``}),i=Error(r);throw i.column=e.range[0],i}return s})(),r=(function(){var t,n,r,i;function a(){if(i.length)return i.shift();var e=`v`+ ++r;return n.push(e),e}function o(){for(var e=arguments,t=e.length;t--;)i.push(e[t])}function s(a){if(t=[],n=[`res`],r=0,i=[],p(a,`res`,`data`),t.unshift(`var `,Array.isArray?`isArr = Array.isArray`:`toStr = Object.prototype.toString, isArr = function(o) { return toStr.call(o) === "[object Array]"; }`,`, concat = Array.prototype.concat`,`,`,n.join(`,`),`;`),a.type===e.PATH){var o=a.parts[a.parts.length-1];o&&o.type===e.POS_PRED&&`idx`in o.arg&&t.push(`res = res[0];`)}return t.push(`return res;`),t.join(``)}function c(n,r,i){var a=n.parts,o=0,s=a.length;for(t.push(r,`=`,n.fromRoot?`data`:n.subst?`subst.`+n.subst:i,`;`,`isArr(`+r+`) || (`+r+` = [`+r+`]);`);o<s;){var c=a[o++];switch(c.type){case e.SELECTOR:c.selector===`..`?u(c,r,r):l(c,r,r);break;case e.OBJ_PRED:d(c,r,r);break;case e.POS_PRED:f(c,r,r);break;case e.CONCAT_EXPR:b(c,r,r);break}}}function l(e,n,r){if(e.prop){var i=x(e.prop),s=a(),c=a(),l=a(),u=a(),d=a(),f=a(),p=a();t.push(s,`= [];`,c,`= 0;`,l,`=`,r,`.length;`,p,`= [];`,`while(`,c,`<`,l,`) {`,u,`=`,r,`[`,c,`++];`,`if(`,u,`!= null) {`),e.prop===`*`?(t.push(`if(typeof `,u,`=== "object") {`,`if(isArr(`,u,`)) {`,s,`=`,s,`.concat(`,u,`);`,`}`,`else {`,`for(`,d,` in `,u,`) {`,`if(`,u,`.hasOwnProperty(`,d,`)) {`,f,`=`,u,`[`,d,`];`),S(s,f),t.push(`}`,`}`,`}`,`}`)):(t.push(f,`=`,u,`[`,i,`];`),S(s,f,p,l)),t.push(`}`,`}`,n,`=`,l,`> 1 &&`,p,`.length?`,p,`.length > 1?`,`concat.apply(`,s,`,`,p,`) :`,s,`.concat(`,p,`[0]) :`,s,`;`),o(s,c,l,u,d,f,p)}}function u(e,n,r){var i=e.prop,s=a(),c=a(),l=a(),u=a(),d=a(),f=a(),p=a(),m=a();t.push(s,`=`,r,`.slice(),`,m,`= [];`,`while(`,s,`.length) {`,c,`=`,s,`.shift();`),i?t.push(`if(typeof `,c,`=== "object" &&`,c,`) {`):t.push(`if(typeof `,c,`!= null) {`),t.push(l,`= [];`,`if(isArr(`,c,`)) {`,u,`= 0,`,p,`=`,c,`.length;`,`while(`,u,`<`,p,`) {`,f,`=`,c,`[`,u,`++];`),i&&t.push(`if(typeof `,f,`=== "object") {`),S(l,f),i&&t.push(`}`),t.push(`}`,`}`,`else {`),i?i!==`*`&&(t.push(f,`=`,c,`["`+i+`"];`),S(m,f)):(S(m,c),t.push(`if(typeof `,c,`=== "object") {`)),t.push(`for(`,d,` in `,c,`) {`,`if(`,c,`.hasOwnProperty(`,d,`)) {`,f,`=`,c,`[`,d,`];`),S(l,f),i===`*`&&S(m,f),t.push(`}`,`}`),i||t.push(`}`),t.push(`}`,l,`.length &&`,s,`.unshift.apply(`,s,`,`,l,`);`,`}`,`}`,n,`=`,m,`;`),o(s,c,l,u,d,f,p,m)}function d(e,n,r){var i=a(),s=a(),c=a(),l=a(),u=a();t.push(i,`= [];`,s,`= 0;`,c,`=`,r,`.length;`,`while(`,s,`<`,c,`) {`,u,`=`,r,`[`,s,`++];`),p(e.arg,l,u),t.push(w(e.arg,l),`&&`,i,`.push(`,u,`);`,`}`,n,`=`,i,`;`),o(i,s,c,u,l)}function f(e,n,r){var i=e.arg,s,c;if(i.idx){var l=a();return p(i.idx,l,r),t.push(l,`< 0 && (`,l,`=`,r,`.length +`,l,`);`,n,`=`,r,`[`,l,`] == null? [] : [`,r,`[`,l,`]];`),o(l),!1}else i.fromIdx?i.toIdx?(p(i.fromIdx,s=a(),r),p(i.toIdx,c=a(),r),t.push(n,`=`,r,`.slice(`,s,`,`,c,`);`),o(s,c)):(p(i.fromIdx,s=a(),r),t.push(n,`=`,r,`.slice(`,s,`);`),o(s)):(p(i.toIdx,c=a(),r),t.push(n,`=`,r,`.slice(0,`,c,`);`),o(c))}function p(n,r,i){switch(n.type){case e.PATH:c(n,r,i);break;case e.CONCAT_EXPR:b(n,r,i);break;case e.COMPARISON_EXPR:h(n,r,i);break;case e.MATH_EXPR:v(n,r,i);break;case e.LOGICAL_EXPR:_(n,r,i);break;case e.UNARY_EXPR:y(n,r,i);break;case e.LITERAL:t.push(r,`=`),m(n.val),t.push(`;`);break}}function m(e){t.push(typeof e==`string`?x(e):e===null?`null`:e)}function h(n,r,i){var s=a(),c=a(),l=a(),u=a(),d=a(),f=a(),m=a(),h=a(),_=n.args[0],v=n.args[1];t.push(r,`= false;`),p(_,s,i),p(v,c,i);var y=_.type===e.PATH,b=v.type===e.LITERAL;t.push(l,`=`),y?t.push(`true;`):t.push(`isArr(`,s,`);`),t.push(u,`=`),b?t.push(`false;`):t.push(`isArr(`,c,`);`),t.push(`if(`),y||t.push(l,`&&`),t.push(s,`.length === 1) {`,s,`=`,s,`[0];`,l,`= false;`,`}`),b||t.push(`if(`,u,`&&`,c,`.length === 1) {`,c,`=`,c,`[0];`,u,`= false;`,`}`),t.push(d,`= 0;`,`if(`,l,`) {`,m,`=`,s,`.length;`),b||(t.push(`if(`,u,`) {`,h,`=`,c,`.length;`,`while(`,d,`<`,m,`&& !`,r,`) {`,f,`= 0;`,`while(`,f,`<`,h,`) {`),g(n.op,[s,`[`,d,`]`].join(``),[c,`[`,f,`]`].join(``)),t.push(r,`= true;`,`break;`,`}`,`++`,f,`;`,`}`,`++`,d,`;`,`}`,`}`,`else {`)),t.push(`while(`,d,`<`,m,`) {`),g(n.op,[s,`[`,d,`]`].join(``),c),t.push(r,`= true;`,`break;`,`}`,`++`,d,`;`,`}`),b||t.push(`}`),t.push(`}`),b||(t.push(`else if(`,u,`) {`,h,`=`,c,`.length;`,`while(`,d,`<`,h,`) {`),g(n.op,s,[c,`[`,d,`]`].join(``)),t.push(r,`= true;`,`break;`,`}`,`++`,d,`;`,`}`,`}`)),t.push(`else {`,r,`=`,ie[n.op](s,c),`;`,`}`),o(s,c,l,u,d,f,m,h)}function g(e,n,r){t.push(`if(`,ie[e](n,r),`) {`)}function _(e,n,r){var i=[],s=e.args,c=s.length,l=0,u;switch(t.push(n,`= false;`),e.op){case`&&`:for(;l<c;)i.push(u=a()),p(s[l],u,r),t.push(`if(`,w(s[l++],u),`) {`);t.push(n,`= true;`);break;case`||`:for(;l<c;)i.push(u=a()),p(s[l],u,r),t.push(`if(`,w(s[l],u),`) {`,n,`= true;`,`}`),l+++1<c&&t.push(`else {`);--c;break}for(;c--;)t.push(`}`);o.apply(null,i)}function v(e,n,r){var i=a(),s=a(),c=e.args;p(c[0],i,r),p(c[1],s,r),t.push(n,`=`,ie[e.op](T(c[0],i),T(c[1],s)),`;`),o(i,s)}function y(e,n,r){var i=a(),s=e.arg;switch(p(s,i,r),e.op){case`!`:t.push(n,`= !`,w(s,i)+`;`);break;case`-`:t.push(n,`= -`,T(s,i)+`;`);break}o(i)}function b(e,n,r){for(var i=[],s=e.args,c=s.length,l=0;l<c;)i.push(a()),p(s[l],i[l++],r);t.push(n,`= concat.call(`,i.join(`,`),`);`),o.apply(null,i)}function x(e){return`'`+e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)+`'`}function S(e,n,r,i){t.push(`if(typeof `,n,`!== "undefined") {`,`if(isArr(`,n,`)) {`),r&&(t.push(i,`> 1?`),C(r,n),t.push(`:`)),t.push(e,`=`,e,`.length?`,e,`.concat(`,n,`) :`,n,`.slice()`,`;`,`}`,`else {`),r&&t.push(`if(`,r,`.length) {`,e,`= concat.apply(`,e,`,`,r,`);`,r,`= [];`,`}`),C(e,n),t.push(`;`,`}`,`}`)}function C(e,n){t.push(e,`.length?`,e,`.push(`,n,`) :`,e,`[0] =`,n)}function w(t,n){switch(t.type){case e.LOGICAL_EXPR:return n;case e.LITERAL:return`!!`+n;case e.PATH:return n+`.length > 0`;default:return[`(typeof `,n,`=== "boolean"?`,n,`:`,`isArr(`,n,`)?`,n,`.length > 0 : !!`,n,`)`].join(``)}}function T(t,n){switch(t.type){case e.LITERAL:return n;case e.PATH:return n+`[0]`;default:return[`(isArr(`,n,`)?`,n,`[0] : `,n,`)`].join(``)}}function ee(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string" &&`,e,`.indexOf(`,t,`) === 0`].join(``)}function E(e,t){return[e,`!= null &&`,t,`!= null &&`,e,`.toString().toLowerCase().indexOf(`,t,`.toString().toLowerCase()) === 0`].join(``)}function D(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string" &&`,e,`.length >=`,t,`.length &&`,e,`.lastIndexOf(`,t,`) ===`,e,`.length -`,t,`.length`].join(``)}function te(e,t){return[e,`!= null &&`,t,`!= null &&`,`(`,e,`=`,e,`.toString()).length >=`,`(`,t,`=`,t,`.toString()).length &&`,`(`,e,`.toLowerCase()).lastIndexOf(`,`(`,t,`.toLowerCase())) ===`,e,`.length -`,t,`.length`].join(``)}function ne(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string" &&`,e,`.indexOf(`,t,`) > -1`].join(``)}function re(e,t){return[e,`!= null && `,t,`!= null &&`,e,`.toString().toLowerCase().indexOf(`,t,`.toString().toLowerCase()) > -1`].join(``)}var ie={"===":function(e,t){return e+`===`+t},"==":function(e,t){return[`typeof `,e,`=== "string" && typeof `,t,`=== "string"?`,e,`.toLowerCase() ===`,t,`.toLowerCase() :`+e,`==`,t].join(``)},">=":function(e,t){return e+`>=`+t},">":function(e,t){return e+`>`+t},"<=":function(e,t){return e+`<=`+t},"<":function(e,t){return e+`<`+t},"!==":function(e,t){return e+`!==`+t},"!=":function(e,t){return e+`!=`+t},"^==":ee,"==^":function(e,t){return ee(t,e)},"^=":E,"=^":function(e,t){return E(t,e)},"$==":D,"==$":function(e,t){return D(t,e)},"$=":te,"=$":function(e,t){return te(t,e)},"*==":ne,"==*":function(e,t){return ne(t,e)},"=*":function(e,t){return re(t,e)},"*=":re,"+":function(e,t){return e+`+`+t},"-":function(e,t){return e+`-`+t},"*":function(e,t){return e+`*`+t},"/":function(e,t){return e+`/`+t},"%":function(e,t){return e+`%`+t}};return s})();function i(e){return Function(`data,subst`,r(n(e)))}var a={},o=[],s={cacheSize:100},c={cacheSize:function(e,t){if(t<e&&o.length>t)for(var n=o.splice(0,o.length-t),r=n.length;r--;)delete a[n[r]]}},l=function(e,t,n){return a[e]||(a[e]=i(e),o.push(e)>s.cacheSize&&delete a[o.shift()]),a[e](t,n||{})};l.version=`0.3.4`,l.params=function(e){if(!arguments.length)return s;for(var t in e)e.hasOwnProperty(t)&&(c[t]&&c[t](s[t],e[t]),s[t]=e[t])},l.compile=i,l.apply=l,typeof t==`object`&&typeof t.exports==`object`?t.exports=l:typeof modules==`object`?modules.define(`jspath`,function(e){e(l)}):typeof define==`function`?define(function(e,t,n){n.exports=l}):window.JSPath=l})()})),hc=o(((e,t)=>{t.exports=mc()}))();function gc(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===null}function _c(e,t,n){if(gc(e))return e;if(Array.isArray(e))return e.map(e=>_c(e,t,n)).filter(e=>e!==B.NULL_OBJECT);{let r=t.indexOf(e);if(r!==-1)return n[r];let i={};for(let r in e){let a=e[r];i[r]=_c(a,t,n)}return i}}function H(e,t,n){return[].concat((0,hc.apply)(t,e,n))}function U(e,t,n){let r=F(e),i=H(r,t),a=i.map(n);if(a.some(e=>e===void 0))throw Error(`Forgot to return transformed value from accessor ${n}`);return _c(r,i,a)}var vc=[`1D`,`5D`,`1M`,`3M`,`6M`,`1Y`,`5Y`,`Max`];function yc(e){let t=e.data.period;if(t!==null){let n=t===`Max`?B.AUTOFIT_PERIOD:`P${t}`,r=vc.findIndex(e=>e===t),i={unit:`Day`};r<2?i={unit:`Intraday`,size:15}:r>5&&(i={unit:`Month`}),delete e.data.period,e.display.period=n,e.data.aggregation=i,e.version=4}return e}function bc(e){let t=H(e,`..panes[0]..plots{.type === "Symbol"}[0].curves{.style === "Candlestick" && .attributes === "Hollow" }`);if(t.length===1){let e=t[0];e.attributes.splice(e.attributes.indexOf(`Hollow`),1),e.attributes.length===0&&delete e.attributes,e.style=`HollowCandles`,e.colors=F(B.COLOR_DEFAULT_VARY)}return e.version=5,e}function xc(e){let t=H(e,`..panes[0]..plots{.type === "Symbol"}[0]`);if(t.length===1){let e=t[0];e.main=!0}return e.version=6,e}function Sc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MAENV`,`BBANDS`,`KELCHN`,`KELEXP`,`DONCHN`]});return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>1){let t=e.curves.length-1,n=vo(e.curves[t].colors[0]);n.a=.1,e.curves.push({colors:[So(n)],fields:e.curves[0].fields.concat(e.curves[t].fields),lineWidth:0,style:`Ribbon`})}}),e.version=7,e}function Cc(e){let t=H(e,`..plots{.type === "Study" && (.study === "ADX" || .study === "ADXMOD")}`);return t.length>0&&t.forEach(e=>{if(e.inputs&&e.inputs.length===1&&e.inputs[0].name===B.INPUT_PERIOD){let t=e.inputs[0].value;e.inputs=[{name:`AdxSmoothing`,value:t},{name:`DiLength`,value:t}]}}),e.version=8,e}function wc(e){return e.length===1}function Tc(e){let t=H(e,`.display.yAxis`);if(wc(t)&&!wc(H(t,`.minorGridLines`))){let e=$().template,n=H(e,`.display.yAxis.minorGridLines`);wc(n)&&(t[0].minorGridLines=n[0])}return e.version=9,e}function Ec(e){return e.length===1}function Dc(e){let t=H(e,`.display.navigator`);if(Ec(t)&&!Ec(H(t,`.enabled`))){let e=$().template,n=H(e,`.display.navigator.enabled`);Ec(n)&&(t[0].enabled=n[0])}return e.version=10,e}function Oc(e){let t=H(e,`..plots{.type === "Study" && .study === "TCHN"}`);return t.length>0&&t.forEach(e=>{if(e.inputs&&e.inputs.length===1&&e.inputs[0].name===B.INPUT_PERIOD){let t=e.inputs[0].value;e.inputs=[{name:`PeriodUpper`,value:t},{name:`PeriodLower`,value:t},{name:`Range`,value:`High/Low`}]}}),e.version=11,e}function kc(e){let t=H(e,`.display.navigator`);if(t.length===1){let e=t[0];e.visible=e.enabled&&e.visible||!1,delete e.enabled}return e.version=12,e}function Ac(e){return H(e,`..annotations`).forEach(e=>{if(e.id===`AndrewsPitchfork`){let[t,n,r]=e.points;e.points=[n,t,r]}}),e.version=13,e}function jc(e){let t=H(e,`.display`);if(t.length===1){let e=t[0];e.scrollbar.visible=e.navigator.visible||!1,delete e.navigator}return e.version=14,e}var Mc={ATRLTR:`REATRHI`,ATRSTR:`REATRLO`,PeriodMARng:`PeriodAdjATR`,PeriodAdjATR:`FactorAdjATR`};function Nc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`ATRLTR`,`ATRSTR`]}),n=e=>nt(Mc,e)?Mc[e]:e;return t.length>0&&t.forEach(e=>{e.curves&&e.curves[0].fields&&(e.curves[0].fields=e.curves[0].fields.map(n)),e.inputs&&=e.inputs.map(e=>(e.name=n(e.name),e)),e.study=n(e.study)}),e.version=15,e}function Pc(e){let t=H(e,`..annotations`),n=`FibonacciRetracement`,r=e=>({shown:!1,value:e}),i=[-.618,-.236].map(r),a=[1.272,1.618,2.618].map(r);return t.forEach(e=>{if(e.id===n){let t=e.traits;if(P(t)&&P(t.factors)){let e=ps(null,n).factors,r=t.factors.map((t,n)=>{let r=!P(t);return{shown:!r,value:r?e[n+2].value:t}});t.factors=i.concat(r).concat(a)}}}),e.version=16,e}function Fc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`STOCHF`,`STOCHM`,`STOCHS`]});return t.length>0&&t.forEach(e=>{let t=e.study===`STOCHM`,n=V(t?`STOCHS`:e.study);P(e.inputs)?e.inputs.push({name:`Smoothing`,value:t?`EMA`:`MA`}):e.inputs=n.defaults.inputs.map(e=>(e.name===`Smoothing`&&t&&(e.value=`EMA`),e)),t&&(e.study=`STOCHS`)}),e.version=17,e}var Ic={BBANDS:{colors:[`#89211e`],fields:[`BOLLBM`],visible:!1},DONCHN:{colors:[`#ff6a00`],fields:[`DONMID`],visible:!1}};function Lc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`BBANDS`,`DONCHN`]});return t.length>0&&t.forEach(e=>{if(P(e.curves)&&e.curves?.length===3){let t=F(Ic[e.study]);e.curves.push(t)}}),e.version=18,e}function Rc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`REATRHI`,`REATRLO`]});return t.length>0&&t.forEach(e=>{e.inputs&&e.inputs.length===4&&e.inputs.push({name:`FactorATR`,value:2})}),e.version=19,e}function zc(e){let t=H(e,`.display.yAxis`);if(t.length===1){let e=t[0];P(e.showLastValue)&&(e.showLastValue=e.showLastValue?`All`:`None`)}return e.version=20,e}function Bc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CTMF`,`TPI`]});return t.length>0&&t.forEach(e=>{let t=e.study===`CTMF`?`GPMI`:`GTPI`;e.study=t,e.curves&&e.curves.length>0&&(e.curves.splice(1,1),e.curves[0].fields=[t])}),e.version=21,e}function Vc(e){let t=H(e,`..plots{.type === "Study" && .study === "AWEOSC"}`);return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>0&&e.curves[0].zones){let t=e.curves[0];delete t.zones,t.varyColorPerBar=!0}}),e.version=22,e}function Hc(e){let t=e.display.yAxis;return delete t.minPadding,delete t.maxPadding,e.version=23,e}function Uc(e){let t=H(e,`..plots{.type === "Study" && .study === "GTPI"}`);return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>0){let t=e.curves[0];t.colors=[`#ef4226`,`#2642ef`],t.zones=[{value:50,colors:1,gradient:`linDarken`},{colors:1,gradient:`linLighten`}]}}),e.version=24,e}function Wc(e){let t=H(e,`..plots{.type === "Study" && .study === "MOM"}`);if(t.length>0){let e=V(`MOM`);t.forEach(t=>{t.curves&&t.curves.length===1&&e.defaults.curves.length===2&&t.curves.push(e.defaults.curves[1]),t.inputs?.length===1&&e.defaults.inputs?.length===2&&t.inputs.push(e.defaults.inputs[1])})}return e.version=25,e}function Gc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MA`,`MAEXP`]});return t.length>0&&t.forEach(e=>{e.source&&delete e.source,e.inputs&&e.inputs.length===1?e.inputs.push({name:`Source`,value:`Close`}):e.inputs=V(e.study).defaults.inputs}),e.version=26,e}function Kc(e){let t=H(e,`..plots{.type === "Study" && .study === "ATR"}`);if(t.length>0){let e=V(`ATR`);t.forEach(t=>{t.curves&&t.curves.length===1&&e.defaults.curves.length===2&&t.curves.push(e.defaults.curves[1]),t.inputs?.length===2&&e.defaults.inputs?.length===3&&t.inputs.push(e.defaults.inputs[2])})}return e.version=27,e}function qc(e){let t=H(e,`..plots{.type === "Study"}`),n=V(`ALLG`),r=e=>{let t=n.defaults.curves.find(t=>t.fields[0]===e.fields[0]);if(P(t))return t.shift};return t.length>0&&t.forEach(e=>{delete e.shift,e.study===`ALLG`&&e.curves&&e.curves.forEach(e=>{let t=r(e);P(t)&&(e.shift=t)})}),e.version=28,e}function Jc(e){let t=Nf(U(e,`..plots{.type === "Study" && .study === "DEMARK"}`,e=>B.NULL_OBJECT));return t.version=29,t}function Yc(e){let t=Nf(U(e,`..plots{.type === "Study" && .study === "ULTOSC"}`,e=>B.NULL_OBJECT));return t.version=30,t}function Xc(e){let t=H(e,`..annotations`),n=`FibonacciRetracement`;return t.forEach(e=>{if(e.id===n){let[t,r]=e.points;t.time>r.time&&(e.points=[r,t]);let i=e.traits;P(i)&&(i.line2=ps(null,n).line2)}}),e.version=31,e}function Zc(e){return e.version=32,e}function Qc(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:rc().filter(e=>e.meta.shiftable===!0).map(e=>e.id)});return t.length>0&&t.forEach(e=>{let t=0;e.curves&&(t=e.curves[0].shift??0,e.curves?.forEach(e=>delete e.shift)),e.inputs&&e.inputs.push({name:`Offset`,value:t})}),e.version=33,e}function $c(e){let t=H(e,`..plots{.type === "Study" && .study === "VWAP"}`),n=V(`VWAP`);return t.length>0&&t.forEach(e=>{P(e.inputs)||(e.inputs=n.defaults.inputs.slice()),e.curves?.length===1&&e.curves.push(...n.defaults.curves.slice(1))}),e.version=34,e}function el(e){let t=`OBVOL`,n=H(e,`..plots{.type === "Study" && .study === "${t}"}`);if(n.length>0){let e=V(t);n.forEach(t=>{t.curves&&t.curves.length===1&&e.defaults.curves.length===2&&t.curves.push(e.defaults.curves[1]),!t.inputs&&e.defaults.inputs&&(t.inputs=e.defaults.inputs)})}return e.version=35,e}function tl(e){return H(e,`..annotations`).forEach(e=>{e.uid=bt()}),e.version=36,e}function nl(e){return e.version=37,e}function rl(e){let t=H(e,`..plots{.type === "Study" && .study === "CRS"}`),n=V(`CRS`);return t.length>0&&t.forEach(e=>{e.inputs?.length===3&&e.inputs.push(n.defaults.inputs[3])}),e.version=38,e}function il(e){let t=H(e,`..plots{.type === "Study" && .study === "PERF"}`),n=V(`PERF`);return t.length>0&&t.forEach(e=>{e.inputs?.length===0&&(e.inputs=n.defaults.inputs)}),e.version=39,e}function al(e){return e.version=40,e}function ol(e){return e.version=41,e}function sl(e){return e.version=42,e}function cl(e){let t=H(e,`..annotations`),n=[`FibonacciTimeZones`,`FibonacciFan`,`FibonacciArcs`],r=Vs();return t.forEach(e=>{let t=e.id;n.includes(t)?e.traits.factors=F(r[t].defaults.factors):t===`GannFan`&&(e.traits.angles=F(r[t].defaults.angles))}),e.version=43,e}function ll(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`RSI`,`RSIMOD`,`RSISTO`,`STOCHF`,`STOCHS`,`GTPI`]});return t.length>0&&t.forEach(e=>{e.levels&&e.levels.length===3&&!e.levels[1].name&&(e.levels[1].name=`Center`)}),e.version=57,e}function ul(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`VOL`,`MAVOL`]}),n=V(`MAVOL`),r=e=>{if(!P(e)||e.length<1)return`LikeMain`;switch(e[0]){case`ChangeBased`:return`CloseToClose`;case`OpenVsClose`:return`OpenToClose`;default:return`LikeMain`}},i=e=>({name:`BarColoring`,value:r(e)});return t.length>0&&t.forEach(e=>{if(!P(e.curves))return;let t=e.study===`VOL`?0:1;P(e.inputs)||(e.inputs=[]),t===1&&e.curves?.length===1&&e.curves.push(F(n.defaults.curves[1])),e.inputs.push(i(e.curves[t].attributes)),delete e.curves[t].attributes}),e.version=60,e}function dl(e){let t=`DIFA`,n=H(e,`..plots{.type === "Study" && .study === "${t}"}`),r=V(t);return n.length>0&&n.forEach(e=>{e.inputs?.length===2&&e.inputs.push(r.defaults.inputs[2])}),e.version=65,e}function fl(e){return H(e,`..annotations`).forEach(e=>{if(e.id===`FibonacciTimeZones`){let t=e.points;if(t.length===1){let e=F(t[0]);e.time+=1,t.push(e)}}}),e.version=66,e}function pl(e){let t=H(e,`..plots{.type === "Study" && .study === "DPO"}`),n=V(`DPO`);return t.length>0&&t.forEach(e=>{if(P(e.curves)&&e.curves?.length===1&&!P(e.levels)){let t=e.curves[0];if(t.colors?.length===1&&!P(t.zones)){e.levels=n.defaults.levels,t.zones=n.defaults.curves[0].zones;let r=t.colors[0],i=fo(r,.3);t.colors=[i,i]}}}),e.version=68,e}function ml(e){let t=`RSISTO`,n=H(e,`..plots{.type === "Study" && .study === "${t}"}`),r=V(t);return n.length>0&&n.forEach(e=>{e.curves?.length===1&&e.inputs?.length===2&&(e.curves.push(r.defaults.curves[1]),e.inputs.push(...r.defaults.inputs.slice(2)))}),e.version=70,e}var hl={[B.AT_SINGLE_STYLE]:!0,[B.AT_SHOW_BACKGROUND]:!1,[B.AT_BACKGROUND_OPACITY]:.2},gl={[B.AT_SHOW_PRICES]:!0,[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_LEFT,[B.AT_EXTEND_LEFT]:!1,[B.AT_EXTEND_RIGHT]:!0,[B.AT_REVERSE]:!1,...hl},_l={FibonacciFan:{[B.AT_SHOW_LEVELS]:!1,[B.AT_LABELS]:B.AT_LABELS_RIGHT,[B.AT_REVERSE]:!1,...hl},FibonacciArcs:{[B.AT_SHOW_LEVELS]:!1,...hl},FibonacciRetracement:{...gl},TrendBasedFibExtension:{...gl},FibonacciChannel:{[B.AT_SHOW_LEVELS]:!0,[B.AT_LEVELS_KIND]:B.AT_LEVELS_PERCENTS,[B.AT_LABELS]:B.AT_LABELS_LEFT,...hl},FibonacciTimeZones:{[B.AT_SHOW_LEVELS]:!0,[B.AT_LABELS]:B.AT_LABELS_RIGHT,...hl},GannFan:{[B.AT_SHOW_LEVELS]:!1,...hl},GannBox:{...hl,[B.AT_SHOW_BACKGROUND]:!0},GannSquare:{...hl,[B.AT_SHOW_BACKGROUND]:!0}},vl=()=>({width:1,color:ss(Math.floor(Math.random()*100)),dashStyle:`Solid`}),yl=[`FibonacciFan`,`FibonacciArcs`,`FibonacciChannel`,`FibonacciTimeZones`,`FibonacciRetracement`,`TrendBasedFibExtension`],bl=[`GannFan`,`GannBox`,`GannSquare`],xl=[...yl,...bl],Sl=[`Line`,`Ray`,`GannLine`],Cl=[`ComputedText`,`ProfitLoss`,`RewardRisk`];function wl(e){return yl.includes(e)?[`factors`]:e===`GannFan`?[`angles`]:e===`GannBox`?[`priceLevels`,`timeLevels`]:e===`GannSquare`?[`levels`,`fans`,`arcs`]:[]}function Tl(e,t,n){let r=!nt(e,t)||!Array.isArray(e[t]),i=!r&&e[t].some(e=>!P(e.value));if(r||i)return e[t]=n[t],!0}function El(e,t){if(!P(t))return;let n=wl(e),r=ps(null,e);for(let e of n)if(!Tl(t,e,r))for(let n of t[e])Number.isFinite(n.value)&&(n.value=Xe(n.value,6))}function Dl(e,t,n=!1){let r=e===`FibonacciFan`,i=P(t);if(xl.includes(e)&&i){if(n){let n=_l[e];ut(t,n)}let i=wl(e),a=ps(null,e);for(let e of i)if(!Tl(t,e,a))for(let n of t[e]){let t=a[e].find(e=>e.value===n.value)||a[e].find(e=>e.value===Math.abs(n.value));P(n.line)||(n.line=t?t.line:vl()),r&&n.value===0&&!P(n.shown)&&(n.shown=!0)}e===`FibonacciChannel`&&t[B.AT_SHOW_LABELS]?(t[B.AT_SHOW_LEVELS]=t[B.AT_SHOW_LABELS],delete t[B.AT_SHOW_LABELS]):e===`FibonacciArcs`&&!t[B.AT_SHOW_TRENDLINE]&&(t[B.AT_SHOW_TRENDLINE]=!0)}Sl.includes(e)&&i&&!P(t[B.AT_MARKER])&&(t[B.AT_MARKER]={...Rs}),i&&(t[B.AT_ALLOW_PRICES_CHANGE_UI]=!Cl.includes(e))}function Ol(e){return H(e,`..annotations`).forEach(e=>Dl(e.id,e.traits,!0)),e.version=71,e}var kl=[3,4,5,6,7,8,9,10,11],Al=[12,13,14,15,16,17,18,19,20];function jl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`GTPI`,`GPMI`,`CBMI`]}),n=V(`JPI`);return t.length>0&&t.forEach(e=>{let t=t=>e.study===t,r=(t,n)=>{e.study=t,e.curves?.length&&e.curves.forEach(e=>{for(let t of n){let[n,r]=t;e.fields?.length===1&&e.fields[0]===n&&(e.fields[0]=r)}})};t(`GTPI`)?r(`CTPI`,[[`GTPI`,`CTPI`]]):t(`GPMI`)?r(`CPMI`,[[`GPMI`,`CPMI`]]):t(`CBMI`)&&(r(`JPI`,[[`CBMB`,`JPIB`],[`CBMS`,`JPIS`]]),e.inputs?.length===3&&(e.inputs=e.inputs.map(e=>e.name===`FastNumber`?{name:`FastPeriod`,value:kl[Number(e.value)-1]}:e.name===`SlowNumber`?{name:`SlowPeriod`,value:Al[Number(e.value)-1]}:e),e.inputs.splice(2,0,n.defaults.inputs[2])))}),e.version=72,e}function Ml(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`JPI`]}),n=V(`JPI`).defaults.inputs.find(e=>e.name===`HandbrakePeriod`);return t.length>0&&t.forEach(e=>{e.inputs?.length===4&&e.inputs.push(n)}),e.version=73,e}function Nl(e){let t=`COPP`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`${t}`]}),r=V(t);return n.length>0&&n.forEach(e=>{P(e.inputs)&&(e.curves=r.defaults.curves,e.levels=r.defaults.levels)}),e.version=77,e}function Pl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MFI`]}),n=V(`MFI`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels,e.bands=n.defaults.bands)}),e.version=78,e}function Fl(e){let t=`RSIMOD`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`RSI`,t]}),r=V(`RSI`),i=V(t);return n.length>0&&n.forEach(e=>{if(P(e.inputs)){let t=e.study===`RSI`?r.defaults:i.defaults;e.inputs.push(...t.inputs.slice(1)),e.curves.push(...t.curves.slice(1))}}),e.version=79,e}function Il(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CCI`]}),n=V(`CCI`);return t.length>0&&t.forEach(e=>{if(N(e.inputs)){let t=e.curves[0].colors[0],r=fo(t,.3);e.curves=n.defaults.curves;let i=e.curves[0].colors;i[0]=i[3]=r,i[2]=t,N(e.levels)?e.levels.splice(1,0,n.defaults.levels[1]):e.levels=n.defaults.levels,N(e.bands)||(e.bands=n.defaults.bands)}}),e.version=80,e}function Ll(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MACD`,`MACDEXP`]}),n=V(`MACD`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels)}),e.version=84,e}function Rl(e){let t=`BBANDS`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{e.inputs?.length===3&&e.inputs.push(r.defaults.inputs[3])}),e.version=87,e}function zl(e){let t=H(e,`..plots{.type === "Study" && .study === "EHLAI" }`);return t.length>0&&t.forEach(e=>{e.study=`NHLAI`,e.curves?.length===1&&e.curves[0].fields?.length===1&&(e.curves[0].fields[0]=`NHLAI`)}),e.version=90,e}function Bl(e){let t=`MCCLO`,n=H(e,`..plots{.type === "Study" && .study === "${t}" }`),r=V(t);return n.length>0&&n.forEach(e=>{e.inputs?.length===3&&e.inputs.push(r.defaults.inputs[3])}),e.version=91,e}function Vl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`PMO`]}),n=V(`PMO`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels)}),e.version=96,e}function Hl(e){return H(e,`..annotations`).forEach(e=>{if(e.id===`ComputedText`){e.points.splice(2);let[t,n]=[`ProfitLoss`,`RewardRisk`];e.traits.kind===t?e.id=t:e.traits.kind===n&&(e.id=n),e.traits[B.AT_SHOW_PRICES]=e.traits[B.AT_DRAW_LINES]??!0,delete e.traits[B.AT_DRAW_LINES],e.traits[B.AT_POSITION]=e.traits.pos??`Long`,delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[B.AT_ALLOW_PRICES_CHANGE_UI]=!1}}),e.version=102,e}function Ul(e){let t=`UseAllFields`;return H(e,`..curves{.attributes === "${t}"}`).forEach(e=>{let n=e.attributes.indexOf(t);e.attributes.splice(n,1),e.style===`Column`&&(e.style=`MultiColumn`,e.varyColorPerBar=!1)}),e.version=104,e}function Wl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MASMO`,`MATRI`,`MAWEI`,`DEMA`,`TEMA`,`HMA`,`MARIB`,`MA`,`MAEXP`]});return t.length>0&&t.forEach(e=>{let t=e.inputs;if(N(t)){let e=e=>t.findIndex(t=>t.name===e),n=(n,r,i)=>{if(e(n)>=0)return;let a={name:n,value:r};i<0?t.push(a):t.splice(i,0,a)};n(`Source`,`Close`,e(`Offset`)),n(`Offset`,0,-1)}}),e.version=106,e}var Gl=[{name:`Source`,value:`Close`},{name:`Average`,value:`MA`}];function Kl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MASIG`,`MACDSIG`]});return t.length>0&&t.forEach(e=>{let t=e.study===`MASIG`;e.study=t?`PACROSS`:`MACROSS`;let n=e.inputs;N(n)&&n.splice(0,0,...Gl);let r=e.curves;N(r)&&t&&(r[0].fields[0]=`AVG`)}),e.version=109,e}function ql(e){return H(e,`..annotations`).forEach(e=>{(e.id===`LongPosition`||e.id===`ShortPosition`)&&(e.traits[B.AT_ALLOW_PRICES_CHANGE_UI]=!0)}),e.version=111,e}function Jl(e){H(e,`..plots{.type === "Study" && .study === "CHEXI"}.inputs{.name === "Period" || .name === "Multiplier"}`).forEach(e=>{if(typeof e.value!=`string`||e.value.trim()===``)return;let t=Number(e.value);Number.isFinite(t)&&(e.value=t)})}function Yl(e){return Jl(e),e.version=113,e}function Xl(e){let t=H(e,`..plots{.detachedScale}`);return t.length>0&&t.forEach(e=>{e.detachedScale=!0}),e.version=114,e}function Zl(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`STOCHF`,`STOCHS`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);N(e.inputs)&&N(e.curves)&&(e.curves[0]=t.curves[0],e.study===`STOCHF`&&e.curves[1].colors[0]===`#00b04b`&&(e.curves[1].colors[0]=t.curves[1].colors[0]))}),e.version=116,e}function Ql(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CHAMF`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);N(e.inputs)&&N(e.curves)&&(e.curves[0]=t.curves[0])}),e.version=117,e}function $l(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CHDMOMOSC`,`TSI`,`DIFA`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);if(N(e.inputs)&&N(e.curves))switch(e.study){case`CHDMOMOSC`:case`TSI`:{let n=e.levels?.[0];e.levels=t.levels,N(n)&&(e.levels[1]=n);break}case`DIFA`:{let[n,r]=e.curves[0].colors;e.curves=[t.curves[0]],e.curves[0].colors=[n,uo(n),r,uo(r)];break}}}),e.version=120,e}function eu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`MACD`,`MACDEXP`,`PPO`]}),n=e=>V(e).defaults;return t.length>0&&t.forEach(e=>{let t=n(e.study);if(N(e.inputs)&&N(e.curves))switch(e.study){case`MACD`:case`MACDEXP`:{let n=e.curves[2],r=n.colors;if(delete n.zones,r.length===2){let e=r.map(e=>fo(e,.3));n.colors=[e[0],r[0],e[1],r[1]]}else n.colors=t.curves[2].colors;n.varyColorPerBar=!0;break}case`PPO`:e.curves[2]=t.curves[2];break}}),e.version=125,e}function tu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`CRS`]}),n=V(`CRS`);return t.length>0&&t.forEach(e=>{P(e.inputs)&&(e.levels=n.defaults.levels)}),e.version=128,e}function nu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`PC`]}),n=V(`PC`);return t.length>0&&t.forEach(e=>{if(N(e.inputs)&&e.inputs.length===6){let t=e.inputs[0].value;e.inputs[0].name=n.defaults.inputs[0].name,e.inputs[0].value=`HV ${t}`,e.inputs.splice(1,0,n.defaults.inputs[1])}}),e.version=131,e}function ru(e){let t=`VOLAP`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{if(N(e.inputs)&&e.inputs.length===5){let t=e.inputs.find(e=>e.name===`Bars`);N(t)&&(t.name=`LevelSize`),e.inputs=[{name:`LevelMode`,value:`Count`},...e.inputs,{name:`ValueRangePercent`,value:70}]}if(N(e.curves)&&e.curves.length===1){let t=e.curves[0].colors.pop();e.curves.push(...r.defaults.curves.slice(1)),e.curves[1].colors=[t],e.curves[2].colors=e.curves[0].colors.map(e=>fo(e,.6))}}),e.version=137,e}function iu(e){let t=`ADXMOD`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`ADX`,t]}),r=V(`ADX`),i=V(t);return n.length>0&&n.forEach(e=>{P(e.inputs)&&(e.levels=[...(e.study===`ADX`?r.defaults:i.defaults).levels])}),e.version=140,e}function au(e){let t=`CHDMOMOSC`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{if(P(e.inputs)){let t=r.defaults;e.inputs.push(...t.inputs.slice(1,3)),e.curves.push(...t.curves.slice(1,2))}}),e.version=142,e}function ou(e){let t=`MACDV`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t);return n.length>0&&n.forEach(e=>{if(N(e.inputs)){let t=r.defaults,n=e.levels[0];e.levels=[...t.levels],e.levels[2]=n}}),e.version=144,e}function su(e){let t=`KELCHN`,n=`KELEXP`,r=`KELBND`,i=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t,n,r]}),a=V(t),o=V(r);return i.length>0&&i.forEach(e=>{if(N(e.inputs))switch(e.study){case t:e.inputs.push(a.defaults.inputs[1]);break;case n:e.study=t,e.inputs.push(o.defaults.inputs[2]);for(let t=0;t<4;t++)e.curves[t].fields=a.defaults.curves[t].fields;break;case r:e.inputs.push(o.defaults.inputs[2]);break}}),e.version=145,e}function cu(e){let t=e.curves?.length??0,n=e.offsets?.length??0;if(!(t===0||n===0)&&t===n+1){let n=e.usesInAverage;Array.isArray(n)&&n.length===6?(e.curves.splice(1,5),e.offsets=[0,-5]):t>2?e.offsets?.push(-1):e.curves.splice(-1,1),delete e.usesInAverage}}function lu(e){let t=H(e,`..plots{.type === "Seasonal"}`);return t.length>0&&t.forEach(e=>{cu(e)}),e.version=149,e}function uu(e,t){let n=e.find(e=>e.name===`TurtleChnField`&&e.value===t);N(n)&&(n.value=`High/Low`)}function du(e){let t=`REATRHI`,n=`REATRLO`,r=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t,n]});return r.length>0&&r.forEach(e=>{if(N(e.inputs)){switch(e.study){case t:e.inputs.unshift({name:`Direction`,value:`Long`}),uu(e.inputs,`High`);break;case n:e.inputs.unshift({name:`Direction`,value:`Short`}),uu(e.inputs,`Low`);break}e.study=`REATRS`,e.curves[0].fields[0]=`REATRS`}}),e.version=151,e}var fu={colors:[`rgba(252, 13, 27, 0.3)`,`rgba(0, 176, 75, 0.3)`],fields:[`DIFA`],style:`Area`,visible:!1,zones:[{value:0,colors:1},{colors:1}]};function pu(e){let t=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[`DIFA`]});return t.length>0&&t.forEach(e=>{N(e.curves)&&e.curves.push(fu)}),e.version=152,e}function mu(e){let t=[`BPERC`,`BSQUEEZE`,`BWIDTH`],n=[`BOLLP`,`BOLLBW`,`BOLLW`],r=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:t});return r.length>0&&r.forEach(e=>{let r=t.indexOf(e.study),i=e.study===`BSQUEEZE`;i&&(e.study=`BBANDW`),N(e.curves)&&(e.curves[0].fields[0]=n[r],i&&e.curves.push({colors:[`#f08f4c`],fields:[`BOLLBWA`]})),N(e.inputs)&&i&&e.inputs.push({name:`Average`,value:`MA`},{name:`PeriodAvg`,value:5})}),e.version=154,e}function hu(e){let t=H(e,`..plots{.type === "Study" && .study === "LINRCHN"}`);return t.length>0&&t.forEach(e=>{N(e.inputs)&&e.inputs.push({name:`ExtendLines`,value:`None`})}),e.version=161,e}function gu(e){let t=e.display?.xAxis?.cycleTransition,n=e.display?.xAxis?.contractTransition,r=e=>{P(e)&&!P(e.fillColor)&&(e.fillColor=`rgba(119,119,119,0.1)`)};return r(t),r(n),e.version=162,e}function _u(e){let t=`ZIGZAG`,n=H(e,`..plots{.type === "Study" && .study === $studies}`,{studies:[t]}),r=V(t).defaults.inputs??[],i=r.find(e=>e.name===`ReversalChange`),a=r.findIndex(e=>e.name===`ReversalChange`);return n.length>0&&N(i)&&n.forEach(e=>{if(N(e.inputs)&&!e.inputs.some(e=>e.name===`ReversalChange`)){let t=a>=0?Math.min(a,e.inputs.length):e.inputs.length;e.inputs.splice(t,0,{...i})}}),e.version=166,e}function vu(e){return H(e,`..plots{.type === "Study" && .basis}`).forEach(e=>{e.basis={kind:`main`}}),e.version=167,e}function yu(e){let t=H(e,`..plots{.type === "Study" && .study === "TARGP"}`),n=V(`TARGP`).defaults;return t.length>0&&t.forEach(e=>{if(!N(e.curves))return;let t=e.curves[0]?.colors?.[0],r=e.curves[1]?.colors?.[0];e.curves=[F(n.curves[0])],N(r)&&N(t)&&(e.curves[0].colors=[r,t])}),e.version=170,e}var bu={"1-Day":`Implied Volatility`,"5-Day":`5-Day Average IV`,"1-Month":`1-Month Average IV`,"3-Month":`3-Month Average IV`,"6-Month":`6-Month Average IV`,"1-Year":`1-Year Average IV`,YTD:`YTD Average IV`};function xu(e){return H(e,`..plots{.type === "Study" && .study === "OPTIV"}`).forEach(e=>{let t=e.inputs?.find(e=>e.name===`TimeFrame`&&typeof e.value==`string`);N(t)&&(t.value=bu[t.value]??t.value)}),e.version=172,e}var Su={SymbolBuy:`SymbolLetterB`,SymbolSell:`SymbolLetterS`};function Cu(e){return H(e,`..annotations`).forEach(e=>{let t=Su[e.id];t&&(e.id=t)}),e.version=175,e}function wu(e){return H(e,`..plots{.type === "Study" && .study === "HV"}`).forEach(e=>{e.inputs&&e.inputs.unshift({name:`Calculation`,value:`Percentage`})}),e.version=176,e}function Tu(e){return H(e,`..plots{.type === "Study" && (.study === "MACROSS" || .study === "PACROSS")}`).forEach(e=>{if(e.inputs&&e.inputs.push({name:`ShowSignals`,value:`Yes`}),e.curves){let t=e.curves[0],n=t.colors[0];t.colors=[n,n],t.varyColorPerBar=!0}}),e.version=177,e}function Eu(e){return Jl(e),e.version=182,e}function W(e){return function(t){return t.version=e,t}}var Du={_3to4:yc,_4to5:bc,_5to6:xc,_6to7:Sc,_7to8:Cc,_8to9:Tc,_9to10:Dc,_10to11:Oc,_11to12:kc,_12to13:Ac,_13to14:jc,_14to15:Nc,_15to16:Pc,_16to17:Fc,_17to18:Lc,_18to19:Rc,_19to20:zc,_20to21:Bc,_21to22:Vc,_22to23:Hc,_23to24:Uc,_24to25:Wc,_25to26:Gc,_26to27:Kc,_27to28:qc,_28to29:Jc,_29to30:Yc,_30to31:Xc,_31to32:Zc,_32to33:Qc,_33to34:$c,_34to35:el,_35to36:tl,_36to37:nl,_37to38:rl,_38to39:il,_39to40:al,_40to41:ol,_41to42:sl,_42to43:cl,_43to44:W(44),_44to45:W(45),_45to46:W(46),_46to47:W(47),_47to48:W(48),_48to49:W(49),_49to50:W(50),_50to51:W(51),_51to52:W(52),_52to53:W(53),_53to54:W(54),_54to55:W(55),_55to56:W(56),_56to57:ll,_57to58:W(58),_58to59:W(59),_59to60:ul,_60to61:W(61),_61to62:W(62),_62to63:W(63),_63to64:W(64),_64to65:dl,_65to66:fl,_66to67:W(67),_67to68:pl,_68to69:W(69),_69to70:ml,_70to71:Ol,_71to72:jl,_72to73:Ml,_73to74:W(74),_74to75:W(75),_75to76:W(76),_76to77:Nl,_77to78:Pl,_78to79:Fl,_79to80:Il,_80to81:W(81),_81to82:W(82),_82to83:W(83),_83to84:Ll,_84to85:W(85),_85to86:W(86),_86to87:Rl,_87to88:W(88),_88to89:W(89),_89to90:zl,_90to91:Bl,_91to92:W(92),_92to93:W(93),_93to94:W(94),_94to95:W(95),_95to96:Vl,_96to97:W(97),_97to98:W(98),_98to99:W(99),_99to100:W(100),_100to101:W(101),_101to102:Hl,_102to103:W(103),_103to104:Ul,_104to105:W(105),_105to106:Wl,_106to107:W(107),_107to108:W(108),_108to109:Kl,_109to110:W(110),_110to111:ql,_111to112:W(112),_112to113:Yl,_113to114:Xl,_114to115:W(115),_115to116:Zl,_116to117:Ql,_117to118:W(118),_118to119:W(119),_119to120:$l,_120to121:W(121),_121to122:W(122),_122to123:W(123),_123to124:W(124),_124to125:eu,_125to126:W(126),_126to127:W(127),_127to128:tu,_128to129:W(129),_129to130:W(130),_130to131:nu,_131to132:W(132),_132to133:W(133),_133to134:W(134),_134to135:W(135),_135to136:W(136),_136to137:ru,_137to138:W(138),_138to139:W(139),_139to140:iu,_140to141:W(141),_141to142:au,_142to143:W(143),_143to144:ou,_144to145:su,_145to146:W(146),_146to147:W(147),_147to148:W(148),_148to149:lu,_149to150:W(150),_150to151:du,_151to152:pu,_152to153:W(153),_153to154:mu,_154to155:W(155),_155to156:W(156),_156to157:W(157),_157to158:W(158),_158to159:W(159),_159to160:W(160),_160to161:hu,_161to162:gu,_162to163:W(163),_163to164:W(164),_164to165:W(165),_165to166:_u,_166to167:vu,_167to168:W(168),_168to169:W(169),_169to170:yu,_170to171:W(171),_171to172:xu,_172to173:W(173),_173to174:W(174),_174to175:Cu,_175to176:wu,_176to177:Tu,_177to178:W(178),_178to179:W(179),_179to180:W(180),_180to181:W(181),_181to182:Eu,_182to183:W(183)};function Ou(e,t,n){let r=e;try{for(ec(!1);t<n;){let e=Du[`_${t}to${t+1}`];r=e(r),t+=1}}finally{ec(!0)}return r}function ku(e,t){if(t===B.CHART_SCHEMA){let n=H(Xs(t),`.properties.version.minimum`)[0],r=e.version;if(r<n)return Ou(e,r,n)}return e}function Au(e){return{unit:rt(e,`Day`,`unit`),size:rt(e,1,`size`),spec:rt(e,`None`,`spec`),isContractVolume:rt(e,!1,`isContractVolume`),dividendsAdjust:rt(e,!1,`dividendsAdjust`),backAdjust:rt(e,!1,`backAdjust`),daysToExpiration:rt(e,1,`daysToExpiration`),contractRoll:rt(e,`combined`,`contractRoll`)}}function ju(e){let t=Au(e);return new Ru(g[t.unit],t.size,_[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function Mu(e){switch(e.unit){case g.Tick:return Lu;case g.Intraday:case g.Day:return Nu;case g.Week:return Pu;case g.Month:return Fu;case g.Quarter:return Iu;case g.Year:return pi;default:return Lu}}function Nu(e,t){return Nn(e,t)&&Fu(e,t)}function Pu(e,t){return li(e,t)&&Fu(e,t)}function Fu(e,t){return di(e,t)&&pi(e,t)}function Iu(e,t){return fi(e,t)&&pi(e,t)}function Lu(e,t){return+e==+t}var Ru=class e{unit;size;spec;isContractVolume;dividendsAdjust;backAdjust;daysToExpiration;contractRoll;constructor(e=g.Day,t=1,n=_.None,r=!1,i=!1,a=!1,o=1,s=`combined`){this.unit=e,this.size=t,this.spec=n,this.isContractVolume=r,this.dividendsAdjust=i,this.backAdjust=a,this.daysToExpiration=o,this.contractRoll=s}duplicate(){return new e(this.unit,this.size,this.spec,this.isContractVolume,this.dividendsAdjust,this.backAdjust,this.daysToExpiration,this.contractRoll)}getHashKey(){return`[${this.unit}:${this.size}:${this.spec}:${this.isContractVolume}:${this.dividendsAdjust}:${this.backAdjust}:${this.daysToExpiration}:${this.contractRoll}]`}toShortString(){if(this.unit===g.Tick){let e=`T`,t=!0;switch(this.spec){case _.PerCount:e=`Tpb`;break;case _.PerVolume:e=`Vpb`;break;case _.PerRange:e=`Rpb`;break;case _.PerSeconds:e=`Spb`;break;case _.TopOfBook:e=`TOB`;break;default:t=!1;break}return`${t?this.size:``}${e}`}else if(this.unit===g.Intraday)return this.size%60==0?`${this.size/60}h`:`${this.size}`;else{let e=``;return this.spec===_.Nearest?e=`n`:this.spec===_.Continue&&(e=`c`),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e=``;switch(this.unit){case g.Tick:e=`Tick`;break;case g.Intraday:if(this.size%60==0){let t=this.size/60;e=`${t} hour${t>1?`s`:``}`}else e=`${this.size<10?` `:``}${this.size} minute${this.size>1?`s`:``}`;break;case g.Day:e=`Daily`;break;case g.Week:e=`Weekly`;break;case g.Month:e=`Monthly`;break;case g.Quarter:e=`Quarterly`;break;case g.Year:e=`Yearly`;break;default:break}return e}describe(){let e=this.unitToString();switch(this.spec){case _.Nearest:e+=` Nearest`;break;case _.Continue:e+=` Continue`;break;case _.PerCount:e=`Ticks Per Bar`;break;case _.PerVolume:e=`Volume Per Bar`;break;case _.PerRange:e=`Range Per Bar`;break;case _.PerSeconds:e=`Seconds Per Bar`;break;case _.TopOfBook:e=`Top Of Book`;break;case _.None:default:break}return e}get hasSpec(){return this.spec!==_.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===g.Tick}get isIntraday(){return this.unit===g.Intraday}get isMultiContract(){let e=this.spec===_.Nearest,t=this.spec===_.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}};function zu(e){delete e.display.chart.bar}function Bu(e){P(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,P(e.data.range)&&delete e.data.range,delete e.data.checkRange}function Vu(e){tf(e.display.period)&&delete e.display.period}function Hu(e){P(e.display.density)&&delete e.display.density}function Uu(e){let t=e.getDataStats();return t===null?null:t.dataRange}function Wu(e,t){return e.unit!==t.unit||e.size!==t.size||e.spec!==t.spec}function Gu(e,t,n){let r=P(t.period),i=P(t.range),a=P(t.density),o=e=>+!!e;if(o(r)+o(i)+o(a)>1)throw Error(`Cannot set more than one of: period, range, density.`);if(r&&(e.display.period=t.period,Bu(e),Hu(e)),i)if((!P(e.display.period)||tf(e.display.period))&&(e.display.xAxis.visibleRange=t.range),Vu(e),Hu(e),P(n)){let r=Uu(n),i=ju(e.data.aggregation),a=n.data.aggregation,o=Wu(i,a)||!P(r)||e.data.checkRange,s=o;if(!o){let{from:e,to:n}=r,{from:i,to:a}=t.range;s=i<e||i>n||a<e||a>n}s&&(e.data.range=t.range),delete e.data.checkRange}else e.data.checkRange=!0;return a&&(e.display.density=t.density,Bu(e),Vu(e)),(r||i||a)&&(zu(e),n&&(n.forceResetVisibleRange=!0)),e}function Ku(e){switch(h[e]){case h.OHLC:case h.HLC:case h.Candlestick:case h.HollowCandles:case h.HeikinAshi:case h.ElderImpulseSystem:case h.Range:case h.MultiColumn:return!0;default:return!1}}function qu(e){switch(h[e]){case h.Candlestick:case h.HollowCandles:case h.HeikinAshi:case h.ElderImpulseSystem:case h.Column:case h.Renko:case h.Range:case h.Kagi:case h.PointAndFigure:case h.LineBreak:case h.HLC:return!0;default:return!1}}function Ju(e){return e!==void 0&&e.length>0&&e.some(e=>e===m[m.ChangeBased]||e===m[m.OpenVsClose])}function Yu(){return{fields:[`Close`],style:`Line`,lineWidth:2,visible:!0,colors:[`#888`],varyColorPerBar:!1}}function Xu(e,t){let n=$().getDefaultMultiFieldCurve();if(n!==null&&n.style===e)return n;let r=e=>e.id,i=[G.Open,G.High,G.Low,G.Close,G.Change].map(r);h[e]===h.HLC&&i.splice(0,1);let a=[G.Close].map(r),o=F(B.COLOR_DEFAULT_AREA),s=F(B.COLOR_DEFAULT_OHLC),c=F(B.COLOR_DEFAULT_VARY),l={fields:i,colors:c,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch(h[e]){case h.OHLC:case h.HLC:case h.Renko:case h.LineBreak:case h.Range:case h.Kagi:case h.PointAndFigure:l.colors=t?c:[s];break;case h.Candlestick:case h.HollowCandles:case h.HeikinAshi:case h.MultiColumn:break;case h.ElderImpulseSystem:l.colors=c.concat(o);break;case h.Line:case h.PercentChange:l.fields=a,l.colors=[s];break;case h.Area:l.fields=a,l.colors=[fo(o,.5),o];break;case h.Baseline:l.fields=a,l.colors=c.map(e=>fo(e,.5)),l.zones=[{value:0,colors:1},{colors:1}];break;case h.Column:l.fields=a;break;default:throw Error(`Curve style "${e}" is not supported here.`)}return l}function Zu(e,t){switch(e){case C.Symbol:case C.Expression:{let e=t.style||`Candlestick`;return Xu(e,t.varyColorPerBar||qu(e))}case C.Forward:case C.Seasonal:return Yu();default:throw Error(`Unexpected plot type '${C[e]}', don't know its default curve.`)}}function Qu(e,t){Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||qu(e.style)||Ju(e.attributes));let n=Zu(C[t],e);return ht(n,e),n}var $u=[`Renko`,`Kagi`,`PointAndFigure`,`LineBreak`,`Baseline`];function ed(e,t){let n=t.curves[0],r=Hd(e);if(r.curves=[Qu(n,t.type)],t.isMultiCurveMain&&t.curves.length>1&&r.curves.push(...t.curves.slice(1)),t.type===`Symbol`&&P(n)&&$u.includes(n.style)){let e=r;P(t.inputs)?e.inputs=t.inputs:delete e.inputs}return e}function td(e,t,n){return n||=` `,e.length>t?e:(t-=e.length,n+=n.repeat(t),e+n.slice(0,t))}var nd=class e extends Error{static buildMessage(e,t){function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function r(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,e=>`\\x0`+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>`\\x`+n(e))}function i(e){return e.replace(/\\/g,`\\\\`).replace(/\]/g,`\\]`).replace(/\^/g,`\\^`).replace(/-/g,`\\-`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,e=>`\\x0`+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>`\\x`+n(e))}function a(e){switch(e.type){case`literal`:return`"`+r(e.text)+`"`;case`class`:let t=e.parts.map(e=>Array.isArray(e)?i(e[0])+`-`+i(e[1]):i(e));return`[`+(e.inverted?`^`:``)+t+`]`;case`any`:return`any character`;case`end`:return`end of input`;case`other`:return e.description}}function o(e){let t=e.map(a),n,r;if(t.sort(),t.length>0){for(n=1,r=1;n<t.length;n++)t[n-1]!==t[n]&&(t[r]=t[n],r++);t.length=r}switch(t.length){case 1:return t[0];case 2:return t[0]+` or `+t[1];default:return t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}}function s(e){return e?`"`+r(e)+`"`:`end of input`}return`Expected `+o(e)+` but `+s(t)+` found.`}message;expected;found;location;name;constructor(t,n,r,i){super(),this.message=t,this.expected=n,this.found=r,this.location=i,this.name=`SyntaxError`,typeof Object.setPrototypeOf==`function`?Object.setPrototypeOf(this,e.prototype):this.__proto__=e.prototype,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e)}format(e){let t=`Error: `+this.message;if(this.location){let n=null,r;for(r=0;r<e.length;r++)if(e[r].grammarSource===this.location.source){n=e[r].text.split(/\r\n|\n|\r/g);break}let i=this.location.start,a=this.location.source+`:`+i.line+`:`+i.column;if(n){let e=this.location.end,r=td(``,i.line.toString().length,` `),o=n[i.line-1],s=i.line===e.line?e.column:o.length+1;t+=`
|
|
3
3
|
--> `+a+`
|
|
4
4
|
`+r+` |
|
|
5
5
|
`+i.line+` | `+o+`
|
|
@@ -13,7 +13,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
13
13
|
`?(n++,r=1):t===`\r`?e[i+1]!==`
|
|
14
14
|
`&&(n++,r=1):r++}return{line:n,column:r}}function pd(e,t){if(!(e instanceof nd)||!e.location)return;let n=Array.isArray(e.expected)?e.expected:[],r=e.found??null,i=ud(n);if(!(r===null&&i.expectsCloseParen))return e.location;let a=dd(t);if(a===void 0)return e.location;let o=Math.max(t.lastIndexOf(`
|
|
15
15
|
`),t.lastIndexOf(`\r`))+1,s=a-1;for(;s>=o&&/\s/.test(t[s]);)s--;if(s<o)return e.location;let c=s+1,l=fd(t,c);return{...e.location,start:{...e.location.start,offset:c,line:l.line,column:l.column},end:{...e.location.end,offset:c,line:l.line,column:l.column}}}function md(e,t){if(!(e instanceof nd))return e instanceof Error?e.message:`Invalid expression.`;let n=Array.isArray(e.expected)?e.expected:[],r=e.found??null,i=ud(n),a=e.location?.start?.offset??0,o=a>0?t[a-1]:``;return r===null?cd(t)?`Expression contains only comments. Add a value (for example {AAPL} or 1).`:i.expectsFieldName&&o===`.`?`Missing field name after '.'.`:i.expectsCloseBrace?`Missing closing brace '}' in symbol.`:i.expectsCloseParen?`Missing closing parenthesis ')'.`:i.expectsValue?`Expression ended unexpectedly; expected a value.`:`Expression ended unexpectedly.`:i.expectsFieldName&&o===`.`?`Expected a field name (letters only) after '.', but found ${ld(r)}.`:i.expectsCloseBrace&&o===`{`&&r===`}`?`Symbol name cannot be empty inside '{}'.`:i.expectsOperator&&i.expectsEnd?`Expected an operator (+, -, *, /, or ^) or end of expression, but found ${ld(r)}.`:i.expectsOperator&&i.expectsCloseParen?`Expected an operator or closing parenthesis ')' but found ${ld(r)}.`:i.expectsValue?`Expected a value (number, symbol, or parenthesized expression), but found ${ld(r)}.`:i.expectsCloseParen?`Expected a closing parenthesis ')', but found ${ld(r)}.`:i.expectsCloseBrace?`Expected a closing brace '}', but found ${ld(r)}.`:`Invalid expression near ${ld(r)}.`}var hd=new Map,gd=/\w:\w/;function _d(e,t){return e.some(e=>e.includes(`:`))?(Sd(t,(e,t,n)=>{let r=(e,t=null,n=`sym`)=>({op:n,left:e,right:t}),i=e;if(i.op!==`sym`||!gd.test(t))return null;let a=t.split(`:`);return i.op=`grp`,i.left=r(r(a[0]),r(a[1]),`-`),null}),!0):!1}function vd(e){return`error`in e}function yd(e,t=!1,n=!0){let r=e.trim();if(t&&hd.has(r))return F(hd.get(r));try{let i=id(r);Ed(i,e=>e.toUpperCase(),!0,!0);let a=wd(i);n&&_d(a,i)&&(a=wd(i));let o={text:e,model:i,clean:Cd(i,!1),verbose:Cd(i,!0),symbols:a};return t&&hd.set(r,o),o}catch(t){return{text:e,error:md(t,r),loc:pd(t,r)??t?.location}}}function bd(e,t){return Sd(e,xd(t))}function xd(e){return(t,n,r)=>{let i=t;if(Dd(i)){if(n===null)return null;switch(i.op){case`-`:return-n;case`grp`:return n;case`sym`:return e(n);case`num`:return n;default:throw Error(`Unrecognized unary operator ${i.op}`)}}else{if(n===null||r===null)return null;let t=n,a=r;switch(i.op){case`+`:return t+a;case`-`:return t-a;case`*`:return t*a;case`/`:return t/a;case`^`:return t**+a;case`sym`:return e(n,r);default:throw Error(`Unrecognized binary operator ${i.op}`)}}}}function Sd(e,t,n){if(!P(e))return null;let r=typeof e;if(r===`number`||r===`string`)return e;let i=e;return t(i,Sd(i.left,t,n),Sd(i.right,t,n),n)}function Cd(e,t=!1){let n={preserveComments:t};if(t){let t=e.leadingComments;return((t?t.map(e=>`// ${e}\n`).join(``):``)+Sd(e,Od,n)).trimEnd()}return Sd(e,Od,n)}function wd(e){let t=new Set;return Sd(e,(e,n,r)=>(e.op===`sym`&&t.add(n),null)),Array.from(t)}function Td(e){let t=0,n=[`+`,`-`,`*`,`/`,`^`];return Sd(e,(e,r,i)=>(n.includes(e.op)&&t++,null)),t>0}function Ed(e,t,n=!1,r=!1){let i=(e,n,i)=>{let a=e;return a.op===`sym`&&(a.left=t(n),r&&a.right&&(a.right=t(a.right))),null},a=n?e:F(e);return Sd(a,i),a}function Dd(e){return!P(e.right)}function Od(e,t,n,r){let i=e,a=r?.preserveComments??!1,o;if(Dd(i))switch(i.op){case`-`:o=`${i.op}${t}`;break;case`grp`:o=`(${t})`;break;case`sym`:o=`{${t}}`;break;case`num`:o=t.toString();break;default:throw Error(`Unrecognized unary operator ${i.op}`)}else{let e=String(t),r=String(n);switch(i.op){case`+`:case`-`:case`*`:case`/`:case`^`:o=a&&e.endsWith(`
|
|
16
|
-
`)?`${e}${i.op} ${r}`:`${e} ${i.op} ${r}`;break;case`sym`:o=`{${t}}.${n}`;break;default:throw Error(`Unrecognized binary operator ${i.op}`)}}return a&&i.trailingComment!==void 0?`${o} // ${i.trailingComment}\n`:o}function kd(e){let t=[];for(let n of e.panes)for(let e of n.axes)for(let n of e.plots)t.push(n);return t}function Ad(e,t,n){return!kd(e).some(e=>e.uid===t&&e.uid!==n)}function jd(e,t,n){if(!Ad(e,t,n))throw Error(`Plot uid '${t}' is already in use on this chart.`)}function Md(e){return kd(e).find(e=>e.main===!0)}function Nd(e,t){let n=0;for(let r=0;r<e.panes.length;r++){let i=e.panes[r].axes;for(let e=0;e<i.length;e++){let a=i[e].plots;for(let i=0;i<a.length;i++){if(n===t)return{pane:r,axis:e,plot:i};n++}}}return null}function Pd(){return{plots:[]}}function Fd(e,t){let n=e.panes[t],r=n.axes.map(e=>e.plots.reduce((e,t)=>e+ +!!t.detachedScale,0)),i=n.axes.length;return n.axes.forEach((e,t)=>{let a=r[t],o=e.plots.length;if(!(a===0||a<o)&&a===o)if(i>1&&a===1){let a=(t+1)%i;if(r[a]<n.axes[a].plots.length){let t=e.plots.find(e=>e.detachedScale);t&&(n.axes[a].plots.push(t),e.plots=e.plots.filter(e=>!e.detachedScale),r[a]++)}}else{let t=e.plots.find(e=>e.detachedScale);t&&(t.detachedScale=!1)}}),e}function Id(e,t,n){let r=Nd(e,t);if(r===null)return e;let i=e.panes[r.pane],a=i.axes[r.axis].plots[r.plot];return n===r.axis?delete a.detachedScale:(delete a.detachedScale,i.axes.length<2&&n>0&&i.axes.push(Pd()),i.axes[n].plots.push(a),i.axes[r.axis].plots.splice(r.plot,1)),Nf(Fd(e,r.pane))}function Ld(e,t){let n=Nd(e,t);if(n===null)return e;let r=e.panes[n.pane].axes[n.axis].plots[n.plot];return r.detachedScale=!0,Nf(Fd(e,n.pane))}function Rd(e,t){let n=kd(e).find(e=>e.uid===t.uid);if(!n||n.type!==`Seasonal`)return null;let r=n.offsets;return!Array.isArray(r)||!r.includes(t.offset)?null:n}function zd(e,t){let n=t??{kind:`main`};return n.kind===`main`?Md(e)??null:n.kind===`seasonal`?Rd(e,n):null}function Bd(e,t,n){let r=zd(e,n);return r?r.type===`Forward`?{eligible:!1,reason:`it cannot be based on a forward plot`}:r.type===`Expression`&&sc(t)?{eligible:!1,reason:`it cannot be based on an expression; the study needs more than "OHLCV" fields`}:r.type===`Seasonal`&&!cc(t)?{eligible:!1,reason:`it cannot be based on a seasonal plot`}:{eligible:!0}:{eligible:!1,reason:`its basis does not resolve to an existing target plot`}}var Vd=`..plots{.main === true}`;function Hd(e){return H(e,Vd)[0]}function Ud(e){let t=H(e,`..panes{${Vd}}`)[0];return{mainPane:t,mainAxis:H(t,`..axes{${Vd}}`)[0]}}function Wd(e,t,n){let r=Hd(t);if(r[r.type.toLowerCase()]===B.PLACEHOLDER_SYMBOL_NAME){let r=Hd(e),{mainAxis:i}=Ud(t),a=i.annotations,o=Zd(t,r);if(n){let{mainAxis:e}=Ud(o);e.annotations=a}return o}return t}var Gd=`Symbol`,Kd=`Expression`,qd=`Forward`,Jd=`Seasonal`,Yd=[Gd,Kd,qd,Jd];function Xd(e){let t=yd(e),n=vd(t),r=n?0:t.symbols.length,i=!n&&r>0?t.symbols[0]:null;return{clean:n?void 0:t.clean,hasErrors:n,symbolCount:r,firstSymbol:i,error:n?t.error:void 0}}function Zd(e,t){let n=Hd(e);P(t.uid)&&jd(e,t.uid,n.uid);let r=e=>n.type===e,i=e=>P(t[e.toLowerCase()]),a=Yd.find(e=>i(e)),o=a.toLowerCase(),s=t[o],c=s===B.PLACEHOLDER_SYMBOL_NAME,l=i(Kd)||i(qd)||i(Jd),u=Yd.some(e=>i(e)&&!r(e)),d=$().config.cachedAnnotationsCount||0,f=d>0,{mainAxis:p}=Ud(e);u&&(p.comparison=`None`);let m=Xd(s),h=e=>{throw Error(e)};c||(l?(m.hasErrors&&h(`[Main Plot] "${s}" is an invalid expression.\n${m.error}`),s=m.clean):m.hasErrors||h(`[Main Plot] "${s}" is an expression, unsupported for ${o}.`));let g=(e,t)=>e.findIndex(e=>e.symbol===t),_=(e,t)=>{if(e===B.PLACEHOLDER_SYMBOL_NAME)return;let n=t.annotations||[],r=t.annCache||[],i=g(r,e);if(i!==-1&&r.splice(i,1),n.length>0){let t={symbol:e,annotations:n};r.length+1>d&&r.splice(0,r.length+1-d),r.push(t)}t.annCache=r},v=(e,t)=>{let n=t.annCache||[],r=g(n,e);r!==-1&&(t.annotations=n[r].annotations)},y=e=>{let a=n;if(r(Gd))_(a.symbol,e);else if(r(Kd))_(a.expression,e);else if(r(Jd)){let t=Xd(a.seasonal);t.symbolCount===1&&_(t.firstSymbol,e)}delete e.annotations,i(Gd)?v(t.symbol,e):i(Kd)?v(t.expression,e):i(Jd)&&m.symbolCount===1&&v(t.seasonal,e)};if(f){let t=H(e,`..axes`);for(let e of t)y(e)}let b=i(Kd)&&r(Gd)||i(Gd)&&r(Kd),x=U(e,Vd,e=>(P(t.uid)&&(e.uid=t.uid),u&&(delete e.expression,delete e.symbol,delete e.showPrevious,delete e.forward,delete e.offsets,delete e.seasonal,e.type=a,b||(e.curves=[{}]),(i(qd)||i(Jd))&&(e.offsets=[0])),e[o]=s,e));if(i(Gd)&&Ei(s)&&(x.data.aggregation.contractRoll=Vi(s)?`expiration`:`combined`),u)if(i(qd))x.data.aggregation={unit:`Month`},x.display.period=`P10Y`;else if(i(Jd)&&!ju(x.data.aggregation).isEndOfDay)x.data.aggregation={unit:`Day`},x.display.period=i(Jd)?`P9M`:`P1Y10D`;else if(r(qd)||r(Jd)){x.data.aggregation=$().getDefaultAggregation(),x.data.maxDataPoints=B.DEFAULT_MAX_RECORDS;let e=$().getDefaultPeriod();P(e)&&(x.display.period=e)}else i(Kd)&&r(Gd)&&($u.includes(n.curves[0].style)&&(x=U(x,Vd,e=>(delete e.inputs,e))),x.data.aggregation.spec===`PerRange`&&(x.data.aggregation={unit:`Day`}));let S=new Map([[`..plots{.type === "Study"}`,e=>{let t=V(e.study);return N(t)&&Bd(x,t,e.basis).eligible?e:B.NULL_OBJECT}],[`..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}`,e=>i(Gd)?(e.symbol=s,e):B.NULL_OBJECT],[`..plots{..events}`,e=>(i(Gd)||delete e.events,e)]]);for(let[e,t]of S)x=U(x,e,t);return u&&!b&&(x=ed(x,{type:a,curves:[{}]})),x=Nf(x),x}function Qd(e){let t=$().getDefaultDensity();P(t)&&(e.display.density=t)}function $d(e,t){return U(e,`..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}`,e=>(e.fields=t?[G.TradeSize.id]:[G.Volume.id],e))}function ef(e,t){let n=ju(e.data.aggregation),r=n.isTick&&!n.hasSpec,i=ju(t),a=i.isTick&&!i.hasSpec,o=e=>e.isIntraday&&e.hasSpec&&e.spec===_.PerRange,s=o(n),c=o(i),l=U(e,`${Vd}.curves[0]`,e=>{let t=[G.Open.id,G.High.id,G.Low.id,G.Close.id,G.Change.id].slice();if(!s&&c)return Xu(`Range`,!0);if(s&&!c&&(e.style=`OHLC`),!a&&r){let n=$().getDefaultMultiFieldCurve();if(n!==null)return n;e.fields=t,e.style!==`Candlestick`&&e.style!==`OHLC`&&e.style!==`HLC`&&(e.style=`Candlestick`,e.colors=[`#ff6961`,`#77dd77`],e.varyColorPerBar=!0),e.style===`HLC`&&e.fields.splice(0,1)}else a&&!r&&(e.fields=[G.Last.id,G.Change.id],e.style=`Line`,e.colors=[`#0055cc`],e.varyColorPerBar=!1);return e});return l=$d(l,a),ht(l.data.aggregation,t),(n.unit!==i.unit||n.size!==i.size)&&(Vu(l),Bu(l),Qd(l),zu(l)),l}function tf(e){return P(e)&&e!==B.AUTOFIT_PERIOD}function nf(e){e.display?.density?(Vu(e),Bu(e)):tf(e.display?.period)&&Bu(e)}var rf=new Set([`OHLC`,`HLC`,`HL`,`Candlestick`,`HollowCandles`,`HeikinAshi`,`ElderImpulseSystem`,`Range`,`Renko`,`LineBreak`,`PointAndFigure`,`Kagi`,`Column`,`MultiColumn`,`StackedColumn`]);function af(e){let t=rt(e.display,null,`chart`,`bar`);if(P(t)){let[n]=H(e,Vd),r=n?.curves?.some(e=>N(e.style)&&rf.has(e.style))?B.MINIMUM_WIDE_BAR_WIDTH:B.MINIMUM_BAR_WIDTH,[i,a]=yt(t.width||0,t.spacing||0,r,B.MAXIMUM_BAR_WIDTH);t.width=i,t.spacing=a}}function of(e){let t=H(e,`..annotations{.id === 'RewardRisk' || .id === 'ProfitLoss' }`);t.length>0&&t.forEach(e=>{e.traits.prices=e.traits.prices.map(e=>typeof e==`string`?Number.parseFloat(e):e),e.id===`RewardRisk`&&(e.traits.ratio=Math.abs(e.traits.ratio),e.traits.textLines=e.traits.textLines.map(e=>e.match(/Ratio/)?e.replace(`-`,``):e))})}function sf(e){let t=H(e,`..annotations{.traits.fill.color === null}`);t.length>0&&t.forEach(e=>{e.traits.fill.color=`rgba(0, 0, 0, 0)`})}function cf(e){let{from:t,to:n}=e.display?.xAxis?.visibleRange||{},r=t===null,i=n===null;r&&delete e.display.xAxis.visibleRange.from,i&&delete e.display.xAxis.visibleRange.to,r&&i&&delete e.display.xAxis.visibleRange}function lf(e){let t=H(e,`..panes[0].axes[0].scale`);if(t.length===1){let n=t[0],r=H(e,`..panes[0]..axes`);r.length>0&&r.forEach(e=>e.scale=n)}}function uf(e){let[t]=H(e,Vd);P(t)&&t.type===C[C.Symbol]&&!$u.includes(t.curves[0].style)&&P(t.inputs)&&delete t.inputs}function df(e){let[t]=H(e,Vd);P(t)&&t.type===C[C.Symbol]&&t.curves[0].style===h[h.Renko]&&P(t.inputs)&&t.inputs.map(e=>e.value).some(e=>e===void 0)&&(t.inputs=F(B.DEFAULT_RENKO_INPUTS))}function ff(e){let[t]=H(e,Vd);if(P(t)&&t.type===C[C.Expression]){let n=t.curves[0].style,r=n===h[h.Range],i=n===h[h.Baseline],a=$u.includes(n);r&&e.data?.aggregation.spec===_[_.PerRange]&&(e.data.aggregation={unit:`Day`}),!i&&(a||r)&&(delete t.inputs,t.curves[0]=Xu(`Candlestick`,!0))}}function pf(e){let t=U(e,`..annCache{!.annotations}`,e=>B.NULL_OBJECT);t=U(t,`..annCache`,e=>{let t=Ki(e.symbol);return t===null?e:ai(t,hi(new Date,3))?B.NULL_OBJECT:e}),t=U(t,`..annotations{.id === 'ComputedText' && !.traits.textLines}`,e=>B.NULL_OBJECT);let n=t.data.aggregation,r=n.unit===`Tick`&&n.spec===`None`;return $d(t,r)}function mf(e){H(e,`..annotations`).forEach(e=>{let{id:t,traits:n}=e;Dl(t,n),El(t,n)})}function hf(e){try{ec(!1),H(e,`..plots{.type === "Study" && .curves.zones}`).forEach(e=>{let t=V(e.study).defaults;for(let n=0;n<(e.curves?.length??0);n++){let r=e.curves[n];if(r.zones&&(r.colors?.length??0)<(t.curves[n].colors?.length??0)){let e=t.curves[n].colors.slice(r.colors?.length??0);r.colors?.length?r.colors.push(...e):r.colors=e}}})}finally{ec(!0)}}function gf(e){let[t]=H(e,Vd);if(t.type===`Symbol`&&t.curves?.length===1){let e=t.curves[0];if(e.style===`HLC`){let t=e.colors?.length;if(t===1){let t=e.colors[0];e.colors=[t,t],e.varyColorPerBar=!0,e.attributes=[`OpenVsClose`]}else t===2&&!e.attributes&&(e.attributes=[`OpenVsClose`])}}}function _f(e){$()?.config?.mode===`cmdtyView`&&(delete e.data?.extendedHours,delete e.data?.buildContinuation)}function vf(e){let t=e.data?.aggregation,n=e.data?.extendedHours,r=N(n);t&&t.spec===`FormT`&&(t.spec=`None`,r||(e.data.extendedHours=!0))}function yf(e){let t=e.data?.buildContinuation,n=N(t),r=e.data?.aggregation;n&&r&&(r.spec===`Continue`&&!t&&(r.spec=`None`),t&&(r.spec=`Continue`))}function bf(e){try{ec(!1),H(e,`..plots{.type === "Study" && .curves.varyColorPerBar}`).forEach(e=>{let t=V(e.study).defaults;if(e?.curves?.length===t?.curves.length&&t?.curves.length>0)for(let n=0;n<e.curves.length;n++)e.curves[n].varyColorPerBar=t.curves[n].varyColorPerBar})}finally{ec(!0)}}function xf(e){try{ec(!1),H(e,`..plots{.type === "Study"}`).forEach(e=>{let t=V(e.study).defaults;N(e.inputs)&&e.inputs.forEach((e,n)=>{let r=t.inputs?.[n]?.value;!N(e.value)&&N(r)&&(e.value=r)}),N(e.levels)&&e.levels.forEach((e,n)=>{let r=t.levels?.[n]?.value;!N(e.value)&&N(r)&&(e.value=r)}),N(e.bands)&&e.bands.forEach((e,n)=>{let r=t.bands?.[n]?.range;!N(e.range.from)&&N(r?.from)&&(e.range.from=r.from),!N(e.range.to)&&N(r?.to)&&(e.range.to=r.to)})})}finally{ec(!0)}}function Sf(e){let t=H(e,`..axes{.annotations{.points{!.price || !.time}}}`);t.length>0&&t.forEach(e=>{let t=e.annotations.map(e=>{let t=e.points.find(e=>P(e.price)),n=e.points.find(e=>P(e.time));return!P(t)||!P(n)?null:(e.points.forEach(e=>{P(e.price)||(e.price=t.price),P(e.time)||(e.time=n.time)}),e)}).filter(e=>P(e));t.length>0?e.annotations=t:delete e.annotations});let n=H(e,`..panes`),r=e=>P(e.height)?e.height:1,i=n.map(e=>r(e)),a=Math.min(...i),o=a<.01?5/a:1;n.forEach(e=>e.height=Xe(o*r(e),4));let s=$().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=s;let c=`wheel+shift`,l=$().config.scrollBehavior||c;Object.values(ie).filter(e=>typeof e==`string`).includes(l)||(l=c),e.display.scrollBehavior=l;let u=H(e,`..plots{.type === "Study" && .study === "RSI"}`);return u.length>0&&u.forEach(e=>{if(P(e.bands)&&e.bands.length>0){let t=e.inputs&&e.inputs.length===1&&e.inputs[0].name===B.INPUT_PERIOD?e.inputs[0].value:null,n=V(`RSI`).defaults;e.curves=n.curves,e.inputs=n.inputs,P(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=n.levels}}),nf(e),af(e),sf(e),cf(e),lf(e),uf(e),df(e),ff(e),mf(e),hf(e),gf(e),of(e),_f(e),vf(e),yf(e),bf(e),xf(e),Ys(e),pf(e)}var Cf=o(((e,t)=>{(function(){var e=function(t){if(typeof t!=`object`||!t)return t;var n;if(t instanceof Date)return n=new Date,n.setTime(t.getTime()),n;if(t instanceof RegExp)return n=new RegExp(t),n;if(t instanceof Array){n=[];for(var r=0,i=t.length;r<i;r++)n[r]=e(t[r]);return n}if(t instanceof Object){for(var a in n={},t)t.hasOwnProperty(a)&&(n[a]=e(t[a]));return n}throw Error(`Unable to clone object!`)},n=function(t){for(var n=[e(t[0])],r=n[0].key,i=n[0].object,a=1,o=t.length;a<o;a++)i=i[r],r=t[a].key,n.push({object:i,key:r});return n},r=function(e,t){var n=e.length-1,r=e[n].key;t[n].object[r]=e[n].object[r]},i={type:!0,not:!0,anyOf:!0,allOf:!0,oneOf:!0,$ref:!0,$schema:!0,id:!0,exclusiveMaximum:!0,exclusiveMininum:!0,properties:!0,patternProperties:!0,additionalProperties:!0,items:!0,additionalItems:!0,required:!0,default:!0,title:!0,description:!0,definitions:!0,dependencies:!0},a={null:function(e){return e===null},string:function(e){return typeof e==`string`},boolean:function(e){return typeof e==`boolean`},number:function(e){return typeof e==`number`&&e===e},integer:function(e){return typeof e==`number`&&e%1==0},object:function(e){return e&&typeof e==`object`&&!Array.isArray(e)},array:function(e){return Array.isArray(e)},date:function(e){return e instanceof Date}},o={alpha:function(e){return/^[a-zA-Z]+$/.test(e)},alphanumeric:function(e){return/^[a-zA-Z0-9]+$/.test(e)},identifier:function(e){return/^[-_a-zA-Z0-9]+$/.test(e)},hexadecimal:function(e){return/^[a-fA-F0-9]+$/.test(e)},numeric:function(e){return/^[0-9]+$/.test(e)},"date-time":function(e){return!isNaN(Date.parse(e))&&e.indexOf(`/`)===-1},uppercase:function(e){return e===e.toUpperCase()},lowercase:function(e){return e===e.toLowerCase()},hostname:function(e){return e.length<256&&/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/.test(e)},uri:function(e){return/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/.test(e)},email:function(e){return/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/.test(e)},ipv4:function(e){return!!(/^(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)$/.test(e)&&e.split(`.`).sort()[3]<=255)},ipv6:function(e){return/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/.test(e)}},s={readOnly:function(e,t){return!1},minimum:function(e,t,n){return!(e<t||n.exclusiveMinimum&&e<=t)},maximum:function(e,t,n){return!(e>t||n.exclusiveMaximum&&e>=t)},multipleOf:function(e,t){return e/t%1==0||typeof e!=`number`},pattern:function(e,t){if(typeof e!=`string`)return!0;var n,r;return typeof t==`string`?n=t:(n=t[0],r=t[1]),new RegExp(n,r).test(e)},minLength:function(e,t){return e.length>=t||typeof e!=`string`},maxLength:function(e,t){return e.length<=t||typeof e!=`string`},minItems:function(e,t){return e.length>=t||!Array.isArray(e)},maxItems:function(e,t){return e.length<=t||!Array.isArray(e)},uniqueItems:function(e,t){for(var n={},r,i=0,a=e.length;i<a;i++){if(r=JSON.stringify(e[i]),n.hasOwnProperty(r))return!1;n[r]=!0}return!0},minProperties:function(e,t){if(typeof e!=`object`)return!0;var n=0;for(var r in e)e.hasOwnProperty(r)&&(n+=1);return n>=t},maxProperties:function(e,t){if(typeof e!=`object`)return!0;var n=0;for(var r in e)e.hasOwnProperty(r)&&(n+=1);return n<=t},constant:function(e,t){return JSON.stringify(e)==JSON.stringify(t)},enum:function(e,t){var n,r,i;if(typeof e==`object`){for(i=JSON.stringify(e),n=0,r=t.length;n<r;n++)if(i===JSON.stringify(t[n]))return!0}else for(n=0,r=t.length;n<r;n++)if(e===t[n])return!0;return!1}},c=function(e){return e.indexOf(`://`)===-1?e:e.split(`#`)[0]},l=function(e,t,n){var r,i,a=n.indexOf(`#`),o;if(a===-1)return e.schema.hasOwnProperty(n)?[e.schema[n]]:null;if(a>0)if(o=n.substr(0,a),n=n.substr(a+1),e.schema.hasOwnProperty(o))t=[e.schema[o]];else if(t&&t[0].id===o)t=[t[0]];else return null;else{if(!t)return null;n=n.substr(1)}if(n===``)return[t[0]];if(n.charAt(0)===`/`){for(n=n.substr(1),r=t[0],i=n.split(`/`);i.length>0;){if(!r.hasOwnProperty(i[0]))return null;r=r[i[0]],t.push(r),i.shift()}return t}else return null},u=function(e,t){var n,r,i=e.length-1,a,o,s=/^(\d+)/.exec(t);if(s){if(t=t.substr(s[0].length),a=parseInt(s[1],10),a<0||a>i)return;if(o=e[i-a],t===`#`)return o.key}else o=e[0];if(r=o.object[o.key],t===``)return r;if(t.charAt(0)===`/`){for(t=t.substr(1),n=t.split(`/`);n.length>0;){if(n[0]=n[0].replace(/~1/g,`/`).replace(/~0/g,`~`),!r.hasOwnProperty(n[0]))return;r=r[n[0]],n.shift()}return r}else return},d=function(e,t,a,o){var s,c,f,p,m,h,g,_=!1,v={},y,b,x,S=t.length-1,C=t[S],w,T=a.length-1,ee=a[T].object,E=a[T].key,D=ee[E],te,ne;if(C.hasOwnProperty(`$ref`))return t=l(e,t,C.$ref),t?d(e,t,a,o):{$ref:C.$ref};if(C.hasOwnProperty(`type`))if(typeof C.type==`string`){if(o.useCoerce&&e.coerceType.hasOwnProperty(C.type)&&(D=ee[E]=e.coerceType[C.type](D)),!e.fieldType[C.type](D))return{type:C.type}}else{for(_=!0,s=0,c=C.type.length;s<c&&_;s++)e.fieldType[C.type[s]](D)&&(_=!1);if(_)return{type:C.type}}if(C.hasOwnProperty(`allOf`)){for(s=0,c=C.allOf.length;s<c;s++)if(y=d(e,t.concat(C.allOf[s]),a,o),y)return y}if(!o.useCoerce&&!o.useDefault&&!o.removeAdditional){if(C.hasOwnProperty(`oneOf`)){for(ne=1/0,s=0,c=C.oneOf.length,f=0;s<c;s++)if(y=d(e,t.concat(C.oneOf[s]),a,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else if(f+=1,f>1)break;if(f>1)return{oneOf:!0};if(f<1)return v;v={}}if(C.hasOwnProperty(`anyOf`)){for(v=null,ne=1/0,s=0,c=C.anyOf.length;s<c;s++)if(y=d(e,t.concat(C.anyOf[s]),a,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else{v=null;break}if(v)return v}if(C.hasOwnProperty(`not`)&&(y=d(e,t.concat(C.not),a,o),!y))return{not:!0}}else{if(C.hasOwnProperty(`oneOf`)){for(ne=1/0,s=0,c=C.oneOf.length,f=0;s<c;s++)if(w=n(a),y=d(e,t.concat(C.oneOf[s]),w,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else{if(f+=1,f>1)break;r(w,a)}if(f>1)return{oneOf:!0};if(f<1)return v;v={}}if(C.hasOwnProperty(`anyOf`)){for(v=null,ne=1/0,s=0,c=C.anyOf.length;s<c;s++)if(w=n(a),y=d(e,t.concat(C.anyOf[s]),w,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else{r(w,a),v=null;break}if(v)return v}if(C.hasOwnProperty(`not`)&&(w=n(a),y=d(e,t.concat(C.not),w,o),!y))return{not:!0}}if(C.hasOwnProperty(`dependencies`)){for(h in C.dependencies)if(C.dependencies.hasOwnProperty(h)&&D.hasOwnProperty(h)){if(Array.isArray(C.dependencies[h])){for(s=0,c=C.dependencies[h].length;s<c;s++)if(!D.hasOwnProperty(C.dependencies[h][s]))return{dependencies:!0}}else if(y=d(e,t.concat(C.dependencies[h]),a,o),y)return y}}if(Array.isArray(D)){if(C.hasOwnProperty(`items`))if(Array.isArray(C.items)){for(s=0,c=C.items.length;s<c;s++)y=d(e,t.concat(C.items[s]),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0);if(D.length>c&&C.hasOwnProperty(`additionalItems`))if(typeof C.additionalItems==`boolean`){if(!C.additionalItems)return{additionalItems:!0}}else for(s=c,c=D.length;s<c;s++)y=d(e,t.concat(C.additionalItems),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0)}else for(s=0,c=D.length;s<c;s++)y=d(e,t.concat(C.items),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0);else if(C.hasOwnProperty(`additionalItems`)&&typeof C.additionalItems!=`boolean`)for(s=0,c=D.length;s<c;s++)y=d(e,t.concat(C.additionalItems),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0);if(_)return{schema:v}}else{for(h in b=[],v={},D)D.hasOwnProperty(h)&&b.push(h);if(o.checkRequired&&C.required)for(s=0,c=C.required.length;s<c;s++)D.hasOwnProperty(C.required[s])||(v[C.required[s]]={required:!0},_=!0);if(p=C.hasOwnProperty(`properties`),m=C.hasOwnProperty(`patternProperties`),p||m)for(s=b.length;s--;){if(x=!1,p&&C.properties.hasOwnProperty(b[s])&&(x=!0,y=d(e,t.concat(C.properties[b[s]]),a.concat({object:D,key:b[s]}),o),y!==null&&(v[b[s]]=y,_=!0)),m)for(h in C.patternProperties)C.patternProperties.hasOwnProperty(h)&&b[s].match(h)&&(x=!0,y=d(e,t.concat(C.patternProperties[h]),a.concat({object:D,key:b[s]}),o),y!==null&&(v[b[s]]=y,_=!0));x&&b.splice(s,1)}if(o.useDefault&&p&&!_)for(h in C.properties)C.properties.hasOwnProperty(h)&&!D.hasOwnProperty(h)&&C.properties[h].hasOwnProperty(`default`)&&(D[h]=C.properties[h].default);if(o.removeAdditional&&p&&C.additionalProperties!==!0&&typeof C.additionalProperties!=`object`)for(s=0,c=b.length;s<c;s++)delete D[b[s]];else if(C.hasOwnProperty(`additionalProperties`))if(typeof C.additionalProperties==`boolean`){if(!C.additionalProperties)for(s=0,c=b.length;s<c;s++)v[b[s]]={additional:!0},_=!0}else for(s=0,c=b.length;s<c;s++)y=d(e,t.concat(C.additionalProperties),a.concat({object:D,key:b[s]}),o),y!==null&&(v[b[s]]=y,_=!0);if(_)return{schema:v}}for(g in C)C.hasOwnProperty(g)&&!i.hasOwnProperty(g)&&(g===`format`?e.fieldFormat.hasOwnProperty(C[g])&&!e.fieldFormat[C[g]](D,C,a,o)&&(v[g]=!0,_=!0):e.fieldValidate.hasOwnProperty(g)&&!e.fieldValidate[g](D,C[g].hasOwnProperty(`$data`)?u(a,C[g].$data):C[g],C,a,o)&&(v[g]=!0,_=!0));return _?v:null},f={useDefault:!1,useCoerce:!1,checkRequired:!0,removeAdditional:!1};function p(){if(!(this instanceof p))return new p;this.coerceType={},this.fieldType=e(a),this.fieldValidate=e(s),this.fieldFormat=e(o),this.defaultOptions=e(f),this.schema={}}p.prototype={validate:function(e,t,n){var r=[e],i=null,a=[{object:{__root__:t},key:`__root__`}];if(typeof e==`string`&&(r=l(this,null,e),!r))throw Error(`jjv: could not find schema '`+e+`'.`);if(!n)n=this.defaultOptions;else for(var o in this.defaultOptions)this.defaultOptions.hasOwnProperty(o)&&!n.hasOwnProperty(o)&&(n[o]=this.defaultOptions[o]);return i=d(this,r,a,n),i?{validation:i.hasOwnProperty(`schema`)?i.schema:i}:null},resolveRef:function(e,t){return l(this,e,t)},addType:function(e,t){this.fieldType[e]=t},addTypeCoercion:function(e,t){this.coerceType[e]=t},addCheck:function(e,t){this.fieldValidate[e]=t},addFormat:function(e,t){this.fieldFormat[e]=t},addSchema:function(e,t){if(!t&&e&&(t=e,e=void 0),t.hasOwnProperty(`id`)&&typeof t.id==`string`&&t.id!==e){if(t.id.charAt(0)===`/`)throw Error(`jjv: schema id's starting with / are invalid.`);this.schema[c(t.id)]=t}else if(!e)throw Error(`jjv: schema needs either a name or id attribute.`);e&&(this.schema[c(e)]=t)}},t!==void 0&&t.exports!==void 0?t.exports=p:typeof define==`function`&&define.amd?define(function(){return p}):this.jjv=p}).call(e)})),wf=c(o(((e,t)=>{t.exports=Cf()}))(),1),Tf=null;function Ef(e){let{id:t,context:n}=e,r=e=>P(n[e]),i=(e,t)=>{if(!P(n[e]))throw Error(`${t} plot accessor: you must provide '${e}'`)},a=(e,t)=>{if(!e.some(e=>r(e)))throw Error(`${t} plot accessor: you must provide either '${e[0]}' or '${e[1]}'`)},o=e=>{if(r(`placement`)&&n.placement===`clone`&&!r(`cloneUid`)&&!r(`cloneIndex`))throw Error(`${e} plot accessor: when placement is 'clone', you must provide either 'cloneUid' or 'cloneIndex'.`)};if(t===`Plot`)switch(n.id){case`Add`:switch(i(`type`,`Add`),n.type){case`Study`:i(`studyId`,`Add`),o(`Add`);break;case`IncomeStatement`:case`BalanceSheet`:i(`fundamentalId`,`Add`);break;case`Expression`:i(`expression`,`Add`);break}break;case`Get`:if(!r(`main`)&&!r(`type`))throw Error(`Get plot accessor: you must provide either 'main' or 'type'`);break;case`Delete`:i(`type`,`Delete`),a([`uid`,`index`],`Delete`);break;case`Update`:switch(i(`type`,`Update`),r(`main`)||a([`uid`,`index`],`Update`),o(`Update`),n.type){case`Forward`:if(!P(n.forward)){if(!P(n.curves)||!P(n.offsets))throw Error(`Update forward plot accessor: you must provide either 'forward' or 'curves' and 'offsets'`);if(n.curves.length!==n.offsets.length)throw Error(`Update forward plot accessor: you must provide same number of elements for 'curves' and 'offsets'`)}break;case`Seasonal`:if(!P(n.seasonal)){if(!P(n.curves)||!P(n.offsets))throw Error(`Update seasonal plot accessor: you must provide either 'seasonal' or 'curves' and 'offsets'`);if(n.curves.length!==n.offsets.length&&n.curves.length!==n.offsets.length+1)throw Error(`Update seasonal plot accessor: you must provide either same number of elements for 'curves' and 'offsets' or one curve more`)}break;case`Study`:{i(`studyId`,`Update`),o(`Update`);let e=e=>e.reduce((e,t)=>e.concat(t.fields),[]),t=V(n.studyId),r=e=>`Update study plot accessor: you must provide same number of elements for '${e}' of the study as defined in the taxonomy`,a=e=>`Update study plot accessor: incoming list of ${e} is different from the ${e} as defined in the taxonomy`;if(P(n.curves)){if(n.curves.length!==t.defaults.curves.length)throw Error(r(`curves`));let i=e(n.curves);if(j(e(t.defaults.curves),i).length!==0)throw Error(a(`fields`))}break}}break}}function Df(){Tf===null&&(Tf=(0,wf.default)(),Tf.defaultOptions.useDefault=!0,[B.CHART_SCHEMA,B.STUDIES_SCHEMA,B.FIELDS_SCHEMA,B.ACCESSOR_SCHEMA].forEach(e=>{Tf.addSchema(e,Xs(e))}))}function Of(e,t){Tf.addSchema(e,t)}function kf(e){H(e,`..plots{.type}`).forEach(e=>{P(e.uid)||(e.uid=bt())}),H(e,`..plots{.type==="${C[C.Study]}"}`).forEach(e=>{let t=V(e.study);P(t)&&ut(e,t.defaults)})}function Af(e){return e===B.CHART_SCHEMA}function jf(e){return e===B.ACCESSOR_SCHEMA}function Mf(e,t){Df();let n=ku(e,t);Af(t)&&(kf(n),n=Sf(n));let r=Tf.validate(t,n);if(r){let e=JSON.stringify(r,null,4);throw Error(`Document not valid according to schema ${t}; error is ${e}`)}return jf(t)&&Ef(n),n}function Nf(e){return U(U(e,`..panes{.axes{!.plots}}`,e=>(e.axes.length===1?e.axes=[]:e.axes[1].plots.length===0&&(e.axes.pop(),e.axes[0].plots.length===0&&(e.axes=[])),e)),`..panes{!.axes}`,e=>B.NULL_OBJECT)}var Pf=JSON.parse(`[{"id":"DateTime","type":"Date"},{"id":"Open"},{"id":"High"},{"id":"Low"},{"id":"Close"},{"id":"TradeSize","format":"AsInteger"},{"id":"Volume","format":"UseMetricUnit","shortName":"VOL"},{"id":"OpenInterest","format":"UseMetricUnit","shortName":"OI"},{"id":"Last"},{"id":"Bid"},{"id":"BidSize","format":"AsInteger"},{"id":"Ask"},{"id":"AskSize","format":"AsInteger"},{"id":"Symbol","type":"String"},{"id":"Change"},{"id":"PercentChange","format":"AsPercent"},{"id":"TradingDay"},{"id":"PreviousClose"},{"id":"PreviousOpen"},{"id":"PreviousHigh"},{"id":"PreviousLow"},{"id":"WeekPreviousClose"},{"id":"WeekPreviousHigh"},{"id":"WeekPreviousLow"},{"id":"MonthPreviousClose"},{"id":"MonthPreviousHigh"},{"id":"MonthPreviousLow"},{"id":"YearHigh"},{"id":"YearLow"},{"id":"Projection","name":"Projection"},{"id":"BarIndex","name":"Bar Index"},{"id":"Dividends","type":"String","category":"Event","name":"Dividend","shortName":"D"},{"id":"Splits","type":"String","category":"Event","name":"Split","shortName":"S"},{"id":"Earnings","type":"String","category":"Event","shortName":"E"},{"id":"Buy","category":"Event","name":"BuySignal","shortName":"B"},{"id":"Sell","category":"Event","name":"SellSignal","shortName":"S"},{"id":"Custom","category":"Event","name":"CustomEvent","shortName":"Z"},{"id":"Call","category":"Option"},{"id":"Put","category":"Option"},{"id":"Delta","category":"Option"},{"id":"Gamma","category":"Option"},{"id":"Theta","category":"Option"},{"id":"Vega","category":"Option"},{"id":"WeighImplVolHigh","category":"Option","name":"Implied Volatility High","shortName":"WeighImplVolHigh"},{"id":"WeighImplVolLow","category":"Option","name":"Implied Volatility Low","shortName":"WeighImplVolLow"},{"id":"WeighImplVol","category":"Option","name":"Implied Volatility","shortName":"WeighImplVol"},{"id":"WeighImplVolHigh5D","category":"Option","name":"Weighted Implied Volatility High 5D","shortName":"WeighImplVolHigh5D"},{"id":"WeighImplVolLow5D","category":"Option","name":"Weighted Implied Volatility Low 5D","shortName":"WeighImplVolLow5D"},{"id":"WeighImplVol5D","category":"Option","name":"Weighted Implied Volatility 5D","shortName":"WeighImplVol5D"},{"id":"WeighImplVolHigh1M","category":"Option","name":"Weighted Implied Volatility High 1M","shortName":"WeighImplVolHigh1M"},{"id":"WeighImplVolLow1M","category":"Option","name":"Weighted Implied Volatility Low 1M","shortName":"WeighImplVolLow1M"},{"id":"WeighImplVol1M","category":"Option","name":"Weighted Implied Volatility 1M","shortName":"WeighImplVol1M"},{"id":"WeighImplVolHigh3M","category":"Option","name":"Weighted Implied Volatility High 3M","shortName":"WeighImplVolHigh3M"},{"id":"WeighImplVolLow3M","category":"Option","name":"Weighted Implied Volatility Low 3M","shortName":"WeighImplVolLow3M"},{"id":"WeighImplVol3M","category":"Option","name":"Weighted Implied Volatility 3M","shortName":"WeighImplVol3M"},{"id":"WeighImplVolHigh6M","category":"Option","name":"Weighted Implied Volatility High 6M","shortName":"WeighImplVolHigh6M"},{"id":"WeighImplVolLow6M","category":"Option","name":"Weighted Implied Volatility Low 6M","shortName":"WeighImplVolLow6M"},{"id":"WeighImplVol6M","category":"Option","name":"Weighted Implied Volatility 6M","shortName":"WeighImplVol6M"},{"id":"WeighImplVolHigh1Y","category":"Option","name":"Weighted Implied Volatility High 1Y","shortName":"WeighImplVolHigh1Y"},{"id":"WeighImplVolLow1Y","category":"Option","name":"Weighted Implied Volatility Low 1Y","shortName":"WeighImplVolLow1Y"},{"id":"WeighImplVol1Y","category":"Option","name":"Weighted Implied Volatility 1Y","shortName":"WeighImplVol1Y"},{"id":"WeighImplVolHighYTD","category":"Option","name":"Weighted Implied Volatility High YTD","shortName":"WeighImplVolHighYTD"},{"id":"WeighImplVolLowYTD","category":"Option","name":"Weighted Implied Volatility Low YTD","shortName":"WeighImplVolLowYTD"},{"id":"WeighImplVolYTD","category":"Option","name":"Weighted Implied Volatility YTD","shortName":"WeighImplVolYTD"},{"id":"WeighImplVolChg","category":"Option","name":"Weighted Implied Volatility Change","shortName":"WeighImplVolChg"},{"id":"ImplVolRank5D","category":"Option","name":"Implied Volatility Rank 5D","shortName":"ImplVolRank5D"},{"id":"ImplVolRank1M","category":"Option","name":"Implied Volatility Rank 1M","shortName":"ImplVolRank1M"},{"id":"ImplVolRank3M","category":"Option","name":"Implied Volatility Rank 3M","shortName":"ImplVolRank3M"},{"id":"ImplVolRank6M","category":"Option","name":"Implied Volatility Rank 6M","shortName":"ImplVolRank6M"},{"id":"ImplVolRank1Y","category":"Option","name":"Implied Volatility Rank","shortName":"ImplVolRank1Y"},{"id":"ImplVolRankYTD","category":"Option","name":"Implied Volatility Rank YTD","shortName":"ImplVolRankYTD"},{"id":"ImplVolPerc5D","category":"Option","name":"Implied Volatility Perc. 5D","shortName":"ImplVolPerc5D"},{"id":"ImplVolPerc1M","category":"Option","name":"Implied Volatility Perc. 1M","shortName":"ImplVolPerc1M"},{"id":"ImplVolPerc3M","category":"Option","name":"Implied Volatility Perc. 3M","shortName":"ImplVolPerc3M"},{"id":"ImplVolPerc6M","category":"Option","name":"Implied Volatility Perc. 6M","shortName":"ImplVolPerc6M"},{"id":"ImplVolPerc1Y","category":"Option","name":"Implied Volatility Percentile","shortName":"ImplVolPerc1Y"},{"id":"ImplVolPercYTD","category":"Option","name":"Implied Volatility Perc. YTD","shortName":"ImplVolPercYTD"},{"id":"OptTotVol","category":"Option","name":"Options Total Volume","shortName":"OptTotVol","format":"UseMetricUnit"},{"id":"OptCallVol","category":"Option","name":"Options Call Volume","shortName":"OptCallVol","format":"UseMetricUnit"},{"id":"OptPutVol","category":"Option","name":"Options Put Volume","shortName":"OptPutVol","format":"UseMetricUnit"},{"id":"PutCallVolRatio","category":"Option","name":"Put Call Volume Ratio","shortName":"PutCallVolRatio"},{"id":"TotalOpenInt","category":"Option","name":"Total Open Interest","shortName":"Total OI","format":"UseMetricUnit"},{"id":"CallOpenInt","category":"Option","name":"Call Open Interest","shortName":"Call OI","format":"UseMetricUnit"},{"id":"PutOpenInt","category":"Option","name":"Put Open Interest","shortName":"Put OI","format":"UseMetricUnit"},{"id":"PutCallOIRatio","category":"Option","name":"Put Call OI Ratio","shortName":"Put Call OI Ratio"},{"id":"CallIVCurve","category":"Option","name":"Call IV Curve","shortName":"Call IV Curve"},{"id":"PutIVCurve","category":"Option","name":"Put IV Curve","shortName":"Put IV Curve"},{"id":"CallTheoretical","category":"Option","name":"Call Theoretical","shortName":"Call Theoretical"},{"id":"PutTheoretical","category":"Option","name":"Put Theoretical","shortName":"Put Theoretical"},{"id":"HL/2","category":"Study","name":"(High+Low)/2","shortName":"(H+L)/2"},{"id":"OC/2","category":"Study","name":"(Open+Close)/2","shortName":"(O+C)/2"},{"id":"HLC/3","category":"Study","name":"(High+Low+Close)/3","shortName":"(H+L+C)/3"},{"id":"OHLC/4","category":"Study","name":"(Open+High+Low+Close)/4","shortName":"(O+H+L+C)/4"},{"id":"HLCC/4","category":"Study","name":"(High+Low+Close+Close)/4","shortName":"(H+L+C+C)/4"},{"id":"AVG","category":"Study","name":"Average","shortName":"AVG"},{"id":"FRAMA","category":"Study","name":"FRAMA","shortName":"FRAMA"},{"id":"MA","category":"Study","name":"MA-Simple","shortName":"MA"},{"id":"MACLD1","category":"Study","name":"MA-Cloud-Fast","shortName":"MACLD1"},{"id":"MACLD2","category":"Study","name":"MA-Cloud-Slow","shortName":"MACLD2"},{"id":"MA1","category":"Study","name":"MA1-Simple","shortName":"MA1"},{"id":"MA2","category":"Study","name":"MA2-Simple","shortName":"MA2"},{"id":"MA3","category":"Study","name":"MA3-Simple","shortName":"MA3"},{"id":"MA4","category":"Study","name":"MA4-Simple","shortName":"MA4"},{"id":"MA5","category":"Study","name":"MA5-Simple","shortName":"MA5"},{"id":"MA6","category":"Study","name":"MA6-Simple","shortName":"MA6"},{"id":"MA7","category":"Study","name":"MA7-Simple","shortName":"MA7"},{"id":"MA8","category":"Study","name":"MA8-Simple","shortName":"MA8"},{"id":"MA9","category":"Study","name":"MA9-Simple","shortName":"MA9"},{"id":"MA10","category":"Study","name":"MA10-Simple","shortName":"MA10"},{"id":"MAS","category":"Study","name":"MA-Shorter","shortName":"MAS"},{"id":"MAL","category":"Study","name":"MA-Longer","shortName":"MAL"},{"id":"CMBCI","category":"Study","name":"Composite Index","shortName":"CMBCI"},{"id":"CMBCIF","category":"Study","name":"Fast Ma","shortName":"CMBCIF"},{"id":"CMBCIS","category":"Study","name":"Slow Ma","shortName":"CMBCIS"},{"id":"COTI","category":"Study","name":"COT Index","shortName":"COTI"},{"id":"CHEXL","category":"Study","name":"ChandelierExitLong","shortName":"CHEXL"},{"id":"CHEXS","category":"Study","name":"ChandelierExitShort","shortName":"CHEXS"},{"id":"SUPTR","category":"Study","name":"Supertrend","shortName":"SUPTR"},{"id":"BARCOLIX","category":"Study","name":"BarColorIndex","shortName":"BARCOLIX"},{"id":"BARKIND","category":"Study","name":"BarKind","shortName":"BARKIND"},{"id":"BREL","category":"Study","name":"BarRelation","shortName":"BREL"},{"id":"EMA","category":"Study","name":"MA-Exp","shortName":"MA(EXP)"},{"id":"MAHI","category":"Study","name":"MA-High","shortName":"MA(HI)"},{"id":"MALO","category":"Study","name":"MA-Low","shortName":"MA(LO)"},{"id":"MACD","category":"Study","name":"MACD","shortName":"MACD"},{"id":"MACDS","category":"Study","name":"MACD-Signal","shortName":"MACD(S)"},{"id":"MACDH","category":"Study","name":"MACD-Histogram","shortName":"MACD(H)"},{"id":"MACDV","category":"Study","name":"MACD-V","shortName":"MACD-V"},{"id":"MACDVS","category":"Study","name":"MACD-V-Signal","shortName":"MACD-V(S)"},{"id":"MACDVH","category":"Study","name":"MACD-V-Histogram","shortName":"MACD-V(H)"},{"id":"ENVU","category":"Study","name":"Envelope-Up","shortName":"ENV(UP)"},{"id":"ENVD","category":"Study","name":"Envelope-Down","shortName":"ENV(DN)"},{"id":"ENVEXPU","category":"Study","name":"Envelope-Exponential-Up","shortName":"ENVEXP(UP)"},{"id":"ENVEXPD","category":"Study","name":"Envelope-Exponential-Down","shortName":"ENVEXP(DN)"},{"id":"ENVSMOU","category":"Study","name":"Envelope-Smoothed-Up","shortName":"ENVSMO(UP)"},{"id":"ENVSMOD","category":"Study","name":"Envelope-Smoothed-Down","shortName":"ENVSMO(DN)"},{"id":"SMA","category":"Study","name":"MA-Smoothed","shortName":"MA(S)"},{"id":"CSHO","category":"Study","name":"Cash-Overlay","shortName":"CSHO"},{"id":"CSHB","category":"Study","name":"Cash-Basis","shortName":"CSHB"},{"id":"MKTCAP","category":"Study","name":"Market-Cap","format":"UseMetricUnit","shortName":"MktCap"},{"id":"TMA","category":"Study","name":"MA-Triangular","shortName":"MA(TRI)"},{"id":"WMA","category":"Study","name":"MA-Weighted","shortName":"MA(W)"},{"id":"VOLMA","category":"Study","format":"UseMetricUnit","name":"MA-Volume","shortName":"VOLMA"},{"id":"OSC","category":"Study","name":"OSC","shortName":"OSC"},{"id":"VOSC","category":"Study","format":"UseMetricUnit","name":"OSC-Volume","shortName":"VOLOSC"},{"id":"RSI","category":"Study","name":"RSI","shortName":"RSI"},{"id":"RSIAVG","category":"Study","name":"RSI-Average","shortName":"RSIAVG"},{"id":"RSA","category":"Study","name":"RSA","shortName":"RSA"},{"id":"RSAAVG","category":"Study","name":"RSA-Average","shortName":"RSIAVG"},{"id":"STORSI","category":"Study","name":"StochRSI","shortName":"STOCHRSI"},{"id":"STORSIAVG","category":"Study","name":"StochRSIAvg","shortName":"STOCHRSIAVG"},{"id":"HH","category":"Study","name":"HighestHigh","shortName":"HHIGH"},{"id":"LL","category":"Study","name":"LowestLow","shortName":"LLOW"},{"id":"PercK","category":"Study","name":"%K","shortName":"PCNTK"},{"id":"PercD","category":"Study","name":"%D","shortName":"PCNTD"},{"id":"PercR","category":"Study","name":"%R","shortName":"PCNTR"},{"id":"WGCL","category":"Study","name":"WeightedClose","shortName":"WTCL"},{"id":"WGALPH","category":"Study","name":"WeightedAlpha","shortName":"WGALPH"},{"id":"UPVOL","category":"Study","format":"UseMetricUnit","name":"UpVol","shortName":"UPVOL"},{"id":"DNVOL","category":"Study","format":"UseMetricUnit","name":"DownVol","shortName":"DNVOL"},{"id":"TOTVOL","category":"Study","format":"UseMetricUnit","name":"TotVol","shortName":"TOTVOL"},{"id":"POC","category":"Study","name":"PointOfControl","shortName":"POC"},{"id":"VAREA","category":"Study","name":"ValueArea","shortName":"VAREA"},{"id":"BARBACK","category":"Study","name":"Background","shortName":"BARBACK"},{"id":"BOLLBU","category":"Study","name":"Bollinger-Upper","shortName":"BOLL(U)"},{"id":"BOLLBL","category":"Study","name":"Bollinger-Lower","shortName":"BOLL(L)"},{"id":"BOLLBM","category":"Study","name":"Bollinger-Mid","shortName":"BOLL(M)"},{"id":"BOLLW","category":"Study","name":"Bollinger-Width","shortName":"BOLL(W)"},{"id":"BOLLP","category":"Study","name":"Bollinger-Percent","shortName":"BOLL(%B)"},{"id":"BOLLBW","category":"Study","name":"Bollinger-BandWidth","shortName":"BOLL(BW)"},{"id":"BOLLBWA","category":"Study","name":"Bollinger-BandWidthAvg","shortName":"BOLL(BWA)"},{"id":"PCUP1","category":"Study","name":"ProbCone-Up1","shortName":"PCUP1"},{"id":"PCDN1","category":"Study","name":"ProbCone-Down1","shortName":"PCDN1"},{"id":"PCUP2","category":"Study","name":"ProbCone-Up2","shortName":"PCUP2"},{"id":"PCDN2","category":"Study","name":"ProbCone-Down2","shortName":"PCDN2"},{"id":"PCUP3","category":"Study","name":"ProbCone-Up3","shortName":"PCUP3"},{"id":"PCDN3","category":"Study","name":"ProbCone-Down3","shortName":"PCDN3"},{"id":"PCTD","category":"Study","name":"ProbCone-TgtDate","shortName":"PCTD"},{"id":"PCTP","category":"Study","name":"ProbCone-TgtPrice","shortName":"PCTP"},{"id":"MBBUO","category":"Study","name":"ModifiedBoll-UppOut","shortName":"MBOLL(UO)"},{"id":"MBBUI","category":"Study","name":"ModifiedBoll-UppIn","shortName":"MBOLL(UI)"},{"id":"MBBM","category":"Study","name":"ModifiedBoll-Mid","shortName":"MBOLL(M)"},{"id":"MBBLI","category":"Study","name":"ModifiedBoll-LowIn","shortName":"MBOLL(LI)"},{"id":"MBBLO","category":"Study","name":"ModifiedBoll-LowOut","shortName":"MBOLL(LO)"},{"id":"OBVOL","category":"Study","format":"UseMetricUnit","name":"OnBalanceVol","shortName":"OBVOL"},{"id":"OBVOLAVG","category":"Study","format":"UseMetricUnit","name":"OnBalanceVolAvg","shortName":"OBVOL"},{"id":"TR","category":"Study","name":"TrueRange","shortName":"TR"},{"id":"ATR","category":"Study","name":"AvgTrueRange","shortName":"ATR"},{"id":"ATRMA","category":"Study","name":"MA-ATR","shortName":"MA(ATR)"},{"id":"ADJATR","category":"Study","name":"AdjAvgTrueRange","shortName":"ADJATR"},{"id":"COTR","category":"Study","name":"ChgOverTrueRange","shortName":"COTR"},{"id":"ATRP","category":"Study","name":"AvgTrueRangePerc","shortName":"ATRP"},{"id":"STOMOMIX","category":"Study","name":"StochMomIndex","shortName":"STOMOMIX"},{"id":"CHDMOMOSC","category":"Study","name":"ChandeMomOsc","shortName":"CHDMOMOSC"},{"id":"CHDMOMOSCAVG","category":"Study","name":"ChandeMomOsc-Avg","shortName":"CHDMOMOSCAVG"},{"id":"PDI","category":"Study","name":"+DI","shortName":"+DI"},{"id":"MDI","category":"Study","name":"-DI","shortName":"-DI"},{"id":"PLVI","category":"Study","name":"+VI","shortName":"+VI"},{"id":"MNVI","category":"Study","name":"-VI","shortName":"-VI"},{"id":"ADX","category":"Study","name":"ADX","shortName":"ADX"},{"id":"ADXM","category":"Study","name":"ADX-Modified","shortName":"ADXM"},{"id":"ADL","category":"Study","format":"UseMetricUnit","name":"AccDist","shortName":"ACCDIS"},{"id":"ADWM","category":"Study","name":"AccDistWill","shortName":"ACCDISWIL"},{"id":"ADWMMA","category":"Study","name":"AccDistWillMovAvg","shortName":"ACCDISWILMA"},{"id":"MCGD","category":"Study","name":"McGinleyDyn","shortName":"MCGD"},{"id":"HMA","category":"Study","name":"HullMovAvg","shortName":"HMA"},{"id":"COPP","category":"Study","name":"CoppCurve","shortName":"COPP"},{"id":"CHAOSC","category":"Study","format":"UseMetricUnit","name":"ChaikinOsc","shortName":"CHAIKOSC"},{"id":"TP","category":"Study","name":"TypicalPrice","shortName":"TP"},{"id":"KCUP","category":"Study","name":"KeltChan-Up","shortName":"KELT(UP)"},{"id":"KCMID","category":"Study","name":"KeltChan-Mid","shortName":"KELT(MID)"},{"id":"KCLOW","category":"Study","name":"KeltChan-Low","shortName":"KELT(LO)"},{"id":"KBUP","category":"Study","name":"KeltBands-Up","shortName":"KELB(UP)"},{"id":"KBMID","category":"Study","name":"KeltBands-Mid","shortName":"KELB(MID)"},{"id":"KBLOW","category":"Study","name":"KeltBands-Low","shortName":"KELB(LO)"},{"id":"DONUP","category":"Study","name":"Donchian-Up","shortName":"DON(U)"},{"id":"DONMID","category":"Study","name":"Donchian-Mid","shortName":"DON(M)"},{"id":"DONLOW","category":"Study","name":"Donchian-Low","shortName":"DON(L)"},{"id":"DONW","category":"Study","name":"Donchian-Width","shortName":"DON(W)"},{"id":"PVT","category":"Study","format":"UseMetricUnit","name":"PriceVolChange","shortName":"PVOL"},{"id":"TRIX","category":"Study","name":"Triple-MA-Exp","shortName":"TRIX"},{"id":"ROC","category":"Study","name":"RateOfChange","shortName":"ROC"},{"id":"PVPT","category":"Study","name":"PivotPoint","shortName":"PVMOV"},{"id":"PVPTR","category":"Study","name":"PvtPt-Resistance","shortName":"PVMOV(R)"},{"id":"PVPTS","category":"Study","name":"PvtPt-Support","shortName":"PVMOV(S)"},{"id":"FISHER","category":"Study","name":"Fisher","shortName":"Fisher"},{"id":"FISHTRG","category":"Study","name":"Fisher-Trigger","shortName":"Trigger"},{"id":"ARNUP","category":"Study","name":"Aroon-Up","shortName":"ARN(UP)"},{"id":"ARNLOW","category":"Study","name":"Aroon-Down","shortName":"ARN(DN)"},{"id":"VSTOPUP","category":"Study","name":"VolaStop-Up","shortName":"VSTOP(UP)"},{"id":"VSTOPLOW","category":"Study","name":"VolaStop-Down","shortName":"VSTOP(DN)"},{"id":"ARNOSC","category":"Study","name":"Aroon-Osci","shortName":"ARNOSC"},{"id":"TCHNUP","category":"Study","name":"TurtleChn-Up","shortName":"TCH(UP)"},{"id":"TCHNLOW","category":"Study","name":"TurtleChn-Low","shortName":"TCH(LO)"},{"id":"TCHRE","category":"Study","name":"TurtleChnRetrace","shortName":"TCHRE"},{"id":"ALJAW","category":"Study","name":"Alligator-Jaw","shortName":"AL(J)"},{"id":"ALTEETH","category":"Study","name":"Alligator-Teeth","shortName":"AL(T)"},{"id":"ALLIPS","category":"Study","name":"Alligator-Lips","shortName":"AL(L)"},{"id":"PLTLN","category":"Study","name":"PlotLine","shortName":"LINE"},{"id":"AWOS","category":"Study","name":"AwesomeOsc","shortName":"AWOSC"},{"id":"AWOSMA","category":"Study","name":"AwesomeOsc-MA","shortName":"AWOSC(MA)"},{"id":"MFMUL","category":"Study","name":"MoneyFlowMul"},{"id":"CLV","category":"Study","name":"CloseLocationValue","shortName":"CLV"},{"id":"CHOP","category":"Study","name":"ChoppinessIndex","shortName":"ChopIx"},{"id":"CHAMF","category":"Study","name":"ChaikinMoneyFlow","shortName":"CHAIKMF"},{"id":"CHAVOL","category":"Study","name":"ChaikinVolatility","shortName":"CHAIKVOL"},{"id":"DPO","category":"Study","name":"DetrendedPriceOsc","shortName":"DPO"},{"id":"CCI","category":"Study","name":"CommodityChannelIndex","shortName":"CCI"},{"id":"EMV","category":"Study","name":"EaseOfMovement","shortName":"EOM"},{"id":"EMVMA","category":"Study","name":"EaseOfMovementMA","shortName":"EOM(MA)"},{"id":"ERBLPOW","category":"Study","name":"ElderRayBullPow","shortName":"ER(BULL)"},{"id":"ERBRPOW","category":"Study","name":"ElderRayBearPow","shortName":"ER(BEAR)"},{"id":"FI","category":"Study","format":"UseMetricUnit","name":"ForceIndex","shortName":"FORCE"},{"id":"MI","category":"Study","name":"MassIndex","shortName":"MASS"},{"id":"MOM","category":"Study","name":"Momentum","shortName":"MOM"},{"id":"MOMMA","category":"Study","name":"MA-Momentum","shortName":"MA(MOM)"},{"id":"MFI","category":"Study","name":"MoneyFlowIndex","shortName":"MFI"},{"id":"MSD","category":"Study","name":"MovingStdDev","shortName":"MSD"},{"id":"PCTCHG","category":"Study","name":"PercentChange","shortName":"PCTCHG"},{"id":"LINRUP","category":"Study","name":"LinRegUpper","shortName":"LINRUP"},{"id":"LINRMID","category":"Study","name":"LinRegMiddle","shortName":"LINRMID"},{"id":"LINRLOW","category":"Study","name":"LinRegLower","shortName":"LINRLOW"},{"id":"NVI","category":"Study","name":"NegativeVolIndex","shortName":"NVI"},{"id":"NVIEMA","category":"Study","name":"NegativeVolIndexEMA","shortName":"NVI(EMA)"},{"id":"PVI","category":"Study","name":"PositiveVolIndex","shortName":"PVI"},{"id":"PVIEMA","category":"Study","name":"PositiveVolIndexEMA","shortName":"PVI(EMA)"},{"id":"PPO","category":"Study","name":"PercPriceOsc","shortName":"PPO"},{"id":"PPOS","category":"Study","name":"PPO-Signal","shortName":"PPO(S)"},{"id":"PPOH","category":"Study","name":"PPO-Histogram","shortName":"PPO(H)"},{"id":"PVO","category":"Study","name":"PercVolOsc","shortName":"PVO"},{"id":"PVOS","category":"Study","name":"PVO-Signal","shortName":"PVO(S)"},{"id":"PVOH","category":"Study","name":"PVO-Histogram","shortName":"PVO(H)"},{"id":"HV","category":"Study","name":"HistVolatility","shortName":"HISTVOL"},{"id":"PERF","category":"Study","name":"Performance","shortName":"PERF"},{"id":"STC","category":"Study","name":"SchaffTrendCycle","shortName":"STC"},{"id":"MCCLO","category":"Study","name":"McClellanOsc","shortName":"MCCLO"},{"id":"BTI","category":"Study","name":"BreadthThrust","shortName":"BTI"},{"id":"NHLAI","category":"Study","name":"NewHiLoAccIx","shortName":"NHLAI"},{"id":"KST","category":"Study","name":"KnowSureThing","shortName":"KST"},{"id":"KSTSIG","category":"Study","name":"KST-Signal","shortName":"KSTSIG"},{"id":"WASI","category":"Study","name":"WilderAccSwingIndex","shortName":"WACCSW"},{"id":"WWVSARU","category":"Study","name":"WilderVolSarUp","shortName":"WVOL-UP"},{"id":"WWVSARD","category":"Study","name":"WilderVolSarDown","shortName":"WVOL-DN"},{"id":"PARSARS","category":"Study","name":"ParabolicSarShort","shortName":"SHORT"},{"id":"PARSARL","category":"Study","name":"ParabolicSarLong","shortName":"LONG"},{"id":"REATRS","category":"Study","name":"RetraceATRStop","shortName":"REATRS"},{"id":"MOVLR","category":"Study","name":"MovingLinRegression","shortName":"MOVLINREG"},{"id":"TRSP1","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TRSP2","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TARGP","category":"Study","name":"Target Price","shortName":"TARGP"},{"id":"COTLCCMSP","category":"Study","name":"Comm Spec","shortName":"COT(C)"},{"id":"COTLCLGSP","category":"Study","name":"Large Spec","shortName":"COT(L)"},{"id":"COTLCSMSP","category":"Study","name":"Small Spec","shortName":"COT(S)"},{"id":"COTDAGPRO","category":"Study","name":"Producers","shortName":"COTDIS(P)"},{"id":"COTDAGSPD","category":"Study","name":"Swap Dealers","shortName":"COTDIS(S)"},{"id":"COTDAGMNM","category":"Study","name":"Managed Money","shortName":"COTDIS(M)"},{"id":"COTDAGOTH","category":"Study","name":"Other Report","shortName":"COTDIS(O)"},{"id":"COTFTRDLI","category":"Study","name":"Dealer Intermediary","shortName":"COTFIN(D)"},{"id":"COTFTRASM","category":"Study","name":"Asset Manager","shortName":"COTFIN(A)"},{"id":"COTFTRLVF","category":"Study","name":"Leveraged Funds","shortName":"COTFIN(L)"},{"id":"COTFTROTH","category":"Study","name":"Other Report","shortName":"COTFIN(O)"},{"id":"PPTPIV","category":"Study","name":"Pivot Point","shortName":"PPT(P)"},{"id":"PPTR1","category":"Study","name":"1st Resistance","shortName":"PPT(R1)"},{"id":"PPTR2","category":"Study","name":"2nd Resistance","shortName":"PPT(R2)"},{"id":"PPTR3","category":"Study","name":"3rd Resistance","shortName":"PPT(R3)"},{"id":"PPTS1","category":"Study","name":"1st Support","shortName":"PPT(S1)"},{"id":"PPTS2","category":"Study","name":"2nd Support","shortName":"PPT(S2)"},{"id":"PPTS3","category":"Study","name":"3rd Support","shortName":"PPT(S3)"},{"id":"CPPH4","category":"Study","name":"4th Camarilla Res","shortName":"CPP(H4)"},{"id":"CPPH3","category":"Study","name":"3rd Camarilla Res","shortName":"CPP(H3)"},{"id":"CPPH2","category":"Study","name":"2nd Camarilla Res","shortName":"CPP(H2)"},{"id":"CPPH1","category":"Study","name":"1st Camarilla Res","shortName":"CPP(H1)"},{"id":"CPPL1","category":"Study","name":"1st Camarilla Supp","shortName":"CPP(L1)"},{"id":"CPPL2","category":"Study","name":"2nd Camarilla Supp","shortName":"CPP(L2)"},{"id":"CPPL3","category":"Study","name":"3rd Camarilla Supp","shortName":"CPP(L3)"},{"id":"CPPL4","category":"Study","name":"4th Camarilla Supp","shortName":"CPP(L4)"},{"id":"IMPVOL","category":"Study","name":"Implied Volatility","shortName":"IV"},{"id":"CTM","category":"Study","name":"Cycle Trading Momentum","shortName":"CTM"},{"id":"CPMI","category":"Study","name":"Principal Momentum","shortName":"CPMI"},{"id":"CTPI","category":"Study","name":"Turning Point","shortName":"CTPI"},{"id":"CTLTM","category":"Study","name":"Long-Term Momentum","shortName":"LTM"},{"id":"CTLTMF","category":"Study","name":"Long-Term Momentum, Fast","shortName":"LTM(F)"},{"id":"DEMA","category":"Study","name":"Double EMA","shortName":"DEMA"},{"id":"EOSC","category":"Study","name":"Exponential Oscillator","shortName":"EOSC"},{"id":"TEMA","category":"Study","name":"Triple EMA","shortName":"TEMA"},{"id":"TSI","category":"Study","name":"True Strength Index","shortName":"Tsi"},{"id":"TSISIG","category":"Study","name":"True Strength Index Signal","shortName":"TsiSig"},{"id":"GMMA3","category":"Study","name":"GMMA-EMA3","shortName":"GMMA(3)"},{"id":"GMMA5","category":"Study","name":"GMMA-EMA5","shortName":"GMMA(5)"},{"id":"GMMA8","category":"Study","name":"GMMA-EMA8","shortName":"GMMA(8)"},{"id":"GMMA10","category":"Study","name":"GMMA-EMA10","shortName":"GMMA(10)"},{"id":"GMMA12","category":"Study","name":"GMMA-EMA12","shortName":"GMMA(12)"},{"id":"GMMA15","category":"Study","name":"GMMA-EMA15","shortName":"GMMA(15)"},{"id":"GMMA30","category":"Study","name":"GMMA-EMA30","shortName":"GMMA(30)"},{"id":"GMMA35","category":"Study","name":"GMMA-EMA35","shortName":"GMMA(35)"},{"id":"GMMA40","category":"Study","name":"GMMA-EMA40","shortName":"GMMA(40)"},{"id":"GMMA45","category":"Study","name":"GMMA-EMA45","shortName":"GMMA(45)"},{"id":"GMMA50","category":"Study","name":"GMMA-EMA50","shortName":"GMMA(50)"},{"id":"GMMA60","category":"Study","name":"GMMA-EMA60","shortName":"GMMA(60)"},{"id":"CONVLN","category":"Study","name":"ConversionLine","shortName":"ConvLn"},{"id":"BASELN","category":"Study","name":"BaseLine","shortName":"BaseLn"},{"id":"LEADSP1","category":"Study","name":"LeadingSpanA","shortName":"LeadSpA"},{"id":"LEADSP2","category":"Study","name":"LeadingSpanB","shortName":"LeadSpB"},{"id":"LAGGSP","category":"Study","name":"LaggingSpan","shortName":"LaggSp"},{"id":"VWAP","category":"Study","name":"VWAP","shortName":"VWAP"},{"id":"AVWAP","category":"Study","name":"Anchored VWAP","shortName":"Anch-VWAP"},{"id":"VWAPSD1U","category":"Study","name":"VWAP Stdev1 Upper","shortName":"VWAP-Std1-Up"},{"id":"VWAPSD1L","category":"Study","name":"VWAP Stdev1 Lower","shortName":"VWAP-Std1-Lo"},{"id":"VWAPSD2U","category":"Study","name":"VWAP Stdev2 Upper","shortName":"VWAP-Std2-Up"},{"id":"VWAPSD2L","category":"Study","name":"VWAP Stdev2 Lower","shortName":"VWAP-Std2-Lo"},{"id":"DIFA","category":"Study","name":"Distance From Average","shortName":"DistAvg"},{"id":"DOSCH","category":"Study","name":"Derivative Oscillator","shortName":"DerOsc"},{"id":"DOSCS","category":"Study","name":"Derivative Oscillator Signal","shortName":"DerOscSig"},{"id":"TTMSQZON","category":"Study","name":"TTM Squeeze On","shortName":"TtmSqzOn"},{"id":"TTMSQZOFF","category":"Study","name":"TTM Squeeze Off","shortName":"TtmSqzOff"},{"id":"TTMSQZOSC","category":"Study","name":"TTM Squeeze Osc","shortName":"TtmSqzOsc"},{"id":"CRS","category":"Study","name":"CompRelStrength","shortName":"CRS"},{"id":"CRSAVG","category":"Study","name":"CompRelStrengthAvg","shortName":"CRS-Avg"},{"id":"DRS","category":"Study","name":"DorseyRelStrength","shortName":"DRS"},{"id":"MRS","category":"Study","name":"MansfieldRelStrength","shortName":"MRS"},{"id":"PMO","category":"Study","name":"PriceMomOsc","shortName":"PMO"},{"id":"PMOS","category":"Study","name":"PriceMomOscSig","shortName":"PMOS"},{"id":"RVOL","category":"Study","name":"Relative Volume","shortName":"RVOL"},{"id":"AccountsPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Accounts Payable","shortName":"AcctsPay"},{"id":"AccruedExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Accrued Expenses","shortName":"AccrdExp"},{"id":"Cash","category":"BalanceSheet","format":"UseMetricUnit","name":"Cash & Cash Equivalents","shortName":"Cash&CashEqv"},{"id":"CommonShares","category":"BalanceSheet","format":"UseMetricUnit","name":"Common Shares","shortName":"CommonShares"},{"id":"SharesOutstanding","category":"BalanceSheet","format":"UseMetricUnit","name":"Shares Outstanding","shortName":"SharesOutstanding"},{"id":"DeferredIncomeTax","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Income Tax","shortName":"DefIncTax"},{"id":"DeferredLongRevenues","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Revenues","shortName":"DefRev"},{"id":"EquityOtherInvestments","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity Investments","shortName":"OthEquityInvest"},{"id":"IncomeTaxPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Income Tax Payable","shortName":"IncTaxPayble"},{"id":"Intangibles","category":"BalanceSheet","format":"UseMetricUnit","name":"Intangibles","shortName":"Intangibles"},{"id":"Inventories","category":"BalanceSheet","format":"UseMetricUnit","name":"Inventories","shortName":"Inventory"},{"id":"LongTermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Long Term Debt","shortName":"LTDebt"},{"id":"MarketableSec","category":"BalanceSheet","format":"UseMetricUnit","name":"Liquid Securities","shortName":"LiqSecurities"},{"id":"OtherCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Miscellaneous Current Assets","shortName":"MiscCurrAssets"},{"id":"OtherCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Current Liabilities","shortName":"OthCurrLiab"},{"id":"OtherEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity","shortName":"OthEquity"},{"id":"OtherNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Assets","shortName":"OthNonCurrAssets"},{"id":"OtherNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Liabilities","shortName":"OthNonCurrLiab"},{"id":"PpeNet","category":"BalanceSheet","format":"UseMetricUnit","name":"PPE Net","shortName":"PPENet"},{"id":"PrepaidExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Prepaid Expenses","shortName":"PpdExp"},{"id":"Receivables","category":"BalanceSheet","format":"UseMetricUnit","name":"Receivables","shortName":"Receivables"},{"id":"RetainedEarnings","category":"BalanceSheet","format":"UseMetricUnit","name":"Retained Earnings","shortName":"RetEarnings"},{"id":"ShorttermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Short-Term Debt","shortName":"ShortTermDebt"},{"id":"TotalAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Assets","shortName":"TotAssets"},{"id":"TotalCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Assets","shortName":"TotCurrAssets"},{"id":"TotalCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Liabilities","shortName":"TotCurrLiab"},{"id":"TotalLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities","shortName":"TotalLiab"},{"id":"TotalLiabilitiesAndEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities & Equity","shortName":"TotLiab&Equity"},{"id":"TotalNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Assets","shortName":"TotNonCurrAssets"},{"id":"TotalNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Liabilities","shortName":"TotNonCurrLiabs"},{"id":"TotalShareholdersEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Shareholders Equity","shortName":"TotShareEquity"},{"id":"BasicEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Continued Operations","shortName":"EPSContOps"},{"id":"BasicEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Total Operations","shortName":"EPSTotOps"},{"id":"CostGoods","category":"IncomeStatement","format":"UseMetricUnit","name":"Cost of Goods","shortName":"COGS"},{"id":"DilutedEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Continued Operations","shortName":"DilutedEPSContOps"},{"id":"DilutedEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Total Operations","shortName":"DilutedEPSTotOps"},{"id":"Ebitda","category":"IncomeStatement","format":"UseMetricUnit","name":"EBITDA","shortName":"EBITDA"},{"id":"GrossProfit","category":"IncomeStatement","format":"UseMetricUnit","name":"Gross Profit","shortName":"GrProfit"},{"id":"IncomeTax","category":"IncomeStatement","format":"UseMetricUnit","name":"Income Tax","shortName":"IncomeTax"},{"id":"InterestExpense","category":"IncomeStatement","format":"UseMetricUnit","name":"Interest Expense","shortName":"IntExp"},{"id":"NetIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Net Income Less Expenses & Tax","shortName":"NetIncome"},{"id":"OperatingExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Expenses","shortName":"OpExpense"},{"id":"OperatingIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Income","shortName":"OpIncome"},{"id":"OtherIncomeExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Other Income","shortName":"OthInc"},{"id":"PreTaxIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Pretax Income","shortName":"PretaxInc"},{"id":"Sales","category":"IncomeStatement","format":"UseMetricUnit","name":"Sales","shortName":"Sales"},{"id":"JPIB","category":"Study","name":"JPI-Buy","shortName":"Buy"},{"id":"JPIS","category":"Study","name":"JPI-Sell","shortName":"Sell"},{"id":"TDIPRC","category":"Study","name":"TDI Price Line","shortName":"PriceLn"},{"id":"TDITSL","category":"Study","name":"TDI Trade Signal","shortName":"TradeSig"},{"id":"TDIMBL","category":"Study","name":"TDI Market Base","shortName":"MktBase"},{"id":"TDIUPR","category":"Study","name":"TDI Upper Band","shortName":"UpperBnd"},{"id":"TDILWR","category":"Study","name":"TDI Lower Band","shortName":"LowerBnd"},{"id":"PPS","category":"Study","name":"PricePercentStop","shortName":"PPS"},{"id":"RCI","category":"Study","name":"RankCorrelationIndex","shortName":"RCI"},{"id":"RCISIG","category":"Study","name":"RCI Signal","shortName":"RCISig"},{"id":"ZZPIVOT","category":"Study","name":"ZigZag Pivot","shortName":"ZZPivot"},{"id":"ADR","category":"Study","name":"AvgDailyRange","shortName":"ADR"},{"id":"ADRP","category":"Study","name":"AvgDailyRangePerc","shortName":"ADRP"},{"id":"BOP","category":"Study","name":"BalanceOfPower","shortName":"BOP"},{"id":"BOPAVG","category":"Study","name":"BalanceOfPowerAvg","shortName":"BOPAVG"},{"id":"CORR","category":"Study","name":"CorrelationCoefficient","shortName":"Corr"},{"id":"RVI","category":"Study","name":"RelativeVigorIndex","shortName":"RVI"},{"id":"RVISIG","category":"Study","name":"RVI Signal","shortName":"RVISig"},{"id":"ATREXTAVG","category":"Study","name":"ATR Extension Average","shortName":"ATREXTAVG"},{"id":"ATREXTUP","category":"Study","name":"ATR Extension Upper","shortName":"ATREXTUP"},{"id":"ATREXTLOW","category":"Study","name":"ATR Extension Lower","shortName":"ATREXTLOW"}]`),Ff=class{id;type;category;name;format;shortName;constructor(e,t=v.Number,n=b.Common,r,i=y.FromMetaData,a){this.id=e,this.type=t,this.category=n,this.name=r,this.format=i,this.shortName=a;let o=e.charAt(0)===`_`;r??(this.name=o?e:this.id.replace(/([A-Z])/g,` $1`).trim()),this.shortName=a??this.name}},If={},Lf=!1;function Rf(e){Mf(e,B.FIELDS_SCHEMA).map(e=>{If[e.id]=new Ff(e.id,v[e.type],b[e.category],e.name,y[e.format],e.shortName)})}function zf(){return Lf||=(Rf(Pf),!0),If}var G=zf(),K={CH_ALL:`ch`,CH_DIDBECOMEACTIVE:`ch.didbecomeactive`,CH_RECREATED:`ch.recreated`,CH_RESET:`ch.reset`,CH_ANNOTATIONCHANGED:`ch.annotationchanged`,CH_ANNNEEDSCONTEXTMENU:`ch.annneedscontextmenu`,CH_CHTNEEDSCONTEXTMENU:`ch.chtneedscontextmenu`,CH_ANNSELECTIONCHANGED:`ch.annselectionchanged`,CH_ANNPOINTPICKED:`ch.annpointpicked`,CH_ANNMODIFIEDBYTOOL:`ch.annmodifiedbytool`,CH_PANEHEIGHTSCHANGED:`ch.paneheightschanged`,CH_PANESREORDERED:`ch.panesreordered`,CH_AXISSCALECHANGED:`ch.axisscalechanged`,CH_CHTLAYOUTCHANGED:`ch.chtlayoutchanged`,CH_NODATAFORMAINSYMBOL:`ch.nodataformainsymbol`,CH_CARDPLOTCLICKED:`ch.cardplotclicked`,CH_CARDPLOTREMOVED:`ch.cardplotremoved`,CH_CARDPLOTVISIBILITYCHANGED:`ch.cardplotvisibilitychanged`,CH_TOOLTIPCHANGED:`ch.tooltipchanged`,CH_LOGOCLICKED:`ch.logoclicked`,CH_SHUTDOWN:`ch.shutdown`,CH_ZOOMCHANGED:`ch.zoomchanged`,CH_ALL_DATA_PROJECTED:`ch.all.data.projected`,CH_API_ACTIONS_RECEIVED:`ch.api.actions.received`,CH_HOST_PROPS_CHANGED:`ch.host.props.changed`,CH_DEFINITION_CHANGED:`ch.definition.changed`,CH_PLOTNEEDSCONTEXTMENU:`ch.plotneedscontextmenu`,DF_ALL:`df`,DF_STREAMRECONNECTED:`df.streamreconnected`,TS_ALL:`ts`,TS_LOADING:`ts.loading`,TS_MANYCHANGED:`ts.manychaged`,TS_DATAPOINTADDED:`ts.datapointadded`,TS_DATAPOINTCHANGED:`ts.datapointchanged`,TS_TIMELINECORRECTION:`ts.timelinecorrection`,TS_EVENTSCHANGED:`ts.eventschanged`,TS_QUOTEMARKER:`ts.quotemarker`,MD_ALL:`md`,MD_CHANGED:`md.changed`,RT_ALL:`rt`,RT_QUOTE:`rt.quote`,RT_QUOTEGROUP:`rt.quotegroup`,RT_TRADE:`rt.trade`,RT_VOLUME:`rt.volume`,TL_CHANGED:`tl.changed`,ME_ALL:`me`,ME_MOUSE_OUT_SERIES:`me.mouse.out.series`,ME_MOUSE_OVER_SERIES:`me.mouse.over.series`},Bf=[G.Open,G.High,G.Low,G.Close,G.Volume,G.Change,G.PercentChange,G.PreviousClose].reduce((e,t,n)=>(e.set(t.id,1<<n),e),new Map);function Vf(...e){return e.reduce((e,t)=>Bf.has(t.id)?e|Bf.get(t.id):e,0)}var Hf=class{symbol;storage;fields=[];_updated=0;isValid=!1;constructor(e=``){this.symbol=e,this.storage=new Map,this.isValid=!1,this.resetUpdated()}get updated(){return this._updated}resetUpdated(){this._updated=0}addFields(...e){this.fields=ye(this.fields,e),this.fields.forEach(e=>{this.storage.has(e.id)||this.storage.set(e.id,null)})}update(e,t){if(this.hasField(e)){let n=e.id,r=this.storage.get(n);this.storage.set(n,t);let i=r!==t;return i&&Bf.has(n)&&(this._updated|=Bf.get(n)),i}}computeWellKnown(){let e=this.getValue(G.Close),t=this.getValue(G.PreviousClose);P(e,t)&&(this.hasField(G.Change)&&this.update(G.Change,e-t),this.hasField(G.PercentChange)&&this.update(G.PercentChange,(e-t)/t))}hasField(e){return P(this.fields)&&this.fields.some(t=>t.id===e.id)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}},Uf=class extends Hf{translated;constructor(e){super(),this.symbol=e,this.translated=Ma(this.symbol)}hasSymbol(e){return this.symbol===e}},Wf=class extends Hf{actual;constructor(e){super(B.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}},Gf=class extends Hf{constructor(e){super(),this.symbol=e}hasSymbol(e){return this.symbol===e}async ready(){return!0}hasField(e){return!1}getValue(e){return null}},Kf={previousOpen:G.PreviousOpen,previousClose:G.PreviousClose,previousHigh:G.PreviousHigh,previousLow:G.PreviousLow,weeklyPreviousClose:G.WeekPreviousClose,weeklyPreviousHigh:G.WeekPreviousHigh,weeklyPreviousLow:G.WeekPreviousLow,monthlyPreviousClose:G.MonthPreviousClose,monthlyPreviousHigh:G.MonthPreviousHigh,monthlyPreviousLow:G.MonthPreviousLow,fiftyTwoWkHigh:G.YearHigh,fiftyTwoWkLow:G.YearLow},qf={open:G.Open,high:G.High,low:G.Low,close:G.Close,lastPrice:G.Last,volume:G.Volume,netChange:G.Change,percentChange:G.PercentChange},Jf=Object.values(Kf),Yf=Object.keys(Kf),Xf=Object.keys(qf),Zf=class extends Uf{triedFetchingExtraValues=!1;includeBaseFields=!1;async ready(){return da.call(this,async()=>{let e=$().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid})}shutdown(){}getValue(e){return this.hasField(e)&&Jf.some(t=>t.id===e.id)&&super.getValue(e)===null&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,sF(`ondemand`,`/getQuote.json?symbols=${this.translated}&fields=${Yf.join(`,`)}`).then(e=>{try{let t=JSON.parse(e);if(t.status.code===200&&t.results.length===1){let e=t.results[0];Yf.forEach(t=>this.update(Kf[t],e[t])),this.includeBaseFields&&Xf.forEach(t=>this.update(qf[t],e[t])),$().getRecordSource().subject.next({topic:K.RT_QUOTE,data:{symbol:this.symbol}})}}catch{I(`Failed to fetch extra values for ${this.translated}`,`error`)}})}},Qf=class extends Zf{constructor(e){super(e),this.includeBaseFields=!0,this.supplementPreviousValues()}async ready(){return Promise.resolve(!0)}},$f=class extends Uf{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){P(t)&&(this.addFields(e),this.update(e,t))}async ready(){return da.call(this,async()=>{let e=$().config.environment===l[l.NodeJs]?null:ea(`#${B.INLINE_DATA_ELEMENT_ID}`);if(!P(e))this.isValid=!1;else{let t=JSON.parse(e);if(!(this.translated in t))this.isValid=!1;else{let e=t[this.translated].quote;this.update(G.Open,e.open),this.update(G.High,e.high),this.update(G.Low,e.low),this.update(G.Close,e.close),this.update(G.PreviousClose,e.previousClose),this.update(G.Volume,e.volume),Yf.filter(e=>e!==`previousClose`).forEach(t=>{this.addOptionalField(Kf[t],e[t])}),this.isValid=!0}}return this.isValid})}},ep=[G.Open,G.High,G.Low,G.Close,G.PreviousClose],tp=class extends Hf{mapping;resolved;model;constructor(e,t){super();let n=e=>$().getRecordSource().getRecord(e);this.resolved=e.map(([e,t])=>t),this.mapping=new Map(e.map(([e,t])=>[e,n(t)])),this.model=t;let r=ep.concat(G.Change,G.PercentChange);this.addFields(...r.filter(e=>e!==G.Volume))}async ready(){return da.call(this,async()=>{let e=Array.from(this.mapping.values()).map(e=>e.ready());return this.isValid=(await Promise.all(e)).every(e=>e),this.isValid&&this.evaluate(),this.isValid})}hasSymbol(e){return this.resolved.includes(e)}getOneValue(e){return t=>this.mapping.get(t).getValue(e)}evaluate(){ep.forEach(e=>{let t=bd(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)}),this.computeWellKnown()}};function np(e,t){return n=>n.topic===e&&n.data.symbol===t}var rp=function(e,t){return rp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},rp(e,t)};function ip(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);rp(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function ap(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function op(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function sp(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function cp(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function lp(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function up(e){return this instanceof up?(this.v=e,this):new up(e)}function dp(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof up?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function fp(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof sp==`function`?sp(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function pp(e){return typeof e==`function`}function mp(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var hp=mp(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
16
|
+
`)?`${e}${i.op} ${r}`:`${e} ${i.op} ${r}`;break;case`sym`:o=`{${t}}.${n}`;break;default:throw Error(`Unrecognized binary operator ${i.op}`)}}return a&&i.trailingComment!==void 0?`${o} // ${i.trailingComment}\n`:o}function kd(e){let t=[];for(let n of e.panes)for(let e of n.axes)for(let n of e.plots)t.push(n);return t}function Ad(e,t,n){return!kd(e).some(e=>e.uid===t&&e.uid!==n)}function jd(e,t,n){if(!Ad(e,t,n))throw Error(`Plot uid '${t}' is already in use on this chart.`)}function Md(e){return kd(e).find(e=>e.main===!0)}function Nd(e,t){let n=0;for(let r=0;r<e.panes.length;r++){let i=e.panes[r].axes;for(let e=0;e<i.length;e++){let a=i[e].plots;for(let i=0;i<a.length;i++){if(n===t)return{pane:r,axis:e,plot:i};n++}}}return null}function Pd(){return{plots:[]}}function Fd(e,t){let n=e.panes[t],r=n.axes.map(e=>e.plots.reduce((e,t)=>e+ +!!t.detachedScale,0)),i=n.axes.length;return n.axes.forEach((e,t)=>{let a=r[t],o=e.plots.length;if(!(a===0||a<o)&&a===o)if(i>1&&a===1){let a=(t+1)%i;if(r[a]<n.axes[a].plots.length){let t=e.plots.find(e=>e.detachedScale);t&&(n.axes[a].plots.push(t),e.plots=e.plots.filter(e=>!e.detachedScale),r[a]++)}}else{let t=e.plots.find(e=>e.detachedScale);t&&(t.detachedScale=!1)}}),e}function Id(e,t,n){let r=Nd(e,t);if(r===null)return e;let i=e.panes[r.pane],a=i.axes[r.axis].plots[r.plot];return n===r.axis?delete a.detachedScale:(delete a.detachedScale,i.axes.length<2&&n>0&&i.axes.push(Pd()),i.axes[n].plots.push(a),i.axes[r.axis].plots.splice(r.plot,1)),Nf(Fd(e,r.pane))}function Ld(e,t){let n=Nd(e,t);if(n===null)return e;let r=e.panes[n.pane].axes[n.axis].plots[n.plot];return r.detachedScale=!0,Nf(Fd(e,n.pane))}function Rd(e,t){let n=kd(e).find(e=>e.uid===t.uid);if(!n||n.type!==`Seasonal`)return null;let r=n.offsets;return!Array.isArray(r)||!r.includes(t.offset)?null:n}function zd(e,t){let n=t??{kind:`main`};return n.kind===`main`?Md(e)??null:n.kind===`seasonal`?Rd(e,n):null}function Bd(e,t,n){let r=zd(e,n);return r?r.type===`Forward`?{eligible:!1,reason:`it cannot be based on a forward plot`}:r.type===`Expression`&&sc(t)?{eligible:!1,reason:`it cannot be based on an expression; the study needs more than "OHLCV" fields`}:r.type===`Seasonal`&&!cc(t)?{eligible:!1,reason:`it cannot be based on a seasonal plot`}:{eligible:!0}:{eligible:!1,reason:`its basis does not resolve to an existing target plot`}}var Vd=`..plots{.main === true}`;function Hd(e){return H(e,Vd)[0]}function Ud(e){let t=H(e,`..panes{${Vd}}`)[0];return{mainPane:t,mainAxis:H(t,`..axes{${Vd}}`)[0]}}function Wd(e,t,n){let r=Hd(t);if(r[r.type.toLowerCase()]===B.PLACEHOLDER_SYMBOL_NAME){let r=Hd(e),{mainAxis:i}=Ud(t),a=i.annotations,o=Zd(t,r);if(n){let{mainAxis:e}=Ud(o);e.annotations=a}return o}return t}var Gd=`Symbol`,Kd=`Expression`,qd=`Forward`,Jd=`Seasonal`,Yd=[Gd,Kd,qd,Jd];function Xd(e){let t=yd(e),n=vd(t),r=n?0:t.symbols.length,i=!n&&r>0?t.symbols[0]:null;return{clean:n?void 0:t.clean,hasErrors:n,symbolCount:r,firstSymbol:i,error:n?t.error:void 0}}function Zd(e,t){let n=Hd(e);P(t.uid)&&jd(e,t.uid,n.uid);let r=e=>n.type===e,i=e=>P(t[e.toLowerCase()]),a=Yd.find(e=>i(e)),o=a.toLowerCase(),s=t[o],c=s===B.PLACEHOLDER_SYMBOL_NAME,l=i(Kd)||i(qd)||i(Jd),u=Yd.some(e=>i(e)&&!r(e)),d=$().config.cachedAnnotationsCount||0,f=d>0,{mainAxis:p}=Ud(e);u&&(p.comparison=`None`);let m=Xd(s),h=e=>{throw Error(e)};c||(l?(m.hasErrors&&h(`[Main Plot] "${s}" is an invalid expression.\n${m.error}`),s=m.clean):m.hasErrors||h(`[Main Plot] "${s}" is an expression, unsupported for ${o}.`));let g=(e,t)=>e.findIndex(e=>e.symbol===t),_=(e,t)=>{if(e===B.PLACEHOLDER_SYMBOL_NAME)return;let n=t.annotations||[],r=t.annCache||[],i=g(r,e);if(i!==-1&&r.splice(i,1),n.length>0){let t={symbol:e,annotations:n};r.length+1>d&&r.splice(0,r.length+1-d),r.push(t)}t.annCache=r},v=(e,t)=>{let n=t.annCache||[],r=g(n,e);r!==-1&&(t.annotations=n[r].annotations)},y=e=>{let a=n;if(r(Gd))_(a.symbol,e);else if(r(Kd))_(a.expression,e);else if(r(Jd)){let t=Xd(a.seasonal);t.symbolCount===1&&_(t.firstSymbol,e)}delete e.annotations,i(Gd)?v(t.symbol,e):i(Kd)?v(t.expression,e):i(Jd)&&m.symbolCount===1&&v(t.seasonal,e)};if(f){let t=H(e,`..axes`);for(let e of t)y(e)}let b=i(Kd)&&r(Gd)||i(Gd)&&r(Kd),x=U(e,Vd,e=>(P(t.uid)&&(e.uid=t.uid),u&&(delete e.expression,delete e.symbol,delete e.showPrevious,delete e.forward,delete e.offsets,delete e.seasonal,e.type=a,b||(e.curves=[{}]),(i(qd)||i(Jd))&&(e.offsets=[0])),e[o]=s,e));if(i(Gd)&&Ei(s)&&(x.data.aggregation.contractRoll=Vi(s)?`expiration`:`combined`),u)if(i(qd))x.data.aggregation={unit:`Month`},x.display.period=`P10Y`;else if(i(Jd)&&!ju(x.data.aggregation).isEndOfDay)x.data.aggregation={unit:`Day`},x.display.period=i(Jd)?`P9M`:`P1Y10D`;else if(r(qd)||r(Jd)){x.data.aggregation=$().getDefaultAggregation(),x.data.maxDataPoints=B.DEFAULT_MAX_RECORDS;let e=$().getDefaultPeriod();P(e)&&(x.display.period=e)}else i(Kd)&&r(Gd)&&($u.includes(n.curves[0].style)&&(x=U(x,Vd,e=>(delete e.inputs,e))),x.data.aggregation.spec===`PerRange`&&(x.data.aggregation={unit:`Day`}));let S=new Map([[`..plots{.type === "Study"}`,e=>{let t=V(e.study);return N(t)&&Bd(x,t,e.basis).eligible?e:B.NULL_OBJECT}],[`..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}`,e=>i(Gd)?(e.symbol=s,e):B.NULL_OBJECT],[`..plots{..events}`,e=>(i(Gd)||delete e.events,e)]]);for(let[e,t]of S)x=U(x,e,t);return u&&!b&&(x=ed(x,{type:a,curves:[{}]})),x=Nf(x),x}function Qd(e){let t=$().getDefaultDensity();P(t)&&(e.display.density=t)}function $d(e,t){return U(e,`..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}`,e=>(e.fields=t?[G.TradeSize.id]:[G.Volume.id],e))}function ef(e,t){let n=ju(e.data.aggregation),r=n.isTick&&!n.hasSpec,i=ju(t),a=i.isTick&&!i.hasSpec,o=e=>e.isIntraday&&e.hasSpec&&e.spec===_.PerRange,s=o(n),c=o(i),l=U(e,`${Vd}.curves[0]`,e=>{let t=[G.Open.id,G.High.id,G.Low.id,G.Close.id,G.Change.id].slice();if(!s&&c)return Xu(`Range`,!0);if(s&&!c&&(e.style=`OHLC`),!a&&r){let n=$().getDefaultMultiFieldCurve();if(n!==null)return n;e.fields=t,e.style!==`Candlestick`&&e.style!==`OHLC`&&e.style!==`HLC`&&(e.style=`Candlestick`,e.colors=[`#ff6961`,`#77dd77`],e.varyColorPerBar=!0),e.style===`HLC`&&e.fields.splice(0,1)}else a&&!r&&(e.fields=[G.Last.id,G.Change.id],e.style=`Line`,e.colors=[`#0055cc`],e.varyColorPerBar=!1);return e});return l=$d(l,a),ht(l.data.aggregation,t),(n.unit!==i.unit||n.size!==i.size)&&(Vu(l),Bu(l),Qd(l),zu(l)),l}function tf(e){return P(e)&&e!==B.AUTOFIT_PERIOD}function nf(e){e.display?.density?(Vu(e),Bu(e)):tf(e.display?.period)&&Bu(e)}var rf=new Set([`OHLC`,`HLC`,`HL`,`Candlestick`,`HollowCandles`,`HeikinAshi`,`ElderImpulseSystem`,`Range`,`Renko`,`LineBreak`,`PointAndFigure`,`Kagi`,`Column`,`MultiColumn`,`StackedColumn`]);function af(e){let t=rt(e.display,null,`chart`,`bar`);if(P(t)){let[n]=H(e,Vd),r=n?.curves?.some(e=>N(e.style)&&rf.has(e.style))?B.MINIMUM_WIDE_BAR_WIDTH:B.MINIMUM_BAR_WIDTH,[i,a]=yt(t.width||0,t.spacing||0,r,B.MAXIMUM_BAR_WIDTH);t.width=i,t.spacing=a}}function of(e){let t=H(e,`..annotations{.id === 'RewardRisk' || .id === 'ProfitLoss' }`);t.length>0&&t.forEach(e=>{e.traits.prices=e.traits.prices.map(e=>typeof e==`string`?Number.parseFloat(e):e),e.id===`RewardRisk`&&(e.traits.ratio=Math.abs(e.traits.ratio),e.traits.textLines=e.traits.textLines.map(e=>e.match(/Ratio/)?e.replace(`-`,``):e))})}function sf(e){let t=H(e,`..annotations{.traits.fill.color === null}`);t.length>0&&t.forEach(e=>{e.traits.fill.color=`rgba(0, 0, 0, 0)`})}function cf(e){let{from:t,to:n}=e.display?.xAxis?.visibleRange||{},r=t===null,i=n===null;r&&delete e.display.xAxis.visibleRange.from,i&&delete e.display.xAxis.visibleRange.to,r&&i&&delete e.display.xAxis.visibleRange}function lf(e){let t=H(e,`..panes[0].axes[0].scale`);if(t.length===1){let n=t[0],r=H(e,`..panes[0]..axes`);r.length>0&&r.forEach(e=>e.scale=n)}}function uf(e){let[t]=H(e,Vd);P(t)&&t.type===C[C.Symbol]&&!$u.includes(t.curves[0].style)&&P(t.inputs)&&delete t.inputs}function df(e){let[t]=H(e,Vd);P(t)&&t.type===C[C.Symbol]&&t.curves[0].style===h[h.Renko]&&P(t.inputs)&&t.inputs.map(e=>e.value).some(e=>e===void 0)&&(t.inputs=F(B.DEFAULT_RENKO_INPUTS))}function ff(e){let[t]=H(e,Vd);if(P(t)&&t.type===C[C.Expression]){let n=t.curves[0].style,r=n===h[h.Range],i=n===h[h.Baseline],a=$u.includes(n);r&&e.data?.aggregation.spec===_[_.PerRange]&&(e.data.aggregation={unit:`Day`}),!i&&(a||r)&&(delete t.inputs,t.curves[0]=Xu(`Candlestick`,!0))}}function pf(e){let t=U(e,`..annCache{!.annotations}`,e=>B.NULL_OBJECT);t=U(t,`..annCache`,e=>{let t=Ki(e.symbol);return t===null?e:ai(t,hi(new Date,3))?B.NULL_OBJECT:e}),t=U(t,`..annotations{.id === 'ComputedText' && !.traits.textLines}`,e=>B.NULL_OBJECT);let n=t.data.aggregation,r=n.unit===`Tick`&&n.spec===`None`;return $d(t,r)}function mf(e){H(e,`..annotations`).forEach(e=>{let{id:t,traits:n}=e;Dl(t,n),El(t,n)})}function hf(e){try{ec(!1),H(e,`..plots{.type === "Study" && .curves.zones}`).forEach(e=>{let t=V(e.study).defaults;for(let n=0;n<(e.curves?.length??0);n++){let r=e.curves[n];if(r.zones&&(r.colors?.length??0)<(t.curves[n].colors?.length??0)){let e=t.curves[n].colors.slice(r.colors?.length??0);r.colors?.length?r.colors.push(...e):r.colors=e}}})}finally{ec(!0)}}function gf(e){let[t]=H(e,Vd);if(t.type===`Symbol`&&t.curves?.length===1){let e=t.curves[0];if(e.style===`HLC`){let t=e.colors?.length;if(t===1){let t=e.colors[0];e.colors=[t,t],e.varyColorPerBar=!0,e.attributes=[`OpenVsClose`]}else t===2&&!e.attributes&&(e.attributes=[`OpenVsClose`])}}}function _f(e){$()?.config?.mode===`cmdtyView`&&(delete e.data?.extendedHours,delete e.data?.buildContinuation)}function vf(e){let t=e.data?.aggregation,n=e.data?.extendedHours,r=N(n);t&&t.spec===`FormT`&&(t.spec=`None`,r||(e.data.extendedHours=!0))}function yf(e){let t=e.data?.buildContinuation,n=N(t),r=e.data?.aggregation;n&&r&&(r.spec===`Continue`&&!t&&(r.spec=`None`),t&&(r.spec=`Continue`))}function bf(e){try{ec(!1),H(e,`..plots{.type === "Study" && .curves.varyColorPerBar}`).forEach(e=>{let t=V(e.study).defaults;if(e?.curves?.length===t?.curves.length&&t?.curves.length>0)for(let n=0;n<e.curves.length;n++)e.curves[n].varyColorPerBar=t.curves[n].varyColorPerBar})}finally{ec(!0)}}function xf(e){try{ec(!1),H(e,`..plots{.type === "Study"}`).forEach(e=>{let t=V(e.study).defaults;N(e.inputs)&&e.inputs.forEach((e,n)=>{let r=t.inputs?.[n]?.value;!N(e.value)&&N(r)&&(e.value=r)}),N(e.levels)&&e.levels.forEach((e,n)=>{let r=t.levels?.[n]?.value;!N(e.value)&&N(r)&&(e.value=r)}),N(e.bands)&&e.bands.forEach((e,n)=>{let r=t.bands?.[n]?.range;!N(e.range.from)&&N(r?.from)&&(e.range.from=r.from),!N(e.range.to)&&N(r?.to)&&(e.range.to=r.to)})})}finally{ec(!0)}}function Sf(e){let t=H(e,`..axes{.annotations{.points{!.price || !.time}}}`);t.length>0&&t.forEach(e=>{let t=e.annotations.map(e=>{let t=e.points.find(e=>P(e.price)),n=e.points.find(e=>P(e.time));return!P(t)||!P(n)?null:(e.points.forEach(e=>{P(e.price)||(e.price=t.price),P(e.time)||(e.time=n.time)}),e)}).filter(e=>P(e));t.length>0?e.annotations=t:delete e.annotations});let n=H(e,`..panes`),r=e=>P(e.height)?e.height:1,i=n.map(e=>r(e)),a=Math.min(...i),o=a<.01?5/a:1;n.forEach(e=>e.height=Xe(o*r(e),4));let s=$().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=s;let c=`wheel+shift`,l=$().config.scrollBehavior||c;Object.values(ie).filter(e=>typeof e==`string`).includes(l)||(l=c),e.display.scrollBehavior=l;let u=H(e,`..plots{.type === "Study" && .study === "RSI"}`);return u.length>0&&u.forEach(e=>{if(P(e.bands)&&e.bands.length>0){let t=e.inputs&&e.inputs.length===1&&e.inputs[0].name===B.INPUT_PERIOD?e.inputs[0].value:null,n=V(`RSI`).defaults;e.curves=n.curves,e.inputs=n.inputs,P(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=n.levels}}),nf(e),af(e),sf(e),cf(e),lf(e),uf(e),df(e),ff(e),mf(e),hf(e),gf(e),of(e),_f(e),vf(e),yf(e),bf(e),xf(e),Ys(e),pf(e)}var Cf=o(((e,t)=>{(function(){var e=function(t){if(typeof t!=`object`||!t)return t;var n;if(t instanceof Date)return n=new Date,n.setTime(t.getTime()),n;if(t instanceof RegExp)return n=new RegExp(t),n;if(t instanceof Array){n=[];for(var r=0,i=t.length;r<i;r++)n[r]=e(t[r]);return n}if(t instanceof Object){for(var a in n={},t)t.hasOwnProperty(a)&&(n[a]=e(t[a]));return n}throw Error(`Unable to clone object!`)},n=function(t){for(var n=[e(t[0])],r=n[0].key,i=n[0].object,a=1,o=t.length;a<o;a++)i=i[r],r=t[a].key,n.push({object:i,key:r});return n},r=function(e,t){var n=e.length-1,r=e[n].key;t[n].object[r]=e[n].object[r]},i={type:!0,not:!0,anyOf:!0,allOf:!0,oneOf:!0,$ref:!0,$schema:!0,id:!0,exclusiveMaximum:!0,exclusiveMininum:!0,properties:!0,patternProperties:!0,additionalProperties:!0,items:!0,additionalItems:!0,required:!0,default:!0,title:!0,description:!0,definitions:!0,dependencies:!0},a={null:function(e){return e===null},string:function(e){return typeof e==`string`},boolean:function(e){return typeof e==`boolean`},number:function(e){return typeof e==`number`&&e===e},integer:function(e){return typeof e==`number`&&e%1==0},object:function(e){return e&&typeof e==`object`&&!Array.isArray(e)},array:function(e){return Array.isArray(e)},date:function(e){return e instanceof Date}},o={alpha:function(e){return/^[a-zA-Z]+$/.test(e)},alphanumeric:function(e){return/^[a-zA-Z0-9]+$/.test(e)},identifier:function(e){return/^[-_a-zA-Z0-9]+$/.test(e)},hexadecimal:function(e){return/^[a-fA-F0-9]+$/.test(e)},numeric:function(e){return/^[0-9]+$/.test(e)},"date-time":function(e){return!isNaN(Date.parse(e))&&e.indexOf(`/`)===-1},uppercase:function(e){return e===e.toUpperCase()},lowercase:function(e){return e===e.toLowerCase()},hostname:function(e){return e.length<256&&/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/.test(e)},uri:function(e){return/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/.test(e)},email:function(e){return/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/.test(e)},ipv4:function(e){return!!(/^(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)$/.test(e)&&e.split(`.`).sort()[3]<=255)},ipv6:function(e){return/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/.test(e)}},s={readOnly:function(e,t){return!1},minimum:function(e,t,n){return!(e<t||n.exclusiveMinimum&&e<=t)},maximum:function(e,t,n){return!(e>t||n.exclusiveMaximum&&e>=t)},multipleOf:function(e,t){return e/t%1==0||typeof e!=`number`},pattern:function(e,t){if(typeof e!=`string`)return!0;var n,r;return typeof t==`string`?n=t:(n=t[0],r=t[1]),new RegExp(n,r).test(e)},minLength:function(e,t){return e.length>=t||typeof e!=`string`},maxLength:function(e,t){return e.length<=t||typeof e!=`string`},minItems:function(e,t){return e.length>=t||!Array.isArray(e)},maxItems:function(e,t){return e.length<=t||!Array.isArray(e)},uniqueItems:function(e,t){for(var n={},r,i=0,a=e.length;i<a;i++){if(r=JSON.stringify(e[i]),n.hasOwnProperty(r))return!1;n[r]=!0}return!0},minProperties:function(e,t){if(typeof e!=`object`)return!0;var n=0;for(var r in e)e.hasOwnProperty(r)&&(n+=1);return n>=t},maxProperties:function(e,t){if(typeof e!=`object`)return!0;var n=0;for(var r in e)e.hasOwnProperty(r)&&(n+=1);return n<=t},constant:function(e,t){return JSON.stringify(e)==JSON.stringify(t)},enum:function(e,t){var n,r,i;if(typeof e==`object`){for(i=JSON.stringify(e),n=0,r=t.length;n<r;n++)if(i===JSON.stringify(t[n]))return!0}else for(n=0,r=t.length;n<r;n++)if(e===t[n])return!0;return!1}},c=function(e){return e.indexOf(`://`)===-1?e:e.split(`#`)[0]},l=function(e,t,n){var r,i,a=n.indexOf(`#`),o;if(a===-1)return e.schema.hasOwnProperty(n)?[e.schema[n]]:null;if(a>0)if(o=n.substr(0,a),n=n.substr(a+1),e.schema.hasOwnProperty(o))t=[e.schema[o]];else if(t&&t[0].id===o)t=[t[0]];else return null;else{if(!t)return null;n=n.substr(1)}if(n===``)return[t[0]];if(n.charAt(0)===`/`){for(n=n.substr(1),r=t[0],i=n.split(`/`);i.length>0;){if(!r.hasOwnProperty(i[0]))return null;r=r[i[0]],t.push(r),i.shift()}return t}else return null},u=function(e,t){var n,r,i=e.length-1,a,o,s=/^(\d+)/.exec(t);if(s){if(t=t.substr(s[0].length),a=parseInt(s[1],10),a<0||a>i)return;if(o=e[i-a],t===`#`)return o.key}else o=e[0];if(r=o.object[o.key],t===``)return r;if(t.charAt(0)===`/`){for(t=t.substr(1),n=t.split(`/`);n.length>0;){if(n[0]=n[0].replace(/~1/g,`/`).replace(/~0/g,`~`),!r.hasOwnProperty(n[0]))return;r=r[n[0]],n.shift()}return r}else return},d=function(e,t,a,o){var s,c,f,p,m,h,g,_=!1,v={},y,b,x,S=t.length-1,C=t[S],w,T=a.length-1,ee=a[T].object,E=a[T].key,D=ee[E],te,ne;if(C.hasOwnProperty(`$ref`))return t=l(e,t,C.$ref),t?d(e,t,a,o):{$ref:C.$ref};if(C.hasOwnProperty(`type`))if(typeof C.type==`string`){if(o.useCoerce&&e.coerceType.hasOwnProperty(C.type)&&(D=ee[E]=e.coerceType[C.type](D)),!e.fieldType[C.type](D))return{type:C.type}}else{for(_=!0,s=0,c=C.type.length;s<c&&_;s++)e.fieldType[C.type[s]](D)&&(_=!1);if(_)return{type:C.type}}if(C.hasOwnProperty(`allOf`)){for(s=0,c=C.allOf.length;s<c;s++)if(y=d(e,t.concat(C.allOf[s]),a,o),y)return y}if(!o.useCoerce&&!o.useDefault&&!o.removeAdditional){if(C.hasOwnProperty(`oneOf`)){for(ne=1/0,s=0,c=C.oneOf.length,f=0;s<c;s++)if(y=d(e,t.concat(C.oneOf[s]),a,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else if(f+=1,f>1)break;if(f>1)return{oneOf:!0};if(f<1)return v;v={}}if(C.hasOwnProperty(`anyOf`)){for(v=null,ne=1/0,s=0,c=C.anyOf.length;s<c;s++)if(y=d(e,t.concat(C.anyOf[s]),a,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else{v=null;break}if(v)return v}if(C.hasOwnProperty(`not`)&&(y=d(e,t.concat(C.not),a,o),!y))return{not:!0}}else{if(C.hasOwnProperty(`oneOf`)){for(ne=1/0,s=0,c=C.oneOf.length,f=0;s<c;s++)if(w=n(a),y=d(e,t.concat(C.oneOf[s]),w,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else{if(f+=1,f>1)break;r(w,a)}if(f>1)return{oneOf:!0};if(f<1)return v;v={}}if(C.hasOwnProperty(`anyOf`)){for(v=null,ne=1/0,s=0,c=C.anyOf.length;s<c;s++)if(w=n(a),y=d(e,t.concat(C.anyOf[s]),w,o),y)te=y.schema?Object.keys(y.schema).length:1,te<ne&&(ne=te,v=y);else{r(w,a),v=null;break}if(v)return v}if(C.hasOwnProperty(`not`)&&(w=n(a),y=d(e,t.concat(C.not),w,o),!y))return{not:!0}}if(C.hasOwnProperty(`dependencies`)){for(h in C.dependencies)if(C.dependencies.hasOwnProperty(h)&&D.hasOwnProperty(h)){if(Array.isArray(C.dependencies[h])){for(s=0,c=C.dependencies[h].length;s<c;s++)if(!D.hasOwnProperty(C.dependencies[h][s]))return{dependencies:!0}}else if(y=d(e,t.concat(C.dependencies[h]),a,o),y)return y}}if(Array.isArray(D)){if(C.hasOwnProperty(`items`))if(Array.isArray(C.items)){for(s=0,c=C.items.length;s<c;s++)y=d(e,t.concat(C.items[s]),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0);if(D.length>c&&C.hasOwnProperty(`additionalItems`))if(typeof C.additionalItems==`boolean`){if(!C.additionalItems)return{additionalItems:!0}}else for(s=c,c=D.length;s<c;s++)y=d(e,t.concat(C.additionalItems),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0)}else for(s=0,c=D.length;s<c;s++)y=d(e,t.concat(C.items),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0);else if(C.hasOwnProperty(`additionalItems`)&&typeof C.additionalItems!=`boolean`)for(s=0,c=D.length;s<c;s++)y=d(e,t.concat(C.additionalItems),a.concat({object:D,key:s}),o),y!==null&&(v[s]=y,_=!0);if(_)return{schema:v}}else{for(h in b=[],v={},D)D.hasOwnProperty(h)&&b.push(h);if(o.checkRequired&&C.required)for(s=0,c=C.required.length;s<c;s++)D.hasOwnProperty(C.required[s])||(v[C.required[s]]={required:!0},_=!0);if(p=C.hasOwnProperty(`properties`),m=C.hasOwnProperty(`patternProperties`),p||m)for(s=b.length;s--;){if(x=!1,p&&C.properties.hasOwnProperty(b[s])&&(x=!0,y=d(e,t.concat(C.properties[b[s]]),a.concat({object:D,key:b[s]}),o),y!==null&&(v[b[s]]=y,_=!0)),m)for(h in C.patternProperties)C.patternProperties.hasOwnProperty(h)&&b[s].match(h)&&(x=!0,y=d(e,t.concat(C.patternProperties[h]),a.concat({object:D,key:b[s]}),o),y!==null&&(v[b[s]]=y,_=!0));x&&b.splice(s,1)}if(o.useDefault&&p&&!_)for(h in C.properties)C.properties.hasOwnProperty(h)&&!D.hasOwnProperty(h)&&C.properties[h].hasOwnProperty(`default`)&&(D[h]=C.properties[h].default);if(o.removeAdditional&&p&&C.additionalProperties!==!0&&typeof C.additionalProperties!=`object`)for(s=0,c=b.length;s<c;s++)delete D[b[s]];else if(C.hasOwnProperty(`additionalProperties`))if(typeof C.additionalProperties==`boolean`){if(!C.additionalProperties)for(s=0,c=b.length;s<c;s++)v[b[s]]={additional:!0},_=!0}else for(s=0,c=b.length;s<c;s++)y=d(e,t.concat(C.additionalProperties),a.concat({object:D,key:b[s]}),o),y!==null&&(v[b[s]]=y,_=!0);if(_)return{schema:v}}for(g in C)C.hasOwnProperty(g)&&!i.hasOwnProperty(g)&&(g===`format`?e.fieldFormat.hasOwnProperty(C[g])&&!e.fieldFormat[C[g]](D,C,a,o)&&(v[g]=!0,_=!0):e.fieldValidate.hasOwnProperty(g)&&!e.fieldValidate[g](D,C[g].hasOwnProperty(`$data`)?u(a,C[g].$data):C[g],C,a,o)&&(v[g]=!0,_=!0));return _?v:null},f={useDefault:!1,useCoerce:!1,checkRequired:!0,removeAdditional:!1};function p(){if(!(this instanceof p))return new p;this.coerceType={},this.fieldType=e(a),this.fieldValidate=e(s),this.fieldFormat=e(o),this.defaultOptions=e(f),this.schema={}}p.prototype={validate:function(e,t,n){var r=[e],i=null,a=[{object:{__root__:t},key:`__root__`}];if(typeof e==`string`&&(r=l(this,null,e),!r))throw Error(`jjv: could not find schema '`+e+`'.`);if(!n)n=this.defaultOptions;else for(var o in this.defaultOptions)this.defaultOptions.hasOwnProperty(o)&&!n.hasOwnProperty(o)&&(n[o]=this.defaultOptions[o]);return i=d(this,r,a,n),i?{validation:i.hasOwnProperty(`schema`)?i.schema:i}:null},resolveRef:function(e,t){return l(this,e,t)},addType:function(e,t){this.fieldType[e]=t},addTypeCoercion:function(e,t){this.coerceType[e]=t},addCheck:function(e,t){this.fieldValidate[e]=t},addFormat:function(e,t){this.fieldFormat[e]=t},addSchema:function(e,t){if(!t&&e&&(t=e,e=void 0),t.hasOwnProperty(`id`)&&typeof t.id==`string`&&t.id!==e){if(t.id.charAt(0)===`/`)throw Error(`jjv: schema id's starting with / are invalid.`);this.schema[c(t.id)]=t}else if(!e)throw Error(`jjv: schema needs either a name or id attribute.`);e&&(this.schema[c(e)]=t)}},t!==void 0&&t.exports!==void 0?t.exports=p:typeof define==`function`&&define.amd?define(function(){return p}):this.jjv=p}).call(e)})),wf=c(o(((e,t)=>{t.exports=Cf()}))(),1),Tf=null;function Ef(e){let{id:t,context:n}=e,r=e=>P(n[e]),i=(e,t)=>{if(!P(n[e]))throw Error(`${t} plot accessor: you must provide '${e}'`)},a=(e,t)=>{if(!e.some(e=>r(e)))throw Error(`${t} plot accessor: you must provide either '${e[0]}' or '${e[1]}'`)},o=e=>{if(r(`placement`)&&n.placement===`clone`&&!r(`cloneUid`)&&!r(`cloneIndex`))throw Error(`${e} plot accessor: when placement is 'clone', you must provide either 'cloneUid' or 'cloneIndex'.`)};if(t===`Plot`)switch(n.id){case`Add`:switch(i(`type`,`Add`),n.type){case`Study`:i(`studyId`,`Add`),o(`Add`);break;case`IncomeStatement`:case`BalanceSheet`:i(`fundamentalId`,`Add`);break;case`Expression`:i(`expression`,`Add`);break}break;case`Get`:if(!r(`main`)&&!r(`type`))throw Error(`Get plot accessor: you must provide either 'main' or 'type'`);break;case`Delete`:i(`type`,`Delete`),a([`uid`,`index`],`Delete`);break;case`Update`:switch(i(`type`,`Update`),r(`main`)||a([`uid`,`index`],`Update`),o(`Update`),n.type){case`Forward`:if(!P(n.forward)){if(!P(n.curves)||!P(n.offsets))throw Error(`Update forward plot accessor: you must provide either 'forward' or 'curves' and 'offsets'`);if(n.curves.length!==n.offsets.length)throw Error(`Update forward plot accessor: you must provide same number of elements for 'curves' and 'offsets'`)}break;case`Seasonal`:if(!P(n.seasonal)){if(!P(n.curves)||!P(n.offsets))throw Error(`Update seasonal plot accessor: you must provide either 'seasonal' or 'curves' and 'offsets'`);if(n.curves.length!==n.offsets.length&&n.curves.length!==n.offsets.length+1)throw Error(`Update seasonal plot accessor: you must provide either same number of elements for 'curves' and 'offsets' or one curve more`)}break;case`Study`:{i(`studyId`,`Update`),o(`Update`);let e=e=>e.reduce((e,t)=>e.concat(t.fields),[]),t=V(n.studyId),r=e=>`Update study plot accessor: you must provide same number of elements for '${e}' of the study as defined in the taxonomy`,a=e=>`Update study plot accessor: incoming list of ${e} is different from the ${e} as defined in the taxonomy`;if(P(n.curves)){if(n.curves.length!==t.defaults.curves.length)throw Error(r(`curves`));let i=e(n.curves);if(j(e(t.defaults.curves),i).length!==0)throw Error(a(`fields`))}break}}break}}function Df(){Tf===null&&(Tf=(0,wf.default)(),Tf.defaultOptions.useDefault=!0,[B.CHART_SCHEMA,B.STUDIES_SCHEMA,B.FIELDS_SCHEMA,B.ACCESSOR_SCHEMA].forEach(e=>{Tf.addSchema(e,Xs(e))}))}function Of(e,t){Tf.addSchema(e,t)}function kf(e){H(e,`..plots{.type}`).forEach(e=>{P(e.uid)||(e.uid=bt())}),H(e,`..plots{.type==="${C[C.Study]}"}`).forEach(e=>{let t=V(e.study);P(t)&&ut(e,t.defaults)})}function Af(e){return e===B.CHART_SCHEMA}function jf(e){return e===B.ACCESSOR_SCHEMA}function Mf(e,t){Df();let n=ku(e,t);Af(t)&&(kf(n),n=Sf(n));let r=Tf.validate(t,n);if(r){let e=JSON.stringify(r,null,4);throw Error(`Document not valid according to schema ${t}; error is ${e}`)}return jf(t)&&Ef(n),n}function Nf(e){return U(U(e,`..panes{.axes{!.plots}}`,e=>(e.axes.length===1?e.axes=[]:e.axes[1].plots.length===0&&(e.axes.pop(),e.axes[0].plots.length===0&&(e.axes=[])),e)),`..panes{!.axes}`,e=>B.NULL_OBJECT)}var Pf=JSON.parse(`[{"id":"DateTime","type":"Date"},{"id":"Open"},{"id":"High"},{"id":"Low"},{"id":"Close"},{"id":"TradeSize","format":"AsInteger"},{"id":"Volume","format":"UseMetricUnit","shortName":"VOL"},{"id":"OpenInterest","format":"UseMetricUnit","shortName":"OI"},{"id":"Last"},{"id":"Bid"},{"id":"BidSize","format":"AsInteger"},{"id":"Ask"},{"id":"AskSize","format":"AsInteger"},{"id":"Symbol","type":"String"},{"id":"Change"},{"id":"PercentChange","format":"AsPercent"},{"id":"TradingDay"},{"id":"PreviousClose"},{"id":"PreviousOpen"},{"id":"PreviousHigh"},{"id":"PreviousLow"},{"id":"WeekPreviousClose"},{"id":"WeekPreviousHigh"},{"id":"WeekPreviousLow"},{"id":"MonthPreviousClose"},{"id":"MonthPreviousHigh"},{"id":"MonthPreviousLow"},{"id":"YearHigh"},{"id":"YearLow"},{"id":"Projection","name":"Projection"},{"id":"BarIndex","name":"Bar Index"},{"id":"Dividends","type":"String","category":"Event","name":"Dividend","shortName":"D"},{"id":"Splits","type":"String","category":"Event","name":"Split","shortName":"S"},{"id":"Earnings","type":"String","category":"Event","shortName":"E"},{"id":"Buy","category":"Event","name":"BuySignal","shortName":"B"},{"id":"Sell","category":"Event","name":"SellSignal","shortName":"S"},{"id":"Custom","category":"Event","name":"CustomEvent","shortName":"Z"},{"id":"Call","category":"Option"},{"id":"Put","category":"Option"},{"id":"Delta","category":"Option"},{"id":"Gamma","category":"Option"},{"id":"Theta","category":"Option"},{"id":"Vega","category":"Option"},{"id":"WeighImplVolHigh","category":"Option","name":"Implied Volatility High","shortName":"WeighImplVolHigh"},{"id":"WeighImplVolLow","category":"Option","name":"Implied Volatility Low","shortName":"WeighImplVolLow"},{"id":"WeighImplVol","category":"Option","name":"Implied Volatility","shortName":"WeighImplVol"},{"id":"WeighImplVolHigh5D","category":"Option","name":"Weighted Implied Volatility High 5D","shortName":"WeighImplVolHigh5D"},{"id":"WeighImplVolLow5D","category":"Option","name":"Weighted Implied Volatility Low 5D","shortName":"WeighImplVolLow5D"},{"id":"WeighImplVol5D","category":"Option","name":"Weighted Implied Volatility 5D","shortName":"WeighImplVol5D"},{"id":"WeighImplVolHigh1M","category":"Option","name":"Weighted Implied Volatility High 1M","shortName":"WeighImplVolHigh1M"},{"id":"WeighImplVolLow1M","category":"Option","name":"Weighted Implied Volatility Low 1M","shortName":"WeighImplVolLow1M"},{"id":"WeighImplVol1M","category":"Option","name":"Weighted Implied Volatility 1M","shortName":"WeighImplVol1M"},{"id":"WeighImplVolHigh3M","category":"Option","name":"Weighted Implied Volatility High 3M","shortName":"WeighImplVolHigh3M"},{"id":"WeighImplVolLow3M","category":"Option","name":"Weighted Implied Volatility Low 3M","shortName":"WeighImplVolLow3M"},{"id":"WeighImplVol3M","category":"Option","name":"Weighted Implied Volatility 3M","shortName":"WeighImplVol3M"},{"id":"WeighImplVolHigh6M","category":"Option","name":"Weighted Implied Volatility High 6M","shortName":"WeighImplVolHigh6M"},{"id":"WeighImplVolLow6M","category":"Option","name":"Weighted Implied Volatility Low 6M","shortName":"WeighImplVolLow6M"},{"id":"WeighImplVol6M","category":"Option","name":"Weighted Implied Volatility 6M","shortName":"WeighImplVol6M"},{"id":"WeighImplVolHigh1Y","category":"Option","name":"Weighted Implied Volatility High 1Y","shortName":"WeighImplVolHigh1Y"},{"id":"WeighImplVolLow1Y","category":"Option","name":"Weighted Implied Volatility Low 1Y","shortName":"WeighImplVolLow1Y"},{"id":"WeighImplVol1Y","category":"Option","name":"Weighted Implied Volatility 1Y","shortName":"WeighImplVol1Y"},{"id":"WeighImplVolHighYTD","category":"Option","name":"Weighted Implied Volatility High YTD","shortName":"WeighImplVolHighYTD"},{"id":"WeighImplVolLowYTD","category":"Option","name":"Weighted Implied Volatility Low YTD","shortName":"WeighImplVolLowYTD"},{"id":"WeighImplVolYTD","category":"Option","name":"Weighted Implied Volatility YTD","shortName":"WeighImplVolYTD"},{"id":"WeighImplVolChg","category":"Option","name":"Weighted Implied Volatility Change","shortName":"WeighImplVolChg"},{"id":"ImplVolRank5D","category":"Option","name":"Implied Volatility Rank 5D","shortName":"ImplVolRank5D"},{"id":"ImplVolRank1M","category":"Option","name":"Implied Volatility Rank 1M","shortName":"ImplVolRank1M"},{"id":"ImplVolRank3M","category":"Option","name":"Implied Volatility Rank 3M","shortName":"ImplVolRank3M"},{"id":"ImplVolRank6M","category":"Option","name":"Implied Volatility Rank 6M","shortName":"ImplVolRank6M"},{"id":"ImplVolRank1Y","category":"Option","name":"Implied Volatility Rank","shortName":"ImplVolRank1Y"},{"id":"ImplVolRankYTD","category":"Option","name":"Implied Volatility Rank YTD","shortName":"ImplVolRankYTD"},{"id":"ImplVolPerc5D","category":"Option","name":"Implied Volatility Perc. 5D","shortName":"ImplVolPerc5D"},{"id":"ImplVolPerc1M","category":"Option","name":"Implied Volatility Perc. 1M","shortName":"ImplVolPerc1M"},{"id":"ImplVolPerc3M","category":"Option","name":"Implied Volatility Perc. 3M","shortName":"ImplVolPerc3M"},{"id":"ImplVolPerc6M","category":"Option","name":"Implied Volatility Perc. 6M","shortName":"ImplVolPerc6M"},{"id":"ImplVolPerc1Y","category":"Option","name":"Implied Volatility Percentile","shortName":"ImplVolPerc1Y"},{"id":"ImplVolPercYTD","category":"Option","name":"Implied Volatility Perc. YTD","shortName":"ImplVolPercYTD"},{"id":"OptTotVol","category":"Option","name":"Options Total Volume","shortName":"OptTotVol","format":"UseMetricUnit"},{"id":"OptCallVol","category":"Option","name":"Options Call Volume","shortName":"OptCallVol","format":"UseMetricUnit"},{"id":"OptPutVol","category":"Option","name":"Options Put Volume","shortName":"OptPutVol","format":"UseMetricUnit"},{"id":"PutCallVolRatio","category":"Option","name":"Put Call Volume Ratio","shortName":"PutCallVolRatio"},{"id":"TotalOpenInt","category":"Option","name":"Total Open Interest","shortName":"Total OI","format":"UseMetricUnit"},{"id":"CallOpenInt","category":"Option","name":"Call Open Interest","shortName":"Call OI","format":"UseMetricUnit"},{"id":"PutOpenInt","category":"Option","name":"Put Open Interest","shortName":"Put OI","format":"UseMetricUnit"},{"id":"PutCallOIRatio","category":"Option","name":"Put Call OI Ratio","shortName":"Put Call OI Ratio"},{"id":"CallIVCurve","category":"Option","name":"Call IV Curve","shortName":"Call IV Curve"},{"id":"PutIVCurve","category":"Option","name":"Put IV Curve","shortName":"Put IV Curve"},{"id":"CallTheoretical","category":"Option","name":"Call Theoretical","shortName":"Call Theoretical"},{"id":"PutTheoretical","category":"Option","name":"Put Theoretical","shortName":"Put Theoretical"},{"id":"HL/2","category":"Study","name":"(High+Low)/2","shortName":"(H+L)/2"},{"id":"OC/2","category":"Study","name":"(Open+Close)/2","shortName":"(O+C)/2"},{"id":"HLC/3","category":"Study","name":"(High+Low+Close)/3","shortName":"(H+L+C)/3"},{"id":"OHLC/4","category":"Study","name":"(Open+High+Low+Close)/4","shortName":"(O+H+L+C)/4"},{"id":"HLCC/4","category":"Study","name":"(High+Low+Close+Close)/4","shortName":"(H+L+C+C)/4"},{"id":"AVG","category":"Study","name":"Average","shortName":"AVG"},{"id":"FRAMA","category":"Study","name":"FRAMA","shortName":"FRAMA"},{"id":"MA","category":"Study","name":"MA-Simple","shortName":"MA"},{"id":"MACLD1","category":"Study","name":"MA-Cloud-Fast","shortName":"MACLD1"},{"id":"MACLD2","category":"Study","name":"MA-Cloud-Slow","shortName":"MACLD2"},{"id":"MA1","category":"Study","name":"MA1-Simple","shortName":"MA1"},{"id":"MA2","category":"Study","name":"MA2-Simple","shortName":"MA2"},{"id":"MA3","category":"Study","name":"MA3-Simple","shortName":"MA3"},{"id":"MA4","category":"Study","name":"MA4-Simple","shortName":"MA4"},{"id":"MA5","category":"Study","name":"MA5-Simple","shortName":"MA5"},{"id":"MA6","category":"Study","name":"MA6-Simple","shortName":"MA6"},{"id":"MA7","category":"Study","name":"MA7-Simple","shortName":"MA7"},{"id":"MA8","category":"Study","name":"MA8-Simple","shortName":"MA8"},{"id":"MA9","category":"Study","name":"MA9-Simple","shortName":"MA9"},{"id":"MA10","category":"Study","name":"MA10-Simple","shortName":"MA10"},{"id":"MAS","category":"Study","name":"MA-Shorter","shortName":"MAS"},{"id":"MAL","category":"Study","name":"MA-Longer","shortName":"MAL"},{"id":"CMBCI","category":"Study","name":"Composite Index","shortName":"CMBCI"},{"id":"CMBCIF","category":"Study","name":"Fast Ma","shortName":"CMBCIF"},{"id":"CMBCIS","category":"Study","name":"Slow Ma","shortName":"CMBCIS"},{"id":"COTI","category":"Study","name":"COT Index","shortName":"COTI"},{"id":"CHEXL","category":"Study","name":"ChandelierExitLong","shortName":"CHEXL"},{"id":"CHEXS","category":"Study","name":"ChandelierExitShort","shortName":"CHEXS"},{"id":"SUPTR","category":"Study","name":"Supertrend","shortName":"SUPTR"},{"id":"BARCOLIX","category":"Study","name":"BarColorIndex","shortName":"BARCOLIX"},{"id":"BARKIND","category":"Study","name":"BarKind","shortName":"BARKIND"},{"id":"BREL","category":"Study","name":"BarRelation","shortName":"BREL"},{"id":"EMA","category":"Study","name":"MA-Exp","shortName":"MA(EXP)"},{"id":"MAHI","category":"Study","name":"MA-High","shortName":"MA(HI)"},{"id":"MALO","category":"Study","name":"MA-Low","shortName":"MA(LO)"},{"id":"MACD","category":"Study","name":"MACD","shortName":"MACD"},{"id":"MACDS","category":"Study","name":"MACD-Signal","shortName":"MACD(S)"},{"id":"MACDH","category":"Study","name":"MACD-Histogram","shortName":"MACD(H)"},{"id":"MACDV","category":"Study","name":"MACD-V","shortName":"MACD-V"},{"id":"MACDVS","category":"Study","name":"MACD-V-Signal","shortName":"MACD-V(S)"},{"id":"MACDVH","category":"Study","name":"MACD-V-Histogram","shortName":"MACD-V(H)"},{"id":"ENVU","category":"Study","name":"Envelope-Up","shortName":"ENV(UP)"},{"id":"ENVD","category":"Study","name":"Envelope-Down","shortName":"ENV(DN)"},{"id":"ENVEXPU","category":"Study","name":"Envelope-Exponential-Up","shortName":"ENVEXP(UP)"},{"id":"ENVEXPD","category":"Study","name":"Envelope-Exponential-Down","shortName":"ENVEXP(DN)"},{"id":"ENVSMOU","category":"Study","name":"Envelope-Smoothed-Up","shortName":"ENVSMO(UP)"},{"id":"ENVSMOD","category":"Study","name":"Envelope-Smoothed-Down","shortName":"ENVSMO(DN)"},{"id":"SMA","category":"Study","name":"MA-Smoothed","shortName":"MA(S)"},{"id":"CSHO","category":"Study","name":"Cash-Overlay","shortName":"CSHO"},{"id":"CSHB","category":"Study","name":"Cash-Basis","shortName":"CSHB"},{"id":"MKTCAP","category":"Study","name":"Market-Cap","format":"UseMetricUnit","shortName":"MktCap"},{"id":"TMA","category":"Study","name":"MA-Triangular","shortName":"MA(TRI)"},{"id":"WMA","category":"Study","name":"MA-Weighted","shortName":"MA(W)"},{"id":"VOLMA","category":"Study","format":"UseMetricUnit","name":"MA-Volume","shortName":"VOLMA"},{"id":"OSC","category":"Study","name":"OSC","shortName":"OSC"},{"id":"VOSC","category":"Study","format":"UseMetricUnit","name":"OSC-Volume","shortName":"VOLOSC"},{"id":"RSI","category":"Study","name":"RSI","shortName":"RSI"},{"id":"RSIAVG","category":"Study","name":"RSI-Average","shortName":"RSIAVG"},{"id":"RSA","category":"Study","name":"RSA","shortName":"RSA"},{"id":"RSAAVG","category":"Study","name":"RSA-Average","shortName":"RSIAVG"},{"id":"STORSI","category":"Study","name":"StochRSI","shortName":"STOCHRSI"},{"id":"STORSIAVG","category":"Study","name":"StochRSIAvg","shortName":"STOCHRSIAVG"},{"id":"HH","category":"Study","name":"HighestHigh","shortName":"HHIGH"},{"id":"LL","category":"Study","name":"LowestLow","shortName":"LLOW"},{"id":"PercK","category":"Study","name":"%K","shortName":"PCNTK"},{"id":"PercD","category":"Study","name":"%D","shortName":"PCNTD"},{"id":"PercR","category":"Study","name":"%R","shortName":"PCNTR"},{"id":"WGCL","category":"Study","name":"WeightedClose","shortName":"WTCL"},{"id":"WGALPH","category":"Study","name":"WeightedAlpha","shortName":"WGALPH"},{"id":"UPVOL","category":"Study","format":"UseMetricUnit","name":"UpVol","shortName":"UPVOL"},{"id":"DNVOL","category":"Study","format":"UseMetricUnit","name":"DownVol","shortName":"DNVOL"},{"id":"TOTVOL","category":"Study","format":"UseMetricUnit","name":"TotVol","shortName":"TOTVOL"},{"id":"POC","category":"Study","name":"PointOfControl","shortName":"POC"},{"id":"VAREA","category":"Study","name":"ValueArea","shortName":"VAREA"},{"id":"BARBACK","category":"Study","name":"Background","shortName":"BARBACK"},{"id":"BOLLBU","category":"Study","name":"Bollinger-Upper","shortName":"BOLL(U)"},{"id":"BOLLBL","category":"Study","name":"Bollinger-Lower","shortName":"BOLL(L)"},{"id":"BOLLBM","category":"Study","name":"Bollinger-Mid","shortName":"BOLL(M)"},{"id":"BOLLW","category":"Study","name":"Bollinger-Width","shortName":"BOLL(W)"},{"id":"BOLLP","category":"Study","name":"Bollinger-Percent","shortName":"BOLL(%B)"},{"id":"BOLLBW","category":"Study","name":"Bollinger-BandWidth","shortName":"BOLL(BW)"},{"id":"BOLLBWA","category":"Study","name":"Bollinger-BandWidthAvg","shortName":"BOLL(BWA)"},{"id":"PCUP1","category":"Study","name":"ProbCone-Up1","shortName":"PCUP1"},{"id":"PCDN1","category":"Study","name":"ProbCone-Down1","shortName":"PCDN1"},{"id":"PCUP2","category":"Study","name":"ProbCone-Up2","shortName":"PCUP2"},{"id":"PCDN2","category":"Study","name":"ProbCone-Down2","shortName":"PCDN2"},{"id":"PCUP3","category":"Study","name":"ProbCone-Up3","shortName":"PCUP3"},{"id":"PCDN3","category":"Study","name":"ProbCone-Down3","shortName":"PCDN3"},{"id":"PCTD","category":"Study","name":"ProbCone-TgtDate","shortName":"PCTD"},{"id":"PCTP","category":"Study","name":"ProbCone-TgtPrice","shortName":"PCTP"},{"id":"MBBUO","category":"Study","name":"ModifiedBoll-UppOut","shortName":"MBOLL(UO)"},{"id":"MBBUI","category":"Study","name":"ModifiedBoll-UppIn","shortName":"MBOLL(UI)"},{"id":"MBBM","category":"Study","name":"ModifiedBoll-Mid","shortName":"MBOLL(M)"},{"id":"MBBLI","category":"Study","name":"ModifiedBoll-LowIn","shortName":"MBOLL(LI)"},{"id":"MBBLO","category":"Study","name":"ModifiedBoll-LowOut","shortName":"MBOLL(LO)"},{"id":"OBVOL","category":"Study","format":"UseMetricUnit","name":"OnBalanceVol","shortName":"OBVOL"},{"id":"OBVOLAVG","category":"Study","format":"UseMetricUnit","name":"OnBalanceVolAvg","shortName":"OBVOL"},{"id":"TR","category":"Study","name":"TrueRange","shortName":"TR"},{"id":"ATR","category":"Study","name":"AvgTrueRange","shortName":"ATR"},{"id":"ATRMA","category":"Study","name":"MA-ATR","shortName":"MA(ATR)"},{"id":"ADJATR","category":"Study","name":"AdjAvgTrueRange","shortName":"ADJATR"},{"id":"COTR","category":"Study","name":"ChgOverTrueRange","shortName":"COTR"},{"id":"ATRP","category":"Study","name":"AvgTrueRangePerc","shortName":"ATRP"},{"id":"STOMOMIX","category":"Study","name":"StochMomIndex","shortName":"STOMOMIX"},{"id":"CHDMOMOSC","category":"Study","name":"ChandeMomOsc","shortName":"CHDMOMOSC"},{"id":"CHDMOMOSCAVG","category":"Study","name":"ChandeMomOsc-Avg","shortName":"CHDMOMOSCAVG"},{"id":"PDI","category":"Study","name":"+DI","shortName":"+DI"},{"id":"MDI","category":"Study","name":"-DI","shortName":"-DI"},{"id":"PLVI","category":"Study","name":"+VI","shortName":"+VI"},{"id":"MNVI","category":"Study","name":"-VI","shortName":"-VI"},{"id":"ADX","category":"Study","name":"ADX","shortName":"ADX"},{"id":"ADXM","category":"Study","name":"ADX-Modified","shortName":"ADXM"},{"id":"ADL","category":"Study","format":"UseMetricUnit","name":"AccDist","shortName":"ACCDIS"},{"id":"ADWM","category":"Study","name":"AccDistWill","shortName":"ACCDISWIL"},{"id":"ADWMMA","category":"Study","name":"AccDistWillMovAvg","shortName":"ACCDISWILMA"},{"id":"MCGD","category":"Study","name":"McGinleyDyn","shortName":"MCGD"},{"id":"HMA","category":"Study","name":"HullMovAvg","shortName":"HMA"},{"id":"COPP","category":"Study","name":"CoppCurve","shortName":"COPP"},{"id":"CHAOSC","category":"Study","format":"UseMetricUnit","name":"ChaikinOsc","shortName":"CHAIKOSC"},{"id":"TP","category":"Study","name":"TypicalPrice","shortName":"TP"},{"id":"KCUP","category":"Study","name":"KeltChan-Up","shortName":"KELT(UP)"},{"id":"KCMID","category":"Study","name":"KeltChan-Mid","shortName":"KELT(MID)"},{"id":"KCLOW","category":"Study","name":"KeltChan-Low","shortName":"KELT(LO)"},{"id":"KBUP","category":"Study","name":"KeltBands-Up","shortName":"KELB(UP)"},{"id":"KBMID","category":"Study","name":"KeltBands-Mid","shortName":"KELB(MID)"},{"id":"KBLOW","category":"Study","name":"KeltBands-Low","shortName":"KELB(LO)"},{"id":"DONUP","category":"Study","name":"Donchian-Up","shortName":"DON(U)"},{"id":"DONMID","category":"Study","name":"Donchian-Mid","shortName":"DON(M)"},{"id":"DONLOW","category":"Study","name":"Donchian-Low","shortName":"DON(L)"},{"id":"DONW","category":"Study","name":"Donchian-Width","shortName":"DON(W)"},{"id":"PVT","category":"Study","format":"UseMetricUnit","name":"PriceVolChange","shortName":"PVOL"},{"id":"TRIX","category":"Study","name":"Triple-MA-Exp","shortName":"TRIX"},{"id":"ROC","category":"Study","name":"RateOfChange","shortName":"ROC"},{"id":"PVPT","category":"Study","name":"PivotPoint","shortName":"PVMOV"},{"id":"PVPTR","category":"Study","name":"PvtPt-Resistance","shortName":"PVMOV(R)"},{"id":"PVPTS","category":"Study","name":"PvtPt-Support","shortName":"PVMOV(S)"},{"id":"FISHER","category":"Study","name":"Fisher","shortName":"Fisher"},{"id":"FISHTRG","category":"Study","name":"Fisher-Trigger","shortName":"Trigger"},{"id":"ARNUP","category":"Study","name":"Aroon-Up","shortName":"ARN(UP)"},{"id":"ARNLOW","category":"Study","name":"Aroon-Down","shortName":"ARN(DN)"},{"id":"VSTOPUP","category":"Study","name":"VolaStop-Up","shortName":"VSTOP(UP)"},{"id":"VSTOPLOW","category":"Study","name":"VolaStop-Down","shortName":"VSTOP(DN)"},{"id":"ARNOSC","category":"Study","name":"Aroon-Osci","shortName":"ARNOSC"},{"id":"TCHNUP","category":"Study","name":"TurtleChn-Up","shortName":"TCH(UP)"},{"id":"TCHNLOW","category":"Study","name":"TurtleChn-Low","shortName":"TCH(LO)"},{"id":"TCHRE","category":"Study","name":"TurtleChnRetrace","shortName":"TCHRE"},{"id":"ALJAW","category":"Study","name":"Alligator-Jaw","shortName":"AL(J)"},{"id":"ALTEETH","category":"Study","name":"Alligator-Teeth","shortName":"AL(T)"},{"id":"ALLIPS","category":"Study","name":"Alligator-Lips","shortName":"AL(L)"},{"id":"PLTLN","category":"Study","name":"PlotLine","shortName":"LINE"},{"id":"AWOS","category":"Study","name":"AwesomeOsc","shortName":"AWOSC"},{"id":"AWOSMA","category":"Study","name":"AwesomeOsc-MA","shortName":"AWOSC(MA)"},{"id":"MFMUL","category":"Study","name":"MoneyFlowMul"},{"id":"CLV","category":"Study","name":"CloseLocationValue","shortName":"CLV"},{"id":"CHOP","category":"Study","name":"ChoppinessIndex","shortName":"ChopIx"},{"id":"CHAMF","category":"Study","name":"ChaikinMoneyFlow","shortName":"CHAIKMF"},{"id":"CHAVOL","category":"Study","name":"ChaikinVolatility","shortName":"CHAIKVOL"},{"id":"DPO","category":"Study","name":"DetrendedPriceOsc","shortName":"DPO"},{"id":"CCI","category":"Study","name":"CommodityChannelIndex","shortName":"CCI"},{"id":"EMV","category":"Study","name":"EaseOfMovement","shortName":"EOM"},{"id":"EMVMA","category":"Study","name":"EaseOfMovementMA","shortName":"EOM(MA)"},{"id":"ERBLPOW","category":"Study","name":"ElderRayBullPow","shortName":"ER(BULL)"},{"id":"ERBRPOW","category":"Study","name":"ElderRayBearPow","shortName":"ER(BEAR)"},{"id":"FI","category":"Study","format":"UseMetricUnit","name":"ForceIndex","shortName":"FORCE"},{"id":"MI","category":"Study","name":"MassIndex","shortName":"MASS"},{"id":"MOM","category":"Study","name":"Momentum","shortName":"MOM"},{"id":"MOMMA","category":"Study","name":"MA-Momentum","shortName":"MA(MOM)"},{"id":"MFI","category":"Study","name":"MoneyFlowIndex","shortName":"MFI"},{"id":"MSD","category":"Study","name":"MovingStdDev","shortName":"MSD"},{"id":"PCTCHG","category":"Study","name":"PercentChange","shortName":"PCTCHG"},{"id":"LINRUP","category":"Study","name":"LinRegUpper","shortName":"LINRUP"},{"id":"LINRMID","category":"Study","name":"LinRegMiddle","shortName":"LINRMID"},{"id":"LINRLOW","category":"Study","name":"LinRegLower","shortName":"LINRLOW"},{"id":"NVI","category":"Study","name":"NegativeVolIndex","shortName":"NVI"},{"id":"NVIEMA","category":"Study","name":"NegativeVolIndexEMA","shortName":"NVI(EMA)"},{"id":"PVI","category":"Study","name":"PositiveVolIndex","shortName":"PVI"},{"id":"PVIEMA","category":"Study","name":"PositiveVolIndexEMA","shortName":"PVI(EMA)"},{"id":"PPO","category":"Study","name":"PercPriceOsc","shortName":"PPO"},{"id":"PPOS","category":"Study","name":"PPO-Signal","shortName":"PPO(S)"},{"id":"PPOH","category":"Study","name":"PPO-Histogram","shortName":"PPO(H)"},{"id":"PVO","category":"Study","name":"PercVolOsc","shortName":"PVO"},{"id":"PVOS","category":"Study","name":"PVO-Signal","shortName":"PVO(S)"},{"id":"PVOH","category":"Study","name":"PVO-Histogram","shortName":"PVO(H)"},{"id":"HV","category":"Study","name":"HistVolatility","shortName":"HISTVOL"},{"id":"PERF","category":"Study","name":"Performance","shortName":"PERF"},{"id":"STC","category":"Study","name":"SchaffTrendCycle","shortName":"STC"},{"id":"MCCLO","category":"Study","name":"McClellanOsc","shortName":"MCCLO"},{"id":"BTI","category":"Study","name":"BreadthThrust","shortName":"BTI"},{"id":"NHLAI","category":"Study","name":"NewHiLoAccIx","shortName":"NHLAI"},{"id":"KST","category":"Study","name":"KnowSureThing","shortName":"KST"},{"id":"KSTSIG","category":"Study","name":"KST-Signal","shortName":"KSTSIG"},{"id":"WASI","category":"Study","name":"WilderAccSwingIndex","shortName":"WACCSW"},{"id":"WWVSARU","category":"Study","name":"WilderVolSarUp","shortName":"WVOL-UP"},{"id":"WWVSARD","category":"Study","name":"WilderVolSarDown","shortName":"WVOL-DN"},{"id":"PARSARS","category":"Study","name":"ParabolicSarShort","shortName":"SHORT"},{"id":"PARSARL","category":"Study","name":"ParabolicSarLong","shortName":"LONG"},{"id":"REATRS","category":"Study","name":"RetraceATRStop","shortName":"REATRS"},{"id":"MOVLR","category":"Study","name":"MovingLinRegression","shortName":"MOVLINREG"},{"id":"TRSP1","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TRSP2","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TARGP","category":"Study","name":"Target Price","shortName":"TARGP"},{"id":"COTLCCMSP","category":"Study","name":"Comm Spec","shortName":"COT(C)"},{"id":"COTLCLGSP","category":"Study","name":"Large Spec","shortName":"COT(L)"},{"id":"COTLCSMSP","category":"Study","name":"Small Spec","shortName":"COT(S)"},{"id":"COTDAGPRO","category":"Study","name":"Producers","shortName":"COTDIS(P)"},{"id":"COTDAGSPD","category":"Study","name":"Swap Dealers","shortName":"COTDIS(S)"},{"id":"COTDAGMNM","category":"Study","name":"Managed Money","shortName":"COTDIS(M)"},{"id":"COTDAGOTH","category":"Study","name":"Other Report","shortName":"COTDIS(O)"},{"id":"COTFTRDLI","category":"Study","name":"Dealer Intermediary","shortName":"COTFIN(D)"},{"id":"COTFTRASM","category":"Study","name":"Asset Manager","shortName":"COTFIN(A)"},{"id":"COTFTRLVF","category":"Study","name":"Leveraged Funds","shortName":"COTFIN(L)"},{"id":"COTFTROTH","category":"Study","name":"Other Report","shortName":"COTFIN(O)"},{"id":"PPTPIV","category":"Study","name":"Pivot Point","shortName":"PPT(P)"},{"id":"PPTR1","category":"Study","name":"1st Resistance","shortName":"PPT(R1)"},{"id":"PPTR2","category":"Study","name":"2nd Resistance","shortName":"PPT(R2)"},{"id":"PPTR3","category":"Study","name":"3rd Resistance","shortName":"PPT(R3)"},{"id":"PPTS1","category":"Study","name":"1st Support","shortName":"PPT(S1)"},{"id":"PPTS2","category":"Study","name":"2nd Support","shortName":"PPT(S2)"},{"id":"PPTS3","category":"Study","name":"3rd Support","shortName":"PPT(S3)"},{"id":"CPPH4","category":"Study","name":"4th Camarilla Res","shortName":"CPP(H4)"},{"id":"CPPH3","category":"Study","name":"3rd Camarilla Res","shortName":"CPP(H3)"},{"id":"CPPH2","category":"Study","name":"2nd Camarilla Res","shortName":"CPP(H2)"},{"id":"CPPH1","category":"Study","name":"1st Camarilla Res","shortName":"CPP(H1)"},{"id":"CPPL1","category":"Study","name":"1st Camarilla Supp","shortName":"CPP(L1)"},{"id":"CPPL2","category":"Study","name":"2nd Camarilla Supp","shortName":"CPP(L2)"},{"id":"CPPL3","category":"Study","name":"3rd Camarilla Supp","shortName":"CPP(L3)"},{"id":"CPPL4","category":"Study","name":"4th Camarilla Supp","shortName":"CPP(L4)"},{"id":"IMPVOL","category":"Study","name":"Implied Volatility","shortName":"IV"},{"id":"CTM","category":"Study","name":"Cycle Trading Momentum","shortName":"CTM"},{"id":"CPMI","category":"Study","name":"Principal Momentum","shortName":"CPMI"},{"id":"CTPI","category":"Study","name":"Turning Point","shortName":"CTPI"},{"id":"CTLTM","category":"Study","name":"Long-Term Momentum","shortName":"LTM"},{"id":"CTLTMF","category":"Study","name":"Long-Term Momentum, Fast","shortName":"LTM(F)"},{"id":"DEMA","category":"Study","name":"Double EMA","shortName":"DEMA"},{"id":"EOSC","category":"Study","name":"Exponential Oscillator","shortName":"EOSC"},{"id":"TEMA","category":"Study","name":"Triple EMA","shortName":"TEMA"},{"id":"TSI","category":"Study","name":"True Strength Index","shortName":"Tsi"},{"id":"TSISIG","category":"Study","name":"True Strength Index Signal","shortName":"TsiSig"},{"id":"GMMA3","category":"Study","name":"GMMA-EMA3","shortName":"GMMA(3)"},{"id":"GMMA5","category":"Study","name":"GMMA-EMA5","shortName":"GMMA(5)"},{"id":"GMMA8","category":"Study","name":"GMMA-EMA8","shortName":"GMMA(8)"},{"id":"GMMA10","category":"Study","name":"GMMA-EMA10","shortName":"GMMA(10)"},{"id":"GMMA12","category":"Study","name":"GMMA-EMA12","shortName":"GMMA(12)"},{"id":"GMMA15","category":"Study","name":"GMMA-EMA15","shortName":"GMMA(15)"},{"id":"GMMA30","category":"Study","name":"GMMA-EMA30","shortName":"GMMA(30)"},{"id":"GMMA35","category":"Study","name":"GMMA-EMA35","shortName":"GMMA(35)"},{"id":"GMMA40","category":"Study","name":"GMMA-EMA40","shortName":"GMMA(40)"},{"id":"GMMA45","category":"Study","name":"GMMA-EMA45","shortName":"GMMA(45)"},{"id":"GMMA50","category":"Study","name":"GMMA-EMA50","shortName":"GMMA(50)"},{"id":"GMMA60","category":"Study","name":"GMMA-EMA60","shortName":"GMMA(60)"},{"id":"CONVLN","category":"Study","name":"ConversionLine","shortName":"ConvLn"},{"id":"BASELN","category":"Study","name":"BaseLine","shortName":"BaseLn"},{"id":"LEADSP1","category":"Study","name":"LeadingSpanA","shortName":"LeadSpA"},{"id":"LEADSP2","category":"Study","name":"LeadingSpanB","shortName":"LeadSpB"},{"id":"LAGGSP","category":"Study","name":"LaggingSpan","shortName":"LaggSp"},{"id":"VWAP","category":"Study","name":"VWAP","shortName":"VWAP"},{"id":"AVWAP","category":"Study","name":"Anchored VWAP","shortName":"Anch-VWAP"},{"id":"VWAPSD1U","category":"Study","name":"VWAP Stdev1 Upper","shortName":"VWAP-Std1-Up"},{"id":"VWAPSD1L","category":"Study","name":"VWAP Stdev1 Lower","shortName":"VWAP-Std1-Lo"},{"id":"VWAPSD2U","category":"Study","name":"VWAP Stdev2 Upper","shortName":"VWAP-Std2-Up"},{"id":"VWAPSD2L","category":"Study","name":"VWAP Stdev2 Lower","shortName":"VWAP-Std2-Lo"},{"id":"DIFA","category":"Study","name":"Distance From Average","shortName":"DistAvg"},{"id":"DOSCH","category":"Study","name":"Derivative Oscillator","shortName":"DerOsc"},{"id":"DOSCS","category":"Study","name":"Derivative Oscillator Signal","shortName":"DerOscSig"},{"id":"TTMSQZON","category":"Study","name":"TTM Squeeze On","shortName":"TtmSqzOn"},{"id":"TTMSQZOFF","category":"Study","name":"TTM Squeeze Off","shortName":"TtmSqzOff"},{"id":"TTMSQZOSC","category":"Study","name":"TTM Squeeze Osc","shortName":"TtmSqzOsc"},{"id":"CRS","category":"Study","name":"CompRelStrength","shortName":"CRS"},{"id":"CRSAVG","category":"Study","name":"CompRelStrengthAvg","shortName":"CRS-Avg"},{"id":"DRS","category":"Study","name":"DorseyRelStrength","shortName":"DRS"},{"id":"MRS","category":"Study","name":"MansfieldRelStrength","shortName":"MRS"},{"id":"PMO","category":"Study","name":"PriceMomOsc","shortName":"PMO"},{"id":"PMOS","category":"Study","name":"PriceMomOscSig","shortName":"PMOS"},{"id":"RVOL","category":"Study","name":"Relative Volume","shortName":"RVOL"},{"id":"AccountsPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Accounts Payable","shortName":"AcctsPay"},{"id":"AccruedExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Accrued Expenses","shortName":"AccrdExp"},{"id":"Cash","category":"BalanceSheet","format":"UseMetricUnit","name":"Cash & Cash Equivalents","shortName":"Cash&CashEqv"},{"id":"CommonShares","category":"BalanceSheet","format":"UseMetricUnit","name":"Common Shares","shortName":"CommonShares"},{"id":"SharesOutstanding","category":"BalanceSheet","format":"UseMetricUnit","name":"Shares Outstanding","shortName":"SharesOutstanding"},{"id":"DeferredIncomeTax","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Income Tax","shortName":"DefIncTax"},{"id":"DeferredLongRevenues","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Revenues","shortName":"DefRev"},{"id":"EquityOtherInvestments","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity Investments","shortName":"OthEquityInvest"},{"id":"IncomeTaxPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Income Tax Payable","shortName":"IncTaxPayble"},{"id":"Intangibles","category":"BalanceSheet","format":"UseMetricUnit","name":"Intangibles","shortName":"Intangibles"},{"id":"Inventories","category":"BalanceSheet","format":"UseMetricUnit","name":"Inventories","shortName":"Inventory"},{"id":"LongTermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Long Term Debt","shortName":"LTDebt"},{"id":"MarketableSec","category":"BalanceSheet","format":"UseMetricUnit","name":"Liquid Securities","shortName":"LiqSecurities"},{"id":"OtherCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Miscellaneous Current Assets","shortName":"MiscCurrAssets"},{"id":"OtherCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Current Liabilities","shortName":"OthCurrLiab"},{"id":"OtherEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity","shortName":"OthEquity"},{"id":"OtherNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Assets","shortName":"OthNonCurrAssets"},{"id":"OtherNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Liabilities","shortName":"OthNonCurrLiab"},{"id":"PpeNet","category":"BalanceSheet","format":"UseMetricUnit","name":"PPE Net","shortName":"PPENet"},{"id":"PrepaidExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Prepaid Expenses","shortName":"PpdExp"},{"id":"Receivables","category":"BalanceSheet","format":"UseMetricUnit","name":"Receivables","shortName":"Receivables"},{"id":"RetainedEarnings","category":"BalanceSheet","format":"UseMetricUnit","name":"Retained Earnings","shortName":"RetEarnings"},{"id":"ShorttermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Short-Term Debt","shortName":"ShortTermDebt"},{"id":"TotalAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Assets","shortName":"TotAssets"},{"id":"TotalCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Assets","shortName":"TotCurrAssets"},{"id":"TotalCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Liabilities","shortName":"TotCurrLiab"},{"id":"TotalLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities","shortName":"TotalLiab"},{"id":"TotalLiabilitiesAndEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities & Equity","shortName":"TotLiab&Equity"},{"id":"TotalNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Assets","shortName":"TotNonCurrAssets"},{"id":"TotalNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Liabilities","shortName":"TotNonCurrLiabs"},{"id":"TotalShareholdersEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Shareholders Equity","shortName":"TotShareEquity"},{"id":"BasicEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Continued Operations","shortName":"EPSContOps"},{"id":"BasicEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Total Operations","shortName":"EPSTotOps"},{"id":"CostGoods","category":"IncomeStatement","format":"UseMetricUnit","name":"Cost of Goods","shortName":"COGS"},{"id":"DilutedEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Continued Operations","shortName":"DilutedEPSContOps"},{"id":"DilutedEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Total Operations","shortName":"DilutedEPSTotOps"},{"id":"Ebitda","category":"IncomeStatement","format":"UseMetricUnit","name":"EBITDA","shortName":"EBITDA"},{"id":"GrossProfit","category":"IncomeStatement","format":"UseMetricUnit","name":"Gross Profit","shortName":"GrProfit"},{"id":"IncomeTax","category":"IncomeStatement","format":"UseMetricUnit","name":"Income Tax","shortName":"IncomeTax"},{"id":"InterestExpense","category":"IncomeStatement","format":"UseMetricUnit","name":"Interest Expense","shortName":"IntExp"},{"id":"NetIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Net Income Less Expenses & Tax","shortName":"NetIncome"},{"id":"OperatingExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Expenses","shortName":"OpExpense"},{"id":"OperatingIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Income","shortName":"OpIncome"},{"id":"OtherIncomeExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Other Income","shortName":"OthInc"},{"id":"PreTaxIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Pretax Income","shortName":"PretaxInc"},{"id":"Sales","category":"IncomeStatement","format":"UseMetricUnit","name":"Sales","shortName":"Sales"},{"id":"JPIB","category":"Study","name":"JPI-Buy","shortName":"Buy"},{"id":"JPIS","category":"Study","name":"JPI-Sell","shortName":"Sell"},{"id":"TDIPRC","category":"Study","name":"TDI Price Line","shortName":"PriceLn"},{"id":"TDITSL","category":"Study","name":"TDI Trade Signal","shortName":"TradeSig"},{"id":"TDIMBL","category":"Study","name":"TDI Market Base","shortName":"MktBase"},{"id":"TDIUPR","category":"Study","name":"TDI Upper Band","shortName":"UpperBnd"},{"id":"TDILWR","category":"Study","name":"TDI Lower Band","shortName":"LowerBnd"},{"id":"PPS","category":"Study","name":"PricePercentStop","shortName":"PPS"},{"id":"RCI","category":"Study","name":"RankCorrelationIndex","shortName":"RCI"},{"id":"RCISIG","category":"Study","name":"RCI Signal","shortName":"RCISig"},{"id":"ZZPIVOT","category":"Study","name":"ZigZag Pivot","shortName":"ZZPivot"},{"id":"ADR","category":"Study","name":"AvgDailyRange","shortName":"ADR"},{"id":"ADRP","category":"Study","name":"AvgDailyRangePerc","shortName":"ADRP"},{"id":"BOP","category":"Study","name":"BalanceOfPower","shortName":"BOP"},{"id":"BOPAVG","category":"Study","name":"BalanceOfPowerAvg","shortName":"BOPAVG"},{"id":"CORR","category":"Study","name":"CorrelationCoefficient","shortName":"Corr"},{"id":"RVI","category":"Study","name":"RelativeVigorIndex","shortName":"RVI"},{"id":"RVISIG","category":"Study","name":"RVI Signal","shortName":"RVISig"},{"id":"ATREXTAVG","category":"Study","name":"ATR Extension Average","shortName":"ATREXTAVG"},{"id":"ATREXTUP","category":"Study","name":"ATR Extension Upper","shortName":"ATREXTUP"},{"id":"ATREXTLOW","category":"Study","name":"ATR Extension Lower","shortName":"ATREXTLOW"},{"id":"DIDIS","category":"Study","name":"DIDI Short","shortName":"DIDIS"},{"id":"DIDIL","category":"Study","name":"DIDI Long","shortName":"DIDIL"},{"id":"DIDIUP","category":"Study","name":"DIDI Crossover","shortName":"DIDIUP"},{"id":"DIDIDN","category":"Study","name":"DIDI Crossunder","shortName":"DIDIDN"}]`),Ff=class{id;type;category;name;format;shortName;constructor(e,t=v.Number,n=b.Common,r,i=y.FromMetaData,a){this.id=e,this.type=t,this.category=n,this.name=r,this.format=i,this.shortName=a;let o=e.charAt(0)===`_`;r??(this.name=o?e:this.id.replace(/([A-Z])/g,` $1`).trim()),this.shortName=a??this.name}},If={},Lf=!1;function Rf(e){Mf(e,B.FIELDS_SCHEMA).map(e=>{If[e.id]=new Ff(e.id,v[e.type],b[e.category],e.name,y[e.format],e.shortName)})}function zf(){return Lf||=(Rf(Pf),!0),If}var G=zf(),K={CH_ALL:`ch`,CH_DIDBECOMEACTIVE:`ch.didbecomeactive`,CH_RECREATED:`ch.recreated`,CH_RESET:`ch.reset`,CH_ANNOTATIONCHANGED:`ch.annotationchanged`,CH_ANNNEEDSCONTEXTMENU:`ch.annneedscontextmenu`,CH_CHTNEEDSCONTEXTMENU:`ch.chtneedscontextmenu`,CH_ANNSELECTIONCHANGED:`ch.annselectionchanged`,CH_ANNPOINTPICKED:`ch.annpointpicked`,CH_ANNMODIFIEDBYTOOL:`ch.annmodifiedbytool`,CH_PANEHEIGHTSCHANGED:`ch.paneheightschanged`,CH_PANESREORDERED:`ch.panesreordered`,CH_AXISSCALECHANGED:`ch.axisscalechanged`,CH_CHTLAYOUTCHANGED:`ch.chtlayoutchanged`,CH_NODATAFORMAINSYMBOL:`ch.nodataformainsymbol`,CH_CARDPLOTCLICKED:`ch.cardplotclicked`,CH_CARDPLOTREMOVED:`ch.cardplotremoved`,CH_CARDPLOTVISIBILITYCHANGED:`ch.cardplotvisibilitychanged`,CH_TOOLTIPCHANGED:`ch.tooltipchanged`,CH_LOGOCLICKED:`ch.logoclicked`,CH_SHUTDOWN:`ch.shutdown`,CH_ZOOMCHANGED:`ch.zoomchanged`,CH_ALL_DATA_PROJECTED:`ch.all.data.projected`,CH_API_ACTIONS_RECEIVED:`ch.api.actions.received`,CH_HOST_PROPS_CHANGED:`ch.host.props.changed`,CH_DEFINITION_CHANGED:`ch.definition.changed`,CH_PLOTNEEDSCONTEXTMENU:`ch.plotneedscontextmenu`,DF_ALL:`df`,DF_STREAMRECONNECTED:`df.streamreconnected`,TS_ALL:`ts`,TS_LOADING:`ts.loading`,TS_MANYCHANGED:`ts.manychaged`,TS_DATAPOINTADDED:`ts.datapointadded`,TS_DATAPOINTCHANGED:`ts.datapointchanged`,TS_TIMELINECORRECTION:`ts.timelinecorrection`,TS_EVENTSCHANGED:`ts.eventschanged`,TS_QUOTEMARKER:`ts.quotemarker`,MD_ALL:`md`,MD_CHANGED:`md.changed`,RT_ALL:`rt`,RT_QUOTE:`rt.quote`,RT_QUOTEGROUP:`rt.quotegroup`,RT_TRADE:`rt.trade`,RT_VOLUME:`rt.volume`,TL_CHANGED:`tl.changed`,ME_ALL:`me`,ME_MOUSE_OUT_SERIES:`me.mouse.out.series`,ME_MOUSE_OVER_SERIES:`me.mouse.over.series`},Bf=[G.Open,G.High,G.Low,G.Close,G.Volume,G.Change,G.PercentChange,G.PreviousClose].reduce((e,t,n)=>(e.set(t.id,1<<n),e),new Map);function Vf(...e){return e.reduce((e,t)=>Bf.has(t.id)?e|Bf.get(t.id):e,0)}var Hf=class{symbol;storage;fields=[];_updated=0;isValid=!1;constructor(e=``){this.symbol=e,this.storage=new Map,this.isValid=!1,this.resetUpdated()}get updated(){return this._updated}resetUpdated(){this._updated=0}addFields(...e){this.fields=ye(this.fields,e),this.fields.forEach(e=>{this.storage.has(e.id)||this.storage.set(e.id,null)})}update(e,t){if(this.hasField(e)){let n=e.id,r=this.storage.get(n);this.storage.set(n,t);let i=r!==t;return i&&Bf.has(n)&&(this._updated|=Bf.get(n)),i}}computeWellKnown(){let e=this.getValue(G.Close),t=this.getValue(G.PreviousClose);P(e,t)&&(this.hasField(G.Change)&&this.update(G.Change,e-t),this.hasField(G.PercentChange)&&this.update(G.PercentChange,(e-t)/t))}hasField(e){return P(this.fields)&&this.fields.some(t=>t.id===e.id)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}},Uf=class extends Hf{translated;constructor(e){super(),this.symbol=e,this.translated=Ma(this.symbol)}hasSymbol(e){return this.symbol===e}},Wf=class extends Hf{actual;constructor(e){super(B.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}},Gf=class extends Hf{constructor(e){super(),this.symbol=e}hasSymbol(e){return this.symbol===e}async ready(){return!0}hasField(e){return!1}getValue(e){return null}},Kf={previousOpen:G.PreviousOpen,previousClose:G.PreviousClose,previousHigh:G.PreviousHigh,previousLow:G.PreviousLow,weeklyPreviousClose:G.WeekPreviousClose,weeklyPreviousHigh:G.WeekPreviousHigh,weeklyPreviousLow:G.WeekPreviousLow,monthlyPreviousClose:G.MonthPreviousClose,monthlyPreviousHigh:G.MonthPreviousHigh,monthlyPreviousLow:G.MonthPreviousLow,fiftyTwoWkHigh:G.YearHigh,fiftyTwoWkLow:G.YearLow},qf={open:G.Open,high:G.High,low:G.Low,close:G.Close,lastPrice:G.Last,volume:G.Volume,netChange:G.Change,percentChange:G.PercentChange},Jf=Object.values(Kf),Yf=Object.keys(Kf),Xf=Object.keys(qf),Zf=class extends Uf{triedFetchingExtraValues=!1;includeBaseFields=!1;async ready(){return da.call(this,async()=>{let e=$().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid})}shutdown(){}getValue(e){return this.hasField(e)&&Jf.some(t=>t.id===e.id)&&super.getValue(e)===null&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,sF(`ondemand`,`/getQuote.json?symbols=${this.translated}&fields=${Yf.join(`,`)}`).then(e=>{try{let t=JSON.parse(e);if(t.status.code===200&&t.results.length===1){let e=t.results[0];Yf.forEach(t=>this.update(Kf[t],e[t])),this.includeBaseFields&&Xf.forEach(t=>this.update(qf[t],e[t])),$().getRecordSource().subject.next({topic:K.RT_QUOTE,data:{symbol:this.symbol}})}}catch{I(`Failed to fetch extra values for ${this.translated}`,`error`)}})}},Qf=class extends Zf{constructor(e){super(e),this.includeBaseFields=!0,this.supplementPreviousValues()}async ready(){return Promise.resolve(!0)}},$f=class extends Uf{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){P(t)&&(this.addFields(e),this.update(e,t))}async ready(){return da.call(this,async()=>{let e=$().config.environment===l[l.NodeJs]?null:ea(`#${B.INLINE_DATA_ELEMENT_ID}`);if(!P(e))this.isValid=!1;else{let t=JSON.parse(e);if(!(this.translated in t))this.isValid=!1;else{let e=t[this.translated].quote;this.update(G.Open,e.open),this.update(G.High,e.high),this.update(G.Low,e.low),this.update(G.Close,e.close),this.update(G.PreviousClose,e.previousClose),this.update(G.Volume,e.volume),Yf.filter(e=>e!==`previousClose`).forEach(t=>{this.addOptionalField(Kf[t],e[t])}),this.isValid=!0}}return this.isValid})}},ep=[G.Open,G.High,G.Low,G.Close,G.PreviousClose],tp=class extends Hf{mapping;resolved;model;constructor(e,t){super();let n=e=>$().getRecordSource().getRecord(e);this.resolved=e.map(([e,t])=>t),this.mapping=new Map(e.map(([e,t])=>[e,n(t)])),this.model=t;let r=ep.concat(G.Change,G.PercentChange);this.addFields(...r.filter(e=>e!==G.Volume))}async ready(){return da.call(this,async()=>{let e=Array.from(this.mapping.values()).map(e=>e.ready());return this.isValid=(await Promise.all(e)).every(e=>e),this.isValid&&this.evaluate(),this.isValid})}hasSymbol(e){return this.resolved.includes(e)}getOneValue(e){return t=>this.mapping.get(t).getValue(e)}evaluate(){ep.forEach(e=>{let t=bd(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)}),this.computeWellKnown()}};function np(e,t){return n=>n.topic===e&&n.data.symbol===t}var rp=function(e,t){return rp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},rp(e,t)};function ip(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);rp(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function ap(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function op(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function sp(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function cp(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function lp(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function up(e){return this instanceof up?(this.v=e,this):new up(e)}function dp(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof up?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function fp(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof sp==`function`?sp(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function pp(e){return typeof e==`function`}function mp(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var hp=mp(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
17
17
|
`+t.map(function(e,t){return t+1+`) `+e.toString()}).join(`
|
|
18
18
|
`):``,this.name=`UnsubscriptionError`,this.errors=t}});function gp(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var _p=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=sp(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var c=this.initialTeardown;if(pp(c))try{c()}catch(e){i=e instanceof hp?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=sp(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{bp(f)}catch(e){i??=[],e instanceof hp?i=lp(lp([],cp(i)),cp(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new hp(i)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)bp(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&gp(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&gp(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),vp=_p.EMPTY;function yp(e){return e instanceof _p||e&&`closed`in e&&pp(e.remove)&&pp(e.add)&&pp(e.unsubscribe)}function bp(e){pp(e)?e():e.unsubscribe()}var xp={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Sp={setTimeout:function(e,t){var n=[...arguments].slice(2),r=Sp.delegate;return r?.setTimeout?r.setTimeout.apply(r,lp([e,t],cp(n))):setTimeout.apply(void 0,lp([e,t],cp(n)))},clearTimeout:function(e){return(Sp.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Cp(e){Sp.setTimeout(function(){var t=xp.onUnhandledError;if(t)t(e);else throw e})}function wp(){}var Tp=(function(){return Op(`C`,void 0,void 0)})();function Ep(e){return Op(`E`,void 0,e)}function Dp(e){return Op(`N`,e,void 0)}function Op(e,t,n){return{kind:e,value:t,error:n}}var kp=null;function Ap(e){if(xp.useDeprecatedSynchronousErrorHandling){var t=!kp;if(t&&(kp={errorThrown:!1,error:null}),e(),t){var n=kp,r=n.errorThrown,i=n.error;if(kp=null,r)throw i}}else e()}function jp(e){xp.useDeprecatedSynchronousErrorHandling&&kp&&(kp.errorThrown=!0,kp.error=e)}var Mp=function(e){ip(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,yp(t)&&t.add(n)):n.destination=Bp,n}return t.create=function(e,t,n){return new Ip(e,t,n)},t.prototype.next=function(e){this.isStopped?zp(Dp(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?zp(Ep(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?zp(Tp,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(_p),Np=Function.prototype.bind;function Pp(e,t){return Np.call(e,t)}var Fp=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Lp(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Lp(e)}else Lp(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Lp(e)}},e}(),Ip=function(e){ip(t,e);function t(t,n,r){var i=e.call(this)||this,a;if(pp(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&xp.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&Pp(t.next,o),error:t.error&&Pp(t.error,o),complete:t.complete&&Pp(t.complete,o)}):a=t}return i.destination=new Fp(a),i}return t}(Mp);function Lp(e){xp.useDeprecatedSynchronousErrorHandling?jp(e):Cp(e)}function Rp(e){throw e}function zp(e,t){var n=xp.onStoppedNotification;n&&Sp.setTimeout(function(){return n(e,t)})}var Bp={closed:!0,next:wp,error:Rp,complete:wp},Vp=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function Hp(e){return e}function Up(e){return e.length===0?Hp:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Wp=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=qp(e)?e:new Ip(e,t,n);return Ap(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=Gp(t),new t(function(t,r){var i=new Ip({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[Vp]=function(){return this},e.prototype.pipe=function(){return Up([...arguments])(this)},e.prototype.toPromise=function(e){var t=this;return e=Gp(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function Gp(e){return e??xp.Promise??Promise}function Kp(e){return e&&pp(e.next)&&pp(e.error)&&pp(e.complete)}function qp(e){return e&&e instanceof Mp||Kp(e)&&yp(e)}function Jp(e){return pp(e?.lift)}function Yp(e){return function(t){if(Jp(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function Xp(e,t,n,r,i){return new Zp(e,t,n,r,i)}var Zp=function(e){ip(t,e);function t(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},t}(Mp),Qp=mp(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),$p=function(e){ip(t,e);function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t.prototype.lift=function(e){var t=new em(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Qp},t.prototype.next=function(e){var t=this;Ap(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=sp(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;Ap(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;Ap(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?vp:(this.currentObservers=null,a.push(e),new _p(function(){t.currentObservers=null,gp(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new Wp;return e.source=this,e},t.create=function(e,t){return new em(e,t)},t}(Wp),em=function(e){ip(t,e);function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},t.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},t.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??vp},t}($p),tm={now:function(){return(tm.delegate||Date).now()},delegate:void 0},nm=function(e){ip(t,e);function t(t,n){return e.call(this)||this}return t.prototype.schedule=function(e,t){return t===void 0&&(t=0),this},t}(_p),rm={setInterval:function(e,t){var n=[...arguments].slice(2),r=rm.delegate;return r?.setInterval?r.setInterval.apply(r,lp([e,t],cp(n))):setInterval.apply(void 0,lp([e,t],cp(n)))},clearInterval:function(e){return(rm.delegate?.clearInterval||clearInterval)(e)},delegate:void 0},im=function(e){ip(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return t.prototype.schedule=function(e,t){if(t===void 0&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return n===void 0&&(n=0),rm.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&rm.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error(`executing a cancelled action`);this.pending=!1;var n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,r=t.scheduler,i=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,gp(i,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(nm),am=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=tm.now,e}(),om=new(function(e){ip(t,e);function t(t,n){n===void 0&&(n=am.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return t.prototype.flush=function(e){var t=this.actions;if(this._active){t.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}},t}(am))(im),sm=om;function cm(e){return e&&pp(e.schedule)}function lm(e){return e[e.length-1]}function um(e){return cm(lm(e))?e.pop():void 0}var dm=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`});function fm(e){return pp(e?.then)}function pm(e){return pp(e[Vp])}function mm(e){return Symbol.asyncIterator&&pp(e?.[Symbol.asyncIterator])}function hm(e){return TypeError(`You provided `+(typeof e==`object`&&e?`an invalid object`:`'`+e+`'`)+` where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function gm(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var _m=gm();function vm(e){return pp(e?.[_m])}function ym(e){return dp(this,arguments,function(){var t,n,r,i;return op(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,up(t.read())];case 3:return n=a.sent(),r=n.value,i=n.done,i?[4,up(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,up(r)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function bm(e){return pp(e?.getReader)}function xm(e){if(e instanceof Wp)return e;if(e!=null){if(pm(e))return Sm(e);if(dm(e))return Cm(e);if(fm(e))return wm(e);if(mm(e))return Em(e);if(vm(e))return Tm(e);if(bm(e))return Dm(e)}throw hm(e)}function Sm(e){return new Wp(function(t){var n=e[Vp]();if(pp(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function Cm(e){return new Wp(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function wm(e){return new Wp(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,Cp)})}function Tm(e){return new Wp(function(t){var n,r;try{for(var i=sp(e),a=i.next();!a.done;a=i.next()){var o=a.value;if(t.next(o),t.closed)return}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()})}function Em(e){return new Wp(function(t){Om(e,t).catch(function(e){return t.error(e)})})}function Dm(e){return Em(ym(e))}function Om(e,t){var n,r,i,a;return ap(this,void 0,void 0,function(){var o,s;return op(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=fp(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),r.done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=c.sent(),i={error:s},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function km(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function Am(e){return e instanceof Date&&!isNaN(e)}function jm(e,t){return Yp(function(n,r){var i=0;n.subscribe(Xp(r,function(n){r.next(e.call(t,n,i++))}))})}function Mm(e,t,n){e===void 0&&(e=0),n===void 0&&(n=sm);var r=-1;return t!=null&&(cm(t)?n=t:r=t),new Wp(function(t){var i=Am(e)?+e-n.now():e;i<0&&(i=0);var a=0;return n.schedule(function(){t.closed||(t.next(a++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function Nm(e,t){return e===void 0&&(e=0),t===void 0&&(t=om),e<0&&(e=0),Mm(e,e,t)}function Pm(e,t){return Yp(function(n,r){var i=0;n.subscribe(Xp(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function Fm(e){var t=[...arguments].slice(1),n=um(t)??om,r=t[0]??null,i=t[1]||1/0;return Yp(function(t,a){var o=[],s=!1,c=function(e){var t=e.buffer;e.subs.unsubscribe(),gp(o,e),a.next(t),s&&l()},l=function(){if(o){var t=new _p;a.add(t);var r={buffer:[],subs:t};o.push(r),km(t,n,function(){return c(r)},e)}};r!==null&&r>=0?km(a,n,l,r,!0):s=!0,l();var u=Xp(a,function(e){var t,n,r=o.slice();try{for(var a=sp(r),s=a.next();!s.done;s=a.next()){var l=s.value,u=l.buffer;u.push(e),i<=u.length&&c(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}},function(){for(;o?.length;)a.next(o.shift().buffer);u?.unsubscribe(),a.complete(),a.unsubscribe()},void 0,function(){return o=null});t.subscribe(u)})}function Im(e){return Yp(function(t,n){var r=null,i=null,a=function(){i?.unsubscribe();var t=r;r=[],t&&n.next(t),xm(e()).subscribe(i=Xp(n,a,wp))};a(),t.subscribe(Xp(n,function(e){return r?.push(e)},function(){r&&n.next(r),n.complete()},void 0,function(){return r=i=null}))})}var Lm=o(((e,t)=>{function n(e){return e&&e.__esModule?e:{default:e}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Rm=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;function n(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}t.exports=e.default})),zm=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;function n(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}t.exports=e.default}));function Bm(e,t){var n=Gm(t);return n.formatToParts?Hm(n,e):Um(n,e)}var Vm={year:0,month:1,day:2,hour:3,minute:4,second:5};function Hm(e,t){try{for(var n=e.formatToParts(t),r=[],i=0;i<n.length;i++){var a=Vm[n[i].type];a>=0&&(r[a]=parseInt(n[i].value,10))}return r}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function Um(e,t){var n=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[r[3],r[1],r[2],r[4],r[5],r[6]]}var Wm={};function Gm(e){if(!Wm[e]){var t=new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:`America/New_York`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(new Date(`2014-06-25T04:00:00.123Z`));Wm[e]=t===`06/25/2014, 00:00:00`||t===`06/25/2014 00:00:00`?new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}return Wm[e]}function Km(e,t,n,r,i,a,o){var s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,i,a,o),s}var qm=36e5,Jm=6e4,Ym={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Xm(e,t,n){var r,i;if(!e||(r=Ym.timezoneZ.exec(e),r))return 0;var a;if(r=Ym.timezoneHH.exec(e),r)return a=parseInt(r[1],10),eh(a)?-(a*qm):NaN;if(r=Ym.timezoneHHMM.exec(e),r){a=parseInt(r[2],10);var o=parseInt(r[3],10);return eh(a,o)?(i=Math.abs(a)*qm+o*Jm,r[1]===`+`?-i:i):NaN}if(nh(e)){t=new Date(t||Date.now());var s=Qm(n?t:Zm(t),e);return-(n?s:$m(t,s,e))}return NaN}function Zm(e){return Km(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function Qm(e,t){var n=Bm(e,t),r=Km(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),i=e.getTime(),a=i%1e3;return i-=a>=0?a:1e3+a,r-i}function $m(e,t,n){var r=e.getTime()-t,i=Qm(new Date(r),n);if(t===i)return t;r-=i-t;var a=Qm(new Date(r),n);return i===a?i:Math.max(i,a)}function eh(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}var th={};function nh(e){if(th[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),th[e]=!0,!0}catch{return!1}}var rh=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,ih=c(Rm()),ah=c(zm()),oh=36e5,sh=6e4,ch=2,lh={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:rh};function uh(e,t){if(arguments.length<1)throw TypeError(`1 argument required, but only `+arguments.length+` present`);if(e===null)return new Date(NaN);var n=t||{},r=n.additionalDigits==null?ch:(0,ih.default)(n.additionalDigits);if(r!==2&&r!==1&&r!==0)throw RangeError(`additionalDigits must be 0, 1 or 2`);if(e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`)return new Date(e.getTime());if(typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`)return new Date(e);if(!(typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`))return new Date(NaN);var i=dh(e),a=fh(i.date,r),o=a.year,s=a.restDateString,c=ph(s,o);if(isNaN(c))return new Date(NaN);if(c){var l=c.getTime(),u=0,d;if(i.time&&(u=mh(i.time),isNaN(u)))return new Date(NaN);if(i.timeZone||n.timeZone){if(d=Xm(i.timeZone||n.timeZone,new Date(l+u)),isNaN(d))return new Date(NaN)}else d=(0,ah.default)(new Date(l+u)),d=(0,ah.default)(new Date(l+u+d));return new Date(l+u+d)}else return new Date(NaN)}function dh(e){var t={},n=lh.dateTimePattern.exec(e),r;if(n?(t.date=n[1],r=n[3]):(n=lh.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){var i=lh.timeZone.exec(r);i?(t.time=r.replace(i[1],``),t.timeZone=i[1].trim()):t.time=r}return t}function fh(e,t){var n=lh.YYY[t],r=lh.YYYYY[t],i=lh.YYYY.exec(e)||r.exec(e);if(i){var a=i[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(i=lh.YY.exec(e)||n.exec(e),i){var o=i[1];return{year:parseInt(o,10)*100,restDateString:e.slice(o.length)}}return{year:null}}function ph(e,t){if(t===null)return null;var n,r,i,a;if(e.length===0)return r=new Date(0),r.setUTCFullYear(t),r;if(n=lh.MM.exec(e),n)return r=new Date(0),i=parseInt(n[1],10)-1,yh(t,i)?(r.setUTCFullYear(t,i),r):new Date(NaN);if(n=lh.DDD.exec(e),n){r=new Date(0);var o=parseInt(n[1],10);return bh(t,o)?(r.setUTCFullYear(t,0,o),r):new Date(NaN)}if(n=lh.MMDD.exec(e),n){r=new Date(0),i=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return yh(t,i,s)?(r.setUTCFullYear(t,i,s),r):new Date(NaN)}if(n=lh.Www.exec(e),n)return a=parseInt(n[1],10)-1,xh(t,a)?hh(t,a):new Date(NaN);if(n=lh.WwwD.exec(e),n){a=parseInt(n[1],10)-1;var c=parseInt(n[2],10)-1;return xh(t,a,c)?hh(t,a,c):new Date(NaN)}return null}function mh(e){var t=lh.HH.exec(e),n,r;if(t)return n=parseFloat(t[1].replace(`,`,`.`)),Sh(n)?n%24*oh:NaN;if(t=lh.HHMM.exec(e),t)return n=parseInt(t[1],10),r=parseFloat(t[2].replace(`,`,`.`)),Sh(n,r)?n%24*oh+r*sh:NaN;if(t=lh.HHMMSS.exec(e),t){n=parseInt(t[1],10),r=parseInt(t[2],10);var i=parseFloat(t[3].replace(`,`,`.`));return Sh(n,r,i)?n%24*oh+r*sh+i*1e3:NaN}return null}function hh(e,t,n){t||=0,n||=0;var r=new Date(0);r.setUTCFullYear(e,0,4);var i=r.getUTCDay()||7,a=t*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var gh=[31,28,31,30,31,30,31,31,30,31,30,31],_h=[31,29,31,30,31,30,31,31,30,31,30,31];function vh(e){return e%400==0||e%4==0&&e%100!=0}function yh(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;var r=vh(e);if(r&&n>_h[t]||!r&&n>gh[t])return!1}return!0}function bh(e,t){if(t<1)return!1;var n=vh(e);return!(n&&t>366||!n&&t>365)}function xh(e,t,n){return!(t<0||t>52||n!=null&&(n<0||n>6))}function Sh(e,t,n){return!(e!=null&&(e<0||e>=25)||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}var Ch=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;function n(e,t){if(e==null)throw TypeError(`assign requires that input parameter not be null or undefined`);for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}t.exports=e.default})),wh=o(((e,t)=>{var n=Lm().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var r=n(Ch());function i(e){return(0,r.default)({},e)}t.exports=e.default}));function Th(e,t,n){var r=uh(e,n),i=Xm(t,r,!0),a=new Date(r.getTime()-i),o=new Date(0);return o.setFullYear(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()),o.setHours(a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()),o}var Eh=c(wh());function Dh(e,t,n){if(typeof e==`string`&&!e.match(rh)){var r=(0,Eh.default)(n);return r.timeZone=t,uh(e,r)}var i=uh(e,n),a=Km(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds()).getTime(),o=Xm(t,new Date(a));return new Date(a+o)}var Oh=`__barchartChartDebug`,kh=new WeakMap,Ah=1;function jh(){try{let e=globalThis.localStorage?.getItem(Oh);if(!e)return{};let t=JSON.parse(e);return typeof t==`object`&&t?t:{}}catch{return{}}}function Mh(){let e=globalThis,t=e.barchart_namespace?.chartDebug,n=e.__barchartChartDebug;return{...jh(),...t||{},...n||{}}}function Nh(e){return typeof e==`boolean`?e:null}function Ph(){return Nh(Mh().traceLifecycle)===!0}function Fh(e){return e===`record:post-init:stale`?{kind:`warn`,labelStyle:`color: #fff; background: #7a271a; font-weight: 700; padding: 1px 4px; border-radius: 2px;`,eventStyle:`color: #7a271a; font-weight: 700;`}:e===`record:evict`||e===`openfeed:unsubscribe`?{kind:`warn`,labelStyle:`color: #fff; background: #b42318; font-weight: 700; padding: 1px 4px; border-radius: 2px;`,eventStyle:`color: #b42318; font-weight: 700;`}:e===`record:subscribe`||e===`openfeed:subscribe`?{kind:`info`,labelStyle:`color: #fff; background: #027a48; font-weight: 700; padding: 1px 4px; border-radius: 2px;`,eventStyle:`color: #027a48; font-weight: 700;`}:e.startsWith(`gc:`)?{kind:`info`,labelStyle:`color: #111827; background: #f59e0b; font-weight: 700; padding: 1px 4px; border-radius: 2px;`,eventStyle:`color: #b54708; font-weight: 700;`}:e.startsWith(`chart:`)||e.startsWith(`plot:`)?{kind:`info`,labelStyle:`color: #fff; background: #175cd3; font-weight: 700; padding: 1px 4px; border-radius: 2px;`,eventStyle:`color: #175cd3; font-weight: 700;`}:{kind:`info`,labelStyle:`color: #fff; background: #475467; font-weight: 700; padding: 1px 4px; border-radius: 2px;`,eventStyle:`color: #344054; font-weight: 700;`}}function Ih(e,t){if(!Ph())return;let{kind:n,labelStyle:r,eventStyle:i}=Fh(e);t&&Object.keys(t).length>0?I(`%c[chart-debug]%c `+e,n,r,i,t):I(`%c[chart-debug]%c `+e,n,r,i)}function Lh(e){if(!e)return null;let t=kh.get(e);return t||(t=Ah++,kh.set(e,t)),t}var Rh=[G.Open,G.High,G.Low,G.Last,G.Close,G.TradingDay,G.PreviousClose,G.PreviousHigh,G.PreviousLow,G.PreviousOpen,G.Volume,G.Change,G.PercentChange,G.YearHigh,G.YearLow,G.WeekPreviousClose,G.WeekPreviousHigh,G.WeekPreviousLow,G.MonthPreviousClose,G.MonthPreviousHigh,G.MonthPreviousLow],zh=class{recordCache;translateSymbolBack;_subject;constructor(){this.recordCache=new Map,this.translateSymbolBack=new Map}traceRecord(e,t,n={}){let r=t;Ih(e,{symbol:r?.symbol??null,translated:r?.translated??r?.symbol??null,recordId:Lh(t),...n})}get subject(){if(!P(this._subject)){let e=Nm(Math.max(B.MINIMUM_THROTTLE,$().config.throttleMillis||0)),t=Nm(B.BACKGROUND_TAB_THROTTLE),n=()=>globalThis.document?.hidden?t:e;this._subject=new $p().pipe(Im(n),Pm(e=>e.length>0))}return this._subject}addRecordForSymbol(e,t){let n=Ma(e);n!==e&&this.translateSymbolBack.set(n,e),this.recordCache.set(e,t)}removeRecordForSymbol(e){this.recordCache.delete(e);let t=Ma(e);this.translateSymbolBack.has(t)&&this.translateSymbolBack.delete(t)}findRecordForSymbol(e){let t=this.translateSymbolBack.has(e)?this.translateSymbolBack.get(e):e;return this.recordCache.get(t)}getSupportedFields(){return Rh}makeAndCacheRecord(e,t){if(e===B.PLACEHOLDER_SYMBOL_NAME)return new Wf(B.PLACEHOLDER_SYMBOL_NAME);if(this.recordCache.has(e))return this.recordCache.get(e);let n=t(e),r=this.getSupportedFields();return n.addFields(...r),this.traceRecord(`record:create`,n),this.addRecordForSymbol(e,n),this.initializeRecord(e,n),n}initializeRecord(e,t){t.ready().then(n=>{let r=this.recordCache.get(e)??null,i=r===t;this.traceRecord(i?`record:post-init`:`record:post-init:stale`,t,{isValid:n,isCurrent:i,currentRecordId:Lh(r)}),i&&this.postInit(n,t)})}refresh(e=new Set(this.recordCache.values())){for(let t of e)t.isValid||t.symbol===B.PLACEHOLDER_SYMBOL_NAME||(fa.call(t),this.initializeRecord(t.symbol,t))}evictUnused(e,t){for(let[n,r]of this.recordCache)e.has(r)||(t(r),this.removeRecordForSymbol(n))}postInit(e,t){}},Bh=class extends zh{getRecord(e){return this.makeAndCacheRecord(e,()=>new $f(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}},Vh=class extends zh{getRecord(e){return this.makeAndCacheRecord(e,()=>new Qf(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}},Hh=class extends zh{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),$().connection.off(`marketUpdate`,this.onMarketUpdate,e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new Zf(e))}postInit(e,t){e&&$().connection.on(`marketUpdate`,this.onMarketUpdate,t.translated)}onMarketUpdate(e){if(e.type===B.REALTIME_INITIAL_QUOTE){let t=this.updateFromQuote(e,!0);this.subject.next({topic:K.RT_QUOTE,data:e,updated:t})}else if(e.type===B.REALTIME_TRADE){let t=$().connection.getMarketState().getQuote(e.symbol),n=this.updateFromQuote(t);this.subject.next({topic:K.RT_TRADE,data:e,updated:n}),e.symbol===B.DEBUG_SYMBOL&&I(`Trade\nSymbol: ${e.symbol} \t%cPrice: ${e.tradePrice} \t%cSize: ${e.tradeSize} \t%cTime: ${Yr(e.time,B.DEBUG_TIME_FORMAT)} \t%cSession: ${e.session}`,`log`,`color:#0f0`,`color:#a7a`,`color:#f96`,`color:#bee`)}else if(e.type===B.REALTIME_VOLUME){let t=this.updateFromVolume(e);t!==0&&(this.subject.next({topic:K.RT_VOLUME,data:e,updated:t}),e.symbol===B.DEBUG_SYMBOL&&I(`Volume\n Symbol: ${e.symbol} \t%cValue: ${e.value} \t%cSession: ${e.session}`,`log`,`color:#a7a`,`color:#bee`))}}updateFromQuote(e,t=!1){let n=this.findRecordForSymbol(e.symbol);n.resetUpdated(),n.update(G.Open,e.openPrice),n.update(G.High,e.highPrice),n.update(G.Low,e.lowPrice),n.update(G.Last,e.lastPrice),n.update(G.Close,e.lastPrice);let r=(e,t)=>{P(t)&&n.update(e,t)};return r(G.Volume,e.volume),n.update(G.PreviousClose,e.previousPrice),t&&(r(G.PreviousOpen,e.previousOpenPrice),r(G.PreviousHigh,e.previousHighPrice),r(G.PreviousLow,e.previousLowPrice)),n.computeWellKnown(),n.updated}updateFromVolume(e){let t=this.findRecordForSymbol(e.symbol);return t.resetUpdated(),t.update(G.Volume,e.value),t.updated}},Uh=class extends zh{localTimeZone;constructor(){super(),this.localTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone}get feed(){return $()}evictUnused(e){super.evictUnused(e,e=>{this.traceRecord(`record:evict`,e,{symbol:e.translated}),e.shutdown(),this.feed.unsubscribe(e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new Zf(e))}postInit(e,t){e&&(this.traceRecord(`record:subscribe`,t,{symbol:t.translated}),this.feed.subscribe(t.translated))}onSnapshot(e,t){let n=this.findRecordForSymbol(t),r=$().metaDataSource.getMetaData(t);if(!r.isReady)return;let i=(e,t)=>{if(N(t)){let i=r.asPrice(t);return n.update(e,i),i}};n.resetUpdated();let a=i(G.Open,e.open?.price),o=i(G.High,e.high?.price),s=i(G.Low,e.low?.price),c=i(G.Last,e.last?.price);if(N(i(G.Close,e.close?.price))||N(i(G.Close,e.settlement?.price))||i(G.Close,e.last?.price),N(e.instrumentStatus?.tradeDate)){let t=e.instrumentStatus.tradeDate%100;n.update(G.TradingDay,t)}N(e.volume?.volume)&&n.update(G.Volume,r.asQuantity(e.volume.volume));let l=this.toExchangeTime(e.transactionTime,r.timeZone);N(i(G.PreviousClose,e.prevClose?.price))||i(G.PreviousClose,e.previousSession?.settlement?.price),i(G.PreviousOpen,e.previousSession?.open?.price),i(G.PreviousHigh,e.previousSession?.high?.price),i(G.PreviousLow,e.previousSession?.low?.price),i(G.YearHigh,e.yearHigh?.price),i(G.YearLow,e.yearLow?.price),n.computeWellKnown();let u={topic:`rt.quote`,data:{symbol:t,openPrice:a,highPrice:o,lowPrice:s,lastPrice:c,tradeTime:l},updated:n.updated};this.subject.next(u)}skip(e){return e===void 0||e.blockTrade||e.doesNotUpdateLast||e.doesNotUpdateVolume}asDate(e){return!N(e)||e.isZero()?null:new Date(e.div(1e6).toNumber())}toExchangeTime(e,t){let n=this.asDate(e);return n===null?null:Th(Dh(n,this.localTimeZone),t)}onUpdate(e,t){if(!this.recordCache.has(t)){I(`[OpenFeed] update for unsubscribed symbol: ${t}`,`warn`);return}let n=$().metaDataSource.getMetaData(t);if(!n.isReady)return;let r=this.toExchangeTime(e.transactionTime,n.timeZone);if(e.trades?.trades)for(let{trade:i}of e.trades.trades){if(this.skip(i))continue;let e=n.asPrice(i.price);if(e===null)continue;let a=n.asQuantity(i.quantity),o=this.toExchangeTime(i.transactionTime,n.timeZone),s=this.findRecordForSymbol(t),[c,l,u,d]=[`High`,`Low`,`Volume`,`TradingDay`].map(e=>G[e]).map(e=>s.getValue(e));(!N(l)||e<l)&&s.update(G.Low,e),(!N(c)||e>c)&&s.update(G.High,e),s.update(G.Last,e),s.update(G.Close,e),s.update(G.Volume,(N(u)?u:0)+a),s.computeWellKnown();let f={data:{symbol:t,tradePrice:e,tradeSize:a,session:i.session,time:o??r,tradingDay:d},topic:`rt.trade`,updated:s.updated};this.subject.next(f)}}};function Wh(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return n.length>=t?e.apply(null,n.slice(0,t).reverse()):function(){var r=[...arguments];return Wh(e,t,n.concat(r))}}var Gh=Wh(un,2),Kh=Wh(Sn,2),qh=Wh(dn,2),Jh=Wh(Cn,2),Yh=Wh(wn,2),Xh=Wh(Tn,2),Zh=Wh(En,2),Qh=Wh(Yr,2),$h=Wh(mi,2);function eg(e,t){let{unit:n}=e;return n===g.Year?nr(t):n===g.Quarter?$n(t):n===g.Month?er(t):n===g.Week?gn(t):n===g.Day?vn(t):t}function tg(e,t){switch(e){case g.Tick:return Yh(t);case g.Intraday:return Kh(t);case g.Day:return Gh(t);case g.Week:return Xh(t);case g.Month:return qh(t);case g.Quarter:return Jh(t);case g.Year:return Zh(t);default:throw Error(`Unexpected aggregation unit ${g[e]}`)}}function ng(e){switch(e.unit){case g.Tick:case g.Intraday:case g.Day:return tg(e.unit,e.size);case g.Week:case g.Month:case g.Quarter:case g.Year:return tg(e.unit,1);default:throw Error(`Unexpected aggregation unit ${g[e.unit]}`)}}function rg(e,t){return t.getFullYear()-1-(t.getFullYear()-1)%e}function ig(e){return rg(10,e)}function ag(e){return rg(100,e)}function og(e,t){return ig(e)===ig(t)}function sg(e,t){return ag(e)===ig(t)}function cg(e){return new Date(e*B.OPTIONS_DATA_INCREMENT+B.OPTIONS_DATA_BASE)}function lg(e){return(e.valueOf()-B.OPTIONS_DATA_BASE)/B.OPTIONS_DATA_INCREMENT}function ug(e,t=B.ZERO_DATE){let n=new Date(`${e}T00:00:00`);return Fn(n)?n:t}function dg(e,t=B.ZERO_DATE){let n=new Date(e.replace(` `,`T`));return Fn(n)?n:t}function fg(e){return e.size-1}var pg=class{container;supportsChunks=!0;retryCountForChunk=1;constructor(){this.container=null}get base(){return this.container}ready(){return Promise.resolve()}processRetrieved(){}getFirstDate(e){return this.base.getTimeData()[0]}getLastDate(){return this.base.getLastDataPoint(G.DateTime)}prepend(e){this.base.prepend(e),this.processRetrieved()}append(e){this.base.append(e),this.processRetrieved()}},mg=class extends pg{constructor(e){super(),this.container=e,this.retryCountForChunk=B.FETCH_TICK_CHUNK_RETRY_COUNT}getFirstDate(e){let t=super.getFirstDate(0);return e>0&&e<this.retryCountForChunk?Kn(mi(t,e)):t}process(e){let t=this.container,n=t.size>0?t.getLastDataPoint(G.Last):null,r=t.getLastDataPoint(G.DateTime),i=e.time;return r!==void 0&&i<=r&&(i=pn(r,1)),t.addDataPoint(G.DateTime,i),t.addDataPoint(G.Last,e.tradePrice),t.addDataPoint(G.TradeSize,e.tradeSize),t.addDataPoint(G.Change,P(n)?e.tradePrice-n:null),t.hasField(G.TradingDay)&&t.addDataPoint(G.TradingDay,e.tradingDay),{isUpdate:!1,time:i.getTime(),index:fg(t)}}},hg=class extends pg{agg;durationAdd;constructor(e,t){super(),this.agg=t,this.container=e,this.durationAdd=ng(t)}isSameBar(e,t){switch(this.agg.unit){case g.Tick:case g.Intraday:case g.Day:return ai(t,this.durationAdd(e));case g.Week:return li(e,t);case g.Month:return di(e,t);case g.Quarter:return fi(e,t);case g.Year:return pi(e,t);default:throw Error(`Unexpected aggregation unit ${g[this.agg.unit]}`)}}fixupTimeBasedAggregationTimestamp(e){return e}isCorrection(e,t){let n=ai(t,e);return n&&I(`Currently not handling data corrections (updates of the past historical data)`,`error`),n}computeNextStamp(e,t){if(this.isCorrection(e,t))return null;let n=e;for(;!this.isSameBar(n,t);)n=this.durationAdd(n);return n}isUpdate(e,t,n,r){return oi(n,e)}getPosition(e){if(this.container.size===0){let t=this.fixupTimeBasedAggregationTimestamp(e.time);return{lastTimestamp:null,newTimestamp:t,nextTimestamp:t,isUpdate:!1}}let t=this.container.getLastDataPoint(G.DateTime),n=e.time,r=this.computeNextStamp(t,n);if(r===null)return null;let i=this.isUpdate(t,n,r,e);return i===null?null:{lastTimestamp:t,newTimestamp:n,nextTimestamp:r,isUpdate:i}}createBar(e,t,n,r,i,a,o){let s=this.container,c=s.size>0?s.getLastDataPoint(G.Close):null;s.addDataPoint(G.DateTime,a),s.addDataPoint(G.Open,e),s.addDataPoint(G.High,t),s.addDataPoint(G.Low,n),s.addDataPoint(G.Close,r),s.addDataPoint(G.Change,P(c)?r-c:null),s.addDataPoint(G.Volume,i),s.hasField(G.OpenInterest)&&s.addDataPoint(G.OpenInterest,null),s.hasField(G.TradingDay)&&s.addDataPoint(G.TradingDay,o??null)}addBar(e,t){let{nextTimestamp:n}=t,{tradePrice:r,tradingDay:i}=e;return this.createBar(r,r,r,r,e.tradeSize,n,i),{isUpdate:!1,time:n.getTime(),index:fg(this.container)}}updateLastBar(e,t,n,r){let i=this.container,a=e=>i.getLastDataPoint(e);if(P(e)&&e>a(G.High)&&i.setLastDataPoint(G.High,e),P(t)&&t<a(G.Low)&&i.setLastDataPoint(G.Low,t),P(n)){i.setLastDataPoint(G.Close,n);let e=i.getData(G.Close)[i.size-2];i.setLastDataPoint(G.Change,n-e)}if(P(r)){let e=i.getLastDataPoint(G.Volume)+r;i.setLastDataPoint(G.Volume,e)}}changeLastBar(e,t){let{lastTimestamp:n}=t;if(n==null)return null;let r=e.tradePrice;return this.updateLastBar(r,r,r,e.tradeSize),{isUpdate:!0,time:n.getTime(),index:fg(this.container)}}process(e){let t=this.getPosition(e);if(t===null)return null;let n=Qh(B.DEBUG_TIME_FORMAT);return t.isUpdate?(e.symbol===B.DEBUG_SYMBOL&&I(`Adding ${this.agg.describe()} Bar\nBars %cnot same %c${n(t.lastTimestamp)} < ${n(t.newTimestamp)} %cnext is %c${n(t.nextTimestamp)}`,`log`,`color:#f00`,`color:#f96`,``,`color:#fff`),this.changeLastBar(e,t)):P(e.tradePrice)?(e.symbol===B.DEBUG_SYMBOL&&I(`Updating ${this.agg.describe()} Bar\nBars %csame %c${n(t.lastTimestamp)} == ${n(t.newTimestamp)}`,`log`,`color:#0f0`,`color:#f96`),this.addBar(e,t)):null}alignToQuote(e){if(P(e.lastPrice,e.time))return this.updateLastBar(e.highPrice,e.lowPrice,e.lastPrice,void 0),{isUpdate:!0,time:e.time.getTime(),index:fg(this.container)}}},gg=class extends hg{innerBuilder;constructor(e,t,n){super(t,n),this.innerBuilder=e,this.processRetrieved()}get base(){return this.innerBuilder.container}fixupTimeBasedAggregationTimestamp(e){return mi(e,zn(e,B.START_OF_LAST_CENTURY)%this.agg.size)}processRetrieved(){this.container.clear();for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.base.getData(G.DateTime)[e],tradeSize:0,tradePrice:0,tradingDay:0};[G.Open,G.High,G.Low].forEach(n=>{t.tradePrice=this.base.getData(n)[e],super.process(t)}),t.tradePrice=this.base.getData(G.Close)[e],t.tradeSize=this.base.getData(G.Volume)[e],super.process(t)}}process(e){return this.innerBuilder.process(e),super.process(e)}},_g=class{fields;storage={};constructor(e){this.fields=e,this.clear()}clear(){this.storage={},this.fields.forEach(e=>{this.storage[e.id]=[]})}fixupTransition(e,t){if(e!==G.Change||!this.hasField(G.Close)||t<1)return;let n=this.storage[e.id],r=this.storage[G.Close.id];n[t]=r[t]-r[t-1]}concat(e,t,n){this.storage[e.id]=t.concat(n),this.fixupTransition(e,t.length)}prependData(e,t){this.checkField(e),this.concat(e,t,this.getData(e))}prepend(e){let t=e.getLastDataPoint(G.DateTime),n=this.getTimeData()[0],r=P(t)&&P(n)&&t.getTime()===n.getTime(),i=e.size;e.fields.forEach(t=>{r&&e.getData(t).splice(i-1,1),this.prependData(t,e.getData(t))})}appendData(e,t){this.checkField(e),this.concat(e,this.getData(e),t)}append(e){let t=e.getTimeData()[0],n=this.getLastDataPoint(G.DateTime),r=P(t)&&P(n)&&t.getTime()===n.getTime(),i=this.size;return e.fields.forEach(t=>{r&&this.getData(t).splice(i-1,1),this.appendData(t,e.getData(t))}),e.size-+!!r}getTimeData(){return this.getData(G.DateTime)}getData(e){return this.storage[e.id]}setData(e,t){this.checkField(e),this.storage[e.id]=t}hasField(e){return this.fields.findIndex(t=>t.id===e.id)!==-1}get size(){return this.fields.length===0?0:this.getData(this.fields[0]).length}get isEmpty(){return this.size===0}checkField(e){if(!this.hasField(e))throw Error(`This container does not store values for field ${e.id}`)}addDataPoint(e,t){this.checkField(e),this.getData(e).push(t)}getLastDataPoint(e){return this.checkField(e),xe(this.getData(e))}setLastDataPoint(e,t){this.checkField(e);let n=this.getData(e);n[n.length-1]=t}keepOnlyLast(e){if(this.size<=e)return;let t=this.size-e;this.fields.forEach(e=>this.getData(e).splice(0,t))}},vg=class extends _g{constructor(){super([])}get size(){return 0}},yg=class extends _g{wrapper;constructor(e,t){super(e),this.wrapper=t}isWrapped(e){return nt(this.wrapper,e.id)}hasField(e){return this.isWrapped(e)||super.hasField(e)}getData(e){return this.isWrapped(e)?this.wrapper[e.id]():super.getData(e)}},bg=B.RENKO_KAGI_NAMES;function xg(e){let{Method:t,Period:n,Source:r,BrickSize:i}=dt(e);return{method:et(t,[bg.ATR,bg.TRD,bg.PCT],bg.ATR),period:Number.isFinite(n)?n:14,source:et(r,[bg.CLS,bg.HL],bg.CLS),brickSize:Number.isFinite(i)?i:10}}function Sg(e,t,n){return e.getData(t)[n]}function Cg(e,t){let[n,r]=[G.High,G.Low].map(n=>Sg(e,n,t)),i=Sg(e,G.Close,t-1);return Math.max(n-r,Math.abs(n-i),Math.abs(r-i))}function wg(e,t){let n=Math.ceil(t);if(!Number.isFinite(n)||n<1||e.size<n)return null;let r=n-1,i=[];i.push(Sg(e,G.High,0)-Sg(e,G.Low,0));for(let t=1;t<n;++t)i.push(Cg(e,t));let a=me(i);for(let t=n;t<e.size;++t){let i=Cg(e,t);a=(a*r+i)/n}return a}var Tg=e=>G[e],Eg=[`DateTime`,`Open`,`High`,`Low`,`Close`,`Volume`].map(Tg),Dg=Eg.concat([`Change`,`Projection`,`BarIndex`].map(Tg)),Og=class extends pg{innerBuilder;inputs;brickSize;lastFinalBrick;projectionCount;refPrices;constructor(e,t){super(),this.supportsChunks=!1,this.innerBuilder=e,this.inputs=F(t.inputs),this.brickSize=null,this.container=new _g(Dg),this.processRetrieved()}get base(){return this.innerBuilder.container}baseVal(e,t){return this.base.getData(e)[t]}isLastBase(e){return e===this.base.size-1}getValuesAt(e,t){let[n,r,i,a,o,s]=Eg.map(n=>t.getData(n)[e]);return{date:n,open:r,high:i,low:a,close:o,volume:s}}getBrickAt(e){return this.getValuesAt(e,this.container)}getBarAt(e){return this.getValuesAt(e,this.base)}getBricksCount(e){return Math.floor(e/this.brickSize)}getMove(e,t,n){let[r,i]=this.refPrices(t.close,t.high,t.low),a=r-e.high,o=e.low-i;return{climbing:(n&&a>0||a>=this.brickSize)&&a>=o,falling:(n&&o>0||o>=this.brickSize)&&o>a,moveUp:a,moveDown:o}}initFirstBrick(e,t){e.open=e.high=e.low=e.close=Math.max(this.brickSize,Xe(t.close-t.close%this.brickSize,4)),e.date=t.date,e.volume=e.change=0}findSafeStartIndex(){let e=0,t=this.base.size-1,n=2*B.RENKO_MAX_BARS;for(;t>0&&e<n;){let n=Cg(this.base,t);e+=Math.floor(n/this.brickSize),t--}return t}processRetrieved(){let e=xg(this.inputs),{method:t,period:n,source:r}=e;if(this.brickSize=e.brickSize,t===bg.ATR)this.brickSize=wg(this.base,n);else if(t===bg.PCT)if((this.base?.size??0)>0){let e=this.base.getLastDataPoint(G.Close);this.brickSize=e*this.brickSize/100}else this.brickSize=null;if(!P(this.brickSize))return;let i=(e,t,n)=>[t,n],a=(e,t,n)=>[e,e];this.refPrices=r===bg.HL?i:a;let o={},s=this.findSafeStartIndex();for(let e=s;e<this.base.size;e++){let t=this.getBarAt(e);if(e===s){this.initFirstBrick(o,t);continue}let n=this.isLastBase(e),{climbing:r,falling:i,moveUp:a,moveDown:c}=this.getMove(o,t,n);if(!r&&!i){o.volume+=t.volume;continue}o.proj=Number(n),o.barIndex=e;let l=t.date.getTime();if(r){let e=this.getBricksCount(a);for(let t=0;t<e;++t)this.constructClimbing(o,l,t,this.brickSize);n&&(this.constructClimbing(o,l,e,a%this.brickSize),this.projectionCount=e+1)}else if(i){let e=this.getBricksCount(c);for(let t=0;t<e;++t)this.constructFalling(o,l,t,this.brickSize);n&&(this.constructFalling(o,l,e,c%this.brickSize),this.projectionCount=e+1)}n||(this.lastFinalBrick=this.container.size-1,o.volume=0)}this.container.keepOnlyLast(B.RENKO_MAX_BARS)}constructClimbing(e,t,n,r,i=!0){let a=e.high,o=e.close;e.open=e.low=a,e.high=e.close=a+r,e.date=new Date(t+n),e.change=e.close-o,i?this.addToContainer(e):this.updateLastDataPoint(e)}constructFalling(e,t,n,r,i=!0){let a=e.low,o=e.close;e.open=e.high=a,e.low=e.close=a-r,e.date=new Date(t+n),e.change=e.close-o,i?this.addToContainer(e):this.updateLastDataPoint(e)}process(e){let t=this.innerBuilder.process(e);return this.processUpdate(t)}alignToQuote(e){let t=this.innerBuilder.alignToQuote(e);return this.processUpdate(t)}rebuild(){return this.container.clear(),this.processRetrieved(),{isUpdate:!1,time:0,index:-1}}processUpdate(e){if(!Number.isFinite(this.lastFinalBrick))return null;let t=this.base.size-1,n=this.getBarAt(t),r=this.getBrickAt(this.lastFinalBrick),{climbing:i,falling:a,moveUp:o,moveDown:s}=this.getMove(r,n,!0),c=this.container.getLastDataPoint(G.Projection)===1;if(!i&&!a)return c?this.rebuild():null;let l=i?o:s,u=this.getBricksCount(l)+1;if(c&&this.projectionCount===u){let e=this.getBrickAt(this.container.size-1),r=this.getBrickAt(Math.min(this.container.size-2,0));return e.proj=1,e.barIndex=t,e.open===e.high?e.low=e.close=n.close:e.open===e.low&&(e.high=e.close=n.close),e.change=e.close-r.close,this.updateLastDataPoint(e),{isUpdate:!0,time:e.date.getTime(),index:this.container.size-1}}else return this.rebuild()}addToContainer(e){let t=this.container;t.addDataPoint(G.DateTime,e.date),t.addDataPoint(G.Open,e.open),t.addDataPoint(G.Close,e.close),t.addDataPoint(G.High,e.high),t.addDataPoint(G.Low,e.low),t.addDataPoint(G.Change,e.change),t.addDataPoint(G.Volume,e.volume),t.addDataPoint(G.Projection,e.proj),t.addDataPoint(G.BarIndex,e.barIndex)}updateLastDataPoint(e){let t=this.container;t.setLastDataPoint(G.DateTime,e.date),t.setLastDataPoint(G.Open,e.open),t.setLastDataPoint(G.Close,e.close),t.setLastDataPoint(G.High,e.high),t.setLastDataPoint(G.Low,e.low),t.setLastDataPoint(G.Change,e.change),t.setLastDataPoint(G.Volume,e.volume),t.setLastDataPoint(G.Projection,e.proj),t.setLastDataPoint(G.BarIndex,e.barIndex)}},kg=[G.DateTime,G.TradingDay,G.Last,G.TradeSize,G.Change],Ag=[G.DateTime,G.Open,G.High,G.Low,G.Close,G.Volume,G.Change],jg=[...Ag,G.OpenInterest],Mg=[...jg,G.Symbol],Ng=[G.Open,G.High,G.Low,G.Close,G.Change];function Pg(e,t){let n=Hi(e);if(t.isTick)return kg;{let e=Ag;return t.isMultiContract?e=Mg:(n||t.isEndOfDay)&&(e=jg),t.isIntraday?[...e,G.TradingDay]:e}}var Fg=class{useLastTrade;symbol;aggregation;offset;container;previousTime;timeZone;isFuture;needsResolution;hasOpenInterest;padded;constructor(e,t,n=0,r=!1,i=!1){this.useLastTrade=i,this.symbol=e,this.aggregation=t,this.offset=n||0,this.previousTime=new Date(0),this.timeZone=this.getTimeZone(),this.isFuture=Ei(e),this.padded=r,this.needsResolution=Vi(e),this.hasOpenInterest=Hi(e)}makeContainer(){return new _g(Pg(this.symbol,this.aggregation))}parse(e){this.container=this.makeContainer();let t=e.split(`
|
|
19
19
|
`),n=this.getParseFunc();if(n!==null){let e=n.bind(this);t.forEach(t=>{let n=t.trim();n&&e(n.split(`,`))})}return this.container}getParseFunc(){return this.aggregation.isTick?this.parseTick:this.aggregation.isIntraday?this.parseMinutes:this.parseEod}parseTick(e){let t=e.length-5;(t===0||t===1)&&(this.container.addDataPoint(G.DateTime,this.parseDate(e[0+t])),this.container.addDataPoint(G.TradingDay,parseInt(e[1+t])),this.container.addDataPoint(G.Last,parseFloat(e[3+t])),this.container.addDataPoint(G.TradeSize,parseInt(e[4+t])),this.container.addDataPoint(G.Change,this.calculateChange(G.Last)))}nullify(e){return e==null||e===0?null:e}parseMinutes(e){let t=this.aggregation.isMultiContract&&this.isFuture||this.needsResolution,n=+!!t;e.length===7+n&&(this.container.hasField(G.Symbol)&&this.container.addDataPoint(G.Symbol,t?e[0]:this.symbol),this.container.addDataPoint(G.DateTime,this.parseDate(e[0+n])),this.container.addDataPoint(G.TradingDay,parseInt(e[1+n])),this.container.addDataPoint(G.Open,parseFloat(e[2+n])),this.container.addDataPoint(G.High,parseFloat(e[3+n])),this.container.addDataPoint(G.Low,parseFloat(e[4+n])),this.container.addDataPoint(G.Close,parseFloat(e[5+n])),this.container.addDataPoint(G.Volume,this.nullify(parseInt(e[6+n]))),this.container.addDataPoint(G.Change,this.calculateChange()))}parseFloatOrNull(e){let t=parseFloat(e);return isNaN(t)&&this.padded?null:t}parseIntOrNull(e){let t=parseInt(e);return isNaN(t)&&this.padded?null:t}parseEod(e){let t=this.aggregation.isMultiContract,n=+!!this.useLastTrade,r=7+n+ +!!this.hasOpenInterest;if(e.length!==r)return;t&&this.container.addDataPoint(G.Symbol,e[0]),this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.Open,this.parseFloatOrNull(e[2])),this.container.addDataPoint(G.High,parseFloat(e[3])),this.container.addDataPoint(G.Low,parseFloat(e[4]));let i=this.useLastTrade&&e[5]!==``?e[5]:e[5+n];this.container.addDataPoint(G.Close,parseFloat(i)),this.container.addDataPoint(G.Volume,this.nullify(this.parseIntOrNull(e[6+n]))),this.hasOpenInterest&&this.container.addDataPoint(G.OpenInterest,this.nullify(this.parseIntOrNull(e[7+n]))),this.container.addDataPoint(G.Change,this.calculateChange())}calculateChange(e=G.Close){let t=this.container.size;if(t>1){let n=this.container.getData(e);return n[t-1]-n[t-2]}else return 0}parseTimestamp(e){switch(this.aggregation.unit){case g.Tick:case g.Intraday:return dg(e);default:return ug(e)}}parseDate(e){let t=this.parseTimestamp(e);return this.aggregation.isEndOfDay?En(t,this.offset):(ii(t,this.previousTime)?this.previousTime=t:this.previousTime=pn(this.previousTime,1),this.previousTime)}getTimeZone(){return Ui(this.symbol)}},Ig=class extends Fg{makeContainer(){return new _g([G.DateTime,G.TradingDay,G.Symbol,G.Bid,G.BidSize,G.Ask,G.AskSize])}getParseFunc(){return this.parseTopOfBook}getTopOfBookPayload(e){if(e.length<7)return null;let t=e[0],n=t===`Q`||t===`T`;if(n&&t!==`Q`)return null;let r=+!!n,i=7+r;if(e.length!==i&&e.length!==i+1)return null;let a=e.length===i+1,o=r+ +!!a,s=o+1,c=o+3,l=o+4,u=o+5,d=o+6;return{symbol:a?e[o-1]:this.symbol,timestamp:e[o],tradingDay:parseInt(e[s]),bid:parseFloat(e[c]),bidSize:parseInt(e[l]),ask:parseFloat(e[u]),askSize:parseInt(e[d])}}parseTopOfBook(e){let t=this.getTopOfBookPayload(e);t!==null&&(this.container.addDataPoint(G.DateTime,this.parseDate(t.timestamp)),this.container.addDataPoint(G.TradingDay,t.tradingDay),this.container.addDataPoint(G.Symbol,t.symbol),this.container.addDataPoint(G.Bid,t.bid),this.container.addDataPoint(G.BidSize,t.bidSize),this.container.addDataPoint(G.Ask,t.ask),this.container.addDataPoint(G.AskSize,t.askSize))}},{BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:Lg,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:Rg}=B,zg=[_.PerCount,_.PerVolume,_.PerSeconds],Bg=class{supportsChunks;constructor(){this.supportsChunks=!0}getPageNameFor(e,t){switch(e.unit){case g.Tick:return B.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case g.Intraday:return t&&e.spec===_.Nearest?Lg:Rg;case g.Day:case g.Week:case g.Month:case g.Quarter:case g.Year:return B.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return``}}addExtraParams(e){}makeUrl(e){let t={},n=Ma(e.symbol);t.symbol=n;let r=e.aggregation,i=this.getDataParam(r);i.length>0&&(t.data=i),r.size>1&&r.unit===g.Intraday&&(t.interval=(r.spec===_.PerRange?1:r.size).toString());let[a,o]=e.range,s=a!==null,c=o!==null;if(s&&(t.start=this.toHistoricalFeedDate(a,r)),!s||e.alwaysUseBarsToFetch){let n=e.barsToFetch||B.DEFAULT_MAX_RECORDS;r.unit===g.Tick&&zg.includes(r.spec)&&(n*=B.TICK_CUSTOM_AGG_MULTIPLIER),t.maxrecords=n.toString()}c&&(t.end=this.toHistoricalFeedDate(o,r)),t.volume=r.isContractVolume?`contract`:`total`,t.order=`asc`,t.dividends=r.dividendsAdjust.toString(),t.backadjust=r.backAdjust.toString(),t.daystoexpiration=r.daysToExpiration.toString(),t.contractroll=r.contractRoll,r.isTick&&(t.type=`T`,t.skipOldEmulation=`true`),r.isEndOfDay&&e.useLastTrade&&(t.lasttrade=`true`),e.extendedHours===!0&&(t.formt=`true`),t.splits=(e?.splits??!0).toString(),t.padded=(e.padded??!1).toString(),this.addExtraParams(t);let l=mt(t),u=Ei(n);return`/${this.getPageNameFor(r,u)}?${l}`}toHistoricalFeedDate(e,t){return Yr(e,t.isTick||t.isIntraday?B.FMT_HIST_FEED_PARAM_DATE_TIME:B.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(e){let t=``,n=this.getSpecPart(e);switch(e.unit){case g.Tick:case g.Intraday:break;case g.Day:t=`daily${n}`;break;case g.Week:t=`weekly${n}`;break;case g.Month:t=`monthly${n}`;break;case g.Quarter:t=`quarterly${n}`;break;case g.Year:t=`yearly${n}`;break}return t}getSpecPart(e){return e.isMultiContract?e.spec===_.Continue?`continue`:`nearest`:``}getParser(e){return new Fg(Ma(e.symbol),e.aggregation,e.offset,e.padded,e.useLastTrade)}async retrieve(e){let t=this.makeUrl(e),n=await sF(e.aggregation.unit===g.Tick?`timeseriesNew`:`timeseries`,t);return this.getParser(e).parse(n)}},Vg=class extends Bg{addExtraParams(e){e.type=`B`}getParser(e){return new Ig(Ma(e.symbol),e.aggregation,e.offset)}async retrieve(e){let t=await sF(`timeseriesNew`,this.makeUrl(e));return this.getParser(e).parse(t)}},Hg=class{supportsChunks;constructor(){this.supportsChunks=!1}addExtraParams(e){}async retrieve(e){let t=Ma(e.symbol),n=this.emptyContainer(t,e.aggregation);if(e.aggregation.unit!==g.Day)return n;let r={symbol:t};this.addExtraParams(r);let i=await sF(`ondemand`,`/${this.getPageName()}.json?${mt(r)}`);try{let e=JSON.parse(i);if(e.status.code===200){let t=e.results;if(this.iterateForward)for(let e=0;e<t.length;e++)this.processRow(t[e],e,n);else for(let e=t.length-1;e>=0;e--)this.processRow(t[e],e,n);return n}}catch(e){I(`Failed parsing the JSON result from OnDemand, error is ${e.message}`)}return n}},Ug={WeighImplVolHigh:`weightedImpliedVolatility`,WeighImplVolLow:`weightedImpliedVolatility`,WeighImplVol:`weightedImpliedVolatility`,WeighImplVolHigh5D:`weightedImpliedVolatilityHigh5d`,WeighImplVolLow5D:`weightedImpliedVolatilityLow5d`,WeighImplVol5D:`weightedImpliedVolatility5d`,WeighImplVolHigh1M:`weightedImpliedVolatilityHigh1m`,WeighImplVolLow1M:`weightedImpliedVolatilityLow1m`,WeighImplVol1M:`weightedImpliedVolatility1m`,WeighImplVolHigh3M:`weightedImpliedVolatilityHigh3m`,WeighImplVolLow3M:`weightedImpliedVolatilityLow3m`,WeighImplVol3M:`weightedImpliedVolatility3m`,WeighImplVolHigh6M:`weightedImpliedVolatilityHigh6m`,WeighImplVolLow6M:`weightedImpliedVolatilityLow6m`,WeighImplVol6M:`weightedImpliedVolatility6m`,WeighImplVolHigh1Y:`weightedImpliedVolatilityHigh1y`,WeighImplVolLow1Y:`weightedImpliedVolatilityLow1y`,WeighImplVol1Y:`weightedImpliedVolatility1y`,WeighImplVolHighYTD:`weightedImpliedVolatilityHighYtd`,WeighImplVolLowYTD:`weightedImpliedVolatilityLowYtd`,WeighImplVolYTD:`weightedImpliedVolatilityYtd`,WeighImplVolChg:`weightedImpliedVolatilityChange`,ImplVolRank5D:`impliedVolatilityRank5d`,ImplVolRank1M:`impliedVolatilityRank1m`,ImplVolRank3M:`impliedVolatilityRank3m`,ImplVolRank6M:`impliedVolatilityRank6m`,ImplVolRank1Y:`impliedVolatilityRank1y`,ImplVolRankYTD:`impliedVolatilityRankYtd`,ImplVolPerc5D:`impliedVolatilityPercentile5d`,ImplVolPerc1M:`impliedVolatilityPercentile1m`,ImplVolPerc3M:`impliedVolatilityPercentile3m`,ImplVolPerc6M:`impliedVolatilityPercentile6m`,ImplVolPerc1Y:`impliedVolatilityPercentile1y`,ImplVolPercYTD:`impliedVolatilityPercentileYtd`,OptTotVol:`totalVolume`,OptCallVol:`callVolume`,OptPutVol:`putVolume`,PutCallVolRatio:`putCallVolumeRatio`,TotalOpenInt:`totalOpenInterest`,CallOpenInt:`callOpenInterest`,PutOpenInt:`putOpenInterest`,PutCallOIRatio:`putCallOpenInterestRatio`,DateTime:`date`},Wg=class{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){let t=Ma(e.symbol).replace(/\.bz$/i,``),n=e.fields.concat(G.DateTime),r=()=>new _g(n);if(e.aggregation.unit!==g.Day)return r();let i=await sF(`options`,`/get?${mt({symbol:t,apiKey:`default`,fields:n.map(e=>Ug[e.id]).join(`,`)})}`);try{let e=JSON.parse(i).data,t=r(),a=e=>Number.parseFloat(e.replace(/,/g,``));return e.forEach(e=>{n.forEach(n=>{n===G.DateTime?t.addDataPoint(G.DateTime,ug(e.date)):t.addDataPoint(n,a(e[Ug[n.id]]))})}),t}catch(e){I(`Failed parsing options JSON historical data result, error is ${e.message}`)}return r()}},Gg=class extends hg{innerBuilder;isBuildingBars;constructor(e,t,n){super(t,n),this.innerBuilder=e,this.isBuildingBars=!1,this.retryCountForChunk=B.FETCH_TICK_CHUNK_RETRY_COUNT,this.processRetrieved()}get base(){return this.innerBuilder.container}getFirstDate(e){return this.innerBuilder.getFirstDate(e)}get startFromIndex(){return 0}processRetrieved(){this.container.clear(),this.isBuildingBars=!0;let[e,t,n,r]=[G.DateTime,G.TradeSize,G.Last,G.TradingDay].map(e=>this.base.getData(e));for(let i=this.startFromIndex;i<this.base.size;i++){let a={isTrade:!0,time:e[i],tradeSize:t[i],tradePrice:n[i],tradingDay:r[i]};super.process(a)}this.isBuildingBars=!1}process(e){let t=this.innerBuilder.process(e);return e.time=new Date(t.time),super.process(e)}},Kg=class extends Gg{constructor(e,t,n){super(e,t,n)}fixupTimeBasedAggregationTimestamp(e){return gi(e,Xn(e,er(hi(e,1)))%this.agg.size)}},qg=class extends Gg{series;constructor(e,t,n,r){super(e,n,r),this.series=t}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}},Jg=new Ff(`_TICK_COUNT`),Yg=class extends qg{anchorTimestamp=null;constructor(e,t,n,r){super(e,t,n,r)}get startFromIndex(){let e=0,t=this.base.getTimeData();if(P(this.anchorTimestamp))e=Ce(t,e=>e===this.anchorTimestamp);else{let n=this.base.size;if(n>2)for(let r=n-2;r>2;--r){let n=t[r].valueOf();if(n-t[r-1].valueOf()>1&&t[r+1].valueOf()-n>1){e=r;break}}this.anchorTimestamp=t[e]}return e>this.agg.size&&(e%=this.agg.size),Math.max(e,0)}addBar(e,t){let n=super.addBar(e,t);return this.container.addDataPoint(Jg,1),n}changeLastBar(e,t){let n=super.changeLastBar(e,t),r=this.container.getLastDataPoint(Jg);return this.container.setLastDataPoint(Jg,r+1),n}isUpdate(e,t,n,r){return this.container.getLastDataPoint(Jg)<this.agg.size}},Xg=new Ff(`_VOLUME_TALLY`),Zg=class extends qg{constructor(e,t,n,r){super(e,t,n,r)}addBar(e,t){let n=this.container,r=(n.getLastDataPoint(Xg)||0)+e.tradeSize,i=Math.floor(r/this.agg.size),a=r%this.agg.size,o=r<this.agg.size;n.size>0&&(n.setLastDataPoint(G.Volume,o?1:i),n.setLastDataPoint(Xg,r));let s=super.addBar(e,t);return n.setLastDataPoint(G.Volume,1),n.addDataPoint(Xg,o?0:a),s}changeLastBar(e,t){let n=this.container,r=super.changeLastBar(e,t);n.setLastDataPoint(G.Volume,1);let i=n.getLastDataPoint(Xg)??0;return n.setLastDataPoint(Xg,i+e.tradeSize),r}isUpdate(e,t,n,r){if(!Nn(e,t))return!1;let i=this.container.getLastDataPoint(Xg)??0;return r.tradeSize+i<this.agg.size}},Qg=class extends hg{innerBuilder;metadata;range;step;constructor(e,t,n,r){super(t,n),this.innerBuilder=e,this.range=n.size,this.step=1;let i=$().getMetaDataSource();this.metadata=i.getMetaData(r)}get priceRange(){return this.step*this.range}get base(){return this.innerBuilder.container}ready(){return da.call(this,async()=>{let e=await this.metadata.ready();return e&&(this.step=this.metadata.minMovement,this.processRetrieved()),e})}processRetrieved(){this.container.clear();for(let e=0;e<this.base.size;e++){let t=this.base.getData(G.Volume)[e],n=this.useHighOrLow(e);if(!P(n)){this.updateLastBar(void 0,void 0,void 0,t);continue}let r={isTrade:!0,time:this.base.getData(G.DateTime)[e],tradeSize:t,tradePrice:n,tradingDay:0};super.process(r)}}useHighOrLow(e){let t=this.base.getData(G.Close)[e];if(this.container.size==0)return t;let n=this.container.getLastDataPoint(G.High),r=this.container.getLastDataPoint(G.Low),i=this.base.getData(G.High)[e],a=this.base.getData(G.Low)[e],o=i>n,s=a<r;if(o&&s)return i-t<t-a?i:a;if(o)return i;if(s)return a}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}isUpdate(e,t,n,r){return!0}process(e){return this.innerBuilder.process(e),super.process(e)}changeLastBar(e,t){let n=e.tradePrice,r=this.container.getLastDataPoint(G.Low)+this.priceRange;if(n>r)return this.changeAndAddBar(r,e,t);let i=this.container.getLastDataPoint(G.High)-this.priceRange;return n<i?this.changeAndAddBar(i,e,t):super.changeLastBar(e,t)}changeAndAddBar(e,t,n){return this.updateLastBar(e,e,e,0),this.container.setLastDataPoint(G.Projection,0),this.addBar(t,n)}addBar(e,t){return this.container.addDataPoint(G.Projection,1),super.addBar(e,t)}},$g=[G.Open,G.High,G.Low,G.Close],e_=[G.BARCOLIX,G.High,G.Low],t_=B.RENKO_KAGI_NAMES;function n_(e){let{BoxSizeMethod:t,Period:n,ReversalAmount:r}=dt(e);return{method:et(t,[t_.ATR,t_.TRD],t_.ATR),period:Number.isFinite(n)?n:14,reversal:Number.isFinite(r)?r:30}}var r_=class extends hg{innerBuilder;inputs;reversal;isProcessingRetrieved=!1;constructor(e,t,n){super(t,n.aggregation),this.innerBuilder=e,this.inputs=F(n.inputs),this.reversal=null,this.processRetrieved()}get base(){return this.innerBuilder.container}_at(e,t,n){return e.getData(t)[n]}baseAt(e,t){return this._at(this.base,e,t)}dataAt(e,t){return this._at(this.container,e,t)}getLast(e){return this.container.getLastDataPoint(e)}setLast(e,t){this.container.setLastDataPoint(e,t)}computeNextStamp(e,t){return t}addBar(e,t){if(super.addBar(e,t),this.container.addDataPoint(G.BARCOLIX,null),this.container.size>1){let e=this.dataAt(G.Close,this.container.size-2);this.setLast(G.Open,e),this.updateLastBar(e,e)}return null}isUpdate(e,t,n,r){let i=r.tradePrice,a=e=>e>=0,o=i-this.getLast(G.Close),s=a(o),c=Math.abs(o)>=this.reversal,[l,u,d,f]=$g.map(e=>this.getLast(e)),p=f-l,m=a(p)!==s||p===0;return m&&!c||!m&&(s?i<u:i>d)?null:Math.abs(p)<this.reversal||!m||!c}computeBarColor(){let e=e=>this.dataAt(G.Close,e)>this.dataAt(G.Open,e),t=this.container.size;if(t>1){let n=e(t-1),[r,i,a]=e_.map(e=>this.dataAt(e,t-2)),[,o,s]=e_.map(e=>this.dataAt(e,t-1)),c=r;r===0&&n&&o>i?c=1:r===1&&!n&&s<a&&(c=0),this.setLast(G.BARCOLIX,c)}else this.setLast(G.BARCOLIX,+!!e(0))}process(e){this.isProcessingRetrieved||this.innerBuilder.process(e);let t=super.process(e);return this.computeBarColor(),t}processRetrieved(){let{method:e,period:t,reversal:n}=n_(this.inputs);if(this.reversal=n,e===t_.ATR&&(this.reversal=wg(this.base,t)),P(this.reversal)){this.container.clear(),this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.baseAt(G.DateTime,e),tradePrice:this.baseAt(G.Close,e),tradeSize:this.baseAt(G.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}};function i_(e){let{LineCount:t}=dt(e);return{lineBreak:Number.isFinite(t)?t:3}}var a_=class extends hg{innerBuilder;lineBreak;currentVolume;inputs;constructor(e,t,n,r){super(t,n),this.innerBuilder=e,this.inputs=F(r.inputs);let i=i_(this.inputs);this.lineBreak=i.lineBreak,this.currentVolume=0,this.processRetrieved()}get base(){return this.innerBuilder.container}readTrade(e){return{isTrade:!0,time:this.base.getData(G.DateTime)[e],tradeSize:this.base.getData(G.Volume)[e],tradePrice:this.base.getData(G.Close)[e],tradingDay:0}}processRetrieved(){if(this.container.clear(),!(this.base.size<2)){this.startLine(this.readTrade(1));for(let e=1;e<this.base.size-1;e++){let t=this.readTrade(e);this.insertBar(t,t.time)}super.process(this.readTrade(this.base.size-1))}}process(e){return this.innerBuilder.process(e),super.process(e)}updateLastBar(e,t,n,r){let i=this.findOpen(n,0,1);this.currentVolume+=r,i===null?this.resetProjection():(super.updateLastBar(void 0,void 0,n,void 0),this.container.setLastDataPoint(G.Open,i),this.container.setLastDataPoint(G.Low,Math.min(i,n)),this.container.setLastDataPoint(G.High,Math.max(i,n)))}resetProjection(){let e=this.container;e.setLastDataPoint(G.High,null),e.setLastDataPoint(G.Low,null),e.setLastDataPoint(G.Open,null),e.setLastDataPoint(G.Close,null),e.setLastDataPoint(G.Change,null)}isProjection(e){return this.agg.isIntraday||this.durationAdd(e).getTime()>Date.now()}updateProjection(e,t){this.container.setLastDataPoint(G.DateTime,t.nextTimestamp);let n=this.changeLastBar(e,t);return n.timeCorrection={from:t.lastTimestamp,to:t.nextTimestamp},n}addBar(e,t){let n=this.container,{nextTimestamp:r}=t;if(n.getLastDataPoint(G.Projection)===1){let r=n.getLastDataPoint(G.Close);if(this.findOpen(r,this.lineBreak,1)!==null)n.setLastDataPoint(G.Projection,0),n.setLastDataPoint(G.Volume,this.currentVolume),this.currentVolume=0;else return this.updateProjection(e,t)}return(this.isProjection(r)||!this.insertBar(e,r))&&!this.addProjection(e,r)?null:{isUpdate:!1,time:r.getTime(),index:this.container.size-1}}insertBar(e,t){this.currentVolume+=e.tradeSize;let n=e.tradePrice,r=this.findOpen(n,this.lineBreak);return r===null?!1:(this.createBar(r,Math.max(r,n),Math.min(r,n),n,this.currentVolume,t),this.container.addDataPoint(G.Projection,0),this.currentVolume=0,!0)}addProjection(e,t){this.currentVolume+=e.tradeSize;let n=e.tradePrice,r=this.findOpen(n,0);return r===null?!1:(this.createBar(r,Math.max(r,n),Math.min(r,n),n,0,t),this.container.addDataPoint(G.Projection,1),!0)}findOpen(e,t,n=0){if(!P(e))return null;let r=this.container,i=r.size-1-n,a=r.getData(G.Close)[i],o=r.getData(G.Open)[i];if(a>o){if(e<=a){if(e>=o)return null;for(let n=0;n<Math.min(r.size,t);n++)if(e>=r.getData(G.Low)[i-n])return null;return o}return a}else{if(e>=a){if(e<=o)return null;for(let n=0;n<Math.min(r.size,t);n++)if(e<=r.getData(G.High)[i-n])return null;return o}return a}}startLine(e){this.container.addDataPoint(G.Projection,0);let t=this.readTrade(0);this.createBar(t.tradePrice,Math.max(t.tradePrice,e.tradePrice),Math.min(t.tradePrice,e.tradePrice),e.tradePrice,e.tradeSize+t.tradeSize,e.time)}},o_=B.RENKO_KAGI_NAMES,s_={Positive:1,Negative:2,Both:3};function c_(e){switch(e){case B.BARKIND_OX:case B.BARKIND_XO:return!0;default:return!1}}function l_(e){switch(e){case B.BARKIND_O:case B.BARKIND_XO:return!0;default:return!1}}function u_(e){switch(e){case B.BARKIND_X:case B.BARKIND_OX:return!0;default:return!1}}function d_(e){let t=dt(e),{Source:n,BoxSizeMethod:r,Period:i}=t,{ReversalAmount:a,BoxSize:o,OneStepBack:s}=t,c=et(n,[o_.CLS,o_.HL],o_.CLS),l=et(r,[o_.ATR,o_.TRD],o_.ATR),u=Number.isFinite(i)?i:14,d=Number.isFinite(a)?a:3;return{method:l,period:u,source:c,boxSize:Number.isFinite(o)?o:20,reversal:d,oneStepBack:s===`Yes`}}var f_=class extends hg{innerBuilder;inputs;boxSize;reversal;source;firstTrend;oneStepBack;isProcessingRetrieved=!1;constructor(e,t,n){super(t,n.aggregation),this.innerBuilder=e,this.inputs=F(n.inputs),this.boxSize=this.reversal=this.source=this.firstTrend=this.oneStepBack=null,this.processRetrieved()}get base(){return this.innerBuilder.container}_at(e,t,n){return e.getData(t)[n]}baseAt(e,t){return this._at(this.base,e,t)}dataAt(e,t){return this._at(this.container,e,t)}getLast(e){return this.container.getLastDataPoint(e)}setLast(e,t){this.container.setLastDataPoint(e,t)}computeNextStamp(e,t){return t}roundToBox(e){return e-e%this.boxSize}roundedDiff(e,t,n){let r=Math.abs(t-e);return e+n*this.roundToBox(r)}get closeBased(){return this.source===o_.CLS}get currentKind(){return this.getLast(G.BARKIND)}getTrendField(e){return this.closeBased?G.Close:e?G.Low:G.High}getTrendPrice(e,t){if(this.closeBased)return e.tradePrice;let n=e;return t?n._lowPrice:n._highPrice}changeLastBar(e,t){let n=l_(this.currentKind),r=n?-1:1,i=this.getLast(this.getTrendField(n)),a=this.getTrendPrice(e,n);return e.tradePrice=this.roundedDiff(i,a,r),super.changeLastBar(e,t),null}addBar(e,t){let n=this.container.size===0,r=l_(this.currentKind),i=r?1:-1,a=n?null:this.getLast(G.Close),o=this.getTrendPrice(e,!r);if(e.tradePrice=(n?this.roundToBox(this.baseAt(G.Open,0)):a)+i*(n?0:this.boxSize),super.addBar(e,t),!n){let e=this.roundedDiff(a,o,i);this.updateLastBar(e,e,e)}return this.container.addDataPoint(G.BARKIND,null),this.computeBarColor(),null}inplaceReverse(){let e=l_(this.currentKind)?B.BARKIND_OX:B.BARKIND_XO;this.setLast(G.BARKIND,e)}canInplaceReverse(){return c_(this.currentKind)?!1:this.getLast(G.High)===this.getLast(G.Low)}isUpdate(e,t,n,r){let i=l_(this.currentKind),a=this.getTrendPrice(r,i),o=this.getTrendPrice(r,!i),s=e=>e>=0,c=a-this.getLast(G.Close),l=s(c),u=Math.abs(c)>=this.boxSize,d=o-this.getLast(G.Close),f=s(d),p=Math.abs(d)>=this.reversal*this.boxSize;return i?!l&&u?!0:f&&p?!this.oneStepBack||!this.canInplaceReverse()?!1:(this.inplaceReverse(),!0):null:l&&u?!0:!f&&p?!this.oneStepBack||!this.canInplaceReverse()?!1:(this.inplaceReverse(),!0):null}findFirstDiffLargerThanBox(e,t){let n=this.baseAt(G.Open,0),r=this.innerBuilder.container.size;for(let i=1;i<r;++i){let r=this.baseAt(e,i)-n;if(Math.abs(r)>this.boxSize){if(t===s_.Positive&&r>0)return[i,B.BARKIND_X];if(t===s_.Negative&&r<0)return[i,B.BARKIND_O];if(t===s_.Both)return[i,r>0?B.BARKIND_X:B.BARKIND_O]}}return[null,null]}findFirstBarTrend(){if(this.innerBuilder.container.size<2)return null;if(this.closeBased){let[,e]=this.findFirstDiffLargerThanBox(G.Close,s_.Both);return e}else{let[e,t]=this.findFirstDiffLargerThanBox(G.High,s_.Positive),[n,r]=this.findFirstDiffLargerThanBox(G.Low,s_.Negative);return t===null&&r===null?null:r===null?t:t===null?r:e<n?t:r}}computeBarColor(){let e=this.container.size,t=this.firstTrend;e>1&&(t=l_(this.dataAt(G.BARKIND,e-2))?B.BARKIND_X:B.BARKIND_O),this.setLast(G.BARKIND,t)}process(e){return this.isProcessingRetrieved||this.innerBuilder.process(e),this.firstTrend===null?null:super.process(e)}processRetrieved(){let{method:e,period:t,reversal:n,source:r,boxSize:i,oneStepBack:a}=d_(this.inputs);if(this.reversal=n,this.source=r,e===o_.ATR?this.boxSize=wg(this.base,t):this.boxSize=i,P(this.reversal,this.boxSize)&&(this.oneStepBack=a&&this.reversal===1,this.container.clear(),this.firstTrend=this.findFirstBarTrend(),this.firstTrend!==null)){this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.baseAt(G.DateTime,e),tradePrice:this.baseAt(G.Close,e),_highPrice:this.baseAt(G.High,e),_lowPrice:this.baseAt(G.Low,e),tradeSize:this.baseAt(G.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}},p_=new Ru(g.Intraday,0),m_=class extends mg{constructor(e){super(e)}process(e){return{isUpdate:!1,time:0,index:-1}}},h_=class{query;container;canLoadMoreData=!0;alignToQuote=!1;isCached;record;isLoading=!1;serverComputedSeries;builder;retriever;streamingSubscription;records;constructor(e){this.query=e,this.container=null,this.canLoadMoreData=!0,this.alignToQuote=!1,this.record=new Wf(e.symbol)}get isTotalVolumeMode(){let e=this.query.symbol,t=this.query.aggregation;return Ei(e)&&!t.isContractVolume&&t.isEndOfDay}getHasVisible(e){return this.query.visibleRange!=null&&this.query.visibleRange[e]!=null}get hasVisibleFrom(){return this.getHasVisible(`from`)}get hasVisibleTo(){return this.getHasVisible(`to`)}get hasHistoricalData(){return this.hasData&&!this.container.isEmpty}refresh(){if(Ih(`ts:refresh`,{symbol:this.query.symbol??null,hasData:this.hasData,hasHistoricalData:this.hasHistoricalData,isCached:this.isCached??!1}),!this.hasHistoricalData){fa.call(this),this.ready().then(e=>{Ih(`ts:refresh:result`,{symbol:this.query.symbol??null,hasData:e,containerSize:this.container?.size??null}),e&&Ge(K.TS_MANYCHANGED,{series:this,part:re.Unspecified})});return}this.query.aggregation.isEndOfDay?this.alignToQuote=!0:this.loadMoreData(!1)}makeInnerBuilder(e){let t=this.query.aggregation;if(t.isTick)switch(t.spec){case _.None:case _.PerSeconds:case _.PerCount:case _.PerVolume:return new mg(e);default:throw Error(`Custom tick aggregation ${t.describe()} has not been implemented yet`)}else return new hg(e,t)}makeBuilder(e){let t=this.makeInnerBuilder(e),n=this.query.aggregation,r=(e,t=[])=>new _g(Pg(this.query.symbol,e).concat(t)),i=t;switch(this.query.curveStyle){case h.Renko:return new Og(i,this.query);case h.Kagi:return new r_(i,r(p_,[G.BARCOLIX]),this.query);case h.PointAndFigure:return new f_(i,r(p_,[G.BARKIND]),this.query);case h.LineBreak:return new a_(i,r(n,[G.Projection]),n,this.query)}if(n.isIntraday&&n.spec===_.PerRange)return new Qg(i,r(p_,[G.Projection]),n,this.query.symbol);let a=t;if(n.isTick)switch(n.spec){case _.PerSeconds:return new Kg(a,r(p_),n);case _.PerCount:{let e=r(p_,[Jg]);return new Yg(a,this,e,n)}case _.PerVolume:{let e=r(p_,[Xg]);return new Zg(a,this,e,n)}}return n.unit===g.Day&&n.size>1?new gg(i,r(n),n):t}onStreamingUpdates(e){this.isLoading||e.map(e=>{if(`isTrade`in e)return this.builder.process(e);if(`isQuote`in e&&(Ge(K.TS_QUOTEMARKER,{series:this}),this.alignToQuote&&this.query.aggregation.isEndOfDay&&this.query.useLastTrade&&(this.alignToQuote=!1),this.alignToQuote)){let t=this.builder.alignToQuote(e);return this.alignToQuote=!1,t}return null}).filter(e=>P(e)).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return r.isUpdate!==e.isUpdate||r.time!==e.time||e.timeCorrection}).forEach(e=>{if(e.index===-1)Ge(K.TS_MANYCHANGED,{series:this,part:re.Unspecified});else{let t={series:this,index:e.index};Ge(e.isUpdate?K.TS_DATAPOINTCHANGED:K.TS_DATAPOINTADDED,t)}e.timeCorrection&&Ge(K.TS_TIMELINECORRECTION,{...e.timeCorrection,series:this})})}get hasData(){return this.container!==null}getRetriever(){return new Bg}getStreamingSubscription(){return $().getRecordSource().subject.pipe(jm(e=>{let t=this.query.aggregation.isEndOfDay,n=this.record,r=n?.symbol;if(!r)return[];let i=np(K.RT_TRADE,r),a=e.filter(i).filter(e=>P(e.data.time)).filter(e=>e.data.session!==`T`||this.query.extendedHours&&!t).map(e=>({isTrade:!0,tradePrice:e.data.tradePrice,tradeSize:e.data.tradeSize,time:e.data.time,tradingDay:e.data.tradingDay}));if(this.isTotalVolumeMode&&this.records){let t=this.getSiblingVolume(e);if(t>0&&a.length>0)a[0].tradeSize+=t;else if(t>0&&a.length===0){let e=n.getValue(G.Last)??n.getValue(G.Close);if(P(e)){let r=new Date;a.push({isTrade:!0,tradePrice:e,tradeSize:t,time:r,tradingDay:n.getValue(G.TradingDay)})}}}let o=a.reduce((e,t)=>{let n=xe(e);return P(n)&&P(n.tradePrice)&&P(t.tradePrice)&&n.tradePrice===t.tradePrice&&n.time.getTime()===t.time.getTime()&&n.tradingDay===t.tradingDay?n.tradeSize+=t.tradeSize:e.push(st(t)),e},[]),s=np(K.RT_QUOTE,r);return o.concat(e.filter(s).map(e=>({isQuote:!0,openPrice:e.data.openPrice,highPrice:e.data.highPrice,lowPrice:e.data.lowPrice,lastPrice:e.data.lastPrice,time:e.data.tradeTime})))}),Pm(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}getSiblingVolume(e){return this.records?e.filter(e=>e.topic===K.RT_TRADE&&e.data.symbol in this.records).filter(e=>P(e.data.time)).filter(e=>e.data.session!==`T`).reduce((e,t)=>e+t.data.tradeSize,0):0}async loadMoreData(e=!0){if(this.isLoading||!this.builder||!this.retriever||!this.builder.supportsChunks||!this.retriever.supportsChunks||!this.canLoadMoreData)return Promise.resolve();this.isLoading=!0,e?await this.loadHeadChunk():await this.loadTailChunk(),this.isLoading=!1}async loadTailChunk(){let e=this.query.duplicate(),t=this.builder.getLastDate();P(e.offset)&&e.offset!==0&&(t=En(t,-e.offset)),e.range=[t,null];let n=await this.retriever.retrieve(e),r=this.container.size;this.builder.append(n);let i=this.container.size-r;Ge(K.TS_MANYCHANGED,{series:this,part:re.Tail,count:i,index:r})}async loadHeadChunk(){let e=!1,t=null;for(let n=0;n<this.builder.retryCountForChunk&&!e;++n){let r=this.query.duplicate(),i=this.builder.getFirstDate(n);P(r.offset)&&r.offset!==0&&(i=En(i,-r.offset)),r.range=[null,i],t=await this.retriever.retrieve(r),e=t.size>1}this.canLoadMoreData=e,e&&t!==null&&(this.builder.prepend(t),Ge(K.TS_MANYCHANGED,{series:this,part:re.Head}))}async applyNearbyFixup(e){let t=this.query.aggregation,n=t.spec===_.Nearest,r=this.query.symbol,i=Ei(r);return!i||!t.isMultiContract||!n||e.size<1||this.serverComputedSeries?i&&Vi(r)?await wi(r):r:e.getLastDataPoint(G.Symbol)}async ready(){return da.call(this,async()=>{try{Ih(`ts:ready:start`,{symbol:this.query.symbol??null,isCached:this.isCached??!1,hasVisibleFrom:this.hasVisibleFrom,hasVisibleTo:this.hasVisibleTo}),this.retriever=this.getRetriever();let e=await this.retriever.retrieve(this.query);Ih(`ts:ready:retrieved`,{symbol:this.query.symbol??null,containerSize:e.size});let t=await this.applyNearbyFixup(e);return this.hasVisibleTo||(this.record=$().getRecordSource().getRecord(t)),this.canLoadMoreData=!this.hasVisibleFrom&&e.size>0,this.isTotalVolumeMode&&await this.setupTotalVolumeSubscriptions(),this.builder=this.makeBuilder(e),await this.builder.ready(),this.container=this.builder.container,Ih(`ts:ready:done`,{symbol:this.query.symbol??null,recordSymbol:this.record?.symbol??null,containerSize:this.container?.size??null}),this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0}catch(e){return Ih(`ts:ready:failed`,{symbol:this.query.symbol??null,message:e.message}),I(`Failed loading the historical data for ${this.query.symbol}, error is ${e.message}`,`warn`),this.builder=void 0,this.container=null,!1}})}async setupTotalVolumeSubscriptions(){let e=this.query.symbol,t=Gi(e);if(t)try{let n=await Wi(t),r=this.record?.symbol??e,i=n.map(e=>e.name).filter(e=>e!==r),a=$().getRecordSource();this.records={};for(let e of i)this.records[e]=a.getRecord(e);await Promise.all(Object.values(this.records).map(e=>e.ready()))}catch{this.records=void 0}}getCacheableEntities(e){e.add(this)}shutdown(){P(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.records=void 0}},g_=class extends h_{getRetriever(){return new Vg}makeBuilder(e){return new m_(e)}getStreamingSubscription(){}onStreamingUpdates(e){}},__=class{query;container;_pretendEmpty;constructor(e,t=!1){this._pretendEmpty=t,this.query=e,this.container=new vg}refresh(){}canLoadMoreData=!1;isLoading=!1;calculable=!1;loadMoreData(e){throw Error(`Should not be called.`)}get hasData(){return this._pretendEmpty}async ready(){return this._pretendEmpty}getCacheableEntities(e){}shutdown(){}},v_=class{query;container;canLoadMoreData=!1;isLoading=!1;constructor(e,t){this.query=e,this.container=t}get hasData(){return this.container!==null}loadMoreData(e){throw Error(`Should not be called.`)}refresh(){}async ready(){return!0}getCacheableEntities(e){}shutdown(){}},y_=class{query;container;supplyCustomDemoData;canLoadMoreData=!0;isLoading=!0;constructor(e){this.query=e,this.container=null,this.supplyCustomDemoData=$().config.mode===`DemoSite`}refresh(){}loadMoreData(e){throw Error(`Should not be called.`)}get hasData(){return this.container!==null}shutdown(){}parseEvents(e){let t=new _g([G.DateTime,G.Dividends,G.Earnings,G.Splits,G.Custom]),n=e.split(`
|
|
@@ -34,9 +34,9 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
34
34
|
<td class="field-name">${it(e)}</td>
|
|
35
35
|
<td class="field-value">${t.join(` `)}</td>
|
|
36
36
|
</tr>
|
|
37
|
-
`}function Av(e,t,n){let r=typeof n==`string`?at(n):null,i=r===null?``:` style="color: ${r}"`,a=P(e)?it(e):null;return`${a===null?``:`<span class="field-name">${a}</span>`}<span${i} class="field-value">${it(t)}</span>`}function jv(e){return`<a class="delete-plot" data-plot-uid="${at(e)}" title="Delete plot">${xv(`delete`)}</a>`}function Mv(e,t){let n=e>0,r=e<t-1;return[`${n?wv(!0,e):``}`,`${r?wv(!1,e):``}`].join(` `).trim()}function Nv(e,t){return e.startsWith(B.FAKE_SYMBOL_PREFIX)&&t.length>0?t:e}function Pv(e){if(!e.isStudy)return null;let t=e;return t.getStandalonePaneBasisTitle()?t.getStandalonePaneTitle():null}function Fv(e,t,n,r,i,a){let o=Iv(e,t);o.offset=n,o.lastBarRefresh=!!r||!1,o.chartId=e.elementId;let s=n=>n.axes.map(e=>e.plots).flat().filter(t=>i?t===e.mainPlot:!0).map(n=>Bv(e,t,a,o,n)).filter(e=>e!==null);return o.panes=e.panes.map(e=>({bounds:Lv(e),id:e.id,plots:s(e)})),o}function Iv(e,t){let n=e.data.aggregation,r=e.display.xAxis,i=r.isOrdinal,a=N(i)&&i,o=a?r.ordinalName??`Value`:`Date`;return{date:a?ev(t):lv(n,t),time:n.isEndOfDay||a?null:uv(n,t,!1),isMultiSymbol:Vv(e),isMultiContract:n.isMultiContract,dateFieldName:o}}function Lv(e){let t=e.getBounds();if(!P(t))return;let{x:n,y:r,width:i,height:a}=t,{leftOffset:o,rightOffset:s}=e.presenter.view;return{top:r,left:n+o,right:s,bottom:r+a,width:i,height:a}}function Rv(e,t,n,r=!1){let i=e.plot,a=i.timeSeries.container,o=i.axis.pane.presenter.timeline,s=Te(o,+n,Number,dv),c=o.at(s-e.shift);if(c===null)return[null,0];let l=a.getTimeData(),u=Te(l,+c,Number);return[!l[u]||l[u].getTime()!==c.getTime()?null:e.dataAt(t,u,!r),u]}function zv(e,t,n){P(e.precision)?n.overridePrecision=e.precision:e.isStudy&&P(t.mainPlot?.precision)&&!P(ac(e.model.study).meta.decimals)&&(n.overridePrecision=t.mainPlot.precision)}function Bv(e,t,n,{isMultiContract:r},i){let a=i.isStudy;if(!i.timeSeries.hasData)return null;let o=i.timeSeries.container;i.type,C.Expression;let s=i.axis.comparison!==x.None,c=i.axis.comparison===x.Percent,l=(e,r)=>i.customPlotValues&&r!==G.DateTime?[i.getValueAt(r,t,n),0]:Rv(e,r,t,s),u=i,d=Pv(i)??i.title,f=a?`${ac(u.model.study).meta.title} ${u.fullParams}`:i.metaData.name||``,p={isMain:i.main,type:i.type,typeName:C[i.type],name:Nv(d,i.metaData.symbol),description:f,exchange:i.metaData.exchange||``,error:u.errorText,id:i.id,uid:i.uid,visible:i.visible,isHidden:!i.isVisible,seasonalOffset:i.isSeasonal?u.offset??void 0:void 0};if(P(u.yearOffset)&&u.yearOffset!=0){let n=e.data.aggregation;p.unalignedDate=lv(n,_i(t,u.yearOffset))}let m=i.curves[0],g=i.type===C.Symbol&&Vi(i.title);if(r&&i.type===C.Symbol&&o.hasField(G.Symbol)){let e=t.valueOf()===B.ZERO_DATE.valueOf()?i.timeSeries.container?.getLastDataPoint(G.Symbol):l(m,G.Symbol)[0];P(e)&&e.length>0&&(p.actualSymbol=e,g||(p.name=e))}let _={},v={range:i.axis.yScale.domain(),allDigits:!0};zv(i,e,v);let y=(e,t)=>{let n=(t===G.Change||t===G.PercentChange)&&e>0?`+`:``;return c?n+tv(e):n+i.metaData.format(e,t,v)},b=mv(e),S=new Set;return p.values=i.curves.filter(e=>e.visible).map(e=>(!i.main&&i.isSymbol&&b?Ng:e.fields).map(t=>{if(S.has(t))return null;S.add(t);let[n,r]=l(e,t),o=i.axis.yScale.priceToY(n);_[t.id]=!0;let s=i.customPlotValues?u.getColorOf(t):e.getColor(r,e.style!==h.HollowCandles,t),c=y(n,t).trim();if(P(n)&&t===G.Change){let[t]=l(e,G.PercentChange);P(t)&&(c+=` (${y(t,G.PercentChange)})`)}return{abbreviation:Hv(t),shortName:t.shortName,id:t.id,name:t.name,longName:`${t.shortName} ${a?u.params:``}`.trim(),color:uo(s),val:n,y:o,value:c}}).filter(e=>e!==null)).flat(),p.events=i.findEvents(l(m,G.DateTime)).filter(e=>e.field!==G.Custom),p}function Vv(e){let t=e.mainPlot.symbol;return e.allPlots.some(e=>e.type===C.Symbol&&e.symbol!==t)}function Hv(e){return e.id===G.Change.id?`Δ`:e.id.substring(0,1)}function Uv(e,t,n){let r=P(t),i=P(n),a,o,s=e.pane.getBounds();if(!r)a=e.priceToY(n),o=new Eo(s.x,a,s.width,s.y+s.height-a);else if(!i)a=e.priceToY(t),o=new Eo(s.x,s.y,s.width,a-s.y);else{let r=e.priceToY(t),i=e.priceToY(n);a=(r+i)/2,o=new Eo(s.x,i,s.width,r-i)}return[a,o]}var Wv=(e,t)=>{let n=go(.6)(e),r=_o(.6)(e),i=t===`linLighten`;return[i?r:n,e,i?n:r]};function Gv(e,t,n,r,i=!1,a){let o;e.zones.forEach((s,c)=>{let l=s.value,[u,d]=Uv(e,o,l);t.save(),To(t,d),i&&(n.range=[null,u]);let f=e.zoneColors[c];if(s.gradient){let e=Wv(f,s.gradient),n=t.createLinearGradient(0,d.y,0,d.y+d.height);n.addColorStop(0,e[0]),n.addColorStop(.5,e[1]),n.addColorStop(1,e[2]),f=n}else P(a)&&(f=a(c,f));r(e,t,n,f),t.restore(),o=l})}function Kv(e,t,{bar:n,slice:r},i){let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,o=a+(r[1]-r[0])*n.totalWidth,s=i+n.totalWidth/2;return t.x<a-s||t.x>o+s}function qv(e,t,n,r=1){let i=e.view.xAxis.xScale.xToIndex(t.x)??n.slice[0];return{from:Math.max(n.slice[0]-1,i-r),to:Math.min(n.slice[1]+1,i+r)}}function Jv(e,t,n,r,i,a){let o=Math.min(t,t+r)-a,s=Math.max(t,t+r)+a,c=Math.min(n,n+i)-a,l=Math.max(n,n+i)+a;return e.x>=o&&e.x<=s&&e.y>=c&&e.y<=l}function Yv(e,t,n,r,i,a){let o=r-t,s=i-n,c=e.x-t,l=e.y-n;if(o===0&&s===0)return Math.abs(c)<=a&&Math.abs(l)<=a;let u=o*o+s*s,d=(c*o+l*s)/u,f=Math.max(0,Math.min(1,d)),p=t+f*o,m=n+f*s,h=e.x-p,g=e.y-m;return h*h+g*g<=a*a}function Xv(e,t,n,r){return e.x>=Math.min(t.x,n.x)-r&&e.x<=Math.max(t.x,n.x)+r}function Zv(e,t,n,r){return e.y>=Math.min(t,n)-r&&e.y<=Math.max(t,n)+r}function Qv(e,t,n){let r=n.x-t.x;if(r===0)return n.y;let i=(e-t.x)/r;return t.y+(n.y-t.y)*i}function $v(e,[t,n],r,i){let a=r,o=e.timeSeries.container.size;for(let r=t;r<=n;r++){for(;e.timeSeriesAt(a)<e.timelineAt(r-e.shift)&&a<o;)++a;if(a===o)break;let t=e.timeSeriesAt(a)>e.timelineAt(r-e.shift);i(a,t)}}var ey={draw(e,t,n){P(e.zones)?Gv(e,t,n,sy):e.varyColorPerBar?dy(e,t,n):sy(e,t,n)},hitTest:ry},ty={draw(e,t,n){P(e.zones)?Gv(e,t,n,py):py(e,t,n,e.colors[0])},hitTest:iy},ny={draw:fy,hitTest:ay};function ry(e,t,n,r){let i=e.pickMainField(),{from:a,to:o}=qv(e,t,n,B.CONTINUOUS_LINE_HIT_TEST_RADIUS),s=null;for(let n=a;n<=o;n++){let a=e.pointAtTimelineIndex(n,i);if(a!==null){if(s!==null&&Yv(t,s.x,s.y,a.x,a.y,r))return!0;s=a}}return!1}function iy(e,t,n,r){let i=e.pickMainField(),{from:a,to:o}=qv(e,t,n);for(let n=a;n<=o;n++){let a=e.pointAtTimelineIndex(n-1,i),o=e.pointAtTimelineIndex(n,i);if(a===null||o===null)continue;let s={x:o.x,y:a.y};if(Yv(t,a.x,a.y,s.x,s.y,r)||Yv(t,s.x,s.y,o.x,o.y,r))return!0}return!1}function ay(e,t,n,r){let i=e.pickMainField(),a=Math.max(1,e.lineWidth||B.CURVE_STYLE_DOTS_RADIUS)+r,o=a*a,{from:s,to:c}=qv(e,t,n);for(let n=s;n<=c;n++){let r=e.pointAtTimelineIndex(n,i);if(r===null)continue;let a=t.x-r.x,s=t.y-r.y;if(a*a+s*s<=o)return!0}return!1}function oy(e,t,n,r,i=1){let a=B.MARKER_SIZE*i,o=a*1.25;switch(r){case`Circle`:e.moveTo(t+a,n),e.arc(t,n,a,0,Math.PI*2);break;case`Square`:e.rect(t-a,n-a,2*a,2*a);break;case`TriangleUp`:e.moveTo(t-o,n+o),e.lineTo(t+o,n+o),e.lineTo(t,n-o),e.lineTo(t-o,n+o);break;case`TriangleDown`:e.moveTo(t-o,n-o),e.lineTo(t+o,n-o),e.lineTo(t,n+o),e.lineTo(t-o,n-o);break;case`Diamond`:e.moveTo(t,n-o),e.lineTo(t+o,n),e.lineTo(t,n+o),e.lineTo(t-o,n),e.lineTo(t,n-o);break;default:break}}function sy(e,t,{bar:n,slice:r,start:i},a=null){let o=a||e.getColor(0),s=N(e.lineMarker);s&&(t.fillStyle=o,t.beginPath());let c=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,l=[],u=e.pickMainField();$v(e,r,i,(r,i)=>{if(!i){let n=e.dataAt(u,r);if(P(n)){let r=e.priceToY(n);s&&oy(t,c,r,e.lineMarker),l.push({x:c,y:r})}}c+=n.totalWidth}),s&&t.fill(),t.lineWidth=e.lineWidth,e.dashStyle&&t.setLineDash(lo(e.dashStyle)),N(e.lineSmoothing)?cy(t,l,o,e.lineSmoothing):uy(t,l,o)}function cy(e,t,n,r){if(t.length<2)return;let i=ly(t,r);e.beginPath(),e.strokeStyle=n,e.moveTo(t[0].x,t[0].y);for(let t of i)e.bezierCurveTo(t.cp1x,t.cp1y,t.cp2x,t.cp2y,t.x,t.y);e.stroke()}function ly(e,t){let n=[];for(let r=0;r<e.length-1;r++){let i=e[r-1]||e[r],a=e[r],o=e[r+1],s=e[r+2]||o,c=a.x+(o.x-i.x)/t,l=a.y+(o.y-i.y)/t,u=o.x-(s.x-a.x)/t,d=o.y-(s.y-a.y)/t;n.push({cp1x:c,cp1y:l,cp2x:u,cp2y:d,x:o.x,y:o.y})}return n}function uy(e,t,n){if(t.length>1){e.beginPath(),e.strokeStyle=n;let r=t[0];e.moveTo(r.x,r.y);for(let n=1;n<t.length;n++){let r=t[n];e.lineTo(r.x,r.y)}e.stroke()}}function dy(e,t,{bar:n,slice:r,start:i}){t.lineWidth=e.lineWidth,t.lineCap=`square`,e.dashStyle&&t.setLineDash(lo(e.dashStyle));let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,o=null,s=null,c=[];$v(e,r,i,(r,i)=>{if(!i){let n=e.pickMainField(),i=e.dataAt(n,r);if(P(i)){let n=e.priceToY(i);s=e.getColor(r),o!==s&&(uy(t,c,o),c.length>0&&(c=[c.pop()]),o=s),c.push({x:a,y:n})}}a+=n.totalWidth}),uy(t,c,s)}function fy(e,t,{bar:n,slice:r,start:i}){let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2;t.fillStyle=e.getColor(0);let o=Math.max(1,e.lineWidth||B.CURVE_STYLE_DOTS_RADIUS),s=Math.PI*2;t.beginPath(),$v(e,r,i,(r,i)=>{if(!i){let n=e.pickMainField(),i=e.dataAt(n,r);if(P(i)){let n=e.priceToY(i);t.moveTo(a+o,n),t.arc(a,n,o,0,s)}}a+=n.totalWidth}),t.fill()}function py(e,t,{bar:n,slice:r,start:i},a){let o=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,s=is();s.prolog(t),t.strokeStyle=a,t.lineWidth=e.lineWidth,e.dashStyle&&t.setLineDash(lo(e.dashStyle)),t.beginPath();let c=!1,l=null;$v(e,r,i,(r,i)=>{if(!i){let n=e.pickMainField(),i=e.dataAt(n,r);if(P(i)){let a=e.priceToY(i);if(c)t.lineTo(o,l),t.lineTo(o,a);else{let i=e.dataAt(n,r-1);if(P(i)){let n=e.priceToY(i);t.moveTo(-1,n),t.lineTo(o,n),t.lineTo(o,a)}else t.moveTo(o,a);c=!0}l=a}}o+=n.totalWidth}),t.stroke(),s.epilog(t)}var my={draw(e,t,n){P(e.zones)?Gv(e,t,n,yy,!0):yy(e,t,n,e.colors,!0)},hitTest:vy},hy={draw:xy,hitTest:vy};function gy(e){let{BaseLevel:t}=dt(e);return{baseLevel:Number.isFinite(t)?xt(0,100,t):50}}function _y(e,[t,n]){let{baseLevel:r}=gy(e.plot.inputs);return(t-n)*r/100+n}function vy(e,t,n,r){if(ry(e,t,n,r))return!0;let{range:i}=n,a=e.pickMainField(),o=e.isBaseline?_y(e,i):i[1],{from:s,to:c}=qv(e,t,n);for(let n=s;n<=c;n++){let i=e.pointAtTimelineIndex(n,a),s=e.pointAtTimelineIndex(n+1,a);if(!(i===null||s===null)&&Xv(t,i,s,r)&&Zv(t,Qv(t.x,i,s),o,r))return!0}return!1}function yy(e,t,n,r,i=!1){sy(e,t,n,e.pickAreaStroke(r)),Sy(e,t,n,r[0],i)}function by(e,t,n){let{x:r,width:i}=e.pane.getBoundsWithoutScales();t.save(),t.lineWidth=1,t.strokeStyle=`#888`,t.setLineDash(lo(`dot`)),Vo(t,n,r,r+i),t.restore()}function xy(e,t,n){let[r,i]=n.range,a=_y(e,n.range);e.zones[0].value=e.yToPrice(a),by(e,t,a),Gv(e,t,n,yy,!0,(e,n)=>{let o=e===1,s=fo(n,0),c=t.createLinearGradient(0,o?r:i,0,a);return c.addColorStop(0,n),c.addColorStop(1,s),[c,fo(n,1)]})}function Sy(e,t,{bar:n,slice:r,start:i,range:[a,o]},s,c){if(c){let e=t.createLinearGradient(0,a,0,o);e.addColorStop(0,s),e.addColorStop(1,fo(s,0)),t.fillStyle=e}else t.fillStyle=s;t.beginPath();let l=null,u=e.pickMainField(),d=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,f=!1,p=null;$v(e,r,i,(r,i)=>{if(!i){let n=e.dataAt(u,r);if(P(n)){let r=e.priceToY(n);f?t.lineTo(d,r):(t.moveTo(l=d,r),f=!0),p=d}}d+=n.totalWidth}),t.lineTo(p,o),t.lineTo(l,o),t.closePath(),t.fill()}var Cy={draw(e,t,n){P(e.zones)?Gv(e,t,n,Oy,!0):Oy(e,t,{...n,range:[null,null]})},hitTest:Ty},wy={draw:Dy,hitTest:Ey};function Ty(e,t,n,r){let{bar:i,slice:a}=n,o=e.view.xAxis.xScale.range()[0],s=e.isMultiColumn,c=s?e.fields.length:1,l=i.width/c,u=s?null:e.pickMainField(),d=e.priceToY(0),{from:f,to:p}=qv(e,t,n);for(let n=f;n<=p;n++){let f=e.dataIndexAtTimelineIndex(n);if(!P(f))continue;let p=o+i.offset+(n-a[0])*i.totalWidth;for(let n=0;n<c;n++){let i=e.dataAt(s?e.fields[n]:u,f);if(P(i)){let a=e.priceToY(i);if(Jv(t,p+n*l,a,l,d-a,r))return!0}}}return!1}function Ey(e,t,n,r){let{bar:i,slice:a}=n,o=e.view.xAxis.xScale.range()[0],{from:s,to:c}=qv(e,t,n);for(let n=s;n<=c;n++){let s=e.dataIndexAtTimelineIndex(n);if(!P(s))continue;let c=o+i.offset+(n-a[0])*i.totalWidth,l=e.priceToY(0),u=0;for(let n=0;n<e.plot.curves.length;n++){let a=e.plot.curves[n];if(!a.visible||!a.isStackedColumn)continue;let o=e.dataAt(a.fields[0],s);if(!P(o))continue;u+=o;let d=e.priceToY(u);if(a===e&&Jv(t,c,d,i.width,l-d,r))return!0;l=d}}return!1}function Dy(e,t,{bar:n,slice:r,start:i}){if(!e.isFirstVisibleOfStyle())return;let a=e.view.xAxis.xScale.range()[0]+n.offset,o=is();o.prolog(t);let s=e.plot.curves.filter(e=>e.isStackedColumn);$v(e,r,i,(r,i)=>{if(!i){let i=e.priceToY(0),c=0;s.forEach(s=>{if(!s.visible)return;let l=s.fields[0],u=e.dataAt(l,r);if(!P(u))return;c+=u;let d=e.priceToY(c);t.fillStyle=s.getColor(r,!1,l),t.beginPath(),t.rect(o.adjust(a),o.adjust(Math.min(d,i)),o.adjust(n.width),o.adjust(Math.abs(i-d))),t.fill(),i=d})}a+=n.totalWidth}),o.epilog(t)}function Oy(e,t,{bar:n,slice:r,start:i,range:[a,o]}){let s=e.view.xAxis.xScale.range()[0]+n.offset,c=e.isMultiColumn,l=c?e.fields:[e.pickMainField()],u=n.width/(c?l.length:1),d=is();d.prolog(t),$v(e,r,i,(r,i)=>{i||l.forEach((n,i)=>{let a=e.dataAt(n,r);if(P(a)){P(o)||(o=e.priceToY(0));let c=e.priceToY(a);t.fillStyle=e.getColor(r,!1,n),t.beginPath(),t.rect(d.adjust(s+i*u),d.adjust(Math.min(c,o)),d.adjust(u),d.adjust(Math.abs(o-c))),t.fill()}}),s+=n.totalWidth}),d.epilog(t)}var ky={draw:My},Ay=[G.Open,G.High,G.Low,G.Close],jy=[null,null,null,null];function My(e,t,{bar:n,slice:r,start:i}){t.lineWidth=Math.max(1,.5*n.width),t.lineJoin=`miter`,t.miterLimit=1.5;let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,o=is();o.prolog(t);let s=null,c=null,l=[];$v(e,r,i,(r,i)=>{if(!i){let i=t=>Ay.map(n=>e.dataAt(n,t)),[u,d,f,p]=i(r),[,m,h]=r<0?jy:i(r-1);if(P(u,d,f,p)){let i=o.adjust(a),g=o.adjust(a-n.totalWidth),_=[u,d,f,p].map(e.priceToY,e).map(o.adjust),v=o.adjust(e.priceToY(d>m?m:h));c=e.getColor(r);let y=P(s)&&s!==c,b=u===d?1:2,x=u===d?2:1;l.push({x:g,y:_[0]}),l.push({x:i,y:_[b]}),y&&(l.push({x:i,y:v}),uy(t,l,s),l=[]),y&&l.push({x:i,y:v}),l.push({x:i,y:_[x]}),s=c}}a+=n.totalWidth}),uy(t,l,c),o.epilog(t)}var Ny={draw:Iy,hitTest:Fy},Py=[G.Open,G.High,G.Low,G.Close];function Fy(e,t,n,r){let{bar:i}=n,a=i.width/2,{from:o,to:s}=qv(e,t,n);for(let n=o;n<=s;n++){let o=e.dataIndexAtTimelineIndex(n);if(!P(o))continue;let s=e.dataAt(G.Open,o),c=e.dataAt(G.High,o),l=e.dataAt(G.Low,o),u=e.dataAt(G.Close,o);if(P(s,c,l,u)){let o=e.view.xAxis.xScale.indexToX(n),d=e.priceToY(s),f=e.priceToY(c),p=e.priceToY(l),m=e.priceToY(u);if(e.isCandle){if(Jv(t,o-a,d,i.width,m-d,r)||Yv(t,o,Math.min(m,d),o,f,r)||Yv(t,o,Math.max(m,d),o,p,r))return!0}else if(Yv(t,o,p,o,f,r)||!e.isHlcStyle&&Yv(t,o-a,d,o,d,r)||Yv(t,o+a,m,o,m,r))return!0}}return!1}function Iy(e,t,{bar:n,slice:r,start:i}){let a=e.presenter.display.chart.showMinMaxArc,o=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,s=is();s.prolog(t);let c=null,l=null,u=null,d=null,f=n=>{e.isCandle?(e.isHollowCandles?n.outlineColor=e.getColor(n.ix,!1):(e.colors.length>3&&(n.outlineColor=e.colors[3]),e.colors.length>4&&(n.wickColor=e.colors[4])),zy(t,n,e.lineWidth)):(e.isOhlcStyle||e.isHlcStyle||e.isElderImpulseSystemStyle||e.isRangeStyle)&&Ry(t,n,e.lineWidth,!e.isHlcStyle)};$v(e,r,i,(t,r)=>{if(!r){let r=Py.map(n=>e.dataAt(n,t)),[i,a,p,m]=r;if(P(i,a,p,m)){let h={x:s.adjust(o),adjust:s.adjust,width:n.width,y:[i,a,p,m].map(e.priceToY,e).map(s.adjust),isMin:!1,isMax:!1,ix:t,color:e.getColor(t)},g=Math.min(...r),_=Math.max(...r);(!P(c)||g<c)&&(c=g,u=h),(!P(l)||_>l)&&(l=_,d=h),f(h)}}o+=n.totalWidth}),a&&(P(u)&&(u.isMin=!0,f(u)),P(d)&&(d.isMax=!0,f(d))),s.epilog(t)}function Ly(e,t,n,r,i,a,o,s=3){t&&Ro(e,{x:r,y:i+s},o,0,Math.PI),n&&Ro(e,{x:r,y:a-s},o,0,Math.PI,!0)}function Ry(e,{x:t,adjust:n,width:r,y:[i,a,o,s],color:c,isMin:l,isMax:u},d,f){let p=r/2;e.lineWidth=d,e.strokeStyle=c,e.beginPath(),e.moveTo(t,o),e.lineTo(t,a),f&&(e.moveTo(n(t-p),i),e.lineTo(t,i)),e.moveTo(n(t+p),s),e.lineTo(t,s),e.stroke(),Ly(e,l,u,t,o,a,p)}function zy(e,{x:t,adjust:n,width:r,y:[i,a,o,s],color:c,outlineColor:l,wickColor:u,isMin:d,isMax:f},p){let m=r/2;e.lineWidth=p,e.fillStyle=c,e.strokeStyle=l||c,e.beginPath(),e.rect(n(t-m),Math.min(i,s),r,n(Math.abs(s-i))),e.fill(),e.stroke(),e.strokeStyle=u||l||c,e.beginPath(),e.moveTo(t,Math.min(s,i)),e.lineTo(t,a),e.moveTo(t,Math.max(s,i)),e.lineTo(t,o),e.stroke(),e.strokeStyle=vo(c).a===0?l:c,Ly(e,d,f,t,o,a,m)}var By={draw:Vy};function Vy(e,t,{bar:n,slice:r,start:i}){let a=e.view.xAxis.xScale.range()[0],o=n.totalWidth/2,s=a+n.offset+n.width/2,c=is();c.prolog(t);let l=e.plot.timeSeries.builder.boxSize,u=l/2;$v(e,r,i,(r,i)=>{if(!i){let[n,i]=[G.High,G.Low].map(t=>e.dataAt(t,r)),a=e.colors[0],d=e.colors[1],f=e.dataAt(G.BARKIND,r),p=u_(f),m=f===B.BARKIND_XO,h=f===B.BARKIND_OX;if(P(n,i))for(let r=n;r>=i;r-=l){let l=c.adjust(s),[f,g]=[l-o,l+o],[_,v,y]=[r,r-u,r+u].map(t=>e.priceToY(t)),b=r===n&&m||r===i&&h?!p:p;t.beginPath(),b?(t.strokeStyle=d,t.moveTo(f,v),t.lineTo(g,y),t.moveTo(f,y),t.lineTo(g,v)):(t.strokeStyle=a,t.ellipse(l,_,o,v-_,0,0,Math.PI*2)),t.stroke()}}s+=n.totalWidth}),c.epilog(t)}var Hy={draw:Uy};function Uy(e,t,{bar:n,slice:r,start:i}){let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2;$v(e,r,i,(r,i)=>{if(!i){let[i,o]=[G.Open,G.Close].map(t=>e.dataAt(t,r)).map(e.priceToY,e),s=Math.floor(n.totalWidth/2);t.fillStyle=e.getColor(r),t.beginPath(),t.rect(a-s,Math.min(i,o),n.totalWidth,Math.abs(o-i)),t.fill()}a+=n.totalWidth})}var Wy={draw(e,t,n){e.varyColorPerBar?qy(e,t,n):Ky(e,t,n,e.colors[0])},hitTest:Gy};function Gy(e,t,n,r){let[i,a]=e.fields,{from:o,to:s}=qv(e,t,n);for(let n=o;n<=s;n++){let o=e.pointAtTimelineIndex(n,i),s=e.pointAtTimelineIndex(n+1,i),c=e.pointAtTimelineIndex(n,a),l=e.pointAtTimelineIndex(n+1,a);if(!(o===null||s===null||c===null||l===null)&&Xv(t,o,s,r)&&Zv(t,Qv(t.x,o,s),Qv(t.x,c,l),r))return!0}return!1}function Ky(e,t,{bar:n,slice:r,start:i},a){t.fillStyle=a;let[o,s]=e.fields,c=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,l=[];if($v(e,r,i,(t,r)=>{if(!r){let n=e.dataAt(o,t),r=e.dataAt(s,t);P(n,r)&&l.push({x:c,upY:e.priceToY(n),downY:e.priceToY(r)})}c+=n.totalWidth}),l.length>0){t.beginPath(),t.moveTo(l[0].x,l[0].upY);for(let e=1;e<l.length;++e)t.lineTo(l[e].x,l[e].upY);let e=l.length-1;t.lineTo(l[e].x,l[e].downY);for(let n=e-1;n>=0;--n)t.lineTo(l[n].x,l[n].downY);t.closePath(),t.fill()}}function qy(e,t,{bar:n,slice:r,start:i}){let[a,o]=e.fields,s=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,c=[],l=e=>{if(c.length>1){t.beginPath(),t.fillStyle=e,t.moveTo(c[0].x,c[0].upY);for(let e=1;e<c.length;++e)t.lineTo(c[e].x,c[e].upY);let n=c.length-1;t.lineTo(c[n].x,c[n].downY);for(let e=n-1;e>=0;--e)t.lineTo(c[e].x,c[e].downY);t.closePath(),t.fill()}},u=null,d=null;$v(e,r,i,(t,r)=>{if(!r){let n=e.dataAt(a,t),r=e.dataAt(o,t);if(P(n,r)){let i=e.priceToY(n),a=e.priceToY(r);d=e.getColor(t),u!==d&&(l(u),c.length>0&&(c=[c.pop()]),u=d),c.push({x:s,upY:i,downY:a})}}s+=n.totalWidth}),l(d)}var Jy=class{plot;id;fields=[];colors=[];style=h.Line;attributes=[];zones;_shift=0;lineWidth=1;lineMarker;lineSmoothing;dashStyle=`Solid`;varyColorPerBar=!1;visible=!0;_zoneColors;constructor(){this.id=bt(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=P(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(G.Close)}get name(){return this.isOhlc?``:this.fields[0].name}get isHeikinAshiStyle(){return this.style===h.HeikinAshi}get isCandle(){return this.style===h.Candlestick||this.style===h.HollowCandles||this.style===h.HeikinAshi}get isHollowCandles(){return this.style===h.HollowCandles}get isElderImpulseSystemStyle(){return this.style===h.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===h.PercentChange}get isOhlcStyle(){return this.style===h.OHLC}get isHlcStyle(){return this.style===h.HLC}get isRangeStyle(){return this.style===h.Range}get isRenko(){return this.style===h.Renko}get isKagi(){return this.style===h.Kagi}get isPointAndFigure(){return this.style===h.PointAndFigure}get isLineBreak(){return this.style===h.LineBreak}get isBaseline(){return this.style===h.Baseline}get isLineLike(){return[h.Line,h.Area,h.Baseline,h.PercentChange].includes(this.style)}get isColumn(){return this.style===h.Column}get isMultiColumn(){return this.style===h.MultiColumn}get isStackedColumn(){return this.style===h.StackedColumn}isFirstVisibleOfStyle(){return this.plot.curves.find(e=>e.visible&&e.style===this.style)===this}fromModel(e){e.attributes&&(this.attributes=e.attributes.map(e=>m[e])),this.colors=e.colors,this.fields=e.fields.map(e=>G[e]),this.style=h[e.style],this.lineWidth=e.lineWidth,this.dashStyle=e.dashStyle,this.lineMarker=e.lineMarker,this.lineSmoothing=e.lineSmoothing,this.varyColorPerBar=e.varyColorPerBar,this.visible=e.visible??!0,e.zones&&(this.zones=e.zones),this.shift=e.shift}get axis(){return this.plot?.axis}get pane(){return this.axis?.pane}get timeSeries(){return this.plot?.timeSeries}get presenter(){return this.pane?.presenter}get view(){return this.presenter?.view}yToPrice(e){return this.yScale.yToPrice(e)}priceToY(e){return this.yScale.priceToY(e)}dataAt(e,t,n=!0){let r=!this.plot.isComparison(x.None),i=e===G.PercentChange,a=e===G.Change,o=i||(!n||r)&&a,s=this.timeSeries.container.hasField(G.Last)?G.Last:G.Close,c=o?s:e,l=(e,t)=>{let n=this.timeSeries.container.getData(e)[t];return e.type===v.Number?this.plot.priceMapper(n,t,e):n},u=l(c,t);if(!o)return u;if(t<=1)return 0;let d=l(c,t-1),f=u-d;return i?d===0?0:f/d:f}timeSeriesAt(e){let t=this.timeSeries.container.getTimeData(),n=t.length;return e<0||e>n-1?null:t[e]}timelineAt(e){return this.presenter.timeline.at(e)}get shiftedTimeDomain(){let e=this.view.xAxis.xScale;return P(e.extent())?this.shift===0?e.domain():e.extent().map(t=>e.timeline.at(t-this.shift)):null}get yScale(){return this.plot?.yScale??this.axis.yScale}get canHitTest(){return P(Yy(this)?.hitTest)}getCore(){let e=this.timeSeries;if(!e.hasData||!this.visible)return null;let t=this.view.xAxis.xScale.extent();if(!P(t))return null;let n=this.yScale.domain();return P(n)?{ts:e,extent:t,domain:n,range:this.yScale.range()}:null}getDrawInfo(e){let t=e.ts.container.getTimeData(),n=this.shiftedTimeDomain[0];return P(n)?{bar:this.view.xAxis.xScale.bar,domain:e.domain,range:e.range,slice:e.extent,start:Te(t,+n,Number)||0}:null}hitTest(e){let t=Yy(this);if(!P(t?.hitTest))return!1;let n=this.getCore();if(n===null)return!1;let r=this.getDrawInfo(n);if(r===null)return!1;let i=B.PLOT_HIT_TEST_TOLERANCE+Math.max(0,this.lineWidth/2);return Kv(this,e,r,i)?!1:t.hitTest(this,e,r,i)}dataIndexAtTimelineIndex(e){let t=this.timelineAt(e-this.shift);if(!P(t))return null;let n=this.timeSeries.container.getTimeData(),r=Te(n,+t,Number),i=n[r];return P(i)&&i.getTime()===t.getTime()?r:null}pointAtTimelineIndex(e,t){let n=this.dataIndexAtTimelineIndex(e);if(!P(n))return null;let r=this.dataAt(t,n);return P(r)?{x:this.view.xAxis.xScale.indexToX(e),y:this.priceToY(r)}:null}drawHover(e,t,n){if(!this.isLineLike||this.getCore()===null)return;let[r,i]=Rv(this,this.pickMainField(),t);P(r)&&(e.save(),To(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=uo(this.getColor(i)),e.beginPath(),oy(e,n,this.priceToY(r),this.lineMarker??`Circle`,1.3333),e.fill(),e.restore())}draw(e){let t=this.getCore();if(t===null)return;let n=this.getDrawInfo(t);if(n===null)return;e.save(),e.setLineDash([]);let r=Yy(this);P(r)?r.draw(this,e,n):I(`Drawing of the curve style '${this.style}' is not implemented yet`,`error`),e.restore()}pickMainField(){return this.fields.length===1?this.fields[0]:this.fields.includes(G.Last)?G.Last:this.fields.includes(G.Close)?G.Close:this.fields[0]}get zoneColors(){if(!P(this._zoneColors)){let e=this.colors.slice();this._zoneColors=this.zones.map(t=>e.splice(0,t.colors))}return this._zoneColors}getColorsFromZone(e){let t=this.zones.findIndex(t=>e<t.value);return t===-1&&(t=this.zones.length-1),this.zoneColors[t]}pickAreaStroke(e){return e.length<2?uo(e[0]):e[1]}getComputedColor(e){if(!this.timeSeries.container.hasField(G.BARCOLIX))return null;let t=this.dataAt(G.BARCOLIX,e);return t>=0&&t<this.colors.length?this.colors[t]:null}getColor(e,t=!0,n=null){if(this.varyColorPerBar){let n={};if(this.isOhlc||this.isRenko||this.isLineBreak){let t=this.dataAt(G.Open,e),r=this.dataAt(G.High,e),i=this.dataAt(G.Low,e),a=this.dataAt(G.Close,e),o=this.dataAt(G.Change,e);n.open=t,n.high=r,n.low=i,n.close=a,n.change=o}else if(this.plot.isStudy&&![`VOL`,`MAVOL`].includes(this.plot.model.study)){let t=this.pickMainField(),r=this.dataAt(t,e-1),i=this.dataAt(t,e),a=P(r),o=P(i);a?n.change=o?i-r:-1:n.change=+!!o}else{let t=this.plot.axis.pane.presenter.data.aggregation;(!t.isTick||t.spec!==_.None)&&(n.open=this.dataAt(G.Open,e),n.close=this.dataAt(G.Close,e)),n.change=this.dataAt(G.Change,e)}let r,i=Xy(this.style,n,this.colors),a=this.getComputedColor(e);switch(this.style){case h.Candlestick:case h.Renko:case h.LineBreak:case h.Range:case h.HeikinAshi:case h.OHLC:case h.HLC:case h.Column:{if(P(a)){r=a;break}let t=i.useSame?i.isUp:i.isUp||i.isSame,n=i.isSame,o=this.attributes||[],s=this.plot.isStudy&&![`HASMO`,`VOL`,`MAVOL`].includes(this.plot.model.study);(o.includes(m.ChangeBased)||s)&&(t=i.useSame?i.isUpPrev:i.isUpPrev||i.isSamePrev,n=i.isSamePrev),r=this.colors[+!!t],i.useSame&&n&&(r=this.colors[2]),(this.isRenko||this.isLineBreak||this.isRangeStyle)&&this.dataAt(G.Projection,e)===1&&(r=go(.5,!0)(r));break}case h.ElderImpulseSystem:r=this.colors[this.dataAt(G.BREL,e)];break;case h.HollowCandles:{let e=this.colors[i.isUpPrev||i.isSamePrev?1:0];r=t&&(i.isUp||i.isSame)?B.COLOR_TRANSPARENT:e;break}case h.Line:case h.PercentChange:case h.Ribbon:case h.Kagi:if(P(a)){r=a;break}r=this.colors[0];break;case h.PointAndFigure:{let t=+!!u_(this.dataAt(G.BARKIND,e));r=this.colors[t];break}default:throw Error(`Unexpected style ${h[this.style]} for a curve with varying colors`)}return P(r)||(r=this.colors[0]),r}else if(this.zones){let t=this.pickMainField(),n=this.dataAt(t,e),r=this.getColorsFromZone(n);return this.style===h.Area?this.pickAreaStroke(r):r.length>0?r[0]:this.colors[0]}else return(this.isMultiColumn||this.isStackedColumn)&&P(n)?this.colors[ke(this.colors,this.fields.findIndex(e=>e===n))]:this.colors[0]}};function Yy(e){return e.isOhlc?Ny:e.isRenko||e.isLineBreak?Hy:e.style===h.Ribbon?Wy:e.style===h.Area?my:e.isColumn||e.isMultiColumn?Cy:e.isStackedColumn?wy:e.isBaseline?hy:e.style===h.Step?ty:e.isKagi?ky:e.isPointAndFigure?By:e.style===h.Dots?ny:e.style===h.Line||e.isPercentChangeStyle?ey:null}function Xy(e,{open:t,close:n,change:r},i){let a=i.length>2&&e!==h.HLC,o=P(t,n),s=o&&n>t,c=o&&n===t,l=r>0,u=r===0;return{useSame:a,isUp:s,isSame:c,isUpPrev:l,isSamePrev:u,isDown:!s&&!c,isDownPrev:!l&&!u}}function Zy(e){let t=e.duplicate(),n=e;return`disableStreamingUpdates`in n&&(t.disableStreamingUpdates=n.disableStreamingUpdates),`surrogate`in n&&(t.surrogate=n.surrogate),t}var Qy=class e{symbol;aggregation;range;seriesKind;cacheMe;barsToFetch;offset;chartId;curveStyle;extendedHours;useLastTrade;fields=[];alwaysUseBarsToFetch;inputs=[];splits;padded;constructor(e,t,n=w.Normal,r=[null,null]){this.symbol=e,this.aggregation=t,this.range=r,this.seriesKind=n,this.cacheMe=!1,this.barsToFetch=0,this.offset=0,this.chartId=null,this.curveStyle=null,this.alwaysUseBarsToFetch=!1,this.splits=!0,this.padded=!1}getBuilderKey(){if(this.curveStyle!==null&&Js(this.inputs,qs(h[this.curveStyle])),!P(this.curveStyle)||!B.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return`Standard`;switch(this.curveStyle){case h.Renko:{let{method:e,period:t,source:n,brickSize:r}=xg(this.inputs);return`Renko;${e===`ATR`?`ATR;${t}`:`${e};${r}`};${n}`}case h.Kagi:{let{method:e,period:t,reversal:n}=n_(this.inputs);return`Kagi;${e===`ATR`?`ATR;${t}`:`User;${n}`}`}case h.PointAndFigure:{let{method:e,period:t,reversal:n,boxSize:r,source:i,oneStepBack:a}=d_(this.inputs);return`PointAndFigure;${e===`ATR`?`ATR;${t}`:`User;${r}`};${i};${n};${a}`}case h.LineBreak:{let{lineBreak:e}=i_(this.inputs);return`LineBreak;${e}`}default:return h[this.curveStyle]}}get needsExtraKey(){return[w.Options,w.BalanceSheet,w.IncomeStatement].includes(this.seriesKind)}getExtraKey(){return this.needsExtraKey&&this.fields.length>0?`${this.fields.map(e=>e.id).join(`;`)}`:``}getHashKey(){let e=this.aggregation.getHashKey(),t=this.getBuilderKey(),n=this.getExtraKey(),r=this.extendedHours??!1,i=this.aggregation.isEndOfDay&&(this.useLastTrade??!1);return`${this.symbol}|${i}|${e}|${r}|${this.range}|${this.seriesKind}|${this.offset}|${t}|${this.splits}|${this.padded}|${n}`}duplicate(){let t=new e(this.symbol,this.aggregation.duplicate(),this.seriesKind,this.range);return t.cacheMe=this.cacheMe,t.barsToFetch=this.barsToFetch,t.alwaysUseBarsToFetch=this.alwaysUseBarsToFetch,t.offset=this.offset,t.chartId=this.chartId,t.curveStyle=this.curveStyle,t.useLastTrade=this.useLastTrade,t.extendedHours=this.extendedHours,t.fields=F(this.fields),t.splits=this.splits,t.padded=this.padded,t}},$y=c(o(((e,t)=>{(function(n,r){var i={};n.PubSub?(i=n.PubSub,console.warn(`PubSub already loaded, using existing version`)):(n.PubSub=i,r(i)),typeof e==`object`?(t!==void 0&&t.exports&&(e=t.exports=i),e.PubSub=i,t.exports=e=i):typeof define==`function`&&define.amd&&define(function(){return i})})(typeof window==`object`&&window||e||global,function(e){var t={},n=-1,r=`*`;function i(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function o(e,t,n){try{e(t,n)}catch(e){setTimeout(a(e),0)}}function s(e,t,n){e(t,n)}function c(e,n,r,i){var a=t[n],c=i?s:o,l;if(Object.prototype.hasOwnProperty.call(t,n))for(l in a)Object.prototype.hasOwnProperty.call(a,l)&&c(a[l],e,r)}function l(e,t,n){return function(){var i=String(e),a=i.lastIndexOf(`.`);for(c(e,e,t,n);a!==-1;)i=i.substr(0,a),a=i.lastIndexOf(`.`),c(e,i,t,n);c(e,r,t,n)}}function u(e){var n=String(e);return!!(Object.prototype.hasOwnProperty.call(t,n)&&i(t[n]))}function d(e){for(var t=String(e),n=u(t)||u(r),i=t.lastIndexOf(`.`);!n&&i!==-1;)t=t.substr(0,i),i=t.lastIndexOf(`.`),n=u(t);return n}function f(e,t,n,r){e=typeof e==`symbol`?e.toString():e;var i=l(e,t,r);return d(e)?(n===!0?i():setTimeout(i,0),!0):!1}e.publish=function(t,n){return f(t,n,!1,e.immediateExceptions)},e.publishSync=function(t,n){return f(t,n,!0,e.immediateExceptions)},e.subscribe=function(e,r){if(typeof r!=`function`)return!1;e=typeof e==`symbol`?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var i=`uid_`+String(++n);return t[e][i]=r,i},e.subscribeAll=function(t){return e.subscribe(r,t)},e.subscribeOnce=function(t,n){var r=e.subscribe(t,function(){e.unsubscribe(r),n.apply(this,arguments)});return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0&&delete t[n]},e.countSubscriptions=function(e){var n,r,i=0;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0){for(r in t[n])i++;break}return i},e.getSubscriptions=function(e){var n,r=[];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0&&r.push(n);return r},e.unsubscribe=function(n){var r=typeof n==`string`&&(Object.prototype.hasOwnProperty.call(t,n)||function(e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0)return!0;return!1}(n)),i=!r&&typeof n==`string`,a=typeof n==`function`,o=!1,s,c,l;if(r){e.clearSubscriptions(n);return}for(s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(c=t[s],i&&c[n]){delete c[n],o=n;break}if(a)for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&c[l]===n&&(delete c[l],o=!0)}return o}})}))(),1);function eb(e,t,n){return new tb(e,t,n)}var tb=class{exprModel;innerSeries;calculable=!0;container;innerLookup;policy;exprSymbols;valueSymbols=[];onlyForTimeline;recalcTriggers;crashedComputationReported=!1;isLoading=!1;_sourceFields;_targetFields;basisChangedToken=null;quoteGroupToken=null;seasonalAverageOffset;constructor(e,t,n){this.exprModel=e,this.innerSeries=t,this.container=null,this.innerLookup=t.reduce((e,t)=>(e[n.mapper(t)]=t,e),{}),this.policy=n,this.exprSymbols=wd(e),this.valueSymbols=this.exprSymbols.filter(e=>this.innerLookup[e]===void 0),this.onlyForTimeline=j(this.symbols,this.exprSymbols),this.recalcTriggers=new Set(t)}refresh(){this.innerSeries.forEach(e=>e.refresh())}get canLoadMoreData(){return this.policy.loadMoreData&&this.innerSeries.some(e=>e.canLoadMoreData)}async loadMoreData(e=!0){if(this.isLoading)return Promise.resolve();this.isLoading=!0;let t=this.innerSeries.filter(e=>e.canLoadMoreData).map(t=>t.loadMoreData(e));await Promise.all(t),this.isLoading=!1}get isExprInError(){return!P(this.exprModel)}get hasData(){return this.container!==null}get sourceFields(){return this._sourceFields||=Array.from(this.policy.fieldMap.keys()),this._sourceFields}get targetFields(){return this._targetFields||=Array.from(this.policy.fieldMap.values()),this._targetFields}async ready(){return da.call(this,async()=>{this.basisChangedToken=$y.default.subscribe(K.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=$y.default.subscribe(K.RT_QUOTEGROUP,this.onQuoteGroup.bind(this));let e=this.innerSeries.map(e=>e.ready());this.policy.valueProvider!==void 0&&e.push(this.policy.valueProvider.ready());let t=(await Promise.all(e)).every(ue);return t&&this.calculate(),t})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every(e=>P(e.container))&&this.calculateCommon(K.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===d.Manual||e===K.TS_EVENTSCHANGED||e===K.TS_LOADING||!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some(e=>!P(e.container)))return;let n=this.policy.mapper(t.series);if(!(e===K.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(n)))switch(this.policy.recompute===d.Everything?K.TS_MANYCHANGED:e){case K.TS_MANYCHANGED:this.calculate();break;case K.TS_DATAPOINTCHANGED:case K.TS_DATAPOINTADDED:this.recalculate(e===K.TS_DATAPOINTADDED);break;case K.TS_TIMELINECORRECTION:case K.TS_QUOTEMARKER:break;default:throw Error(`Unknown time series message, likely forgot to handle it`)}}shutdown(){this.basisChangedToken&&$y.default.unsubscribe(this.basisChangedToken),this.quoteGroupToken&&($y.default.unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map((t,n)=>t===G.Volume?pe(this.exprSymbols.map(t=>e.inn[t].values[n]??0)):bd(this.exprModel,t=>e.oneValue[t]??e.inn[t]?.values[n]??null))}pickMainField(){let e=null;for(let t of this.policy.fieldMap.values())if(e==null)e=t;else if(t===G.Close){e=t;break}return e}calculateLastChange(){let e=this.container,t=e.size;if(t<=1)return;let n=this.pickMainField(),r=e.getData(n)[t-2],i=e.getData(n)[t-1];P(r,i)&&e.setLastDataPoint(G.Change,i-r)}calculateDataPoint(e,t){let n=this.calculateAt(e);if(n===null)return;e.atLeastOne=!0;let[r,i]=Ee(n,0,3);n[1]=i,n[2]=r,this.targetFields.forEach((e,r)=>{let i=n[r];t?this.container.addDataPoint(e,i):this.container.setLastDataPoint(e,i)}),t&&(this.container.addDataPoint(G.Change,null),this.container.addDataPoint(G.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){Ge(e,{series:this,index:this.container.size-1})}fieldValueAt(e,t,n){let r=this.innerLookup[e].container.getData(n);return t<0||t>=r.length?null:r[t]}timeStampAt(e,t){return this.fieldValueAt(e,t,G.DateTime)}timeline(e){return e.container.getData(G.DateTime)}getRangeHelper(){switch(this.policy.missing){case u.UseNext:case u.UseNone:return Math.min;case u.UsePrevious:return Math.max;default:throw Error(`Unknow missing bar policy, likely forgot to implement it.`)}}getRange(){let e=this.getRangeHelper();return{begin:new Date(e(...this.symbols.map(e=>Se(this.timeline(this.innerLookup[e]))))),end:new Date(e(...this.symbols.map(e=>xe(this.timeline(this.innerLookup[e])))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(e,t){let n=this.timeline(this.innerLookup[e]);switch(this.policy.missing){case u.UseNext:case u.UseNone:return n.findIndex(e=>e.valueOf()>=t.valueOf());case u.UsePrevious:return Ce(n,e=>e.valueOf()<=t.valueOf());default:throw Error(`Unknow missing bar policy, likely forgot to implement it.`)}}checkPos(e){let t=Object.keys(e.inn).length;e.isNull=Object.values(e.inn).some(e=>!P(e.timeStamp)&&(!this.policy.stretch(e.symbol)||t===1))}fillPosSymbolAt(e,t,n){e.index=t,e.timeStamp=this.timeStampAt(e.symbol,t);let r=(this.policy.missing===u.UseNone||this.policy.skipLeadingEmpty&&!n.atLeastOne)&&e.timeStamp&&e.timeStamp.valueOf()!==n.timeStamp.valueOf();return e.values=this.sourceFields.map(n=>r?null:this.fieldValueAt(e.symbol,t,n)),e}skippable(e){return this.innerLookup[e].container.isEmpty?this.policy.noDataApproach===f.IgnoreTimelineOnly&&this.onlyForTimeline.includes(e)||this.policy.noDataApproach===f.ModelTransformRequired:!1}get symbols(){let e=Object.keys(this.innerLookup);return P(this.onlyForTimeline)?e.filter(e=>!this.skippable(e)):e}getPos(e){let t={isNull:!0,inn:{},timeStamp:e,atLeastOne:!1,oneValue:{}};return this.symbols.length===0?t:(this.symbols.forEach(n=>{let r=this.findIndex(n,e),i={symbol:n,index:-1,timeStamp:new Date(0),values:[]};t.inn[n]=this.fillPosSymbolAt(i,r,t)}),this.valueSymbols.forEach(e=>{t.oneValue[e]=this.policy.valueProvider?.getValue(e)??null}),this.checkPos(t),t)}getInner(e){return Object.values(e.inn)}moveNext(e){e.isNull||(this.getInner(e).forEach(t=>{for(;P(t.timeStamp)&&t.timeStamp.valueOf()<=e.timeStamp.valueOf();)this.fillPosSymbolAt(t,t.index+1,e)}),this.checkPos(e),e.isNull||(e.timeStamp=new Date(Math.min(...this.getInner(e).filter(e=>e.timeStamp!==null).map(e=>e.timeStamp.valueOf()))),this.policy.missing===u.UsePrevious?this.getInner(e).forEach(t=>{let n=P(t.timeStamp);(n&&t.timeStamp.valueOf()>e.timeStamp.valueOf()||!n&&this.policy.stretch(t.symbol))&&this.fillPosSymbolAt(t,t.index-1,e)}):this.policy.missing===u.UseNone&&this.getInner(e).forEach(t=>this.fillPosSymbolAt(t,t.index,e))))}shouldAdd(e){let t=this.container?.getLastDataPoint(G.DateTime),n=e?.timeStamp;return P(t,n)?t.valueOf()<n.valueOf():!1}calculateCommon(e=null,t=null,n=!0){try{if(t)this.calculateDataPoint(t,n);else if(this.container=this.makeContainer(),!this.isExprInError){let e=this.getFirstPos();for(;!e.isNull;)this.calculateDataPoint(e,!0),this.moveNext(e)}e&&this.notify(e)}catch(e){this.crashedComputationReported||=(I(e,`error`),!0)}}calculate(){let{yes:e,no:t}=A(this.innerSeries,e=>!e.container.isEmpty);if(t.length>0&&this.policy.noDataApproach===f.ModelTransformRequired){let n=e=>e.map(this.policy.mapper),r=this.policy.modelTransform(n(e),n(t));r!==null&&(this.exprModel=r)}this.calculateCommon(K.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;let t=this.getLastPos(),n=this.shouldAdd(t);this.calculateCommon(n?K.TS_DATAPOINTADDED:K.TS_DATAPOINTCHANGED,t,n)}recalculateAt(e,t,n){return this.recalculate(n)}makeContainer(){return new _g([G.DateTime,G.Change].concat(this.targetFields))}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}};function nb(e){if(!(e instanceof tb)||e.innerSeries.length!==1||e.exprSymbols.length!==1||e.valueSymbols.length!==0)return e;let t=e.innerSeries[0],n=t.query;return!P(n)||!nt(n,`surrogate`)?e:t}function rb(e){let{query:t}=e;return t!==void 0&&`duplicate`in t&&`getBuilderKey`in t}function ib(e,t,n){if(!(e instanceof tb))return n(e);if(e.valueSymbols.length!==0)return new __;let r=e.innerSeries.map(n);return new tb(e.exprModel,r,{...e.policy,fieldMap:new Map([[t,t]])})}function ab(e,t){return ib(e,t,e=>e)}function ob(e,t){let n=nb(e);if(!rb(n))return new __;let r=Zy(n.query);if(r.symbol===B.PLACEHOLDER_SYMBOL_NAME||r.getBuilderKey()!==`Standard`)return new __(r);{r.barsToFetch!==0&&(r.barsToFetch*=B.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);let e=t(r);return e.serverComputedSeries=!0,e}}function sb(e,t,n){return ib(e,t,e=>ob(e,n))}function q(e){return new Ff(e,v.Number,b.Study,e)}var J=class{calcCtx;container;_source;target;inputs;outFields;studyFields={};innerSeries;calculable=!0;useNotifications=!1;initialNotification=!1;computedServerSide=!1;id;usedAsStyle=!1;recalcTriggers=new Set;basisChangedToken=null;_canLoadMoreData=!1;isLoading=!1;query;aggregation;sourceNeedsCompute=!1;allowEmptyValues=!1;constructor(e,...t){this.container=this._source=null,this.inputs=e.inputs,this.setOptions(e),this.innerSeries=t,this.id=bt(),this.addRecalcTrigger(...t)}refresh(){}get canLoadMoreData(){return this._canLoadMoreData}set canLoadMoreData(e){this._canLoadMoreData=e}loadMoreData(e){throw Error(`Should not be called.`)}addInner(...e){this.innerSeries.push(...e),this.addRecalcTrigger(...e)}isCalculable(e){return e.calculable??!1}addRecalcTrigger(...e){for(let t of e)this.isCalculable(t)?t.recalcTriggers.forEach(e=>this.recalcTriggers.add(e)):this.recalcTriggers.add(t)}setOptions(e){ut(this,e),nt(e,`source`)&&(this.source=e.source??null);let t=e.outFields??[e.target];this.studyFields=this.helpers.concat(t).reduce((e,t)=>(e[t.id]=t,e),{})}get helpers(){return B.EMPTY_ARRAY}get hasData(){return this.container!==null}get source(){if(P(this._source))return this._source;let e=P(this.inputs)?this.inputs[B.INPUT_SOURCE]:null;return P(e)?G[e]:null}set source(e){this._source=e}async ready(){return da.call(this,async()=>{this.basisChangedToken=this.useNotifications?$y.default.subscribe(K.TS_ALL,this.onBasisChanged.bind(this)):null;let e={tag:bt(),src:null},t=(await Promise.all(this.innerSeries.map(e=>e.ready()))).every(ue);return t&&this.calculate(e),t})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===K.TS_EVENTSCHANGED||e===K.TS_LOADING||this.innerSeries.some(e=>!e.hasData)||!this.shouldTriggerOurRecalc(t.series)||this.base===null||this===t.series)return;let n={tag:bt(),src:t.series};switch(e){case K.TS_MANYCHANGED:this.calculate(n);break;case K.TS_DATAPOINTCHANGED:case K.TS_DATAPOINTADDED:{let r=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(n,r,e===K.TS_DATAPOINTADDED);break}case K.TS_TIMELINECORRECTION:case K.TS_QUOTEMARKER:break;default:throw Error(`Unknown time series message, likely forgot to handle it`)}}shutdown(){this.useNotifications&&this.basisChangedToken&&$y.default.unsubscribe(this.basisChangedToken)}get baseIndex(){return 0}get base(){return this.innCont(this.baseIndex)}get period(){return this.inputs?.Period}calculateAt(e){return null}calculateDataPoint(e,t){let n=this.calculateAt(e);n!==null&&Object.keys(n).forEach(e=>{let r=n[e],i=this.studyFields[e];t?this.container.addDataPoint(i,r):this.container.setLastDataPoint(i,r)})}notify(e,t){Ge(e,{series:this,index:t})}calculateCommon(e,t=null,n=-1,r=!0){let i=n===-1,a=i?t=>{(P(e.src)||!P(t.calcCtx))&&t.calculate(e)}:t=>t.recalculateAt(e,n,r);if(!(this.base===null||this.calcCtx&&this.calcCtx.tag===e.tag||this===e.src)){if(this.calcCtx=e,this.innerSeries.filter(e=>this.isCalculable(e)&&!e.usedAsStyle).forEach(e=>a(e)),i&&(this.container=this.makeContainer()),this.calculateAt!==void 0)if(!i)this.calculateDataPoint(n,r);else{let e=this.base.size;for(let t=0;t<e;++t)this.calculateDataPoint(t,!0)}t&&(P(e.src)||this.initialNotification)&&this.notify(t,n)}}calculate(e){this.calculateCommon(e,K.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,n){this.computedServerSide||(!n&&N(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,n?K.TS_DATAPOINTADDED:K.TS_DATAPOINTCHANGED,t,n))}baseVal(e,t){return this.base.getData(e)[t]}innCont(e){return this.innerSeries[e].container}innVal(e,t,n){let r=this.innCont(e),i=r.size;return n<0||n>i-1?null:r.getData(t)[n]}innHasData(e){let t=this.innCont(e);return P(t)&&t.size>0}wrap(...e){return e.reduce((e,t)=>(e[t.f.id]=t.g,e),{})}wrapBaseFields(...e){return e.map(this.wrapBaseField,this)}wrapInner(e,t){return{f:e,g:()=>this.innCont(t).getData(e)}}wrapBaseField(e){return this.wrapInner(e,this.baseIndex)}get defaultWrappers(){return this.wrapBaseFields(G.DateTime,G.Symbol)}makeContainer(){let e=this.defaultWrappers.concat(this.getWrappers());return new yg(Object.keys(this.studyFields).map(e=>this.studyFields[e],this),this.wrap(...e))}getWrappers(){return[]}atLeast(e,t){return e>=t-1}exactly(e,t){return e==t-1}past(e,t,n,r=this.base){let i=r?.getData(n);return Array.isArray(i)?i.slice(e-t+1,e+1):[]}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}},cb=class extends J{constructor(e,...t){super(e,...t),this.usedAsStyle=!0}get actual(){return this.innerSeries[0]}get canLoadMoreData(){return this.actual.canLoadMoreData}async loadMoreData(e=!0){return this.actual.loadMoreData(e)}get record(){return this.actual.record}},lb=class extends J{constructor(e,t){super(e,t)}calculateAt(e){return null}getWrappers(){return[this.wrapInner(this.target,0)]}},ub=class extends cb{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){let[t,n,r,i]=[G.Open,G.High,G.Low,G.Close].map(t=>this.baseVal(t,e),this),a=null,o=null,s=null,c=null,l=me([t,n,r,i]);if(e<1)a=me([t,i]),o=n,s=r,c=0;else{let[t,i]=[G.Open,G.Close].map(t=>this.container.getData(t)[e-1],this);a=me([t,i]),o=Math.max(n,a,l),s=Math.min(r,a,l),c=l-i}return{[G.Open.id]:a,[G.High.id]:o,[G.Low.id]:s,[G.Close.id]:l,[G.Change.id]:c}}getWrappers(){return this.wrapBaseFields(G.Volume,G.OpenInterest,G.TradingDay)}},db=class extends J{constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=this.inputs.PeriodAverage,i=n(t,r,this.source??G.Close,G.ATREXTAVG),a=zD(t,this.inputs.PeriodATR);this.addInner(i,a)}calculateAt(e){let t=this.innVal(1,G.ATREXTAVG,e),n=this.innVal(2,G.ATR,e),r=t!==null&&n!==null,i=n*this.inputs.Multiplier;return{[G.ATREXTUP.id]:r?t+i:null,[G.ATREXTLOW.id]:r?t-i:null}}getWrappers(){return[this.wrapInner(G.ATREXTAVG,1)]}},fb=class extends J{constructor(e,t){super(e,t),rO(this)}calculateAt(e){let t=null,n=this.period,[,r]=iO(this);if(this.atLeast(e,n)&&r.hasField(this.source)){let i=this.past(e,n,this.source,r);this.allowEmptyValues?t=me(i.filter(de)):k(i)&&(t=me(i))}return{[this.target.id]:t}}getWrappers(){return this.source===G.Volume?this.wrapBaseFields(G.Volume,G.TradeSize,G.Change,G.Open,G.Close):[]}},pb=class extends J{multiplier;constructor(e,t,n){super(e,t),this.multiplier=n(this.period),rO(this)}calculateAt(e){let t=null,[n,r]=iO(this);if(this.atLeast(e,2)&&r.hasField(this.source)){let i=this.container.getData(this.target)[e-1];if(i!==null)t=(this.innVal(n,this.source,e)-i)*this.multiplier+i;else{let n=this.period;if(this.atLeast(e,n)){let i=this.past(e,n,this.source,r);this.allowEmptyValues?t=me(i.filter(de)):k(i)&&(t=me(i))}}}return{[this.target.id]:t}}},mb=class extends pb{constructor(e,t){super(e,t,e=>2/(e+1))}},hb=class extends pb{constructor(e,t){super(e,t,e=>1/e)}},gb=class extends J{constructor(e,t){super(e,t);let n=Y(t,this.inputs.Period1,G.High,G.MAHI),r=Y(t,this.inputs.Period2,G.Low,G.MALO);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.MAHI,1),this.wrapInner(G.MALO,2)]}},_b=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,n=G.OpenInterest;return this.base.hasField(n)&&(t=this.baseVal(n,e)),{[n.id]:t}}},vb=class extends _b{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(G.Volume,G.TradeSize,G.Change,G.Open,G.Close)}},yb=class extends _b{constructor(e,t){super(e,ab(t,G.OpenInterest))}getWrappers(){return this.wrapBaseFields(G.TradeSize,G.Change)}},bb={inField:G.MA,outFields:[G.ENVU,G.ENVD],func:Y},xb={inField:G.EMA,outFields:[G.ENVEXPU,G.ENVEXPD],func:X},Sb={inField:G.SMA,outFields:[G.ENVSMOU,G.ENVSMOD],func:AD},Cb=class extends J{kind;perc;constructor(e,t,n){super(e,n),this.kind=t,this.perc=this.inputs.Percent/100;let r=t.func(n,this.inputs.Period,e.source);this.addInner(r)}calculateAt(e){let t=null,n=null,r=this.innVal(1,this.kind.inField,e);if(r!==null){let e=r*this.perc;t=r+e,n=r-e}return{[this.kind.outFields[0].id]:t,[this.kind.outFields[1].id]:n}}},wb=class extends Cb{constructor(e,t){super(e,bb,t)}},Tb=class extends Cb{constructor(e,t){super(e,xb,t)}},Eb=class extends Cb{constructor(e,t){super(e,Sb,t)}},Db=class extends J{constructor(e,t){super(e,t);let n=Y(t,this.inputs.Period,this.source),r=Y(n,this.inputs.Period,G.MA,G.TMA);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.TMA,2)]}},Ob=class extends J{triangle;constructor(e,t){super(e,t);let n=this.period;this.triangle=n*(n+1)/2,rO(this)}weightedAverage(e){let t=e.length;if(t===0)return null;let n=t===this.period?this.triangle:t*(t+1)/2;return e.reduce((e,t,n)=>e+t*(n+1),0)/n}calculateAt(e){let t=null,n=this.period,[,r]=iO(this);if(this.atLeast(e,n)){let i=this.past(e,n,this.source,r);this.allowEmptyValues?t=this.weightedAverage(i.filter(de)):k(i)&&(t=this.weightedAverage(i))}return{[this.target.id]:t}}},kb=class extends J{constructor(e,t){super(e,t);let n=Y(t,this.inputs.Period1,this.source),r=Y(t,this.inputs.Period2,this.source),i=Q(this.target,(e,t,n)=>t-n,n,r);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},Ab={fields:[G.MACD,G.MACDS,G.MACDH],avgFunc:Y,mapFunc:eO,histogramVaryColor:!0},jb={fields:[G.MACD,G.MACDS,G.MACDH],avgFunc:X,mapFunc:eO,histogramVaryColor:!0},Mb={fields:[G.MACD,G.CTLTM,G.CTM],avgFunc:X,mapFunc:eO,histogramVaryColor:!1},Nb={fields:[G.MACD,G.CTLTMF,G.CPMI],avgFunc:X,mapFunc:eO,histogramVaryColor:!1},Pb={fields:[G.PPO,G.PPOS,G.PPOH],avgFunc:X,mapFunc:tO,histogramVaryColor:!0},Fb={fields:[G.PVO,G.PVOS,G.PVOH],avgFunc:X,mapFunc:tO,histogramVaryColor:!1},Ib=class extends J{histogramVaryColor=!1;histogramField;get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=-1;if(this.histogramVaryColor&&e>0){let n=this.container.getData(this.histogramField)[e],r=this.container.getData(this.histogramField)[e-1];if(P(n,r)){let i=n<=0;t=i?1:3,e>0&&(i&&n>r&&(t=0),!i&&n<r&&(t=2))}}return{[G.BARCOLIX.id]:t}}},Lb=class extends Ib{fields;constructor(e,t,n){super(e,n),this.fields=t.fields,this.histogramVaryColor=t.histogramVaryColor,this.histogramField=this.fields[2];let r=t.avgFunc(n,e.inputs.Period1,e.source,void 0),i=t.avgFunc(n,e.inputs.Period2,e.source,void 0),a=Q(this.fields[0],t.mapFunc,r,i),o=t.avgFunc(a,e.inputs.Period3,a.target,this.fields[1]),s=Q(this.fields[2],eO,a,o);this.addInner(a,o,s)}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}},Rb=class extends Ib{constructor(e,t){super(e,t),this.histogramVaryColor=!0,this.histogramField=G.MACDVH;let n=cO(e,`EMA`,`Average`),r=n(t,e.inputs.Period1,e.source,void 0),i=n(t,e.inputs.Period2,e.source,void 0),a=zD(t,e.inputs.Period2,e.inputs.Average),o=Q(G.MACDV,(e,t,n,r)=>(t-n)/r*100,r,i,a),s=n(o,e.inputs.Period3,o.target,G.MACDVS),c=Q(G.MACDVH,eO,o,s);this.addInner(o,s,c)}getWrappers(){return[this.wrapInner(G.MACDV,1),this.wrapInner(G.MACDVS,2),this.wrapInner(G.MACDVH,3)]}},zb=class extends Lb{constructor(e,t){super(e,Ab,t)}},Bb=class extends Lb{constructor(e,t){super(e,jb,t)}},Vb=class extends Lb{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,Mb,t)}},Hb=class extends Lb{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,Nb,t)}},Ub=class extends Lb{constructor(e,t){super(e,Pb,t)}},Wb=class extends Lb{constructor(e,t){super(e,Fb,t)}},Gb=q(`_AVG_GAIN`),Kb=q(`_AVG_LOSS`),qb=class extends J{isModified;constructor(e,t){super(e,t);let n=e.inputs.Modified;this.isModified=n}get helpers(){return[Gb,Kb]}gain(e,t){return t[e]>t[e-1]?t[e]-t[e-1]:0}loss(e,t){return t[e]<t[e-1]?t[e-1]-t[e]:0}calculateAt(e){let t=null,n=null,r=null,i=this.period;if(this.atLeast(e,i+1)){if(this.container.getData(this.target)[e-1]!==null&&!this.isModified){let t=this.container.getData(Gb)[e-1],a=this.container.getData(Kb)[e-1],o=this.past(e,2,this.source),s=this.gain(1,o),c=this.loss(1,o);n=(t*(i-1)+s)/i,r=(a*(i-1)+c)/i}else{let t=this.past(e,i+1,this.source);if(k(t)){let e=he(1,i),a=e.map(e=>this.gain(e,t)),o=e.map(e=>this.loss(e,t));n=me(a),r=me(o)}}n!==null&&r!==null&&(t=100-100/(1+n/r))}return{[Gb.id]:n,[Kb.id]:r,[this.target.id]:t}}},Jb=class extends J{constructor(e,t,n){super(e,n);let r=WD(n,this.inputs.Period,this.source,G.RSI,t),i=cO(e,`MA`,`Average`)(r,this.inputs.PeriodAvg,G.RSI,G.RSIAVG);this.addInner(r,i)}getWrappers(){return[this.wrapInner(G.RSI,1),this.wrapInner(G.RSIAVG,2)]}},Yb=class extends Jb{constructor(e,t){super(e,!1,t)}},Xb=class extends Jb{constructor(e,t){super(e,!0,t)}},Zb=class extends J{constructor(e,t){super(e,t);let n=WD(t,this.inputs.Period,this.source),r=this.inputs.Range,i=Z(G.STORSI,function(e){let t=null;if(this.atLeast(e,r)){let n=this.past(e,r,G.RSI,this.base),i=Ee(n),a=i[0],o=i[1];t=(xe(n)-a)/(o-a)}return{[G.STORSI.id]:t}},n),a=cO(e,`MA`,`Average`),o=this.inputs.PeriodAvg,s=a(i,o,G.STORSI,G.STORSIAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(G.STORSI,1),this.wrapInner(G.STORSIAVG,2)]}},Qb=class extends J{constructor(e,t){super(e,t);let n=PD(t,this.inputs.Period1,G.High,G.HH,!0),r=PD(t,this.inputs.Period2,G.Low,G.LL,!1);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.HH,1),this.wrapInner(G.LL,2)]}},$b=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,[n,r,i]=[G.Close,G.High,G.Low].map(t=>this.baseVal(t,e));return t=(2*n+r+i)/4,{[this.target.id]:t}}},ex=class extends J{highest;index;constructor(e,t,n,r){super(e,r),this.highest=t,this.index=n}calculateAt(e){let t=null,n=this.inputs.Period;if(this.atLeast(e,n)){let r=this.past(e,n,this.source);k(r)&&(t=this.highest?Math.max(...r):Math.min(...r),this.index&&(t=n-r.indexOf(t)-1))}return{[this.target.id]:t}}},tx=class extends J{toHighest;field;highField;lowField;constructor(e,t,n){super(e,n),this.toHighest=t;let r=P(e.source),i=e.source,a=r?i:G.Close;this.field=a;let o=r?i:G.High;this.highField=o;let s=r?i:G.Low;this.lowField=s;let c=PD(n,e.inputs.Period,this.highField,G.HH,!0),l=PD(n,e.inputs.Period,this.lowField,G.LL,!1);this.addInner(c,l)}calculateAt(e){let t=null,n=this.baseVal(this.field,e),r=this.innVal(1,G.HH,e),i=this.innVal(2,G.LL,e);if(k([n,r,i])){let e=this.toHighest?r:i,a=r-i;a!==0&&(t=(n-e)/a*100)}return{[this.target.id]:t}}},nx=class extends tx{constructor(e,t){super(e,!0,t)}},rx=q(`RawPercK`),ix=class extends J{kField;constructor(e,t,n,r){super(e,r);let i=FD(r,this.inputs.Period1,t?rx:n,!1),a=cO(e,`MA`),o=a(i,this.inputs.Period2,i.target,t?n:G.PercD),s=t?a(o,this.inputs.Period3,o.target,G.PercD):o;this.kField=n,t?this.addInner(o,s):this.addInner(i,o)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(G.PercD,2)]}},ax=class extends ix{constructor(e,t){super(e,!1,G.PercK,t)}},ox=class extends ix{constructor(e,t){super(e,!0,G.PercK,t)}},sx=class extends ix{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,G.CTPI,t)}};function cx(e,t,n,r,i){if(i===null)return null;let a=e*i,o=r+a,s=r-a;switch(t){case G.BOLLBU:return o;case G.BOLLBL:return s;case G.BOLLBW:return(o-s)/r*100;default:return null}}var lx=class extends J{kind;constructor(e,t,n){super(e,n),this.kind=t,rO(this);let r=this.inputs.Period,i=this.source,a=Y(n,r,i,G.BOLLBM),o=t===`Modified`,s=KD(o?ID(n,i):n,r,o?G.PCTCHG:i),c=this.inputs.Width,l=e=>ce(cx,c,e),u=Q(G.BOLLBU,l(G.BOLLBU),a,s),d=Q(G.BOLLBL,l(G.BOLLBL),a,s),f=Q(G.BOLLBW,l(G.BOLLBW),a,s),p=cO(e,`MA`,`Average`),m=this.inputs.PeriodAvg,h=p(f,m,G.BOLLBW,G.BOLLBWA);this.addInner(a,s,u,d,f,h)}calculateAt(e){let t=+!!this.sourceNeedsCompute,n=this.innVal(3+t,G.BOLLBU,e),r=this.innVal(4+t,G.BOLLBL,e),i=this.innVal(1+t,G.BOLLBM,e),a=this.innVal(5+t,G.BOLLBW,e),o=this.innVal(6+t,G.BOLLBWA,e),s=null;switch(this.kind){case`Regular`:return{[G.BOLLBU.id]:n,[G.BOLLBL.id]:r,[G.BOLLBM.id]:i};case`Width`:return{[G.BOLLW.id]:n-r};case`Percent`:if(P(n,r)){let[t]=iO(this),i=this.innVal(t,this.source,e);P(i)&&(s=(i-r)/(n-r))}return{[G.BOLLP.id]:s};case`BandWidth`:return{[G.BOLLBW.id]:a,[G.BOLLBWA.id]:o};case`Modified`:{let n=null,r=null,a=null,o=null,s=this.innVal(2+t,G.MSD,e);if(P(s)){let e=this.inputs.MultInside,t=this.inputs.MultOutside;n=i+e*s,a=i-e*s,r=i+t*s,o=i-t*s}return{[G.MBBUI.id]:n,[G.MBBLI.id]:a,[G.MBBUO.id]:r,[G.MBBLO.id]:o,[G.MBBM.id]:i}}default:return null}}},ux=class extends lx{constructor(e,t){super(e,`Regular`,t)}},dx=class extends lx{constructor(e,t){super(e,`Width`,t)}},fx=class extends lx{constructor(e,t){super(e,`Percent`,t)}},px=class extends lx{constructor(e,t){super(e,`BandWidth`,t)}},mx=class extends lx{constructor(e,t){super(e,`Modified`,t)}},hx=class extends J{constructor(e,t){super(e,t);let n=Z(G.OBVOL,function(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Volume,e),i=this.baseVal(G.Close,e-1),a=this.container.getData(this.target)[e-1];P(a)||(a=0),t=n>i?a+r:n<i?a-r:a}return{[this.target.id]:t}},t),r=cO(e,`MA`,`Average`),i=this.period,a=r(n,i,G.OBVOL,G.OBVOLAVG);this.addInner(n,a)}getWrappers(){return[this.wrapInner(G.OBVOL,1),this.wrapInner(G.OBVOLAVG,2)]}},gx=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,n=this.baseVal(G.High,e),r=this.baseVal(G.Low,e);if(e>0){let i=this.baseVal(G.Close,e-1);t=Math.max(n-r,Math.abs(n-i),Math.abs(r-i))}else t=n-r;return{[this.target.id]:t}}},_x=q(`_ABS_CHG`),vx=q(`_MA_ABS_CHG`),yx=q(`_CHG`),bx=class extends J{constructor(e,t){super(e,t);let n=RD(t,G.TR),r=cO(e,`SMA`)(n,this.inputs.Period,G.TR,this.target),i=Y(r,this.inputs.Period2,G.ATR,G.ATRMA);this.addInner(r,i)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(G.ATRMA,2)]}},xx=class extends J{constructor(e,t){super(e,t);let n=Z(_x,se((e,t)=>{let n=0;return t>0&&(n=this.baseVal(e,t)-this.baseVal(e,t-1)),{[_x.id]:Math.abs(n)}},this.source),t),r=cO(e,`MA`)(n,this.inputs.Period,_x,vx),i=Q(G.ADJATR,(e,t)=>2*t,r);this.addInner(i)}getWrappers(){return[this.wrapInner(G.ADJATR,1)]}},Sx=class extends J{constructor(e,t){super(e,t);let n=Z(yx,e=>{let t=0;return e>0&&(t=this.baseVal(G.Close,e)-this.baseVal(G.Close,e-1)),{[yx.id]:t}},t),r=uO(e),i=this.inputs.Period,a=this.inputs.Smoothing,o=r(t,i,a),s=Q(this.target,(e,t,n)=>!P(t)||!P(n)?null:t/n,n,o);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}},Cx=q(`_PDM`),wx=q(`_MDM`),Tx=q(`_TRS`),Ex=q(`_PDS`),Dx=q(`_MDS`),Ox=q(`_DX`),kx=class extends J{useEma;adxField;multiplier;constructor(e,t,n,r){super(e,r),this.useEma=t,this.adxField=n,this.multiplier=2/(this.inputs.AdxSmoothing+1);let i=RD(r,G.TR);this.addInner(i)}get helpers(){return[Cx,wx,Tx,Ex,Dx,Ox]}sum(e,t,n,r){let i=null;if(this.atLeast(e-1,r-1)){let a=this.past(e-1,r-1,t,this.container);a.push(n),k(a)&&(i=a.reduce((e,t,n)=>e+t,0))}return i}smooth1(e,t,n,r){let i=null,a=this.inputs.DiLength,o=this.container.getData(n)[e-1];return i=o===null?this.sum(e,t,r,a):o-o/a+r,i}smooth2(e,t,n,r){let i=this.container.getData(n)[e-1],a=this.inputs.AdxSmoothing;if(i!==null)return this.useEma?(r-i)*this.multiplier+i:(i*(a-1)+r)/a;{let n=this.sum(e,t,r,a);if(n!==null)return n/a}return null}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;if(e>0){let u=this.past(e,2,G.High),d=this.past(e,2,G.Low),f=Math.max(u[1]-u[0],0),p=Math.max(d[0]-d[1],0);t=f>p?f:0,n=p>f?p:0;let m=this.container.getData(G.TR)[e];i=this.smooth1(e,Cx,Ex,t),a=this.smooth1(e,wx,Dx,n),r=this.smooth1(e,G.TR,Tx,m),(i>0||a>0)&&r!==0&&(o=i/r*100,s=a/r*100,c=100*Math.abs(o-s)/(o+s),l=this.smooth2(e,Ox,this.adxField,c))}return{[Cx.id]:t,[wx.id]:n,[Tx.id]:r,[Ex.id]:i,[Dx.id]:a,[G.PDI.id]:o,[G.MDI.id]:s,[Ox.id]:c,[this.adxField.id]:l}}getWrappers(){return[this.wrapInner(G.TR,1)]}},Ax=class extends kx{constructor(e,t){super(e,!1,G.ADX,t)}},jx=class extends kx{constructor(e,t){super(e,!0,G.ADXM,t)}},Mx=class extends J{constructor(e,t){super(e,t);let n=GD(t);this.addInner(n)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,G.MFMUL,e),{[this.target.id]:t}}},Nx=class extends J{constructor(e,t){super(e,t);let n=Z(G.ADWM,function(e){let t=null,n=null;if(e>0){let r=this.baseVal(G.Close,e-1),i=Math.max(r,this.baseVal(G.High,e)),a=Math.min(r,this.baseVal(G.Low,e)),o=this.baseVal(G.Close,e);t=o>r?o-a:o<r?o-i:0,e>1&&(n=(e>2?this.container.getData(G.ADWM)[e-1]:0)+t)}return{[G.ADWM.id]:n}},t),r=Y(n,this.inputs.Period,G.ADWM,G.ADWMMA);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.ADWM,1),this.wrapInner(G.ADWMMA,2)]}},Px=class extends J{constructor(e,t){super(e,t);let n=G.ADL,r=VD(t,n),i=X(r,3,n),a=X(r,10,n),o=Q(e.target,(e,t,n)=>t-n,i,a);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},Fx=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=me([G.Close,G.High,G.Low].map(t=>this.baseVal(t,e))),{[this.target.id]:t}}},Ix=class extends J{calculateAtFunc;constructor(e,t,...n){super(e,...n),this.calculateAtFunc=t}calculateAt(e){let t=this.innerSeries.map((t,n)=>{let r=t,i=r.target;return P(i)||(i=r.container.hasField(G.Close)?G.Close:r.container.fields[0]),this.innVal(n,i,e)}),n=null;return k(t)&&(n=this.calculateAtFunc(e,...t)),{[this.target.id]:n}}};function Lx(e,t){let n=this.baseVal(G.High,t),r=this.baseVal(G.Low,t);return{[e.id]:(n+r)/2}}function Rx(e,t){let n=this.baseVal(G.High,t),r=this.baseVal(G.Low,t);return{[e.id]:n-r}}var zx=class extends J{calculateAtFunc;constructor(e,t,n){super(e,n),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}},Bx=q(`_RANGE`),Vx=q(`_MOV_RANGE`),Hx={fields:[G.KCUP,G.KCLOW,G.KCMID],midSeries:e=>HD(e,G.TP),midTarget:G.TP,rangeSeries:e=>Z(Bx,se(Rx,Bx),e),rangeTarget:Bx,func:`MA`,useMultiplier:!1},Ux={fields:[G.KBUP,G.KBLOW,G.KBMID],midSeries:e=>e,midTarget:G.Close,rangeSeries:e=>RD(e,G.TR),rangeTarget:G.TR,func:`EMA`,useMultiplier:!0},Wx=class extends J{kind;constructor(e,t,n){super(e,n),this.kind=t;let r=t.midSeries(n),i=cO(e,t.func,`Average`),a=i(r,this.inputs.Period,t.midTarget,t.fields[2]),o=i(t.rangeSeries(n),this.inputs.Period,t.rangeTarget,Vx);this.addInner(a,o)}calculateAt(e){let t=this.innVal(1,this.kind.fields[2],e),n=this.innVal(2,Vx,e),r=t!==null&&n!==null,i=this.kind.useMultiplier?this.inputs.Multiplier:1;return{[this.kind.fields[0].id]:r?t+n*i:null,[this.kind.fields[1].id]:r?t-n*i:null}}getWrappers(){return[this.wrapInner(this.kind.fields[2],1)]}},Gx=class extends Wx{constructor(e,t){super(e,Hx,t)}},Kx=class extends Wx{constructor(e,t){super(e,Ux,t)}},qx=class extends J{isWidth;constructor(e,t,n){super(e,n),this.isWidth=t;let r=PD(n,this.inputs.Period,G.High,G.DONUP,!0),i=PD(n,this.inputs.Period,G.Low,G.DONLOW,!1);this.addInner(r,i)}calculateAt(e){let t=this.innVal(1,G.DONUP,e),n=this.innVal(2,G.DONLOW,e),r=t===null&&n===null;return this.isWidth?{[G.DONW.id]:r?null:t-n}:{[G.DONMID.id]:r?null:(t+n)/2}}getWrappers(){return[this.wrapInner(G.DONUP,1),this.wrapInner(G.DONLOW,2)]}},Jx=class extends qx{constructor(e,t){super(e,!1,t)}},Yx=class extends qx{constructor(e,t){super(e,!0,t)}},Xx=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Volume,e),i=this.baseVal(G.Close,e-1),a=this.container.getData(this.target)[e-1];P(a)||(a=0);let o=(n-i)/i*r;t=a+o}return{[this.target.id]:t}}},Zx=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,this.source),r=X(n,this.inputs.Period,n.target),i=X(r,this.inputs.Period,r.target),a=UD(i,1,i.target,this.target);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},Qx=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,this.source),r=X(n,this.inputs.Period,n.target),i=Q(G.DEMA,(e,t,n)=>2*t-n,n,r);this.addInner(i)}getWrappers(){return[this.wrapInner(G.DEMA,1)]}},$x=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period1,this.source),r=X(t,this.inputs.Period2,this.source),i=Q(G.EOSC,(e,t,n)=>t-n,n,r);this.addInner(i)}getWrappers(){return[this.wrapInner(G.EOSC,1)]}},eS=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,this.source),r=X(n,this.inputs.Period,n.target),i=X(r,this.inputs.Period,r.target),a=Q(G.TEMA,(e,t,n,r)=>3*(t-n)+r,n,r,i);this.addInner(a)}getWrappers(){return[this.wrapInner(G.TEMA,1)]}},tS=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n+1)){let r=this.baseVal(this.source,e-n);r!==null&&r!==0&&(t=(this.baseVal(this.source,e)-r)/r*100)}return{[this.target.id]:t}}},nS=class extends J{constructor(e,t){super(e,t);let n=HD(t,G.PVPT);this.addInner(n)}calculateAt(e){let t=this.innVal(1,G.PVPT,e),n=this.baseVal(G.High,e),r=this.baseVal(G.Low,e);return{[G.PVPTR.id]:t+n-r,[G.PVPTS.id]:t-n+r}}getWrappers(){return[this.wrapInner(G.PVPT,1)]}},rS=q(`_HIND`),iS=q(`_LIND`),aS=class extends J{justWidth;constructor(e,t,n){super(e,n),this.justWidth=t,this.justWidth=t;let r=this.inputs.Period,i=PD(n,r,G.High,rS,!0,!0),a=PD(n,r,G.Low,iS,!1,!0);this.addInner(i,a)}calculateAt(e){let t=null,n=null,r=null,i=this.innVal(1,rS,e),a=this.innVal(2,iS,e);if(i!==null&&a!==null){let e=this.period;t=(e-i)/e*100,n=(e-a)/e*100,r=t-n}return this.justWidth?{[G.ARNOSC.id]:r}:{[G.ARNUP.id]:t,[G.ARNLOW.id]:n}}},oS=class extends aS{constructor(e,t){super(e,!1,t)}},sS=class extends aS{constructor(e,t){super(e,!0,t)}},cS=class extends J{constructor(e,t){super(e,t);let n=e.inputs.Range===`Close`,r=fO(t);if(!n&&r){let e=Z(G.TCHNUP,(e,t)=>null,t),n=Z(G.TCHNLOW,(e,t)=>null,t);this.addInner(e,n)}else{let r=PD(t,e.inputs.PeriodUpper,n?G.Close:G.High,G.TCHNUP,!0),i=PD(t,e.inputs.PeriodLower,n?G.Close:G.Low,G.TCHNLOW,!1);this.addInner(r,i)}}getWrappers(){return[this.wrapInner(G.TCHNUP,1),this.wrapInner(G.TCHNLOW,2)]}},lS=class extends J{constructor(e,t){super(e,t);let n=YD(t,e.inputs.Period,e.inputs.Range);this.addInner(n)}calculateAt(e){let t=null,n=this.innVal(1,G.TCHNUP,e),r=this.innVal(1,G.TCHNLOW,e),i=this.inputs.Adjustment,a=this.inputs.Retracement;return a===`Long`?t=P(n)?n-i:null:a===`Short`&&(t=P(r)?r+i:null),{[this.target.id]:t}}},uS=q(`_MIDPOINT`),dS=class extends J{constructor(e,t){super(e,t);let n=Z(uS,se(Lx,uS),t),r=AD(n,e.inputs.Period1,uS,G.ALJAW),i=AD(n,e.inputs.Period2,uS,G.ALTEETH),a=AD(n,e.inputs.Period3,uS,G.ALLIPS);this.addInner(r,i,a)}calculateAt(e){return{[G.ALJAW.id]:this.innVal(1,G.ALJAW,e),[G.ALTEETH.id]:this.innVal(2,G.ALTEETH,e),[G.ALLIPS.id]:this.innVal(3,G.ALLIPS,e)}}},fS=class extends J{constructor(e,t){super(e,t)}calculateAt(e){return{[G.PLTLN.id]:this.inputs.Position}}},pS=q(`_MIDPOINT`),mS=class extends J{constructor(e,t){super(e,t);let n=Z(pS,se(Lx,pS),t),r=Y(n,this.inputs.Period1,pS),i=Y(n,this.inputs.Period2,pS),a=Q(G.AWOS,(e,t,n)=>t-n,r,i),o=Y(a,this.inputs.Period3,a.target,G.AWOSMA);this.addInner(a,o)}getWrappers(){return[this.wrapInner(G.AWOS,1),this.wrapInner(G.AWOSMA,2)]}},hS=class extends J{multiplyVol;constructor(e,t,n){super(e,n),this.multiplyVol=t}calculateAt(e){let[t,n,r,i]=[G.High,G.Low,G.Close,G.Volume].map(t=>this.baseVal(t,e)),a=t===n?0:(r-n-(t-r))/(t-n);return this.multiplyVol&&(a*=i),{[this.target.id]:a}}},gS=class extends hS{constructor(e,t){super(e,!1,t)}},_S=class extends hS{constructor(e,t){super(e,!0,t)}},vS=class extends J{constructor(e,t){super(e,t);let n=GD(t);this.addInner(n)}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,G.Volume),i=this.past(e,n,G.MFMUL,this.innCont(1));if(k(r)&&k(i)){let e=pe(r);e!==0&&(t=pe(i)/e)}}return{[this.target.id]:t}}},yS=q(`_RANGE`),bS=class extends J{constructor(e,t){super(e,t);let n=UD(X(Z(yS,se(Rx,yS),t),this.inputs.Period1,yS),this.inputs.Period2,G.EMA,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},xS=class extends J{shift;constructor(e,t){super(e,t);let n=this.inputs.Period;this.shift=Math.floor(n/2)+1;let r=Y(t,n,e.source);this.addInner(r)}calculateAt(e){let t=null,n=this.shift,r=this.innVal(1,G.MA,e-n);return r!==null&&(t=this.baseVal(this.source,e)-r),{[this.target.id]:t}}},SS=q(`_MATP`),CS=class extends J{constructor(e,t){super(e,t);let n=HD(t),r=Y(n,this.inputs.Period,n.target,SS);this.addInner(n,r)}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,G.TP,this.innCont(1));if(k(r)){let n=this.innVal(2,SS,e);if(n!==null){let i=r.reduce((e,t,r)=>e+Math.abs(n-t),0)/this.period;t=(this.innVal(1,G.TP,e)-n)/(.015*i)}}}return{[this.target.id]:t}}},wS=class extends J{constructor(e,t){super(e,t);let n=Z(G.EMV,function(e){let t=null;if(e>0){let[n,r,i]=[G.High,G.Low,G.Volume].map(t=>this.baseVal(t,e)),[a,o]=[G.High,G.Low].map(t=>this.baseVal(t,e-1));t=((n+r)/2-(a+o)/2)/(i/1e6/(n-r))}return{[this.target.id]:t}},t),r=Y(n,this.inputs.Period,G.EMV,G.EMVMA);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.EMV,1),this.wrapInner(G.EMVMA,2)]}},TS=class extends J{isBull;constructor(e,t,n){super(e,n),this.isBull=t;let r=X(n,this.inputs.Period,this.source);this.addInner(r)}calculateAt(e){let t=null,n=this.innVal(1,G.EMA,e);return n!==null&&(t=this.isBull?this.baseVal(G.High,e)-n:this.baseVal(G.Low,e)-n),{[this.isBull?G.ERBLPOW.id:G.ERBRPOW.id]:t}}},ES=class extends TS{constructor(e,t){super(e,!0,t)}},DS=class extends TS{constructor(e,t){super(e,!1,t)}},OS=q(`_FORCE`),kS=class extends J{constructor(e,t){super(e,t);let n=X(Z(OS,function(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Volume,e);t=(n-this.baseVal(G.Close,e-1))*r}return{[this.target.id]:t}},t),this.inputs.Period,OS,G.FI);this.addInner(n)}getWrappers(){return[this.wrapInner(G.FI,1)]}},AS=q(`_RANGE`),jS=q(`_EMA1`),MS=q(`_EMA2`),NS=q(`_RATIO`),PS=class extends J{constructor(e,t){super(e,t);let n=X(Z(AS,se(Rx,AS),t),9,AS,jS),r=Q(NS,(e,t,n)=>t/n,n,X(n,9,jS,MS));this.addInner(r)}calculateAt(e){let t=null;if(this.atLeast(e,25)){let n=this.past(e,25,NS,this.innCont(1));k(n)&&(t=pe(n))}return{[this.target.id]:t}}},FS=class extends J{constructor(e,t){super(e,t);let n=this.inputs.Period,r=Z(G.MOM,ce(oO,n,this.source),t),i=Y(r,this.inputs.Movement,G.MOM,G.MOMMA);this.addInner(r,i)}getWrappers(){return[this.wrapInner(G.MOM,1),this.wrapInner(G.MOMMA,2)]}},IS=class extends J{constructor(e,t){super(e,t);let n=HD(t);this.addInner(n)}calculateAt(e){let t=null,n=this.period+1;if(this.atLeast(e,n)){let r=this.past(e,n,G.TP,this.innCont(1)),i=this.past(e,n,G.Volume).map(e=>e??0);if(k(r)&&k(i)){let e=0,a=0;for(let t=1;t<n;++t){let n=r[t]*i[t];r[t]>r[t-1]?e+=n:a+=n}t=100-100/(1+e/a)}}return{[this.target.id]:t}}},LS=class extends J{constructor(e,t){super(e,t),rO(this);let n=Y(t,this.inputs.Period,this.source);this.addInner(n)}calculateAt(e){let t=null,[n,r]=iO(this),i=this.innVal(n+1,G.MA,e);if(i!==null){let n=this.inputs.Period,a=this.past(e,n,this.source,r);a=a.map(e=>(e-i)*(e-i)),t=Math.sqrt(me(a))}return{[this.target.id]:t}}getWrappers(){let[e]=iO(this);return[this.wrapInner(G.MA,e+1)]}},RS={isNegative:!1,fields:[G.PVI,G.PVIEMA]},zS={isNegative:!0,fields:[G.NVI,G.NVIEMA]},BS=class extends J{kind;constructor(e,t,n){super(e,n),this.kind=t;let r=Z(this.kind.fields[0],se(function(e,t){let n=1e3;if(t>0){let r=[G.Close,G.Volume],[i,a]=r.map(e=>this.baseVal(e,t)),[o,s]=r.map(e=>this.baseVal(e,t-1)),c=this.container.getData(this.target)[t-1];n=(e?a<s:a>s)?c*((i-o)/o+1):c}return{[this.target.id]:n}},this.kind.isNegative),n),i=X(r,this.inputs.Period,this.kind.fields[0],this.kind.fields[1]);this.addInner(r,i)}getWrappers(){return[this.wrapInner(this.kind.fields[0],1),this.wrapInner(this.kind.fields[1],2)]}},VS=class extends BS{constructor(e,t){super(e,zS,t)}},HS=class extends BS{constructor(e,t){super(e,RS,t)}},US=q(`_PRICE_CHANGE`),WS=class extends J{constructor(e,t){super(e,t);let n=this.source??G.Close,r=Math.sqrt(dO(e.aggregation)),i=e.inputs.Calculation===`Absolute`;if(r===0){let e=Z(this.target,(e,t)=>null,t);this.addInner(e)}else{let a=function(e,t){let n=null;if(t>0){let r=this.baseVal(e,t),a=this.baseVal(e,t-1);r!==null&&a!==null&&(n=i?r-a:Math.log(r/a))}return{[US.id]:n}},o=function(e,t){let n=null,r=this.baseVal(G.MSD,t);return r!==null&&(n=(i?1:100)*r*e),{[G.HV.id]:n}},s=KD(Z(US,se(a,n),t),e.inputs.Period,US,G.MSD),c=Z(G.HV,se(o,r),s);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}},GS=class extends J{noOp;constructor(e,t){super(e,t);let n=this.inputs.Anchor===`VisibleStart`;this.noOp=n}calculateAt(e){let t=null,n=this.baseVal(this.source,0),r=this.baseVal(this.source,e);return this.noOp?t=r:n!==null&&r!==null&&(t=(r-n)/n*100),{[this.target.id]:t}}},KS=q(`_SWING_INDEX`),qS=class extends J{constructor(e,t){super(e,t)}get helpers(){return[KS]}ohlcVals(e){return[G.Open,G.High,G.Low,G.Close].map(t=>this.baseVal(t,e))}obtainR(e,t,n,r){let i=Math.abs(e-r),a=Math.abs(t-r),o=Math.abs(e-t),s=Math.max(i,a,o),c=.25*Math.abs(r-n);return s===i?i-.5*a+c:s===a?a-.5*i+c:o+c}calculateAt(e){let t=null,n=null;if(e>0){let r=this.container.getData(KS)[e-1];P(r)||(r=0);let[i,a,o,s]=this.ohlcVals(e),[c,l,u,d]=this.ohlcVals(e-1);if(k([i,a,o,s,c,d])){let e=Math.max(Math.abs(a-d),Math.abs(o-d)),l=this.inputs.Limit,u=this.obtainR(a,o,c,d);t=50*((s-d+.5*(s-i)+.25*(d-c))/u)*(e/l),n=r+t}}return{[KS.id]:t,[this.target.id]:n}}},JS=q(`_MIN_CLOSE`),YS=q(`_MAX_CLOSE`),XS=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period);this.addInner(n)}get helpers(){return[YS,JS]}calculateAt(e){let t=null,n=null,r=null,i=null,a=this.innVal(1,G.ATR,e);if(a!==null){let o=this.baseVal(G.Close,e),s=this.baseVal(G.Close,e-1),c=this.period;r=Math.max(...this.past(e,c,G.Close)),i=Math.min(...this.past(e,c,G.Close));let l=a*this.inputs.Constant;if(this.innVal(1,G.ATR,e-1)===null)o>s?t=r-l:n=i+l;else{let[a,s,c,u]=[G.WWVSARU,G.WWVSARD,YS,JS].map(t=>this.container.getData(t)[e-1]);r=c,i=u,a===null?o>s?(r=o,t=o-l):(i=Math.min(o,i),n=i+l):o<a?(i=o,n=o+l):(r=Math.max(o,r),t=r-l)}}return{[YS.id]:r,[JS.id]:i,[G.WWVSARU.id]:t,[G.WWVSARD.id]:n}}},ZS=q(`_EP`),QS=q(`_AF`),$S=q(`_POS`),eC=1,tC=-1,nC=class extends J{constructor(e,t){super(e,t)}get helpers(){return[ZS,QS,$S]}hlcVals(e){return[G.High,G.Low,G.Close].map(t=>this.baseVal(t,e))}me(e,t){return this.container.getData(e)[t]}reciprocal(e){return 1/e}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null;if(e>0){let[s,c,l]=this.hlcVals(e),[u,d,f]=this.hlcVals(e-1),p=this.reciprocal(this.inputs.Acceleration),m=this.reciprocal(this.inputs.Limit);if(e===1){a=l>f?eC:tC;let e=a===eC;o=e?d:u,r=e?Math.max(s,u):Math.min(c,d),i=p,e?t=o:n=o}else{let[l,f,h,g,_]=[$S,G.PARSARS,G.PARSARL,ZS,QS].map(t=>this.me(t,e-1)),v=l===eC,y=v?h:f,b=_*Math.abs(g-y);a=v?y+b>c?tC:eC:y-b<s?eC:tC;let x=l===a;o=x?v?Math.min(y+b,d,this.baseVal(G.Low,e-2)):Math.max(y-b,u,this.baseVal(G.High,e-2)):g,r=x?v?Math.max(s,g):Math.min(c,g):a===eC?s:c,i=_,x?(v?r>g:r<g)&&_<m&&(i=_+p):i=p,a===eC?t=o:n=o}}return{[ZS.id]:r,[QS.id]:i,[$S.id]:a,[G.PARSARS.id]:n,[G.PARSARL.id]:t}}},rC=class extends J{xSum;xSum2;x2Sum;constructor(e,t){super(e,t);let n=this.period;this.xSum=n*(n+1)/2,this.xSum2=this.xSum*this.xSum,this.x2Sum=n*(n+1)*(2*n+1)/6}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,this.source);if(k(r)){let e=pe(r),i=(n*pe(r.map((e,t)=>e*(t+1)))-this.xSum*e)/(n*this.x2Sum-this.xSum2);t=(e-i*this.xSum)/n+i*n}}return{[this.target.id]:t}}},iC=q(`_IDY`),aC=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],oC=e=>Array(e).fill(0);function sC(e,t){return fC(e,t,10)}function cC(e,t){return fC(e,t,13)}function lC(e,t){return fC(e,t,16)}function uC(e,t){return fC(e,t,4)}function dC(e,t){return fC(e,t,7)}function fC(e,t,n){let r=e[n-1];return t===0&&(r=e[n]),t<0&&(r=e[n+1]),r}function pC(e,t,n,r,i){let a=i[18],o=r+1,s=0;for(let n=0;n<a;++n){let n=0,r=0;for(let i=1;i<6;++i){if(o--,e[o]==null)continue;let a=e[o]-t[o];i==1&&(n=r=a),a>n&&(n=a),a<r&&(r=a)}s=s+n-r}return s=s/a*uC(i,n[r]),s}function mC(e,t,n,r,i){let a=r,o=dC(i,n[r]),s=0;do a--,e[a]!=null&&s++;while(s<o&&a>0);return t[r]-t[a]}function hC(e,t,n,r,i,a){let o=n;do o--;while(e[o]==null);return t[n]=t[o],e[n]>i&&t[o]<=0&&(t[n]=t[o]+1),e[n]<r&&t[o]>=0&&(t[n]=t[o]-1),a++,t[n]!==t[o]&&(a=1),a}function gC(e,t,n,r,i,a,o,s,c,l){let u=sC(i,n[r]),d=cC(i,n[r]),f=lC(i,n[r]),p=c+l+t[r]-e[r],m=100;i[20]>0&&(m=i[20]);let h=u*s/m;s>d&&(h=u*d/m);let g=l*2,_=e[r]+(p-g)-(p-g)*h,v=e[r]+(p-p*h),y=[a,o];return(s===1||f!==1||_>a)&&(y[0]=_),(s===1||f!==1||v<o)&&(y[1]=v),y}function _C(e,t,n){let r=0,i=-1,a=0,o=1;for(let s=0;s<n;++s){if(t[s]=0,e[s]==null||(r++,r==21&&(o=2),r==31&&(o=3),a+=e[s]*o,r<40))continue;t[s]=a/70;let c=0,l=i+1;for(let t=l;t<n&&!(e[t]!=null&&(c++,c==1&&(i=t),(c==1||c==21||c==31)&&(a-=e[t]),c==31));++t);}}var vC=class extends J{haveEnoughData=!1;firstUsefulIndex=0;s3;itr;constructor(e,t){super(e,t),this.s3=this.itr=[];let n=[`VelocityUpTrend`,`VelocitySideTrend`,`VelocityDownTrend`].map(t=>e.inputs[t]||`3`).map(Number);aC.splice(6,3,...n)}get helpers(){return[iC]}prepareComputation(){let e=this.base.getData(G.Close),t=0,n=0,r=e.length;for(;n<72&&t<r;)e[t]!=null&&n++,t++;this.haveEnoughData=t<r,this.firstUsefulIndex=t,this.s3=oC(r),this.itr=oC(r),this.haveEnoughData&&_C(e,this.s3,r)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,n){let r=this.base.getData(G.Close),i=r.length;this.haveEnoughData&&_C(r,this.s3,i),super.recalculateAt(e,t,n)}calculateAt(e){let t=null,n=null,r=null,i=t=>this.us(t,e-1);if(e===0)this.prepareComputation();else if(this.haveEnoughData&&e>=this.firstUsefulIndex&&this.baseVal(G.Close,e)!==null){let a=i(G.TRSP1),o=i(G.TRSP2);r=i(iC),a===null&&o===null&&(a=o=this.baseVal(G.Close,this.firstUsefulIndex)),r===null&&(r=1);let s=this.base.getData(G.Close);r=hC(s,this.itr,e,a,o,r);let c=mC(s,this.s3,this.itr,e,aC),l=pC(s,this.s3,this.itr,e,aC);[a,o]=gC(s,this.s3,this.itr,e,aC,a,o,r,c,l),this.itr[e]>=0&&(t=a),this.itr[e]<=0&&(n=o)}return{[iC.id]:r,[G.TRSP1.id]:t,[G.TRSP2.id]:n}}},yC=class extends J{constructor(e,t){super(e,t),this.addInner(HD(t))}get helpers(){return[G.BARCOLIX]}getTarget(e){let t=this.baseVal(G.Close,e),n=this.innVal(1,G.TP,e);if(!P(t,n)||!this.atLeast(e,4))return null;let r=this.innVal(1,G.TP,e-3);return r===null?null:t+(n-r)/3}calculateAt(e){let t=null,n=this.getTarget(e);if(n!==null&&e>0){let r=this.container.getData(G.TARGP)?.[e-1];r!==null&&(t=n===r?this.container.getData(G.BARCOLIX)?.[e-1]??1:+(n>r))}return{[G.TARGP.id]:n,[G.BARCOLIX.id]:t}}},bC=1,xC=2,SC=3,CC={[bC]:{param:`cot`,func:`parseCotLineChart`,fields:[G.DateTime,G.COTLCCMSP,G.COTLCLGSP,G.COTLCSMSP]},[xC]:{param:`cotadv`,func:`parseDisaggregated`,fields:[G.DateTime,G.COTDAGPRO,G.COTDAGSPD,G.COTDAGMNM,G.COTDAGOTH]},[SC]:{param:`cotfin`,func:`parseFinancialTradersReport`,fields:[G.DateTime,G.COTFTRDLI,G.COTFTRASM,G.COTFTRLVF,G.COTFTROTH]}},wC=class extends J{wrappers;constructor(e,t,n){super(e,ob(n,e=>new TC(t,e))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=CC[t].fields.slice(1).map(e=>this.wrapInner(e,0))}getWrappers(){return this.wrappers}},TC=class extends h_{kind;constructor(e,t){super(t),this.kind=e}getRetriever(){return new EC(this.kind)}onStreamingUpdates(e){}},EC=class extends Bg{kind;constructor(e){super(),this.kind=e}addExtraParams(e){e[CC[this.kind].param]=`y`}getParser(e){return new DC(e.symbol,e.aggregation,e.offset,this.kind)}},DC=class extends Fg{kind;constructor(e,t,n,r){super(e,t,n),this.kind=r}makeContainer(){return new _g(CC[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[CC[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(G.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(G.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(G.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(G.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(G.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(G.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(G.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(G.COTFTROTH,parseInt(e[5]))}},OC=class extends wC{constructor(e,t){super(e,bC,t)}},kC=class extends wC{constructor(e,t){super(e,xC,t)}},AC=class extends wC{constructor(e,t){super(e,SC,t)}},jC={Day:[G.PreviousHigh,G.PreviousLow,G.PreviousClose],Week:[G.WeekPreviousHigh,G.WeekPreviousLow,G.WeekPreviousClose],Month:[G.MonthPreviousHigh,G.MonthPreviousLow,G.MonthPreviousClose]},MC=class extends J{disabled;record;streamingSubscription;constructor(e,t,n){if(super(e,n),this.disabled=!P(n.query)||!P(n.query.symbol),!this.disabled){let e=n.query.symbol;e.endsWith(`.BZ`)&&(e=e.slice(0,-3)),this.record=$().getRecordSource().getRecord(e),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()}this.initialNotification=!0}getStreamingSubscription(){return $().getRecordSource().subject.pipe(jm(e=>{let t=np(K.RT_QUOTE,this.record.symbol);return e.filter(t)}),Pm(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return da.call(this,async()=>P(this.record)?await this.record.ready()&&await super.ready():await super.ready(),`asyncReadyWork2`)}onStreamingUpdates(e){if(this.record){let e={tag:bt(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return jC[e].map(e=>this.record.getValue(e))}},NC=class extends MC{constructor(e,t){super(e,jC[e.inputs.Previous],t)}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=null;if(!this.disabled){let e=this.getValues(this.inputs.Previous);if(k(e)){let[c,l,u]=e;t=(c+l+u)/3;let d=2*t;n=d-l,r=d-c;let f=c-l;i=t+f,a=t-f,o=c+2*(t-l),s=l-2*(c-t)}}return{[G.PPTPIV.id]:t,[G.PPTR1.id]:n,[G.PPTR2.id]:i,[G.PPTR3.id]:o,[G.PPTS1.id]:r,[G.PPTS2.id]:a,[G.PPTS3.id]:s}}},PC=class extends MC{constructor(e,t){super(e,jC.Day,t)}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=null,c=null;if(!this.disabled){let e=this.getValues(`Day`);if(k(e)){let[l,u,d]=e,f=l-u,[p,m,h,g]=[2,4,6,12].map(e=>1.1/e*f);s=d+p,a=d+m,r=d+h,t=d+g,n=d-g,i=d-h,o=d-m,c=d-p}}return{[G.CPPH4.id]:s,[G.CPPH3.id]:a,[G.CPPH2.id]:r,[G.CPPH1.id]:t,[G.CPPL1.id]:n,[G.CPPL2.id]:i,[G.CPPL3.id]:o,[G.CPPL4.id]:c}}},FC=class extends J{constructor(e,t){super(e,sb(t,G.IMPVOL,e=>new IC(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(G.IMPVOL,0)]}},IC=class extends h_{constructor(e){super(e)}getRetriever(){return Ti(this.query.symbol)?new BC:new LC}onStreamingUpdates(e){}},LC=class extends Bg{addExtraParams(e){e.impl=`y`}getParser(e){return new zC(e.symbol,e.aggregation,e.offset)}};function RC(){return new _g([G.DateTime,G.IMPVOL])}var zC=class extends Fg{constructor(e,t,n=0){super(e,t,n)}makeContainer(){return RC()}getParseFunc(){return this.parseImpVol}parseImpVol(e){!this.aggregation.isEndOfDay||e.length<9||(this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.IMPVOL,parseFloat(e[8])))}},BC=class extends Hg{emptyContainer(e,t){return RC()}get iterateForward(){return!1}getPageName(){return`getFuturesOptionsHistory`}processRow(e,t,n){n.addDataPoint(G.DateTime,ug(e.date.substring(0,10)));let r=N(e.impliedVolatility);n.addDataPoint(G.IMPVOL,r?e.impliedVolatility*100:null)}},VC=q(`_ABS_CHG`),HC=q(`_DS1_EMA1`),UC=q(`_DS1_EMA2`),WC=q(`_DS2_EMA1`),GC=q(`_DS2_EMA2`),KC=class extends J{constructor(e,t){super(e,t);let n=(e,t,n,r,i,a)=>X(X(e,t,n,r),i,r,a),r=Z(VC,se((e,t)=>({[e.id]:Math.abs(this.baseVal(G.Change,t))}),VC),t),i=n(t,e.inputs.Period1,G.Change,HC,e.inputs.Period2,UC),a=n(r,e.inputs.Period1,VC,WC,e.inputs.Period2,GC),o=Q(G.TSI,(e,t,n)=>100*t/n,i,a),s=X(o,e.inputs.Period3,G.TSI,G.TSISIG);this.addInner(o,s)}getWrappers(){return[this.wrapInner(G.TSI,1),this.wrapInner(G.TSISIG,2)]}},qC=class extends J{constructor(e,t){super(e,t);for(let n=1;n<=12;++n){let r=pO(e.inputs,n);this.addInner(X(t,r,G.Close,e.outFields[n-1]))}}getWrappers(){return he(1,12).map(e=>this.wrapInner(this.outFields[e-1],e))}},JC=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,G.Close);this.addInner(n)}calculateAt(e){let t=null,n=e>0?this.container.getData(this.target)[e-1]:null,r=this.innVal(1,G.EMA,e);if(!N(n))t=r;else{let i=this.baseVal(this.source,e),a=(i/n)**4;t=n+(i-n)/(.6*this.period*a);let o=e=>Math.log10(Math.abs(e-t))>1,s=o(n)||o(r);(!Number.isFinite(t)||s)&&(t=null)}return{[this.target.id]:t}}},YC=q(`_DIFF`),XC=class extends J{constructor(e,t){super(e,t);let n=this.inputs.Period,r=Math.floor(n/2),i=this.allowEmptyValues,a=jD(Q(YC,(e,t,n)=>2*t-n,jD(t,r,this.source,G.WMA,i),jD(t,n,this.source,G.WMA,i)),Math.floor(Math.sqrt(n)),YC,this.target,i);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},ZC=q(`_SUM`),QC=class extends J{constructor(e,t){super(e,t);let n=jD(Q(ZC,(e,t,n)=>t+n,UD(t,this.inputs.PeriodRocLong),UD(t,this.inputs.PeriodRocShort)),this.inputs.PeriodWma,ZC,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},$C=q(`_ABS_CHG`),ew=q(`_HH_LL`),tw=q(`_MULMA`),nw=class extends J{constructor(e,t){super(e,t);let n=e.inputs.TurtleChnField===`Close`,r=e.inputs.Direction===`Long`,i=fO(t);if(!n&&i){let e=Z(this.target,(e,t)=>null,t);this.addInner(e)}else{let e=Y(Z($C,se((e,t)=>({[$C.id]:t>0?e*Math.abs(this.baseVal(G.Change,t)):null}),this.inputs.FactorATR),t),this.inputs.PeriodAdjATR,$C,G.MA),i=r?G.High:G.Low,a=PD(t,this.inputs.PeriodTurtleChn,n?G.Close:i,ew,r),o=Q(tw,(e,t)=>this.inputs.FactorAdjATR*t,e),s=r?-1:1,c=Q(this.target,(e,t,n)=>t+s*n,a,o);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}},rw=class extends J{state;constructor(e,t){super(e,t),this.resetState()}resetState(){let e=this.inputs.ExtendLines??`None`;this.state={startIndex:null,endIndex:null,slope:null,intercept:null,stdDevWidth:null,extendLeft:e===`Left`||e===`Both`,extendRight:e===`Right`||e===`Both`}}calculateAt(e){let t=this.inputs.Period,n=this.inputs.Width,r=this.source;if(e===this.base.size-1&&this.base.size>=t){this.resetState();let e=t*(t+1)/2,i=e*e,a=t*(t+1)*(2*t+1)/6,o=0,s=0,c=1,l=this.base.size-t;for(let e=0;e<t;++e){let t=this.baseVal(r,l+e);if(!Ze(t))return{};o+=t,s+=c*t,c+=1}let u=(t*s-e*o)/(t*a-i),d=o/t-u*e/t;if(!Ze(u)||!Ze(d))return{};let f=0;for(let e=0;e<t;++e){let t=this.baseVal(r,l+e);if(!Ze(t))return{};let n=t-(d+u*(e+1));f+=n*n}let p=Math.sqrt(f/t);if(!Ze(p))return{};this.state.startIndex=l,this.state.endIndex=this.base.size-1,this.state.slope=u,this.state.intercept=d,this.state.stdDevWidth=n*p}return{}}getCurrentState(){return this.state}},iw=class extends J{computeDone;constructor(e,t){super(e,t,ob(t,e=>{let t=F(e);return t.symbol=Mi(e.symbol),P(t.symbol)?new h_(t):new __(t,!0)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){let e=this.innCont(0);if(!P(e)||e.size===0)return;let t=this.innCont(1),n=e.getTimeData(),r=t.getTimeData(),i=t.getData(G.Close),a=Array(n.length).fill(null);if(!(this.innerSeries[1]instanceof __)){let o=0,s=e.size,c=t.size;for(let e=0;e<s;++e){for(;o<c&&r[o].getTime()<n[e].getTime();)o++;o<c&&r[o].getTime()===n[e].getTime()&&(a[e]=i[o])}}this.container.setData(this.target,a)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignCashTimelineWithUnderlying(),this.computeDone=!0,this.notify(K.TS_MANYCHANGED,-1))}},aw=class extends J{constructor(e,t){let n=JD(t);super(e,t,n)}shouldTriggerOurRecalc(e){return super.shouldTriggerOurRecalc(e)?!0:e===this.innerSeries[1]&&this.innHasData(0)&&this.innHasData(1)}calculateAt(e){let t=(t,n)=>P(this.innCont(t))?this.innVal(t,n,e):null,n=t(0,G.Close),r=t(1,G.CSHO);return{[this.target.id]:P(r)&&P(n)?r-n:null}}},ow=class extends J{computeDone;constructor(e,t){super(e,t,ob(t,e=>{let t=new Qy(e.symbol,new Ru(e.aggregation.unit===g.Year?g.Year:g.Quarter,1),w.BalanceSheet);return t.fields=[G.SharesOutstanding],t.cacheMe=!0,new b_(t)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignFundamentalTimelineWithUnderlying(){let e=this.innCont(0);if(!P(e)||e.size===0)return;let t=this.innCont(1);if(!P(t)||t.size===0)return;let n=e.getTimeData(),r=t.getTimeData(),i=t.getData(G.SharesOutstanding),a=e.getData(G.Close),o=Array(n.length),s=0,c=e.size,l=t.size;for(let e=0;e<c;++e){let t=n[e].getTime();for(;s<l-1&&r[s+1].getTime()<=t;)s++;if(s<l&&r[s].getTime()<=t){let t=i[s],n=a[e];o[e]=P(t,n)?t*n:null}}this.container.setData(this.target,o)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignFundamentalTimelineWithUnderlying(),this.computeDone=!0,this.notify(K.TS_MANYCHANGED,-1))}},sw=class extends J{constructor(e,t){super(e,t),rO(this)}calculateAt(e){let t=null,[n]=iO(this);if(e>0){let r=this.innVal(n,this.source,e-1);r!==null&&(t=100*(this.innVal(n,this.source,e)-r)/r)}return{[this.target.id]:t}}},cw=class extends cb{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=[null,null,null,null,null];if(e>0){let n=(e,t)=>this.baseVal(e,t),r=[G.Open,G.High,G.Low,G.Close],i=r.map(t=>n(t,e));if(k(i)){let a=r.map(t=>n(t,e-1));if(k(a)){t=i.map((e,t)=>100*(e-a[t])/a[t]);let[n,r]=Ee(t);if(t[1]=r,t[2]=n,e>1){let n=this.container.getData(G.Close)[e-1];t[4]=t[3]-n}}}}return{[G.Open.id]:t[0],[G.High.id]:t[1],[G.Low.id]:t[2],[G.Close.id]:t[3],[G.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(G.Volume,G.OpenInterest,G.TradingDay)}},lw=q(`_DIST`),uw=q(`_EMA_DIST1`),dw=q(`_EMA_DIST2`),fw=q(`_DIFF`),pw=q(`_EMA_DIFF1`),mw=q(`_EMA_DIFF2`),hw=class extends J{constructor(e,t){super(e,t);let n=PD(t,e.inputs.Period1,G.High,G.HH,!0),r=PD(t,e.inputs.Period1,G.Low,G.LL,!1),i=X(X(Q(lw,(e,t,n)=>this.baseVal(G.Close,e)-(t+n)/2,n,r),e.inputs.Period2,lw,uw),e.inputs.Period2,uw,dw),a=X(X(Q(fw,(e,t,n)=>t-n,n,r),e.inputs.Period2,fw,pw),e.inputs.Period2,pw,mw),o=Q(G.STOMOMIX,(e,t,n)=>100*t/n,i,a);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},gw=q(`_CHG`),_w=q(`_M1`),vw=q(`_M2`),yw=class extends J{constructor(e,t){super(e,t);let n=Z(gw,function(e){let t=G.Close,n=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[gw.id]:n}},t),r=(e,t)=>t>=0?t:0,i=(e,t)=>t>=0?0:-t,a=Q(_w,r,n),o=Q(vw,i,n);this.addInner(a,o)}perc(e,t){return 100*e/t}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n+1)){let r=this.past(e,n,_w,this.innCont(1)),i=this.past(e,n,vw,this.innCont(2));if(k(r)&&k(i)){let e=pe(r),n=pe(i);t=this.perc(e-n,e+n)}}return{[G.CHDMOMOSC.id]:t}}},bw=class extends J{constructor(e,t){super(e,t);let n=new yw(e,t),r=cO(e,`MA`,`Average`),i=this.inputs.PeriodAvg,a=r(n,i,G.CHDMOMOSC,G.CHDMOMOSCAVG);this.addInner(n,a)}getWrappers(){return[this.wrapInner(G.CHDMOMOSC,1),this.wrapInner(G.CHDMOMOSCAVG,2)]}},xw=q(`_MAX`),Sw=q(`_MIN`),Cw=q(`_ISUPTREND`),ww=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period);this.addInner(n)}get helpers(){return[xw,Sw,Cw]}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=1,c=this.baseVal(G.Close,e),l=(e,t)=>P(e)?e:t,u=e=>l(e,0),d=(e,t)=>this.container.getData(e)[t];e>0&&(r=Math.max(u(d(xw,e-1)),c),a=Math.min(u(d(Sw,e-1)),c),s=d(Cw,e-1));let f=this.inputs.Multiplier,p=this.innVal(1,G.ATR,e);if(P(p)){let l=s===1,u=l?r-f*p:a+f*p,m=d(l?G.VSTOPUP:G.VSTOPLOW,e-1);P(m)||(m=0);let h=l?Math.max(m,u):Math.min(m,u);o=+(c-h>=0);let g=o!=s;n=g?c:r,i=g?c:a,t=g?o===1?n-f*p:i+f*p:h}return{[G.VSTOPUP.id]:o===1?t:null,[G.VSTOPLOW.id]:o===1?null:t,[xw.id]:n,[Sw.id]:i,[Cw.id]:o}}},Tw=q(`_TRENDUP`),Ew=q(`_TRENDDOWN`),Dw=q(`_TREND`),Ow=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period);this.addInner(n)}get helpers(){return[Tw,Ew,Dw,G.BARCOLIX]}calculateAt(e){let t=0,n=0,r=0,i=null,a=0,o=this.innVal(1,G.ATR,e);if(P(o)){let s=(e,t)=>P(e)?e:t,[c,l,u]=[G.Close,G.High,G.Low].map(t=>this.baseVal(t,e)),d=(l+u)/2,f=this.baseVal(G.Close,e-1),p=this.inputs.Multiplier,m=d-p*o,h=d+p*o,[g,_,v]=[Tw,Ew,Dw].map(t=>this.container.getData(t)[e-1]);t=f>g?Math.max(m,g):m,n=f<_?Math.min(h,_):h,r=c>_?1:c<g?-1:s(v,1);let y=r===1;i=y?t:n,a=+!!y}return{[Tw.id]:t,[Ew.id]:n,[Dw.id]:r,[G.SUPTR.id]:i,[G.BARCOLIX.id]:a}}},kw=class extends J{constructor(e,t){super(e,t);let n=e=>PD(t,e,G.Low,G.LL,!1),r=e=>PD(t,e,G.High,G.HH,!0),i=(e,t,n)=>Q(n,(e,t,n)=>(t+n)/2,e,t),a=(e,t)=>i(n(e),r(e),t),o=a(e.inputs.PeriodConversionLine,G.CONVLN),s=a(e.inputs.PeriodBaseLine,G.BASELN),c=i(o,s,G.LEADSP1),l=a(e.inputs.PeriodLaggingSpan2,G.LEADSP2);this.addInner(o,s,c,l)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=+(this.innVal(3,G.LEADSP1,e)>this.innVal(4,G.LEADSP2,e));return{[G.LAGGSP.id]:this.baseVal(G.Close,e),[G.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(G.CONVLN,1),this.wrapInner(G.BASELN,2),this.wrapInner(G.LEADSP1,3),this.wrapInner(G.LEADSP2,4)]}},Aw=q(`_CUM_PRICE`),jw=q(`_CUM_VOL`),Mw=q(`_PER_CHG`),Nw=class extends J{constructor(e,t){super(e,t);let n=this.source,r=Z(n,se(aO,n),t);this.addInner(r)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}},Pw=class extends Nw{constructor(e,t){super(e,t)}get helpers(){return[Aw,jw,Mw]}isSame(e,t){switch(this.inputs.AnchorPeriod){case`Session`:default:return Nn(e,t);case`Week`:return li(e,t);case`Month`:return di(e,t);case`Quarter`:return fi(e,t);case`Year`:return pi(e,t);case`Decade`:return og(e,t);case`Century`:return sg(e,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(this.valueAt(Mw,t)===1)return t;return 0}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=e>0,s=o?this.dateAt(e-1):B.ZERO_DATE,c=this.dateAt(e),l=o&&this.isSame(s,c),u=l?this.valueAt(Aw,e-1):0,d=l?this.valueAt(jw,e-1):0,f=this.innVal(0,G.Volume,e),p=u+this.innVal(1,this.source,e)*f,m=d+f;if(t=p/m,l){let o=this.findPrevPeriodChange(e-1),s=this.container.getData(G.VWAP).slice(o,e);s.push(t);let c=me(s),l=s.map(e=>(e-c)*(e-c)),u=Math.sqrt(me(l)),d=this.inputs.Stdev1stMultiplier*u;n=t+d,r=t-d;let f=this.inputs.Stdev2ndMultiplier*u;i=t+f,a=t-f}else n=t,r=t,i=t,a=t;return{[Aw.id]:p,[jw.id]:m,[Mw.id]:+!l,[G.VWAP.id]:t,[G.VWAPSD1U.id]:n,[G.VWAPSD1L.id]:r,[G.VWAPSD2U.id]:i,[G.VWAPSD2L.id]:a}}},Fw=class extends Nw{constructor(e,t){super(e,t)}get helpers(){return[Aw,jw]}isSameOhlcBar(e,t){let{unit:n,size:r}=this.aggregation;switch(n){case g.Tick:return e===t;case g.Intraday:return ai(t,Sn(e,r));case g.Day:return ai(t,un(e,r));case g.Week:return li(e,t);case g.Month:return di(e,t);case g.Quarter:return fi(e,t);case g.Year:return pi(e,t);default:throw Error(`Unexpected aggregation unit ${g[n]}`)}}calculateAt(e){let t=null,n=null,r=null,i=this.inputs.Anchor,a=this.dateAt(e);if(ai(i,a)||this.isSameOhlcBar(a,i)){let i=e>0,a=i?this.valueAt(Aw,e-1):0,o=i?this.valueAt(jw,e-1):0,s=this.innVal(0,G.Volume,e);n=a+this.innVal(1,this.source,e)*s,r=o+s,t=n/r}return{[Aw.id]:n,[jw.id]:r,[G.AVWAP.id]:t}}},Iw=q(`_DIFF`),Lw=[Iw,G.BARCOLIX],Rw=[...Lw,G.Buy,G.Sell];function zw(e){return e.ShowSignals!==`No`}function Bw(e,t,n,r,i){let a=null,o=null,s=null,c=null;P(n,r)&&(s=n-r);let l=t>0?e.getData(Iw)[t-1]:null,u=t>0?e.getData(G.BARCOLIX)[t-1]:null;i&&P(s,l)&&(a=s>0&&l<=0?1:null,o=s<0&&l>=0?-1:null),P(s)&&(c=s>0?1:s<0?0:u);let d={[Iw.id]:s,[G.BARCOLIX.id]:c};return i&&(d[G.Buy.id]=a,d[G.Sell.id]=o),d}var Vw=class extends J{_showSignals;constructor(e,t){super(e,t),this._showSignals=zw(e.inputs)}get helpers(){return this._showSignals??zw(this.inputs)?Rw:Lw}calculateDiff(e,t,n,r){return Bw(e,t,n,r,this._showSignals)}},Hw=class extends Vw{constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=n(t,e.inputs.Period1,this.source,G.MAS),i=n(t,e.inputs.Period2,this.source,G.MAL);this.addInner(r,i)}calculateAt(e){let t=this.innVal(1,G.MAS,e),n=this.innVal(2,G.MAL,e);return this.calculateDiff(this.container,e,t,n)}getWrappers(){return[this.wrapInner(G.MAS,1),this.wrapInner(G.MAL,2)]}},Uw=class extends Vw{_maIndex;_maTarget;constructor(e,t){super(e,t),rO(this);let n=cO(e,`MA`,`Average`)(t,e.inputs.Period,this.source);this.addInner(n);let[r]=iO(this);this._maIndex=r+1,this._maTarget=n.target}calculateAt(e){let t=this.innVal(this._maIndex,this._maTarget,e),[,n]=iO(this),r=n.getData(this.source)[e],i=this.calculateDiff(this.container,e,r,t);return i[this.target.id]=t,i}},Ww=q(`_PVM`),Gw=q(`_NVM`),Kw=class extends J{constructor(e,t){super(e,t);let n=function(e){return{[Ww.id]:e>0?Math.abs(this.baseVal(G.High,e)-this.baseVal(G.Low,e-1)):null}},r=function(e){return{[Gw.id]:e>0?Math.abs(this.baseVal(G.Low,e)-this.baseVal(G.High,e-1)):null}},i=Z(Ww,n,t),a=Z(Gw,r,t),o=RD(t,G.TR);this.addInner(i,a,o)}calculateAt(e){let t=null,n=null,r=this.period;if(this.atLeast(e,r)){let i=this.past(e,r,Ww,this.innCont(1)),a=this.past(e,r,Gw,this.innCont(2)),o=this.past(e,r,G.TR,this.innCont(3));if(k(i)&&k(a)&&k(o)){let e=pe(i),r=pe(a),s=pe(o);t=e/s,n=r/s}}return{[G.PLVI.id]:t,[G.MNVI.id]:n}}},qw=q(`_AVG`),Jw=class extends J{isPercent;constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=this.period,i=n(t,r,this.source,qw);this.isPercent=e.inputs.Distance===`Percentage`,this.addInner(i)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=null,n=null,r=this.innVal(1,qw,e),i=this.baseVal(this.source,e);if(r!=null&&r!==0){t=i-r,this.isPercent&&(t=100*t/r);let a=t<=0;if(n=a?1:3,e>0){let r=this.container.getData(this.target)[e-1];r!==null&&(a&&t>r&&(n=0),!a&&t<r&&(n=2))}}return{[this.target.id]:t,[G.BARCOLIX.id]:n}}},Yw=class extends J{constructor(e,t){super(e,t);let n=X(X(WD(t,this.inputs.PeriodRsi,this.source,G.RSI),this.inputs.PeriodEma1,G.RSI,G.EMA),this.inputs.PeriodEma2,G.EMA,G.EMA),r=Y(n,this.inputs.PeriodMa,G.EMA,G.MA),i=Q(G.DOSCH,(e,t,n)=>t-n,n,r),a=Y(i,this.inputs.PeriodSig,G.DOSCH,G.DOSCS);this.addInner(i,a)}getWrappers(){return[this.wrapInner(G.DOSCH,1),this.wrapInner(G.DOSCS,2)]}},Xw=class extends J{constructor(e,t){super(e,t);let n=this.inputs.Period,r=this.inputs.Increment,i=Math.min(Math.max(0,this.inputs.Count),10);for(let e=0;e<i;++e){let i=Y(t,n+e*r,this.source,this.outFields[e]);this.addInner(i)}}getWrappers(){let e=this.outFields,t=this.inputs.Count;return[this.wrapInner(e[0],1),this.wrapInner(e[1],2),this.wrapInner(e[2],3),this.wrapInner(e[3],4),this.wrapInner(e[4],5),this.wrapInner(e[5],6),this.wrapInner(e[6],7),this.wrapInner(e[7],8),this.wrapInner(e[8],9),this.wrapInner(e[9],10)].slice(0,t)}},Zw=q(`_HAO`),Qw=q(`_HAH`),$w=q(`_HAL`),eT=q(`_HAC`),tT=class extends J{constructor(e,t){super(e,t);let n=cO(e,`EMA`,`Smoothing1`),r=e.inputs.Period1,i=n(t,r,G.Open),a=n(t,r,G.High),o=n(t,r,G.Low),s=n(t,r,G.Close),c=Q(eT,(e,t,n,r,i)=>(t+n+r+i)/4,i,a,o,s);function l(e,t,n,r){let i=null;if(e>0){let r=this.container.getData(Zw)[e-1],a=this.innVal(2,eT,e-1);P(r,a)?i=(r+a)/2:P(t,n)&&(i=(t+n)/2)}return i}let u=Q(Zw,l,i,s,c),d=Q(Qw,(e,t,n,r)=>P(t,n,r)?Math.max(t,Math.max(n,r)):null,a,u,c),f=Q($w,(e,t,n,r)=>P(t,n,r)?Math.min(t,Math.min(n,r)):null,o,u,c),p=cO(e,`EMA`,`Smoothing2`),m=e.inputs.Period2,h=p(u,m,Zw,G.Open),g=p(d,m,Qw,G.High),_=p(f,m,$w,G.Low),v=p(c,m,eT,G.Close),y=Z(G.Change,function(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Close,e-1);P(n,r)?t=n-r:P(n)&&!P(r)&&(t=0)}return{[G.Change.id]:t}},v);this.addInner(h,g,_,v,y)}getWrappers(){return[this.wrapInner(G.Open,1),this.wrapInner(G.High,2),this.wrapInner(G.Low,3),this.wrapInner(G.Close,4),this.wrapInner(G.Change,5)]}},nT=q(`_DELTA`),rT=class extends J{constructor(e,t){super(e,t);let n=e.inputs,r=X(t,n.PeriodEmaKeltner,G.Close),i=zD(t,n.PeriodAtrKeltner);function a(e,t,n,r){return P(n,r)?n+e*r:null}let o=n.MultiplierKeltner,s=Q(G.KCUP,se(a,o),r,i),c=Q(G.KCLOW,se(a,-o),r,i),l=XD(t,n.PeriodBollinger,n.WidthBollinger),u=ZD(t,n.PeriodMomentum),d=Y(t,n.PeriodMomentum,G.Close);function f(e,t,n,r){let i=null,a=this.innVal(1,G.DONMID,e);return P(a,r)&&(i=t-(a+r)/2),i}let p=QD(Q(nT,f,t,u,d),n.PeriodMomentum,nT,G.TTMSQZOSC);this.addInner(s,c,l,p)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=null,n=null,r=-1,i=this.innVal(1,G.KCUP,e),a=this.innVal(2,G.KCLOW,e),[o,s]=[G.BOLLBU,G.BOLLBL].map(t=>this.innVal(3,t,e));o<i&&s>a?t=0:n=0;let c=this.innVal(4,G.TTMSQZOSC,e),l=e>0?this.innVal(4,G.TTMSQZOSC,e-1):null;if(P(c))if(!P(l))r=2;else{let e=c>=0,t=l<c;r=e?t?3:2:+!!t}return{[G.TTMSQZON.id]:t,[G.TTMSQZOFF.id]:n,[G.BARCOLIX.id]:r}}getWrappers(){return[this.wrapInner(G.TTMSQZOSC,4)]}},iT=e=>{let t=e.unit===g.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:d.Manual,missing:t?u.UseNext:u.UsePrevious,stretch:e=>!1,fieldMap:new Map([[G.Close,G.CRS]]),noDataApproach:f.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}},aT=class extends J{constructor(e,t){if(super(e,t),mO(t)){let n=$().getTimeSeriesDataSource(),r=t.query.duplicate();r.symbol=this.inputs.Symbol.toUpperCase();let i=n.getTimeSeries(r),a=e=>e.query?.symbol,{model:o}=yd(((e,t)=>`{${a(e)}} / {${a(t)}}`)(t,i),!1),s=iT(e.aggregation),c=new tb(o,[t,i],s),l=cO(e,`MA`,`Average`)(c,this.period,G.CRS,G.CRSAVG);this.addInner(i,c,l),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=Z(G.Close,(e,t)=>null,t),n=Z(G.CRS,(e,t)=>null,t),r=Z(G.CRSAVG,(e,t)=>null,t);this.addInner(e,n,r),this.canLoadMoreData=!1}}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[0].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}getWrappers(){return[this.wrapInner(G.DateTime,2),this.wrapInner(G.CRS,2),this.wrapInner(G.CRSAVG,3)]}},oT=q(`_DIFF`),sT=q(`_RANK`),cT=q(`_CHG`),lT=q(`_AVG`),uT=q(`_HBRAKE_CHG`),dT=q(`_HEIGHT_DELTA`),fT=q(`_ACTION`),pT=q(`_REVERSAL`),mT=200,hT=10,gT=e=>[e>0,e<0],_T=[null,null,null],vT={None:0,Hold:1,Take:2};function yT([e,t],n){let r=null;if(n>0){let t=this.baseVal(e,n-1);P(t)&&(r=this.baseVal(e,n)-t)}return{[t.id]:r}}var bT=class extends J{useHandbrake;constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=n(t,xt(1,999,this.inputs.FastPeriod),G.Close),i=xt(0,999,this.inputs.SlowPeriod),a=i>0,o=a?n(t,i,G.Close):t,s=Q(oT,a?(e,t,n)=>t-n:(e,t,n)=>n-t,r,o),c=Z(cT,se(yT,[G.Close,cT]),t),l=Z(sT,function(e){let t=Math.abs(this.baseVal(oT,e)),n=null,r=0,i=0;for(let n=e-1;n>=0&&r<mT;--n){let e=Math.abs(this.baseVal(oT,n));r++,e<t&&i++}return r>0&&(n=Math.floor(i/r*hT)),n===hT&&n--,{[sT.id]:n}},s),u=xt(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=u>0;let d=n(t,u,G.Close,lT),f=Z(uT,se(yT,[lT,uT]),d);this.addInner(c,s,l,f)}get helpers(){return[dT,G.BARCOLIX,fT,pT]}getStateAt(e){let t=this.innVal(2,oT,e);return P(t)?gT(t):_T}findPreviousKnownState(e){for(let t=e-1;t>0;t--){let e=this.getStateAt(t);if(e===_T)return _T;let[n,r]=e;if(n||r)return e}return _T}getBuySell(e){let t=this.getStateAt(e);if(t===_T)return _T;let[n,r]=t,i=this.findPreviousKnownState(e),[a,o]=i;if(!n&&!r)return i===_T?_T:[a,o,!1];let s=n!==a||r!==o;return s?[a,o,s]:[n,r,s]}getPrev(e,t){return t>0?this.container.getData(e)[t-1]:null}calculateAt(e){let t=null,n=null,r=0,i=-1,a=vT.None,[o,s,c]=this.getBuySell(e),[l,u]=[pT,fT].map(t=>this.getPrev(t,e)),[d,f]=[0,-1].map(t=>this.innVal(4,uT,e+t));if(i=c?hT:this.innVal(3,sT,e),this.useHandbrake&&P(d,f)){let t=o&&f>0||s&&f<0,n=!o&&d>0||!s&&d<0;c?(i=n?hT:12,a=u):(l===!0||u===vT.Hold)&&(t?(i=this.innVal(3,sT,e),a=vT.Take):(i=n?11:13,a=vT.Hold))}if(P(this.innVal(2,oT,e))){let t=this.innVal(1,cT,e),[n,i]=gT(t),a=Math.abs(t);(o&&n||s&&i)&&(r=a),(o&&i||s&&n)&&(r=-a)}return o?t=1:s&&(n=1),{[G.JPIB.id]:t,[G.JPIS.id]:n,[G.BARCOLIX.id]:i,[dT.id]:r,[fT.id]:a,[pT.id]:c}}},xT=class extends bT{constructor(e,t){e.inputs=dt(V(`JPI`).defaults.inputs.filter(e=>e.name!==`HandbrakePeriod`)),super(e,t)}},ST={FastPeriod:8,SlowPeriod:21,HandbrakePeriod:13,Average:`EMA`,Height:`Fixed`},CT=class extends bT{constructor(e,t){e.inputs=structuredClone(ST),super(e,t)}},wT=e=>{let t=e.unit===g.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:d.Manual,missing:t?u.UseNext:u.UsePrevious,stretch:e=>!1,fieldMap:new Map([[G.Close,G.DRS]]),noDataApproach:f.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}},TT=class extends J{get indexSymbol(){return this.inputs[B.INPUT_SYMBOL]}constructor(e,t){if(super(e,t),mO(t)){let n=$().getTimeSeriesDataSource(),r=t.query.duplicate();r.symbol=this.indexSymbol;let i=n.getTimeSeries(r),{model:a}=yd(`{${t.query.symbol}} / {${i.query.symbol}} * 100`,!1),o=wT(e.aggregation),s=new tb(a,[t,i],o);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=Z(G.Close,(e,t)=>null,t),n=Z(G.DRS,(e,t)=>null,t);this.addInner(e,n),this.canLoadMoreData=!1}}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[0].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}getWrappers(){return[this.wrapInner(G.DateTime,2),this.wrapInner(G.DRS,2)]}},ET=class extends J{get indexSymbol(){return this.inputs[B.INPUT_SYMBOL]}constructor(e,t){super(e,t);let n=qD(t,this.indexSymbol,e.aggregation),r=Y(n,this.period,G.DRS);this.addInner(n,r),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){let t=this.innVal(1,G.DRS,e),n=this.innVal(2,G.MA,e),r=null;return P(t,n)&&n!==0&&(r=(t/n-1)*100),{[G.MRS.id]:r}}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[0].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}},DT=q(`_SMTH_ROC`),OT=q(`_TEN_SMTH_ROC`);function kT(e,t,n,r,i){return new pb({source:r,target:i,outFields:[i],aggregation:n,inputs:xD(t)},e,e=>2/e)}var AT=class extends J{constructor(e,t){super(e,t);let n=UD(t,1),r=e.aggregation,i=this.inputs.Period1,a=Q(OT,(e,t)=>10*t,kT(n,i,r,G.ROC,DT)),o=this.inputs.Period2,s=kT(a,o,r,OT,G.PMO),c=X(s,this.inputs.Period3,G.PMO,G.PMOS);this.addInner(s,c)}getWrappers(){return[this.wrapInner(G.PMO,1),this.wrapInner(G.PMOS,2)]}},jT=q(`_VOL_AVG`),MT=class extends J{constructor(e,t){super(e,t);let n=cO(e,`MA`)(t,this.period,G.Volume,jT,!0);this.addInner(n)}calculateAt(e){let t=null,n=this.innVal(0,G.Volume,e),r=this.innVal(1,jT,e);return P(n,r)&&r!==0&&(t=n/r),{[this.target.id]:t}}},NT=e=>Xe(.5**(1/e),6),PT=52,FT=53,IT=27,LT=5,RT=131,zT=(()=>{let e=NT(PT-1),t=De(PT,t=>e**+t),n=PT/pe(t);return t.map(e=>e*n)})(),BT=[`Renko`,`Kagi`,`PointAndFigure`,`LineBreak`],VT=class extends J{isDaily;isFeasible=!0;constructor(e,t){super(e,t);let n=nb(t),r=n.query?.curveStyle;this.isFeasible=!(n instanceof __)&&(!P(r)||!BT.includes(h[r])),this.isDaily=e.aggregation.unit===g.Day}acceptable(e,t,n,r){return this.isDaily?r===0?!0:!li(this.baseVal(G.DateTime,t),this.baseVal(G.DateTime,n)):e>0&&n-t>=LT}pluckValues(e){let t=0,n=[],r=e+LT;for(let i=0;t<FT&&e-i>0;i++){let a=e-i,o=this.baseVal(this.source,a);this.acceptable(o,a,r,t)&&(n.push(o),r=a,t++)}return n}calculateAt(e){let t=null;if(this.isFeasible&&e>=RT){let n=1,r=this.pluckValues(e),i=r.length;if(i>=IT)for(let e=0;e<i-1;e++){let t=r[e]/r[e+1]-1;t<0?t=Math.max(t,-.2):t>=0&&(t=Math.min(t,.2)),t=t*zT[e]+1,n*=t}t=100*(n-1)}return{[this.target.id]:t}}},HT=20;function UT(e,t){switch(e){case g.Intraday:return t>=240?3:t>=120?2:1;case g.Day:default:return 5;case g.Week:return 15;case g.Month:return 60;case g.Quarter:case g.Year:return 240}}function WT(e){return e===_.Continue||e===_.Nearest}var GT=class extends J{additionalChunksCounter=1;noData=!1;isPeriodic=!1;constructor(e,t,n){super(e,n,ob(n,e=>{let t=ne[$()?.config.mode??`Unspecified`];if(!lc(t))return n;let r=e.duplicate(),i=e.aggregation;if(i.hasSpec)return WT(i.spec)?n:new __(r,!0);let a=i.unit===g.Intraday&&i.size<=5,o=UT(i.unit,i.size);r.aggregation=a?new Ru(g.Tick,i.size,_.PerSeconds):new Ru(g.Intraday,o);let s=a?1:3;return r.barsToFetch=Math.min(B.MAX_INTRADAY_BARS,s*e.barsToFetch),new h_(r)})),this.isPeriodic=t,this.noData=this.innerSeries[1]instanceof __,this.computedServerSide=!0,this.initialNotification=!0}get canLoadMoreData(){return!1}loadMoreData(){let e=this.innerSeries[1];return!this.noData&&this.additionalChunksCounter<HT&&e.canLoadMoreData&&!e.isLoading?(this.additionalChunksCounter+=1,e.loadMoreData()):Promise.resolve()}recalculateAt(e,t,n){if(e.src!==this.innerSeries[0])return;let r=n?K.TS_DATAPOINTADDED:K.TS_DATAPOINTCHANGED;this.notify(r,this.innerSeries[0].container.size-1)}getWrappers(){return[this.wrapInner(G.Change,1),this.wrapInner(G.Open,1),this.wrapInner(G.Close,1)]}},KT=class extends GT{constructor(e,t){super(e,!1,t)}},qT=class extends GT{constructor(e,t){super(e,!0,t)}},JT=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(n)}calculateAt(e){let t=null,n=this.innVal(1,G.ATR,e),r=this.baseVal(G.Close,e);return P(n,r)&&r>0&&(t=n/r*100),{[G.ATRP.id]:t}}},YT=q(`_DR`),XT=class extends J{constructor(e,t,n){super(e,n);let r=Z(YT,e=>{let t=this.baseVal(G.High,e),n=this.baseVal(G.Low,e);return{[YT.id]:P(t,n)?t-n:null}},n),i=cO(e,`MA`)(r,this.inputs.Period,YT,G.ADR);if(t){let e=Q(this.target,(e,t,n)=>!P(t,n)||n===0?null:t/n*100,i,n);this.addInner(e)}else this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},ZT=class extends XT{constructor(e,t){super(e,!1,t)}},QT=class extends XT{constructor(e,t){super(e,!0,t)}},$T=class extends J{constructor(e,t){super(e,t);let n=this.source,r=Z(n,se(aO,n),t),i=UD(r,this.inputs.PeriodRoc1,n),a=UD(r,this.inputs.PeriodRoc2,n),o=UD(r,this.inputs.PeriodRoc3,n),s=UD(r,this.inputs.PeriodRoc4,n),c=Y(i,this.inputs.PeriodMa1,G.ROC,G.MA1),l=Y(a,this.inputs.PeriodMa2,G.ROC,G.MA2),u=Y(o,this.inputs.PeriodMa3,G.ROC,G.MA3),d=Y(s,this.inputs.PeriodMa4,G.ROC,G.MA4),f=Q(G.KST,(e,t,n,r,i)=>t+2*n+3*r+4*i,c,l,u,d),p=Y(f,this.inputs.PeriodSig,G.KST,G.KSTSIG);this.addInner(f,p)}getWrappers(){return[this.wrapInner(G.KST,1),this.wrapInner(G.KSTSIG,2)]}},eE=q(`_EMA1`),tE=q(`_EMA2`),nE=q(`_MACD`),rE=q(`_PCTK`),iE=q(`_PCTD`),aE=q(`_PCTK2`),oE=class extends J{constructor(e,t){super(e,t);let n=Q(nE,(e,t,n)=>t-n,X(t,this.inputs.PeriodShort,G.Close,eE),X(t,this.inputs.PeriodLong,G.Close,tE)),r=this.inputs.PeriodStoch1,i=this.inputs.PeriodStoch2,a=cO(e,`EMA`),o=a(FD(a(FD(n,r,rE,!1,nE),i,rE,iE),r,aE,!1,iE),i,aE,this.target);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},sE=q(`_EMA1`),cE=q(`_EMA2`),lE=q(`_CORE`),uE=class extends J{isEmpty=!1;constructor(e,t){if(super(e,t),mO(t)&&e.aggregation?.isEndOfDay){let n=[`$ADVT`,`$DECT`];switch(this.inputs.Source){case`TotalStocks`:default:break;case`NYSEStocks`:n=[`$ADVN`,`$DECN`];break;case`NasdaqStocks`:n=[`$AVDQ`,`$DECQ`];break}let r=this.getSeries(t.query,n[0]),i=this.getSeries(t.query,n[1]),a=this.getTargetSeries(e,r,i);this.addInner(r,i,a),this.canLoadMoreData=!0,this.initialNotification=!0}else{this.isEmpty=!0;let e=Z(G.Close,(e,t)=>null,t),n=Z(G.Close,(e,t)=>null,t),r=Z(this.target,(e,t)=>null,t);this.addInner(e,n,r),this.canLoadMoreData=!1}}get baseIndex(){return+!this.isEmpty}getSeries(e,t){let n=e.duplicate();return n.symbol=t,$().getTimeSeriesDataSource().getTimeSeries(n)}shouldTriggerOurRecalc(e){return super.shouldTriggerOurRecalc(e)?!0:e===this.innerSeries[0]?!1:(e===this.innerSeries[1]||e===this.innerSeries[2])&&this.innHasData(1)&&this.innHasData(2)}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[1].canLoadMoreData||!this.innerSeries[2].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),await this.innerSeries[2].loadMoreData(e),this.isLoading=!1}getWrappers(){return[this.wrapInner(this.target,3)]}},dE=class extends uE{constructor(e,t){super(e,t)}getTargetSeries(e,t,n){let r=(e,t,n)=>t-n,i=Q(lE,this.inputs.RatioAdjusted===`Yes`?(e,t,n)=>(t-n)/(t+n)*1e3:r,t,n),a=X(i,this.inputs.Period1,lE,sE),o=X(i,this.inputs.Period2,lE,cE);return Q(this.target,r,a,o)}},fE=q(`_INN_HL_ACC_IX`),pE=new Ru;function mE(e,t,n){return new hE({aggregation:pE,source:null,target:n,outFields:[n],inputs:{...t}},e)}var hE=class extends J{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof __)this.canLoadMoreData=!1;else{let n=this.inputs.Source===`PriceIndex`?`$MADX`:`$FADX`,r=this.getSeries(t.query,n);if(this.addInner(r),this.isWeekly=e.aggregation.unit===g.Week,this.isWeekly){let e=mE(this.getSeries(t.query,n,pE),this.inputs,fE);this.addInner(e)}this.canLoadMoreData=!0,this.initialNotification=!0}}getSeries(e,t,n){let r=e.duplicate();return r.symbol=t,n&&(r.aggregation=n,r.barsToFetch=B.US_TRADING_DAYS_PER_YEAR*15),$().getTimeSeriesDataSource().getTimeSeries(r)}get baseIndex(){return 1}calculateAt(e){if(this.isWeekly)return this.calculateAtWeekly(e);let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,G.Close);k(r)&&(t=pe(r))}return{[this.target.id]:t}}calculateAtWeekly(e){let t=this.container?.size??-1,n=null,r=this.innCont(2);if(t>0&&e===t-1)n=r.getLastDataPoint(fE);else{let t=this.container.getTimeData()[e],i=r.getTimeData(),a=Te(i,t),o=i[a],s=null;for(;a<r.size&&li(t,o);)s=a,a+=1,o=i[a];s!==null&&(n=r.getData(fE)[s])}return{[this.target.id]:n}}shouldTriggerOurRecalc(e){return super.shouldTriggerOurRecalc(e)?!0:e===this.innerSeries[0]?!1:e===this.innerSeries[1]&&this.innHasData(1)}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[1].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}},gE=q(`_RSI1`),_E=q(`_RSI1_MOM`),vE=q(`_RSI2`),yE=q(`_RSI2_MA`),bE=class extends J{constructor(e,t){super(e,t);let n=WD(t,this.inputs.Period1Rsi,G.Close,gE),r=Z(_E,ce(oO,this.inputs.Period1Mom,gE),n),i=Y(WD(t,this.inputs.Period2Rsi,G.Close,vE),this.inputs.Period2Ma,vE,yE),a=Q(G.CMBCI,(e,t,n)=>t+n,r,i),o=Y(a,this.inputs.PeriodFastMa,G.CMBCI,G.CMBCIF),s=Y(a,this.inputs.PeriodSlowMa,G.CMBCI,G.CMBCIS);this.addInner(a,o,s)}getWrappers(){return[this.wrapInner(G.CMBCI,1),this.wrapInner(G.CMBCIF,2),this.wrapInner(G.CMBCIS,3)]}};function xE(e){return new OC({source:G.Close,inputs:{},outFields:OD(`COTLC`)},e)}var SE=class extends J{constructor(e,t){super(e,xE(t));let n=Number.parseInt(this.inputs.History),r=n===6?52/2:52*n,i=FD(this.innerSeries[0],r,G.COTI,!1,G.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(i)}getWrappers(){return[this.wrapInner(G.COTI,1)]}},CE=q(`_MUL_ATR`),wE=class extends J{isLong;constructor(e,t){super(e,t),this.isLong=this.inputs.Direction===`Long`;let n=this.period,r=zD(t,n),i=this.inputs.Multiplier,a=Q(CE,(e,t)=>t===null?null:i*t,r),o=PD(t,n,G.High,G.HH,!0),s=PD(t,n,G.Low,G.LL,!1);this.addInner(a,o,s)}calculateAt(e){let t=null,n=null,r=this.innVal(1,CE,e);return r!==null&&(this.isLong?t=this.innVal(2,G.HH,e)-r:n=this.innVal(3,G.LL,e)+r),{[G.CHEXL.id]:t,[G.CHEXS.id]:n}}},TE=class extends J{constructor(e,t){let n=e.outFields??[],r=e=>{let t=$().getTimeSeriesDataSource();return e.seriesKind=w.Options,e.fields=n,t.getTimeSeries(e)},i=n.length===1?n[0]:void 0,a=i?sb(t,i,r):ob(t,r);super(e,a),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return this.outFields.map(e=>this.wrapInner(e,0))}},EE=class extends TE{},DE=class extends TE{},OE=class extends TE{},kE=class extends TE{},AE=class extends TE{},jE=class extends TE{},ME=class extends TE{},NE=class extends J{constructor(e,t){super(e,t);let n=zD(t,1),r=this.inputs.Period,i=PD(t,r,G.High,G.HH,!0),a=PD(t,r,G.Low,G.LL,!1);this.addInner(n,i,a)}calculateAt(e){let t=null,n=this.period;if(e>n){let r=this.past(e,n,G.ATR,this.innCont(1));if(k(r)){let i=pe(r)/(this.innVal(2,G.HH,e)-this.innVal(3,G.LL,e));t=100*Math.log10(i)/Math.log10(n)}}return{[this.target.id]:t}}},PE=class extends J{constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=n(t,e.inputs.Period1,this.source,G.MACLD1),i=n(t,e.inputs.Period2,this.source,G.MACLD2);this.addInner(r,i)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=+(this.innVal(1,G.MACLD1,e)>this.innVal(2,G.MACLD2,e));return{[G.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(G.MACLD1,1),this.wrapInner(G.MACLD2,2)]}},FE=q(`_CORE`),IE=class extends uE{constructor(e,t){super(e,t)}getTargetSeries(e,t,n){let r=Q(FE,(e,t,n)=>t/(t+n),t,n);return cO(e,`MA`,`Average`)(r,this.inputs.Period,FE,this.target)}},LE=class extends J{stdDevs;periodForecast;unitsPerYear;constructor(e,t){super(e,t),this.unitsPerYear=dO(e.aggregation),this.stdDevs=this.toInt(`StandardDeviations`),this.periodForecast=this.inputs.PeriodForecast;let n=this.getHistVolPeriod();if(n!==null){let r=$D(t,n,e.aggregation);this.addInner(r)}}getHistVolPeriod(){return this.isCustomVolatility?null:Number.parseInt(this.volatilityParam.substring(2))}toInt(e){return Number.parseInt(this.inputs[e])}get volatilityParam(){return this.inputs.Volatility}get isCustomVolatility(){return this.volatilityParam===`Custom`}get haveVolatility(){return this.isCustomVolatility||this.innHasData(1)}getVolatilityPercent(){return(this.isCustomVolatility?this.inputs.VolatilityPercent:this.innCont(1).getLastDataPoint(G.HV))/100}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null;if(this.haveVolatility){let s=this.base.size-this.periodForecast;if(e>=s){let c=this.base.getLastDataPoint(G.Close),l=this.getVolatilityPercent(),u=e-s+1,d=c*l*Math.sqrt(u/this.unitsPerYear);if(t=c+d,n=c-d,this.stdDevs>1){let e=2*d;if(r=c+e,i=c-e,this.stdDevs>2){let e=3*d;a=c+e,o=c-e}}}}return{[G.PCUP1.id]:t,[G.PCDN1.id]:n,[G.PCUP2.id]:r,[G.PCDN2.id]:i,[G.PCUP3.id]:a,[G.PCDN3.id]:o}}recalculateAt(e,t,n){let r={tag:bt(),src:this.innerSeries[0]};n&&this.calculate(r)}},RE=class extends J{constructor(e,t){super(e,ob(t,e=>new zE(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(G.Delta,0),this.wrapInner(G.Gamma,0),this.wrapInner(G.Theta,0),this.wrapInner(G.Vega,0)]}},zE=class extends h_{constructor(e){super(e)}getRetriever(){return Ti(this.query.symbol)?new HE:ji(this.query.symbol)?new UE:new VE}};function BE(){return new _g([G.DateTime,G.Delta,G.Gamma,G.Theta,G.Vega])}var VE=class{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){return BE()}},HE=class extends Hg{emptyContainer(e,t){return BE()}get iterateForward(){return!1}getPageName(){return`getFuturesOptionsHistory`}processRow(e,t,n){n.addDataPoint(G.DateTime,ug(e.date.substring(0,10))),n.addDataPoint(G.Delta,e.delta),n.addDataPoint(G.Gamma,e.gamma),n.addDataPoint(G.Theta,e.theta),n.addDataPoint(G.Vega,e.vega)}},UE=class extends Hg{emptyContainer(e,t){return BE()}addExtraParams(e){e.fields=`delta,gamma,theta,vega`}get iterateForward(){return!0}getPageName(){return`getEquityOptionsHistory`}processRow(e,t,n){n.addDataPoint(G.DateTime,ug(e.date)),n.addDataPoint(G.Delta,e.delta),n.addDataPoint(G.Gamma,e.gamma),n.addDataPoint(G.Theta,e.theta),n.addDataPoint(G.Vega,e.vega)}},WE=q(`_RSI1`),GE=q(`_RSI2`),KE=class extends J{constructor(e,t){super(e,t);let n=WD(t,this.inputs.Period1,this.source,WE),r=WD(t,this.inputs.Period2,this.source,GE),i=Q(G.RSA,(e,t,n)=>(t+n)/2,n,r),a=cO(e,`MA`,`Average`)(i,this.inputs.PeriodAvg,G.RSA,G.RSAAVG);this.addInner(i,a)}getWrappers(){return[this.wrapInner(G.RSA,1),this.wrapInner(G.RSAAVG,2)]}},qE=class extends J{constructor(e,t){super(e,t),rO(this);let n=e.inputs.PeriodRSI,r=e.inputs.PeriodTradeSignal,i=e.inputs.PeriodMarketBase,a=e.inputs.PeriodBB,[o]=iO(this),s=this.innerSeries[o],c=WD(s,n,this.source,G.TDIPRC),l=Y(c,r,G.TDIPRC,G.TDITSL),u=Y(c,i,G.TDIPRC,G.TDIMBL),d=KD(c,a,G.TDIPRC,G.MSD);this.addInner(c,l,u,d)}calculateAt(e){let t=this.inputs.MultiplierBB,n=+!!this.sourceNeedsCompute,r=this.innVal(1+n,G.TDIPRC,e),i=this.innVal(2+n,G.TDITSL,e),a=this.innVal(3+n,G.TDIMBL,e),o=this.innVal(4+n,G.MSD,e),s=null,c=null;if(P(a,o)){let e=t*o;s=a+e,c=a-e}return{[G.TDIPRC.id]:r,[G.TDITSL.id]:i,[G.TDIMBL.id]:a,[G.TDIUPR.id]:s,[G.TDILWR.id]:c}}},JE=q(`_ANCHR`),YE=class extends J{isLong;isPercent;constructor(e,t){super(e,t);let n=e.inputs.Period,r=e.inputs.Range,i=e.inputs.Direction;this.isLong=i===`Long`,this.isPercent=e.inputs.Type===`Percent`;let a=r===`Close`,o=G.Close;a||(o=this.isLong?G.High:G.Low);let s=PD(t,n,o,JE,this.isLong);this.addInner(s)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=null,n=this.innVal(1,JE,e),r=this.inputs.StopValue;if(n!==null){let e=this.isPercent?n*r/100:r;t=this.isLong?n-e:n+e}let i=+!!this.isLong;return{[G.PPS.id]:t,[G.BARCOLIX.id]:i}}},XE=q(`_HH_N`),ZE=q(`_LL_N`),QE=q(`_HH_H1`),$E=q(`_LL_H1`),eD=q(`_HH_H2`),tD=q(`_LL_H2`),nD=class extends J{constructor(e,t){super(e,t),rO(this);let n=e.inputs.Period,r=Math.floor(n/2),i=PD(t,n,G.High,XE,!0),a=PD(t,n,G.Low,ZE,!1),o=PD(t,r,G.High,QE,!0),s=PD(t,r,G.Low,$E,!1),c=PD(t,r,G.High,eD,!0),l=PD(t,r,G.Low,tD,!1);this.addInner(i,a,o,s,c,l)}calculateAt(e){let t=this.period,n=Math.floor(t/2),[,r]=iO(this),i=r.getData(this.source)[e];if(!this.atLeast(e,t))return{[this.target.id]:i};let a=+!!this.sourceNeedsCompute,o=this.innVal(1+a,XE,e),s=this.innVal(2+a,ZE,e),c=this.innVal(3+a,QE,e),l=this.innVal(4+a,$E,e),u=this.innVal(5+a,eD,e-n),d=this.innVal(6+a,tD,e-n);if(!P(o,s,c,l,u,d))return{[this.target.id]:i};let f=(o-s)/t,p=(c-l)/n,m=(u-d)/n,h=0;p>0&&m>0&&f>0&&(h=(Math.log(p+m)-Math.log(f))/Math.log(2));let g=Math.exp(-4.6*(h-1));g=Math.max(.01,Math.min(1,g));let _=e>0?this.container.getData(this.target)[e-1]:i,v=_===null?i:g*i+(1-g)*_;return{[this.target.id]:v}}},rD=q(`_MIDPOINT`),iD=q(`_VALUE`),aD=class extends J{constructor(e,t){super(e,t);let n=e.inputs.Period,r=Z(rD,se(Lx,rD),t),i=PD(r,n,rD,G.HH,!0),a=PD(r,n,rD,G.LL,!1);this.addInner(r,i,a)}get helpers(){return[iD]}calculateAt(e){let t=this.innVal(1,rD,e),n=this.innVal(2,G.HH,e),r=this.innVal(3,G.LL,e);if(!P(n,r,t))return{[G.FISHER.id]:null,[G.FISHTRG.id]:null,[iD.id]:null};let i=n-r,a=i===0?.5:(t-r)/i,o=t=>this.container.getData(t)[e-1],s=e>0?o(iD):null,c=.66*(a-.5)+.67*(s??0);c>.99?c=.999:c<-.99&&(c=-.999);let l=e>0?o(G.FISHER):null,u=.5*Math.log((1+c)/(1-c))+.5*(l??0);return{[G.FISHER.id]:u,[G.FISHTRG.id]:l,[iD.id]:c}}},oD=class extends J{constructor(e,t){super(e,t),rO(this)}computeMidranks(e){let t=e.length,n=e.map((e,t)=>({v:e,i:t}));n.sort((e,t)=>e.v-t.v);let r=Array(t),i=0;for(;i<t;){let e=i,a=n[i].v;for(;e+1<t&&n[e+1].v===a;)e++;let o=(i+1+(e+1))/2;for(let t=i;t<=e;t++)r[n[t].i]=o;i=e+1}return r}pearsonCorrelation(e){let t=e.length;if(t<2)return null;let n=(t+1)/2,r=0;for(let n=0;n<t;n++)r+=e[n];let i=r/t,a=0,o=0,s=0;for(let r=0;r<t;r++){let t=r+1-n,c=e[r]-i;a+=t*c,o+=t*t,s+=c*c}let c=Math.sqrt(o*s);return c===0?null:a/c}calculateAt(e){let t=null,n=this.period,[,r]=iO(this);if(this.atLeast(e,n)){let i=this.past(e,n,this.source,r);if(i.every(e=>e!==null)){let e=this.computeMidranks(i),n=this.pearsonCorrelation(e);n!==null&&(t=100*n)}}return{[G.RCI.id]:t}}},sD=class extends J{constructor(e,t){super(e,t);let n=this.source,r=new oD({source:n,target:G.RCI,inputs:{Period:e.inputs.Period}},t),i=e.inputs.PeriodSignal,a=cO(e,`MA`,`Smoothing`)(r,i,G.RCI,G.RCISIG);this.addInner(r,a)}getWrappers(){return[this.wrapInner(G.RCI,1),this.wrapInner(G.RCISIG,2)]}},cD=q(`_ATR`),lD=class extends J{state;useHighLow;isAtrMode;atrMult;percent;constructor(e,t){if(super(e,t),this.useHighLow=e.inputs.Method===`High/Low`,this.isAtrMode=e.inputs.PercentMode===`ATR`,this.percent=e.inputs.Percent,this.atrMult=e.inputs.MultiplierAtr,this.useHighLow||rO(this),this.isAtrMode){let t=e.inputs.PeriodAtr,[n]=this.useHighLow?[0]:iO(this),r=this.innerSeries[n],i=zD(r,t,`SMA`,cD);this.addInner(i)}this.resetState()}getHigh(e){if(this.useHighLow)return this.baseVal(G.High,e);let[,t]=iO(this);return t.getData(this.source)[e]}getLow(e){if(this.useHighLow)return this.baseVal(G.Low,e);let[,t]=iO(this);return t.getData(this.source)[e]}getAtrDenom(e){if(this.useHighLow)return this.baseVal(G.Close,e);let[,t]=iO(this);return t.getData(this.source)[e]}setPivot(e,t){this.state.pivotPrice=e,this.state.pivotIndex=t}setCandidate(e,t){this.state.candPrice=e,this.state.candIndex=t}getDevPct(e){if(this.isAtrMode){let t=!this.useHighLow&&this.sourceNeedsCompute?1:0,n=this.innVal(1+t,cD,e),r=this.getAtrDenom(e);if(n===null||r===null||r===0)return 0;let i=n/r*100;return this.atrMult*i}return this.percent}pct(e,t){return e===0?0:(t-e)/e*100}resetState(){this.state={mode:0,pivotPrice:null,pivotIndex:null,candPrice:null,candIndex:null,confirmedPivots:new Map}}calculateAt(e){let t=this.getHigh(e),n=this.getLow(e),r=this.getDevPct(e);if(t===null||n===null)return{};if(e===0){this.resetState();let n=this.useHighLow?this.baseVal(G.Close,e):t;return this.setPivot(n,e),this.setCandidate(n,e),{}}if(this.state.mode===0)this.pct(this.state.pivotPrice,t)>=r?(this.state.mode=1,this.setCandidate(t,e)):-this.pct(this.state.pivotPrice,n)>=r&&(this.state.mode=-1,this.setCandidate(n,e));else if(this.state.mode===1){let i=t>=this.state.candPrice;i&&this.setCandidate(t,e);let a=(this.state.candPrice-n)/this.state.candPrice*100;if(!i&&a>=r){let t=this.state.candIndex,r=this.state.candPrice;this.state.confirmedPivots.set(t,r),this.setPivot(r,t),this.setCandidate(n,e),this.state.mode=-1}}else if(this.state.mode===-1){let i=n<=this.state.candPrice;i&&this.setCandidate(n,e);let a=(t-this.state.candPrice)/this.state.candPrice*100;if(!i&&a>=r){let n=this.state.candIndex,r=this.state.candPrice;this.state.confirmedPivots.set(n,r),this.setPivot(r,n),this.setCandidate(t,e),this.state.mode=1}}return{}}getCurrentState(){return this.state}},uD=class extends J{constructor(e,t){super(e,t);let n=Z(G.BOP,function(e){let t=null,[n,r,i,a]=[G.Open,G.High,G.Low,G.Close].map(t=>this.baseVal(t,e));if(P(n,r,i,a)){let e=r-i;t=e===0?0:(a-n)/e}return{[this.target.id]:t}},t),r=cO(e,`MA`,`Average`),i=this.period,a=r(n,i,G.BOP,G.BOPAVG);this.addInner(n,a)}getWrappers(){return[this.wrapInner(G.BOP,1),this.wrapInner(G.BOPAVG,2)]}};function dD(e,t){let n=e.length;if(n<2||t.length!==n)return null;let r=0,i=0,a=0,o=0,s=0;for(let c=0;c<n;c++){let n=e[c],l=t[c];r+=n,i+=l,a+=n*n,o+=l*l,s+=n*l}let c=n*s-r*i,l=Math.sqrt((n*a-r*r)*(n*o-i*i));if(l===0||!Number.isFinite(l))return null;let u=c/l;return Number.isFinite(u)?Math.max(-1,Math.min(1,u)):null}var fD=class extends J{constructor(e,t){if(super(e,t),mO(t)){let e=this.inputs.Symbol?.toUpperCase();if(e){let n=$().getTimeSeriesDataSource(),r=t.query.duplicate();r.symbol=e;let i=n.getTimeSeries(r);this.addInner(i),this.canLoadMoreData=!0,this.initialNotification=!0}}}compareCloseAt(e){let t=this.innCont(1);if(!t||t.isEmpty)return null;let n=this.baseVal(G.DateTime,e);if(n===null)return null;let r=t.getData(G.DateTime),i=t.getData(G.Close);if(r.length===0)return null;let a=n.valueOf(),o=Te(r,a,Number),s=r[o];if(!P(s))return null;let c=s.valueOf()<=a?o:o-1;if(c<0)return null;let l=i[c];return P(l)?l:null}calculateCorrelation(e){let t=this.period;if(!this.atLeast(e,t)||!this.innHasData(1))return null;let n=[],r=[];for(let i=e-t+1;i<=e;i++){let e=this.baseVal(G.Close,i),t=this.compareCloseAt(i);if(!P(e,t))return null;n.push(e),r.push(t)}return dD(n,r)}calculateAt(e){return{[this.target.id]:this.calculateCorrelation(e)}}async loadMoreData(e=!0){if(this.isLoading||this.innerSeries.length<2||!this.innerSeries[1].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}},pD=4,mD=4,hD=q(`_RVI_NUM`),gD=q(`_RVI_DEN`),_D=q(`_RVI_NUMAVG`),vD=q(`_RVI_DENAVG`);function yD(e){if(e.length<mD||!k(e))return null;let[t,n,r,i]=e;return(t+2*n+2*r+i)/6}var bD={_TR:gx,_RSI:qb,MA:fb,MAEXP:mb,MAHLC:gb,VOL:vb,MAENV:wb,MAENVEXP:Tb,MAENVSMO:Eb,MATRI:Db,MAWEI:Ob,MAVOL:fb,MASMO:hb,MACD:zb,MACDEXP:Bb,MACDV:Rb,GMMA:qC,OSCI:kb,OSCIVOL:kb,RSI:Yb,RSIMOD:Xb,RSISTO:Zb,RSA:KE,WPERCR:nx,HHLL:Qb,WGCL:$b,STOCHF:ax,STOCHS:ox,BBANDS:ux,BWIDTH:dx,BPERC:fx,OBVOL:hx,ATR:bx,ADR:ZT,ATRP:JT,ADRP:QT,ADX:Ax,ADXMOD:jx,ADL:Mx,ADWM:Nx,CHAOSC:Px,TP:Fx,KELCHN:Gx,KELBND:Kx,DONCHN:Jx,DONWIDTH:Yx,PVT:Xx,ROC:tS,TRIX:Zx,PPMOV:nS,PIVPTS:NC,CPP:PC,ARNUPDW:oS,ARNOSC:sS,TCHN:cS,TCHRE:lS,ALLG:dS,PLTLN:fS,AWEOSC:mS,MFV:_S,CLV:gS,CHAMF:vS,CHAVOL:bS,DPO:xS,CCI:CS,EMV:wS,ERBRPOW:DS,ERBLPOW:ES,FI:kS,MI:PS,MOM:FS,MFI:IS,MSD:LS,NVI:VS,PVI:HS,PPO:Ub,PVO:Wb,HV:WS,PERF:GS,WASI:qS,WWVOL:XS,PARTP:nC,MOVLR:rC,TRSP:vC,TARGP:yC,COTLC:OC,COTDAG:kC,COTFTR:AC,IMPVOL:FC,CTM:Vb,CPMI:Hb,DEMA:Qx,EOSC:$x,TEMA:eS,TSI:KC,ADJATR:xx,COTR:Sx,MCGD:JC,HMA:XC,COPP:QC,REATRS:nw,LINRCHN:rw,CSHO:iw,CSHB:aw,MKTCAP:ow,CTPI:sx,PCTCHG:sw,OPINT:yb,STOMOMIX:hw,CHDMOMOSC:bw,VSTOP:ww,ATREXT:db,SUPTR:Ow,ICHCLD:kw,VWAP:Pw,MACROSS:Hw,PACROSS:Uw,VOIN:Kw,DIFA:Jw,DOSC:Yw,BBANDW:px,MARIB:Xw,HASMO:tT,TTMSQZ:rT,CRS:aT,JPI:bT,CTTP:xT,CTTI:CT,DRS:TT,MRS:ET,PMO:AT,RVOL:MT,WGALPH:VT,VOLAP:KT,AVWAP:Fw,KST:$T,STC:oE,MCCLO:dE,NHLAI:hE,CMBCI:bE,COTI:SE,CHEXI:wE,MBBANDS:mx,OPTIV:EE,IVRANK:DE,IVPCTL:OE,OPTVOLPC:kE,OPTOIPC:AE,OPTVOL:jE,OPTOI:ME,CHOP:NE,MACLD:PE,BTI:IE,FRAMA:nD,FISHER:aD,PC:LE,GREEKS:RE,PVACP:qT,TDI:qE,PPS:YE,RCI:sD,BOP:uD,CORR:fD,RVI:class extends J{constructor(e,t){super(e,t);let n=(e,t)=>function(n){let r=this.past(n,mD,e),i=this.past(n,mD,t),a=null;if(k(r)&&k(i)){let e=r,t=i;a=yD(e.map((e,n)=>e-t[n]))}return{[this.target.id]:a}},r=Z(hD,n(G.Close,G.Open),t),i=Z(gD,n(G.High,G.Low),t),a=this.period,o=Y(r,a,hD,_D),s=Y(i,a,gD,vD),c=Q(G.RVI,(e,t,n)=>n===0?null:t/n,o,s),l=Z(G.RVISIG,function(e){return{[this.target.id]:yD(this.past(e,pD,G.RVI))}},c);this.addInner(c,l)}getWrappers(){return[this.wrapInner(G.RVI,1),this.wrapInner(G.RVISIG,2)]}},ZIGZAG:lD};function xD(e){return{[B.INPUT_PERIOD]:e}}function SD(e){return{[B.INPUT_SYMBOL]:e}}function CD(e){return{target:e,source:null,inputs:LD}}function wD(e){return e instanceof tb&&typeof e.seasonalAverageOffset==`number`&&e.seasonalAverageOffset<0}function TD(e,t){if(!P(e))return e;for(let[n,r]of t.policy.fieldMap.entries())if(r===e)return n;return e}function ED(e,t,n){if(!B.CLIENT_SIDE_SEASONAL_AVERAGE_DISTRIBUTED_STUDIES.has(e)||!wD(n))return null;let r=TD(t.source,n),i=t.target??t.outFields?.[0];if(!N(i))return null;let a=n.innerSeries.map(n=>{let a=DD(e,{...t,source:r??null,target:i,outFields:[i],inputs:F(t.inputs??{})},n);return a.query=n.query,a}),o=new tb(n.exprModel,a,{...n.policy,fieldMap:new Map([[i,i]])});return new lb({...t,source:r??null,target:i,outFields:[i]},o)}function DD(e,t,n){let r=ED(e,t,n);if(r)return r;if(nt(bD,e))return new bD[e](t,n);let i=$()?.config.extensions?.studyProvider;if(i){let r=i.factory(e,t,n);if(r)return r}throw Error(`Study ${e} has not been implemented yet.`)}function OD(e){return V(e).defaults.curves.reduce((e,t)=>e.concat(t.fields.filter(t=>!e.includes(t))),[]).map(e=>G[e])}function kD(e,t,n,r){return{source:t,target:n,inputs:xD(e),allowEmptyValues:r}}function Y(e,t,n,r=G.MA,i=!1){return DD(`MA`,kD(t,n,r,i),e)}function X(e,t,n,r=G.EMA,i=!1){return DD(`MAEXP`,kD(t,n,r,i),e)}function AD(e,t,n,r=G.SMA,i=!1){return DD(`MASMO`,kD(t,n,r,i),e)}function jD(e,t,n,r=G.WMA,i=!1){return DD(`MAWEI`,kD(t,n,r,i),e)}function MD(e,t,n,r=G.HMA,i=!1){return DD(`HMA`,kD(t,n,r,i),e)}function ND(e,t,n,r,i=G.Close){return DD(`MACDEXP`,{source:i,inputs:{Period1:t,Period2:n,Period3:r},outFields:[G.MACD,G.MACDS,G.MACDH]},e)}function PD(e,t,n,r,i,a=!1){return new ex({source:n,target:r,inputs:xD(t)},i,a,e)}function FD(e,t,n,r,i=null){return new tx({source:i,target:n,inputs:xD(t)},r,e)}function ID(e,t,n=G.PCTCHG){return DD(`PCTCHG`,{source:t,target:n,inputs:LD},e)}var LD={};function RD(e,t=G.TR){return DD(`_TR`,CD(t),e)}function zD(e,t,n=`SMA`,r=G.ATR){return DD(`ATR`,{target:r,inputs:{[B.INPUT_PERIOD]:t,[B.INPUT_SMOOTHING]:n},source:null},e)}function BD(e,t,n=`MA`,r=G.Close,i=G.ADJATR){return DD(`ADJATR`,{source:r,target:i,inputs:{[B.INPUT_PERIOD]:t,[B.INPUT_SMOOTHING]:n}},e)}function VD(e,t=G.ADL){return DD(`ADL`,CD(t),e)}function HD(e,t=G.TP){return DD(`TP`,CD(t),e)}function UD(e,t,n=G.Close,r=G.ROC){return DD(`ROC`,{source:n,target:r,inputs:xD(t)},e)}function WD(e,t,n,r=G.RSI,i=!1){return DD(`_RSI`,{source:n,target:r,inputs:{...xD(t),Modified:i}},e)}function GD(e,t=G.MFMUL){return DD(`MFV`,CD(t),e)}function KD(e,t,n,r=G.MSD){return DD(`MSD`,{source:n,target:r,inputs:xD(t)},e)}function qD(e,t,n,r=G.DRS){return DD(`DRS`,{target:r,inputs:SD(t),aggregation:n,source:null},e)}function JD(e,t=G.CSHO){return DD(`CSHO`,CD(t),e)}function YD(e,t,n){let r=`TCHN`;return DD(r,{inputs:{PeriodUpper:t,PeriodLower:t,Range:n},outFields:OD(r),source:null},e)}function XD(e,t,n,r=G.Close){let i=`BBANDS`,a=OD(i);return DD(i,{source:r,inputs:{[B.INPUT_PERIOD]:t,[B.INPUT_WIDTH]:n},outFields:a},e)}function ZD(e,t){let n=`DONCHN`,r=OD(n);return DD(n,{inputs:xD(t),outFields:r,source:null},e)}function QD(e,t,n,r=G.MOVLR){return DD(`MOVLR`,{source:n,inputs:xD(t),target:r},e)}function $D(e,t,n,r=G.Close,i=G.HV){return DD(`HV`,{source:r,target:i,aggregation:n,inputs:xD(t)},e)}function Z(e,t,n){return new zx(CD(e),t,n)}function Q(e,t,...n){return new Ix(CD(e),t,...n)}function eO(e,t,n){return t-n}function tO(e,t,n){return(t-n)/n*100}function nO(e){switch(e.id){case`HL/2`:case`OC/2`:case`HLC/3`:case`OHLC/4`:case`HLCC/4`:return!0;default:return!1}}function rO(e){let t=e.source;if(e.sourceNeedsCompute=nO(t),e.sourceNeedsCompute){let n=Z(t,se(aO,t),e.innerSeries[0]);e.addInner(n)}}function iO(e){let t=+!!e.sourceNeedsCompute;return[t,e.innCont(t)]}var aO=function(e,t){let[n,r,i,a]=[G.Open,G.High,G.Low,G.Close].map(e=>this.baseVal(e,t)),o=null,s=e.id;switch(s){case`Open`:o=n;break;case`High`:o=r;break;case`Low`:o=i;break;case`Close`:o=a;break;case`HL/2`:o=(r+i)/2;break;case`OC/2`:o=(n+a)/2;break;case`HLC/3`:o=(r+i+a)/3;break;case`OHLC/4`:o=(n+r+i+a)/4;break;case`HLCC/4`:o=(r+i+a+a)/4;break;default:break}return{[s]:o}},oO=function(e,t,n){let r=null;if(this.atLeast(n,e+1)){let i=this.baseVal(t,n-e);i!==null&&(r=this.baseVal(t,n)-i)}return{[this.target.id]:r}},sO={sma:AD,ma:Y,ema:X,wma:jD,hma:MD};function cO(e,t,n=`Smoothing`){return sO[(e.inputs[n]??t).toLowerCase()]}var lO={atr:zD,adjatr:BD};function uO(e){return lO[e.inputs.TypeOfATR.toLowerCase()]}function dO(e){switch(e.unit){case g.Day:return 252;case g.Week:return 52;case g.Month:return 12;default:return 0}}function fO(e){let t=[G.High,G.Low];return e instanceof tb&&be(e.targetFields,t).length!==2}function pO(e,t){return e[`Period${t}`]}function mO(e){return!(e instanceof __)&&e.query instanceof Qy}var hO=class extends cb{constructor(e,t){let n=X(t,13,G.Close),r=ND(t,12,26,9,G.Close);super(e,t,n,r),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=p.Same,n=this.innVal(1,G.EMA,e),r=this.innVal(1,G.EMA,e-1),i=this.innVal(2,G.MACDH,e),a=this.innVal(2,G.MACDH,e-1);return P(n,r,i,a)&&(n>r&&i>a?t=p.Up:n<r&&i<a&&(t=p.Down)),{[G.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(G.Open,G.High,G.Low,G.Close,G.Change,G.Volume,G.OpenInterest,G.TradingDay)}};function gO(e,t){return P(t)?(this[e]=t,null):this[e]}var _O=class{_domain;_range;_extent;_padding;constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return gO.call(this,`_domain`,e)}range(e){return gO.call(this,`_range`,e)}padding(e){return gO.call(this,`_padding`,e)}get ready(){return P(this._domain,this._range)}},vO=1/Math.log2(10),yO=(e,t)=>n=>e*(1-n)+t*n,bO=(e,t)=>(t-=e,t>0?n=>(n-e)/t:e=>ue(isNaN(t)?NaN:.5));function xO(e,t){let n=bO(e[0],e[1]),r=yO(t[0],t[1]);return e=>r(n(e))}function SO(e){return Math.sign(e)*Math.log10(1+Math.abs(e/vO))}function CO(e){return Math.sign(e)*vO*(-1+10**Math.abs(e))}var wO=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]],TO=class extends _O{scaleType;axis;constructor(e,t){super(),this.scaleType=e,this.axis=t}domain(e){return this.axis&&e&&!ge(e,this._domain)&&this.axis.pane.presenter.onScaleDomainChanged(this.axis),super.domain(e)}yToPrice(e){return this.mapValue(e)}rangeWithPadding(){return[this._range[0]+this._padding[0],this._range[1]-this._padding[1]]}mapValue(e,t=!0){if(!this.ready)return null;let n=ue,r=ue;switch(this.scaleType){case S.Linear:break;case S.Logarithmic:n=SO,r=CO;break;default:throw Error(`Unexpected scale type (neither linear nor log)`)}let i=this._domain.map(n),a=this.rangeWithPadding(),o=t?xO(a,i):xO(i,a),s=e=>a[1]-e+a[0];return(t?r:s)(o((t?s:n)(e)))}priceToY(e){return this.mapValue(e,!1)}getTicks(e){if(!this.ready)return[];let[t,n]=this._range.map(e=>this.mapValue(e,!0));if(t===n&&e>0)return[t];let[r,i]=this._domain;if(this.scaleType===S.Linear||r<0||i>1e5)return EO(t,n,e);let a=this.findLogBand(r),o=this.findLogBand(i),s=e*2;return o-a===0?EO(t,n,s):this.getLogTicks(a,o,s,n<t)}findLogBand(e){return wO.findIndex(([t,n])=>e>=t&&e<n)}getLogTicks(e,t,n,r){let i=[...this._domain],a=[];try{for(let o=e;o<=t;o++){let[s,c]=wO[o];o===e?s=i[0]:o===t&&(c=i[1]),this.domain([s,c]);let[l,u]=this._range.map(e=>this.mapValue(e,!0)),d=EO(l,u,n);a=r?d.concat(a):a.concat(d)}}finally{this.domain(i)}return je(a,r?(e,t)=>e>t:(e,t)=>e<t),a}checkTicks(){return this.scaleType===S.Logarithmic}};function EO(e,t,n){let r,i=-1,a,o,s;if(t=+t,e=+e,n=+n,e===t&&n>0)return[e];if((r=t<e)&&(a=e,e=t,t=a),(s=DO(e,t,n))===0||!isFinite(s))return[];if(s>0)for(e=Math.ceil(e/s),t=Math.floor(t/s),o=Array(a=Math.ceil(t-e+1));++i<a;)o[i]=(e+i)*s;else for(e=Math.floor(e*s),t=Math.ceil(t*s),o=Array(a=Math.ceil(e-t+1));++i<a;)o[i]=(e-i)/s;return r&&o.reverse(),o}function DO(e,t,n){let r=Math.sqrt(50),i=Math.sqrt(10),a=Math.sqrt(2),o=(t-e)/Math.max(0,n),s=Math.floor(Math.log(o)/Math.LN10),c=o/10**s;return s>=0?(c>=r?10:c>=i?5:c>=a?2:1)*10**s:-(10**-s)/(c>=r?10:c>=i?5:c>=a?2:1)}var OO=[`None`,`Annotations`,`Studies`,`All`],kO=OO[0];function AO(e){return e?.hiddenItems??kO}function jO(e){let t=AO(e);return t===`Annotations`||t===`All`}function MO(e){let t=AO(e);return t===`Studies`||t===`All`}function NO(e,t){return e.type===C.Study&&MO(t)}function PO(e,t){return e.visible!==!1&&!NO(e,t)}function FO(e,t){return e.visible!==!1&&!jO(t)}var IO={color:B.COLOR_TRANSPARENT},LO={color:B.COLOR_TRANSPARENT,width:0,dashStyle:`Solid`},RO=[G.Open,G.High,G.Low,G.Close],zO=new Set(RO.map(e=>e.id)),BO=e=>zO.has(e.id),VO=e=>e.visible,HO=e=>e.visible&&e.canHitTest,UO=new Eo(0,0,0,0),WO=class{axis;id;uid;record;metaData;timeSeries;notifyAboutPriceDomains=!1;customPlotValues=!1;_priceMapFirstIndex;priceMapper;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=C.Symbol;isShutDown=!1;targetFields=[];detachedScale;yScale=null;levels;bands;annotations;visFromIndex;visToIndex;_eventsData;precision;visible=!0;constructor(){this.axis=null,this.id=bt(),this.uid=this.id,this.record=new Wf(``),this.metaData=new Ga,this.timeSeries=new __,this.priceMapper=this._priceMapper.bind(this),this._priceMapFirstIndex=new Map}get title(){return``}get showPrevious(){return!1}getPreviousValue(){return null}get mainCurve(){return this.curves[0]}get hasEvents(){return!1}findEvents([e,t]){return[]}get eventsSeries(){return null}get hasEventsData(){return this.hasEvents&&P(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(C.Symbol)}get isExpression(){return this.is(C.Expression)}get isStudy(){return this.is(C.Study)}get isForward(){return this.is(C.Forward)}get isSeasonal(){return this.is(C.Seasonal)}get isVisible(){return PO(this,this.presenter?.display)}getValueAt(e,t,n){return null}wrapIfAdvancedStyle(e){let t=e,n=e=>({outFields:e,inputs:{},source:null});return this.mainCurve.isHeikinAshiStyle?t=new ub(n(Ng.slice()),e):this.mainCurve.isElderImpulseSystemStyle?t=new hO(n(Ng.slice().concat(G.BREL)),e):this.mainCurve.isPercentChangeStyle&&(t=new cw(n(Ng.slice()),e)),t}is(e){return this.type===e}getCacheableEntities(e){this.metaData.getCacheableEntities(e.metaData),this.timeSeries.getCacheableEntities(e.timeSeries)}fromModel(e){this.type=C[e.type];let t=e;this.uid=t.uid,this.main=t.main,t.levels&&(this.levels=t.levels),t.bands&&(this.bands=t.bands),P(t.precision)&&(this.precision=t.precision),this.curves=e.curves.map(e=>{let t=new Jy;return t.plot=this,t.fromModel(e),t}),t.detachedScale&&(this.detachedScale=t.detachedScale,this.yScale=new TO(S.Linear,null)),this.visible=t.visible??!0}initialize(){}shutdown(){P(this.timeSeries)&&P(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){let e=this.axis.pane.presenter,t=new Qy(null,e.data.aggregation,w.Normal,[pt(rt(e.data,null,`range`,`from`)),pt(rt(e.data,null,`range`,`to`))]);return t.barsToFetch=e.data.maxDataPoints||B.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=rt(e.display,null,`xAxis`,`visibleRange`),t.useLastTrade=e.data.useLastTrade,t.extendedHours=e.data.extendedHours,t}priceToY(e){return(this.hasDetachedScale?this.yScale:this.axis.yScale).priceToY(e)}get hasDetachedScale(){return P(this.detachedScale,this.yScale)&&this.detachedScale}hasCurveThat(e){return this.curves.some(e)}get hasVisibleCurves(){return this.hasCurveThat(VO)}get hasHitTestableCurves(){return this.hasCurveThat(HO)}getDetachedScaleMargins(){return B.DEFAULT_DETACHED_SCALE_MARGINS}setViewBox(e){if(!this.hasDetachedScale)return;let{y:t,height:n}=e,{top:r,bottom:i}=this.getDetachedScaleMargins();this.yScale.range([Math.floor(t+r*n),Math.floor(t+n-i*n)])}drawLevels(e){e.save();let t=B.OUT_OF_SCREEN;for(let n of this.levels.filter(e=>e.visible)){let r=this.priceToY(n.value);ms(e,hs({line:n.line,fill:IO})),zo(e,{x:-1,y:r},{x:t,y:r})}e.restore()}drawBands(e){e.save();let t=B.OUT_OF_SCREEN;for(let n of this.bands){let r=this.priceToY(n.range.to),i=this.priceToY(n.range.from);ms(e,hs({fill:n.fill,line:LO})),Lo(e,new Eo(-1,r,t,i-r),!1)}e.restore()}drawAnnotations(e){e.save(),this.annotations.forEach(t=>t.draw(e,!0)),e.restore()}getEventFields(){return!this.hasEvents||!this.hasEventsData?[]:this.eventsSeries.container.fields.filter(e=>e!==G.DateTime)}getEventsAt(e){let t=this.eventsSeries.container,n=n=>t.getData(n)[e];return this.getEventFields().map(t=>{let r=n(t);if(!P(r))return null;let i=this.getEventFor(t);if(!P(i))return null;let a={field:t,value:r,date:n(G.DateTime),text:i.title,color:i.color};if(t===G.Custom&&r===B.FAKE_CUSTOM_EVENT){let t=e%2==0;return{...a,value:t?`___news`:`___video`,text:t?`N`:`V`}}else return a}).filter(e=>e!=null)}getRefEventField(e,t,n,r){let i=r?.container,a=e.fields[0];t&&(a=e.isOhlc?G.High:n.isTick?G.Last:G.Close);let o=[a,e.fields[0]].filter(N);return N(i)?o.find(e=>i.hasField(e))??a:a}getRefPlot(e){return this.axis.pane.isMain?e.mainPlot:this}drawEvents(e,t){let n=this.axis.pane.presenter,r=n.view.xAxis.xScale,i=r.domain();if(!P(i)||!P(i[0],i[1]))return;let a=(e,t=G.DateTime)=>e.container.getData(t),o=a(this.eventsSeries),s=this.getRefPlot(n),c=s.timeSeries,l=a(c),u=n.data.aggregation,d=s===n.mainPlot,f=a(c,this.getRefEventField(s.mainCurve,d,u,c));if(!Array.isArray(f))return;let{chart:{fontFamily:p}}=this.axis.pane.presenter.display,m=e=>e.valueOf()>=i[0].valueOf()&&e.valueOf()<=i[1].valueOf(),h=o.flatMap((e,i)=>m(e)?this.getEventsAt(i).map(e=>{let i=eg(u,e.date),a=Te(l,+i,Number);if(a<0||a>=f.length)return null;let o=f[a];if(!Ze(o))return null;t.has(a)||t.set(a,-1);let s=t.get(a);t.set(a,++s);let c=r.timeToX(i),d=n.view.getEventRadius(),p=this.axis.yScale.priceToY(o)-s*(d+d+d);return{visible:!0,...e,x:c,y:p,r:d,rect:UO}}).filter(N):[]);e.save();let g=!0;h.forEach(t=>{t.rect=Ho(e,t,p),this.customEventPopup?.visible&&t.date===this.customEventPopup.date&&(this.showCustomEventPopup(t),g=!1)}),e.restore(),this._eventsData=h,this.customEventPopup?.visible&&g&&this.hideCustomEventPopup()}get customEventPopup(){return this.axis.pane.presenter.view.customEventPopup}hideCustomEventPopup(){this.customEventPopup?.hide()}showCustomEventPopup(e){let{x:t,y:n,r,date:i,value:a}=e;this.customEventPopup?.show({x:t+2*r,y:n-2*r},i,a)}getCustomEventDataAt(e){if(!this.isVisible||!this._eventsData)return null;let t=this._eventsData.find(t=>t.rect.contains(e));return t?.field===G.Custom?t:null}hitTestCustomEvent(e){return this.getCustomEventDataAt(e)!==null}hitTest(e){if(!this.isVisible)return!1;for(let t=0;t<this.curves.length;t++){let n=this.curves[t];if(n.visible&&n.hitTest(e))return!0}return!1}tryHandleCustomEventClick(e){let t=this.getCustomEventDataAt(e);return P(t)?(this.showCustomEventPopup(t),!0):!1}startHoverDim(e){let t=this.presenter?.shouldDimPlot(this)??!1;return t&&(e.save(),e.globalAlpha*=B.PLOT_HOVER_DIM_ALPHA),t}finishHoverDim(e,t){t&&e.restore()}isEmpty(){let e=this.timeSeries;return P(e)&&e.hasData&&e.container.isEmpty}draw(e){if(!this.isVisible)return;let t=this.startHoverDim(e);P(this.levels)&&this.drawLevels(e),P(this.bands)&&this.drawBands(e);for(let t of this.curves)t.draw(e);this.finishHoverDim(e,t)}drawEventsTopmost(e,t){if(!this.isVisible||!this.hasEventsData)return;let n=this.startHoverDim(e);this.drawEvents(e,t),this.finishHoverDim(e,n)}isComparison(e){return this.axis.comparison===e}invalidatePriceMappingCache(){this._firstVisibleDate=null}_priceMapper(e,t,n,r){if(!P(e)||!this.timeSeries.hasData||!this.shouldPriceMap(n,r))return e;let[i,a]=this.axis.pane.presenter.view.xAxis.xScale.domain()||[];if(!P(i)||!Fn(i))return e;if(this._firstVisibleDate!==i){this._firstVisibleDate=i;let e=this.timeSeries.container.getTimeData(),t=t=>Te(e,+t,Number);this.visFromIndex=t(i),this.visToIndex=t(a),this._priceMapFirstIndex.clear()}return this._priceMapFirstIndex.has(n)||this.canPriceMap(t,n),this.priceMap(e,t,n,!1,r)}isOhlcMapping(e){return this.mainCurve.isOhlc&&BO(e)}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===G.PreviousClose?G.Close:e}dataOf(e){return this.timeSeries.container.getData(e)}canPriceMap(e,t){let n=this.getRefPriceMapField(t),r=this.dataOf(n),i=null,a=this.visFromIndex;for(;i===null&&a<=this.visToIndex;)i=r[a++];this._priceMapFirstIndex.set(n,i===null?NaN:a-1)}priceMap(e,t,n,r=!1,i=x.None){let a=this.getRefPriceMapField(n),o=this._priceMapFirstIndex.get(a);if(!Number.isFinite(o))return e;let s=this.dataOf(a)[o];return this.isComparison(x.Percent)||i===x.Percent?r?s+s*e/100:(e>=s?1:-1)*(Math.abs(e-s)*100)/Math.abs(s):r?s+e:e-s}shouldPriceMap(e,t){return P(t)?t!==x.None:this.isComparison(x.Percent)||this.isComparison(x.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}},GO=class extends WO{_symbol;_showPrevious;yearOffset;resolved=null;events;inputs=[];_eventsSeries;compare;tracePlot(e,t={}){Ih(e,{chartId:this.axis?.pane?.presenter?.elementId,symbol:this.symbol,...t})}get symbol(){return this._symbol}get title(){return this.symbol}get showPrevious(){return this._showPrevious}getPreviousValue(){if(!P(this.timeSeries)||!P(this.timeSeries.record))return null;let e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(G[e])}getTimeSeries(){let e=$().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.symbol,this.mainCurve.style){case h.Renko:case h.Kagi:case h.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case h.Range:t.barsToFetch=4e3;break;case h.LineBreak:t.inputs=this.inputs;break}let n=this.axis.pane;if(P(n.alignedToYear)){let e=Ki(this.resolved??t.symbol);e!==null&&(this.yearOffset=n.alignedToYear-e.getFullYear(),t.offset=this.yearOffset)}let r=e.getTimeSeries(t);this.timeSeries=this.wrapIfAdvancedStyle(r),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:re.Unspecified};this.presenter?.notifyHost(K.TS_MANYCHANGED,e),this.getEvents()}})}getMetaData(){let e=$().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(K.MD_CHANGED,{plot:this})})}getEvents(){if(!this.hasEvents)return;let e=$().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:w.Events,getHashKey:function(){return Object.values(this).filter(e=>typeof e!=`function`).join(`|`)}};B.EVENTS.forEach(e=>{t[e]=rt(this.events,!1,e,`show`)}),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then(e=>{e&&this.presenter?.notifyHost(K.TS_EVENTSCHANGED,{series:this.eventsSeries})})}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return P(this.events)?B.EVENTS.some(e=>rt(this.events,!1,e,`show`)):!1}findEvents(e){if(!this.hasEventsData||e[0]===null||e[1]===null)return[];let t=e[0],n=e[1];if(n>0&&this.axis?.pane?.presenter?.data?.aggregation?.isIntraday){let e=this.timeSeries.container.getTimeData()[n-1];if(this.compare(e,t))return[]}return this.eventsSeries.container.getTimeData().map((e,n)=>this.compare(e,t)?this.getEventsAt(n):[]).flat()}fromModel(e){super.fromModel(e);let t=e;this._showPrevious=t.showPrevious,this.events=t.events,this.inputs=t.inputs||[],this.compare=Mu(this.axis.pane.presenter.data.aggregation),this._symbol=t.symbol}getEventFor(e){let t=this.events[e.id.toLowerCase()];return!P(t)||!t.show?null:t}async initialize(){return da.call(this,async()=>(this.tracePlot(`plot:init:start`),this.resolved=await wi(this.symbol),this.isShutDown?(this.tracePlot(`plot:init:aborted`,{resolved:this.resolved}),!1):(this.getMetaData(),this.getTimeSeries(),this.tracePlot(`plot:init:ready`,{resolved:this.resolved}),!0)))}},KO=class extends GO{seriesKind;fundamental;constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${g[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=g[e.fundamental],super.fromModel(e)}makeQuery(){let e=new Qy(this.symbol,new Ru(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}},qO=class{longPressTimeout;constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){let e=$().config.touchCrosshairDelayMillis;return P(e)&&Number.isFinite(e)?e:B.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,n){Ie()&&(this.longPressTimeout=setTimeout(()=>this.longPressTriggered(e,t,n),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,n){this.cancelLongPress(),this.performLongPress(e,t,n)}cancelLongPress(){Ie()&&P(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,n){}};function JO(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}var YO=class extends qO{annotation;previous;onLongPress;cursorSet;moved;snapToSupported;constructor(e,t,n,r){super(),this.annotation=e,this.previous=t,this.onLongPress=r,this.cursorSet=!1,this.moved=!1,this.snapToSupported=!1,this.startLongPress(null,t,n)}performLongPress(e,t,n){this.onLongPress?this.onLongPress():qk(this.annotation,n)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),JO(this.annotation))return;let{point:t,view:n,offset:r}=e;if(!t||t.axis.pane!==this.annotation.axis.pane)return;let i=this.annotation.axis.toAnnotationPoint(r);if(!N(i)||i.axis!==this.annotation.axis)return;n.drawCrosshair({ap:i,offset:r}),this.cursorSet||=(this.previous.axis.pane.presenter.view.setCursor(ee.Move),!0);let a=ao(i.point,this.previous.point);this.annotation.offset(a),this.annotation.wasModifiedByTool(),this.annotation.requestRedraw(),this.previous=i,this.moved=!0}onMouseUp(e){this.cancelLongPress(),vj(this.annotation,this.moved,O.Moved)}},XO=class{annotation;pointIndex;snapToSupported=!0;moved=!1;alignPointsMode=!1;constructor(e,t){this.annotation=e,this.pointIndex=e.points.indexOf(t)}onMouseMove(e){if(this.alignPointsMode=e.getModifier(D.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),JO(this.annotation))return;let{point:t,view:n,offset:r}=e;if(!t||t.axis.pane!==this.annotation.axis.pane)return;let i=this.annotation.axis.toAnnotationPoint(r);if(n.drawCrosshair({ap:i,offset:r}),P(i)){let e=this.annotation.points[this.pointIndex],t=ao(i.point,e.point);switch(e.moveDirection){case te.Both:e.update(i.price,i.time);break;case te.Horizontal:e.update(e.price,i.time);break;case te.Vertical:e.update(i.price,e.time);break;default:break}this.moved=e.moveDirection!==te.None,this.moved&&this.annotation.wasPointMovedByTool(e,t)}this.annotation.requestRedraw()}onMouseUp(e){vj(this.annotation,this.moved,O.PointMoved)}},ZO=class{anchor;isVertical;axis;constructor(e,t,n){this.anchor=e,this.isVertical=t,this.axis=n}hitTest(e){return P(this.anchor)?this.isVertical?Math.abs(e.x-this.anchor.x)<=B.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=B.HIT_TEST_TOLERANCE:!1}draw(e){let t=B.OUT_OF_SCREEN;this.isVertical?Bo(e,this.anchor.x,-t,t):Vo(e,this.anchor.y,-t,t)}},QO=class{id;axis;_price;_time;passive=!1;moveDirection=te.Both;visible=!0;point;constructor(e,t,n){this.id=bt(),this.axis=e,t!==void 0&&n!==void 0&&(this.price=t,this.time=n,this.toPoint())}get price(){return this._price}set price(e){this._price=e}get time(){return this._time}set time(e){this._time=e}get movable(){return this.moveDirection!==te.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){let e=this.axis.toPoint(this);P(e)&&Ze(e.x)&&Ze(e.y)&&(this.point=e)}update(e,t){this.price=e,this.time=typeof t==`number`?new Date(t):t,this.toPoint()}updateFromPoint(e){let t=this.axis.toAnnotationPoint(e);this.price=t.price,this.time=t.time,this.point=e}hitTest(e){return this.visible?this.distance(e)<=B.HIT_TEST_TOLERANCE:!1}distance(e){let t=e.x-this.point.x,n=e.y-this.point.y;return Math.abs(Math.sqrt(t*t+n*n)-B.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(P(this.point)){let n=B.HALF_ANN_POINT_DIMENSION;P(t)&&t.locked&&(n*=.6),e.beginPath(),e.ellipse(this.point.x,this.point.y,n,n,0,0,2*Math.PI),e.stroke()}}};function $O(e){return vo(e.fill.color).a===0?e.line.color:e.fill.color}function ek(e,t){return{owner:e.axis.annotationUndoOwner,position:e.axis.findIndex(e),uid:e.uid,id:e.name,traits:{...e.extractTraits(!0),...e.extractTraits(!1)},extras:{},points:e.extractPoints(),visible:e.visible,locked:e.locked,isUndoRedo:!0,toolChange:t}}function tk(e){return{uid:e.uid,id:e.name,traits:e.extractTraits(!0),extras:e.extractTraits(!1),points:e.extractPoints(),visible:e.visible,locked:e.locked,chart:e.axis.pane.presenter.accessor}}var nk=class{points=[];isSelected=!1;drawn=!0;axis;name;uid;alignPointsSupported=!1;visible=!0;locked=!1;computed=!1;_traits;adjustFill;constructor(e,t){this.axis=e,this.name=t,this.uid=bt()}requestRedraw(){this.axis.pane.presenter.view?.redraw()}prepareDraw(e,t){let n=!this.isSelected||!this.axis.pane.presenter.annotationManipulation;return this.drawPoints(e,t,n),this.readyToDraw()}readyToDraw(){return this.activePoints.every(e=>e.point!==void 0)}getPriceScaleAdornments(){return B.EMPTY_ARRAY}getTimeScaleAdornments(){return B.EMPTY_ARRAY}extractTraits(e=!0){let t=F(this.traits),n=Vs(this.name);return Object.keys(t).forEach(r=>{let i=n.includes(r);(e&&!i||!e&&i)&&delete t[r]}),e||[`line`,`fill`,`zIndex`].forEach(e=>delete t[e]),t}extractPoints(){return this.activePoints.map(e=>({price:e.price,time:Xe(+e.time,4)}))}offset(e){this.points.filter(e=>e.movable).forEach(t=>{t.updateFromPoint(oo(t.point,e))})}get traits(){return this._traits||=F(this.defaultTraits),this.adjustFill&&=(this._traits.fill.color=$O(this._traits),!1),this._traits}set traits(e){e!==void 0&&ht(this.traits,e)}get activePoints(){return this.points.filter(e=>!e.passive)}get style(){return hs(this.traits)}get defaultTraits(){return ps(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return hs(this.defaultTraits)}get isVisible(){return FO(this,this.axis.pane.presenter.display)}get adornStyle(){let e=F(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=B.COLOR_TRANSPARENT,hs(e)}get pointsStyle(){let e=F(this.defaultTraits);return e.line.dashStyle=`Solid`,hs(e)}get allowPricesChangeUI(){return this.traits?.allowPricesChangeUI}wasModifiedByTool(){}wasPointMovedByTool(e,t){}onFormatterChanged(){}isPointDrawn(e){return e.price!==void 0}drawPoints(e,t,n=!0){this.isVisible&&this.points.forEach(r=>{let i=this.isPointDrawn(r),a=P(e);t&&(i||!a)&&r.toPoint(),n&&a&&i&&(this.isSelected||this.drawn)&&(ms(e,this.pointsStyle),r.draw(e,this))})}addPoints(e){for(let t=0;t<e;t++)this.points.push(new QO(this.axis))}toModel(){let e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:F(this.traits)}}canMove(e){return!0}updatePoints(e){}updateActivePoints(e){let t=this.activePoints;t.length===e.length&&t.forEach((t,n)=>{let r=e[n];t.update(r.price,r.time)})}updateFrom(e,t,n,r,i){typeof r==`boolean`&&(this.visible=r),typeof i==`boolean`&&(this.locked=i);let a=P(e)?F(e):{};P(t)&&ht(a,t),this.traits=a,P(n)&&this.updatePoints(n)}priceMap(e){return this.axis.priceMap(e)}flip(e){let t=this.getFlipAnchorIndices();if(!N(t))return;let n=this.points[t[0]],r=this.points[t[1]];if(e){let e=r.time;r.update(r.price,n.time),n.update(n.price,e)}else{let e=r.price;r.update(n.price,r.time),n.update(e,n.time)}this.wasModifiedByTool()}getFlipAnchorIndices(){return null}};function rk(e,t,n,r){return function(i,a=!0){let o=new t(i,e,n);return a?i.appendAnnotation(o):o.drawn=!1,P(r)&&(o.traits=r),o}}var ik=class{axis;angle;extent;anchor1;anchor2;p1;p2;style;extended;_data;isTrend;constructor(e,t,n,r,i){this.axis=i,P(e,t)&&(this.angle=so(e,t),this.extent=this.getExtent(e,t),this.anchor1=e,this.anchor2=t,this.p1=n?this.extendPoint(t,-1):e,this.p2=r?this.extendPoint(e,1):t),this.extended=n||r}extendPoint(e,t){return{x:e.x+t*this.extent*Math.cos(this.angle),y:e.y+t*this.extent*Math.sin(this.angle)}}getExtent(e,t){let n=Math.max(Math.abs(e.x),Math.abs(t.x)),r=Math.max(Math.abs(e.y),Math.abs(t.y));return Math.sqrt(n*n+r*r)+B.OUT_OF_SCREEN}hitTest(e){return P(this.p1,this.p2)?co([this.p1,this.p2],e,B.HIT_TEST_TOLERANCE):!1}draw(e){P(this.p1,this.p2)&&(zo(e,this.p1,this.p2),this.extended)}getAdornOffset(e){let t=No(e),n=jo(e,1);return ro(this.p1,this.p2)<0&&(t.y=n+5),t}},ak=class{style;axis;rect;constructor(e,t,n,r){this.axis=r,this.rect=new Eo(e.x,e.y,t,n)}hitTest(e){return this.rect.contains(e)}draw(e,t){Lo(e,this.rect)}},ok=class extends nk{countCache;constructor(e,t){super(e,t)}draw(e,t){if(!(!this.isVisible||!this.prepareDraw(e,t))&&!this.getScreenPoints().some(e=>!P(e))&&!this.drawn){let t=this.getElements();ms(e,this.style),t.forEach((t,n)=>{ms(e,this.getStyleForElement(t,n)),t.draw(e)}),ms(e,this.adornStyle),this.adornElements(t,e);let n=this.getMarkers();ms(e,this.style),n.forEach(t=>{t.draw(e)})}}getBarCount(e,t){if(this.countCache===void 0||this.countCache.time1!==e||this.countCache.time2!==t){let n=this.axis.pane.presenter.view,r=Math.abs(n.toIndex(e)-n.toIndex(t));this.countCache={time1:e,time2:t,barCount:r}}return this.countCache.barCount}getElements(){return[]}get presenter(){return this.axis.pane.presenter}get formatter(){return this.presenter.mainPlot.metaData}data(e){return this.presenter.mainPlot.timeSeries.container.getData(e)}getScreenPoints(){return this.points.map(e=>e.point)}getStyleForElement(e,t){return this.style}adornElements(e,t){}hitTestAdornments(e,t){return!1}getTextRef(){return null}hitTest(e){if(!this.drawn&&this.isVisible){if(this.getScreenPoints().some(e=>!P(e)))return!1;let t=this.getElements(),n=this.getMarkers();return t.some(t=>t.hitTest(e))||n.some(t=>t.hitTest(e))?!0:this.hitTestAdornments(t,e)}return!1}updatePointsFrom(e,t=0){e.forEach((e,n)=>this.points[t+n].update(e.price,e.time))}updatePoints(e){this.allowPricesChangeUI&&this.updatePointsFrom(e)}getMarkers(){return[]}get marker(){return this.traits?.marker}get showPrices(){return this.traits?.showPrices}get singleStyle(){return tt(this.traits?.singleStyle,!0)}get showBackground(){return tt(this.traits?.showBackground,!1)}get backgroundOpacity(){return tt(this.traits?.backgroundOpacity,0)}fillOnlyStyle(e){return hs({line:{color:B.COLOR_TRANSPARENT,dashStyle:`Solid`,width:0},fill:this.traits[e]})}lineOnlyStyle(e){return hs({fill:{color:B.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new ik(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return fo(uo(e),this.backgroundOpacity)}getTraitsFor(e){let t={fill:{color:B.COLOR_TRANSPARENT},line:{...e.line}};return this.showBackground&&(t.fill.color=this.applyBackgroundOpacity(t.line.color)),t}getFlipAnchorIndices(){return this.points.length===2?[0,1]:null}},sk=class extends ok{_factors;constructor(e,t){super(e,t)}get factorsPropName(){return B.AT_FACTORS}get factors(){return cs(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[B.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[B.AT_LEVELS_KIND]}get labels(){return this.traits[B.AT_LABELS]}get isExtended(){return this.points.length===3}isBefore(e,t){return this.points[e].time<this.points[t].time}comparePoints(e,t,n){let r=this.isBefore(e,t);return n||(r=!r),this.points[r?e:t].point}getPoint(e){return this.isExtended?this.comparePoints(1,2,e):this.comparePoints(0,1,e)}get leftPoint(){return this.getPoint(!0)}get rightPoint(){return this.getPoint(!1)}get pricesOnScale(){return this.traits[B.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){let n=this.levelsKind===B.AT_LEVELS_PERCENTS,r=``;if(this.showLevels&&(r=n?`${(e*100).toFixed(1)}%`:e.toString()),this.showPrices){let e=this.priceMap(this.axis.toPrice(t));r=(r+` (${rv(this.axis,e)})`).trim()}return r}getAdornPointAndAlign(e,t){let n=this.labels,r=e instanceof ik,i=(e,t,n)=>({pt:e,align:t,offset:n});switch(n){case B.AT_LABELS_LEFT:return i(r?e.anchor1:e,T.Right,-t);default:case B.AT_LABELS_RIGHT:return i(r?e.anchor2:e,T.Left,t);case B.AT_LABELS_CENTER:return i(r?no(e.anchor1,e.anchor2):e,T.Center,0)}}getColoredElements(e){let t=this.singleStyle;return this.factors.map(n=>{let r=e(n);return r===null?null:(t||(r.style=hs(this.getTraitsFor(n))),r._data={factor:n.value},r)}).filter(e=>e!==null)}hitTestAdornments(e,t){let n=this.showLevels,r=this.getTextRef();if(!n||r===null)return!1;let i=this.axis.pane.presenter,a=i.view?.mainContext;if(!a)return!1;let o=null,s=!1;a.save();let{chart:{fontFamily:c},yAxis:{fontSize:l}}=i.display;a.font=`${l??12}px ${c}`;for(let n of e){if(!P(n._data))continue;let{factor:e}=n._data,{ref:i,spacing:c,offsetY:l,text:u}=r(o,n,e),{pt:d,align:f,offset:p}=this.getAdornPointAndAlign(i,c);if(Po(a,u,this.getAdornTextPoint(a,l,d,p),f).contains(t)){s=!0;break}o=n}return a.restore(),s}adornElementsForColoredFactors(e,t,n,r){let i=this.singleStyle,a=this.showBackground,o=this.showLevels,s=this.applyBackgroundOpacity(this.traits.line.color),c=r.fillStyle,l=null;e.forEach(e=>{if(!P(e._data))return;let{factor:u}=e._data;if(a){let n=t(l,e);r.fillStyle=i?s:e.style.fillStyle,r.fill(n)}if(o){let{ref:t,spacing:a,offsetY:o,text:s}=n(l,e,u),{pt:d,align:f,offset:p}=this.getAdornPointAndAlign(t,a);Fo(r,s,this.getAdornTextPoint(r,o,d,p),f,i?c:e.style.strokeStyle)}l=e})}getAdornTextPoint(e,t,n,r){let i=jo(e,.75);return oo(n,{x:r,y:t===!0?i/2:t})}},ck=class extends ok{lines;constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(B.AT_FILL)}get rect(){let[e,t,,]=this.getScreenPoints(),n=new ak({x:e.x,y:Math.min(e.y,t.y)},t.x-e.x,Math.abs(e.y-t.y),this.axis);return n.style=this.rectStyle,n}get reverse(){return!1}getLinesDataAtLevels(e,t){let[n,r]=this.points;if(this.reverse&&([n,r]=[r,n]),this.lines==null){let i=(e,t=!1)=>n=>({level:n.value,domain:e(n.value),traits:this.getTraitsFor(n),isPrice:t}),a=r.price-n.price,o=i(e=>n.price+e*a,!0),s=e?.map(o)??[],c=this.axis.pane.presenter.timeline,l=Te(c,+n.time,Number,dv),u=Te(c,+r.time,Number,dv)-l,d=i(e=>+c.at(l+Math.floor(e*u))),f=t?.map(d)||[];this.lines={prices:s,times:f,barsDiff:u,priceDiff:a}}return this.lines}makeColoredLine(e,t,n){let r=this.makeLine(e,t);return this.singleStyle||(r.style=hs(n.traits)),r._data={level:n.level,isPrice:n.isPrice},r}getLineElements(e){let[t,n]=this.getScreenPoints();return{priceLines:e.prices.map(e=>{let r=this.axis.toY(e.domain);return this.makeColoredLine({x:t.x,y:r},{x:n.x,y:r},e)}),timeLines:e.times.map(e=>{let r=this.presenter.view.toX(e.domain);return this.makeColoredLine({x:r,y:t.y},{x:r,y:n.y},e)})}}getStyleForElement(e,t){return e.style||super.getStyleForElement(e,t)}resetComputedState(){}wasModifiedByTool(){this.resetComputedState()}wasPointMovedByTool(e,t){this.wasModifiedByTool()}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}},lk=class extends QO{priceRef;timeRef;constructor(e,t,n){super(e),this.priceRef=t,this.timeRef=n,this.passive=!0}get price(){return this.priceRef.price}get time(){return this.timeRef.time}set price(e){this.priceRef.price=e}set time(e){this.timeRef.time=e}},uk=class{points;constructor(e){this.points=e}get left(){return Math.min(this.points[0].point.x,this.points[1].point.x)}get top(){return Math.min(this.points[0].point.y,this.points[1].point.y)}get width(){return Math.abs(this.points[1].point.x-this.points[0].point.x)}get height(){return Math.abs(this.points[1].point.y-this.points[0].point.y)}getRect(){return P(this.points[0].point,this.points[1].point)?new Eo(this.left,this.top,this.width,this.height):null}};function dk(e){let t=new QO(e),n=new QO(e);return[t,n,new lk(e,t,n),new lk(e,n,t)]}var fk=class extends nk{helper;constructor(e,t){super(e,t),this.points=dk(e),this.helper=new uk(this.points)}get left(){return this.helper.left}get top(){return this.helper.top}get width(){return this.helper.width}get height(){return this.helper.height}getRect(){return this.helper.getRect()}draw(e,t){return!this.isVisible||!this.prepareDraw(e,t)?!1:(ms(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&e.length===2&&e.forEach((e,t)=>this.points[t].update(e.price,e.time))}},pk=class{points;lines;axis;helper;_actualWidth=0;_fontSizeForWidth=0;constructor(e,t,n){this.points=e,this.lines=t,this.axis=n,this.helper=new uk(this.points)}hitTest(e){let t=this.getRect();return N(t)?(t.width=this._actualWidth,t.contains(e)):!1}getRect(){return this.helper.getRect()}get fontSize(){if(this.lines.length===0)return 0;let{height:e}=this.getRect();return Math.floor(e/this.lines.length)}computeActualWidth(e){(this._actualWidth<=0||this._fontSizeForWidth!==this.fontSize)&&(this._actualWidth=Math.max(...this.lines.map(t=>e.measureText(t).width)),this._fontSizeForWidth=this.fontSize)}draw(e){if(this.lines.length===0)return;e.save();let{x:t,y:n}=this.getRect(),{chart:{fontFamily:r}}=this.axis.pane.presenter.display,i=this.fontSize;e.textAlign=`left`,e.textBaseline=`top`,e.font=`${i}px ${r}`,this.lines.forEach((r,a)=>{let o=n+i*a;e.fillText(r,t,o)}),this.computeActualWidth(e),e.restore()}},mk=class extends ok{textEditable;_textAnnElement;constructor(e,t){super(e,t),this.textEditable=!0,this.points=dk(e),this.adjustFill=!0}get textLines(){return this.traits[B.AT_TEXT_LINES]}set textLines(e){this.traits[B.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!P(this._textAnnElement)&&this.isVisible&&(this._textAnnElement=new pk(this.points,this.textLines,this.axis)),this._textAnnElement}updateFrom(e,t,n,r,i){super.updateFrom(e,t,n,r,i),this._textAnnElement=void 0}getElements(){return this.isVisible?[this.textElement]:[]}},hk=class extends mk{constructor(e,t){super(e,t),this.textEditable=!1}canMove(e){return this.isVisible?this.textElement.hitTest(e):!1}get prices(){return this.traits.prices}get pricesPoints(){let e=this.points[0].time;return this.prices.map(t=>new QO(this.axis,t,e))}updateFrom(e,t,n,r,i){super.updateFrom(e,t,n,r,i),P(e?.textLines)&&(this.textLines=e.textLines)}getElements(){let e=super.getElements(),t=this.pricesPoints.map(e=>new ZO(e.point,!1,this.axis));return e.concat(t)}getPriceScaleAdornments(){if(!this.showPrices)return super.getPriceScaleAdornments();let e=this.traits.line;return this.prices.map(t=>({price:t,color:e.color}))}get defaultFont(){let{chart:{fontSize:e,fontFamily:t}}=this.axis.pane.presenter.display;return[e??13,t]}updateOtherPoints(e){let[t,n]=this.defaultFont;e.save(),e.font=`${t}px ${n}`;let r=Math.max(...this.textLines.map(t=>e.measureText(t).width)),{x:i,y:a}=this.points[0].point;this.points[1].updateFromPoint({x:i+r,y:a+this.textLines.length*t}),e.restore()}},gk=class{annId;annotation;constructor(e){this.annId=e}onKeyDown(e){if(this.annId==null)return;let{key:t,code:n,presenter:r}=e;Re(t,n)&&(P(this.annotation)&&(this.annotation.axis.deleteAnnotation(this.annotation,!1),r.view.redraw()),_j(r,{toolChange:O.Cancelled,annId:this.annId}))}},_k=class extends gk{factory;thirdPoint;dragged=!1;snapToSupported=!0;isDrawingAnnotation=!0;forceAlignPoints=!1;indices;alignPointsMode=!1;constructor(e,t=!1){super(e.annName),this.factory=e,this.thirdPoint=t,this.indices=t?[0,1,2]:[0,1]}signalChange(){this.annotation.wasModifiedByTool(),this.annotation.requestRedraw()}onMouseDown(e){let{point:t,button:n}=e;if(t===void 0)return;let r=N(this.annotation);if(n===E.Left)if(r){let e=!this.thirdPoint||this.dragged?1:2;this.annotation.points[e].update(t.price,t.time),this.dragged=!1,this.signalChange(),(!this.thirdPoint||e===2)&&this.finish()}else this.dragged=!0,t.axis.pane.presenter.clearSelection(),this.annotation=this.factory(t.axis),this.annotation.drawn=!1,this.indices.forEach(e=>this.annotation.points[e].update(t.price,t.time)),this.signalChange();return!0}onMouseMove(e){let{point:t,view:n,offset:r}=e;return n.drawCrosshair({ap:t,offset:r}),P(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(D.Shift),this.dragged?(this.annotation.points[1].update(t.price,t.time),this.signalChange()):this.thirdPoint&&!this.dragged&&(this.annotation.points[2].update(t.price,t.time),this.signalChange())),!0}finish(){vj(this.annotation,!0,O.Created)}isAccidentalMouseUp(e){let{point:t}=e,n=this.annotation.points[0].point;return!t?.point||!n?!1:io(t.point,n)<B.HIT_TEST_TOLERANCE}onMouseUp(e){if(this.annotation===void 0){bj(e);return}if(this.isAccidentalMouseUp(e)){this.dragged=!0;return}this.dragged=!1,this.thirdPoint||this.finish()}},vk=class extends _k{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}},yk=class extends _k{constructor(e){super(e,!1),this.snapToSupported=!1}onMouseMove(e){let{point:t,view:n,offset:r}=e;if(n.drawCrosshair({ap:t,offset:r}),P(this.annotation)&&this.dragged){let[e,n]=this.annotation.points;n.update(t.price,t.time);let r=ao(n.point,e.point),i=e.point.y+r.x*Math.sign(r.y)*Math.sign(r.x),a=this.annotation.axis.toPrice(i);n.update(a,t.time),this.signalChange()}return!0}},bk=class extends gk{factory;existing;isNew;anchor;clicks=0;snapToSupported=!1;isDrawingAnnotation;textArea;constructor(e,t){super(e?e.annName:null),this.factory=e,this.existing=t,this.isNew=!P(t),this.isNew||(this.anchor=this.existing.points[0]),this.isDrawingAnnotation=this.isNew}getChartParent(){return this.anchor.axis.pane.presenter.view.canvasContainer}styleProps(){if(this.isNew)return{height:100,fontSize:`100%`,color:$O(ps(this.anchor.axis.pane.presenter.display,`Text`))};{let e=this.existing.textElement;return{height:e.getRect().height*1.05,fontSize:`${Math.round(e.fontSize)}px`,color:this.existing.traits[B.AT_FILL].color}}}onMouseDown(e){let{point:t}=e;if(this.isNew)if(this.clicks===0){if(t===void 0){bj(e);return}t.axis.pane.presenter.clearSelection(),this.anchor=t,this.clicks++,this.startEditing()}else this.onEndEditing();else this.onEndEditing()}startEditing(){this.textArea=document.createElement(`textarea`);let{x:e,y:t}=this.anchor.point,n=this.anchor.axis.pane.getBounds(),r=n.x+n.width-this.anchor.point.x,{height:i,fontSize:a,color:o}=this.styleProps();ra(this.textArea,{position:`absolute`,top:`${t}px`,left:`${e}px`,border:`none`,outline:`none`,overflow:`hidden`,height:`${i}px`,width:`${r}px`,resize:`none`,backgroundColor:`rgba(255, 255, 255, 0.05)`,zIndex:`5`,fontSize:a,color:o}),this.getChartParent().appendChild(this.textArea),this.textArea.onblur=this.onEndEditing.bind(this),this.textArea.onkeydown=e=>e.stopImmediatePropagation(),this.isNew||(this.textArea.value=this.existing.textLines.join(`
|
|
37
|
+
`}function Av(e,t,n){let r=typeof n==`string`?at(n):null,i=r===null?``:` style="color: ${r}"`,a=P(e)?it(e):null;return`${a===null?``:`<span class="field-name">${a}</span>`}<span${i} class="field-value">${it(t)}</span>`}function jv(e){return`<a class="delete-plot" data-plot-uid="${at(e)}" title="Delete plot">${xv(`delete`)}</a>`}function Mv(e,t){let n=e>0,r=e<t-1;return[`${n?wv(!0,e):``}`,`${r?wv(!1,e):``}`].join(` `).trim()}function Nv(e,t){return e.startsWith(B.FAKE_SYMBOL_PREFIX)&&t.length>0?t:e}function Pv(e){if(!e.isStudy)return null;let t=e;return t.getStandalonePaneBasisTitle()?t.getStandalonePaneTitle():null}function Fv(e,t,n,r,i,a){let o=Iv(e,t);o.offset=n,o.lastBarRefresh=!!r||!1,o.chartId=e.elementId;let s=n=>n.axes.map(e=>e.plots).flat().filter(t=>i?t===e.mainPlot:!0).map(n=>Bv(e,t,a,o,n)).filter(e=>e!==null);return o.panes=e.panes.map(e=>({bounds:Lv(e),id:e.id,plots:s(e)})),o}function Iv(e,t){let n=e.data.aggregation,r=e.display.xAxis,i=r.isOrdinal,a=N(i)&&i,o=a?r.ordinalName??`Value`:`Date`;return{date:a?ev(t):lv(n,t),time:n.isEndOfDay||a?null:uv(n,t,!1),isMultiSymbol:Vv(e),isMultiContract:n.isMultiContract,dateFieldName:o}}function Lv(e){let t=e.getBounds();if(!P(t))return;let{x:n,y:r,width:i,height:a}=t,{leftOffset:o,rightOffset:s}=e.presenter.view;return{top:r,left:n+o,right:s,bottom:r+a,width:i,height:a}}function Rv(e,t,n,r=!1){let i=e.plot,a=i.timeSeries.container,o=i.axis.pane.presenter.timeline,s=Te(o,+n,Number,dv),c=o.at(s-e.shift);if(c===null)return[null,0];let l=a.getTimeData(),u=Te(l,+c,Number);return[!l[u]||l[u].getTime()!==c.getTime()?null:e.dataAt(t,u,!r),u]}function zv(e,t,n){P(e.precision)?n.overridePrecision=e.precision:e.isStudy&&P(t.mainPlot?.precision)&&!P(ac(e.model.study).meta.decimals)&&(n.overridePrecision=t.mainPlot.precision)}function Bv(e,t,n,{isMultiContract:r},i){let a=i.isStudy;if(!i.timeSeries.hasData)return null;let o=i.timeSeries.container;i.type,C.Expression;let s=i.axis.comparison!==x.None,c=i.axis.comparison===x.Percent,l=(e,r)=>i.customPlotValues&&r!==G.DateTime?[i.getValueAt(r,t,n),0]:Rv(e,r,t,s),u=i,d=Pv(i)??i.title,f=a?`${ac(u.model.study).meta.title} ${u.fullParams}`:i.metaData.name||``,p={isMain:i.main,type:i.type,typeName:C[i.type],name:Nv(d,i.metaData.symbol),description:f,exchange:i.metaData.exchange||``,error:u.errorText,id:i.id,uid:i.uid,visible:i.visible,isHidden:!i.isVisible,seasonalOffset:i.isSeasonal?u.offset??void 0:void 0};if(P(u.yearOffset)&&u.yearOffset!=0){let n=e.data.aggregation;p.unalignedDate=lv(n,_i(t,u.yearOffset))}let m=i.curves[0],g=i.type===C.Symbol&&Vi(i.title);if(r&&i.type===C.Symbol&&o.hasField(G.Symbol)){let e=t.valueOf()===B.ZERO_DATE.valueOf()?i.timeSeries.container?.getLastDataPoint(G.Symbol):l(m,G.Symbol)[0];P(e)&&e.length>0&&(p.actualSymbol=e,g||(p.name=e))}let _={},v={range:i.axis.yScale.domain(),allDigits:!0};zv(i,e,v);let y=(e,t)=>{let n=(t===G.Change||t===G.PercentChange)&&e>0?`+`:``;return c?n+tv(e):n+i.metaData.format(e,t,v)},b=mv(e),S=new Set;return p.values=i.curves.filter(e=>e.visible).map(e=>(!i.main&&i.isSymbol&&b?Ng:e.fields).map(t=>{if(S.has(t))return null;S.add(t);let[n,r]=l(e,t),o=i.axis.yScale.priceToY(n);_[t.id]=!0;let s=i.customPlotValues?u.getColorOf(t):e.getColor(r,e.style!==h.HollowCandles,t),c=y(n,t).trim();if(P(n)&&t===G.Change){let[t]=l(e,G.PercentChange);P(t)&&(c+=` (${y(t,G.PercentChange)})`)}return{abbreviation:Hv(t),shortName:t.shortName,id:t.id,name:t.name,longName:`${t.shortName} ${a?u.params:``}`.trim(),color:uo(s),val:n,y:o,value:c}}).filter(e=>e!==null)).flat(),p.events=i.findEvents(l(m,G.DateTime)).filter(e=>e.field!==G.Custom),p}function Vv(e){let t=e.mainPlot.symbol;return e.allPlots.some(e=>e.type===C.Symbol&&e.symbol!==t)}function Hv(e){return e.id===G.Change.id?`Δ`:e.id.substring(0,1)}function Uv(e,t,n){let r=P(t),i=P(n),a,o,s=e.pane.getBounds();if(!r)a=e.priceToY(n),o=new Eo(s.x,a,s.width,s.y+s.height-a);else if(!i)a=e.priceToY(t),o=new Eo(s.x,s.y,s.width,a-s.y);else{let r=e.priceToY(t),i=e.priceToY(n);a=(r+i)/2,o=new Eo(s.x,i,s.width,r-i)}return[a,o]}var Wv=(e,t)=>{let n=go(.6)(e),r=_o(.6)(e),i=t===`linLighten`;return[i?r:n,e,i?n:r]};function Gv(e,t,n,r,i=!1,a){let o;e.zones.forEach((s,c)=>{let l=s.value,[u,d]=Uv(e,o,l);t.save(),To(t,d),i&&(n.range=[null,u]);let f=e.zoneColors[c];if(s.gradient){let e=Wv(f,s.gradient),n=t.createLinearGradient(0,d.y,0,d.y+d.height);n.addColorStop(0,e[0]),n.addColorStop(.5,e[1]),n.addColorStop(1,e[2]),f=n}else P(a)&&(f=a(c,f));r(e,t,n,f),t.restore(),o=l})}function Kv(e,t,{bar:n,slice:r},i){let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,o=a+(r[1]-r[0])*n.totalWidth,s=i+n.totalWidth/2;return t.x<a-s||t.x>o+s}function qv(e,t,n,r=1){let i=e.view.xAxis.xScale.xToIndex(t.x)??n.slice[0];return{from:Math.max(n.slice[0]-1,i-r),to:Math.min(n.slice[1]+1,i+r)}}function Jv(e,t,n,r,i,a){let o=Math.min(t,t+r)-a,s=Math.max(t,t+r)+a,c=Math.min(n,n+i)-a,l=Math.max(n,n+i)+a;return e.x>=o&&e.x<=s&&e.y>=c&&e.y<=l}function Yv(e,t,n,r,i,a){let o=r-t,s=i-n,c=e.x-t,l=e.y-n;if(o===0&&s===0)return Math.abs(c)<=a&&Math.abs(l)<=a;let u=o*o+s*s,d=(c*o+l*s)/u,f=Math.max(0,Math.min(1,d)),p=t+f*o,m=n+f*s,h=e.x-p,g=e.y-m;return h*h+g*g<=a*a}function Xv(e,t,n,r){return e.x>=Math.min(t.x,n.x)-r&&e.x<=Math.max(t.x,n.x)+r}function Zv(e,t,n,r){return e.y>=Math.min(t,n)-r&&e.y<=Math.max(t,n)+r}function Qv(e,t,n){let r=n.x-t.x;if(r===0)return n.y;let i=(e-t.x)/r;return t.y+(n.y-t.y)*i}function $v(e,[t,n],r,i){let a=r,o=e.timeSeries.container.size;for(let r=t;r<=n;r++){for(;e.timeSeriesAt(a)<e.timelineAt(r-e.shift)&&a<o;)++a;if(a===o)break;let t=e.timeSeriesAt(a)>e.timelineAt(r-e.shift);i(a,t)}}var ey={draw(e,t,n){P(e.zones)?Gv(e,t,n,sy):e.varyColorPerBar?dy(e,t,n):sy(e,t,n)},hitTest:ry},ty={draw(e,t,n){P(e.zones)?Gv(e,t,n,py):py(e,t,n,e.colors[0])},hitTest:iy},ny={draw:fy,hitTest:ay};function ry(e,t,n,r){let i=e.pickMainField(),{from:a,to:o}=qv(e,t,n,B.CONTINUOUS_LINE_HIT_TEST_RADIUS),s=null;for(let n=a;n<=o;n++){let a=e.pointAtTimelineIndex(n,i);if(a!==null){if(s!==null&&Yv(t,s.x,s.y,a.x,a.y,r))return!0;s=a}}return!1}function iy(e,t,n,r){let i=e.pickMainField(),{from:a,to:o}=qv(e,t,n);for(let n=a;n<=o;n++){let a=e.pointAtTimelineIndex(n-1,i),o=e.pointAtTimelineIndex(n,i);if(a===null||o===null)continue;let s={x:o.x,y:a.y};if(Yv(t,a.x,a.y,s.x,s.y,r)||Yv(t,s.x,s.y,o.x,o.y,r))return!0}return!1}function ay(e,t,n,r){let i=e.pickMainField(),a=Math.max(1,e.lineWidth||B.CURVE_STYLE_DOTS_RADIUS)+r,o=a*a,{from:s,to:c}=qv(e,t,n);for(let n=s;n<=c;n++){let r=e.pointAtTimelineIndex(n,i);if(r===null)continue;let a=t.x-r.x,s=t.y-r.y;if(a*a+s*s<=o)return!0}return!1}function oy(e,t,n,r,i=1){let a=B.MARKER_SIZE*i,o=a*1.25;switch(r){case`Circle`:e.moveTo(t+a,n),e.arc(t,n,a,0,Math.PI*2);break;case`Square`:e.rect(t-a,n-a,2*a,2*a);break;case`TriangleUp`:e.moveTo(t-o,n+o),e.lineTo(t+o,n+o),e.lineTo(t,n-o),e.lineTo(t-o,n+o);break;case`TriangleDown`:e.moveTo(t-o,n-o),e.lineTo(t+o,n-o),e.lineTo(t,n+o),e.lineTo(t-o,n-o);break;case`Diamond`:e.moveTo(t,n-o),e.lineTo(t+o,n),e.lineTo(t,n+o),e.lineTo(t-o,n),e.lineTo(t,n-o);break;default:break}}function sy(e,t,{bar:n,slice:r,start:i},a=null){let o=a||e.getColor(0),s=N(e.lineMarker);s&&(t.fillStyle=o,t.beginPath());let c=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,l=[],u=e.pickMainField();$v(e,r,i,(r,i)=>{if(!i){let n=e.dataAt(u,r);if(P(n)){let r=e.priceToY(n);s&&oy(t,c,r,e.lineMarker),l.push({x:c,y:r})}}c+=n.totalWidth}),s&&t.fill(),t.lineWidth=e.lineWidth,e.dashStyle&&t.setLineDash(lo(e.dashStyle)),N(e.lineSmoothing)?cy(t,l,o,e.lineSmoothing):uy(t,l,o)}function cy(e,t,n,r){if(t.length<2)return;let i=ly(t,r);e.beginPath(),e.strokeStyle=n,e.moveTo(t[0].x,t[0].y);for(let t of i)e.bezierCurveTo(t.cp1x,t.cp1y,t.cp2x,t.cp2y,t.x,t.y);e.stroke()}function ly(e,t){let n=[];for(let r=0;r<e.length-1;r++){let i=e[r-1]||e[r],a=e[r],o=e[r+1],s=e[r+2]||o,c=a.x+(o.x-i.x)/t,l=a.y+(o.y-i.y)/t,u=o.x-(s.x-a.x)/t,d=o.y-(s.y-a.y)/t;n.push({cp1x:c,cp1y:l,cp2x:u,cp2y:d,x:o.x,y:o.y})}return n}function uy(e,t,n){if(t.length>1){e.beginPath(),e.strokeStyle=n;let r=t[0];e.moveTo(r.x,r.y);for(let n=1;n<t.length;n++){let r=t[n];e.lineTo(r.x,r.y)}e.stroke()}}function dy(e,t,{bar:n,slice:r,start:i}){t.lineWidth=e.lineWidth,t.lineCap=`square`,e.dashStyle&&t.setLineDash(lo(e.dashStyle));let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,o=null,s=null,c=[];$v(e,r,i,(r,i)=>{if(!i){let n=e.pickMainField(),i=e.dataAt(n,r);if(P(i)){let n=e.priceToY(i);s=e.getColor(r),o!==s&&(uy(t,c,o),c.length>0&&(c=[c.pop()]),o=s),c.push({x:a,y:n})}}a+=n.totalWidth}),uy(t,c,s)}function fy(e,t,{bar:n,slice:r,start:i}){let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2;t.fillStyle=e.getColor(0);let o=Math.max(1,e.lineWidth||B.CURVE_STYLE_DOTS_RADIUS),s=Math.PI*2;t.beginPath(),$v(e,r,i,(r,i)=>{if(!i){let n=e.pickMainField(),i=e.dataAt(n,r);if(P(i)){let n=e.priceToY(i);t.moveTo(a+o,n),t.arc(a,n,o,0,s)}}a+=n.totalWidth}),t.fill()}function py(e,t,{bar:n,slice:r,start:i},a){let o=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,s=is();s.prolog(t),t.strokeStyle=a,t.lineWidth=e.lineWidth,e.dashStyle&&t.setLineDash(lo(e.dashStyle)),t.beginPath();let c=!1,l=null;$v(e,r,i,(r,i)=>{if(!i){let n=e.pickMainField(),i=e.dataAt(n,r);if(P(i)){let a=e.priceToY(i);if(c)t.lineTo(o,l),t.lineTo(o,a);else{let i=e.dataAt(n,r-1);if(P(i)){let n=e.priceToY(i);t.moveTo(-1,n),t.lineTo(o,n),t.lineTo(o,a)}else t.moveTo(o,a);c=!0}l=a}}o+=n.totalWidth}),t.stroke(),s.epilog(t)}var my={draw(e,t,n){P(e.zones)?Gv(e,t,n,yy,!0):yy(e,t,n,e.colors,!0)},hitTest:vy},hy={draw:xy,hitTest:vy};function gy(e){let{BaseLevel:t}=dt(e);return{baseLevel:Number.isFinite(t)?xt(0,100,t):50}}function _y(e,[t,n]){let{baseLevel:r}=gy(e.plot.inputs);return(t-n)*r/100+n}function vy(e,t,n,r){if(ry(e,t,n,r))return!0;let{range:i}=n,a=e.pickMainField(),o=e.isBaseline?_y(e,i):i[1],{from:s,to:c}=qv(e,t,n);for(let n=s;n<=c;n++){let i=e.pointAtTimelineIndex(n,a),s=e.pointAtTimelineIndex(n+1,a);if(!(i===null||s===null)&&Xv(t,i,s,r)&&Zv(t,Qv(t.x,i,s),o,r))return!0}return!1}function yy(e,t,n,r,i=!1){sy(e,t,n,e.pickAreaStroke(r)),Sy(e,t,n,r[0],i)}function by(e,t,n){let{x:r,width:i}=e.pane.getBoundsWithoutScales();t.save(),t.lineWidth=1,t.strokeStyle=`#888`,t.setLineDash(lo(`dot`)),Vo(t,n,r,r+i),t.restore()}function xy(e,t,n){let[r,i]=n.range,a=_y(e,n.range);e.zones[0].value=e.yToPrice(a),by(e,t,a),Gv(e,t,n,yy,!0,(e,n)=>{let o=e===1,s=fo(n,0),c=t.createLinearGradient(0,o?r:i,0,a);return c.addColorStop(0,n),c.addColorStop(1,s),[c,fo(n,1)]})}function Sy(e,t,{bar:n,slice:r,start:i,range:[a,o]},s,c){if(c){let e=t.createLinearGradient(0,a,0,o);e.addColorStop(0,s),e.addColorStop(1,fo(s,0)),t.fillStyle=e}else t.fillStyle=s;t.beginPath();let l=null,u=e.pickMainField(),d=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,f=!1,p=null;$v(e,r,i,(r,i)=>{if(!i){let n=e.dataAt(u,r);if(P(n)){let r=e.priceToY(n);f?t.lineTo(d,r):(t.moveTo(l=d,r),f=!0),p=d}}d+=n.totalWidth}),t.lineTo(p,o),t.lineTo(l,o),t.closePath(),t.fill()}var Cy={draw(e,t,n){P(e.zones)?Gv(e,t,n,Oy,!0):Oy(e,t,{...n,range:[null,null]})},hitTest:Ty},wy={draw:Dy,hitTest:Ey};function Ty(e,t,n,r){let{bar:i,slice:a}=n,o=e.view.xAxis.xScale.range()[0],s=e.isMultiColumn,c=s?e.fields.length:1,l=i.width/c,u=s?null:e.pickMainField(),d=e.priceToY(0),{from:f,to:p}=qv(e,t,n);for(let n=f;n<=p;n++){let f=e.dataIndexAtTimelineIndex(n);if(!P(f))continue;let p=o+i.offset+(n-a[0])*i.totalWidth;for(let n=0;n<c;n++){let i=e.dataAt(s?e.fields[n]:u,f);if(P(i)){let a=e.priceToY(i);if(Jv(t,p+n*l,a,l,d-a,r))return!0}}}return!1}function Ey(e,t,n,r){let{bar:i,slice:a}=n,o=e.view.xAxis.xScale.range()[0],{from:s,to:c}=qv(e,t,n);for(let n=s;n<=c;n++){let s=e.dataIndexAtTimelineIndex(n);if(!P(s))continue;let c=o+i.offset+(n-a[0])*i.totalWidth,l=e.priceToY(0),u=0;for(let n=0;n<e.plot.curves.length;n++){let a=e.plot.curves[n];if(!a.visible||!a.isStackedColumn)continue;let o=e.dataAt(a.fields[0],s);if(!P(o))continue;u+=o;let d=e.priceToY(u);if(a===e&&Jv(t,c,d,i.width,l-d,r))return!0;l=d}}return!1}function Dy(e,t,{bar:n,slice:r,start:i}){if(!e.isFirstVisibleOfStyle())return;let a=e.view.xAxis.xScale.range()[0]+n.offset,o=is();o.prolog(t);let s=e.plot.curves.filter(e=>e.isStackedColumn);$v(e,r,i,(r,i)=>{if(!i){let i=e.priceToY(0),c=0;s.forEach(s=>{if(!s.visible)return;let l=s.fields[0],u=e.dataAt(l,r);if(!P(u))return;c+=u;let d=e.priceToY(c);t.fillStyle=s.getColor(r,!1,l),t.beginPath(),t.rect(o.adjust(a),o.adjust(Math.min(d,i)),o.adjust(n.width),o.adjust(Math.abs(i-d))),t.fill(),i=d})}a+=n.totalWidth}),o.epilog(t)}function Oy(e,t,{bar:n,slice:r,start:i,range:[a,o]}){let s=e.view.xAxis.xScale.range()[0]+n.offset,c=e.isMultiColumn,l=c?e.fields:[e.pickMainField()],u=n.width/(c?l.length:1),d=is();d.prolog(t),$v(e,r,i,(r,i)=>{i||l.forEach((n,i)=>{let a=e.dataAt(n,r);if(P(a)){P(o)||(o=e.priceToY(0));let c=e.priceToY(a);t.fillStyle=e.getColor(r,!1,n),t.beginPath(),t.rect(d.adjust(s+i*u),d.adjust(Math.min(c,o)),d.adjust(u),d.adjust(Math.abs(o-c))),t.fill()}}),s+=n.totalWidth}),d.epilog(t)}var ky={draw:My},Ay=[G.Open,G.High,G.Low,G.Close],jy=[null,null,null,null];function My(e,t,{bar:n,slice:r,start:i}){t.lineWidth=Math.max(1,.5*n.width),t.lineJoin=`miter`,t.miterLimit=1.5;let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,o=is();o.prolog(t);let s=null,c=null,l=[];$v(e,r,i,(r,i)=>{if(!i){let i=t=>Ay.map(n=>e.dataAt(n,t)),[u,d,f,p]=i(r),[,m,h]=r<0?jy:i(r-1);if(P(u,d,f,p)){let i=o.adjust(a),g=o.adjust(a-n.totalWidth),_=[u,d,f,p].map(e.priceToY,e).map(o.adjust),v=o.adjust(e.priceToY(d>m?m:h));c=e.getColor(r);let y=P(s)&&s!==c,b=u===d?1:2,x=u===d?2:1;l.push({x:g,y:_[0]}),l.push({x:i,y:_[b]}),y&&(l.push({x:i,y:v}),uy(t,l,s),l=[]),y&&l.push({x:i,y:v}),l.push({x:i,y:_[x]}),s=c}}a+=n.totalWidth}),uy(t,l,c),o.epilog(t)}var Ny={draw:Iy,hitTest:Fy},Py=[G.Open,G.High,G.Low,G.Close];function Fy(e,t,n,r){let{bar:i}=n,a=i.width/2,{from:o,to:s}=qv(e,t,n);for(let n=o;n<=s;n++){let o=e.dataIndexAtTimelineIndex(n);if(!P(o))continue;let s=e.dataAt(G.Open,o),c=e.dataAt(G.High,o),l=e.dataAt(G.Low,o),u=e.dataAt(G.Close,o);if(P(s,c,l,u)){let o=e.view.xAxis.xScale.indexToX(n),d=e.priceToY(s),f=e.priceToY(c),p=e.priceToY(l),m=e.priceToY(u);if(e.isCandle){if(Jv(t,o-a,d,i.width,m-d,r)||Yv(t,o,Math.min(m,d),o,f,r)||Yv(t,o,Math.max(m,d),o,p,r))return!0}else if(Yv(t,o,p,o,f,r)||!e.isHlcStyle&&Yv(t,o-a,d,o,d,r)||Yv(t,o+a,m,o,m,r))return!0}}return!1}function Iy(e,t,{bar:n,slice:r,start:i}){let a=e.presenter.display.chart.showMinMaxArc,o=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,s=is();s.prolog(t);let c=null,l=null,u=null,d=null,f=n=>{e.isCandle?(e.isHollowCandles?n.outlineColor=e.getColor(n.ix,!1):(e.colors.length>3&&(n.outlineColor=e.colors[3]),e.colors.length>4&&(n.wickColor=e.colors[4])),zy(t,n,e.lineWidth)):(e.isOhlcStyle||e.isHlcStyle||e.isElderImpulseSystemStyle||e.isRangeStyle)&&Ry(t,n,e.lineWidth,!e.isHlcStyle)};$v(e,r,i,(t,r)=>{if(!r){let r=Py.map(n=>e.dataAt(n,t)),[i,a,p,m]=r;if(P(i,a,p,m)){let h={x:s.adjust(o),adjust:s.adjust,width:n.width,y:[i,a,p,m].map(e.priceToY,e).map(s.adjust),isMin:!1,isMax:!1,ix:t,color:e.getColor(t)},g=Math.min(...r),_=Math.max(...r);(!P(c)||g<c)&&(c=g,u=h),(!P(l)||_>l)&&(l=_,d=h),f(h)}}o+=n.totalWidth}),a&&(P(u)&&(u.isMin=!0,f(u)),P(d)&&(d.isMax=!0,f(d))),s.epilog(t)}function Ly(e,t,n,r,i,a,o,s=3){t&&Ro(e,{x:r,y:i+s},o,0,Math.PI),n&&Ro(e,{x:r,y:a-s},o,0,Math.PI,!0)}function Ry(e,{x:t,adjust:n,width:r,y:[i,a,o,s],color:c,isMin:l,isMax:u},d,f){let p=r/2;e.lineWidth=d,e.strokeStyle=c,e.beginPath(),e.moveTo(t,o),e.lineTo(t,a),f&&(e.moveTo(n(t-p),i),e.lineTo(t,i)),e.moveTo(n(t+p),s),e.lineTo(t,s),e.stroke(),Ly(e,l,u,t,o,a,p)}function zy(e,{x:t,adjust:n,width:r,y:[i,a,o,s],color:c,outlineColor:l,wickColor:u,isMin:d,isMax:f},p){let m=r/2;e.lineWidth=p,e.fillStyle=c,e.strokeStyle=l||c,e.beginPath(),e.rect(n(t-m),Math.min(i,s),r,n(Math.abs(s-i))),e.fill(),e.stroke(),e.strokeStyle=u||l||c,e.beginPath(),e.moveTo(t,Math.min(s,i)),e.lineTo(t,a),e.moveTo(t,Math.max(s,i)),e.lineTo(t,o),e.stroke(),e.strokeStyle=vo(c).a===0?l:c,Ly(e,d,f,t,o,a,m)}var By={draw:Vy};function Vy(e,t,{bar:n,slice:r,start:i}){let a=e.view.xAxis.xScale.range()[0],o=n.totalWidth/2,s=a+n.offset+n.width/2,c=is();c.prolog(t);let l=e.plot.timeSeries.builder.boxSize,u=l/2;$v(e,r,i,(r,i)=>{if(!i){let[n,i]=[G.High,G.Low].map(t=>e.dataAt(t,r)),a=e.colors[0],d=e.colors[1],f=e.dataAt(G.BARKIND,r),p=u_(f),m=f===B.BARKIND_XO,h=f===B.BARKIND_OX;if(P(n,i))for(let r=n;r>=i;r-=l){let l=c.adjust(s),[f,g]=[l-o,l+o],[_,v,y]=[r,r-u,r+u].map(t=>e.priceToY(t)),b=r===n&&m||r===i&&h?!p:p;t.beginPath(),b?(t.strokeStyle=d,t.moveTo(f,v),t.lineTo(g,y),t.moveTo(f,y),t.lineTo(g,v)):(t.strokeStyle=a,t.ellipse(l,_,o,v-_,0,0,Math.PI*2)),t.stroke()}}s+=n.totalWidth}),c.epilog(t)}var Hy={draw:Uy};function Uy(e,t,{bar:n,slice:r,start:i}){let a=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2;$v(e,r,i,(r,i)=>{if(!i){let[i,o]=[G.Open,G.Close].map(t=>e.dataAt(t,r)).map(e.priceToY,e),s=Math.floor(n.totalWidth/2);t.fillStyle=e.getColor(r),t.beginPath(),t.rect(a-s,Math.min(i,o),n.totalWidth,Math.abs(o-i)),t.fill()}a+=n.totalWidth})}var Wy={draw(e,t,n){e.varyColorPerBar?qy(e,t,n):Ky(e,t,n,e.colors[0])},hitTest:Gy};function Gy(e,t,n,r){let[i,a]=e.fields,{from:o,to:s}=qv(e,t,n);for(let n=o;n<=s;n++){let o=e.pointAtTimelineIndex(n,i),s=e.pointAtTimelineIndex(n+1,i),c=e.pointAtTimelineIndex(n,a),l=e.pointAtTimelineIndex(n+1,a);if(!(o===null||s===null||c===null||l===null)&&Xv(t,o,s,r)&&Zv(t,Qv(t.x,o,s),Qv(t.x,c,l),r))return!0}return!1}function Ky(e,t,{bar:n,slice:r,start:i},a){t.fillStyle=a;let[o,s]=e.fields,c=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,l=[];if($v(e,r,i,(t,r)=>{if(!r){let n=e.dataAt(o,t),r=e.dataAt(s,t);P(n,r)&&l.push({x:c,upY:e.priceToY(n),downY:e.priceToY(r)})}c+=n.totalWidth}),l.length>0){t.beginPath(),t.moveTo(l[0].x,l[0].upY);for(let e=1;e<l.length;++e)t.lineTo(l[e].x,l[e].upY);let e=l.length-1;t.lineTo(l[e].x,l[e].downY);for(let n=e-1;n>=0;--n)t.lineTo(l[n].x,l[n].downY);t.closePath(),t.fill()}}function qy(e,t,{bar:n,slice:r,start:i}){let[a,o]=e.fields,s=e.view.xAxis.xScale.range()[0]+n.offset+n.width/2,c=[],l=e=>{if(c.length>1){t.beginPath(),t.fillStyle=e,t.moveTo(c[0].x,c[0].upY);for(let e=1;e<c.length;++e)t.lineTo(c[e].x,c[e].upY);let n=c.length-1;t.lineTo(c[n].x,c[n].downY);for(let e=n-1;e>=0;--e)t.lineTo(c[e].x,c[e].downY);t.closePath(),t.fill()}},u=null,d=null;$v(e,r,i,(t,r)=>{if(!r){let n=e.dataAt(a,t),r=e.dataAt(o,t);if(P(n,r)){let i=e.priceToY(n),a=e.priceToY(r);d=e.getColor(t),u!==d&&(l(u),c.length>0&&(c=[c.pop()]),u=d),c.push({x:s,upY:i,downY:a})}}s+=n.totalWidth}),l(d)}var Jy=class{plot;id;fields=[];colors=[];style=h.Line;attributes=[];zones;_shift=0;lineWidth=1;lineMarker;lineSmoothing;dashStyle=`Solid`;varyColorPerBar=!1;visible=!0;_zoneColors;constructor(){this.id=bt(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=P(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(G.Close)}get name(){return this.isOhlc?``:this.fields[0].name}get isHeikinAshiStyle(){return this.style===h.HeikinAshi}get isCandle(){return this.style===h.Candlestick||this.style===h.HollowCandles||this.style===h.HeikinAshi}get isHollowCandles(){return this.style===h.HollowCandles}get isElderImpulseSystemStyle(){return this.style===h.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===h.PercentChange}get isOhlcStyle(){return this.style===h.OHLC}get isHlcStyle(){return this.style===h.HLC}get isRangeStyle(){return this.style===h.Range}get isRenko(){return this.style===h.Renko}get isKagi(){return this.style===h.Kagi}get isPointAndFigure(){return this.style===h.PointAndFigure}get isLineBreak(){return this.style===h.LineBreak}get isBaseline(){return this.style===h.Baseline}get isLineLike(){return[h.Line,h.Area,h.Baseline,h.PercentChange].includes(this.style)}get isColumn(){return this.style===h.Column}get isMultiColumn(){return this.style===h.MultiColumn}get isStackedColumn(){return this.style===h.StackedColumn}isFirstVisibleOfStyle(){return this.plot.curves.find(e=>e.visible&&e.style===this.style)===this}fromModel(e){e.attributes&&(this.attributes=e.attributes.map(e=>m[e])),this.colors=e.colors,this.fields=e.fields.map(e=>G[e]),this.style=h[e.style],this.lineWidth=e.lineWidth,this.dashStyle=e.dashStyle,this.lineMarker=e.lineMarker,this.lineSmoothing=e.lineSmoothing,this.varyColorPerBar=e.varyColorPerBar,this.visible=e.visible??!0,e.zones&&(this.zones=e.zones),this.shift=e.shift}get axis(){return this.plot?.axis}get pane(){return this.axis?.pane}get timeSeries(){return this.plot?.timeSeries}get presenter(){return this.pane?.presenter}get view(){return this.presenter?.view}yToPrice(e){return this.yScale.yToPrice(e)}priceToY(e){return this.yScale.priceToY(e)}dataAt(e,t,n=!0){let r=!this.plot.isComparison(x.None),i=e===G.PercentChange,a=e===G.Change,o=i||(!n||r)&&a,s=this.timeSeries.container.hasField(G.Last)?G.Last:G.Close,c=o?s:e,l=(e,t)=>{let n=this.timeSeries.container.getData(e)[t];return e.type===v.Number?this.plot.priceMapper(n,t,e):n},u=l(c,t);if(!o)return u;if(t<=1)return 0;let d=l(c,t-1),f=u-d;return i?d===0?0:f/d:f}timeSeriesAt(e){let t=this.timeSeries.container.getTimeData(),n=t.length;return e<0||e>n-1?null:t[e]}timelineAt(e){return this.presenter.timeline.at(e)}get shiftedTimeDomain(){let e=this.view.xAxis.xScale;return P(e.extent())?this.shift===0?e.domain():e.extent().map(t=>e.timeline.at(t-this.shift)):null}get yScale(){return this.plot?.yScale??this.axis.yScale}get canHitTest(){return P(Yy(this)?.hitTest)}getCore(){let e=this.timeSeries;if(!e.hasData||!this.visible)return null;let t=this.view.xAxis.xScale.extent();if(!P(t))return null;let n=this.yScale.domain();return P(n)?{ts:e,extent:t,domain:n,range:this.yScale.range()}:null}getDrawInfo(e){let t=e.ts.container.getTimeData(),n=this.shiftedTimeDomain[0];return P(n)?{bar:this.view.xAxis.xScale.bar,domain:e.domain,range:e.range,slice:e.extent,start:Te(t,+n,Number)||0}:null}hitTest(e){let t=Yy(this);if(!P(t?.hitTest))return!1;let n=this.getCore();if(n===null)return!1;let r=this.getDrawInfo(n);if(r===null)return!1;let i=B.PLOT_HIT_TEST_TOLERANCE+Math.max(0,this.lineWidth/2);return Kv(this,e,r,i)?!1:t.hitTest(this,e,r,i)}dataIndexAtTimelineIndex(e){let t=this.timelineAt(e-this.shift);if(!P(t))return null;let n=this.timeSeries.container.getTimeData(),r=Te(n,+t,Number),i=n[r];return P(i)&&i.getTime()===t.getTime()?r:null}pointAtTimelineIndex(e,t){let n=this.dataIndexAtTimelineIndex(e);if(!P(n))return null;let r=this.dataAt(t,n);return P(r)?{x:this.view.xAxis.xScale.indexToX(e),y:this.priceToY(r)}:null}drawHover(e,t,n){if(!this.isLineLike||this.getCore()===null)return;let[r,i]=Rv(this,this.pickMainField(),t);P(r)&&(e.save(),To(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=uo(this.getColor(i)),e.beginPath(),oy(e,n,this.priceToY(r),this.lineMarker??`Circle`,1.3333),e.fill(),e.restore())}draw(e){let t=this.getCore();if(t===null)return;let n=this.getDrawInfo(t);if(n===null)return;e.save(),e.setLineDash([]);let r=Yy(this);P(r)?r.draw(this,e,n):I(`Drawing of the curve style '${this.style}' is not implemented yet`,`error`),e.restore()}pickMainField(){return this.fields.length===1?this.fields[0]:this.fields.includes(G.Last)?G.Last:this.fields.includes(G.Close)?G.Close:this.fields[0]}get zoneColors(){if(!P(this._zoneColors)){let e=this.colors.slice();this._zoneColors=this.zones.map(t=>e.splice(0,t.colors))}return this._zoneColors}getColorsFromZone(e){let t=this.zones.findIndex(t=>e<t.value);return t===-1&&(t=this.zones.length-1),this.zoneColors[t]}pickAreaStroke(e){return e.length<2?uo(e[0]):e[1]}getComputedColor(e){if(!this.timeSeries.container.hasField(G.BARCOLIX))return null;let t=this.dataAt(G.BARCOLIX,e);return t>=0&&t<this.colors.length?this.colors[t]:null}getColor(e,t=!0,n=null){if(this.varyColorPerBar){let n={};if(this.isOhlc||this.isRenko||this.isLineBreak){let t=this.dataAt(G.Open,e),r=this.dataAt(G.High,e),i=this.dataAt(G.Low,e),a=this.dataAt(G.Close,e),o=this.dataAt(G.Change,e);n.open=t,n.high=r,n.low=i,n.close=a,n.change=o}else if(this.plot.isStudy&&![`VOL`,`MAVOL`].includes(this.plot.model.study)){let t=this.pickMainField(),r=this.dataAt(t,e-1),i=this.dataAt(t,e),a=P(r),o=P(i);a?n.change=o?i-r:-1:n.change=+!!o}else{let t=this.plot.axis.pane.presenter.data.aggregation;(!t.isTick||t.spec!==_.None)&&(n.open=this.dataAt(G.Open,e),n.close=this.dataAt(G.Close,e)),n.change=this.dataAt(G.Change,e)}let r,i=Xy(this.style,n,this.colors),a=this.getComputedColor(e);switch(this.style){case h.Candlestick:case h.Renko:case h.LineBreak:case h.Range:case h.HeikinAshi:case h.OHLC:case h.HLC:case h.Column:{if(P(a)){r=a;break}let t=i.useSame?i.isUp:i.isUp||i.isSame,n=i.isSame,o=this.attributes||[],s=this.plot.isStudy&&![`HASMO`,`VOL`,`MAVOL`].includes(this.plot.model.study);(o.includes(m.ChangeBased)||s)&&(t=i.useSame?i.isUpPrev:i.isUpPrev||i.isSamePrev,n=i.isSamePrev),r=this.colors[+!!t],i.useSame&&n&&(r=this.colors[2]),(this.isRenko||this.isLineBreak||this.isRangeStyle)&&this.dataAt(G.Projection,e)===1&&(r=go(.5,!0)(r));break}case h.ElderImpulseSystem:r=this.colors[this.dataAt(G.BREL,e)];break;case h.HollowCandles:{let e=this.colors[i.isUpPrev||i.isSamePrev?1:0];r=t&&(i.isUp||i.isSame)?B.COLOR_TRANSPARENT:e;break}case h.Line:case h.PercentChange:case h.Ribbon:case h.Kagi:if(P(a)){r=a;break}r=this.colors[0];break;case h.PointAndFigure:{let t=+!!u_(this.dataAt(G.BARKIND,e));r=this.colors[t];break}default:throw Error(`Unexpected style ${h[this.style]} for a curve with varying colors`)}return P(r)||(r=this.colors[0]),r}else if(this.zones){let t=this.pickMainField(),n=this.dataAt(t,e),r=this.getColorsFromZone(n);return this.style===h.Area?this.pickAreaStroke(r):r.length>0?r[0]:this.colors[0]}else return(this.isMultiColumn||this.isStackedColumn)&&P(n)?this.colors[ke(this.colors,this.fields.findIndex(e=>e===n))]:this.colors[0]}};function Yy(e){return e.isOhlc?Ny:e.isRenko||e.isLineBreak?Hy:e.style===h.Ribbon?Wy:e.style===h.Area?my:e.isColumn||e.isMultiColumn?Cy:e.isStackedColumn?wy:e.isBaseline?hy:e.style===h.Step?ty:e.isKagi?ky:e.isPointAndFigure?By:e.style===h.Dots?ny:e.style===h.Line||e.isPercentChangeStyle?ey:null}function Xy(e,{open:t,close:n,change:r},i){let a=i.length>2&&e!==h.HLC,o=P(t,n),s=o&&n>t,c=o&&n===t,l=r>0,u=r===0;return{useSame:a,isUp:s,isSame:c,isUpPrev:l,isSamePrev:u,isDown:!s&&!c,isDownPrev:!l&&!u}}function Zy(e){let t=e.duplicate(),n=e;return`disableStreamingUpdates`in n&&(t.disableStreamingUpdates=n.disableStreamingUpdates),`surrogate`in n&&(t.surrogate=n.surrogate),t}var Qy=class e{symbol;aggregation;range;seriesKind;cacheMe;barsToFetch;offset;chartId;curveStyle;extendedHours;useLastTrade;fields=[];alwaysUseBarsToFetch;inputs=[];splits;padded;constructor(e,t,n=w.Normal,r=[null,null]){this.symbol=e,this.aggregation=t,this.range=r,this.seriesKind=n,this.cacheMe=!1,this.barsToFetch=0,this.offset=0,this.chartId=null,this.curveStyle=null,this.alwaysUseBarsToFetch=!1,this.splits=!0,this.padded=!1}getBuilderKey(){if(this.curveStyle!==null&&Js(this.inputs,qs(h[this.curveStyle])),!P(this.curveStyle)||!B.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return`Standard`;switch(this.curveStyle){case h.Renko:{let{method:e,period:t,source:n,brickSize:r}=xg(this.inputs);return`Renko;${e===`ATR`?`ATR;${t}`:`${e};${r}`};${n}`}case h.Kagi:{let{method:e,period:t,reversal:n}=n_(this.inputs);return`Kagi;${e===`ATR`?`ATR;${t}`:`User;${n}`}`}case h.PointAndFigure:{let{method:e,period:t,reversal:n,boxSize:r,source:i,oneStepBack:a}=d_(this.inputs);return`PointAndFigure;${e===`ATR`?`ATR;${t}`:`User;${r}`};${i};${n};${a}`}case h.LineBreak:{let{lineBreak:e}=i_(this.inputs);return`LineBreak;${e}`}default:return h[this.curveStyle]}}get needsExtraKey(){return[w.Options,w.BalanceSheet,w.IncomeStatement].includes(this.seriesKind)}getExtraKey(){return this.needsExtraKey&&this.fields.length>0?`${this.fields.map(e=>e.id).join(`;`)}`:``}getHashKey(){let e=this.aggregation.getHashKey(),t=this.getBuilderKey(),n=this.getExtraKey(),r=this.extendedHours??!1,i=this.aggregation.isEndOfDay&&(this.useLastTrade??!1);return`${this.symbol}|${i}|${e}|${r}|${this.range}|${this.seriesKind}|${this.offset}|${t}|${this.splits}|${this.padded}|${n}`}duplicate(){let t=new e(this.symbol,this.aggregation.duplicate(),this.seriesKind,this.range);return t.cacheMe=this.cacheMe,t.barsToFetch=this.barsToFetch,t.alwaysUseBarsToFetch=this.alwaysUseBarsToFetch,t.offset=this.offset,t.chartId=this.chartId,t.curveStyle=this.curveStyle,t.useLastTrade=this.useLastTrade,t.extendedHours=this.extendedHours,t.fields=F(this.fields),t.splits=this.splits,t.padded=this.padded,t}},$y=c(o(((e,t)=>{(function(n,r){var i={};n.PubSub?(i=n.PubSub,console.warn(`PubSub already loaded, using existing version`)):(n.PubSub=i,r(i)),typeof e==`object`?(t!==void 0&&t.exports&&(e=t.exports=i),e.PubSub=i,t.exports=e=i):typeof define==`function`&&define.amd&&define(function(){return i})})(typeof window==`object`&&window||e||global,function(e){var t={},n=-1,r=`*`;function i(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function o(e,t,n){try{e(t,n)}catch(e){setTimeout(a(e),0)}}function s(e,t,n){e(t,n)}function c(e,n,r,i){var a=t[n],c=i?s:o,l;if(Object.prototype.hasOwnProperty.call(t,n))for(l in a)Object.prototype.hasOwnProperty.call(a,l)&&c(a[l],e,r)}function l(e,t,n){return function(){var i=String(e),a=i.lastIndexOf(`.`);for(c(e,e,t,n);a!==-1;)i=i.substr(0,a),a=i.lastIndexOf(`.`),c(e,i,t,n);c(e,r,t,n)}}function u(e){var n=String(e);return!!(Object.prototype.hasOwnProperty.call(t,n)&&i(t[n]))}function d(e){for(var t=String(e),n=u(t)||u(r),i=t.lastIndexOf(`.`);!n&&i!==-1;)t=t.substr(0,i),i=t.lastIndexOf(`.`),n=u(t);return n}function f(e,t,n,r){e=typeof e==`symbol`?e.toString():e;var i=l(e,t,r);return d(e)?(n===!0?i():setTimeout(i,0),!0):!1}e.publish=function(t,n){return f(t,n,!1,e.immediateExceptions)},e.publishSync=function(t,n){return f(t,n,!0,e.immediateExceptions)},e.subscribe=function(e,r){if(typeof r!=`function`)return!1;e=typeof e==`symbol`?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var i=`uid_`+String(++n);return t[e][i]=r,i},e.subscribeAll=function(t){return e.subscribe(r,t)},e.subscribeOnce=function(t,n){var r=e.subscribe(t,function(){e.unsubscribe(r),n.apply(this,arguments)});return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0&&delete t[n]},e.countSubscriptions=function(e){var n,r,i=0;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0){for(r in t[n])i++;break}return i},e.getSubscriptions=function(e){var n,r=[];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0&&r.push(n);return r},e.unsubscribe=function(n){var r=typeof n==`string`&&(Object.prototype.hasOwnProperty.call(t,n)||function(e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.indexOf(e)===0)return!0;return!1}(n)),i=!r&&typeof n==`string`,a=typeof n==`function`,o=!1,s,c,l;if(r){e.clearSubscriptions(n);return}for(s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(c=t[s],i&&c[n]){delete c[n],o=n;break}if(a)for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&c[l]===n&&(delete c[l],o=!0)}return o}})}))(),1);function eb(e,t,n){return new tb(e,t,n)}var tb=class{exprModel;innerSeries;calculable=!0;container;innerLookup;policy;exprSymbols;valueSymbols=[];onlyForTimeline;recalcTriggers;crashedComputationReported=!1;isLoading=!1;_sourceFields;_targetFields;basisChangedToken=null;quoteGroupToken=null;seasonalAverageOffset;constructor(e,t,n){this.exprModel=e,this.innerSeries=t,this.container=null,this.innerLookup=t.reduce((e,t)=>(e[n.mapper(t)]=t,e),{}),this.policy=n,this.exprSymbols=wd(e),this.valueSymbols=this.exprSymbols.filter(e=>this.innerLookup[e]===void 0),this.onlyForTimeline=j(this.symbols,this.exprSymbols),this.recalcTriggers=new Set(t)}refresh(){this.innerSeries.forEach(e=>e.refresh())}get canLoadMoreData(){return this.policy.loadMoreData&&this.innerSeries.some(e=>e.canLoadMoreData)}async loadMoreData(e=!0){if(this.isLoading)return Promise.resolve();this.isLoading=!0;let t=this.innerSeries.filter(e=>e.canLoadMoreData).map(t=>t.loadMoreData(e));await Promise.all(t),this.isLoading=!1}get isExprInError(){return!P(this.exprModel)}get hasData(){return this.container!==null}get sourceFields(){return this._sourceFields||=Array.from(this.policy.fieldMap.keys()),this._sourceFields}get targetFields(){return this._targetFields||=Array.from(this.policy.fieldMap.values()),this._targetFields}async ready(){return da.call(this,async()=>{this.basisChangedToken=$y.default.subscribe(K.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=$y.default.subscribe(K.RT_QUOTEGROUP,this.onQuoteGroup.bind(this));let e=this.innerSeries.map(e=>e.ready());this.policy.valueProvider!==void 0&&e.push(this.policy.valueProvider.ready());let t=(await Promise.all(e)).every(ue);return t&&this.calculate(),t})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every(e=>P(e.container))&&this.calculateCommon(K.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===d.Manual||e===K.TS_EVENTSCHANGED||e===K.TS_LOADING||!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some(e=>!P(e.container)))return;let n=this.policy.mapper(t.series);if(!(e===K.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(n)))switch(this.policy.recompute===d.Everything?K.TS_MANYCHANGED:e){case K.TS_MANYCHANGED:this.calculate();break;case K.TS_DATAPOINTCHANGED:case K.TS_DATAPOINTADDED:this.recalculate(e===K.TS_DATAPOINTADDED);break;case K.TS_TIMELINECORRECTION:case K.TS_QUOTEMARKER:break;default:throw Error(`Unknown time series message, likely forgot to handle it`)}}shutdown(){this.basisChangedToken&&$y.default.unsubscribe(this.basisChangedToken),this.quoteGroupToken&&($y.default.unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map((t,n)=>t===G.Volume?pe(this.exprSymbols.map(t=>e.inn[t].values[n]??0)):bd(this.exprModel,t=>e.oneValue[t]??e.inn[t]?.values[n]??null))}pickMainField(){let e=null;for(let t of this.policy.fieldMap.values())if(e==null)e=t;else if(t===G.Close){e=t;break}return e}calculateLastChange(){let e=this.container,t=e.size;if(t<=1)return;let n=this.pickMainField(),r=e.getData(n)[t-2],i=e.getData(n)[t-1];P(r,i)&&e.setLastDataPoint(G.Change,i-r)}calculateDataPoint(e,t){let n=this.calculateAt(e);if(n===null)return;e.atLeastOne=!0;let[r,i]=Ee(n,0,3);n[1]=i,n[2]=r,this.targetFields.forEach((e,r)=>{let i=n[r];t?this.container.addDataPoint(e,i):this.container.setLastDataPoint(e,i)}),t&&(this.container.addDataPoint(G.Change,null),this.container.addDataPoint(G.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){Ge(e,{series:this,index:this.container.size-1})}fieldValueAt(e,t,n){let r=this.innerLookup[e].container.getData(n);return t<0||t>=r.length?null:r[t]}timeStampAt(e,t){return this.fieldValueAt(e,t,G.DateTime)}timeline(e){return e.container.getData(G.DateTime)}getRangeHelper(){switch(this.policy.missing){case u.UseNext:case u.UseNone:return Math.min;case u.UsePrevious:return Math.max;default:throw Error(`Unknow missing bar policy, likely forgot to implement it.`)}}getRange(){let e=this.getRangeHelper();return{begin:new Date(e(...this.symbols.map(e=>Se(this.timeline(this.innerLookup[e]))))),end:new Date(e(...this.symbols.map(e=>xe(this.timeline(this.innerLookup[e])))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(e,t){let n=this.timeline(this.innerLookup[e]);switch(this.policy.missing){case u.UseNext:case u.UseNone:return n.findIndex(e=>e.valueOf()>=t.valueOf());case u.UsePrevious:return Ce(n,e=>e.valueOf()<=t.valueOf());default:throw Error(`Unknow missing bar policy, likely forgot to implement it.`)}}checkPos(e){let t=Object.keys(e.inn).length;e.isNull=Object.values(e.inn).some(e=>!P(e.timeStamp)&&(!this.policy.stretch(e.symbol)||t===1))}fillPosSymbolAt(e,t,n){e.index=t,e.timeStamp=this.timeStampAt(e.symbol,t);let r=(this.policy.missing===u.UseNone||this.policy.skipLeadingEmpty&&!n.atLeastOne)&&e.timeStamp&&e.timeStamp.valueOf()!==n.timeStamp.valueOf();return e.values=this.sourceFields.map(n=>r?null:this.fieldValueAt(e.symbol,t,n)),e}skippable(e){return this.innerLookup[e].container.isEmpty?this.policy.noDataApproach===f.IgnoreTimelineOnly&&this.onlyForTimeline.includes(e)||this.policy.noDataApproach===f.ModelTransformRequired:!1}get symbols(){let e=Object.keys(this.innerLookup);return P(this.onlyForTimeline)?e.filter(e=>!this.skippable(e)):e}getPos(e){let t={isNull:!0,inn:{},timeStamp:e,atLeastOne:!1,oneValue:{}};return this.symbols.length===0?t:(this.symbols.forEach(n=>{let r=this.findIndex(n,e),i={symbol:n,index:-1,timeStamp:new Date(0),values:[]};t.inn[n]=this.fillPosSymbolAt(i,r,t)}),this.valueSymbols.forEach(e=>{t.oneValue[e]=this.policy.valueProvider?.getValue(e)??null}),this.checkPos(t),t)}getInner(e){return Object.values(e.inn)}moveNext(e){e.isNull||(this.getInner(e).forEach(t=>{for(;P(t.timeStamp)&&t.timeStamp.valueOf()<=e.timeStamp.valueOf();)this.fillPosSymbolAt(t,t.index+1,e)}),this.checkPos(e),e.isNull||(e.timeStamp=new Date(Math.min(...this.getInner(e).filter(e=>e.timeStamp!==null).map(e=>e.timeStamp.valueOf()))),this.policy.missing===u.UsePrevious?this.getInner(e).forEach(t=>{let n=P(t.timeStamp);(n&&t.timeStamp.valueOf()>e.timeStamp.valueOf()||!n&&this.policy.stretch(t.symbol))&&this.fillPosSymbolAt(t,t.index-1,e)}):this.policy.missing===u.UseNone&&this.getInner(e).forEach(t=>this.fillPosSymbolAt(t,t.index,e))))}shouldAdd(e){let t=this.container?.getLastDataPoint(G.DateTime),n=e?.timeStamp;return P(t,n)?t.valueOf()<n.valueOf():!1}calculateCommon(e=null,t=null,n=!0){try{if(t)this.calculateDataPoint(t,n);else if(this.container=this.makeContainer(),!this.isExprInError){let e=this.getFirstPos();for(;!e.isNull;)this.calculateDataPoint(e,!0),this.moveNext(e)}e&&this.notify(e)}catch(e){this.crashedComputationReported||=(I(e,`error`),!0)}}calculate(){let{yes:e,no:t}=A(this.innerSeries,e=>!e.container.isEmpty);if(t.length>0&&this.policy.noDataApproach===f.ModelTransformRequired){let n=e=>e.map(this.policy.mapper),r=this.policy.modelTransform(n(e),n(t));r!==null&&(this.exprModel=r)}this.calculateCommon(K.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;let t=this.getLastPos(),n=this.shouldAdd(t);this.calculateCommon(n?K.TS_DATAPOINTADDED:K.TS_DATAPOINTCHANGED,t,n)}recalculateAt(e,t,n){return this.recalculate(n)}makeContainer(){return new _g([G.DateTime,G.Change].concat(this.targetFields))}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}};function nb(e){if(!(e instanceof tb)||e.innerSeries.length!==1||e.exprSymbols.length!==1||e.valueSymbols.length!==0)return e;let t=e.innerSeries[0],n=t.query;return!P(n)||!nt(n,`surrogate`)?e:t}function rb(e){let{query:t}=e;return t!==void 0&&`duplicate`in t&&`getBuilderKey`in t}function ib(e,t,n){if(!(e instanceof tb))return n(e);if(e.valueSymbols.length!==0)return new __;let r=e.innerSeries.map(n);return new tb(e.exprModel,r,{...e.policy,fieldMap:new Map([[t,t]])})}function ab(e,t){return ib(e,t,e=>e)}function ob(e,t){let n=nb(e);if(!rb(n))return new __;let r=Zy(n.query);if(r.symbol===B.PLACEHOLDER_SYMBOL_NAME||r.getBuilderKey()!==`Standard`)return new __(r);{r.barsToFetch!==0&&(r.barsToFetch*=B.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);let e=t(r);return e.serverComputedSeries=!0,e}}function sb(e,t,n){return ib(e,t,e=>ob(e,n))}function q(e){return new Ff(e,v.Number,b.Study,e)}var J=class{calcCtx;container;_source;target;inputs;outFields;studyFields={};innerSeries;calculable=!0;useNotifications=!1;initialNotification=!1;computedServerSide=!1;id;usedAsStyle=!1;recalcTriggers=new Set;basisChangedToken=null;_canLoadMoreData=!1;isLoading=!1;query;aggregation;sourceNeedsCompute=!1;allowEmptyValues=!1;constructor(e,...t){this.container=this._source=null,this.inputs=e.inputs,this.setOptions(e),this.innerSeries=t,this.id=bt(),this.addRecalcTrigger(...t)}refresh(){}get canLoadMoreData(){return this._canLoadMoreData}set canLoadMoreData(e){this._canLoadMoreData=e}loadMoreData(e){throw Error(`Should not be called.`)}addInner(...e){this.innerSeries.push(...e),this.addRecalcTrigger(...e)}isCalculable(e){return e.calculable??!1}addRecalcTrigger(...e){for(let t of e)this.isCalculable(t)?t.recalcTriggers.forEach(e=>this.recalcTriggers.add(e)):this.recalcTriggers.add(t)}setOptions(e){ut(this,e),nt(e,`source`)&&(this.source=e.source??null);let t=e.outFields??[e.target];this.studyFields=this.helpers.concat(t).reduce((e,t)=>(e[t.id]=t,e),{})}get helpers(){return B.EMPTY_ARRAY}get hasData(){return this.container!==null}get source(){if(P(this._source))return this._source;let e=P(this.inputs)?this.inputs[B.INPUT_SOURCE]:null;return P(e)?G[e]:null}set source(e){this._source=e}async ready(){return da.call(this,async()=>{this.basisChangedToken=this.useNotifications?$y.default.subscribe(K.TS_ALL,this.onBasisChanged.bind(this)):null;let e={tag:bt(),src:null},t=(await Promise.all(this.innerSeries.map(e=>e.ready()))).every(ue);return t&&this.calculate(e),t})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===K.TS_EVENTSCHANGED||e===K.TS_LOADING||this.innerSeries.some(e=>!e.hasData)||!this.shouldTriggerOurRecalc(t.series)||this.base===null||this===t.series)return;let n={tag:bt(),src:t.series};switch(e){case K.TS_MANYCHANGED:this.calculate(n);break;case K.TS_DATAPOINTCHANGED:case K.TS_DATAPOINTADDED:{let r=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(n,r,e===K.TS_DATAPOINTADDED);break}case K.TS_TIMELINECORRECTION:case K.TS_QUOTEMARKER:break;default:throw Error(`Unknown time series message, likely forgot to handle it`)}}shutdown(){this.useNotifications&&this.basisChangedToken&&$y.default.unsubscribe(this.basisChangedToken)}get baseIndex(){return 0}get base(){return this.innCont(this.baseIndex)}get period(){return this.inputs?.Period}calculateAt(e){return null}calculateDataPoint(e,t){let n=this.calculateAt(e);n!==null&&Object.keys(n).forEach(e=>{let r=n[e],i=this.studyFields[e];t?this.container.addDataPoint(i,r):this.container.setLastDataPoint(i,r)})}notify(e,t){Ge(e,{series:this,index:t})}calculateCommon(e,t=null,n=-1,r=!0){let i=n===-1,a=i?t=>{(P(e.src)||!P(t.calcCtx))&&t.calculate(e)}:t=>t.recalculateAt(e,n,r);if(!(this.base===null||this.calcCtx&&this.calcCtx.tag===e.tag||this===e.src)){if(this.calcCtx=e,this.innerSeries.filter(e=>this.isCalculable(e)&&!e.usedAsStyle).forEach(e=>a(e)),i&&(this.container=this.makeContainer()),this.calculateAt!==void 0)if(!i)this.calculateDataPoint(n,r);else{let e=this.base.size;for(let t=0;t<e;++t)this.calculateDataPoint(t,!0)}t&&(P(e.src)||this.initialNotification)&&this.notify(t,n)}}calculate(e){this.calculateCommon(e,K.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,n){this.computedServerSide||(!n&&N(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,n?K.TS_DATAPOINTADDED:K.TS_DATAPOINTCHANGED,t,n))}baseVal(e,t){return this.base.getData(e)[t]}innCont(e){return this.innerSeries[e].container}innVal(e,t,n){let r=this.innCont(e),i=r.size;return n<0||n>i-1?null:r.getData(t)[n]}innHasData(e){let t=this.innCont(e);return P(t)&&t.size>0}wrap(...e){return e.reduce((e,t)=>(e[t.f.id]=t.g,e),{})}wrapBaseFields(...e){return e.map(this.wrapBaseField,this)}wrapInner(e,t){return{f:e,g:()=>this.innCont(t).getData(e)}}wrapBaseField(e){return this.wrapInner(e,this.baseIndex)}get defaultWrappers(){return this.wrapBaseFields(G.DateTime,G.Symbol)}makeContainer(){let e=this.defaultWrappers.concat(this.getWrappers());return new yg(Object.keys(this.studyFields).map(e=>this.studyFields[e],this),this.wrap(...e))}getWrappers(){return[]}atLeast(e,t){return e>=t-1}exactly(e,t){return e==t-1}past(e,t,n,r=this.base){let i=r?.getData(n);return Array.isArray(i)?i.slice(e-t+1,e+1):[]}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}},cb=class extends J{constructor(e,...t){super(e,...t),this.usedAsStyle=!0}get actual(){return this.innerSeries[0]}get canLoadMoreData(){return this.actual.canLoadMoreData}async loadMoreData(e=!0){return this.actual.loadMoreData(e)}get record(){return this.actual.record}},lb=class extends J{constructor(e,t){super(e,t)}calculateAt(e){return null}getWrappers(){return[this.wrapInner(this.target,0)]}},ub=class extends cb{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){let[t,n,r,i]=[G.Open,G.High,G.Low,G.Close].map(t=>this.baseVal(t,e),this),a=null,o=null,s=null,c=null,l=me([t,n,r,i]);if(e<1)a=me([t,i]),o=n,s=r,c=0;else{let[t,i]=[G.Open,G.Close].map(t=>this.container.getData(t)[e-1],this);a=me([t,i]),o=Math.max(n,a,l),s=Math.min(r,a,l),c=l-i}return{[G.Open.id]:a,[G.High.id]:o,[G.Low.id]:s,[G.Close.id]:l,[G.Change.id]:c}}getWrappers(){return this.wrapBaseFields(G.Volume,G.OpenInterest,G.TradingDay)}},db=class extends J{constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=this.inputs.PeriodAverage,i=n(t,r,this.source??G.Close,G.ATREXTAVG),a=zD(t,this.inputs.PeriodATR);this.addInner(i,a)}calculateAt(e){let t=this.innVal(1,G.ATREXTAVG,e),n=this.innVal(2,G.ATR,e),r=t!==null&&n!==null,i=n*this.inputs.Multiplier;return{[G.ATREXTUP.id]:r?t+i:null,[G.ATREXTLOW.id]:r?t-i:null}}getWrappers(){return[this.wrapInner(G.ATREXTAVG,1)]}},fb=class extends J{constructor(e,t){super(e,t),rO(this)}calculateAt(e){let t=null,n=this.period,[,r]=iO(this);if(this.atLeast(e,n)&&r.hasField(this.source)){let i=this.past(e,n,this.source,r);this.allowEmptyValues?t=me(i.filter(de)):k(i)&&(t=me(i))}return{[this.target.id]:t}}getWrappers(){return this.source===G.Volume?this.wrapBaseFields(G.Volume,G.TradeSize,G.Change,G.Open,G.Close):[]}},pb=class extends J{multiplier;constructor(e,t,n){super(e,t),this.multiplier=n(this.period),rO(this)}calculateAt(e){let t=null,[n,r]=iO(this);if(this.atLeast(e,2)&&r.hasField(this.source)){let i=this.container.getData(this.target)[e-1];if(i!==null)t=(this.innVal(n,this.source,e)-i)*this.multiplier+i;else{let n=this.period;if(this.atLeast(e,n)){let i=this.past(e,n,this.source,r);this.allowEmptyValues?t=me(i.filter(de)):k(i)&&(t=me(i))}}}return{[this.target.id]:t}}},mb=class extends pb{constructor(e,t){super(e,t,e=>2/(e+1))}},hb=class extends pb{constructor(e,t){super(e,t,e=>1/e)}},gb=class extends J{constructor(e,t){super(e,t);let n=Y(t,this.inputs.Period1,G.High,G.MAHI),r=Y(t,this.inputs.Period2,G.Low,G.MALO);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.MAHI,1),this.wrapInner(G.MALO,2)]}},_b=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,n=G.OpenInterest;return this.base.hasField(n)&&(t=this.baseVal(n,e)),{[n.id]:t}}},vb=class extends _b{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(G.Volume,G.TradeSize,G.Change,G.Open,G.Close)}},yb=class extends _b{constructor(e,t){super(e,ab(t,G.OpenInterest))}getWrappers(){return this.wrapBaseFields(G.TradeSize,G.Change)}},bb={inField:G.MA,outFields:[G.ENVU,G.ENVD],func:Y},xb={inField:G.EMA,outFields:[G.ENVEXPU,G.ENVEXPD],func:X},Sb={inField:G.SMA,outFields:[G.ENVSMOU,G.ENVSMOD],func:AD},Cb=class extends J{kind;perc;constructor(e,t,n){super(e,n),this.kind=t,this.perc=this.inputs.Percent/100;let r=t.func(n,this.inputs.Period,e.source);this.addInner(r)}calculateAt(e){let t=null,n=null,r=this.innVal(1,this.kind.inField,e);if(r!==null){let e=r*this.perc;t=r+e,n=r-e}return{[this.kind.outFields[0].id]:t,[this.kind.outFields[1].id]:n}}},wb=class extends Cb{constructor(e,t){super(e,bb,t)}},Tb=class extends Cb{constructor(e,t){super(e,xb,t)}},Eb=class extends Cb{constructor(e,t){super(e,Sb,t)}},Db=class extends J{constructor(e,t){super(e,t);let n=Y(t,this.inputs.Period,this.source),r=Y(n,this.inputs.Period,G.MA,G.TMA);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.TMA,2)]}},Ob=class extends J{triangle;constructor(e,t){super(e,t);let n=this.period;this.triangle=n*(n+1)/2,rO(this)}weightedAverage(e){let t=e.length;if(t===0)return null;let n=t===this.period?this.triangle:t*(t+1)/2;return e.reduce((e,t,n)=>e+t*(n+1),0)/n}calculateAt(e){let t=null,n=this.period,[,r]=iO(this);if(this.atLeast(e,n)){let i=this.past(e,n,this.source,r);this.allowEmptyValues?t=this.weightedAverage(i.filter(de)):k(i)&&(t=this.weightedAverage(i))}return{[this.target.id]:t}}},kb=class extends J{constructor(e,t){super(e,t);let n=Y(t,this.inputs.Period1,this.source),r=Y(t,this.inputs.Period2,this.source),i=Q(this.target,(e,t,n)=>t-n,n,r);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},Ab={fields:[G.MACD,G.MACDS,G.MACDH],avgFunc:Y,mapFunc:eO,histogramVaryColor:!0},jb={fields:[G.MACD,G.MACDS,G.MACDH],avgFunc:X,mapFunc:eO,histogramVaryColor:!0},Mb={fields:[G.MACD,G.CTLTM,G.CTM],avgFunc:X,mapFunc:eO,histogramVaryColor:!1},Nb={fields:[G.MACD,G.CTLTMF,G.CPMI],avgFunc:X,mapFunc:eO,histogramVaryColor:!1},Pb={fields:[G.PPO,G.PPOS,G.PPOH],avgFunc:X,mapFunc:tO,histogramVaryColor:!0},Fb={fields:[G.PVO,G.PVOS,G.PVOH],avgFunc:X,mapFunc:tO,histogramVaryColor:!1},Ib=class extends J{histogramVaryColor=!1;histogramField;get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=-1;if(this.histogramVaryColor&&e>0){let n=this.container.getData(this.histogramField)[e],r=this.container.getData(this.histogramField)[e-1];if(P(n,r)){let i=n<=0;t=i?1:3,e>0&&(i&&n>r&&(t=0),!i&&n<r&&(t=2))}}return{[G.BARCOLIX.id]:t}}},Lb=class extends Ib{fields;constructor(e,t,n){super(e,n),this.fields=t.fields,this.histogramVaryColor=t.histogramVaryColor,this.histogramField=this.fields[2];let r=t.avgFunc(n,e.inputs.Period1,e.source,void 0),i=t.avgFunc(n,e.inputs.Period2,e.source,void 0),a=Q(this.fields[0],t.mapFunc,r,i),o=t.avgFunc(a,e.inputs.Period3,a.target,this.fields[1]),s=Q(this.fields[2],eO,a,o);this.addInner(a,o,s)}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}},Rb=class extends Ib{constructor(e,t){super(e,t),this.histogramVaryColor=!0,this.histogramField=G.MACDVH;let n=cO(e,`EMA`,`Average`),r=n(t,e.inputs.Period1,e.source,void 0),i=n(t,e.inputs.Period2,e.source,void 0),a=zD(t,e.inputs.Period2,e.inputs.Average),o=Q(G.MACDV,(e,t,n,r)=>(t-n)/r*100,r,i,a),s=n(o,e.inputs.Period3,o.target,G.MACDVS),c=Q(G.MACDVH,eO,o,s);this.addInner(o,s,c)}getWrappers(){return[this.wrapInner(G.MACDV,1),this.wrapInner(G.MACDVS,2),this.wrapInner(G.MACDVH,3)]}},zb=class extends Lb{constructor(e,t){super(e,Ab,t)}},Bb=class extends Lb{constructor(e,t){super(e,jb,t)}},Vb=class extends Lb{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,Mb,t)}},Hb=class extends Lb{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,Nb,t)}},Ub=class extends Lb{constructor(e,t){super(e,Pb,t)}},Wb=class extends Lb{constructor(e,t){super(e,Fb,t)}},Gb=q(`_AVG_GAIN`),Kb=q(`_AVG_LOSS`),qb=class extends J{isModified;constructor(e,t){super(e,t);let n=e.inputs.Modified;this.isModified=n}get helpers(){return[Gb,Kb]}gain(e,t){return t[e]>t[e-1]?t[e]-t[e-1]:0}loss(e,t){return t[e]<t[e-1]?t[e-1]-t[e]:0}calculateAt(e){let t=null,n=null,r=null,i=this.period;if(this.atLeast(e,i+1)){if(this.container.getData(this.target)[e-1]!==null&&!this.isModified){let t=this.container.getData(Gb)[e-1],a=this.container.getData(Kb)[e-1],o=this.past(e,2,this.source),s=this.gain(1,o),c=this.loss(1,o);n=(t*(i-1)+s)/i,r=(a*(i-1)+c)/i}else{let t=this.past(e,i+1,this.source);if(k(t)){let e=he(1,i),a=e.map(e=>this.gain(e,t)),o=e.map(e=>this.loss(e,t));n=me(a),r=me(o)}}n!==null&&r!==null&&(t=100-100/(1+n/r))}return{[Gb.id]:n,[Kb.id]:r,[this.target.id]:t}}},Jb=class extends J{constructor(e,t,n){super(e,n);let r=WD(n,this.inputs.Period,this.source,G.RSI,t),i=cO(e,`MA`,`Average`)(r,this.inputs.PeriodAvg,G.RSI,G.RSIAVG);this.addInner(r,i)}getWrappers(){return[this.wrapInner(G.RSI,1),this.wrapInner(G.RSIAVG,2)]}},Yb=class extends Jb{constructor(e,t){super(e,!1,t)}},Xb=class extends Jb{constructor(e,t){super(e,!0,t)}},Zb=class extends J{constructor(e,t){super(e,t);let n=WD(t,this.inputs.Period,this.source),r=this.inputs.Range,i=Z(G.STORSI,function(e){let t=null;if(this.atLeast(e,r)){let n=this.past(e,r,G.RSI,this.base),i=Ee(n),a=i[0],o=i[1];t=(xe(n)-a)/(o-a)}return{[G.STORSI.id]:t}},n),a=cO(e,`MA`,`Average`),o=this.inputs.PeriodAvg,s=a(i,o,G.STORSI,G.STORSIAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(G.STORSI,1),this.wrapInner(G.STORSIAVG,2)]}},Qb=class extends J{constructor(e,t){super(e,t);let n=PD(t,this.inputs.Period1,G.High,G.HH,!0),r=PD(t,this.inputs.Period2,G.Low,G.LL,!1);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.HH,1),this.wrapInner(G.LL,2)]}},$b=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,[n,r,i]=[G.Close,G.High,G.Low].map(t=>this.baseVal(t,e));return t=(2*n+r+i)/4,{[this.target.id]:t}}},ex=class extends J{highest;index;constructor(e,t,n,r){super(e,r),this.highest=t,this.index=n}calculateAt(e){let t=null,n=this.inputs.Period;if(this.atLeast(e,n)){let r=this.past(e,n,this.source);k(r)&&(t=this.highest?Math.max(...r):Math.min(...r),this.index&&(t=n-r.indexOf(t)-1))}return{[this.target.id]:t}}},tx=class extends J{toHighest;field;highField;lowField;constructor(e,t,n){super(e,n),this.toHighest=t;let r=P(e.source),i=e.source,a=r?i:G.Close;this.field=a;let o=r?i:G.High;this.highField=o;let s=r?i:G.Low;this.lowField=s;let c=PD(n,e.inputs.Period,this.highField,G.HH,!0),l=PD(n,e.inputs.Period,this.lowField,G.LL,!1);this.addInner(c,l)}calculateAt(e){let t=null,n=this.baseVal(this.field,e),r=this.innVal(1,G.HH,e),i=this.innVal(2,G.LL,e);if(k([n,r,i])){let e=this.toHighest?r:i,a=r-i;a!==0&&(t=(n-e)/a*100)}return{[this.target.id]:t}}},nx=class extends tx{constructor(e,t){super(e,!0,t)}},rx=q(`RawPercK`),ix=class extends J{kField;constructor(e,t,n,r){super(e,r);let i=FD(r,this.inputs.Period1,t?rx:n,!1),a=cO(e,`MA`),o=a(i,this.inputs.Period2,i.target,t?n:G.PercD),s=t?a(o,this.inputs.Period3,o.target,G.PercD):o;this.kField=n,t?this.addInner(o,s):this.addInner(i,o)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(G.PercD,2)]}},ax=class extends ix{constructor(e,t){super(e,!1,G.PercK,t)}},ox=class extends ix{constructor(e,t){super(e,!0,G.PercK,t)}},sx=class extends ix{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,G.CTPI,t)}};function cx(e,t,n,r,i){if(i===null)return null;let a=e*i,o=r+a,s=r-a;switch(t){case G.BOLLBU:return o;case G.BOLLBL:return s;case G.BOLLBW:return(o-s)/r*100;default:return null}}var lx=class extends J{kind;constructor(e,t,n){super(e,n),this.kind=t,rO(this);let r=this.inputs.Period,i=this.source,a=Y(n,r,i,G.BOLLBM),o=t===`Modified`,s=KD(o?ID(n,i):n,r,o?G.PCTCHG:i),c=this.inputs.Width,l=e=>ce(cx,c,e),u=Q(G.BOLLBU,l(G.BOLLBU),a,s),d=Q(G.BOLLBL,l(G.BOLLBL),a,s),f=Q(G.BOLLBW,l(G.BOLLBW),a,s),p=cO(e,`MA`,`Average`),m=this.inputs.PeriodAvg,h=p(f,m,G.BOLLBW,G.BOLLBWA);this.addInner(a,s,u,d,f,h)}calculateAt(e){let t=+!!this.sourceNeedsCompute,n=this.innVal(3+t,G.BOLLBU,e),r=this.innVal(4+t,G.BOLLBL,e),i=this.innVal(1+t,G.BOLLBM,e),a=this.innVal(5+t,G.BOLLBW,e),o=this.innVal(6+t,G.BOLLBWA,e),s=null;switch(this.kind){case`Regular`:return{[G.BOLLBU.id]:n,[G.BOLLBL.id]:r,[G.BOLLBM.id]:i};case`Width`:return{[G.BOLLW.id]:n-r};case`Percent`:if(P(n,r)){let[t]=iO(this),i=this.innVal(t,this.source,e);P(i)&&(s=(i-r)/(n-r))}return{[G.BOLLP.id]:s};case`BandWidth`:return{[G.BOLLBW.id]:a,[G.BOLLBWA.id]:o};case`Modified`:{let n=null,r=null,a=null,o=null,s=this.innVal(2+t,G.MSD,e);if(P(s)){let e=this.inputs.MultInside,t=this.inputs.MultOutside;n=i+e*s,a=i-e*s,r=i+t*s,o=i-t*s}return{[G.MBBUI.id]:n,[G.MBBLI.id]:a,[G.MBBUO.id]:r,[G.MBBLO.id]:o,[G.MBBM.id]:i}}default:return null}}},ux=class extends lx{constructor(e,t){super(e,`Regular`,t)}},dx=class extends lx{constructor(e,t){super(e,`Width`,t)}},fx=class extends lx{constructor(e,t){super(e,`Percent`,t)}},px=class extends lx{constructor(e,t){super(e,`BandWidth`,t)}},mx=class extends lx{constructor(e,t){super(e,`Modified`,t)}},hx=class extends J{constructor(e,t){super(e,t);let n=Z(G.OBVOL,function(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Volume,e),i=this.baseVal(G.Close,e-1),a=this.container.getData(this.target)[e-1];P(a)||(a=0),t=n>i?a+r:n<i?a-r:a}return{[this.target.id]:t}},t),r=cO(e,`MA`,`Average`),i=this.period,a=r(n,i,G.OBVOL,G.OBVOLAVG);this.addInner(n,a)}getWrappers(){return[this.wrapInner(G.OBVOL,1),this.wrapInner(G.OBVOLAVG,2)]}},gx=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,n=this.baseVal(G.High,e),r=this.baseVal(G.Low,e);if(e>0){let i=this.baseVal(G.Close,e-1);t=Math.max(n-r,Math.abs(n-i),Math.abs(r-i))}else t=n-r;return{[this.target.id]:t}}},_x=q(`_ABS_CHG`),vx=q(`_MA_ABS_CHG`),yx=q(`_CHG`),bx=class extends J{constructor(e,t){super(e,t);let n=RD(t,G.TR),r=cO(e,`SMA`)(n,this.inputs.Period,G.TR,this.target),i=Y(r,this.inputs.Period2,G.ATR,G.ATRMA);this.addInner(r,i)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(G.ATRMA,2)]}},xx=class extends J{constructor(e,t){super(e,t);let n=Z(_x,se((e,t)=>{let n=0;return t>0&&(n=this.baseVal(e,t)-this.baseVal(e,t-1)),{[_x.id]:Math.abs(n)}},this.source),t),r=cO(e,`MA`)(n,this.inputs.Period,_x,vx),i=Q(G.ADJATR,(e,t)=>2*t,r);this.addInner(i)}getWrappers(){return[this.wrapInner(G.ADJATR,1)]}},Sx=class extends J{constructor(e,t){super(e,t);let n=Z(yx,e=>{let t=0;return e>0&&(t=this.baseVal(G.Close,e)-this.baseVal(G.Close,e-1)),{[yx.id]:t}},t),r=uO(e),i=this.inputs.Period,a=this.inputs.Smoothing,o=r(t,i,a),s=Q(this.target,(e,t,n)=>!P(t)||!P(n)?null:t/n,n,o);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}},Cx=q(`_PDM`),wx=q(`_MDM`),Tx=q(`_TRS`),Ex=q(`_PDS`),Dx=q(`_MDS`),Ox=q(`_DX`),kx=class extends J{useEma;adxField;multiplier;constructor(e,t,n,r){super(e,r),this.useEma=t,this.adxField=n,this.multiplier=2/(this.inputs.AdxSmoothing+1);let i=RD(r,G.TR);this.addInner(i)}get helpers(){return[Cx,wx,Tx,Ex,Dx,Ox]}sum(e,t,n,r){let i=null;if(this.atLeast(e-1,r-1)){let a=this.past(e-1,r-1,t,this.container);a.push(n),k(a)&&(i=a.reduce((e,t,n)=>e+t,0))}return i}smooth1(e,t,n,r){let i=null,a=this.inputs.DiLength,o=this.container.getData(n)[e-1];return i=o===null?this.sum(e,t,r,a):o-o/a+r,i}smooth2(e,t,n,r){let i=this.container.getData(n)[e-1],a=this.inputs.AdxSmoothing;if(i!==null)return this.useEma?(r-i)*this.multiplier+i:(i*(a-1)+r)/a;{let n=this.sum(e,t,r,a);if(n!==null)return n/a}return null}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;if(e>0){let u=this.past(e,2,G.High),d=this.past(e,2,G.Low),f=Math.max(u[1]-u[0],0),p=Math.max(d[0]-d[1],0);t=f>p?f:0,n=p>f?p:0;let m=this.container.getData(G.TR)[e];i=this.smooth1(e,Cx,Ex,t),a=this.smooth1(e,wx,Dx,n),r=this.smooth1(e,G.TR,Tx,m),(i>0||a>0)&&r!==0&&(o=i/r*100,s=a/r*100,c=100*Math.abs(o-s)/(o+s),l=this.smooth2(e,Ox,this.adxField,c))}return{[Cx.id]:t,[wx.id]:n,[Tx.id]:r,[Ex.id]:i,[Dx.id]:a,[G.PDI.id]:o,[G.MDI.id]:s,[Ox.id]:c,[this.adxField.id]:l}}getWrappers(){return[this.wrapInner(G.TR,1)]}},Ax=class extends kx{constructor(e,t){super(e,!1,G.ADX,t)}},jx=class extends kx{constructor(e,t){super(e,!0,G.ADXM,t)}},Mx=class extends J{constructor(e,t){super(e,t);let n=GD(t);this.addInner(n)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,G.MFMUL,e),{[this.target.id]:t}}},Nx=class extends J{constructor(e,t){super(e,t);let n=Z(G.ADWM,function(e){let t=null,n=null;if(e>0){let r=this.baseVal(G.Close,e-1),i=Math.max(r,this.baseVal(G.High,e)),a=Math.min(r,this.baseVal(G.Low,e)),o=this.baseVal(G.Close,e);t=o>r?o-a:o<r?o-i:0,e>1&&(n=(e>2?this.container.getData(G.ADWM)[e-1]:0)+t)}return{[G.ADWM.id]:n}},t),r=Y(n,this.inputs.Period,G.ADWM,G.ADWMMA);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.ADWM,1),this.wrapInner(G.ADWMMA,2)]}},Px=class extends J{constructor(e,t){super(e,t);let n=G.ADL,r=VD(t,n),i=X(r,3,n),a=X(r,10,n),o=Q(e.target,(e,t,n)=>t-n,i,a);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},Fx=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=me([G.Close,G.High,G.Low].map(t=>this.baseVal(t,e))),{[this.target.id]:t}}},Ix=class extends J{calculateAtFunc;constructor(e,t,...n){super(e,...n),this.calculateAtFunc=t}calculateAt(e){let t=this.innerSeries.map((t,n)=>{let r=t,i=r.target;return P(i)||(i=r.container.hasField(G.Close)?G.Close:r.container.fields[0]),this.innVal(n,i,e)}),n=null;return k(t)&&(n=this.calculateAtFunc(e,...t)),{[this.target.id]:n}}};function Lx(e,t){let n=this.baseVal(G.High,t),r=this.baseVal(G.Low,t);return{[e.id]:(n+r)/2}}function Rx(e,t){let n=this.baseVal(G.High,t),r=this.baseVal(G.Low,t);return{[e.id]:n-r}}var zx=class extends J{calculateAtFunc;constructor(e,t,n){super(e,n),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}},Bx=q(`_RANGE`),Vx=q(`_MOV_RANGE`),Hx={fields:[G.KCUP,G.KCLOW,G.KCMID],midSeries:e=>HD(e,G.TP),midTarget:G.TP,rangeSeries:e=>Z(Bx,se(Rx,Bx),e),rangeTarget:Bx,func:`MA`,useMultiplier:!1},Ux={fields:[G.KBUP,G.KBLOW,G.KBMID],midSeries:e=>e,midTarget:G.Close,rangeSeries:e=>RD(e,G.TR),rangeTarget:G.TR,func:`EMA`,useMultiplier:!0},Wx=class extends J{kind;constructor(e,t,n){super(e,n),this.kind=t;let r=t.midSeries(n),i=cO(e,t.func,`Average`),a=i(r,this.inputs.Period,t.midTarget,t.fields[2]),o=i(t.rangeSeries(n),this.inputs.Period,t.rangeTarget,Vx);this.addInner(a,o)}calculateAt(e){let t=this.innVal(1,this.kind.fields[2],e),n=this.innVal(2,Vx,e),r=t!==null&&n!==null,i=this.kind.useMultiplier?this.inputs.Multiplier:1;return{[this.kind.fields[0].id]:r?t+n*i:null,[this.kind.fields[1].id]:r?t-n*i:null}}getWrappers(){return[this.wrapInner(this.kind.fields[2],1)]}},Gx=class extends Wx{constructor(e,t){super(e,Hx,t)}},Kx=class extends Wx{constructor(e,t){super(e,Ux,t)}},qx=class extends J{isWidth;constructor(e,t,n){super(e,n),this.isWidth=t;let r=PD(n,this.inputs.Period,G.High,G.DONUP,!0),i=PD(n,this.inputs.Period,G.Low,G.DONLOW,!1);this.addInner(r,i)}calculateAt(e){let t=this.innVal(1,G.DONUP,e),n=this.innVal(2,G.DONLOW,e),r=t===null&&n===null;return this.isWidth?{[G.DONW.id]:r?null:t-n}:{[G.DONMID.id]:r?null:(t+n)/2}}getWrappers(){return[this.wrapInner(G.DONUP,1),this.wrapInner(G.DONLOW,2)]}},Jx=class extends qx{constructor(e,t){super(e,!1,t)}},Yx=class extends qx{constructor(e,t){super(e,!0,t)}},Xx=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Volume,e),i=this.baseVal(G.Close,e-1),a=this.container.getData(this.target)[e-1];P(a)||(a=0);let o=(n-i)/i*r;t=a+o}return{[this.target.id]:t}}},Zx=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,this.source),r=X(n,this.inputs.Period,n.target),i=X(r,this.inputs.Period,r.target),a=UD(i,1,i.target,this.target);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},Qx=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,this.source),r=X(n,this.inputs.Period,n.target),i=Q(G.DEMA,(e,t,n)=>2*t-n,n,r);this.addInner(i)}getWrappers(){return[this.wrapInner(G.DEMA,1)]}},$x=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period1,this.source),r=X(t,this.inputs.Period2,this.source),i=Q(G.EOSC,(e,t,n)=>t-n,n,r);this.addInner(i)}getWrappers(){return[this.wrapInner(G.EOSC,1)]}},eS=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,this.source),r=X(n,this.inputs.Period,n.target),i=X(r,this.inputs.Period,r.target),a=Q(G.TEMA,(e,t,n,r)=>3*(t-n)+r,n,r,i);this.addInner(a)}getWrappers(){return[this.wrapInner(G.TEMA,1)]}},tS=class extends J{constructor(e,t){super(e,t)}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n+1)){let r=this.baseVal(this.source,e-n);r!==null&&r!==0&&(t=(this.baseVal(this.source,e)-r)/r*100)}return{[this.target.id]:t}}},nS=class extends J{constructor(e,t){super(e,t);let n=HD(t,G.PVPT);this.addInner(n)}calculateAt(e){let t=this.innVal(1,G.PVPT,e),n=this.baseVal(G.High,e),r=this.baseVal(G.Low,e);return{[G.PVPTR.id]:t+n-r,[G.PVPTS.id]:t-n+r}}getWrappers(){return[this.wrapInner(G.PVPT,1)]}},rS=q(`_HIND`),iS=q(`_LIND`),aS=class extends J{justWidth;constructor(e,t,n){super(e,n),this.justWidth=t,this.justWidth=t;let r=this.inputs.Period,i=PD(n,r,G.High,rS,!0,!0),a=PD(n,r,G.Low,iS,!1,!0);this.addInner(i,a)}calculateAt(e){let t=null,n=null,r=null,i=this.innVal(1,rS,e),a=this.innVal(2,iS,e);if(i!==null&&a!==null){let e=this.period;t=(e-i)/e*100,n=(e-a)/e*100,r=t-n}return this.justWidth?{[G.ARNOSC.id]:r}:{[G.ARNUP.id]:t,[G.ARNLOW.id]:n}}},oS=class extends aS{constructor(e,t){super(e,!1,t)}},sS=class extends aS{constructor(e,t){super(e,!0,t)}},cS=class extends J{constructor(e,t){super(e,t);let n=e.inputs.Range===`Close`,r=fO(t);if(!n&&r){let e=Z(G.TCHNUP,(e,t)=>null,t),n=Z(G.TCHNLOW,(e,t)=>null,t);this.addInner(e,n)}else{let r=PD(t,e.inputs.PeriodUpper,n?G.Close:G.High,G.TCHNUP,!0),i=PD(t,e.inputs.PeriodLower,n?G.Close:G.Low,G.TCHNLOW,!1);this.addInner(r,i)}}getWrappers(){return[this.wrapInner(G.TCHNUP,1),this.wrapInner(G.TCHNLOW,2)]}},lS=class extends J{constructor(e,t){super(e,t);let n=YD(t,e.inputs.Period,e.inputs.Range);this.addInner(n)}calculateAt(e){let t=null,n=this.innVal(1,G.TCHNUP,e),r=this.innVal(1,G.TCHNLOW,e),i=this.inputs.Adjustment,a=this.inputs.Retracement;return a===`Long`?t=P(n)?n-i:null:a===`Short`&&(t=P(r)?r+i:null),{[this.target.id]:t}}},uS=q(`_MIDPOINT`),dS=class extends J{constructor(e,t){super(e,t);let n=Z(uS,se(Lx,uS),t),r=AD(n,e.inputs.Period1,uS,G.ALJAW),i=AD(n,e.inputs.Period2,uS,G.ALTEETH),a=AD(n,e.inputs.Period3,uS,G.ALLIPS);this.addInner(r,i,a)}calculateAt(e){return{[G.ALJAW.id]:this.innVal(1,G.ALJAW,e),[G.ALTEETH.id]:this.innVal(2,G.ALTEETH,e),[G.ALLIPS.id]:this.innVal(3,G.ALLIPS,e)}}},fS=class extends J{constructor(e,t){super(e,t)}calculateAt(e){return{[G.PLTLN.id]:this.inputs.Position}}},pS=q(`_MIDPOINT`),mS=class extends J{constructor(e,t){super(e,t);let n=Z(pS,se(Lx,pS),t),r=Y(n,this.inputs.Period1,pS),i=Y(n,this.inputs.Period2,pS),a=Q(G.AWOS,(e,t,n)=>t-n,r,i),o=Y(a,this.inputs.Period3,a.target,G.AWOSMA);this.addInner(a,o)}getWrappers(){return[this.wrapInner(G.AWOS,1),this.wrapInner(G.AWOSMA,2)]}},hS=class extends J{multiplyVol;constructor(e,t,n){super(e,n),this.multiplyVol=t}calculateAt(e){let[t,n,r,i]=[G.High,G.Low,G.Close,G.Volume].map(t=>this.baseVal(t,e)),a=t===n?0:(r-n-(t-r))/(t-n);return this.multiplyVol&&(a*=i),{[this.target.id]:a}}},gS=class extends hS{constructor(e,t){super(e,!1,t)}},_S=class extends hS{constructor(e,t){super(e,!0,t)}},vS=class extends J{constructor(e,t){super(e,t);let n=GD(t);this.addInner(n)}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,G.Volume),i=this.past(e,n,G.MFMUL,this.innCont(1));if(k(r)&&k(i)){let e=pe(r);e!==0&&(t=pe(i)/e)}}return{[this.target.id]:t}}},yS=q(`_RANGE`),bS=class extends J{constructor(e,t){super(e,t);let n=UD(X(Z(yS,se(Rx,yS),t),this.inputs.Period1,yS),this.inputs.Period2,G.EMA,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},xS=class extends J{shift;constructor(e,t){super(e,t);let n=this.inputs.Period;this.shift=Math.floor(n/2)+1;let r=Y(t,n,e.source);this.addInner(r)}calculateAt(e){let t=null,n=this.shift,r=this.innVal(1,G.MA,e-n);return r!==null&&(t=this.baseVal(this.source,e)-r),{[this.target.id]:t}}},SS=q(`_MATP`),CS=class extends J{constructor(e,t){super(e,t);let n=HD(t),r=Y(n,this.inputs.Period,n.target,SS);this.addInner(n,r)}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,G.TP,this.innCont(1));if(k(r)){let n=this.innVal(2,SS,e);if(n!==null){let i=r.reduce((e,t,r)=>e+Math.abs(n-t),0)/this.period;t=(this.innVal(1,G.TP,e)-n)/(.015*i)}}}return{[this.target.id]:t}}},wS=class extends J{constructor(e,t){super(e,t);let n=Z(G.EMV,function(e){let t=null;if(e>0){let[n,r,i]=[G.High,G.Low,G.Volume].map(t=>this.baseVal(t,e)),[a,o]=[G.High,G.Low].map(t=>this.baseVal(t,e-1));t=((n+r)/2-(a+o)/2)/(i/1e6/(n-r))}return{[this.target.id]:t}},t),r=Y(n,this.inputs.Period,G.EMV,G.EMVMA);this.addInner(n,r)}getWrappers(){return[this.wrapInner(G.EMV,1),this.wrapInner(G.EMVMA,2)]}},TS=class extends J{isBull;constructor(e,t,n){super(e,n),this.isBull=t;let r=X(n,this.inputs.Period,this.source);this.addInner(r)}calculateAt(e){let t=null,n=this.innVal(1,G.EMA,e);return n!==null&&(t=this.isBull?this.baseVal(G.High,e)-n:this.baseVal(G.Low,e)-n),{[this.isBull?G.ERBLPOW.id:G.ERBRPOW.id]:t}}},ES=class extends TS{constructor(e,t){super(e,!0,t)}},DS=class extends TS{constructor(e,t){super(e,!1,t)}},OS=q(`_FORCE`),kS=class extends J{constructor(e,t){super(e,t);let n=X(Z(OS,function(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Volume,e);t=(n-this.baseVal(G.Close,e-1))*r}return{[this.target.id]:t}},t),this.inputs.Period,OS,G.FI);this.addInner(n)}getWrappers(){return[this.wrapInner(G.FI,1)]}},AS=q(`_RANGE`),jS=q(`_EMA1`),MS=q(`_EMA2`),NS=q(`_RATIO`),PS=class extends J{constructor(e,t){super(e,t);let n=X(Z(AS,se(Rx,AS),t),9,AS,jS),r=Q(NS,(e,t,n)=>t/n,n,X(n,9,jS,MS));this.addInner(r)}calculateAt(e){let t=null;if(this.atLeast(e,25)){let n=this.past(e,25,NS,this.innCont(1));k(n)&&(t=pe(n))}return{[this.target.id]:t}}},FS=class extends J{constructor(e,t){super(e,t);let n=this.inputs.Period,r=Z(G.MOM,ce(oO,n,this.source),t),i=Y(r,this.inputs.Movement,G.MOM,G.MOMMA);this.addInner(r,i)}getWrappers(){return[this.wrapInner(G.MOM,1),this.wrapInner(G.MOMMA,2)]}},IS=class extends J{constructor(e,t){super(e,t);let n=HD(t);this.addInner(n)}calculateAt(e){let t=null,n=this.period+1;if(this.atLeast(e,n)){let r=this.past(e,n,G.TP,this.innCont(1)),i=this.past(e,n,G.Volume).map(e=>e??0);if(k(r)&&k(i)){let e=0,a=0;for(let t=1;t<n;++t){let n=r[t]*i[t];r[t]>r[t-1]?e+=n:a+=n}t=100-100/(1+e/a)}}return{[this.target.id]:t}}},LS=class extends J{constructor(e,t){super(e,t),rO(this);let n=Y(t,this.inputs.Period,this.source);this.addInner(n)}calculateAt(e){let t=null,[n,r]=iO(this),i=this.innVal(n+1,G.MA,e);if(i!==null){let n=this.inputs.Period,a=this.past(e,n,this.source,r);a=a.map(e=>(e-i)*(e-i)),t=Math.sqrt(me(a))}return{[this.target.id]:t}}getWrappers(){let[e]=iO(this);return[this.wrapInner(G.MA,e+1)]}},RS={isNegative:!1,fields:[G.PVI,G.PVIEMA]},zS={isNegative:!0,fields:[G.NVI,G.NVIEMA]},BS=class extends J{kind;constructor(e,t,n){super(e,n),this.kind=t;let r=Z(this.kind.fields[0],se(function(e,t){let n=1e3;if(t>0){let r=[G.Close,G.Volume],[i,a]=r.map(e=>this.baseVal(e,t)),[o,s]=r.map(e=>this.baseVal(e,t-1)),c=this.container.getData(this.target)[t-1];n=(e?a<s:a>s)?c*((i-o)/o+1):c}return{[this.target.id]:n}},this.kind.isNegative),n),i=X(r,this.inputs.Period,this.kind.fields[0],this.kind.fields[1]);this.addInner(r,i)}getWrappers(){return[this.wrapInner(this.kind.fields[0],1),this.wrapInner(this.kind.fields[1],2)]}},VS=class extends BS{constructor(e,t){super(e,zS,t)}},HS=class extends BS{constructor(e,t){super(e,RS,t)}},US=q(`_PRICE_CHANGE`),WS=class extends J{constructor(e,t){super(e,t);let n=this.source??G.Close,r=Math.sqrt(dO(e.aggregation)),i=e.inputs.Calculation===`Absolute`;if(r===0){let e=Z(this.target,(e,t)=>null,t);this.addInner(e)}else{let a=function(e,t){let n=null;if(t>0){let r=this.baseVal(e,t),a=this.baseVal(e,t-1);r!==null&&a!==null&&(n=i?r-a:Math.log(r/a))}return{[US.id]:n}},o=function(e,t){let n=null,r=this.baseVal(G.MSD,t);return r!==null&&(n=(i?1:100)*r*e),{[G.HV.id]:n}},s=KD(Z(US,se(a,n),t),e.inputs.Period,US,G.MSD),c=Z(G.HV,se(o,r),s);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}},GS=class extends J{noOp;constructor(e,t){super(e,t);let n=this.inputs.Anchor===`VisibleStart`;this.noOp=n}calculateAt(e){let t=null,n=this.baseVal(this.source,0),r=this.baseVal(this.source,e);return this.noOp?t=r:n!==null&&r!==null&&(t=(r-n)/n*100),{[this.target.id]:t}}},KS=q(`_SWING_INDEX`),qS=class extends J{constructor(e,t){super(e,t)}get helpers(){return[KS]}ohlcVals(e){return[G.Open,G.High,G.Low,G.Close].map(t=>this.baseVal(t,e))}obtainR(e,t,n,r){let i=Math.abs(e-r),a=Math.abs(t-r),o=Math.abs(e-t),s=Math.max(i,a,o),c=.25*Math.abs(r-n);return s===i?i-.5*a+c:s===a?a-.5*i+c:o+c}calculateAt(e){let t=null,n=null;if(e>0){let r=this.container.getData(KS)[e-1];P(r)||(r=0);let[i,a,o,s]=this.ohlcVals(e),[c,l,u,d]=this.ohlcVals(e-1);if(k([i,a,o,s,c,d])){let e=Math.max(Math.abs(a-d),Math.abs(o-d)),l=this.inputs.Limit,u=this.obtainR(a,o,c,d);t=50*((s-d+.5*(s-i)+.25*(d-c))/u)*(e/l),n=r+t}}return{[KS.id]:t,[this.target.id]:n}}},JS=q(`_MIN_CLOSE`),YS=q(`_MAX_CLOSE`),XS=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period);this.addInner(n)}get helpers(){return[YS,JS]}calculateAt(e){let t=null,n=null,r=null,i=null,a=this.innVal(1,G.ATR,e);if(a!==null){let o=this.baseVal(G.Close,e),s=this.baseVal(G.Close,e-1),c=this.period;r=Math.max(...this.past(e,c,G.Close)),i=Math.min(...this.past(e,c,G.Close));let l=a*this.inputs.Constant;if(this.innVal(1,G.ATR,e-1)===null)o>s?t=r-l:n=i+l;else{let[a,s,c,u]=[G.WWVSARU,G.WWVSARD,YS,JS].map(t=>this.container.getData(t)[e-1]);r=c,i=u,a===null?o>s?(r=o,t=o-l):(i=Math.min(o,i),n=i+l):o<a?(i=o,n=o+l):(r=Math.max(o,r),t=r-l)}}return{[YS.id]:r,[JS.id]:i,[G.WWVSARU.id]:t,[G.WWVSARD.id]:n}}},ZS=q(`_EP`),QS=q(`_AF`),$S=q(`_POS`),eC=1,tC=-1,nC=class extends J{constructor(e,t){super(e,t)}get helpers(){return[ZS,QS,$S]}hlcVals(e){return[G.High,G.Low,G.Close].map(t=>this.baseVal(t,e))}me(e,t){return this.container.getData(e)[t]}reciprocal(e){return 1/e}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null;if(e>0){let[s,c,l]=this.hlcVals(e),[u,d,f]=this.hlcVals(e-1),p=this.reciprocal(this.inputs.Acceleration),m=this.reciprocal(this.inputs.Limit);if(e===1){a=l>f?eC:tC;let e=a===eC;o=e?d:u,r=e?Math.max(s,u):Math.min(c,d),i=p,e?t=o:n=o}else{let[l,f,h,g,_]=[$S,G.PARSARS,G.PARSARL,ZS,QS].map(t=>this.me(t,e-1)),v=l===eC,y=v?h:f,b=_*Math.abs(g-y);a=v?y+b>c?tC:eC:y-b<s?eC:tC;let x=l===a;o=x?v?Math.min(y+b,d,this.baseVal(G.Low,e-2)):Math.max(y-b,u,this.baseVal(G.High,e-2)):g,r=x?v?Math.max(s,g):Math.min(c,g):a===eC?s:c,i=_,x?(v?r>g:r<g)&&_<m&&(i=_+p):i=p,a===eC?t=o:n=o}}return{[ZS.id]:r,[QS.id]:i,[$S.id]:a,[G.PARSARS.id]:n,[G.PARSARL.id]:t}}},rC=class extends J{xSum;xSum2;x2Sum;constructor(e,t){super(e,t);let n=this.period;this.xSum=n*(n+1)/2,this.xSum2=this.xSum*this.xSum,this.x2Sum=n*(n+1)*(2*n+1)/6}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,this.source);if(k(r)){let e=pe(r),i=(n*pe(r.map((e,t)=>e*(t+1)))-this.xSum*e)/(n*this.x2Sum-this.xSum2);t=(e-i*this.xSum)/n+i*n}}return{[this.target.id]:t}}},iC=q(`_IDY`),aC=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],oC=e=>Array(e).fill(0);function sC(e,t){return fC(e,t,10)}function cC(e,t){return fC(e,t,13)}function lC(e,t){return fC(e,t,16)}function uC(e,t){return fC(e,t,4)}function dC(e,t){return fC(e,t,7)}function fC(e,t,n){let r=e[n-1];return t===0&&(r=e[n]),t<0&&(r=e[n+1]),r}function pC(e,t,n,r,i){let a=i[18],o=r+1,s=0;for(let n=0;n<a;++n){let n=0,r=0;for(let i=1;i<6;++i){if(o--,e[o]==null)continue;let a=e[o]-t[o];i==1&&(n=r=a),a>n&&(n=a),a<r&&(r=a)}s=s+n-r}return s=s/a*uC(i,n[r]),s}function mC(e,t,n,r,i){let a=r,o=dC(i,n[r]),s=0;do a--,e[a]!=null&&s++;while(s<o&&a>0);return t[r]-t[a]}function hC(e,t,n,r,i,a){let o=n;do o--;while(e[o]==null);return t[n]=t[o],e[n]>i&&t[o]<=0&&(t[n]=t[o]+1),e[n]<r&&t[o]>=0&&(t[n]=t[o]-1),a++,t[n]!==t[o]&&(a=1),a}function gC(e,t,n,r,i,a,o,s,c,l){let u=sC(i,n[r]),d=cC(i,n[r]),f=lC(i,n[r]),p=c+l+t[r]-e[r],m=100;i[20]>0&&(m=i[20]);let h=u*s/m;s>d&&(h=u*d/m);let g=l*2,_=e[r]+(p-g)-(p-g)*h,v=e[r]+(p-p*h),y=[a,o];return(s===1||f!==1||_>a)&&(y[0]=_),(s===1||f!==1||v<o)&&(y[1]=v),y}function _C(e,t,n){let r=0,i=-1,a=0,o=1;for(let s=0;s<n;++s){if(t[s]=0,e[s]==null||(r++,r==21&&(o=2),r==31&&(o=3),a+=e[s]*o,r<40))continue;t[s]=a/70;let c=0,l=i+1;for(let t=l;t<n&&!(e[t]!=null&&(c++,c==1&&(i=t),(c==1||c==21||c==31)&&(a-=e[t]),c==31));++t);}}var vC=class extends J{haveEnoughData=!1;firstUsefulIndex=0;s3;itr;constructor(e,t){super(e,t),this.s3=this.itr=[];let n=[`VelocityUpTrend`,`VelocitySideTrend`,`VelocityDownTrend`].map(t=>e.inputs[t]||`3`).map(Number);aC.splice(6,3,...n)}get helpers(){return[iC]}prepareComputation(){let e=this.base.getData(G.Close),t=0,n=0,r=e.length;for(;n<72&&t<r;)e[t]!=null&&n++,t++;this.haveEnoughData=t<r,this.firstUsefulIndex=t,this.s3=oC(r),this.itr=oC(r),this.haveEnoughData&&_C(e,this.s3,r)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,n){let r=this.base.getData(G.Close),i=r.length;this.haveEnoughData&&_C(r,this.s3,i),super.recalculateAt(e,t,n)}calculateAt(e){let t=null,n=null,r=null,i=t=>this.us(t,e-1);if(e===0)this.prepareComputation();else if(this.haveEnoughData&&e>=this.firstUsefulIndex&&this.baseVal(G.Close,e)!==null){let a=i(G.TRSP1),o=i(G.TRSP2);r=i(iC),a===null&&o===null&&(a=o=this.baseVal(G.Close,this.firstUsefulIndex)),r===null&&(r=1);let s=this.base.getData(G.Close);r=hC(s,this.itr,e,a,o,r);let c=mC(s,this.s3,this.itr,e,aC),l=pC(s,this.s3,this.itr,e,aC);[a,o]=gC(s,this.s3,this.itr,e,aC,a,o,r,c,l),this.itr[e]>=0&&(t=a),this.itr[e]<=0&&(n=o)}return{[iC.id]:r,[G.TRSP1.id]:t,[G.TRSP2.id]:n}}},yC=class extends J{constructor(e,t){super(e,t),this.addInner(HD(t))}get helpers(){return[G.BARCOLIX]}getTarget(e){let t=this.baseVal(G.Close,e),n=this.innVal(1,G.TP,e);if(!P(t,n)||!this.atLeast(e,4))return null;let r=this.innVal(1,G.TP,e-3);return r===null?null:t+(n-r)/3}calculateAt(e){let t=null,n=this.getTarget(e);if(n!==null&&e>0){let r=this.container.getData(G.TARGP)?.[e-1];r!==null&&(t=n===r?this.container.getData(G.BARCOLIX)?.[e-1]??1:+(n>r))}return{[G.TARGP.id]:n,[G.BARCOLIX.id]:t}}},bC=1,xC=2,SC=3,CC={[bC]:{param:`cot`,func:`parseCotLineChart`,fields:[G.DateTime,G.COTLCCMSP,G.COTLCLGSP,G.COTLCSMSP]},[xC]:{param:`cotadv`,func:`parseDisaggregated`,fields:[G.DateTime,G.COTDAGPRO,G.COTDAGSPD,G.COTDAGMNM,G.COTDAGOTH]},[SC]:{param:`cotfin`,func:`parseFinancialTradersReport`,fields:[G.DateTime,G.COTFTRDLI,G.COTFTRASM,G.COTFTRLVF,G.COTFTROTH]}},wC=class extends J{wrappers;constructor(e,t,n){super(e,ob(n,e=>new TC(t,e))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=CC[t].fields.slice(1).map(e=>this.wrapInner(e,0))}getWrappers(){return this.wrappers}},TC=class extends h_{kind;constructor(e,t){super(t),this.kind=e}getRetriever(){return new EC(this.kind)}onStreamingUpdates(e){}},EC=class extends Bg{kind;constructor(e){super(),this.kind=e}addExtraParams(e){e[CC[this.kind].param]=`y`}getParser(e){return new DC(e.symbol,e.aggregation,e.offset,this.kind)}},DC=class extends Fg{kind;constructor(e,t,n,r){super(e,t,n),this.kind=r}makeContainer(){return new _g(CC[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[CC[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(G.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(G.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(G.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(G.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(G.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(G.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(G.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(G.COTFTROTH,parseInt(e[5]))}},OC=class extends wC{constructor(e,t){super(e,bC,t)}},kC=class extends wC{constructor(e,t){super(e,xC,t)}},AC=class extends wC{constructor(e,t){super(e,SC,t)}},jC={Day:[G.PreviousHigh,G.PreviousLow,G.PreviousClose],Week:[G.WeekPreviousHigh,G.WeekPreviousLow,G.WeekPreviousClose],Month:[G.MonthPreviousHigh,G.MonthPreviousLow,G.MonthPreviousClose]},MC=class extends J{disabled;record;streamingSubscription;constructor(e,t,n){if(super(e,n),this.disabled=!P(n.query)||!P(n.query.symbol),!this.disabled){let e=n.query.symbol;e.endsWith(`.BZ`)&&(e=e.slice(0,-3)),this.record=$().getRecordSource().getRecord(e),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()}this.initialNotification=!0}getStreamingSubscription(){return $().getRecordSource().subject.pipe(jm(e=>{let t=np(K.RT_QUOTE,this.record.symbol);return e.filter(t)}),Pm(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return da.call(this,async()=>P(this.record)?await this.record.ready()&&await super.ready():await super.ready(),`asyncReadyWork2`)}onStreamingUpdates(e){if(this.record){let e={tag:bt(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return jC[e].map(e=>this.record.getValue(e))}},NC=class extends MC{constructor(e,t){super(e,jC[e.inputs.Previous],t)}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=null;if(!this.disabled){let e=this.getValues(this.inputs.Previous);if(k(e)){let[c,l,u]=e;t=(c+l+u)/3;let d=2*t;n=d-l,r=d-c;let f=c-l;i=t+f,a=t-f,o=c+2*(t-l),s=l-2*(c-t)}}return{[G.PPTPIV.id]:t,[G.PPTR1.id]:n,[G.PPTR2.id]:i,[G.PPTR3.id]:o,[G.PPTS1.id]:r,[G.PPTS2.id]:a,[G.PPTS3.id]:s}}},PC=class extends MC{constructor(e,t){super(e,jC.Day,t)}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=null,c=null;if(!this.disabled){let e=this.getValues(`Day`);if(k(e)){let[l,u,d]=e,f=l-u,[p,m,h,g]=[2,4,6,12].map(e=>1.1/e*f);s=d+p,a=d+m,r=d+h,t=d+g,n=d-g,i=d-h,o=d-m,c=d-p}}return{[G.CPPH4.id]:s,[G.CPPH3.id]:a,[G.CPPH2.id]:r,[G.CPPH1.id]:t,[G.CPPL1.id]:n,[G.CPPL2.id]:i,[G.CPPL3.id]:o,[G.CPPL4.id]:c}}},FC=class extends J{constructor(e,t){super(e,sb(t,G.IMPVOL,e=>new IC(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(G.IMPVOL,0)]}},IC=class extends h_{constructor(e){super(e)}getRetriever(){return Ti(this.query.symbol)?new BC:new LC}onStreamingUpdates(e){}},LC=class extends Bg{addExtraParams(e){e.impl=`y`}getParser(e){return new zC(e.symbol,e.aggregation,e.offset)}};function RC(){return new _g([G.DateTime,G.IMPVOL])}var zC=class extends Fg{constructor(e,t,n=0){super(e,t,n)}makeContainer(){return RC()}getParseFunc(){return this.parseImpVol}parseImpVol(e){!this.aggregation.isEndOfDay||e.length<9||(this.container.addDataPoint(G.DateTime,this.parseDate(e[1])),this.container.addDataPoint(G.IMPVOL,parseFloat(e[8])))}},BC=class extends Hg{emptyContainer(e,t){return RC()}get iterateForward(){return!1}getPageName(){return`getFuturesOptionsHistory`}processRow(e,t,n){n.addDataPoint(G.DateTime,ug(e.date.substring(0,10)));let r=N(e.impliedVolatility);n.addDataPoint(G.IMPVOL,r?e.impliedVolatility*100:null)}},VC=q(`_ABS_CHG`),HC=q(`_DS1_EMA1`),UC=q(`_DS1_EMA2`),WC=q(`_DS2_EMA1`),GC=q(`_DS2_EMA2`),KC=class extends J{constructor(e,t){super(e,t);let n=(e,t,n,r,i,a)=>X(X(e,t,n,r),i,r,a),r=Z(VC,se((e,t)=>({[e.id]:Math.abs(this.baseVal(G.Change,t))}),VC),t),i=n(t,e.inputs.Period1,G.Change,HC,e.inputs.Period2,UC),a=n(r,e.inputs.Period1,VC,WC,e.inputs.Period2,GC),o=Q(G.TSI,(e,t,n)=>100*t/n,i,a),s=X(o,e.inputs.Period3,G.TSI,G.TSISIG);this.addInner(o,s)}getWrappers(){return[this.wrapInner(G.TSI,1),this.wrapInner(G.TSISIG,2)]}},qC=class extends J{constructor(e,t){super(e,t);for(let n=1;n<=12;++n){let r=pO(e.inputs,n);this.addInner(X(t,r,G.Close,e.outFields[n-1]))}}getWrappers(){return he(1,12).map(e=>this.wrapInner(this.outFields[e-1],e))}},JC=class extends J{constructor(e,t){super(e,t);let n=X(t,this.inputs.Period,G.Close);this.addInner(n)}calculateAt(e){let t=null,n=e>0?this.container.getData(this.target)[e-1]:null,r=this.innVal(1,G.EMA,e);if(!N(n))t=r;else{let i=this.baseVal(this.source,e),a=(i/n)**4;t=n+(i-n)/(.6*this.period*a);let o=e=>Math.log10(Math.abs(e-t))>1,s=o(n)||o(r);(!Number.isFinite(t)||s)&&(t=null)}return{[this.target.id]:t}}},YC=q(`_DIFF`),XC=class extends J{constructor(e,t){super(e,t);let n=this.inputs.Period,r=Math.floor(n/2),i=this.allowEmptyValues,a=jD(Q(YC,(e,t,n)=>2*t-n,jD(t,r,this.source,G.WMA,i),jD(t,n,this.source,G.WMA,i)),Math.floor(Math.sqrt(n)),YC,this.target,i);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},ZC=q(`_SUM`),QC=class extends J{constructor(e,t){super(e,t);let n=jD(Q(ZC,(e,t,n)=>t+n,UD(t,this.inputs.PeriodRocLong),UD(t,this.inputs.PeriodRocShort)),this.inputs.PeriodWma,ZC,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},$C=q(`_ABS_CHG`),ew=q(`_HH_LL`),tw=q(`_MULMA`),nw=class extends J{constructor(e,t){super(e,t);let n=e.inputs.TurtleChnField===`Close`,r=e.inputs.Direction===`Long`,i=fO(t);if(!n&&i){let e=Z(this.target,(e,t)=>null,t);this.addInner(e)}else{let e=Y(Z($C,se((e,t)=>({[$C.id]:t>0?e*Math.abs(this.baseVal(G.Change,t)):null}),this.inputs.FactorATR),t),this.inputs.PeriodAdjATR,$C,G.MA),i=r?G.High:G.Low,a=PD(t,this.inputs.PeriodTurtleChn,n?G.Close:i,ew,r),o=Q(tw,(e,t)=>this.inputs.FactorAdjATR*t,e),s=r?-1:1,c=Q(this.target,(e,t,n)=>t+s*n,a,o);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}},rw=class extends J{state;constructor(e,t){super(e,t),this.resetState()}resetState(){let e=this.inputs.ExtendLines??`None`;this.state={startIndex:null,endIndex:null,slope:null,intercept:null,stdDevWidth:null,extendLeft:e===`Left`||e===`Both`,extendRight:e===`Right`||e===`Both`}}calculateAt(e){let t=this.inputs.Period,n=this.inputs.Width,r=this.source;if(e===this.base.size-1&&this.base.size>=t){this.resetState();let e=t*(t+1)/2,i=e*e,a=t*(t+1)*(2*t+1)/6,o=0,s=0,c=1,l=this.base.size-t;for(let e=0;e<t;++e){let t=this.baseVal(r,l+e);if(!Ze(t))return{};o+=t,s+=c*t,c+=1}let u=(t*s-e*o)/(t*a-i),d=o/t-u*e/t;if(!Ze(u)||!Ze(d))return{};let f=0;for(let e=0;e<t;++e){let t=this.baseVal(r,l+e);if(!Ze(t))return{};let n=t-(d+u*(e+1));f+=n*n}let p=Math.sqrt(f/t);if(!Ze(p))return{};this.state.startIndex=l,this.state.endIndex=this.base.size-1,this.state.slope=u,this.state.intercept=d,this.state.stdDevWidth=n*p}return{}}getCurrentState(){return this.state}},iw=class extends J{computeDone;constructor(e,t){super(e,t,ob(t,e=>{let t=F(e);return t.symbol=Mi(e.symbol),P(t.symbol)?new h_(t):new __(t,!0)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){let e=this.innCont(0);if(!P(e)||e.size===0)return;let t=this.innCont(1),n=e.getTimeData(),r=t.getTimeData(),i=t.getData(G.Close),a=Array(n.length).fill(null);if(!(this.innerSeries[1]instanceof __)){let o=0,s=e.size,c=t.size;for(let e=0;e<s;++e){for(;o<c&&r[o].getTime()<n[e].getTime();)o++;o<c&&r[o].getTime()===n[e].getTime()&&(a[e]=i[o])}}this.container.setData(this.target,a)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignCashTimelineWithUnderlying(),this.computeDone=!0,this.notify(K.TS_MANYCHANGED,-1))}},aw=class extends J{constructor(e,t){let n=JD(t);super(e,t,n)}shouldTriggerOurRecalc(e){return super.shouldTriggerOurRecalc(e)?!0:e===this.innerSeries[1]&&this.innHasData(0)&&this.innHasData(1)}calculateAt(e){let t=(t,n)=>P(this.innCont(t))?this.innVal(t,n,e):null,n=t(0,G.Close),r=t(1,G.CSHO);return{[this.target.id]:P(r)&&P(n)?r-n:null}}},ow=class extends J{computeDone;constructor(e,t){super(e,t,ob(t,e=>{let t=new Qy(e.symbol,new Ru(e.aggregation.unit===g.Year?g.Year:g.Quarter,1),w.BalanceSheet);return t.fields=[G.SharesOutstanding],t.cacheMe=!0,new b_(t)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignFundamentalTimelineWithUnderlying(){let e=this.innCont(0);if(!P(e)||e.size===0)return;let t=this.innCont(1);if(!P(t)||t.size===0)return;let n=e.getTimeData(),r=t.getTimeData(),i=t.getData(G.SharesOutstanding),a=e.getData(G.Close),o=Array(n.length),s=0,c=e.size,l=t.size;for(let e=0;e<c;++e){let t=n[e].getTime();for(;s<l-1&&r[s+1].getTime()<=t;)s++;if(s<l&&r[s].getTime()<=t){let t=i[s],n=a[e];o[e]=P(t,n)?t*n:null}}this.container.setData(this.target,o)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignFundamentalTimelineWithUnderlying(),this.computeDone=!0,this.notify(K.TS_MANYCHANGED,-1))}},sw=class extends J{constructor(e,t){super(e,t),rO(this)}calculateAt(e){let t=null,[n]=iO(this);if(e>0){let r=this.innVal(n,this.source,e-1);r!==null&&(t=100*(this.innVal(n,this.source,e)-r)/r)}return{[this.target.id]:t}}},cw=class extends cb{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=[null,null,null,null,null];if(e>0){let n=(e,t)=>this.baseVal(e,t),r=[G.Open,G.High,G.Low,G.Close],i=r.map(t=>n(t,e));if(k(i)){let a=r.map(t=>n(t,e-1));if(k(a)){t=i.map((e,t)=>100*(e-a[t])/a[t]);let[n,r]=Ee(t);if(t[1]=r,t[2]=n,e>1){let n=this.container.getData(G.Close)[e-1];t[4]=t[3]-n}}}}return{[G.Open.id]:t[0],[G.High.id]:t[1],[G.Low.id]:t[2],[G.Close.id]:t[3],[G.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(G.Volume,G.OpenInterest,G.TradingDay)}},lw=q(`_DIST`),uw=q(`_EMA_DIST1`),dw=q(`_EMA_DIST2`),fw=q(`_DIFF`),pw=q(`_EMA_DIFF1`),mw=q(`_EMA_DIFF2`),hw=class extends J{constructor(e,t){super(e,t);let n=PD(t,e.inputs.Period1,G.High,G.HH,!0),r=PD(t,e.inputs.Period1,G.Low,G.LL,!1),i=X(X(Q(lw,(e,t,n)=>this.baseVal(G.Close,e)-(t+n)/2,n,r),e.inputs.Period2,lw,uw),e.inputs.Period2,uw,dw),a=X(X(Q(fw,(e,t,n)=>t-n,n,r),e.inputs.Period2,fw,pw),e.inputs.Period2,pw,mw),o=Q(G.STOMOMIX,(e,t,n)=>100*t/n,i,a);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},gw=q(`_CHG`),_w=q(`_M1`),vw=q(`_M2`),yw=class extends J{constructor(e,t){super(e,t);let n=Z(gw,function(e){let t=G.Close,n=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[gw.id]:n}},t),r=(e,t)=>t>=0?t:0,i=(e,t)=>t>=0?0:-t,a=Q(_w,r,n),o=Q(vw,i,n);this.addInner(a,o)}perc(e,t){return 100*e/t}calculateAt(e){let t=null,n=this.period;if(this.atLeast(e,n+1)){let r=this.past(e,n,_w,this.innCont(1)),i=this.past(e,n,vw,this.innCont(2));if(k(r)&&k(i)){let e=pe(r),n=pe(i);t=this.perc(e-n,e+n)}}return{[G.CHDMOMOSC.id]:t}}},bw=class extends J{constructor(e,t){super(e,t);let n=new yw(e,t),r=cO(e,`MA`,`Average`),i=this.inputs.PeriodAvg,a=r(n,i,G.CHDMOMOSC,G.CHDMOMOSCAVG);this.addInner(n,a)}getWrappers(){return[this.wrapInner(G.CHDMOMOSC,1),this.wrapInner(G.CHDMOMOSCAVG,2)]}},xw=q(`_MAX`),Sw=q(`_MIN`),Cw=q(`_ISUPTREND`),ww=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period);this.addInner(n)}get helpers(){return[xw,Sw,Cw]}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=1,c=this.baseVal(G.Close,e),l=(e,t)=>P(e)?e:t,u=e=>l(e,0),d=(e,t)=>this.container.getData(e)[t];e>0&&(r=Math.max(u(d(xw,e-1)),c),a=Math.min(u(d(Sw,e-1)),c),s=d(Cw,e-1));let f=this.inputs.Multiplier,p=this.innVal(1,G.ATR,e);if(P(p)){let l=s===1,u=l?r-f*p:a+f*p,m=d(l?G.VSTOPUP:G.VSTOPLOW,e-1);P(m)||(m=0);let h=l?Math.max(m,u):Math.min(m,u);o=+(c-h>=0);let g=o!=s;n=g?c:r,i=g?c:a,t=g?o===1?n-f*p:i+f*p:h}return{[G.VSTOPUP.id]:o===1?t:null,[G.VSTOPLOW.id]:o===1?null:t,[xw.id]:n,[Sw.id]:i,[Cw.id]:o}}},Tw=q(`_TRENDUP`),Ew=q(`_TRENDDOWN`),Dw=q(`_TREND`),Ow=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period);this.addInner(n)}get helpers(){return[Tw,Ew,Dw,G.BARCOLIX]}calculateAt(e){let t=0,n=0,r=0,i=null,a=0,o=this.innVal(1,G.ATR,e);if(P(o)){let s=(e,t)=>P(e)?e:t,[c,l,u]=[G.Close,G.High,G.Low].map(t=>this.baseVal(t,e)),d=(l+u)/2,f=this.baseVal(G.Close,e-1),p=this.inputs.Multiplier,m=d-p*o,h=d+p*o,[g,_,v]=[Tw,Ew,Dw].map(t=>this.container.getData(t)[e-1]);t=f>g?Math.max(m,g):m,n=f<_?Math.min(h,_):h,r=c>_?1:c<g?-1:s(v,1);let y=r===1;i=y?t:n,a=+!!y}return{[Tw.id]:t,[Ew.id]:n,[Dw.id]:r,[G.SUPTR.id]:i,[G.BARCOLIX.id]:a}}},kw=class extends J{constructor(e,t){super(e,t);let n=e=>PD(t,e,G.Low,G.LL,!1),r=e=>PD(t,e,G.High,G.HH,!0),i=(e,t,n)=>Q(n,(e,t,n)=>(t+n)/2,e,t),a=(e,t)=>i(n(e),r(e),t),o=a(e.inputs.PeriodConversionLine,G.CONVLN),s=a(e.inputs.PeriodBaseLine,G.BASELN),c=i(o,s,G.LEADSP1),l=a(e.inputs.PeriodLaggingSpan2,G.LEADSP2);this.addInner(o,s,c,l)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=+(this.innVal(3,G.LEADSP1,e)>this.innVal(4,G.LEADSP2,e));return{[G.LAGGSP.id]:this.baseVal(G.Close,e),[G.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(G.CONVLN,1),this.wrapInner(G.BASELN,2),this.wrapInner(G.LEADSP1,3),this.wrapInner(G.LEADSP2,4)]}},Aw=q(`_CUM_PRICE`),jw=q(`_CUM_VOL`),Mw=q(`_PER_CHG`),Nw=class extends J{constructor(e,t){super(e,t);let n=this.source,r=Z(n,se(aO,n),t);this.addInner(r)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}},Pw=class extends Nw{constructor(e,t){super(e,t)}get helpers(){return[Aw,jw,Mw]}isSame(e,t){switch(this.inputs.AnchorPeriod){case`Session`:default:return Nn(e,t);case`Week`:return li(e,t);case`Month`:return di(e,t);case`Quarter`:return fi(e,t);case`Year`:return pi(e,t);case`Decade`:return og(e,t);case`Century`:return sg(e,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(this.valueAt(Mw,t)===1)return t;return 0}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=e>0,s=o?this.dateAt(e-1):B.ZERO_DATE,c=this.dateAt(e),l=o&&this.isSame(s,c),u=l?this.valueAt(Aw,e-1):0,d=l?this.valueAt(jw,e-1):0,f=this.innVal(0,G.Volume,e),p=u+this.innVal(1,this.source,e)*f,m=d+f;if(t=p/m,l){let o=this.findPrevPeriodChange(e-1),s=this.container.getData(G.VWAP).slice(o,e);s.push(t);let c=me(s),l=s.map(e=>(e-c)*(e-c)),u=Math.sqrt(me(l)),d=this.inputs.Stdev1stMultiplier*u;n=t+d,r=t-d;let f=this.inputs.Stdev2ndMultiplier*u;i=t+f,a=t-f}else n=t,r=t,i=t,a=t;return{[Aw.id]:p,[jw.id]:m,[Mw.id]:+!l,[G.VWAP.id]:t,[G.VWAPSD1U.id]:n,[G.VWAPSD1L.id]:r,[G.VWAPSD2U.id]:i,[G.VWAPSD2L.id]:a}}},Fw=class extends Nw{constructor(e,t){super(e,t)}get helpers(){return[Aw,jw]}isSameOhlcBar(e,t){let{unit:n,size:r}=this.aggregation;switch(n){case g.Tick:return e===t;case g.Intraday:return ai(t,Sn(e,r));case g.Day:return ai(t,un(e,r));case g.Week:return li(e,t);case g.Month:return di(e,t);case g.Quarter:return fi(e,t);case g.Year:return pi(e,t);default:throw Error(`Unexpected aggregation unit ${g[n]}`)}}calculateAt(e){let t=null,n=null,r=null,i=this.inputs.Anchor,a=this.dateAt(e);if(ai(i,a)||this.isSameOhlcBar(a,i)){let i=e>0,a=i?this.valueAt(Aw,e-1):0,o=i?this.valueAt(jw,e-1):0,s=this.innVal(0,G.Volume,e);n=a+this.innVal(1,this.source,e)*s,r=o+s,t=n/r}return{[Aw.id]:n,[jw.id]:r,[G.AVWAP.id]:t}}},Iw=q(`_DIFF`),Lw=[Iw,G.BARCOLIX],Rw=[...Lw,G.Buy,G.Sell];function zw(e){return e.ShowSignals!==`No`}function Bw(e,t,n,r,i){let a=null,o=null,s=null,c=null;P(n,r)&&(s=n-r);let l=t>0?e.getData(Iw)[t-1]:null,u=t>0?e.getData(G.BARCOLIX)[t-1]:null;i&&P(s,l)&&(a=s>0&&l<=0?1:null,o=s<0&&l>=0?-1:null),P(s)&&(c=s>0?1:s<0?0:u);let d={[Iw.id]:s,[G.BARCOLIX.id]:c};return i&&(d[G.Buy.id]=a,d[G.Sell.id]=o),d}var Vw=class extends J{_showSignals;constructor(e,t){super(e,t),this._showSignals=zw(e.inputs)}get helpers(){return this._showSignals??zw(this.inputs)?Rw:Lw}calculateDiff(e,t,n,r){return Bw(e,t,n,r,this._showSignals)}},Hw=class extends Vw{constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=n(t,e.inputs.Period1,this.source,G.MAS),i=n(t,e.inputs.Period2,this.source,G.MAL);this.addInner(r,i)}calculateAt(e){let t=this.innVal(1,G.MAS,e),n=this.innVal(2,G.MAL,e);return this.calculateDiff(this.container,e,t,n)}getWrappers(){return[this.wrapInner(G.MAS,1),this.wrapInner(G.MAL,2)]}},Uw=class extends Vw{_maIndex;_maTarget;constructor(e,t){super(e,t),rO(this);let n=cO(e,`MA`,`Average`)(t,e.inputs.Period,this.source);this.addInner(n);let[r]=iO(this);this._maIndex=r+1,this._maTarget=n.target}calculateAt(e){let t=this.innVal(this._maIndex,this._maTarget,e),[,n]=iO(this),r=n.getData(this.source)[e],i=this.calculateDiff(this.container,e,r,t);return i[this.target.id]=t,i}},Ww=q(`_PVM`),Gw=q(`_NVM`),Kw=class extends J{constructor(e,t){super(e,t);let n=function(e){return{[Ww.id]:e>0?Math.abs(this.baseVal(G.High,e)-this.baseVal(G.Low,e-1)):null}},r=function(e){return{[Gw.id]:e>0?Math.abs(this.baseVal(G.Low,e)-this.baseVal(G.High,e-1)):null}},i=Z(Ww,n,t),a=Z(Gw,r,t),o=RD(t,G.TR);this.addInner(i,a,o)}calculateAt(e){let t=null,n=null,r=this.period;if(this.atLeast(e,r)){let i=this.past(e,r,Ww,this.innCont(1)),a=this.past(e,r,Gw,this.innCont(2)),o=this.past(e,r,G.TR,this.innCont(3));if(k(i)&&k(a)&&k(o)){let e=pe(i),r=pe(a),s=pe(o);t=e/s,n=r/s}}return{[G.PLVI.id]:t,[G.MNVI.id]:n}}},qw=q(`_AVG`),Jw=class extends J{isPercent;constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=this.period,i=n(t,r,this.source,qw);this.isPercent=e.inputs.Distance===`Percentage`,this.addInner(i)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=null,n=null,r=this.innVal(1,qw,e),i=this.baseVal(this.source,e);if(r!=null&&r!==0){t=i-r,this.isPercent&&(t=100*t/r);let a=t<=0;if(n=a?1:3,e>0){let r=this.container.getData(this.target)[e-1];r!==null&&(a&&t>r&&(n=0),!a&&t<r&&(n=2))}}return{[this.target.id]:t,[G.BARCOLIX.id]:n}}},Yw=class extends J{constructor(e,t){super(e,t);let n=X(X(WD(t,this.inputs.PeriodRsi,this.source,G.RSI),this.inputs.PeriodEma1,G.RSI,G.EMA),this.inputs.PeriodEma2,G.EMA,G.EMA),r=Y(n,this.inputs.PeriodMa,G.EMA,G.MA),i=Q(G.DOSCH,(e,t,n)=>t-n,n,r),a=Y(i,this.inputs.PeriodSig,G.DOSCH,G.DOSCS);this.addInner(i,a)}getWrappers(){return[this.wrapInner(G.DOSCH,1),this.wrapInner(G.DOSCS,2)]}},Xw=class extends J{constructor(e,t){super(e,t);let n=this.inputs.Period,r=this.inputs.Increment,i=Math.min(Math.max(0,this.inputs.Count),10);for(let e=0;e<i;++e){let i=Y(t,n+e*r,this.source,this.outFields[e]);this.addInner(i)}}getWrappers(){let e=this.outFields,t=this.inputs.Count;return[this.wrapInner(e[0],1),this.wrapInner(e[1],2),this.wrapInner(e[2],3),this.wrapInner(e[3],4),this.wrapInner(e[4],5),this.wrapInner(e[5],6),this.wrapInner(e[6],7),this.wrapInner(e[7],8),this.wrapInner(e[8],9),this.wrapInner(e[9],10)].slice(0,t)}},Zw=q(`_HAO`),Qw=q(`_HAH`),$w=q(`_HAL`),eT=q(`_HAC`),tT=class extends J{constructor(e,t){super(e,t);let n=cO(e,`EMA`,`Smoothing1`),r=e.inputs.Period1,i=n(t,r,G.Open),a=n(t,r,G.High),o=n(t,r,G.Low),s=n(t,r,G.Close),c=Q(eT,(e,t,n,r,i)=>(t+n+r+i)/4,i,a,o,s);function l(e,t,n,r){let i=null;if(e>0){let r=this.container.getData(Zw)[e-1],a=this.innVal(2,eT,e-1);P(r,a)?i=(r+a)/2:P(t,n)&&(i=(t+n)/2)}return i}let u=Q(Zw,l,i,s,c),d=Q(Qw,(e,t,n,r)=>P(t,n,r)?Math.max(t,Math.max(n,r)):null,a,u,c),f=Q($w,(e,t,n,r)=>P(t,n,r)?Math.min(t,Math.min(n,r)):null,o,u,c),p=cO(e,`EMA`,`Smoothing2`),m=e.inputs.Period2,h=p(u,m,Zw,G.Open),g=p(d,m,Qw,G.High),_=p(f,m,$w,G.Low),v=p(c,m,eT,G.Close),y=Z(G.Change,function(e){let t=null;if(e>0){let n=this.baseVal(G.Close,e),r=this.baseVal(G.Close,e-1);P(n,r)?t=n-r:P(n)&&!P(r)&&(t=0)}return{[G.Change.id]:t}},v);this.addInner(h,g,_,v,y)}getWrappers(){return[this.wrapInner(G.Open,1),this.wrapInner(G.High,2),this.wrapInner(G.Low,3),this.wrapInner(G.Close,4),this.wrapInner(G.Change,5)]}},nT=q(`_DELTA`),rT=class extends J{constructor(e,t){super(e,t);let n=e.inputs,r=X(t,n.PeriodEmaKeltner,G.Close),i=zD(t,n.PeriodAtrKeltner);function a(e,t,n,r){return P(n,r)?n+e*r:null}let o=n.MultiplierKeltner,s=Q(G.KCUP,se(a,o),r,i),c=Q(G.KCLOW,se(a,-o),r,i),l=XD(t,n.PeriodBollinger,n.WidthBollinger),u=ZD(t,n.PeriodMomentum),d=Y(t,n.PeriodMomentum,G.Close);function f(e,t,n,r){let i=null,a=this.innVal(1,G.DONMID,e);return P(a,r)&&(i=t-(a+r)/2),i}let p=QD(Q(nT,f,t,u,d),n.PeriodMomentum,nT,G.TTMSQZOSC);this.addInner(s,c,l,p)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=null,n=null,r=-1,i=this.innVal(1,G.KCUP,e),a=this.innVal(2,G.KCLOW,e),[o,s]=[G.BOLLBU,G.BOLLBL].map(t=>this.innVal(3,t,e));o<i&&s>a?t=0:n=0;let c=this.innVal(4,G.TTMSQZOSC,e),l=e>0?this.innVal(4,G.TTMSQZOSC,e-1):null;if(P(c))if(!P(l))r=2;else{let e=c>=0,t=l<c;r=e?t?3:2:+!!t}return{[G.TTMSQZON.id]:t,[G.TTMSQZOFF.id]:n,[G.BARCOLIX.id]:r}}getWrappers(){return[this.wrapInner(G.TTMSQZOSC,4)]}},iT=e=>{let t=e.unit===g.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:d.Manual,missing:t?u.UseNext:u.UsePrevious,stretch:e=>!1,fieldMap:new Map([[G.Close,G.CRS]]),noDataApproach:f.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}},aT=class extends J{constructor(e,t){if(super(e,t),mO(t)){let n=$().getTimeSeriesDataSource(),r=t.query.duplicate();r.symbol=this.inputs.Symbol.toUpperCase();let i=n.getTimeSeries(r),a=e=>e.query?.symbol,{model:o}=yd(((e,t)=>`{${a(e)}} / {${a(t)}}`)(t,i),!1),s=iT(e.aggregation),c=new tb(o,[t,i],s),l=cO(e,`MA`,`Average`)(c,this.period,G.CRS,G.CRSAVG);this.addInner(i,c,l),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=Z(G.Close,(e,t)=>null,t),n=Z(G.CRS,(e,t)=>null,t),r=Z(G.CRSAVG,(e,t)=>null,t);this.addInner(e,n,r),this.canLoadMoreData=!1}}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[0].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}getWrappers(){return[this.wrapInner(G.DateTime,2),this.wrapInner(G.CRS,2),this.wrapInner(G.CRSAVG,3)]}},oT=q(`_DIFF`),sT=q(`_RANK`),cT=q(`_CHG`),lT=q(`_AVG`),uT=q(`_HBRAKE_CHG`),dT=q(`_HEIGHT_DELTA`),fT=q(`_ACTION`),pT=q(`_REVERSAL`),mT=200,hT=10,gT=e=>[e>0,e<0],_T=[null,null,null],vT={None:0,Hold:1,Take:2};function yT([e,t],n){let r=null;if(n>0){let t=this.baseVal(e,n-1);P(t)&&(r=this.baseVal(e,n)-t)}return{[t.id]:r}}var bT=class extends J{useHandbrake;constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=n(t,xt(1,999,this.inputs.FastPeriod),G.Close),i=xt(0,999,this.inputs.SlowPeriod),a=i>0,o=a?n(t,i,G.Close):t,s=Q(oT,a?(e,t,n)=>t-n:(e,t,n)=>n-t,r,o),c=Z(cT,se(yT,[G.Close,cT]),t),l=Z(sT,function(e){let t=Math.abs(this.baseVal(oT,e)),n=null,r=0,i=0;for(let n=e-1;n>=0&&r<mT;--n){let e=Math.abs(this.baseVal(oT,n));r++,e<t&&i++}return r>0&&(n=Math.floor(i/r*hT)),n===hT&&n--,{[sT.id]:n}},s),u=xt(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=u>0;let d=n(t,u,G.Close,lT),f=Z(uT,se(yT,[lT,uT]),d);this.addInner(c,s,l,f)}get helpers(){return[dT,G.BARCOLIX,fT,pT]}getStateAt(e){let t=this.innVal(2,oT,e);return P(t)?gT(t):_T}findPreviousKnownState(e){for(let t=e-1;t>0;t--){let e=this.getStateAt(t);if(e===_T)return _T;let[n,r]=e;if(n||r)return e}return _T}getBuySell(e){let t=this.getStateAt(e);if(t===_T)return _T;let[n,r]=t,i=this.findPreviousKnownState(e),[a,o]=i;if(!n&&!r)return i===_T?_T:[a,o,!1];let s=n!==a||r!==o;return s?[a,o,s]:[n,r,s]}getPrev(e,t){return t>0?this.container.getData(e)[t-1]:null}calculateAt(e){let t=null,n=null,r=0,i=-1,a=vT.None,[o,s,c]=this.getBuySell(e),[l,u]=[pT,fT].map(t=>this.getPrev(t,e)),[d,f]=[0,-1].map(t=>this.innVal(4,uT,e+t));if(i=c?hT:this.innVal(3,sT,e),this.useHandbrake&&P(d,f)){let t=o&&f>0||s&&f<0,n=!o&&d>0||!s&&d<0;c?(i=n?hT:12,a=u):(l===!0||u===vT.Hold)&&(t?(i=this.innVal(3,sT,e),a=vT.Take):(i=n?11:13,a=vT.Hold))}if(P(this.innVal(2,oT,e))){let t=this.innVal(1,cT,e),[n,i]=gT(t),a=Math.abs(t);(o&&n||s&&i)&&(r=a),(o&&i||s&&n)&&(r=-a)}return o?t=1:s&&(n=1),{[G.JPIB.id]:t,[G.JPIS.id]:n,[G.BARCOLIX.id]:i,[dT.id]:r,[fT.id]:a,[pT.id]:c}}},xT=class extends bT{constructor(e,t){e.inputs=dt(V(`JPI`).defaults.inputs.filter(e=>e.name!==`HandbrakePeriod`)),super(e,t)}},ST={FastPeriod:8,SlowPeriod:21,HandbrakePeriod:13,Average:`EMA`,Height:`Fixed`},CT=class extends bT{constructor(e,t){e.inputs=structuredClone(ST),super(e,t)}},wT=e=>{let t=e.unit===g.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:d.Manual,missing:t?u.UseNext:u.UsePrevious,stretch:e=>!1,fieldMap:new Map([[G.Close,G.DRS]]),noDataApproach:f.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}},TT=class extends J{get indexSymbol(){return this.inputs[B.INPUT_SYMBOL]}constructor(e,t){if(super(e,t),mO(t)){let n=$().getTimeSeriesDataSource(),r=t.query.duplicate();r.symbol=this.indexSymbol;let i=n.getTimeSeries(r),{model:a}=yd(`{${t.query.symbol}} / {${i.query.symbol}} * 100`,!1),o=wT(e.aggregation),s=new tb(a,[t,i],o);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=Z(G.Close,(e,t)=>null,t),n=Z(G.DRS,(e,t)=>null,t);this.addInner(e,n),this.canLoadMoreData=!1}}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[0].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}getWrappers(){return[this.wrapInner(G.DateTime,2),this.wrapInner(G.DRS,2)]}},ET=class extends J{get indexSymbol(){return this.inputs[B.INPUT_SYMBOL]}constructor(e,t){super(e,t);let n=qD(t,this.indexSymbol,e.aggregation),r=Y(n,this.period,G.DRS);this.addInner(n,r),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){let t=this.innVal(1,G.DRS,e),n=this.innVal(2,G.MA,e),r=null;return P(t,n)&&n!==0&&(r=(t/n-1)*100),{[G.MRS.id]:r}}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[0].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}},DT=q(`_SMTH_ROC`),OT=q(`_TEN_SMTH_ROC`);function kT(e,t,n,r,i){return new pb({source:r,target:i,outFields:[i],aggregation:n,inputs:xD(t)},e,e=>2/e)}var AT=class extends J{constructor(e,t){super(e,t);let n=UD(t,1),r=e.aggregation,i=this.inputs.Period1,a=Q(OT,(e,t)=>10*t,kT(n,i,r,G.ROC,DT)),o=this.inputs.Period2,s=kT(a,o,r,OT,G.PMO),c=X(s,this.inputs.Period3,G.PMO,G.PMOS);this.addInner(s,c)}getWrappers(){return[this.wrapInner(G.PMO,1),this.wrapInner(G.PMOS,2)]}},jT=q(`_VOL_AVG`),MT=class extends J{constructor(e,t){super(e,t);let n=cO(e,`MA`)(t,this.period,G.Volume,jT,!0);this.addInner(n)}calculateAt(e){let t=null,n=this.innVal(0,G.Volume,e),r=this.innVal(1,jT,e);return P(n,r)&&r!==0&&(t=n/r),{[this.target.id]:t}}},NT=e=>Xe(.5**(1/e),6),PT=52,FT=53,IT=27,LT=5,RT=131,zT=(()=>{let e=NT(PT-1),t=De(PT,t=>e**+t),n=PT/pe(t);return t.map(e=>e*n)})(),BT=[`Renko`,`Kagi`,`PointAndFigure`,`LineBreak`],VT=class extends J{isDaily;isFeasible=!0;constructor(e,t){super(e,t);let n=nb(t),r=n.query?.curveStyle;this.isFeasible=!(n instanceof __)&&(!P(r)||!BT.includes(h[r])),this.isDaily=e.aggregation.unit===g.Day}acceptable(e,t,n,r){return this.isDaily?r===0?!0:!li(this.baseVal(G.DateTime,t),this.baseVal(G.DateTime,n)):e>0&&n-t>=LT}pluckValues(e){let t=0,n=[],r=e+LT;for(let i=0;t<FT&&e-i>0;i++){let a=e-i,o=this.baseVal(this.source,a);this.acceptable(o,a,r,t)&&(n.push(o),r=a,t++)}return n}calculateAt(e){let t=null;if(this.isFeasible&&e>=RT){let n=1,r=this.pluckValues(e),i=r.length;if(i>=IT)for(let e=0;e<i-1;e++){let t=r[e]/r[e+1]-1;t<0?t=Math.max(t,-.2):t>=0&&(t=Math.min(t,.2)),t=t*zT[e]+1,n*=t}t=100*(n-1)}return{[this.target.id]:t}}},HT=20;function UT(e,t){switch(e){case g.Intraday:return t>=240?3:t>=120?2:1;case g.Day:default:return 5;case g.Week:return 15;case g.Month:return 60;case g.Quarter:case g.Year:return 240}}function WT(e){return e===_.Continue||e===_.Nearest}var GT=class extends J{additionalChunksCounter=1;noData=!1;isPeriodic=!1;constructor(e,t,n){super(e,n,ob(n,e=>{let t=ne[$()?.config.mode??`Unspecified`];if(!lc(t))return n;let r=e.duplicate(),i=e.aggregation;if(i.hasSpec)return WT(i.spec)?n:new __(r,!0);let a=i.unit===g.Intraday&&i.size<=5,o=UT(i.unit,i.size);r.aggregation=a?new Ru(g.Tick,i.size,_.PerSeconds):new Ru(g.Intraday,o);let s=a?1:3;return r.barsToFetch=Math.min(B.MAX_INTRADAY_BARS,s*e.barsToFetch),new h_(r)})),this.isPeriodic=t,this.noData=this.innerSeries[1]instanceof __,this.computedServerSide=!0,this.initialNotification=!0}get canLoadMoreData(){return!1}loadMoreData(){let e=this.innerSeries[1];return!this.noData&&this.additionalChunksCounter<HT&&e.canLoadMoreData&&!e.isLoading?(this.additionalChunksCounter+=1,e.loadMoreData()):Promise.resolve()}recalculateAt(e,t,n){if(e.src!==this.innerSeries[0])return;let r=n?K.TS_DATAPOINTADDED:K.TS_DATAPOINTCHANGED;this.notify(r,this.innerSeries[0].container.size-1)}getWrappers(){return[this.wrapInner(G.Change,1),this.wrapInner(G.Open,1),this.wrapInner(G.Close,1)]}},KT=class extends GT{constructor(e,t){super(e,!1,t)}},qT=class extends GT{constructor(e,t){super(e,!0,t)}},JT=class extends J{constructor(e,t){super(e,t);let n=zD(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(n)}calculateAt(e){let t=null,n=this.innVal(1,G.ATR,e),r=this.baseVal(G.Close,e);return P(n,r)&&r>0&&(t=n/r*100),{[G.ATRP.id]:t}}},YT=q(`_DR`),XT=class extends J{constructor(e,t,n){super(e,n);let r=Z(YT,e=>{let t=this.baseVal(G.High,e),n=this.baseVal(G.Low,e);return{[YT.id]:P(t,n)?t-n:null}},n),i=cO(e,`MA`)(r,this.inputs.Period,YT,G.ADR);if(t){let e=Q(this.target,(e,t,n)=>!P(t,n)||n===0?null:t/n*100,i,n);this.addInner(e)}else this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},ZT=class extends XT{constructor(e,t){super(e,!1,t)}},QT=class extends XT{constructor(e,t){super(e,!0,t)}},$T=class extends J{constructor(e,t){super(e,t);let n=this.source,r=Z(n,se(aO,n),t),i=UD(r,this.inputs.PeriodRoc1,n),a=UD(r,this.inputs.PeriodRoc2,n),o=UD(r,this.inputs.PeriodRoc3,n),s=UD(r,this.inputs.PeriodRoc4,n),c=Y(i,this.inputs.PeriodMa1,G.ROC,G.MA1),l=Y(a,this.inputs.PeriodMa2,G.ROC,G.MA2),u=Y(o,this.inputs.PeriodMa3,G.ROC,G.MA3),d=Y(s,this.inputs.PeriodMa4,G.ROC,G.MA4),f=Q(G.KST,(e,t,n,r,i)=>t+2*n+3*r+4*i,c,l,u,d),p=Y(f,this.inputs.PeriodSig,G.KST,G.KSTSIG);this.addInner(f,p)}getWrappers(){return[this.wrapInner(G.KST,1),this.wrapInner(G.KSTSIG,2)]}},eE=q(`_EMA1`),tE=q(`_EMA2`),nE=q(`_MACD`),rE=q(`_PCTK`),iE=q(`_PCTD`),aE=q(`_PCTK2`),oE=class extends J{constructor(e,t){super(e,t);let n=Q(nE,(e,t,n)=>t-n,X(t,this.inputs.PeriodShort,G.Close,eE),X(t,this.inputs.PeriodLong,G.Close,tE)),r=this.inputs.PeriodStoch1,i=this.inputs.PeriodStoch2,a=cO(e,`EMA`),o=a(FD(a(FD(n,r,rE,!1,nE),i,rE,iE),r,aE,!1,iE),i,aE,this.target);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},sE=q(`_EMA1`),cE=q(`_EMA2`),lE=q(`_CORE`),uE=class extends J{isEmpty=!1;constructor(e,t){if(super(e,t),mO(t)&&e.aggregation?.isEndOfDay){let n=[`$ADVT`,`$DECT`];switch(this.inputs.Source){case`TotalStocks`:default:break;case`NYSEStocks`:n=[`$ADVN`,`$DECN`];break;case`NasdaqStocks`:n=[`$AVDQ`,`$DECQ`];break}let r=this.getSeries(t.query,n[0]),i=this.getSeries(t.query,n[1]),a=this.getTargetSeries(e,r,i);this.addInner(r,i,a),this.canLoadMoreData=!0,this.initialNotification=!0}else{this.isEmpty=!0;let e=Z(G.Close,(e,t)=>null,t),n=Z(G.Close,(e,t)=>null,t),r=Z(this.target,(e,t)=>null,t);this.addInner(e,n,r),this.canLoadMoreData=!1}}get baseIndex(){return+!this.isEmpty}getSeries(e,t){let n=e.duplicate();return n.symbol=t,$().getTimeSeriesDataSource().getTimeSeries(n)}shouldTriggerOurRecalc(e){return super.shouldTriggerOurRecalc(e)?!0:e===this.innerSeries[0]?!1:(e===this.innerSeries[1]||e===this.innerSeries[2])&&this.innHasData(1)&&this.innHasData(2)}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[1].canLoadMoreData||!this.innerSeries[2].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),await this.innerSeries[2].loadMoreData(e),this.isLoading=!1}getWrappers(){return[this.wrapInner(this.target,3)]}},dE=class extends uE{constructor(e,t){super(e,t)}getTargetSeries(e,t,n){let r=(e,t,n)=>t-n,i=Q(lE,this.inputs.RatioAdjusted===`Yes`?(e,t,n)=>(t-n)/(t+n)*1e3:r,t,n),a=X(i,this.inputs.Period1,lE,sE),o=X(i,this.inputs.Period2,lE,cE);return Q(this.target,r,a,o)}},fE=q(`_INN_HL_ACC_IX`),pE=new Ru;function mE(e,t,n){return new hE({aggregation:pE,source:null,target:n,outFields:[n],inputs:{...t}},e)}var hE=class extends J{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof __)this.canLoadMoreData=!1;else{let n=this.inputs.Source===`PriceIndex`?`$MADX`:`$FADX`,r=this.getSeries(t.query,n);if(this.addInner(r),this.isWeekly=e.aggregation.unit===g.Week,this.isWeekly){let e=mE(this.getSeries(t.query,n,pE),this.inputs,fE);this.addInner(e)}this.canLoadMoreData=!0,this.initialNotification=!0}}getSeries(e,t,n){let r=e.duplicate();return r.symbol=t,n&&(r.aggregation=n,r.barsToFetch=B.US_TRADING_DAYS_PER_YEAR*15),$().getTimeSeriesDataSource().getTimeSeries(r)}get baseIndex(){return 1}calculateAt(e){if(this.isWeekly)return this.calculateAtWeekly(e);let t=null,n=this.period;if(this.atLeast(e,n)){let r=this.past(e,n,G.Close);k(r)&&(t=pe(r))}return{[this.target.id]:t}}calculateAtWeekly(e){let t=this.container?.size??-1,n=null,r=this.innCont(2);if(t>0&&e===t-1)n=r.getLastDataPoint(fE);else{let t=this.container.getTimeData()[e],i=r.getTimeData(),a=Te(i,t),o=i[a],s=null;for(;a<r.size&&li(t,o);)s=a,a+=1,o=i[a];s!==null&&(n=r.getData(fE)[s])}return{[this.target.id]:n}}shouldTriggerOurRecalc(e){return super.shouldTriggerOurRecalc(e)?!0:e===this.innerSeries[0]?!1:e===this.innerSeries[1]&&this.innHasData(1)}async loadMoreData(e=!0){if(this.isLoading||!this.innerSeries[1].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}},gE=q(`_RSI1`),_E=q(`_RSI1_MOM`),vE=q(`_RSI2`),yE=q(`_RSI2_MA`),bE=class extends J{constructor(e,t){super(e,t);let n=WD(t,this.inputs.Period1Rsi,G.Close,gE),r=Z(_E,ce(oO,this.inputs.Period1Mom,gE),n),i=Y(WD(t,this.inputs.Period2Rsi,G.Close,vE),this.inputs.Period2Ma,vE,yE),a=Q(G.CMBCI,(e,t,n)=>t+n,r,i),o=Y(a,this.inputs.PeriodFastMa,G.CMBCI,G.CMBCIF),s=Y(a,this.inputs.PeriodSlowMa,G.CMBCI,G.CMBCIS);this.addInner(a,o,s)}getWrappers(){return[this.wrapInner(G.CMBCI,1),this.wrapInner(G.CMBCIF,2),this.wrapInner(G.CMBCIS,3)]}};function xE(e){return new OC({source:G.Close,inputs:{},outFields:OD(`COTLC`)},e)}var SE=class extends J{constructor(e,t){super(e,xE(t));let n=Number.parseInt(this.inputs.History),r=n===6?52/2:52*n,i=FD(this.innerSeries[0],r,G.COTI,!1,G.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(i)}getWrappers(){return[this.wrapInner(G.COTI,1)]}},CE=q(`_MUL_ATR`),wE=class extends J{isLong;constructor(e,t){super(e,t),this.isLong=this.inputs.Direction===`Long`;let n=this.period,r=zD(t,n),i=this.inputs.Multiplier,a=Q(CE,(e,t)=>t===null?null:i*t,r),o=PD(t,n,G.High,G.HH,!0),s=PD(t,n,G.Low,G.LL,!1);this.addInner(a,o,s)}calculateAt(e){let t=null,n=null,r=this.innVal(1,CE,e);return r!==null&&(this.isLong?t=this.innVal(2,G.HH,e)-r:n=this.innVal(3,G.LL,e)+r),{[G.CHEXL.id]:t,[G.CHEXS.id]:n}}},TE=class extends J{constructor(e,t){let n=e.outFields??[],r=e=>{let t=$().getTimeSeriesDataSource();return e.seriesKind=w.Options,e.fields=n,t.getTimeSeries(e)},i=n.length===1?n[0]:void 0,a=i?sb(t,i,r):ob(t,r);super(e,a),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return this.outFields.map(e=>this.wrapInner(e,0))}},EE=class extends TE{},DE=class extends TE{},OE=class extends TE{},kE=class extends TE{},AE=class extends TE{},jE=class extends TE{},ME=class extends TE{},NE=class extends J{constructor(e,t){super(e,t);let n=zD(t,1),r=this.inputs.Period,i=PD(t,r,G.High,G.HH,!0),a=PD(t,r,G.Low,G.LL,!1);this.addInner(n,i,a)}calculateAt(e){let t=null,n=this.period;if(e>n){let r=this.past(e,n,G.ATR,this.innCont(1));if(k(r)){let i=pe(r)/(this.innVal(2,G.HH,e)-this.innVal(3,G.LL,e));t=100*Math.log10(i)/Math.log10(n)}}return{[this.target.id]:t}}},PE=class extends J{constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=n(t,e.inputs.Period1,this.source,G.MACLD1),i=n(t,e.inputs.Period2,this.source,G.MACLD2);this.addInner(r,i)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=+(this.innVal(1,G.MACLD1,e)>this.innVal(2,G.MACLD2,e));return{[G.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(G.MACLD1,1),this.wrapInner(G.MACLD2,2)]}},FE=q(`_CORE`),IE=class extends uE{constructor(e,t){super(e,t)}getTargetSeries(e,t,n){let r=Q(FE,(e,t,n)=>t/(t+n),t,n);return cO(e,`MA`,`Average`)(r,this.inputs.Period,FE,this.target)}},LE=class extends J{stdDevs;periodForecast;unitsPerYear;constructor(e,t){super(e,t),this.unitsPerYear=dO(e.aggregation),this.stdDevs=this.toInt(`StandardDeviations`),this.periodForecast=this.inputs.PeriodForecast;let n=this.getHistVolPeriod();if(n!==null){let r=$D(t,n,e.aggregation);this.addInner(r)}}getHistVolPeriod(){return this.isCustomVolatility?null:Number.parseInt(this.volatilityParam.substring(2))}toInt(e){return Number.parseInt(this.inputs[e])}get volatilityParam(){return this.inputs.Volatility}get isCustomVolatility(){return this.volatilityParam===`Custom`}get haveVolatility(){return this.isCustomVolatility||this.innHasData(1)}getVolatilityPercent(){return(this.isCustomVolatility?this.inputs.VolatilityPercent:this.innCont(1).getLastDataPoint(G.HV))/100}calculateAt(e){let t=null,n=null,r=null,i=null,a=null,o=null;if(this.haveVolatility){let s=this.base.size-this.periodForecast;if(e>=s){let c=this.base.getLastDataPoint(G.Close),l=this.getVolatilityPercent(),u=e-s+1,d=c*l*Math.sqrt(u/this.unitsPerYear);if(t=c+d,n=c-d,this.stdDevs>1){let e=2*d;if(r=c+e,i=c-e,this.stdDevs>2){let e=3*d;a=c+e,o=c-e}}}}return{[G.PCUP1.id]:t,[G.PCDN1.id]:n,[G.PCUP2.id]:r,[G.PCDN2.id]:i,[G.PCUP3.id]:a,[G.PCDN3.id]:o}}recalculateAt(e,t,n){let r={tag:bt(),src:this.innerSeries[0]};n&&this.calculate(r)}},RE=class extends J{constructor(e,t){super(e,ob(t,e=>new zE(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(G.Delta,0),this.wrapInner(G.Gamma,0),this.wrapInner(G.Theta,0),this.wrapInner(G.Vega,0)]}},zE=class extends h_{constructor(e){super(e)}getRetriever(){return Ti(this.query.symbol)?new HE:ji(this.query.symbol)?new UE:new VE}};function BE(){return new _g([G.DateTime,G.Delta,G.Gamma,G.Theta,G.Vega])}var VE=class{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){return BE()}},HE=class extends Hg{emptyContainer(e,t){return BE()}get iterateForward(){return!1}getPageName(){return`getFuturesOptionsHistory`}processRow(e,t,n){n.addDataPoint(G.DateTime,ug(e.date.substring(0,10))),n.addDataPoint(G.Delta,e.delta),n.addDataPoint(G.Gamma,e.gamma),n.addDataPoint(G.Theta,e.theta),n.addDataPoint(G.Vega,e.vega)}},UE=class extends Hg{emptyContainer(e,t){return BE()}addExtraParams(e){e.fields=`delta,gamma,theta,vega`}get iterateForward(){return!0}getPageName(){return`getEquityOptionsHistory`}processRow(e,t,n){n.addDataPoint(G.DateTime,ug(e.date)),n.addDataPoint(G.Delta,e.delta),n.addDataPoint(G.Gamma,e.gamma),n.addDataPoint(G.Theta,e.theta),n.addDataPoint(G.Vega,e.vega)}},WE=q(`_RSI1`),GE=q(`_RSI2`),KE=class extends J{constructor(e,t){super(e,t);let n=WD(t,this.inputs.Period1,this.source,WE),r=WD(t,this.inputs.Period2,this.source,GE),i=Q(G.RSA,(e,t,n)=>(t+n)/2,n,r),a=cO(e,`MA`,`Average`)(i,this.inputs.PeriodAvg,G.RSA,G.RSAAVG);this.addInner(i,a)}getWrappers(){return[this.wrapInner(G.RSA,1),this.wrapInner(G.RSAAVG,2)]}},qE=class extends J{constructor(e,t){super(e,t),rO(this);let n=e.inputs.PeriodRSI,r=e.inputs.PeriodTradeSignal,i=e.inputs.PeriodMarketBase,a=e.inputs.PeriodBB,[o]=iO(this),s=this.innerSeries[o],c=WD(s,n,this.source,G.TDIPRC),l=Y(c,r,G.TDIPRC,G.TDITSL),u=Y(c,i,G.TDIPRC,G.TDIMBL),d=KD(c,a,G.TDIPRC,G.MSD);this.addInner(c,l,u,d)}calculateAt(e){let t=this.inputs.MultiplierBB,n=+!!this.sourceNeedsCompute,r=this.innVal(1+n,G.TDIPRC,e),i=this.innVal(2+n,G.TDITSL,e),a=this.innVal(3+n,G.TDIMBL,e),o=this.innVal(4+n,G.MSD,e),s=null,c=null;if(P(a,o)){let e=t*o;s=a+e,c=a-e}return{[G.TDIPRC.id]:r,[G.TDITSL.id]:i,[G.TDIMBL.id]:a,[G.TDIUPR.id]:s,[G.TDILWR.id]:c}}},JE=q(`_ANCHR`),YE=class extends J{isLong;isPercent;constructor(e,t){super(e,t);let n=e.inputs.Period,r=e.inputs.Range,i=e.inputs.Direction;this.isLong=i===`Long`,this.isPercent=e.inputs.Type===`Percent`;let a=r===`Close`,o=G.Close;a||(o=this.isLong?G.High:G.Low);let s=PD(t,n,o,JE,this.isLong);this.addInner(s)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=null,n=this.innVal(1,JE,e),r=this.inputs.StopValue;if(n!==null){let e=this.isPercent?n*r/100:r;t=this.isLong?n-e:n+e}let i=+!!this.isLong;return{[G.PPS.id]:t,[G.BARCOLIX.id]:i}}},XE=q(`_HH_N`),ZE=q(`_LL_N`),QE=q(`_HH_H1`),$E=q(`_LL_H1`),eD=q(`_HH_H2`),tD=q(`_LL_H2`),nD=class extends J{constructor(e,t){super(e,t),rO(this);let n=e.inputs.Period,r=Math.floor(n/2),i=PD(t,n,G.High,XE,!0),a=PD(t,n,G.Low,ZE,!1),o=PD(t,r,G.High,QE,!0),s=PD(t,r,G.Low,$E,!1),c=PD(t,r,G.High,eD,!0),l=PD(t,r,G.Low,tD,!1);this.addInner(i,a,o,s,c,l)}calculateAt(e){let t=this.period,n=Math.floor(t/2),[,r]=iO(this),i=r.getData(this.source)[e];if(!this.atLeast(e,t))return{[this.target.id]:i};let a=+!!this.sourceNeedsCompute,o=this.innVal(1+a,XE,e),s=this.innVal(2+a,ZE,e),c=this.innVal(3+a,QE,e),l=this.innVal(4+a,$E,e),u=this.innVal(5+a,eD,e-n),d=this.innVal(6+a,tD,e-n);if(!P(o,s,c,l,u,d))return{[this.target.id]:i};let f=(o-s)/t,p=(c-l)/n,m=(u-d)/n,h=0;p>0&&m>0&&f>0&&(h=(Math.log(p+m)-Math.log(f))/Math.log(2));let g=Math.exp(-4.6*(h-1));g=Math.max(.01,Math.min(1,g));let _=e>0?this.container.getData(this.target)[e-1]:i,v=_===null?i:g*i+(1-g)*_;return{[this.target.id]:v}}},rD=q(`_MIDPOINT`),iD=q(`_VALUE`),aD=class extends J{constructor(e,t){super(e,t);let n=e.inputs.Period,r=Z(rD,se(Lx,rD),t),i=PD(r,n,rD,G.HH,!0),a=PD(r,n,rD,G.LL,!1);this.addInner(r,i,a)}get helpers(){return[iD]}calculateAt(e){let t=this.innVal(1,rD,e),n=this.innVal(2,G.HH,e),r=this.innVal(3,G.LL,e);if(!P(n,r,t))return{[G.FISHER.id]:null,[G.FISHTRG.id]:null,[iD.id]:null};let i=n-r,a=i===0?.5:(t-r)/i,o=t=>this.container.getData(t)[e-1],s=e>0?o(iD):null,c=.66*(a-.5)+.67*(s??0);c>.99?c=.999:c<-.99&&(c=-.999);let l=e>0?o(G.FISHER):null,u=.5*Math.log((1+c)/(1-c))+.5*(l??0);return{[G.FISHER.id]:u,[G.FISHTRG.id]:l,[iD.id]:c}}},oD=class extends J{constructor(e,t){super(e,t),rO(this)}computeMidranks(e){let t=e.length,n=e.map((e,t)=>({v:e,i:t}));n.sort((e,t)=>e.v-t.v);let r=Array(t),i=0;for(;i<t;){let e=i,a=n[i].v;for(;e+1<t&&n[e+1].v===a;)e++;let o=(i+1+(e+1))/2;for(let t=i;t<=e;t++)r[n[t].i]=o;i=e+1}return r}pearsonCorrelation(e){let t=e.length;if(t<2)return null;let n=(t+1)/2,r=0;for(let n=0;n<t;n++)r+=e[n];let i=r/t,a=0,o=0,s=0;for(let r=0;r<t;r++){let t=r+1-n,c=e[r]-i;a+=t*c,o+=t*t,s+=c*c}let c=Math.sqrt(o*s);return c===0?null:a/c}calculateAt(e){let t=null,n=this.period,[,r]=iO(this);if(this.atLeast(e,n)){let i=this.past(e,n,this.source,r);if(i.every(e=>e!==null)){let e=this.computeMidranks(i),n=this.pearsonCorrelation(e);n!==null&&(t=100*n)}}return{[G.RCI.id]:t}}},sD=class extends J{constructor(e,t){super(e,t);let n=this.source,r=new oD({source:n,target:G.RCI,inputs:{Period:e.inputs.Period}},t),i=e.inputs.PeriodSignal,a=cO(e,`MA`,`Smoothing`)(r,i,G.RCI,G.RCISIG);this.addInner(r,a)}getWrappers(){return[this.wrapInner(G.RCI,1),this.wrapInner(G.RCISIG,2)]}},cD=q(`_ATR`),lD=class extends J{state;useHighLow;isAtrMode;atrMult;percent;constructor(e,t){if(super(e,t),this.useHighLow=e.inputs.Method===`High/Low`,this.isAtrMode=e.inputs.PercentMode===`ATR`,this.percent=e.inputs.Percent,this.atrMult=e.inputs.MultiplierAtr,this.useHighLow||rO(this),this.isAtrMode){let t=e.inputs.PeriodAtr,[n]=this.useHighLow?[0]:iO(this),r=this.innerSeries[n],i=zD(r,t,`SMA`,cD);this.addInner(i)}this.resetState()}getHigh(e){if(this.useHighLow)return this.baseVal(G.High,e);let[,t]=iO(this);return t.getData(this.source)[e]}getLow(e){if(this.useHighLow)return this.baseVal(G.Low,e);let[,t]=iO(this);return t.getData(this.source)[e]}getAtrDenom(e){if(this.useHighLow)return this.baseVal(G.Close,e);let[,t]=iO(this);return t.getData(this.source)[e]}setPivot(e,t){this.state.pivotPrice=e,this.state.pivotIndex=t}setCandidate(e,t){this.state.candPrice=e,this.state.candIndex=t}getDevPct(e){if(this.isAtrMode){let t=!this.useHighLow&&this.sourceNeedsCompute?1:0,n=this.innVal(1+t,cD,e),r=this.getAtrDenom(e);if(n===null||r===null||r===0)return 0;let i=n/r*100;return this.atrMult*i}return this.percent}pct(e,t){return e===0?0:(t-e)/e*100}resetState(){this.state={mode:0,pivotPrice:null,pivotIndex:null,candPrice:null,candIndex:null,confirmedPivots:new Map}}calculateAt(e){let t=this.getHigh(e),n=this.getLow(e),r=this.getDevPct(e);if(t===null||n===null)return{};if(e===0){this.resetState();let n=this.useHighLow?this.baseVal(G.Close,e):t;return this.setPivot(n,e),this.setCandidate(n,e),{}}if(this.state.mode===0)this.pct(this.state.pivotPrice,t)>=r?(this.state.mode=1,this.setCandidate(t,e)):-this.pct(this.state.pivotPrice,n)>=r&&(this.state.mode=-1,this.setCandidate(n,e));else if(this.state.mode===1){let i=t>=this.state.candPrice;i&&this.setCandidate(t,e);let a=(this.state.candPrice-n)/this.state.candPrice*100;if(!i&&a>=r){let t=this.state.candIndex,r=this.state.candPrice;this.state.confirmedPivots.set(t,r),this.setPivot(r,t),this.setCandidate(n,e),this.state.mode=-1}}else if(this.state.mode===-1){let i=n<=this.state.candPrice;i&&this.setCandidate(n,e);let a=(t-this.state.candPrice)/this.state.candPrice*100;if(!i&&a>=r){let n=this.state.candIndex,r=this.state.candPrice;this.state.confirmedPivots.set(n,r),this.setPivot(r,n),this.setCandidate(t,e),this.state.mode=1}}return{}}getCurrentState(){return this.state}},uD=class extends J{constructor(e,t){super(e,t);let n=Z(G.BOP,function(e){let t=null,[n,r,i,a]=[G.Open,G.High,G.Low,G.Close].map(t=>this.baseVal(t,e));if(P(n,r,i,a)){let e=r-i;t=e===0?0:(a-n)/e}return{[this.target.id]:t}},t),r=cO(e,`MA`,`Average`),i=this.period,a=r(n,i,G.BOP,G.BOPAVG);this.addInner(n,a)}getWrappers(){return[this.wrapInner(G.BOP,1),this.wrapInner(G.BOPAVG,2)]}};function dD(e,t){let n=e.length;if(n<2||t.length!==n)return null;let r=0,i=0,a=0,o=0,s=0;for(let c=0;c<n;c++){let n=e[c],l=t[c];r+=n,i+=l,a+=n*n,o+=l*l,s+=n*l}let c=n*s-r*i,l=Math.sqrt((n*a-r*r)*(n*o-i*i));if(l===0||!Number.isFinite(l))return null;let u=c/l;return Number.isFinite(u)?Math.max(-1,Math.min(1,u)):null}var fD=class extends J{constructor(e,t){if(super(e,t),mO(t)){let e=this.inputs.Symbol?.toUpperCase();if(e){let n=$().getTimeSeriesDataSource(),r=t.query.duplicate();r.symbol=e;let i=n.getTimeSeries(r);this.addInner(i),this.canLoadMoreData=!0,this.initialNotification=!0}}}compareCloseAt(e){let t=this.innCont(1);if(!t||t.isEmpty)return null;let n=this.baseVal(G.DateTime,e);if(n===null)return null;let r=t.getData(G.DateTime),i=t.getData(G.Close);if(r.length===0)return null;let a=n.valueOf(),o=Te(r,a,Number),s=r[o];if(!P(s))return null;let c=s.valueOf()<=a?o:o-1;if(c<0)return null;let l=i[c];return P(l)?l:null}calculateCorrelation(e){let t=this.period;if(!this.atLeast(e,t)||!this.innHasData(1))return null;let n=[],r=[];for(let i=e-t+1;i<=e;i++){let e=this.baseVal(G.Close,i),t=this.compareCloseAt(i);if(!P(e,t))return null;n.push(e),r.push(t)}return dD(n,r)}calculateAt(e){return{[this.target.id]:this.calculateCorrelation(e)}}async loadMoreData(e=!0){if(this.isLoading||this.innerSeries.length<2||!this.innerSeries[1].canLoadMoreData)return Promise.resolve();this.isLoading=!0,await this.innerSeries[1].loadMoreData(e),this.isLoading=!1}},pD=4,mD=4,hD=q(`_RVI_NUM`),gD=q(`_RVI_DEN`),_D=q(`_RVI_NUMAVG`),vD=q(`_RVI_DENAVG`);function yD(e){if(e.length<mD||!k(e))return null;let[t,n,r,i]=e;return(t+2*n+2*r+i)/6}var bD={_TR:gx,_RSI:qb,MA:fb,MAEXP:mb,MAHLC:gb,VOL:vb,MAENV:wb,MAENVEXP:Tb,MAENVSMO:Eb,MATRI:Db,MAWEI:Ob,MAVOL:fb,MASMO:hb,MACD:zb,MACDEXP:Bb,MACDV:Rb,GMMA:qC,OSCI:kb,OSCIVOL:kb,RSI:Yb,RSIMOD:Xb,RSISTO:Zb,RSA:KE,WPERCR:nx,HHLL:Qb,WGCL:$b,STOCHF:ax,STOCHS:ox,BBANDS:ux,BWIDTH:dx,BPERC:fx,OBVOL:hx,ATR:bx,ADR:ZT,ATRP:JT,ADRP:QT,ADX:Ax,ADXMOD:jx,ADL:Mx,ADWM:Nx,CHAOSC:Px,TP:Fx,KELCHN:Gx,KELBND:Kx,DONCHN:Jx,DONWIDTH:Yx,PVT:Xx,ROC:tS,TRIX:Zx,PPMOV:nS,PIVPTS:NC,CPP:PC,ARNUPDW:oS,ARNOSC:sS,TCHN:cS,TCHRE:lS,ALLG:dS,PLTLN:fS,AWEOSC:mS,MFV:_S,CLV:gS,CHAMF:vS,CHAVOL:bS,DPO:xS,CCI:CS,EMV:wS,ERBRPOW:DS,ERBLPOW:ES,FI:kS,MI:PS,MOM:FS,MFI:IS,MSD:LS,NVI:VS,PVI:HS,PPO:Ub,PVO:Wb,HV:WS,PERF:GS,WASI:qS,WWVOL:XS,PARTP:nC,MOVLR:rC,TRSP:vC,TARGP:yC,COTLC:OC,COTDAG:kC,COTFTR:AC,IMPVOL:FC,CTM:Vb,CPMI:Hb,DEMA:Qx,EOSC:$x,TEMA:eS,TSI:KC,ADJATR:xx,COTR:Sx,MCGD:JC,HMA:XC,COPP:QC,REATRS:nw,LINRCHN:rw,CSHO:iw,CSHB:aw,MKTCAP:ow,CTPI:sx,PCTCHG:sw,OPINT:yb,STOMOMIX:hw,CHDMOMOSC:bw,VSTOP:ww,ATREXT:db,SUPTR:Ow,ICHCLD:kw,VWAP:Pw,MACROSS:Hw,PACROSS:Uw,VOIN:Kw,DIFA:Jw,DOSC:Yw,BBANDW:px,MARIB:Xw,HASMO:tT,TTMSQZ:rT,CRS:aT,JPI:bT,CTTP:xT,CTTI:CT,DRS:TT,MRS:ET,PMO:AT,RVOL:MT,WGALPH:VT,VOLAP:KT,AVWAP:Fw,KST:$T,STC:oE,MCCLO:dE,NHLAI:hE,CMBCI:bE,COTI:SE,CHEXI:wE,MBBANDS:mx,OPTIV:EE,IVRANK:DE,IVPCTL:OE,OPTVOLPC:kE,OPTOIPC:AE,OPTVOL:jE,OPTOI:ME,CHOP:NE,MACLD:PE,BTI:IE,FRAMA:nD,FISHER:aD,PC:LE,GREEKS:RE,PVACP:qT,TDI:qE,PPS:YE,RCI:sD,BOP:uD,CORR:fD,RVI:class extends J{constructor(e,t){super(e,t);let n=(e,t)=>function(n){let r=this.past(n,mD,e),i=this.past(n,mD,t),a=null;if(k(r)&&k(i)){let e=r,t=i;a=yD(e.map((e,n)=>e-t[n]))}return{[this.target.id]:a}},r=Z(hD,n(G.Close,G.Open),t),i=Z(gD,n(G.High,G.Low),t),a=this.period,o=Y(r,a,hD,_D),s=Y(i,a,gD,vD),c=Q(G.RVI,(e,t,n)=>n===0?null:t/n,o,s),l=Z(G.RVISIG,function(e){return{[this.target.id]:yD(this.past(e,pD,G.RVI))}},c);this.addInner(c,l)}getWrappers(){return[this.wrapInner(G.RVI,1),this.wrapInner(G.RVISIG,2)]}},ZIGZAG:lD,DIDI:class extends J{constructor(e,t){super(e,t);let n=cO(e,`MA`,`Average`),r=this.source??G.Close,i=n(t,this.inputs.PeriodShort,r),a=n(t,this.inputs.PeriodMedium,r),o=n(t,this.inputs.PeriodLong,r),s=(e,t,n)=>n===0?null:t/n,c=Q(G.DIDIS,s,i,a),l=Q(G.DIDIL,s,o,a);this.addInner(c,l)}get helpers(){return[G.BARCOLIX]}calculateAt(e){let t=this.innVal(1,G.DIDIS,e),n=this.innVal(2,G.DIDIL,e),r=this.innVal(1,G.DIDIS,e-1),i=this.innVal(2,G.DIDIL,e-1),a=t===null||n===null?-1:+(t>n),o=null,s=null;if(t!==null&&n!==null&&r!==null&&i!==null){let e=(n+i)/2;t>n&&r<=i&&(o=e),n>t&&i<=r&&(s=e)}return{[G.DIDIUP.id]:o,[G.DIDIDN.id]:s,[G.BARCOLIX.id]:a}}getWrappers(){return[this.wrapInner(G.DIDIS,1),this.wrapInner(G.DIDIL,2)]}}};function xD(e){return{[B.INPUT_PERIOD]:e}}function SD(e){return{[B.INPUT_SYMBOL]:e}}function CD(e){return{target:e,source:null,inputs:LD}}function wD(e){return e instanceof tb&&typeof e.seasonalAverageOffset==`number`&&e.seasonalAverageOffset<0}function TD(e,t){if(!P(e))return e;for(let[n,r]of t.policy.fieldMap.entries())if(r===e)return n;return e}function ED(e,t,n){if(!B.CLIENT_SIDE_SEASONAL_AVERAGE_DISTRIBUTED_STUDIES.has(e)||!wD(n))return null;let r=TD(t.source,n),i=t.target??t.outFields?.[0];if(!N(i))return null;let a=n.innerSeries.map(n=>{let a=DD(e,{...t,source:r??null,target:i,outFields:[i],inputs:F(t.inputs??{})},n);return a.query=n.query,a}),o=new tb(n.exprModel,a,{...n.policy,fieldMap:new Map([[i,i]])});return new lb({...t,source:r??null,target:i,outFields:[i]},o)}function DD(e,t,n){let r=ED(e,t,n);if(r)return r;if(nt(bD,e))return new bD[e](t,n);let i=$()?.config.extensions?.studyProvider;if(i){let r=i.factory(e,t,n);if(r)return r}throw Error(`Study ${e} has not been implemented yet.`)}function OD(e){return V(e).defaults.curves.reduce((e,t)=>e.concat(t.fields.filter(t=>!e.includes(t))),[]).map(e=>G[e])}function kD(e,t,n,r){return{source:t,target:n,inputs:xD(e),allowEmptyValues:r}}function Y(e,t,n,r=G.MA,i=!1){return DD(`MA`,kD(t,n,r,i),e)}function X(e,t,n,r=G.EMA,i=!1){return DD(`MAEXP`,kD(t,n,r,i),e)}function AD(e,t,n,r=G.SMA,i=!1){return DD(`MASMO`,kD(t,n,r,i),e)}function jD(e,t,n,r=G.WMA,i=!1){return DD(`MAWEI`,kD(t,n,r,i),e)}function MD(e,t,n,r=G.HMA,i=!1){return DD(`HMA`,kD(t,n,r,i),e)}function ND(e,t,n,r,i=G.Close){return DD(`MACDEXP`,{source:i,inputs:{Period1:t,Period2:n,Period3:r},outFields:[G.MACD,G.MACDS,G.MACDH]},e)}function PD(e,t,n,r,i,a=!1){return new ex({source:n,target:r,inputs:xD(t)},i,a,e)}function FD(e,t,n,r,i=null){return new tx({source:i,target:n,inputs:xD(t)},r,e)}function ID(e,t,n=G.PCTCHG){return DD(`PCTCHG`,{source:t,target:n,inputs:LD},e)}var LD={};function RD(e,t=G.TR){return DD(`_TR`,CD(t),e)}function zD(e,t,n=`SMA`,r=G.ATR){return DD(`ATR`,{target:r,inputs:{[B.INPUT_PERIOD]:t,[B.INPUT_SMOOTHING]:n},source:null},e)}function BD(e,t,n=`MA`,r=G.Close,i=G.ADJATR){return DD(`ADJATR`,{source:r,target:i,inputs:{[B.INPUT_PERIOD]:t,[B.INPUT_SMOOTHING]:n}},e)}function VD(e,t=G.ADL){return DD(`ADL`,CD(t),e)}function HD(e,t=G.TP){return DD(`TP`,CD(t),e)}function UD(e,t,n=G.Close,r=G.ROC){return DD(`ROC`,{source:n,target:r,inputs:xD(t)},e)}function WD(e,t,n,r=G.RSI,i=!1){return DD(`_RSI`,{source:n,target:r,inputs:{...xD(t),Modified:i}},e)}function GD(e,t=G.MFMUL){return DD(`MFV`,CD(t),e)}function KD(e,t,n,r=G.MSD){return DD(`MSD`,{source:n,target:r,inputs:xD(t)},e)}function qD(e,t,n,r=G.DRS){return DD(`DRS`,{target:r,inputs:SD(t),aggregation:n,source:null},e)}function JD(e,t=G.CSHO){return DD(`CSHO`,CD(t),e)}function YD(e,t,n){let r=`TCHN`;return DD(r,{inputs:{PeriodUpper:t,PeriodLower:t,Range:n},outFields:OD(r),source:null},e)}function XD(e,t,n,r=G.Close){let i=`BBANDS`,a=OD(i);return DD(i,{source:r,inputs:{[B.INPUT_PERIOD]:t,[B.INPUT_WIDTH]:n},outFields:a},e)}function ZD(e,t){let n=`DONCHN`,r=OD(n);return DD(n,{inputs:xD(t),outFields:r,source:null},e)}function QD(e,t,n,r=G.MOVLR){return DD(`MOVLR`,{source:n,inputs:xD(t),target:r},e)}function $D(e,t,n,r=G.Close,i=G.HV){return DD(`HV`,{source:r,target:i,aggregation:n,inputs:xD(t)},e)}function Z(e,t,n){return new zx(CD(e),t,n)}function Q(e,t,...n){return new Ix(CD(e),t,...n)}function eO(e,t,n){return t-n}function tO(e,t,n){return(t-n)/n*100}function nO(e){switch(e.id){case`HL/2`:case`OC/2`:case`HLC/3`:case`OHLC/4`:case`HLCC/4`:return!0;default:return!1}}function rO(e){let t=e.source;if(e.sourceNeedsCompute=nO(t),e.sourceNeedsCompute){let n=Z(t,se(aO,t),e.innerSeries[0]);e.addInner(n)}}function iO(e){let t=+!!e.sourceNeedsCompute;return[t,e.innCont(t)]}var aO=function(e,t){let[n,r,i,a]=[G.Open,G.High,G.Low,G.Close].map(e=>this.baseVal(e,t)),o=null,s=e.id;switch(s){case`Open`:o=n;break;case`High`:o=r;break;case`Low`:o=i;break;case`Close`:o=a;break;case`HL/2`:o=(r+i)/2;break;case`OC/2`:o=(n+a)/2;break;case`HLC/3`:o=(r+i+a)/3;break;case`OHLC/4`:o=(n+r+i+a)/4;break;case`HLCC/4`:o=(r+i+a+a)/4;break;default:break}return{[s]:o}},oO=function(e,t,n){let r=null;if(this.atLeast(n,e+1)){let i=this.baseVal(t,n-e);i!==null&&(r=this.baseVal(t,n)-i)}return{[this.target.id]:r}},sO={sma:AD,ma:Y,ema:X,wma:jD,hma:MD};function cO(e,t,n=`Smoothing`){return sO[(e.inputs[n]??t).toLowerCase()]}var lO={atr:zD,adjatr:BD};function uO(e){return lO[e.inputs.TypeOfATR.toLowerCase()]}function dO(e){switch(e.unit){case g.Day:return 252;case g.Week:return 52;case g.Month:return 12;default:return 0}}function fO(e){let t=[G.High,G.Low];return e instanceof tb&&be(e.targetFields,t).length!==2}function pO(e,t){return e[`Period${t}`]}function mO(e){return!(e instanceof __)&&e.query instanceof Qy}var hO=class extends cb{constructor(e,t){let n=X(t,13,G.Close),r=ND(t,12,26,9,G.Close);super(e,t,n,r),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=p.Same,n=this.innVal(1,G.EMA,e),r=this.innVal(1,G.EMA,e-1),i=this.innVal(2,G.MACDH,e),a=this.innVal(2,G.MACDH,e-1);return P(n,r,i,a)&&(n>r&&i>a?t=p.Up:n<r&&i<a&&(t=p.Down)),{[G.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(G.Open,G.High,G.Low,G.Close,G.Change,G.Volume,G.OpenInterest,G.TradingDay)}};function gO(e,t){return P(t)?(this[e]=t,null):this[e]}var _O=class{_domain;_range;_extent;_padding;constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return gO.call(this,`_domain`,e)}range(e){return gO.call(this,`_range`,e)}padding(e){return gO.call(this,`_padding`,e)}get ready(){return P(this._domain,this._range)}},vO=1/Math.log2(10),yO=(e,t)=>n=>e*(1-n)+t*n,bO=(e,t)=>(t-=e,t>0?n=>(n-e)/t:e=>ue(isNaN(t)?NaN:.5));function xO(e,t){let n=bO(e[0],e[1]),r=yO(t[0],t[1]);return e=>r(n(e))}function SO(e){return Math.sign(e)*Math.log10(1+Math.abs(e/vO))}function CO(e){return Math.sign(e)*vO*(-1+10**Math.abs(e))}var wO=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]],TO=class extends _O{scaleType;axis;constructor(e,t){super(),this.scaleType=e,this.axis=t}domain(e){return this.axis&&e&&!ge(e,this._domain)&&this.axis.pane.presenter.onScaleDomainChanged(this.axis),super.domain(e)}yToPrice(e){return this.mapValue(e)}rangeWithPadding(){return[this._range[0]+this._padding[0],this._range[1]-this._padding[1]]}mapValue(e,t=!0){if(!this.ready)return null;let n=ue,r=ue;switch(this.scaleType){case S.Linear:break;case S.Logarithmic:n=SO,r=CO;break;default:throw Error(`Unexpected scale type (neither linear nor log)`)}let i=this._domain.map(n),a=this.rangeWithPadding(),o=t?xO(a,i):xO(i,a),s=e=>a[1]-e+a[0];return(t?r:s)(o((t?s:n)(e)))}priceToY(e){return this.mapValue(e,!1)}getTicks(e){if(!this.ready)return[];let[t,n]=this._range.map(e=>this.mapValue(e,!0));if(t===n&&e>0)return[t];let[r,i]=this._domain;if(this.scaleType===S.Linear||r<0||i>1e5)return EO(t,n,e);let a=this.findLogBand(r),o=this.findLogBand(i),s=e*2;return o-a===0?EO(t,n,s):this.getLogTicks(a,o,s,n<t)}findLogBand(e){return wO.findIndex(([t,n])=>e>=t&&e<n)}getLogTicks(e,t,n,r){let i=[...this._domain],a=[];try{for(let o=e;o<=t;o++){let[s,c]=wO[o];o===e?s=i[0]:o===t&&(c=i[1]),this.domain([s,c]);let[l,u]=this._range.map(e=>this.mapValue(e,!0)),d=EO(l,u,n);a=r?d.concat(a):a.concat(d)}}finally{this.domain(i)}return je(a,r?(e,t)=>e>t:(e,t)=>e<t),a}checkTicks(){return this.scaleType===S.Logarithmic}};function EO(e,t,n){let r,i=-1,a,o,s;if(t=+t,e=+e,n=+n,e===t&&n>0)return[e];if((r=t<e)&&(a=e,e=t,t=a),(s=DO(e,t,n))===0||!isFinite(s))return[];if(s>0)for(e=Math.ceil(e/s),t=Math.floor(t/s),o=Array(a=Math.ceil(t-e+1));++i<a;)o[i]=(e+i)*s;else for(e=Math.floor(e*s),t=Math.ceil(t*s),o=Array(a=Math.ceil(e-t+1));++i<a;)o[i]=(e-i)/s;return r&&o.reverse(),o}function DO(e,t,n){let r=Math.sqrt(50),i=Math.sqrt(10),a=Math.sqrt(2),o=(t-e)/Math.max(0,n),s=Math.floor(Math.log(o)/Math.LN10),c=o/10**s;return s>=0?(c>=r?10:c>=i?5:c>=a?2:1)*10**s:-(10**-s)/(c>=r?10:c>=i?5:c>=a?2:1)}var OO=[`None`,`Annotations`,`Studies`,`All`],kO=OO[0];function AO(e){return e?.hiddenItems??kO}function jO(e){let t=AO(e);return t===`Annotations`||t===`All`}function MO(e){let t=AO(e);return t===`Studies`||t===`All`}function NO(e,t){return e.type===C.Study&&MO(t)}function PO(e,t){return e.visible!==!1&&!NO(e,t)}function FO(e,t){return e.visible!==!1&&!jO(t)}var IO={color:B.COLOR_TRANSPARENT},LO={color:B.COLOR_TRANSPARENT,width:0,dashStyle:`Solid`},RO=[G.Open,G.High,G.Low,G.Close],zO=new Set(RO.map(e=>e.id)),BO=e=>zO.has(e.id),VO=e=>e.visible,HO=e=>e.visible&&e.canHitTest,UO=new Eo(0,0,0,0),WO=class{axis;id;uid;record;metaData;timeSeries;notifyAboutPriceDomains=!1;customPlotValues=!1;_priceMapFirstIndex;priceMapper;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=C.Symbol;isShutDown=!1;targetFields=[];detachedScale;yScale=null;levels;bands;annotations;visFromIndex;visToIndex;_eventsData;precision;visible=!0;constructor(){this.axis=null,this.id=bt(),this.uid=this.id,this.record=new Wf(``),this.metaData=new Ga,this.timeSeries=new __,this.priceMapper=this._priceMapper.bind(this),this._priceMapFirstIndex=new Map}get title(){return``}get showPrevious(){return!1}getPreviousValue(){return null}get mainCurve(){return this.curves[0]}get hasEvents(){return!1}findEvents([e,t]){return[]}get eventsSeries(){return null}get hasEventsData(){return this.hasEvents&&P(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(C.Symbol)}get isExpression(){return this.is(C.Expression)}get isStudy(){return this.is(C.Study)}get isForward(){return this.is(C.Forward)}get isSeasonal(){return this.is(C.Seasonal)}get isVisible(){return PO(this,this.presenter?.display)}getValueAt(e,t,n){return null}wrapIfAdvancedStyle(e){let t=e,n=e=>({outFields:e,inputs:{},source:null});return this.mainCurve.isHeikinAshiStyle?t=new ub(n(Ng.slice()),e):this.mainCurve.isElderImpulseSystemStyle?t=new hO(n(Ng.slice().concat(G.BREL)),e):this.mainCurve.isPercentChangeStyle&&(t=new cw(n(Ng.slice()),e)),t}is(e){return this.type===e}getCacheableEntities(e){this.metaData.getCacheableEntities(e.metaData),this.timeSeries.getCacheableEntities(e.timeSeries)}fromModel(e){this.type=C[e.type];let t=e;this.uid=t.uid,this.main=t.main,t.levels&&(this.levels=t.levels),t.bands&&(this.bands=t.bands),P(t.precision)&&(this.precision=t.precision),this.curves=e.curves.map(e=>{let t=new Jy;return t.plot=this,t.fromModel(e),t}),t.detachedScale&&(this.detachedScale=t.detachedScale,this.yScale=new TO(S.Linear,null)),this.visible=t.visible??!0}initialize(){}shutdown(){P(this.timeSeries)&&P(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){let e=this.axis.pane.presenter,t=new Qy(null,e.data.aggregation,w.Normal,[pt(rt(e.data,null,`range`,`from`)),pt(rt(e.data,null,`range`,`to`))]);return t.barsToFetch=e.data.maxDataPoints||B.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=rt(e.display,null,`xAxis`,`visibleRange`),t.useLastTrade=e.data.useLastTrade,t.extendedHours=e.data.extendedHours,t}priceToY(e){return(this.hasDetachedScale?this.yScale:this.axis.yScale).priceToY(e)}get hasDetachedScale(){return P(this.detachedScale,this.yScale)&&this.detachedScale}hasCurveThat(e){return this.curves.some(e)}get hasVisibleCurves(){return this.hasCurveThat(VO)}get hasHitTestableCurves(){return this.hasCurveThat(HO)}getDetachedScaleMargins(){return B.DEFAULT_DETACHED_SCALE_MARGINS}setViewBox(e){if(!this.hasDetachedScale)return;let{y:t,height:n}=e,{top:r,bottom:i}=this.getDetachedScaleMargins();this.yScale.range([Math.floor(t+r*n),Math.floor(t+n-i*n)])}drawLevels(e){e.save();let t=B.OUT_OF_SCREEN;for(let n of this.levels.filter(e=>e.visible)){let r=this.priceToY(n.value);ms(e,hs({line:n.line,fill:IO})),zo(e,{x:-1,y:r},{x:t,y:r})}e.restore()}drawBands(e){e.save();let t=B.OUT_OF_SCREEN;for(let n of this.bands){let r=this.priceToY(n.range.to),i=this.priceToY(n.range.from);ms(e,hs({fill:n.fill,line:LO})),Lo(e,new Eo(-1,r,t,i-r),!1)}e.restore()}drawAnnotations(e){e.save(),this.annotations.forEach(t=>t.draw(e,!0)),e.restore()}getEventFields(){return!this.hasEvents||!this.hasEventsData?[]:this.eventsSeries.container.fields.filter(e=>e!==G.DateTime)}getEventsAt(e){let t=this.eventsSeries.container,n=n=>t.getData(n)[e];return this.getEventFields().map(t=>{let r=n(t);if(!P(r))return null;let i=this.getEventFor(t);if(!P(i))return null;let a={field:t,value:r,date:n(G.DateTime),text:i.title,color:i.color};if(t===G.Custom&&r===B.FAKE_CUSTOM_EVENT){let t=e%2==0;return{...a,value:t?`___news`:`___video`,text:t?`N`:`V`}}else return a}).filter(e=>e!=null)}getRefEventField(e,t,n,r){let i=r?.container,a=e.fields[0];t&&(a=e.isOhlc?G.High:n.isTick?G.Last:G.Close);let o=[a,e.fields[0]].filter(N);return N(i)?o.find(e=>i.hasField(e))??a:a}getRefPlot(e){return this.axis.pane.isMain?e.mainPlot:this}drawEvents(e,t){let n=this.axis.pane.presenter,r=n.view.xAxis.xScale,i=r.domain();if(!P(i)||!P(i[0],i[1]))return;let a=(e,t=G.DateTime)=>e.container.getData(t),o=a(this.eventsSeries),s=this.getRefPlot(n),c=s.timeSeries,l=a(c),u=n.data.aggregation,d=s===n.mainPlot,f=a(c,this.getRefEventField(s.mainCurve,d,u,c));if(!Array.isArray(f))return;let{chart:{fontFamily:p}}=this.axis.pane.presenter.display,m=e=>e.valueOf()>=i[0].valueOf()&&e.valueOf()<=i[1].valueOf(),h=o.flatMap((e,i)=>m(e)?this.getEventsAt(i).map(e=>{let i=eg(u,e.date),a=Te(l,+i,Number);if(a<0||a>=f.length)return null;let o=f[a];if(!Ze(o))return null;t.has(a)||t.set(a,-1);let s=t.get(a);t.set(a,++s);let c=r.timeToX(i),d=n.view.getEventRadius(),p=this.axis.yScale.priceToY(o)-s*(d+d+d);return{visible:!0,...e,x:c,y:p,r:d,rect:UO}}).filter(N):[]);e.save();let g=!0;h.forEach(t=>{t.rect=Ho(e,t,p),this.customEventPopup?.visible&&t.date===this.customEventPopup.date&&(this.showCustomEventPopup(t),g=!1)}),e.restore(),this._eventsData=h,this.customEventPopup?.visible&&g&&this.hideCustomEventPopup()}get customEventPopup(){return this.axis.pane.presenter.view.customEventPopup}hideCustomEventPopup(){this.customEventPopup?.hide()}showCustomEventPopup(e){let{x:t,y:n,r,date:i,value:a}=e;this.customEventPopup?.show({x:t+2*r,y:n-2*r},i,a)}getCustomEventDataAt(e){if(!this.isVisible||!this._eventsData)return null;let t=this._eventsData.find(t=>t.rect.contains(e));return t?.field===G.Custom?t:null}hitTestCustomEvent(e){return this.getCustomEventDataAt(e)!==null}hitTest(e){if(!this.isVisible)return!1;for(let t=0;t<this.curves.length;t++){let n=this.curves[t];if(n.visible&&n.hitTest(e))return!0}return!1}tryHandleCustomEventClick(e){let t=this.getCustomEventDataAt(e);return P(t)?(this.showCustomEventPopup(t),!0):!1}startHoverDim(e){let t=this.presenter?.shouldDimPlot(this)??!1;return t&&(e.save(),e.globalAlpha*=B.PLOT_HOVER_DIM_ALPHA),t}finishHoverDim(e,t){t&&e.restore()}isEmpty(){let e=this.timeSeries;return P(e)&&e.hasData&&e.container.isEmpty}draw(e){if(!this.isVisible)return;let t=this.startHoverDim(e);P(this.levels)&&this.drawLevels(e),P(this.bands)&&this.drawBands(e);for(let t of this.curves)t.draw(e);this.finishHoverDim(e,t)}drawEventsTopmost(e,t){if(!this.isVisible||!this.hasEventsData)return;let n=this.startHoverDim(e);this.drawEvents(e,t),this.finishHoverDim(e,n)}isComparison(e){return this.axis.comparison===e}invalidatePriceMappingCache(){this._firstVisibleDate=null}_priceMapper(e,t,n,r){if(!P(e)||!this.timeSeries.hasData||!this.shouldPriceMap(n,r))return e;let[i,a]=this.axis.pane.presenter.view.xAxis.xScale.domain()||[];if(!P(i)||!Fn(i))return e;if(this._firstVisibleDate!==i){this._firstVisibleDate=i;let e=this.timeSeries.container.getTimeData(),t=t=>Te(e,+t,Number);this.visFromIndex=t(i),this.visToIndex=t(a),this._priceMapFirstIndex.clear()}return this._priceMapFirstIndex.has(n)||this.canPriceMap(t,n),this.priceMap(e,t,n,!1,r)}isOhlcMapping(e){return this.mainCurve.isOhlc&&BO(e)}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===G.PreviousClose?G.Close:e}dataOf(e){return this.timeSeries.container.getData(e)}canPriceMap(e,t){let n=this.getRefPriceMapField(t),r=this.dataOf(n),i=null,a=this.visFromIndex;for(;i===null&&a<=this.visToIndex;)i=r[a++];this._priceMapFirstIndex.set(n,i===null?NaN:a-1)}priceMap(e,t,n,r=!1,i=x.None){let a=this.getRefPriceMapField(n),o=this._priceMapFirstIndex.get(a);if(!Number.isFinite(o))return e;let s=this.dataOf(a)[o];return this.isComparison(x.Percent)||i===x.Percent?r?s+s*e/100:(e>=s?1:-1)*(Math.abs(e-s)*100)/Math.abs(s):r?s+e:e-s}shouldPriceMap(e,t){return P(t)?t!==x.None:this.isComparison(x.Percent)||this.isComparison(x.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}},GO=class extends WO{_symbol;_showPrevious;yearOffset;resolved=null;events;inputs=[];_eventsSeries;compare;tracePlot(e,t={}){Ih(e,{chartId:this.axis?.pane?.presenter?.elementId,symbol:this.symbol,...t})}get symbol(){return this._symbol}get title(){return this.symbol}get showPrevious(){return this._showPrevious}getPreviousValue(){if(!P(this.timeSeries)||!P(this.timeSeries.record))return null;let e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(G[e])}getTimeSeries(){let e=$().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.symbol,this.mainCurve.style){case h.Renko:case h.Kagi:case h.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case h.Range:t.barsToFetch=4e3;break;case h.LineBreak:t.inputs=this.inputs;break}let n=this.axis.pane;if(P(n.alignedToYear)){let e=Ki(this.resolved??t.symbol);e!==null&&(this.yearOffset=n.alignedToYear-e.getFullYear(),t.offset=this.yearOffset)}let r=e.getTimeSeries(t);this.timeSeries=this.wrapIfAdvancedStyle(r),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:re.Unspecified};this.presenter?.notifyHost(K.TS_MANYCHANGED,e),this.getEvents()}})}getMetaData(){let e=$().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(K.MD_CHANGED,{plot:this})})}getEvents(){if(!this.hasEvents)return;let e=$().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:w.Events,getHashKey:function(){return Object.values(this).filter(e=>typeof e!=`function`).join(`|`)}};B.EVENTS.forEach(e=>{t[e]=rt(this.events,!1,e,`show`)}),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then(e=>{e&&this.presenter?.notifyHost(K.TS_EVENTSCHANGED,{series:this.eventsSeries})})}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return P(this.events)?B.EVENTS.some(e=>rt(this.events,!1,e,`show`)):!1}findEvents(e){if(!this.hasEventsData||e[0]===null||e[1]===null)return[];let t=e[0],n=e[1];if(n>0&&this.axis?.pane?.presenter?.data?.aggregation?.isIntraday){let e=this.timeSeries.container.getTimeData()[n-1];if(this.compare(e,t))return[]}return this.eventsSeries.container.getTimeData().map((e,n)=>this.compare(e,t)?this.getEventsAt(n):[]).flat()}fromModel(e){super.fromModel(e);let t=e;this._showPrevious=t.showPrevious,this.events=t.events,this.inputs=t.inputs||[],this.compare=Mu(this.axis.pane.presenter.data.aggregation),this._symbol=t.symbol}getEventFor(e){let t=this.events[e.id.toLowerCase()];return!P(t)||!t.show?null:t}async initialize(){return da.call(this,async()=>(this.tracePlot(`plot:init:start`),this.resolved=await wi(this.symbol),this.isShutDown?(this.tracePlot(`plot:init:aborted`,{resolved:this.resolved}),!1):(this.getMetaData(),this.getTimeSeries(),this.tracePlot(`plot:init:ready`,{resolved:this.resolved}),!0)))}},KO=class extends GO{seriesKind;fundamental;constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${g[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=g[e.fundamental],super.fromModel(e)}makeQuery(){let e=new Qy(this.symbol,new Ru(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}},qO=class{longPressTimeout;constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){let e=$().config.touchCrosshairDelayMillis;return P(e)&&Number.isFinite(e)?e:B.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,n){Ie()&&(this.longPressTimeout=setTimeout(()=>this.longPressTriggered(e,t,n),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,n){this.cancelLongPress(),this.performLongPress(e,t,n)}cancelLongPress(){Ie()&&P(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,n){}};function JO(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}var YO=class extends qO{annotation;previous;onLongPress;cursorSet;moved;snapToSupported;constructor(e,t,n,r){super(),this.annotation=e,this.previous=t,this.onLongPress=r,this.cursorSet=!1,this.moved=!1,this.snapToSupported=!1,this.startLongPress(null,t,n)}performLongPress(e,t,n){this.onLongPress?this.onLongPress():qk(this.annotation,n)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),JO(this.annotation))return;let{point:t,view:n,offset:r}=e;if(!t||t.axis.pane!==this.annotation.axis.pane)return;let i=this.annotation.axis.toAnnotationPoint(r);if(!N(i)||i.axis!==this.annotation.axis)return;n.drawCrosshair({ap:i,offset:r}),this.cursorSet||=(this.previous.axis.pane.presenter.view.setCursor(ee.Move),!0);let a=ao(i.point,this.previous.point);this.annotation.offset(a),this.annotation.wasModifiedByTool(),this.annotation.requestRedraw(),this.previous=i,this.moved=!0}onMouseUp(e){this.cancelLongPress(),vj(this.annotation,this.moved,O.Moved)}},XO=class{annotation;pointIndex;snapToSupported=!0;moved=!1;alignPointsMode=!1;constructor(e,t){this.annotation=e,this.pointIndex=e.points.indexOf(t)}onMouseMove(e){if(this.alignPointsMode=e.getModifier(D.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),JO(this.annotation))return;let{point:t,view:n,offset:r}=e;if(!t||t.axis.pane!==this.annotation.axis.pane)return;let i=this.annotation.axis.toAnnotationPoint(r);if(n.drawCrosshair({ap:i,offset:r}),P(i)){let e=this.annotation.points[this.pointIndex],t=ao(i.point,e.point);switch(e.moveDirection){case te.Both:e.update(i.price,i.time);break;case te.Horizontal:e.update(e.price,i.time);break;case te.Vertical:e.update(i.price,e.time);break;default:break}this.moved=e.moveDirection!==te.None,this.moved&&this.annotation.wasPointMovedByTool(e,t)}this.annotation.requestRedraw()}onMouseUp(e){vj(this.annotation,this.moved,O.PointMoved)}},ZO=class{anchor;isVertical;axis;constructor(e,t,n){this.anchor=e,this.isVertical=t,this.axis=n}hitTest(e){return P(this.anchor)?this.isVertical?Math.abs(e.x-this.anchor.x)<=B.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=B.HIT_TEST_TOLERANCE:!1}draw(e){let t=B.OUT_OF_SCREEN;this.isVertical?Bo(e,this.anchor.x,-t,t):Vo(e,this.anchor.y,-t,t)}},QO=class{id;axis;_price;_time;passive=!1;moveDirection=te.Both;visible=!0;point;constructor(e,t,n){this.id=bt(),this.axis=e,t!==void 0&&n!==void 0&&(this.price=t,this.time=n,this.toPoint())}get price(){return this._price}set price(e){this._price=e}get time(){return this._time}set time(e){this._time=e}get movable(){return this.moveDirection!==te.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){let e=this.axis.toPoint(this);P(e)&&Ze(e.x)&&Ze(e.y)&&(this.point=e)}update(e,t){this.price=e,this.time=typeof t==`number`?new Date(t):t,this.toPoint()}updateFromPoint(e){let t=this.axis.toAnnotationPoint(e);this.price=t.price,this.time=t.time,this.point=e}hitTest(e){return this.visible?this.distance(e)<=B.HIT_TEST_TOLERANCE:!1}distance(e){let t=e.x-this.point.x,n=e.y-this.point.y;return Math.abs(Math.sqrt(t*t+n*n)-B.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(P(this.point)){let n=B.HALF_ANN_POINT_DIMENSION;P(t)&&t.locked&&(n*=.6),e.beginPath(),e.ellipse(this.point.x,this.point.y,n,n,0,0,2*Math.PI),e.stroke()}}};function $O(e){return vo(e.fill.color).a===0?e.line.color:e.fill.color}function ek(e,t){return{owner:e.axis.annotationUndoOwner,position:e.axis.findIndex(e),uid:e.uid,id:e.name,traits:{...e.extractTraits(!0),...e.extractTraits(!1)},extras:{},points:e.extractPoints(),visible:e.visible,locked:e.locked,isUndoRedo:!0,toolChange:t}}function tk(e){return{uid:e.uid,id:e.name,traits:e.extractTraits(!0),extras:e.extractTraits(!1),points:e.extractPoints(),visible:e.visible,locked:e.locked,chart:e.axis.pane.presenter.accessor}}var nk=class{points=[];isSelected=!1;drawn=!0;axis;name;uid;alignPointsSupported=!1;visible=!0;locked=!1;computed=!1;_traits;adjustFill;constructor(e,t){this.axis=e,this.name=t,this.uid=bt()}requestRedraw(){this.axis.pane.presenter.view?.redraw()}prepareDraw(e,t){let n=!this.isSelected||!this.axis.pane.presenter.annotationManipulation;return this.drawPoints(e,t,n),this.readyToDraw()}readyToDraw(){return this.activePoints.every(e=>e.point!==void 0)}getPriceScaleAdornments(){return B.EMPTY_ARRAY}getTimeScaleAdornments(){return B.EMPTY_ARRAY}extractTraits(e=!0){let t=F(this.traits),n=Vs(this.name);return Object.keys(t).forEach(r=>{let i=n.includes(r);(e&&!i||!e&&i)&&delete t[r]}),e||[`line`,`fill`,`zIndex`].forEach(e=>delete t[e]),t}extractPoints(){return this.activePoints.map(e=>({price:e.price,time:Xe(+e.time,4)}))}offset(e){this.points.filter(e=>e.movable).forEach(t=>{t.updateFromPoint(oo(t.point,e))})}get traits(){return this._traits||=F(this.defaultTraits),this.adjustFill&&=(this._traits.fill.color=$O(this._traits),!1),this._traits}set traits(e){e!==void 0&&ht(this.traits,e)}get activePoints(){return this.points.filter(e=>!e.passive)}get style(){return hs(this.traits)}get defaultTraits(){return ps(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return hs(this.defaultTraits)}get isVisible(){return FO(this,this.axis.pane.presenter.display)}get adornStyle(){let e=F(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=B.COLOR_TRANSPARENT,hs(e)}get pointsStyle(){let e=F(this.defaultTraits);return e.line.dashStyle=`Solid`,hs(e)}get allowPricesChangeUI(){return this.traits?.allowPricesChangeUI}wasModifiedByTool(){}wasPointMovedByTool(e,t){}onFormatterChanged(){}isPointDrawn(e){return e.price!==void 0}drawPoints(e,t,n=!0){this.isVisible&&this.points.forEach(r=>{let i=this.isPointDrawn(r),a=P(e);t&&(i||!a)&&r.toPoint(),n&&a&&i&&(this.isSelected||this.drawn)&&(ms(e,this.pointsStyle),r.draw(e,this))})}addPoints(e){for(let t=0;t<e;t++)this.points.push(new QO(this.axis))}toModel(){let e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:F(this.traits)}}canMove(e){return!0}updatePoints(e){}updateActivePoints(e){let t=this.activePoints;t.length===e.length&&t.forEach((t,n)=>{let r=e[n];t.update(r.price,r.time)})}updateFrom(e,t,n,r,i){typeof r==`boolean`&&(this.visible=r),typeof i==`boolean`&&(this.locked=i);let a=P(e)?F(e):{};P(t)&&ht(a,t),this.traits=a,P(n)&&this.updatePoints(n)}priceMap(e){return this.axis.priceMap(e)}flip(e){let t=this.getFlipAnchorIndices();if(!N(t))return;let n=this.points[t[0]],r=this.points[t[1]];if(e){let e=r.time;r.update(r.price,n.time),n.update(n.price,e)}else{let e=r.price;r.update(n.price,r.time),n.update(e,n.time)}this.wasModifiedByTool()}getFlipAnchorIndices(){return null}};function rk(e,t,n,r){return function(i,a=!0){let o=new t(i,e,n);return a?i.appendAnnotation(o):o.drawn=!1,P(r)&&(o.traits=r),o}}var ik=class{axis;angle;extent;anchor1;anchor2;p1;p2;style;extended;_data;isTrend;constructor(e,t,n,r,i){this.axis=i,P(e,t)&&(this.angle=so(e,t),this.extent=this.getExtent(e,t),this.anchor1=e,this.anchor2=t,this.p1=n?this.extendPoint(t,-1):e,this.p2=r?this.extendPoint(e,1):t),this.extended=n||r}extendPoint(e,t){return{x:e.x+t*this.extent*Math.cos(this.angle),y:e.y+t*this.extent*Math.sin(this.angle)}}getExtent(e,t){let n=Math.max(Math.abs(e.x),Math.abs(t.x)),r=Math.max(Math.abs(e.y),Math.abs(t.y));return Math.sqrt(n*n+r*r)+B.OUT_OF_SCREEN}hitTest(e){return P(this.p1,this.p2)?co([this.p1,this.p2],e,B.HIT_TEST_TOLERANCE):!1}draw(e){P(this.p1,this.p2)&&(zo(e,this.p1,this.p2),this.extended)}getAdornOffset(e){let t=No(e),n=jo(e,1);return ro(this.p1,this.p2)<0&&(t.y=n+5),t}},ak=class{style;axis;rect;constructor(e,t,n,r){this.axis=r,this.rect=new Eo(e.x,e.y,t,n)}hitTest(e){return this.rect.contains(e)}draw(e,t){Lo(e,this.rect)}},ok=class extends nk{countCache;constructor(e,t){super(e,t)}draw(e,t){if(!(!this.isVisible||!this.prepareDraw(e,t))&&!this.getScreenPoints().some(e=>!P(e))&&!this.drawn){let t=this.getElements();ms(e,this.style),t.forEach((t,n)=>{ms(e,this.getStyleForElement(t,n)),t.draw(e)}),ms(e,this.adornStyle),this.adornElements(t,e);let n=this.getMarkers();ms(e,this.style),n.forEach(t=>{t.draw(e)})}}getBarCount(e,t){if(this.countCache===void 0||this.countCache.time1!==e||this.countCache.time2!==t){let n=this.axis.pane.presenter.view,r=Math.abs(n.toIndex(e)-n.toIndex(t));this.countCache={time1:e,time2:t,barCount:r}}return this.countCache.barCount}getElements(){return[]}get presenter(){return this.axis.pane.presenter}get formatter(){return this.presenter.mainPlot.metaData}data(e){return this.presenter.mainPlot.timeSeries.container.getData(e)}getScreenPoints(){return this.points.map(e=>e.point)}getStyleForElement(e,t){return this.style}adornElements(e,t){}hitTestAdornments(e,t){return!1}getTextRef(){return null}hitTest(e){if(!this.drawn&&this.isVisible){if(this.getScreenPoints().some(e=>!P(e)))return!1;let t=this.getElements(),n=this.getMarkers();return t.some(t=>t.hitTest(e))||n.some(t=>t.hitTest(e))?!0:this.hitTestAdornments(t,e)}return!1}updatePointsFrom(e,t=0){e.forEach((e,n)=>this.points[t+n].update(e.price,e.time))}updatePoints(e){this.allowPricesChangeUI&&this.updatePointsFrom(e)}getMarkers(){return[]}get marker(){return this.traits?.marker}get showPrices(){return this.traits?.showPrices}get singleStyle(){return tt(this.traits?.singleStyle,!0)}get showBackground(){return tt(this.traits?.showBackground,!1)}get backgroundOpacity(){return tt(this.traits?.backgroundOpacity,0)}fillOnlyStyle(e){return hs({line:{color:B.COLOR_TRANSPARENT,dashStyle:`Solid`,width:0},fill:this.traits[e]})}lineOnlyStyle(e){return hs({fill:{color:B.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new ik(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return fo(uo(e),this.backgroundOpacity)}getTraitsFor(e){let t={fill:{color:B.COLOR_TRANSPARENT},line:{...e.line}};return this.showBackground&&(t.fill.color=this.applyBackgroundOpacity(t.line.color)),t}getFlipAnchorIndices(){return this.points.length===2?[0,1]:null}},sk=class extends ok{_factors;constructor(e,t){super(e,t)}get factorsPropName(){return B.AT_FACTORS}get factors(){return cs(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[B.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[B.AT_LEVELS_KIND]}get labels(){return this.traits[B.AT_LABELS]}get isExtended(){return this.points.length===3}isBefore(e,t){return this.points[e].time<this.points[t].time}comparePoints(e,t,n){let r=this.isBefore(e,t);return n||(r=!r),this.points[r?e:t].point}getPoint(e){return this.isExtended?this.comparePoints(1,2,e):this.comparePoints(0,1,e)}get leftPoint(){return this.getPoint(!0)}get rightPoint(){return this.getPoint(!1)}get pricesOnScale(){return this.traits[B.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){let n=this.levelsKind===B.AT_LEVELS_PERCENTS,r=``;if(this.showLevels&&(r=n?`${(e*100).toFixed(1)}%`:e.toString()),this.showPrices){let e=this.priceMap(this.axis.toPrice(t));r=(r+` (${rv(this.axis,e)})`).trim()}return r}getAdornPointAndAlign(e,t){let n=this.labels,r=e instanceof ik,i=(e,t,n)=>({pt:e,align:t,offset:n});switch(n){case B.AT_LABELS_LEFT:return i(r?e.anchor1:e,T.Right,-t);default:case B.AT_LABELS_RIGHT:return i(r?e.anchor2:e,T.Left,t);case B.AT_LABELS_CENTER:return i(r?no(e.anchor1,e.anchor2):e,T.Center,0)}}getColoredElements(e){let t=this.singleStyle;return this.factors.map(n=>{let r=e(n);return r===null?null:(t||(r.style=hs(this.getTraitsFor(n))),r._data={factor:n.value},r)}).filter(e=>e!==null)}hitTestAdornments(e,t){let n=this.showLevels,r=this.getTextRef();if(!n||r===null)return!1;let i=this.axis.pane.presenter,a=i.view?.mainContext;if(!a)return!1;let o=null,s=!1;a.save();let{chart:{fontFamily:c},yAxis:{fontSize:l}}=i.display;a.font=`${l??12}px ${c}`;for(let n of e){if(!P(n._data))continue;let{factor:e}=n._data,{ref:i,spacing:c,offsetY:l,text:u}=r(o,n,e),{pt:d,align:f,offset:p}=this.getAdornPointAndAlign(i,c);if(Po(a,u,this.getAdornTextPoint(a,l,d,p),f).contains(t)){s=!0;break}o=n}return a.restore(),s}adornElementsForColoredFactors(e,t,n,r){let i=this.singleStyle,a=this.showBackground,o=this.showLevels,s=this.applyBackgroundOpacity(this.traits.line.color),c=r.fillStyle,l=null;e.forEach(e=>{if(!P(e._data))return;let{factor:u}=e._data;if(a){let n=t(l,e);r.fillStyle=i?s:e.style.fillStyle,r.fill(n)}if(o){let{ref:t,spacing:a,offsetY:o,text:s}=n(l,e,u),{pt:d,align:f,offset:p}=this.getAdornPointAndAlign(t,a);Fo(r,s,this.getAdornTextPoint(r,o,d,p),f,i?c:e.style.strokeStyle)}l=e})}getAdornTextPoint(e,t,n,r){let i=jo(e,.75);return oo(n,{x:r,y:t===!0?i/2:t})}},ck=class extends ok{lines;constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(B.AT_FILL)}get rect(){let[e,t,,]=this.getScreenPoints(),n=new ak({x:e.x,y:Math.min(e.y,t.y)},t.x-e.x,Math.abs(e.y-t.y),this.axis);return n.style=this.rectStyle,n}get reverse(){return!1}getLinesDataAtLevels(e,t){let[n,r]=this.points;if(this.reverse&&([n,r]=[r,n]),this.lines==null){let i=(e,t=!1)=>n=>({level:n.value,domain:e(n.value),traits:this.getTraitsFor(n),isPrice:t}),a=r.price-n.price,o=i(e=>n.price+e*a,!0),s=e?.map(o)??[],c=this.axis.pane.presenter.timeline,l=Te(c,+n.time,Number,dv),u=Te(c,+r.time,Number,dv)-l,d=i(e=>+c.at(l+Math.floor(e*u))),f=t?.map(d)||[];this.lines={prices:s,times:f,barsDiff:u,priceDiff:a}}return this.lines}makeColoredLine(e,t,n){let r=this.makeLine(e,t);return this.singleStyle||(r.style=hs(n.traits)),r._data={level:n.level,isPrice:n.isPrice},r}getLineElements(e){let[t,n]=this.getScreenPoints();return{priceLines:e.prices.map(e=>{let r=this.axis.toY(e.domain);return this.makeColoredLine({x:t.x,y:r},{x:n.x,y:r},e)}),timeLines:e.times.map(e=>{let r=this.presenter.view.toX(e.domain);return this.makeColoredLine({x:r,y:t.y},{x:r,y:n.y},e)})}}getStyleForElement(e,t){return e.style||super.getStyleForElement(e,t)}resetComputedState(){}wasModifiedByTool(){this.resetComputedState()}wasPointMovedByTool(e,t){this.wasModifiedByTool()}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}},lk=class extends QO{priceRef;timeRef;constructor(e,t,n){super(e),this.priceRef=t,this.timeRef=n,this.passive=!0}get price(){return this.priceRef.price}get time(){return this.timeRef.time}set price(e){this.priceRef.price=e}set time(e){this.timeRef.time=e}},uk=class{points;constructor(e){this.points=e}get left(){return Math.min(this.points[0].point.x,this.points[1].point.x)}get top(){return Math.min(this.points[0].point.y,this.points[1].point.y)}get width(){return Math.abs(this.points[1].point.x-this.points[0].point.x)}get height(){return Math.abs(this.points[1].point.y-this.points[0].point.y)}getRect(){return P(this.points[0].point,this.points[1].point)?new Eo(this.left,this.top,this.width,this.height):null}};function dk(e){let t=new QO(e),n=new QO(e);return[t,n,new lk(e,t,n),new lk(e,n,t)]}var fk=class extends nk{helper;constructor(e,t){super(e,t),this.points=dk(e),this.helper=new uk(this.points)}get left(){return this.helper.left}get top(){return this.helper.top}get width(){return this.helper.width}get height(){return this.helper.height}getRect(){return this.helper.getRect()}draw(e,t){return!this.isVisible||!this.prepareDraw(e,t)?!1:(ms(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&e.length===2&&e.forEach((e,t)=>this.points[t].update(e.price,e.time))}},pk=class{points;lines;axis;helper;_actualWidth=0;_fontSizeForWidth=0;constructor(e,t,n){this.points=e,this.lines=t,this.axis=n,this.helper=new uk(this.points)}hitTest(e){let t=this.getRect();return N(t)?(t.width=this._actualWidth,t.contains(e)):!1}getRect(){return this.helper.getRect()}get fontSize(){if(this.lines.length===0)return 0;let{height:e}=this.getRect();return Math.floor(e/this.lines.length)}computeActualWidth(e){(this._actualWidth<=0||this._fontSizeForWidth!==this.fontSize)&&(this._actualWidth=Math.max(...this.lines.map(t=>e.measureText(t).width)),this._fontSizeForWidth=this.fontSize)}draw(e){if(this.lines.length===0)return;e.save();let{x:t,y:n}=this.getRect(),{chart:{fontFamily:r}}=this.axis.pane.presenter.display,i=this.fontSize;e.textAlign=`left`,e.textBaseline=`top`,e.font=`${i}px ${r}`,this.lines.forEach((r,a)=>{let o=n+i*a;e.fillText(r,t,o)}),this.computeActualWidth(e),e.restore()}},mk=class extends ok{textEditable;_textAnnElement;constructor(e,t){super(e,t),this.textEditable=!0,this.points=dk(e),this.adjustFill=!0}get textLines(){return this.traits[B.AT_TEXT_LINES]}set textLines(e){this.traits[B.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!P(this._textAnnElement)&&this.isVisible&&(this._textAnnElement=new pk(this.points,this.textLines,this.axis)),this._textAnnElement}updateFrom(e,t,n,r,i){super.updateFrom(e,t,n,r,i),this._textAnnElement=void 0}getElements(){return this.isVisible?[this.textElement]:[]}},hk=class extends mk{constructor(e,t){super(e,t),this.textEditable=!1}canMove(e){return this.isVisible?this.textElement.hitTest(e):!1}get prices(){return this.traits.prices}get pricesPoints(){let e=this.points[0].time;return this.prices.map(t=>new QO(this.axis,t,e))}updateFrom(e,t,n,r,i){super.updateFrom(e,t,n,r,i),P(e?.textLines)&&(this.textLines=e.textLines)}getElements(){let e=super.getElements(),t=this.pricesPoints.map(e=>new ZO(e.point,!1,this.axis));return e.concat(t)}getPriceScaleAdornments(){if(!this.showPrices)return super.getPriceScaleAdornments();let e=this.traits.line;return this.prices.map(t=>({price:t,color:e.color}))}get defaultFont(){let{chart:{fontSize:e,fontFamily:t}}=this.axis.pane.presenter.display;return[e??13,t]}updateOtherPoints(e){let[t,n]=this.defaultFont;e.save(),e.font=`${t}px ${n}`;let r=Math.max(...this.textLines.map(t=>e.measureText(t).width)),{x:i,y:a}=this.points[0].point;this.points[1].updateFromPoint({x:i+r,y:a+this.textLines.length*t}),e.restore()}},gk=class{annId;annotation;constructor(e){this.annId=e}onKeyDown(e){if(this.annId==null)return;let{key:t,code:n,presenter:r}=e;Re(t,n)&&(P(this.annotation)&&(this.annotation.axis.deleteAnnotation(this.annotation,!1),r.view.redraw()),_j(r,{toolChange:O.Cancelled,annId:this.annId}))}},_k=class extends gk{factory;thirdPoint;dragged=!1;snapToSupported=!0;isDrawingAnnotation=!0;forceAlignPoints=!1;indices;alignPointsMode=!1;constructor(e,t=!1){super(e.annName),this.factory=e,this.thirdPoint=t,this.indices=t?[0,1,2]:[0,1]}signalChange(){this.annotation.wasModifiedByTool(),this.annotation.requestRedraw()}onMouseDown(e){let{point:t,button:n}=e;if(t===void 0)return;let r=N(this.annotation);if(n===E.Left)if(r){let e=!this.thirdPoint||this.dragged?1:2;this.annotation.points[e].update(t.price,t.time),this.dragged=!1,this.signalChange(),(!this.thirdPoint||e===2)&&this.finish()}else this.dragged=!0,t.axis.pane.presenter.clearSelection(),this.annotation=this.factory(t.axis),this.annotation.drawn=!1,this.indices.forEach(e=>this.annotation.points[e].update(t.price,t.time)),this.signalChange();return!0}onMouseMove(e){let{point:t,view:n,offset:r}=e;return n.drawCrosshair({ap:t,offset:r}),P(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(D.Shift),this.dragged?(this.annotation.points[1].update(t.price,t.time),this.signalChange()):this.thirdPoint&&!this.dragged&&(this.annotation.points[2].update(t.price,t.time),this.signalChange())),!0}finish(){vj(this.annotation,!0,O.Created)}isAccidentalMouseUp(e){let{point:t}=e,n=this.annotation.points[0].point;return!t?.point||!n?!1:io(t.point,n)<B.HIT_TEST_TOLERANCE}onMouseUp(e){if(this.annotation===void 0){bj(e);return}if(this.isAccidentalMouseUp(e)){this.dragged=!0;return}this.dragged=!1,this.thirdPoint||this.finish()}},vk=class extends _k{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}},yk=class extends _k{constructor(e){super(e,!1),this.snapToSupported=!1}onMouseMove(e){let{point:t,view:n,offset:r}=e;if(n.drawCrosshair({ap:t,offset:r}),P(this.annotation)&&this.dragged){let[e,n]=this.annotation.points;n.update(t.price,t.time);let r=ao(n.point,e.point),i=e.point.y+r.x*Math.sign(r.y)*Math.sign(r.x),a=this.annotation.axis.toPrice(i);n.update(a,t.time),this.signalChange()}return!0}},bk=class extends gk{factory;existing;isNew;anchor;clicks=0;snapToSupported=!1;isDrawingAnnotation;textArea;constructor(e,t){super(e?e.annName:null),this.factory=e,this.existing=t,this.isNew=!P(t),this.isNew||(this.anchor=this.existing.points[0]),this.isDrawingAnnotation=this.isNew}getChartParent(){return this.anchor.axis.pane.presenter.view.canvasContainer}styleProps(){if(this.isNew)return{height:100,fontSize:`100%`,color:$O(ps(this.anchor.axis.pane.presenter.display,`Text`))};{let e=this.existing.textElement;return{height:e.getRect().height*1.05,fontSize:`${Math.round(e.fontSize)}px`,color:this.existing.traits[B.AT_FILL].color}}}onMouseDown(e){let{point:t}=e;if(this.isNew)if(this.clicks===0){if(t===void 0){bj(e);return}t.axis.pane.presenter.clearSelection(),this.anchor=t,this.clicks++,this.startEditing()}else this.onEndEditing();else this.onEndEditing()}startEditing(){this.textArea=document.createElement(`textarea`);let{x:e,y:t}=this.anchor.point,n=this.anchor.axis.pane.getBounds(),r=n.x+n.width-this.anchor.point.x,{height:i,fontSize:a,color:o}=this.styleProps();ra(this.textArea,{position:`absolute`,top:`${t}px`,left:`${e}px`,border:`none`,outline:`none`,overflow:`hidden`,height:`${i}px`,width:`${r}px`,resize:`none`,backgroundColor:`rgba(255, 255, 255, 0.05)`,zIndex:`5`,fontSize:a,color:o}),this.getChartParent().appendChild(this.textArea),this.textArea.onblur=this.onEndEditing.bind(this),this.textArea.onkeydown=e=>e.stopImmediatePropagation(),this.isNew||(this.textArea.value=this.existing.textLines.join(`
|
|
38
38
|
`),this.existing.textLines=[``],this.existing.requestRedraw()),setTimeout(()=>this.textArea.focus(),100)}onEndEditing(){let e=this.anchor,t=this.isNew?this.factory(e.axis):this.existing,n=this.textArea.value.split(`
|
|
39
39
|
`);if(this.isNew){let{actualWidth:r,actualHeight:i}=this.getTextDimensions(n);t.points[0].update(e.price,e.time);let{x:a,y:o}=t.points[0].point;t.points[1].updateFromPoint({x:a+r,y:o+i}),t.drawn=!1}t.textLines=n,this.textArea.onblur=null,this.getChartParent().removeChild(this.textArea),t.requestRedraw(),this.isNew||t.requestRedraw(),vj(t,!0,this.isNew?O.Created:O.TextChanged)}getTextDimensions(e){let t=globalThis.getComputedStyle(this.textArea).getPropertyValue(`font-size`),n=parseFloat(t)*e.length,r=0,i=this.anchor.axis.pane.presenter,a=i.view.mainContext;a.save();let{chart:{fontFamily:o}}=i.display;a.font=`${t} ${o}`;for(let t=0;t<e.length;t++){let n=a.measureText(e[t]).width;n>r&&(r=n)}return a.restore(),{actualWidth:r,actualHeight:n}}};function xk(e){return $().config.tooltipMovement===e}function Sk(){return xk(`Draggable`)}function Ck(){return xk(`Auto`)}var wk=B.TOOLTIP_STD_LEGACY_CLASS,Tk=B.TOOLTIP_STD_CLASS,Ek=B.TOOLTIP_BUBBLE_CLASS;function Dk(e,t){let n=e.filter(e=>!e.isHidden),r=e=>N(e.val)&&Number.isFinite(e.y),i=n.find(e=>e.isMain)||n[0],a=i?.values.find(e=>[`Close`,`Last`].includes(e.id)&&r(e))?.y??i?.values.find(r)?.y??t,o=n.map(e=>e.values.filter(e=>e.id!==`Change`&&e.y>0&&r(e)).map(e=>e.y)).flat(),[s,c]=o.length>0?[Math.min(...o),Math.max(...o)]:[a,a];return{plots:n,y:a,yMin:s,yMax:c,hasData:n.some(e=>e.values.some(r))}}var Ok=class{view;tooltipElem;leftSide;mode;isDrag=!1;layoutTop=0;canDrag;isToggling;constructor(e){this.view=e,this.tooltipElem=sa(e.el,`div`),ia(this.tooltipElem,{id:`${e.presenter.elementId}-global-tooltip`,class:`${Tk} ${wk}`}),this.leftSide=!0,ra(this.tooltipElem,{visibility:`hidden`,position:`absolute`,cursor:Sk()?`move`:`default`,zIndex:20,top:`${B.TOOLTIP_Y_OFFSET}px`,left:`${B.TOOLTIP_X_OFFSET}px`}),this.setMode(e.presenter.display.tooltip.mode),this.handleMouseMove=this.handleMouseMove.bind(this),this.startDrag=this.startDrag.bind(this),this.stopDrag=this.stopDrag.bind(this),this.view.el.addEventListener(`mousemove`,this.handleMouseMove),this.view.el.addEventListener(`mouseleave`,this.stopDrag),this.tooltipElem.addEventListener(`mousedown`,this.startDrag),this.tooltipElem.addEventListener(`mouseup`,this.stopDrag)}startDrag(){this.isDrag=!0}stopDrag(){this.isDrag=!1}setMode(e){if(this.mode!==e){if(this.mode=e,e===B.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition=`none`,this.tooltipElem.classList.remove(Tk,wk),this.tooltipElem.classList.add(Ek),ra(this.tooltipElem,{pointerEvents:`none`});else if(e===B.TOOLTIP_STD){this.canDrag=Sk(),this.tooltipElem.classList.remove(Ek),this.tooltipElem.classList.add(Tk,wk);let e=B.TOOLTIP_TOGGLE_SIDE_ANIM_MS;this.layoutTop=this.view.xAxis?.contentBounds?.y??0,ra(this.tooltipElem,{pointerEvents:`all`,top:`${this.layoutTop+B.TOOLTIP_Y_OFFSET}px`,left:`${B.TOOLTIP_X_OFFSET}px`,transition:Ck()?`left ${e}ms ease-out`:null})}}}show(e,t){let n=this.tooltipElem;if(t){let{width:e,height:r,leftOffset:i,rightOffset:a}=this.view,o=n.getBoundingClientRect(),s=o.width/2,c=n.style,l=r*B.TOOLTIP_BUBBLE_OFFSET,u=t.yMin-o.height-l,d=t.x-s,f=t.yMax+l,p=f+o.height,m=this.view.xAxis?.contentBounds,h=m?.y??0,g=m?m.y+m.height:r,_=u<h?p<g?f:h:u,v=d,y=e-a;v<i?v=i:v+o.width>y&&(v=y-o.width),c.top=`${_}px`,c.left=`${v}px`}n.style.visibility===`hidden`&&(n.style.visibility=`visible`),la(n,e)}hide(){this.tooltipElem.style.visibility=`hidden`}remove(){this.view.el.removeEventListener(`mousemove`,this.handleMouseMove),this.view.el.removeEventListener(`mouseleave`,this.stopDrag),this.tooltipElem.removeEventListener(`mousedown`,this.startDrag),this.tooltipElem.removeEventListener(`mouseup`,this.stopDrag),ta(this.tooltipElem)}reposition(e,t){ra(this.tooltipElem,{left:`${e}px`,top:`${t}px`})}isAutoMove(){return this.mode===B.TOOLTIP_STD&&Ck()}handleMouseMove(e){if(this.isDrag&&this.canDrag){let{movementX:t,movementY:n}=e,{top:r,left:i}=this.tooltipElem.style,a=parseInt(r)+n,o=parseInt(i)+t;this.reposition(o,a)}else if(this.isAutoMove()){let t=this.tooltipElem.getBoundingClientRect(),n=this.view.el.getBoundingClientRect(),r=e.pageX,i=B.TOOLTIP_TOGGLE_DISTANCE_TOLERANCE,a=n.width>t.width*2,o=r>t.x&&r<=t.right+i,s=r<t.x&&r>=t.x-i;a&&(o||s)&&this.toggleSide()}}repositionForLayout(){let e=this.view.xAxis?.contentBounds?.y??0;if(this.mode===B.TOOLTIP_STD&&e!==this.layoutTop){let t=parseFloat(this.tooltipElem.style.top),n=Number.isFinite(t)?t:B.TOOLTIP_Y_OFFSET;this.tooltipElem.style.top=`${n+e-this.layoutTop}px`}this.layoutTop=e}repositionAuto(){if(this.isAutoMove()){let e=this.view.presenter.mainPane.getBoundsWithoutScales(),t=parseFloat(this.tooltipElem.style.top),n=e.x+(this.leftSide?B.TOOLTIP_X_OFFSET:e.width-this.tooltipElem.offsetWidth-B.TOOLTIP_X_OFFSET);this.reposition(n,t)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout(()=>this.isToggling=!1,B.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}};function kk(e){e.showTooltip&&Ak(e,{time:B.ZERO_DATE,offset:B.OFFSCREEN_OFFSET,price:0,lastBarRefresh:void 0,justMain:void 0})}function Ak(e,{time:t,lastBarRefresh:n,justMain:r,offset:i,price:a}){let o=Fv(e,t,i,n,r,a),{mode:s,showMainPlot:c,hideSymbols:l,revealingClose:u}=e.display.tooltip,{includeTimestamp:d,showMainPlot:f,showPlotActions:p}=$().config.tooltipHeaders||{},m=P(f)?f:c,h=P(d)?d:!1,g=P(l)?l:!1,_=P(u)?u:!1,v=P(p)?p:!1,y=t.valueOf()===B.ZERO_DATE.valueOf();switch(s){case B.TOOLTIP_CARDS:r||Mk(e,o,m,!y,h&&!y,!1,g,_,v,e.hasLegend?e.view?.legend?.getLegendElem().clientHeight:0);break;case B.TOOLTIP_BUBBLE:if(!y){let t=Dk(o.panes.find(e=>{let{top:t,left:n,width:r,height:a}=e.bounds;return new Eo(n,t,r,a).contains(i)}).plots,i.y);if(t.hasData){let n=`<div class="bubble-box">${_v({...o,hideSymbols:g,revealingClose:_,plots:t.plots})}</div>`;e.view.tooltip.show(n,{x:i.x,y:t.y,yMin:t.yMin,yMax:t.yMax})}else e.view.tooltip.hide()}Mk(e,o,m,!1,!1,e.hasLegend,g,_,v);break;case B.TOOLTIP_STD:if(!y){let t=_v({...o,hideSymbols:g,revealingClose:_,plots:o.panes.map(e=>e.plots).flat()});e.view.tooltip.show(t)}Mk(e,o,m,!1,!1,e.hasLegend,g,_,v);break;case B.TOOLTIP_EXTERNAL:e.notifyHost(K.CH_TOOLTIPCHANGED,o);break;default:I(`Unknown tooltip mode requested: ${s}`,`warn`);break}}function jk(e,t,n,r,i,a){ra(e,{position:`absolute`,display:`flex`,"flex-direction":t,"flex-wrap":`wrap`,left:`${n+B.CARDS_X_OFFSET}px`,top:`${i+B.CARDS_Y_OFFSET}px`,maxWidth:`${a-r-B.CARDS_X_OFFSET*2}px`})}function Mk(e,t,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=0){let u=e.view.el,d=vv(e,t,n,r,i,o,s,c);d.some(e=>!P(e.bounds))||d.forEach(({id:t,isMainPane:n,content:r,moveContent:i,bounds:{left:o,right:s,top:c,width:d}},f)=>{if(r!==``&&(!a||!n)){let i=aa(t,u,`div`);jk(i,n&&mv(e)?`column`:`row`,o,s,c+l,d),oa(i,{"bcharts-card":!0,"bcharts-card-main":n,"bcharts-card-first":f===0}),i.innerHTML=r}let p=na(`#right-${t}`,u);P(p)||(p=document.createElement(`div`),p.id=`right-${t}`,u.appendChild(p),oa(p,`bcharts-card bcharts-card-move`)),ra(p,{position:`absolute`,display:`block`,right:`${s+B.CARDS_X_OFFSET}px`,top:`${c+l+B.CARDS_Y_OFFSET}px`}),p.innerHTML=i})}var Nk=null;function Pk(){return Nk===null&&(Nk=$().config.hostingModel===ae[ae.Application]),Nk}var Fk=class extends qO{ap;onLongPress;presenter;panY;snapToSupported=!1;warmUp=!0;preventDefault=!1;lastOffset;lastPanningExtremes;constructor(e,t){super(),this.ap=e,this.onLongPress=t,this.presenter=e.presenter,this.panY=e.axis.isCustomDomain}activated(){}deactivated(){this.cancelLongPress()}startPan(e){this.startLongPress(this.presenter,this.ap,e),this.lastOffset=e,this.lastPanningExtremes=this.ap.axis.yScale.domain();let t=this.ap.presenter;t.enableTooltip(!1),t.view.tooltip.hide(),t.view.drawCrosshair({ap:void 0})}onMouseMove(e){if(e.pinchZoom){this.presenter.resetActiveTool();return}let{point:t,view:n,offset:r}=e;if(t&&t.axis!==this.ap.axis)return;let{x:i,y:a}=r,o=i-this.lastOffset.x,s=Math.abs(o),c=this.lastOffset.y,l=a-c,u=Math.abs(l);s>=1&&this.cancelLongPress();let d=Pk();if(Ie()&&!d&&this.warmUp)return(s>7||u>7)&&(this.warmUp=!1,this.preventDefault=s>u),!1;if(this.preventDefault||!Ie()||d){if(n.xAxis.pan(o),this.panY&&t&&t.axis){u>=1&&this.cancelLongPress();let e=Ik(t.axis,c,a,this.lastPanningExtremes);this.lastPanningExtremes=e,t.axis.yScale.domain(e)}this.lastOffset=r,n.redraw(),t&&t.presenter.view.setCursor(ee.Grabbing)}return d||this.preventDefault}finished(){_j(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:e,offset:t,originalEvent:n}){Ie()&&Jk(e,t,n)}performLongPress(e,t,n){e.enableTooltip(!0),e.resetActiveTool(),this.onLongPress?this.onLongPress():e.activeTool.startTouchCrosshairMode(e,t,n)}};function Ik(e,t,n,r){let i=(n-t)/e.viewBox.height,[a,o]=r,s=i*(o-a);return[a+s,o+s]}var Lk=null;function Rk(e,t){let n=new DOMParser().parseFromString(e,`image/svg+xml`),r=n.querySelector(`svg`)?.getAttribute(`viewBox`),i=n.querySelector(`path`)?.getAttribute(`d`);if(N(r)&&N(i)){let e=r.split(` `).map(Number);e.length===4&&e.every(Number.isFinite)&&(Lk={path:new Path2D(i),width:e[2],height:e[3],rect:new Eo(0,0,0,0),logoClickable:t})}}var zk=5,Bk=50;function Vk(e,{x:t,y:n,height:r,width:i}){if(!N(Lk))return;let{path:a,width:o,height:s,rect:c}=Lk,l=i/8,u=Math.min(Math.max(Bk,l),o)/o;c.width=o*u,c.height=s*u,c.x=t+zk,c.y=n+r-c.height-zk,e.save();let d=getComputedStyle(e.canvas).getPropertyValue(`--widget-logo-fill-color`);e.fillStyle=d.length===0?`rgba(127, 127, 127, 0.6)`:d,e.translate(c.x,c.y),e.scale(u,u),e.fill(a),e.restore()}function Hk(){return N(Lk)&&Lk.logoClickable?Lk.rect:null}var Uk=class extends fk{constructor(e,t){super(e,t)}hitTest(e){if(!this.isVisible)return!1;let t=this.getRect();return t===null?!1:t.contains(e)}draw(e,t){return super.draw(e,t)?(Lo(e,this.getRect()),!0):!1}};function Wk(e,t){return e<t?[e,t]:[t,e]}var Gk={line:{width:1,color:`rgba(127, 127, 127, 0.3)`,dashStyle:`LongDash`},fill:{color:`rgba(127, 127, 127, 0.1)`}},Kk=class extends _k{snapToSupported=!1;preventDefault=!1;axis;presenter;constructor(){super(rk(`Rectangle`,Uk,null,Gk),!1)}activated(){}deactivated(){P(this.axis,this.annotation)&&this.axis.deleteAnnotation(this.annotation,!1)}onMouseDown(e){let t=super.onMouseDown(e);if(t===!0){let{point:t}=e;this.axis=t.axis,this.presenter=t.presenter}return t}finish(){if(P(this.axis,this.presenter)){_j(this.presenter,{toolChange:O.Executed,annId:`ZoomIn`});let e=this.annotation.points,t=Wk(e[0].price,e[1].price),n=Wk(e[0].time,e[1].time),r=(e,t)=>Math.abs(t(e[0])-t(e[1])),i=r(n,e=>this.axis.toX(e)),a=r(t,e=>this.axis.toY(e)),o=this.presenter.view,s=B.MINIMUM_ZOOM_DIMENSION;if(i>s&&a>s){let e=o.xAxis.xScale;this.axis.isCustomDomain=!0,this.axis.yScale.domain(t),e.wasZoomed=!0,e.scaleBarToFitRange(n,!1),e.domain(n)}o.redraw()}}};function qk(e,t,n=e.isSelected){let r=tk(e);r.offset={x:t.x,y:t.y},r.wasSelected=n,r.canFlip=e.getFlipAnchorIndices()!==null;let i=e.axis.pane.presenter;r.candidates=i.defaultTool.findAnnotationHits(e.axis.toAnnotationPoint(t)).reverse().map(e=>({...tk(e),paneIndex:i.panes.indexOf(e.axis.pane),axisIndex:e.axis.pane.axes.indexOf(e.axis),position:e.axis.findIndex(e),canFlip:e.getFlipAnchorIndices()!==null})),i.annotationManipulation||i.clearSelection(),i.notifyHost(K.CH_ANNNEEDSCONTEXTMENU,r)}function Jk(e,t,n){let r={offset:{x:t.x,y:t.y},chart:e.accessor,originalEvent:n};e.notifyHost(K.CH_CHTNEEDSCONTEXTMENU,r)}function Yk(e,t,n,r=1,i=-1){let a=(n.y-t.y)/10,o=e.yScale.rangeWithPadding().reverse();return[o[0]+a*r,o[1]+a*i].map(t=>e.yScale.yToPrice(t))}function Xk(e,t){return t.x===e.x||t.x===e.x+e.width||t.y===e.y||t.y===e.y+e.height}function Zk(){let e=$().config.touchCrosshairTimeoutMillis;return P(e)&&Number.isFinite(e)?e:B.LONG_PRESS_TIMEOUT_MILLIS}var Qk=class{resizingPanes=!1;snapToSupported=!1;touchCrosshairMode=!1;notifyZoomChanged;previousTouchTimestamp=null;resizingScale=!1;resizingScaleId=null;lastScaleResizingOffset=null;touchCrosshairTimeout=null;lastResizingOffset=null;splitter;prevZoomingOffset;prevPinchDistance=null;constructor(){this.stopResizingScale(),this.notifyZoomChanged=Ke(K.CH_ZOOMCHANGED,1e3)}startTouchCrosshairMode(e,t,n){this.touchCrosshairMode=!0,this.showCrosshairAndTooltips(e.view,t,n)}activated(){}deactivated(){}findAnnotationHits(e){let t=e.point;if(!t)return[];let n=e.presenter.selectedAnnotation,r=e=>e.hitTest(t)||e===n&&e.points.some(e=>e.hitTest(t));return e.axis.pane.axes.flatMap(e=>e.annotations.filter(e=>!e.computed&&e.isVisible&&r(e)))}findHit(e){if(!e.point)return[];if(e.axis.pane.axes.some(t=>t.plots.some(t=>t.hitTestCustomEvent(e.point))))return B.EVENT_PIN_HIT;let t=e.presenter.selectedAnnotation;if(t?.isVisible&&!t.computed&&t.axis.pane===e.axis.pane){let n=t.points.find(t=>t.hitTest(e.point));if(n)return[t,n];if(e.presenter.annotationManipulation&&t.hitTest(e.point))return[t,void 0]}return[xe(e.presenter.annotationManipulation?this.findAnnotationHits(e):e.axis.annotations.filter(t=>!t.computed&&t.isVisible&&t.hitTest(e.point))),void 0]}restoreSelection(e,t){e.clearSelection();let n=e.allAnnotations.find(e=>e.uid===t);n?.isVisible&&e.setSelection(n)}findPlotHits(e,t){let n=e.axes.map(e=>e.plots).flat().filter(e=>e.isVisible);if(n.length===1){let[t]=n;if(t.isStudy&&e.presenter.isHoverHighlightable(t))return[t]}let r=[];for(let n=e.axes.length-1;n>=0;n--){let i=e.axes[n].plots;for(let n=i.length-1;n>=0;n--){let a=i[n];e.presenter.isHoverHighlightable(a)&&a.isVisible&&a.hasHitTestableCurves&&a.hitTest(t)&&r.push(a)}}return r}stopResizingScale(){this.resizingScale=!1,this.resizingScaleId=null,this.lastScaleResizingOffset=null}resetVerticalAxis(e,t=!0){this.stopResizingScale(),e.isCustomDomain=!1,t&&e.setDomain()}resetHorizontalAxis(e,t=!0){e.view.xAxis.resetZoom(),t&&e.view.setPriceAxesDomains(),this.fireZoomChanged(e)}canVerticalZoom(e){return Qe(e.display.chart.zooming)[0]}canHorizontalZoom(e){return Qe(e.display.chart.zooming)[1]}canRectangleZoom(e){return this.canVerticalZoom(e)&&this.canHorizontalZoom(e)}fireZoomChanged(e){this.notifyZoomChanged({chart:e.accessor})}onMouseDblClick({priceAxis:e,offset:t,presenter:n,view:r}){let i=r.xAxis.contains(t),a=!1;if(P(e))this.resetVerticalAxis(e),a=!0;else if(i)this.resetHorizontalAxis(n),a=!0;else if(Ie()){let e=n.selectedAnnotation;e==null?Jk(n,t):qk(e,t)}a&&r.redraw()}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!Ie())return null;let e=new Date().getTime(),t=P(this.previousTouchTimestamp)?e-this.previousTouchTimestamp:null;return this.previousTouchTimestamp=e,t}onMouseDown(e){let{point:t,button:n,splitter:r,offset:i,priceAxis:a,presenter:o,originalEvent:s}=e,c=window.navigator.platform.toLowerCase().startsWith(`mac`),l=c?D.Meta:D.Control,u=n===E.Right||c&&n===E.Left&&e.getModifier(D.Control);this.touchCrosshairMode&&P(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);let d=this.computePreviousTouchStartDuration();if(P(d)&&d<B.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(e),!0;if(!u&&this.isLogoLink(i)&&o.notifyHost(K.CH_LOGOCLICKED,{chart:o.accessor}),P(t)&&o.allPlots.some(e=>e.tryHandleCustomEventClick(t.point)))return!0;if(P(r))return this.resizingPanes=!0,this.lastResizingOffset=i,this.splitter=r,o.enableTooltip(!1),!0;if(P(a))return this.canVerticalZoom(o)&&this.startAxisScaling(a,i),!0;if(t!=null){if(e.getModifier(l)&&this.canRectangleZoom(o))return o.activeTool=new Kk,o.activeTool.onMouseDown(e),!0;let[n,r]=this.findHit(t),a=o.annotationManipulation,c=o.selectedAnnotation?.uid,d=n!=null&&c===n.uid,f=()=>this.findAnnotationHits(t).length>1,p;if(a&&n!=null&&(p=()=>{!d&&f()&&this.restoreSelection(o,c),qk(n,i,d)}),a&&u&&n!=null&&!d&&f())return qk(n,i,!1),Ie();if(o.clearSelection(),n!=null&&o.setSelection(n),n==null||n?.locked)return u?(this.hideCrosshairAndTooltips(o.view),n==null?Jk(o,i,s):n?.locked&&qk(n,i,d),!0):this.touchCrosshairMode?!0:(o.activeTool=new Fk(t,p),o.activeTool.startPan(i),Pk());let m=r!=null;if(u)return qk(n,i,d),Ie();{if(m&&!r.movable||!m&&!n.canMove(t.point))return!1;let e=m&&n.points.indexOf(r)!==-1,a=n.axis.toAnnotationPoint(i);return o.activeTool=e?new XO(n,r):new YO(n,a,i,p),Ie()}}else this.canHorizontalZoom(o)&&(this.prevZoomingOffset=i);return!1}onContextMenu(e){return!0}isLogoLink(e){let t=Hk();return P(t)&&t.contains(e)}onMouseMove(e){let{point:t,splitter:n,priceAxis:r,view:i,presenter:a,offset:o}=e;if(P(e.pinchZoom)&&e.pinchZoom&&P(e.pinchDistance))return P(this.prevPinchDistance)&&(e.delta=this.prevPinchDistance-e.pinchDistance,this.onWheel(e)),this.prevPinchDistance=e.pinchDistance,Ie();if(n!=null||this.resizingPanes)i.setCursor(ee.ResizeVertical),this.resizingPanes&&this.resizePanes(i,o);else if(P(t)){let[e,n]=this.findHit(t),r=!P(e)&&!P(n)?this.findPlotHits(t.pane,o):[],i=a.setHoverHighlight(r);P(n)?t.presenter.view.setCursor(ee.Crosshair):P(e)?e.isSelected?t.presenter.view.setCursor(ee.Move):t.presenter.view.setCursor(ee.Hand):i?t.presenter.view.setCursor(ee.Crosshair):t.presenter.view.setCursor(ee.Arrow)}else if(P(r))this.canVerticalZoom(a)&&(i.setCursor(ee.ResizeVertical),this.performAxisScaling(i,r,o));else{let e=this.canHorizontalZoom(a);if(!e&&this.prevZoomingOffset&&delete this.prevZoomingOffset,this.prevZoomingOffset&&e){let{x:e}=this.prevZoomingOffset,{x:t}=o,n=e-t;this.applyZoom(i.presenter,-n),this.prevZoomingOffset=o}i.setCursor(e?ee.ResizeHorizontal:ee.Arrow)}return!t||this.resizingPanes?(this.hideCrosshairAndTooltips(i),Ie()):(this.isLogoLink(o)&&i.setCursor(ee.Hand),this.showCrosshairAndTooltips(i,t,o),Ie())}showCrosshairAndTooltips(e,t,n){t.time&&(!Ie()||this.touchCrosshairMode)&&e.drawCrosshair({ap:t,offset:n})&&e.presenter.showTooltip&&Ak(e.presenter,{time:t.time,offset:n,price:t.price,lastBarRefresh:void 0,justMain:void 0})}hideCrosshairAndTooltips(e,t=!1){e.presenter.setHoverHighlight([]),e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(t),t&&e.tooltip.mode===`cards`&&!e.presenter?.hasLegend&&kk(e.presenter)}onMouseLeave(e){let{view:t,offset:n}=e;t.presenter.accessor.getPaneBounds()?.every(e=>!e||!e.contains(n)||Xk(e,n))&&(this.hideCrosshairAndTooltips(t,!0),this.stopResizeZoom(t.presenter)),t.setCursor(ee.Arrow),this.touchCrosshairMode=!1}stopResizeZoom(e){this.resizingPanes&&(this.resizingPanes=!1,e.enableTooltip(!0),e.onPaneHeightsUpdated()),this.resizingScale&&this.stopResizingScale(),this.prevZoomingOffset&&delete this.prevZoomingOffset}onMouseUp({presenter:e}){if(this.stopResizeZoom(e),Ie()){let t=Zk();this.touchCrosshairTimeout=window.setTimeout(()=>{this.hideCrosshairAndTooltips(e.view,!0),this.touchCrosshairMode=!1},t)}}applyZoom(e,t,n=!0){if(!this.canHorizontalZoom(e))return;let r=Math.sign(t)*(Ie()?2:10),i=e.view;i.xAxis.zoom(r)&&(i.setPriceAxesDomains(),i.redraw(),n&&this.fireZoomChanged(e))}onWheel({view:e,presenter:t,getModifier:n,delta:r}){let{scrollBehavior:i}=t.display;return!(Ie()?i!==`none`:i===`wheel`||i===`wheel+shift`&&n(D.Shift))||r===0?!1:(e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(),this.applyZoom(t,r),!0)}get useKeyboardShortcuts(){return $().config.hostingModel!==ae[ae.Application]}onKeyDown(e){let{key:t,code:n,presenter:r}=e;if(P(r.selectedAnnotation)&&Le(t,n)&&r.deleteAnnotationWithUndo(r.selectedAnnotation),P(r.selectedAnnotation)&&(Re(t,n)?r.clearSelection():ze(t,n)&&r.selectedAnnotation instanceof mk&&r.selectedAnnotation.textEditable&&(r.activeTool=new bk(null,r.selectedAnnotation),r.activeTool.startEditing())),Be(t,n)||Ve(t,n)){let e=Be(t,n)?1:-1,i=r.view;i.xAxis.pan(e*i.xAxis.xScale.bar.totalWidth),this.hideCrosshairAndTooltips(i),i.redraw()}let i=window.navigator.platform.toLowerCase().startsWith(`mac`)?D.Meta:D.Control;if(e.getModifier(i)&&this.useKeyboardShortcuts){let e=He(t,n),i=We(t,n);return e&&r.undoRedoManager.undo(),i&&r.undoRedoManager.redo(),e||i}Ue(t,n)&&e.getModifier(D.Alt)&&this.resetView(r)}resetView(e){e.allAxes.forEach(e=>this.resetVerticalAxis(e,!1)),this.resetHorizontalAxis(e,!1),e.view.xAxis.goToLatest(!0)}resizePanes(e,t){let n=t.y-this.lastResizingOffset.y;if(n===0)return;let r=e.presenter.panes,[i,a]=this.splitter,o=r.map((e,t)=>{let r=e.getBounds().height;return t===i?r+n:t===a?r-n:r});if(o.some(e=>e<B.MINIMUM_PANE_HEIGHT))return;let s=(e,t)=>e+t,c=o.reduce(s,0),l=r.map(e=>e.height).reduce(s,0),u=e=>Xe(e,4);r.forEach((e,t)=>e.height=u(o[t]/c*l)),this.lastResizingOffset=t,e.recalculateLayout(),e.redraw()}startAxisScaling(e,t){this.resizingScale=!0,this.resizingScaleId=e.id,this.lastScaleResizingOffset=t}performAxisScaling(e,t,n){if(this.resizingScale&&this.resizingScaleId===t.id){let r=Ie()?4:5,i=Yk(t,this.lastScaleResizingOffset,n,r,-r);this.lastScaleResizingOffset=n,t.isCustomDomain=!0,t.yScale.domain(i),e.redraw()}}},$k=class extends gk{factory;maxClicks;clicks=0;snapToSupported=!0;isDrawingAnnotation=!0;constructor(e,t){super(e.annName),this.factory=e,this.maxClicks=t}onMouseMove(e){let{point:t,view:n,offset:r}=e;n.drawCrosshair({ap:t,offset:r})}onMouseDown(e){let{point:t,view:n}=e;if(this.clicks===0){if(t===void 0)return bj(e),!1;t.axis.pane.presenter.clearSelection(),this.annotation=this.factory(t.axis)}this.applyToPoints(t),this.clicks++,this.clicks===this.maxClicks&&this.annotation!==void 0?(this.annotation.drawn=!1,this.annotation.requestRedraw(),typeof this.annotation.updateOtherPoints==`function`&&this.annotation.updateOtherPoints(n.mainContext),vj(this.annotation,!0,O.Created)):this.annotation.requestRedraw()}applyToPoints(e){this.annotation.points[this.clicks].update(e.price,e.time)}},eA=class{snapToSupported=!1;constructor(e,t){setTimeout(()=>this.finalize(e,t),10)}finalize(e,t){let n=e(t);t.pane.presenter.clearSelection(),n.drawn=!1,n.requestRedraw(),vj(n,!0,O.None)}},tA=B.MARKER_ARROW_ANGLE*Math.PI/180/2;function nA(e,t){return rA(e.map(e=>e.point),t)}function rA(e,t,n=B.MARKER_ARROW_LENGTH){return new iA(e,t,n)}var iA=class{vertex;arrowLen;p1;p2;constructor(e,t,n=B.MARKER_ARROW_LENGTH){this.vertex=t,this.arrowLen=n,this.p1=e[0],this.p2=e[1]}hitTest(e){let{anchor:t,p1:n,p2:r}=this.getArrowPoints();return co([t,n],e,B.HIT_TEST_TOLERANCE)||co([t,r],e,B.HIT_TEST_TOLERANCE)}draw(e){let{anchor:t,p1:n,p2:r}=this.getArrowPoints();zo(e,t,n),zo(e,t,r)}getArrowPoints(){let e=so(this.p1,this.p2),t=this.vertex===`start`?0:Math.PI,n=e-tA+t,r=e+tA+t,i=this.vertex===`start`?this.p1:this.p2,a=this.arrowLen*Math.cos(n)+i.x,o=this.arrowLen*Math.sin(n)+i.y,s=this.arrowLen*Math.cos(r)+i.x,c=this.arrowLen*Math.sin(r)+i.y;return{anchor:i,p1:{x:a,y:o},p2:{x:s,y:c}}}},aA=class{hitTest(){return!1}draw(){}},oA=class extends ok{constructor(e,t){super(e,t),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[B.AT_EXTEND_PT_1]}get extend2(){return this.traits[B.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[B.AT_SHOW_PERCENTDIFF]}get showBarCount(){return this.traits[B.AT_SHOW_BARCOUNT]}get showRatio(){return this.traits[B.AT_RATIO]}getElements(){let e=this.points[0].point,t=this.points[1].point,n=new ik(e,t,this.extend1,this.extend2,this.axis),r=[];return this.extend1&&r.push(new ik(n.p1,e,!0,!1,this.axis)),r.push(new ik(e,t,!1,!1,this.axis)),this.extend2&&r.push(new ik(t,n.p2,!1,!0,this.axis)),r}formatRatio(e,t){return` (${Xe(e/t,3)})`}formatPercDiff(e,t){let n=(t-e)/e*100;return` (${n>0?`+`:``}${Xe(n,2)}%)`}formatPrice(e){return rv(this.axis,this.priceMap(e))}adornElements(e,t){if(!this.showBarCount&&!this.showPrices&&!this.showPercentDiff&&!this.showRatio)return;let[n,r]=this.points,i=e[+!!this.extend1].getAdornOffset(t);if(this.showBarCount){let e=oo(no(n.point,r.point),i);Fo(t,this.getBarCount(n.time,r.time).toFixed(0),e,T.Right)}let a=this.showRatio?this.formatRatio(n.price,r.price):``,o=`${this.showPrices?this.formatPrice(n.price):``}${a}`.trim();o!==``&&Fo(t,o,oo(n.point,i),T.Right);let s=this.showPercentDiff?this.formatPercDiff(n.price,r.price):``,c=`${this.showPrices?this.formatPrice(r.price):``}${s}`.trim();c!==``&&Fo(t,c,oo(r.point,i),T.Right)}getMarkers(){let e=this.marker;if(!e||e.vertex===`none`)return[];let{vertex:t,kind:n}=e;return(t===`both`?[`start`,`end`]:[t]).map(e=>n===`arrow`?nA(this.points,e):(I(`There is no marker of ${n} kind`,`warn`),new aA))}},sA=class extends ok{constructor(e,t){super(e,t),this.addPoints(1)}get showTimestamps(){return this.traits[B.AT_SHOW_TIMESTAMPS]}getElements(){return[new ZO(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}},cA=class extends ok{constructor(e,t){super(e,t),this.addPoints(1)}getElements(){return[new ZO(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}},lA=class extends ok{constructor(e,t,n){super(e,t),this.addPoints(2),P(n)&&P(n.points)&&n.points.forEach((e,t)=>this.points[t].update(e.price,e.time))}allPoints(){let[e,t]=this.points;return P(e,e.point,t,t.point)?[e,this.axis.toAnnotationPoint(no(e.point,t.point)),t]:B.EMPTY_ARRAY}line2(){return this.traits[B.AT_LINE_2]}use52WeekPrices(){return this.traits[B.AT_USE_52WEEK_PRICES]}getElements(){let e=this.allPoints();return e===B.EMPTY_ARRAY?B.EMPTY_ARRAY:e.map(e=>new ik({x:-B.OUT_OF_SCREEN,y:e.point.y},{x:B.OUT_OF_SCREEN,y:e.point.y},!1,!1,this.axis))}wasPointMovedByTool(e,t){P(this.use52WeekPrices())&&(this.traits[B.AT_USE_52WEEK_PRICES]=!1)}getStyleForElement(e,t){let n=this.line2();if(t!==1||!P(n))return super.getStyleForElement(e,t);let r=F(this.traits);return r.line=n,hs(r)}getPriceScaleAdornments(){let e=this.allPoints();if(!this.showPrices||e===B.EMPTY_ARRAY)return super.getPriceScaleAdornments();let t=this.traits.line,n=e.map(e=>({price:e.price,color:t.color})),r=this.line2();return P(r)&&(n[1].color=r.color),n}getFlipAnchorIndices(){return null}},uA=5,dA=class extends sk{helper;constructor(e,t,n){super(e,t),this.addPoints(n),this.helper=new QO(e)}get showTrendLine(){return this.traits[B.AT_SHOW_TRENDLINE]}get hasAllPoints(){return P(...this.points.map(e=>e.point))}get line2(){return this.traits[B.AT_LINE_2]}get extendLeft(){return this.traits[B.AT_EXTEND_LEFT]}get extendRight(){return this.traits[B.AT_EXTEND_RIGHT]}get reverse(){return this.traits[B.AT_REVERSE]}get levelsRespectLogScale(){return this.traits[B.AT_LEVELS_RESPECT_LOG_SCALE]}getStyleForElement(e,t){if(e.isTrend){let e=F(this.traits);return e.line=this.line2,hs(e)}return super.getStyleForElement(e,t)}getKeyPoints(){let e=e=>e.map(e=>this.points[e]);return this.isExtended?e(this.reverse?[1,0,2]:[0,1,2]):e(this.reverse?[0,1,0]:[1,0,1])}getElements(){if(!this.hasAllPoints)return[];let[e,t,n]=this.getKeyPoints(),r=t.price-e.price,i=t.price/e.price,a=this.extendLeft,o=this.extendRight,s=this.leftPoint,c=this.rightPoint,l=(e,t,n=!1)=>{let r=new ik(e,t,!n&&a,!n&&o,this.axis);return r.isTrend=n,r},u=this.levelsRespectLogScale&&this.axis.scale===S.Logarithmic,d=this.getColoredElements(({value:e})=>{let t=n.price+r*e,a=n.price*i**+e,o=u?a:t;this.helper.update(o,n.time);let d=this.helper.point.y;return l({x:s.x,y:d},{x:c.x,y:d})});return this.showTrendLine&&(d.push(l(e.point,t.point,!0)),this.isExtended&&d.push(l((this.reverse?e:t).point,n.point,!0))),d}getAdornPointAndAlign(e,t){let n=this.labels,r=(e,t,n)=>({pt:e,align:t,offset:n}),i=this.axis.pane.getBoundsWithoutScales();switch(n){case B.AT_LABELS_LEFT:return this.extendLeft?r({x:i.x,y:e.anchor1.y},T.Left,t):super.getAdornPointAndAlign(e,t);default:case B.AT_LABELS_RIGHT:return this.extendRight?r({x:i.x+i.width,y:e.anchor2.y},T.Right,-t):super.getAdornPointAndAlign(e,t);case B.AT_LABELS_CENTER:return super.getAdornPointAndAlign(e,t)}}getTextRef(){return(e,t,n)=>({ref:t,spacing:uA,offsetY:-5,text:this.formatLevelPrice(n,t.anchor1.y)})}adornElements(e,t){this.adornElementsForColoredFactors(e,(e,t)=>{let n=new Path2D;return e===null?n:(Oo(n,e.p1),n.lineTo(t.p2.x,e.p1.y),ko(n,t.p2),n.lineTo(e.p1.x,t.p2.y),n)},this.getTextRef(),t)}getPriceScaleAdornments(){if(!this.pricesOnScale)return super.getPriceScaleAdornments();let e=this.getElements();if(e.length===0)return super.getPriceScaleAdornments();let t=this.traits.line.color;return this.factors.map((n,r)=>{let i=e[r++].p1,a=this.singleStyle?t:n.line.color;return{price:this.axis.toPrice(i.y),color:a}})}},fA=class extends dA{constructor(e,t){super(e,t,2)}},pA=class extends dA{constructor(e,t){super(e,t,3)}},mA=5,hA=(e,t)=>{let n=new Path2D;return e===null?n:(Oo(n,e.p1),ko(n,e.p2),ko(n,t.p2),n)},gA=class extends sk{constructor(e,t){super(e,t),this.addPoints(2)}get reverse(){return this.traits[B.AT_REVERSE]}getElements(){let[e,t]=this.getScreenPoints(),n=t.y-e.y;return this.getColoredElements(({value:r})=>{let i=this.reverse?e.y+r*n:t.y-r*n;return new ik(e,{x:t.x,y:i},!1,!0,this.axis)})}getTextRef(){let[e,t]=this.getScreenPoints(),n=t.y-e.y,[r,i]=[this.leftPoint,this.rightPoint];return(a,o,s)=>{let c=this.reverse?e.y+s*n:t.y-s*n;return{ref:new ik({x:r.x,y:c},{x:i.x,y:c},!1,!1,this.axis),spacing:mA,offsetY:!0,text:s.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,hA,this.getTextRef(),t)}},_A=class extends gA{constructor(e,t){super(e,t)}};function vA(e,t,n){return new bA(e,t,io(e,t),0,Math.PI,null,n)}function yA(e,t,n,r,i,a){return new bA(e,null,t,n,r,i,a)}var bA=class{center;rim;radius;startAngle;endAngle;antiClockwise;axis;left=null;right=null;scale=null;clip=null;style;constructor(e,t,n,r,i,a,o){this.center=e,this.rim=t,this.radius=n,this.startAngle=r,this.endAngle=i,this.antiClockwise=a,this.axis=o,t!==null&&(this.left={x:this.center.x-this.radius,y:this.center.y},this.right={x:this.center.x+this.radius,y:this.center.y})}get hasScale(){return this.scale!==null}get hasClip(){return this.clip!==null}get hasRim(){return this.rim!==null}applyScale(e){e.translate(this.center.x,this.center.y),e.scale(this.scale.x,this.scale.y),e.translate(-this.center.x,-this.center.y)}inverseScale(e){let t=new DOMPointReadOnly(e.x,e.y),n=this.axis.pane.presenter.view.mouseContext;n.save(),n.resetTransform(),this.applyScale(n);let r=n.getTransform().inverse();return n.restore(),r.transformPoint(t)}hitTest(e){let t=999;if(this.hasRim&&(this.center.y<this.rim.y&&e.y<=this.center.y||this.center.y>=this.rim.y&&e.y>=this.center.y))t=Math.min(io(this.left,e),io(this.right,e));else{let{x:n,y:r}=ao(this.hasScale?this.inverseScale(e):e,this.center);if(!this.hasRim){let{startAngle:e,endAngle:t,antiClockwise:i}=this,a=Math.PI/2;if(e===0&&t===a&&!i&&(n<0||r<0)||e===a&&t===Math.PI&&!i&&(n>0||r<0)||e===-a&&t===Math.PI&&i&&(n>0||r>0)||e===0&&t===-a&&i&&(n<0||r>0))return!1}t=Math.abs(Math.sqrt(n*n+r*r)-this.radius)}return t<=B.HIT_TEST_TOLERANCE}get isAntiClockwise(){return this.hasRim?this.rim.y<=this.center.y:this.antiClockwise}draw(e){e.save(),this.hasClip&&e.clip(this.clip),this.hasScale&&this.applyScale(e),Ro(e,this.center,this.radius,this.startAngle,this.endAngle,this.isAntiClockwise??!1),e.restore()}},xA=(e,t)=>{let n=new Path2D,{center:r}=t;if(Oo(n,r),n.arc(r.x,r.y,t.radius,t.startAngle,t.endAngle,t.isAntiClockwise??!1),e===null)return n;let i=new Path2D,{center:a}=e;return Oo(i,a),i.arc(a.x,a.y,e.radius,e.endAngle,e.startAngle,!e.isAntiClockwise),n.addPath(i),n},SA=class extends sk{constructor(e,t){super(e,t),this.addPoints(2)}getElements(){let[e,t]=this.getScreenPoints();if(!P(e,t))return[];let n=io(e,t),r=ao(t,e),i=r.y/n,a=r.x/n,o=this.getColoredElements(({value:t})=>{let r=n*t,o=i*r,s=a*r;return vA(e,{x:e.x+s,y:e.y+o},this.axis)});if(this.showTrendLine){let n=new ik(e,t,!1,!1,this.axis);n.isTrend=!0,o.unshift(n)}return o}get showTrendLine(){return!0}getTextRef(){return(e,t,n)=>{let{center:r}=t,i=t.isAntiClockwise?-1:1;return{ref:{x:r.x,y:r.y+i*t.radius},spacing:0,offsetY:!0,text:n.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,xA,this.getTextRef(),t)}},CA=class extends SA{constructor(e,t){super(e,t)}getStyleForElement(e,t){if(e.isTrend){let e=F(this.traits);return e.line=this.line2,hs(e)}return super.getStyleForElement(e,t)}get showTrendLine(){return this.traits[B.AT_SHOW_TRENDLINE]}get line2(){return this.traits[B.AT_LINE_2]}},wA=class extends sk{constructor(e,t){super(e,t),this.addPoints(2)}get factorsPropName(){return B.AT_ANGLES}getElements(){let[e,t]=this.getScreenPoints(),{x:n,y:r}=ao(t,e);return this.getColoredElements(({value:i})=>{let a=(t,n)=>new ik(e,{x:t,y:n},!1,!0,this.axis),o=i.charAt(0)!==`1`,s=Number(o?i.charAt(0):i.charAt(2));return o?a(t.x,e.y+r/s):a(e.x+n/s,t.y)})}getTextRef(){return(e,t,n)=>({ref:t.anchor2,spacing:0,offsetY:!0,text:n.toString()})}adornElements(e,t){this.adornElementsForColoredFactors(e,hA,this.getTextRef(),t)}},TA=class extends gA{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}getElements(){let[e,t]=this.getScreenPoints();return[new ik(e,t,!1,!1,this.axis)].concat(super.getElements())}},EA=class extends SA{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}},DA=class extends ok{constructor(e,t){super(e,t),this.addPoints(3)}getElements(){let e=this.points[0].point,t=this.points[1].point,n=this.points[2].point,r=(t.x+n.x)/2-e.x,i=(t.y+n.y)/2-e.y,a=[];return a.push(new ik(t,{x:t.x+r,y:t.y+i},!1,!0,this.axis)),a.push(new ik(e,{x:e.x+r,y:e.y+i},!1,!0,this.axis)),a.push(new ik(n,{x:n.x+r,y:n.y+i},!1,!0,this.axis)),a.push(new ik(t,n,!1,!1,this.axis)),a}},OA=class extends fk{constructor(e,t){super(e,t)}getEllipse(){let e=this.getRect();return e===null?null:new Do(e.centerX,e.centerY,e.width/2,e.height/2)}hitTest(e){if(!this.isVisible)return!1;let t=this.getEllipse();return t===null?!1:t.contains(e)}draw(e,t){return super.draw(e,t)?(Io(e,this.getEllipse()),!0):!1}},kA=class extends ok{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[B.AT_EXTEND_PT_1]}get extend2(){return this.traits[B.AT_EXTEND_PT_2]}getLastPoint(){let[e,t,n]=this.points;var r=io(e.point,t.point),i=so(e.point,t.point);return{x:n.point.x+r*Math.cos(i),y:n.point.y+r*Math.sin(i)}}getElements(){let[e,t,n]=this.points;var r=[];if(r.push(new ik(e.point,t.point,this.extend1,this.extend2,this.axis)),P(n?.price)){var i=this.getLastPoint();r.push(new ik(n.point,i,this.extend1,this.extend2,this.axis))}return r}},AA=class extends fk{kind;constructor(e,t,n){super(e,t),this.kind=n,this.adjustFill=!0}hitTest(e){if(!this.isVisible)return!1;let t=this.getRect();return t===null?!1:t.contains(e)}get dimension(){let e=this.kind===`fish_hook`?2:1;return B.DEFAULT_SYMBOL_WIDTH_HEIGHT*e}updateOtherPoints(){this.points[1].price||this.setBottomRight()}setBottomRight(){let e=this.dimension,t=this.axis.pane.presenter.timeline,{price:n,time:r}=this.points[0],i=Te(t,r,Number,dv);if(i!==-1){let r=this.axis.pane.presenter.view.xAxis.xScale.bar.totalWidth,a=1;for(;(2*a+1)*r<e;)a++;this.points[0].update(n,t.at(i-a)),this.points[1].update(n,t.at(i+a));let o=oo(this.points[0].point,{x:0,y:-e/2}),s=oo(this.points[1].point,{x:0,y:e/2});this.points[0].updateFromPoint(o),this.points[1].updateFromPoint(s)}}draw(e,t){if(!super.draw(e,t))return!1;let n=this.getRect();return n.width===0&&(n.width=this.dimension),Uo(e,this.kind,n),!0}},jA=class extends sk{helper;constructor(e,t){super(e,t),this.addPoints(2),this.helper=new QO(e)}getElements(){let e=this.axis.pane.presenter.timeline,{price:t,time:n}=this.points[0],r=Te(e,n,Number,dv),i=Te(e,this.points[1].time,Number,dv),a=i-r;return r===-1||i===-1?[]:this.getColoredElements(({value:n})=>{let i=e.at(r+n*a);return i===null?null:(this.helper.update(t,i),new ZO(this.helper.point,!0,this.axis))})}getTextRef(){return(e,t,n)=>({ref:t.anchor,spacing:3,offsetY:!0,text:n.toString()})}adornElements(e,t){let n=this.axis.pane.getBoundsWithoutScales();this.adornElementsForColoredFactors(e,(e,t)=>{let r=new Path2D;if(e===null)return r;let i=t.anchor.x-e.anchor.x;return r.rect(e.anchor.x,n.y,i,n.height),r},this.getTextRef(),t)}getTimeScaleAdornments(){let e=e=>({time:this.points[e].time,color:this.traits.line.color});return[e(0),e(1)]}},MA=class{snapToSupported=!0;isDrawingAnnotation=!0;constructor(){}onMouseMove(e){let{point:t,view:n,offset:r}=e;n.drawCrosshair({ap:t,offset:r})}onMouseDown(e){if(Ie()&&e.originalEvent instanceof TouchEvent)return;let{point:t}=e;if(!t?.axis?.pane?.presenter||!t.time)return;let n=t.axis.pane.presenter,r={chart:n.accessor,axis:t.axis,point:{time:t.time.getTime(),price:t.price}};n.notifyHost(K.CH_ANNPOINTPICKED,r),_j(n,void 0)}},NA=c(o(((e,t)=>{var n=ga(),r=Ca();t.exports=(()=>{function e(e){if(!n.string(e)||e.length!==1)return 0;let t=r.parse(e);return t===null?0:t.baseCode}return e})()}))(),1);function PA(e){let t=e?.minMovement;if(!Number.isFinite(t)||t<=0)return B.MIN_POSITION_PRICE_PRECISION;let[n,r=`0`]=t.toString().toLowerCase().split(`e`),i=(n.includes(`.`)?n.split(`.`)[1].length:0)+Math.max(0,-Number.parseInt(r,10));return Math.max(B.MIN_POSITION_PRICE_PRECISION,i)}function FA(e){if(e?.symbolType===`Forex`)return 10**(0,NA.default)(e.unitCode);let t=e?.pointValue;return Number.isFinite(t)?t:1}function IA(e,t,n){return Xe(n?e/100*t:e,2)}function LA({entryPrice:e,upperPrice:t,lowerPrice:n,isLong:r},i){let a=r?e-n:t-e;return!Number.isFinite(a)||a<=0?NaN:Math.floor(i/a)}function RA(e,t,n){let r=n?e:t,i=n?t:e;return!Number.isFinite(i)||i===0?NaN:Xe(r/i,2)}function zA(e,t,n,r){return Xe((r===`upper`?1:-1)*(n?1:-1)*e*t,2)}function BA(e,t,n,r,i){return Xe(e+(i===`upper`?1:-1)*(r?1:-1)*t*n,2)}function VA(e,t){return Number.isFinite(e)?t?e>0:e<=0:!0}var HA={Open:`Open`,Closed:`Closed`},UA=class extends ok{isLong;twoDecMeta;_dataWindow;_metaData;isHit=!1;constructor(e,t,n){super(e,t),this.isLong=n,this.addPoints(4);let r=(e,t)=>this.points[e].moveDirection=t;r(1,te.Vertical),r(2,te.Vertical),r(3,te.Horizontal),this.twoDecMeta=new Wa(2)}data(e){return this.presenter.mainPlot.timeSeries.container.getData(e)}get presenter(){return this.axis.pane.presenter}get metaData(){return this._metaData||=this.presenter.mainPlot.metaData,this._metaData}getDataWindow(e,t,n=!0,r=!0){let i=this.data(G.DateTime),a=Te(i,+e,Number),o=Te(i,+t,Number),s={refIndex:-1,highestIndex:-1,lowestIndex:-1,highest:null,lowest:null,data:[]},[c,l,u]=[G.High,G.Low,G.Close].map(e=>this.data(e)),d=e=>e-a;for(let e=a;e<=o;e++)n&&s.refIndex===-1&&P(this.entryPrice)&&this.entryPrice>=l[e]&&this.entryPrice<=c[e]&&(s.refIndex=d(e)),(!n||s.refIndex>=0&&d(e)>=s.refIndex)&&((!P(s.highest)||c[e]>s.highest)&&(s.highest=c[e]),(!P(s.lowest)||l[e]<s.lowest)&&(s.lowest=l[e])),n&&s.refIndex!==-1&&(s.highestIndex===-1&&c[e]>this.upperPrice&&(s.highestIndex=d(e)),s.lowestIndex===-1&&l[e]<this.lowerPrice&&(s.lowestIndex=d(e))),r&&s.data.push({high:c[e],low:l[e],close:u[e],time:i[e]});if(r&&s.data&&s.data.length>0){s.state=P(s.highest,s.lowest)&&(this.upperPrice<s.highest||this.lowerPrice>s.lowest)?HA.Closed:HA.Open,s.special=s.highestIndex===-1&&s.lowestIndex===-1||s.highestIndex===s.lowestIndex;let e=xe(s.data);if(s.toPrice=e.close,s.toTime=e.time,s.state===HA.Closed)if(s.special)s.refIndex!==-1&&(s.toTime=s.data[s.refIndex].time,s.toPrice=(this.isLong?this.lowerPrice<s.lowest:this.upperPrice<s.highest)?this.upperPrice:this.lowerPrice);else{let e=s.highestIndex!==-1&&s.lowestIndex!==-1;e&&s.highestIndex<s.lowestIndex||s.lowestIndex===-1?(s.toPrice=this.upperPrice,s.toTime=s.data[s.highestIndex].time):(e&&s.lowestIndex<s.highestIndex||s.highestIndex===-1)&&(s.toPrice=this.lowerPrice,s.toTime=s.data[s.lowestIndex].time)}let t=this.isLong?s.toPrice-this.entryPrice:this.entryPrice-s.toPrice;s.pAndL=this.roundPriceDelta(t)}return s}get dataWindow(){return P(this._dataWindow)||(this._dataWindow=this.getDataWindow(this.entryAnchor.time,this.exitAnchor.time)),this._dataWindow}getVisiblePriceRange(){let e=this.axis.yScale.domain();return e[1]-e[0]}getFutureTimestamp(){let e=this.axis.pane.presenter.timeline,t=Te(e,+this.points[0].time,Number,dv);if(!Number.isFinite(t)||t<0)return Date.now();let n=Math.min(e.length-1,t+50),r=e.at(n);return P(r)?r.getTime():Date.now()}get entryPrice(){return this.entryAnchor.price}get entryAnchor(){return this.points[0]}get upperPrice(){return this.upperAnchor.price}get upperAnchor(){return this.points[1]}get lowerPrice(){return this.lowerAnchor.price}get lowerAnchor(){return this.points[2]}get exitAnchor(){return this.points[3]}get accountSize(){return this.traits[B.AT_ACCOUNT_SIZE]}get risk(){return IA(this.traits[B.AT_RISK],this.accountSize,this.traits[B.AT_RISK_IS_PERCENT])}get positionInputs(){return{entryPrice:this.entryPrice,upperPrice:this.upperPrice,lowerPrice:this.lowerPrice,isLong:this.isLong}}get pricePrecision(){return PA(this.metaData)}get pointValue(){return FA(this.metaData)}roundPriceDelta(e){return Xe(e,this.pricePrecision)}formatDollarValue(e){return Number.isFinite(e)?`${e<0?`-`:``}$${this.twoDecMeta.format(Math.abs(e))}`:B.NOT_APPLICABLE}formatRatioValue(e){return Number.isFinite(e)?e.toFixed(2):B.NOT_APPLICABLE}formatQuantityValue(e){return Number.isFinite(e)?`${e}`:B.NOT_APPLICABLE}formatPercentChange(e){return Number.isFinite(e)?`(${Xe(e,2).toFixed(2)}%)`:`(${B.NOT_APPLICABLE})`}get qty(){return LA(this.positionInputs,this.risk)}get upperDiff(){return this.roundPriceDelta(this.upperPrice-this.entryPrice)}get upperAmount(){return BA(this.accountSize,this.qty,this.upperDiff,this.isLong,`upper`)}get upperPandL(){return zA(this.upperDiff,this.pointValue,this.isLong,`upper`)}get isCompact(){return this.traits[B.AT_COMPACT]}get upper(){let e=rv(this.axis,this.priceMap(this.upperPrice)),t=this.formatPercentChange(this.upperDiff/this.entryPrice*100);return this.isCompact,`${e} ${t}`}get upperText(){let e=`${this.formatDollarValue(this.upperPandL)}`,t=`${this.formatDollarValue(this.upperAmount)}`,n=this.isLong?`Target`:`Stop`;return this.isCompact?`${this.upper} ${e}`:`${n}: ${this.upper}, P&L: ${e}, Amount: ${t}`}get lowerDiff(){return this.roundPriceDelta(this.entryPrice-this.lowerPrice)}get lowerAmount(){return BA(this.accountSize,this.qty,this.lowerDiff,this.isLong,`lower`)}get lowerPandL(){return zA(this.lowerDiff,this.pointValue,this.isLong,`lower`)}get lower(){let e=rv(this.axis,this.priceMap(this.lowerPrice)),t=this.formatPercentChange(this.lowerDiff/this.entryPrice*100);return this.isCompact,`${e} ${t}`}get lowerText(){let e=`${this.formatDollarValue(this.lowerPandL)}`,t=`${this.formatDollarValue(this.lowerAmount)}`,n=this.isLong?`Stop`:`Target`;return this.isCompact?`${this.lower} ${e}`:`${n}: ${this.lower}, P&L: ${e}, Amount: ${t}`}get riskReward(){return RA(this.upperDiff,this.lowerDiff,this.isLong)}get state(){return this.dataWindow.state}get pAndL(){return this.dataWindow.pAndL}get pAndLValue(){return this.pAndL*this.pointValue}positionPoints(){let e=this.getVisiblePriceRange()/5,t=this.getFutureTimestamp();this.upperAnchor.update(this.entryPrice+e,this.entryAnchor.time),this.lowerAnchor.update(this.entryPrice-e,this.entryAnchor.time),this.exitAnchor.update(this.entryPrice,t)}get lowerStyle(){return this.fillOnlyStyle(B.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(B.AT_FILL)}get textStyle(){return this.fillOnlyStyle(B.AT_FILL_TEXT)}get secondaryLineStyle(){return hs({line:{color:this.traits.line.color,dashStyle:`ShortDash`},fill:{color:B.COLOR_TRANSPARENT}})}wasModifiedByTool(){P(this.points[2].price)||this.positionPoints(),this._dataWindow=void 0}wasPointMovedByTool(e,t){let n=this.getVisiblePriceRange()/5e3;if(this.points.indexOf(e)<3){let t=t=>e.update(t,e.time);this.entryAnchor.price>this.upperAnchor.price&&(e===this.entryAnchor?t(this.upperAnchor.price-n):t(this.entryAnchor.price+n)),this.entryAnchor.price<this.lowerAnchor.price&&(e===this.entryAnchor?t(this.lowerAnchor.price+n):t(this.entryAnchor.price-n))}if(e===this.entryAnchor){let t=(t,n,r)=>t.update(n?e.price:t.price,r?e.time:t.time);t(this.exitAnchor,!0,!1),t(this.upperAnchor,!1,!0),t(this.lowerAnchor,!1,!0)}this.wasModifiedByTool()}get isUpperPerPAndL(){return VA(this.dataWindow.pAndL,this.isLong)}getStyleForElement(e,t){return e.style||this.defaultStyle}getElements(){let e=new ik(this.entryAnchor.point,this.exitAnchor.point,!1,!1,this.axis),t=this.exitAnchor.point.x<this.entryAnchor.point.x,n=Math.abs(this.exitAnchor.point.x-this.entryAnchor.point.x),r=(e,t)=>({x:e.x+t,y:e.y}),i=new ak(r(this.upperAnchor.point,t?-n:0),n,Math.abs(this.upperAnchor.point.y-this.entryAnchor.point.y),this.axis);i.style=this.upperStyle;let a=new ak(r(this.entryAnchor.point,t?-n:0),n,Math.abs(this.entryAnchor.point.y-this.lowerAnchor.point.y),this.axis);a.style=this.lowerStyle;let o=[e,i,a],s=this.dataWindow;if(s.refIndex!==-1){let e=s.data[s.refIndex],t=new QO(this.axis,this.entryPrice,e.time),n=new QO(this.axis,s.toPrice,s.toTime),r=new ik(t.point,n.point,!1,!1,this.axis);if(r.style=this.secondaryLineStyle,o.push(r),t.time!==n.time){let e=this.entryPrice<s.toPrice,r=new ak({x:t.point.x,y:Math.min(t.point.y,n.point.y)},n.point.x-t.point.x,Math.abs(n.point.y-t.point.y),this.axis);r.style=e?this.upperStyle:this.lowerStyle,o.push(r)}}return o}hitTest(e){if(!this.isVisible)return!1;let t=this.isHit||!1;return this.isHit=super.hitTest(e),this.isHit!==t&&this.requestRedraw(),this.isHit}get showTextAdornments(){return this.isHit||this.isSelected}getPriceScaleAdornments(){let e=e=>uo(this.traits[e].color);return[{price:this.upperPrice,color:e(B.AT_FILL)},{price:this.entryPrice,color:e(B.AT_LINE)},{price:this.lowerPrice,color:e(B.AT_FILL2)}]}adornElements(e,t){let[n,r,i]=e;if(this.showTextAdornments){let[e,a]=[!0,!1].map(e=>Mo(t,e)),{x:o,y:s,width:c}=r.rect,l={x:o+c/2,y:s+e},u=this.textStyle.fillStyle;Fo(t,this.upperText,l,T.Center,u,uo(this.upperStyle.fillStyle));let{x:d,y:f,width:p,height:m}=i.rect,h={x:d+p/2,y:f+m+Math.abs(a)};Fo(t,this.lowerText,h,T.Center,u,uo(this.lowerStyle.fillStyle));let{p1:g,p2:_}=n,{x:v,y}=g,{x:b}=_,x=this.state||B.NOT_APPLICABLE,S=this.isCompact?`${this.formatDollarValue(this.pAndLValue)}`:`${x} P&L: ${this.formatDollarValue(this.pAndLValue)}, Qty: ${this.formatQuantityValue(this.qty)}`,C=this.isCompact?`${this.formatRatioValue(this.riskReward)}`:`Risk/Reward Ratio: ${this.formatRatioValue(this.riskReward)}`,w=e=>t.measureText(e).width,ee=Math.max(w(S),w(C)),E=Math.abs(b-v)<ee*1.25?y+Math.abs(a)+5:y+e+10,D={x:v+(b-v)/2,y:E},te=uo(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);Fo(t,[S,C],D,T.Center,u,te)}}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}},WA=class extends ck{markers;display=null;constructor(e,t){super(e,t),this.points=dk(e),this.points[2].visible=!1,this.points[3].visible=!1,this.markers=[new aA]}isPointDrawn(e){return super.isPointDrawn(e)?e.visible:!1}makeLineArrow(e,t,n,r){let i=[no(e,t),no(n,r)];return[this.makeLine(i[0],i[1]),rA(i,`end`,10)]}get rectColor(){return this.traits[B.AT_FILL].color}get textColor(){return this.traits[B.AT_FILL_TEXT].color}getMarkers(){return this.markers}getScreenPoints(){return this.points.slice(2).forEach(e=>e.toPoint()),super.getScreenPoints()}formatDateDifference(e,t){return this.presenter.data.aggregation.isEndOfDay?`${zn(t,e)}d`:Qr(ri({start:e,end:t}),{format:[`days`,`hours`,`minutes`,`seconds`]}).replaceAll(/(days?)|(hours?)|(minutes?)|(seconds?)/g,e=>e[0])}computeState(){}get text(){return this.display===null&&this.computeState(),this.display}getTextCoord(e,t){let n=this.points[0].price<this.points[1].price,r=Mo(t,n,this.text.length),{x:i,y:a,width:o,height:s}=e.rect;return{x:i+o/2,y:a+(n?0:s)+(n?r:Math.abs(r))}}adornElements(e,t){Fo(t,this.text,this.getTextCoord(e[0],t),T.Center,this.textColor,uo(this.rectColor))}getDateDifference(){let[e,t]=this.points.slice(0,2).map(e=>e.time);if(!e||!t)return[`0 bars, `,`Vol ${this.formatter.format(0,G.Volume)}`];let n=Math.min(+e,+t),r=Math.max(+e,+t),i=this.data(G.DateTime);if(!i||i.length===0)return[`0 bars, `,`Vol ${this.formatter.format(0,G.Volume)}`];let a=Te(i,+n,Number),o=Te(i,+r,Number),s=this.data(G.Volume);if(!Array.isArray(s))return[`0 bars, `,`Vol ${this.formatter.format(0,G.Volume)}`];let c=pe(s.slice(a,o+1)),l=this.formatter.format(c,G.Volume),u=o-a,d=u===0?``:this.formatDateDifference(n,r),f=e<t?``:`-`;return[`${f}${u} bars, ${f}${d}`,`Vol ${l}`]}getPriceDifference(){let[e,t]=this.points.slice(0,2).map(e=>e.price),n=t-e,r=n/e;return[`${this.formatter.format(n,G.Close)} (${this.formatter.format(r,G.PercentChange)})`]}resetComputedState(){this.display=null}onFormatterChanged(){this.resetComputedState()}getFlipAnchorIndices(){return[0,1]}},GA=class extends WA{getElements(){let[e,t,n,r]=this.getScreenPoints(),i=this.makeLine(e,r),a=this.makeLine(t,n),[o,s]=this.makeLineArrow(e,r,t,n);return this.markers[0]=s,[this.rect,i,a,o]}computeState(){this.display=this.getDateDifference()}},KA=class extends WA{getElements(){let[e,t,n,r]=this.getScreenPoints(),i=this.makeLine(e,n),a=this.makeLine(t,r),[o,s]=this.makeLineArrow(e,n,t,r);return this.markers[0]=s,[this.rect,i,a,o]}computeState(){this.display=this.getPriceDifference()}},qA=class extends WA{get drawBorder(){return this.traits[B.AT_DRAW_BORDER]}getBorderElements(){if(!this.drawBorder)return[];let[e,t,n,r]=this.getScreenPoints();return[this.makeLine(e,r),this.makeLine(t,n),this.makeLine(e,n),this.makeLine(t,r)]}getElements(){let[e,t,n,r]=this.getScreenPoints(),[i,a]=this.makeLineArrow(e,r,t,n),[o,s]=this.makeLineArrow(e,n,t,r);this.markers=[a,s];let c=this.getBorderElements();return[this.rect,i,o].concat(c)}computeState(){this.display=this.getPriceDifference().concat(this.getDateDifference())}},JA=class extends ck{constructor(e,t){super(e,t),this.points=dk(e)}get priceLevels(){return cs(this.traits[B.AT_PRICE_LEVELS])}get timeLevels(){return cs(this.traits[B.AT_TIME_LEVELS])}get showAngles(){return this.traits[B.AT_SHOW_ANGLES]}get reverse(){return this.traits[B.AT_REVERSE]}get showLeftLabels(){return this.traits[B.AT_SHOW_LEFT_LABELS]}get showRightLabels(){return this.traits[B.AT_SHOW_RIGHT_LABELS]}get showTopLabels(){return this.traits[B.AT_SHOW_TOP_LABELS]}get showBottomLabels(){return this.traits[B.AT_SHOW_BOTTOM_LABELS]}getAngles(e,t){let n=this.getScreenPoints(),r=this.lineOnlyStyle(B.AT_LINE_2),i=(e,t)=>e.x===t.x&&e.y===t.y,a=(e,t)=>e.x===t.x||e.y===t.y,o=[];e.concat(t).flatMap(e=>[e.p1,e.p2]).map(e=>{o.some(t=>i(e,t))||o.push(e)});let s=n.map(e=>o.filter(t=>!a(t,e)).map(t=>this.makeLine(e,t))).flat();return s.forEach(e=>e.style=r),s}getElements(){let e=this.getLinesDataAtLevels(this.priceLevels,this.timeLevels),{priceLines:t,timeLines:n}=this.getLineElements(e),r=this.showAngles?this.getAngles(t,n):[];return[...t,...n,...r]}adornElements(e,t){let n=this.singleStyle,r=this.showBackground,i=t.fillStyle,a=jo(t,1)/2,o=e=>Number(e.toFixed(4)).toString(),{x:s,y:c}=B.DEFAULT_ADORN_OFFSET,l=(e,n,r,i,a)=>{let s=oo(e,n);Fo(t,o(r),s,i,a)},u=(e,n)=>{let r=new Path2D;Ao(r,e.p1,n.p2),t.fillStyle=n.style.fillStyle,t.fill(r)},d=null;if(e.forEach(e=>{if(!e._data)return;let{level:t,isPrice:o}=e._data,f=n?i:e.style.strokeStyle,p=d&&r&&!n;o?(this.showLeftLabels&&l(e.p1,{x:s,y:a},t,T.Right,f),this.showRightLabels&&l(e.p2,{x:-s,y:a},t,T.Left,f),p&&u(d,e)):(this.showTopLabels&&l(e.p1,{x:0,y:c},t,T.Center,f),this.showBottomLabels&&l(e.p2,{x:0,y:-c*2},t,T.Center,f),p&&u(d,e)),d=e}),n&&r){let e=this.applyBackgroundOpacity(this.traits.line.color),n=new Path2D,[r,i]=this.getScreenPoints();Ao(n,r,i),t.fillStyle=e,t.fill(n)}}resetComputedState(){this.lines=void 0}updateFrom(e,t,n,r,i){let a=e.reverse!==this.reverse;super.updateFrom(e,t,n,r,i),a&&this.resetComputedState()}getFlipAnchorIndices(){return[0,1]}},YA=e=>e.map(e=>({...e,dimensions:e.value.split(`x`).map(Number)})),XA=5,ZA=(e,t)=>Math.abs(e-t)<1e-7,QA=class extends ck{_parsedFans=null;_parsedArcs=null;constructor(e,t){super(e,t),this.points=dk(e),this._parsedFans=this._parsedArcs=null}get levels(){return cs(this.traits[B.AT_LEVELS])}setComputedAndTraits(e,t){let n={...e,computed:t,traits:this.getTraitsFor(e)};return delete n.line,n}get computedLevels(){return this.levels.map(e=>this.setComputedAndTraits(e,e.value/XA))}get showRangesRatio(){return this.traits[B.AT_SHOW_RANGES_RATIO]}get arcs(){return cs(this.traits[B.AT_ARCS])}get fans(){return cs(this.traits[B.AT_FANS])}get reverse(){return this.traits[B.AT_REVERSE]}get parsedFans(){return this._parsedFans===null&&(this._parsedFans=YA(this.fans)),this._parsedFans}get computedFans(){let[,,e,t]=this.getReversedScreenPoints(),{dx:n,dy:r}=this.unit,{signX:i,signY:a}=this.getOrientation();return this.parsedFans.map(o=>{let[s,c]=o.dimensions;return this.setComputedAndTraits(o,s>=c?{x:e.x,y:e.y+c/s*a*XA*r}:{x:t.x+s/c*XA*i*n,y:t.y})})}get parsedArcs(){return this._parsedArcs===null&&(this._parsedArcs=YA(this.arcs)),this._parsedArcs}get computedArcs(){let{dx:e}=this.unit;return this.parsedArcs.map(t=>{let[n,r]=t.dimensions;return this.setComputedAndTraits(t,Math.sqrt(e**2*(n**2+r**2)))})}getReversedScreenPoints(){let[e,t,n,r]=this.getScreenPoints();return this.reverse?[t,e,r,n]:[e,t,n,r]}get unit(){let[e,t]=this.getReversedScreenPoints();return e.x!==t.x&&e.y!==t.y?{dx:Math.abs(t.x-e.x)/XA,dy:Math.abs(t.y-e.y)/XA}:null}get priceBarRatio(){return this.traits[B.AT_PRICE_BAR_RATIO]}set priceBarRatio(e){this.traits[B.AT_PRICE_BAR_RATIO]=e}makeStyledLine(e,t,n){let r=this.makeLine(e,t);return this.singleStyle||(r.style=hs(n)),r}getGridLines(e,t){let n=t.x-e.x,r=t.y-e.y;return this.computedLevels.map(({computed:i,traits:a})=>{let o=e.x+i*n,s=e.y+i*r;return[this.makeStyledLine({x:o,y:e.y},{x:o,y:t.y},a),this.makeStyledLine({x:e.x,y:s},{x:t.x,y:s},a)]}).flat()}getArcs(e){let{flipX:t,flipY:n,signY:r}=this.getOrientation(),{dx:i,dy:a}=this.unit,o=ZA(i,a)?null:{x:1,y:a/i},s=this.getClipPath();return this.computedArcs.map(({computed:i,traits:a})=>{let c=yA(e,i,t?r*Math.PI/2:0,t?Math.PI:r*Math.PI/2,n,this.axis);return o!==null&&(c.scale=o),c.clip=s,this.singleStyle||(c.style=hs(a)),c})}getFans(e){return this.computedFans.map(({computed:t,traits:n})=>this.makeStyledLine(e,t,n))}getElements(){if(this.unit===null)return[];let[e,t]=this.getReversedScreenPoints(),n=this.getGridLines(e,t),r=this.getArcs(e),i=this.getFans(e);return[...n,...r,...i]}getOrientation(){let[e,t]=this.getReversedScreenPoints(),n=t.x<e.x,r=t.y<e.y;return{flipX:n,signX:n?-1:1,flipY:r,signY:r?-1:1}}getClipPath(){let[e,t]=this.getReversedScreenPoints(),n=new Path2D;return Ao(n,e,t),n}adornElements(e,t){if(e.length===0)return;let n=(e,n,r)=>{t.fillStyle=r;let i=n.hasScale;i&&(t.save(),n.applyScale(t)),t.fill(e),i&&t.restore()};if(this.showBackground){let r=e.filter(e=>e.radius),i=this.getClipPath();if(t.save(),t.clip(i),this.singleStyle){let e=xe(r);n(xA(null,e),e,this.applyBackgroundOpacity(this.traits.line.color))}else{let e=null;r.forEach(t=>{let r=xA(e,t),i=t.style.fillStyle;n(r,t,i),e=t})}t.restore()}if(this.showRangesRatio&&this.unit!==null){let e=xe(this.computedLevels),n=(this.singleStyle?this:e).traits.line.color,[,r,i,a]=this.getReversedScreenPoints(),{x:o,y:s}=B.DEFAULT_ADORN_OFFSET,{flipX:c,signX:l,signY:u}=this.getOrientation(),d=oo(i,{x:-o*l,y:s*u}),{priceDiff:f,barsDiff:p}=this.getLinesDataAtLevels(null,null),m=c?T.Right:T.Left;Fo(t,p.toFixed(0),d,m,n);let h=oo(a,{x:o*2*l,y:-s*u}),g=c?T.Left:T.Right;Fo(t,this.formatter.format(f,G.Close),h,g,n);let _=oo(r,{x:-o*l,y:-s*u});Fo(t,this.priceBarRatio.toFixed(6),_,m,n)}}resetComputedState(){if(this.lines=void 0,this.points.length===4&&this.unit!==null){let{priceDiff:e,barsDiff:t}=this.getLinesDataAtLevels(null,null);this.priceBarRatio=Math.abs(e/t)}}updateFrom(e,t,n,r,i){if(super.updateFrom(e,t,n,r,i),this._parsedFans=this._parsedArcs=null,!ZA(e.priceBarRatio,this.priceBarRatio)){let[t,n,,]=this.points;this.reverse&&([t,n]=[n,t]);let{priceDiff:r,barsDiff:i}=this.getLinesDataAtLevels(null,null);n.update(t.price+Math.sign(r)*e.priceBarRatio*i,n.time),this.resetComputedState()}}getFlipAnchorIndices(){return[0,1]}},$A=5,ej=(e,t)=>{let n=new Path2D;return e===null?n:(Oo(n,e.p1),ko(n,e.p2),ko(n,t.p2),ko(n,t.p1),n)},tj=class extends sk{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[B.AT_EXTEND_PT_1]}get extend2(){return this.traits[B.AT_EXTEND_PT_2]}getElements(){let[e,t,n]=this.getScreenPoints(),{x:r,y:i}=ao(n,e),a=n=>{let[r,i]=[e,t].map(e=>oo(e,n));return new ik(r,i,this.extend1,this.extend2,this.axis)};return this.getColoredElements(({value:e})=>a({x:r*e,y:i*e}))}getTextRef(){return(e,t,n)=>({ref:t,spacing:$A,offsetY:!0,text:this.formatLevelPrice(n,t.anchor1.y)})}adornElements(e,t){this.adornElementsForColoredFactors(e,ej,this.getTextRef(),t)}},nj=class extends ok{levelSize=0;alignLeft=!0;totalVolume=!1;widthPercent=30;useChange=!1;studyPlotId;gotData;boxes=[];periodType=`VisibleScreen`;period=0;valueRangePercent=.7;levelMode=`Count`;usesFinerGrainedAgg=!0;constructor(e,t,n){super(e,t),this.computed=!0,this.studyPlotId=n,this.gotData=!1}setOptions(e){switch(this.levelMode=e.LevelMode,this.levelSize=xt(1,1e3,e.LevelSize),this.alignLeft=e.Position===`Left`,this.totalVolume=e.Volume===`Total`,this.widthPercent=xt(5,100,e.WidthPercent)/100,e.BarColoring){case`OpenToClose`:this.useChange=!1;break;case`CloseToClose`:this.useChange=!0;break;default:{let e=this.presenter.mainPlot?.mainCurve?.attributes;this.useChange=e?.includes(m.ChangeBased)??!1}}N(e.PeriodType)&&(this.periodType=e.PeriodType),this.period=e.Period,this.valueRangePercent=e.ValueRangePercent/100;let t=ne[$()?.config.mode??`Unspecified`];this.usesFinerGrainedAgg=lc(t)}get isCountMode(){return this.levelMode===`Count`}updateLastBox(){if(this.boxes.length>0){let e=this.boxes.pop(),t=this.getDataForRange(e.firstDate,e.lastDate);t&&this.boxes.push(t)}}invalidate(e){switch(this.periodType){case`VisibleScreen`:this.gotData=!1,this.boxes=[];break;case`Bars`:case`Days`:switch(e){case`DataPointAdded`:{let e=this.studySeries.innCont(0)?.getTimeData();if(!P(e))return;let t=e[e.length-1],n=this.boxes.length>0?this.boxes[this.boxes.length-1]:null;if(N(n)&&t.valueOf()<n.lastDate.valueOf())this.updateLastBox();else{let e=this.getDataForRange(t,this.getBoxEndFromStart(t));e&&this.boxes.push(e)}break}case`DataPointChanged`:this.updateLastBox();break;case`NewChunkArrived`:this.gotData=!1;break}break}}getBoxRect(e){switch(this.periodType){case`VisibleScreen`:return this.axis.pane.getBoundsWithoutScales();case`Bars`:case`Days`:{let t=this.axis.pane.presenter.view.xAxis.xScale.bar,n=this.axis.toY(e.min),r=this.axis.toY(e.max),i=this.axis.pane.presenter.view.toX(e.firstDate)-t.width/2,a=0;if(this.periodType===`Days`){let n=e.lastDate,r=this.axis.pane.presenter.view.xAxis.xScale.timeline,o=r.at(r.lastSeriesIndex),s=o.valueOf()<n.valueOf(),c=s?o:n,l=(s?1:-2)*t.width/2;a=this.axis.pane.presenter.view.toX(c)+l-i}else a=this.period*t.width+(this.period-1)*t.spacing;return new Eo(i,r,a,n-r)}default:throw Error(`Unexpected period type for Volume At Price annotation`)}}getElementsForBox(e){let t=this.getBoxRect(e),n=[];if(this.isPeriodic){let e=new ak({x:t.x,y:t.y},t.width,t.height,this.axis);e.style=this.backgroundStyle,n.push(e)}let{x:r,width:i}=t,a=i*this.widthPercent,o=e.bars[e.maxVolumeIndex];return e.bars.forEach((t,s)=>{let{upVolume:c,downVolume:l,totalVolume:u,isValue:d}=t;if(c===0&&l===0)return null;let f=this.axis.toY(e.min+s*e.zone),p=this.axis.toY(e.min+(s+1)*e.zone),m=Math.abs(f-p),h=(e,t,n=0)=>{let a=new ak({x:this.alignLeft?r+n:r+i-e-n,y:p},e,m,this.axis);return a.style=t,a},g=(e,t,n)=>e/t.totalVolume*n,_=this.studyPlot.curves[2].visible,v=_&&d?this.upValueStyle:this.upStyle,y=_&&d?this.downValueStyle:this.downStyle,b=_&&d?this.totalValueStyle:this.totalStyle;if(this.totalVolume){let e=g(u,o,a);n.push(h(e,b))}else{let e=g(l,o,a),t=g(c,o,a);n.push(h(t,v),h(e,y,t))}if(this.studyPlot.curves[1].visible&&s===e.maxVolumeIndex){let e=n[n.length-1].rect,t=this.alignLeft?e.x+e.width:r,a=(p+f)/2,o=this.alignLeft?r+i:e.x;n.push(new ik({x:t,y:a},{x:o,y:a},!1,!1,this.axis))}}),n}get isVisible(){return super.isVisible&&this.studyPlot.isVisible&&this.studyPlot.mainCurve.visible}getElements(){if(this.gotData||this.getData(),!this.gotData||!this.isVisible||this.boxes.length===0)return[];switch(this.periodType){case`VisibleScreen`:{let e=this.boxes[0];return!e||e.bars.length===0?[]:this.getElementsForBox(e)}case`Bars`:case`Days`:{let[e,t]=this.presenter.view.xAxis.xScale.domain()||[];if(!Fn(e)||!Fn(t))return[];let n=this.boxes.findIndex(t=>t.firstDate.getTime()<=e.getTime()&&t.lastDate.getTime()>=e.getTime());n===-1&&(n=0,this.studySeries.loadMoreData());let r=this.boxes.findIndex(e=>e.firstDate.getTime()<=t.getTime()&&e.lastDate.getTime()>=t.getTime());r===-1&&n!==-1&&(r=this.boxes.length-1);let i=[];for(let e=n;e<=r;e++)i.push(...this.getElementsForBox(this.boxes[e]));return i}default:throw Error(`Unexpected period type for Volume At Price annotation`)}}getStyleForElement(e,t){return e.style||super.getStyleForElement(e,t)}get presenter(){return this.axis.pane.presenter}get downStyle(){return this.fillOnlyStyle(B.AT_FILL)}get upStyle(){return this.fillOnlyStyle(B.AT_FILL2)}get totalStyle(){return this.fillOnlyStyle(B.AT_FILL3)}get downValueStyle(){return this.fillOnlyStyle(B.AT_FILL4)}get upValueStyle(){return this.fillOnlyStyle(B.AT_FILL5)}get totalValueStyle(){return this.fillOnlyStyle(B.AT_FILL6)}get backgroundStyle(){return this.fillOnlyStyle(B.AT_FILL7)}get lineStyle(){return this.lineOnlyStyle(B.AT_LINE)}getBoxEndFromStart(e){switch(this.periodType){case`VisibleScreen`:default:return null;case`Days`:return rr(tg(g.Day,this.period)(e),1);case`Bars`:{let t=this.axis.pane.presenter.data.aggregation;return rr(tg(t.unit,t.size*this.period)(e),1)}}}getData(){let e=this.axis.pane.presenter.data.aggregation;if(e.isTick||e.hasSpec&&!WT(e.spec))return;let[t,n]=this.presenter.view.xAxis.xScale.domain()||[];if(!Fn(t)||!Fn(n))return;let r=tg(e.unit,e.size);switch(this.periodType){case`VisibleScreen`:{let e=this.boxes[0];if(!e||e.firstDate!==t||e.lastDate!==n){let e=this.getDataForRange(t,n);e&&(this.boxes[0]=e)}else this.gotData=!0;break}case`Bars`:{let[e,t]=[0,1].map(e=>this.studySeries.innCont(e));if((e?.size??0)<1||(t?.size??0)<1)return;let n=e.getTimeData(),i=0;for(this.boxes=[];i<n.length;){let e=n[i],t=i+this.period,a=rr(t<n.length?n[t]:r(n[n.length-1]),1),o=this.getDataForRange(e,a);o&&this.boxes.push(o),i+=this.period}this.gotData=!0;break}case`Days`:{if(e.isEndOfDay){this.boxes=[],this.gotData=!0;return}let[t,n]=[0,1].map(e=>this.studySeries.innCont(e));if((t?.size??0)<1||(n?.size??0)<1)return;let i=t.getTimeData(),a=t.getData(G.TradingDay),o=e=>{let t=0,n=i[e],r=a[e];for(let o=e;o<i.length;o++)if(bn(i[o],n)>0&&a[o]!==r&&(t+=1,n=i[o],r=a[o],t===this.period))return o;return-1},s=0,c=i[s],l=o(s)-1;for(;(l<0||l===s)&&s<i.length;)s+=1,l=o(s)-1;for(this.boxes=[];s<i.length&&l<i.length&&s<l;){let e=rr(r(i[l]),1),t=this.getDataForRange(c,e);t&&this.boxes.push(t),s=l+1,c=i[s],l=o(s)-1}if(l<0&&s<i.length-1){let e=rr(r(i[i.length-1]),1),t=this.getDataForRange(i[s],e);t&&this.boxes.push(t)}this.gotData=!0;break}}}getBoxAt(e){if(this.boxes.length===0)return null;switch(this.periodType){case`VisibleScreen`:{let t=this.boxes[0];return t.firstDate>e||t.lastDate<e?null:t}case`Bars`:case`Days`:{let t=e.getTime();return this.boxes.find(e=>e.firstDate.getTime()<=t&&e.lastDate.getTime()>=t)||null}}}getValueAt(e,t,n){if(!this.isVisible)return null;let r=this.getBoxAt(t);if(!r)return null;let i=this.getBarIndex(r,n);if(i<0||i>=r.bars.length)return null;let a=r.bars[i];switch(e){case G.UPVOL:return this.totalVolume?null:a.upVolume;case G.DNVOL:return this.totalVolume?null:a.downVolume;case G.TOTVOL:return this.totalVolume?a.totalVolume:null;case G.POC:case G.VAREA:case G.BARBACK:return null;default:throw Error(`Unexpected Volume At Price field`)}}getBarIndex(e,t,n=!1){if(e.bars.length===0||e.zone===0)return-1;let r=Math.floor((t-e.min)/e.zone);return n?Math.min(e.bars.length-1,r):r}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get studySeries(){return this.studyPlot.timeSeries}makeBox(e,t){return{min:Number.MAX_VALUE,max:Number.MIN_VALUE,zone:0,bars:[],maxVolumeIndex:-1,firstDate:e,lastDate:t}}findExtremes(e,t,n,r,i,a){let o=N(i)&&N(a);for(let s=t;s<=n;s++)if(o){let t=i[s];t>e.max&&(e.max=t);let n=a[s];n<e.min&&(e.min=n)}else{let t=r[s];t<e.min&&(e.min=t),t>e.max&&(e.max=t)}}findValueArea(e){if(e.maxVolumeIndex===-1||e.bars.length===0)return;e.bars[e.maxVolumeIndex].isValue=!0;let t=pe(e.bars.map(e=>e.totalVolume))*this.valueRangePercent,n=e.bars[e.maxVolumeIndex].totalVolume,r=e.maxVolumeIndex,i=e.maxVolumeIndex;for(;n<t;){let a=[{dir:`lower`,count:2,startIdx:r-2,endIdx:r-1},{dir:`lower`,count:1,startIdx:r-1,endIdx:r-1},{dir:`upper`,count:2,startIdx:i+1,endIdx:i+2},{dir:`upper`,count:1,startIdx:i+1,endIdx:i+1}].filter(t=>t.startIdx>=0&&t.endIdx<e.bars.length).map(t=>{let r=pe(e.bars.slice(t.startIdx,t.endIdx+1).map(e=>e.totalVolume));return{...t,volume:r,newTotal:n+r}});if(a.length===0)break;let o=(e,t)=>t.newTotal<e.newTotal?t:e,s=(e,t)=>t.volume>e.volume?t:e,c=a.filter(e=>e.newTotal>=t),l=c.length>0?c.reduce(o):a.reduce(s);for(let t=l.startIdx;t<=l.endIdx;t++)e.bars[t].isValue=!0;if(l.dir===`lower`?r=l.startIdx:i=l.endIdx,n=l.newTotal,n>=t)break}}tallyVolume(e,t,n,r,i,a,o){let s=Number.MIN_VALUE,c=!1;for(let l=t;l<=n;l++){let t=i[l],n=this.getBarIndex(e,t,!0);if(n===-1){c=!0;break}let u=o[l],d=this.useChange?a[l]>=0:r[l]<=i[l],f=e.bars[n];d?f.upVolume+=u:f.downVolume+=u,f.totalVolume=f.downVolume+f.upVolume,f.totalVolume>s&&(s=f.totalVolume,e.maxVolumeIndex=n)}c||this.findValueArea(e)}get isPeriodic(){return this.periodType===`Bars`||this.periodType===`Days`}get isVisibleScreen(){return this.periodType===`VisibleScreen`}getDataForRange(e,t){let n=this.makeBox(e,t),r=this.studySeries.innCont(1),i=r?.getTimeData();if(!P(i)||i.length===0)return null;let a=e=>Te(i,+e,Number),o=a(e),s=a(t);if(s<0||s>=i.length||o<0||o>=i.length)return null;let c=i[s];if(!P(c)||(c.getTime()>t.getTime()&&--s,s<0)||o>s)return null;if(this.axis.pane.presenter.data.aggregation.unit===g.Day&&this.periodType===`Bars`){let e=r.getData(G.TradingDay),t=e[o];for(;t===e[o]&&o>0;)--o;o+=1;let n=0;for(s=o;s<i.length&&n<this.period;)e[s]!==t&&(n+=1,t=e[s]),s+=1;s-=2}this.isVisibleScreen&&this.usesFinerGrainedAgg&&o<1e3&&this.studySeries.loadMoreData();let l=e=>r.getData(e),[u,d,f,p,m,h]=[`Open`,`High`,`Low`,`Close`,`Change`,`Volume`].map(e=>l(G[e]));this.findExtremes(n,o,s,p,d,f);let _=n.max-n.min,v=e=>({upVolume:0,downVolume:0,isValue:!1,totalVolume:0});if(this.isCountMode)n.zone=_/this.levelSize,n.bars=De(this.levelSize,v);else{let e=(this.presenter.mainPlot?.metaData.minMovement??1)*this.levelSize,t=Math.max(1,Math.ceil(_/e));n.zone=_/t,n.bars=De(t,v)}return this.tallyVolume(n,o,s,u,p,m,h),this.gotData=!0,n}},rj=[`None`,`Absolute`,`Percent`],ij=`#16A34A`,aj=`#DC2626`;function oj(e){return typeof e==`string`&&rj.includes(e)}var sj=class extends ok{studyPlotId;displayMode=`None`;visibleLabelSegments=[];constructor(e,t,n){super(e,t),this.studyPlotId=n}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get studySeries(){return this.studyPlot.timeSeries}setOptions(e){let t=e.ReversalChange;this.displayMode=oj(t)?t:`None`}formatSegmentValue(e,t){return this.displayMode===`Absolute`?this.formatter.format(t-e,G.Close):this.displayMode===`Percent`?e===0?``:this.formatter.format((t-e)/e,G.PercentChange):``}getElements(){if(this.visibleLabelSegments=[],!this.studyPlot.isVisible||!this.studyPlot.mainCurve.visible)return[];let e=this.studySeries.getCurrentState();if(!e)return[];let t=e.confirmedPivots,n=Array.from(t.keys()).sort((e,t)=>e-t);if(n.length===0)return[];let r=this.presenter.mainPlot?.timeSeries?.container;if(!r||r.size<2)return[];let i=r.getTimeData();if(!i)return[];let a=this.presenter.view,[o,s]=a.xAxis.xScale.domain()||[];if(!o||!s)return[];let c=o.getTime(),l=s.getTime(),u=-1,d=-1;for(let e=0;e<n.length;e++){let t=i[n[e]].getTime();if(u===-1&&t>=c&&(u=Math.max(0,e-1)),t<=l)d=e;else if(u!==-1)break}if(u===-1){if(n.length>0&&i[n[0]].getTime()>l)return[];u=n.length-1,d=n.length-1}else d===-1&&(d=u);d=Math.min(n.length-1,d+1);let f=[];for(let e=u;e<d;e++){let r=n[e],o=n[e+1],s=t.get(r),u=t.get(o),d=a.toX(i[r]),p=this.axis.toY(s),m=a.toX(i[o]),h=this.axis.toY(u);f.push(this.makeLine({x:d,y:p},{x:m,y:h}));let g=i[o].getTime();g>=c&&g<=l&&this.visibleLabelSegments.push({fromPrice:s,toPrice:u,toPoint:{x:m,y:h}})}if(P(e.pivotPrice)&&P(e.candPrice)){let t=i[e.pivotIndex].getTime();if(i[e.candIndex].getTime()>=c&&t<=l){let t=a.toX(i[e.pivotIndex]),n=this.axis.toY(e.pivotPrice),r=a.toX(i[e.candIndex]),o=this.axis.toY(e.candPrice);f.push(this.makeLine({x:t,y:n},{x:r,y:o}))}}return f}adornElements(e,t){if(this.displayMode===`None`||this.visibleLabelSegments.length===0)return;let n=Math.abs(Mo(t,!0));this.visibleLabelSegments.forEach(e=>{let r=this.formatSegmentValue(e.fromPrice,e.toPrice);if(r===``)return;let i=e.toPrice>=e.fromPrice;Fo(t,r,{x:e.toPoint.x,y:e.toPoint.y+(i?-n:n)},T.Right,i?ij:aj)})}},cj=[B.AT_LINE,B.AT_LINE_2,B.AT_LINE_3],lj=class extends ok{studyPlotId;constructor(e,t,n){super(e,t),this.studyPlotId=n}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get studySeries(){return this.studyPlot.timeSeries}isCurveVisible(e){return this.studyPlot.curves[e]?.visible??!1}getChannelPrices(){let e=this.studySeries.getCurrentState();if(!e)return null;let{startIndex:t,endIndex:n,slope:r,intercept:i,stdDevWidth:a}=e;if(!N(t)||!N(n)||!N(r)||!N(i)||!N(a)||!Ze(r)||!Ze(i)||!Ze(a))return null;let o=n-t+1;if(o<1)return null;let s=e=>i+r*(e+1),c=s(0),l=s(o-1);return{start:[c+a,c,c-a],end:[l+a,l,l-a]}}makeLines(){if(!this.studyPlot?.isVisible)return null;let e=this.studySeries.getCurrentState(),t=this.getChannelPrices();if(!e||!t)return null;let{startIndex:n,endIndex:r,extendLeft:i,extendRight:a}=e;if(!N(n)||!N(r))return null;let o=this.studyPlot.basePlot?.timeSeries?.container??this.presenter.mainPlot?.timeSeries?.container;if(!o||o.size<2)return null;let s=o.getTimeData();if(!s||s.length<=r)return null;let c=this.presenter.view,[[l,u,d],[f,p,m]]=[t.start,t.end],h=c.toX(s[n]),g=c.toX(s[r]),_=(e,t,n)=>{let r=this.axis.toY(e),o=this.axis.toY(t),s=new ik({x:h,y:r},{x:g,y:o},i,a,this.axis);return s._data={lineIndex:n},s};return[_(l,f,0),_(u,p,1),_(d,m,2)]}getStyleForElement(e,t){let n=cj[e._data?.lineIndex??t],r=this.traits[n];return r?hs({line:r,fill:{color:B.COLOR_TRANSPARENT}}):super.getStyleForElement(e,t)}getElements(){let e=this.makeLines();return e?e.filter((e,t)=>this.isCurveVisible(t)):[]}getPriceScaleAdornments(){let e=this.getChannelPrices();if(!e)return[];let t=[this.traits?.[B.AT_LINE]?.color,this.traits?.[B.AT_LINE_2]?.color,this.traits?.[B.AT_LINE_3]?.color];return e.end.map((e,n)=>({price:e,color:t[n]??this.traits?.line?.color??`#000`}))}getDomainPrices(){let e=this.getChannelPrices();return e?[...e.start,...e.end]:[]}adornElements(e,t){let n=this.makeLines();if(!n||!n.every(e=>P(e.p1,e.p2)))return;let[r,i,a]=n,o=(e,n,r)=>{t.fillStyle=r,t.fill(ej(e,n))};this.isCurveVisible(3)&&o(r,i,this.traits?.[B.AT_FILL]?.color),this.isCurveVisible(4)&&o(i,a,this.traits?.[B.AT_FILL2]?.color)}};function uj(e){let t=e<0?-1:1,n=Math.abs(e)/Math.SQRT2,r=1/(1+.3275911*n);return .5*(1+t*(1-((((1.061405429*r+-1.453152027)*r+1.421413741)*r+-.284496736)*r+.254829592)*r*Math.exp(-n*n)))}var dj=class extends ok{studyPlotId;periodTarget=0;targetPrice1=0;targetPrice2=0;pricesCount=0;targetDate;computed=!1;anchorPrice=0;sigmaAnnualized=0;unitsPerYear=0;probabilityAbove=0;probabilityBelow=0;probabilityBetween=0;styles=[];constructor(e,t,n){super(e,t),this.studyPlotId=n}makeStyles(){let e=this.lineOnlyStyle(B.AT_LINE),t=this.lineOnlyStyle(B.AT_LINE_2);this.styles=[e,t,t]}containerOf(e){return e?.timeSeries.container}get mainCont(){return this.containerOf(this.presenter.mainPlot)}get studyCont(){return this.containerOf(this.studyPlot)}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get targetPrice(){return this.targetPrice1===0?this.targetPrice2:this.targetPrice1}setOptions(e){if(this.periodTarget=e.PeriodTarget,this.targetPrice1=e.TargetPrice1,this.targetPrice2=e.TargetPrice2,this.pricesCount=(this.targetPrice1===0?0:1)+(this.targetPrice2===0?0:1),this.pricesCount>1&&this.targetPrice1<this.targetPrice2){let e=this.targetPrice1;this.targetPrice1=this.targetPrice2,this.targetPrice2=e}}get haveInput(){return this.periodTarget!==0&&(this.targetPrice1!==0||this.targetPrice2!==0)}get haveData(){return N(this.mainCont)&&!this.mainCont.isEmpty&&this.studySeries.haveVolatility}get studySeries(){return this.studyPlot.timeSeries}getData(){let e=this.presenter.timeline;this.targetDate=e.at(e.lastSeriesIndex+this.periodTarget),this.points=[new QO(this.axis,this.targetPrice,this.targetDate)],this.pricesCount>1&&this.points.push(new QO(this.axis,this.targetPrice2,this.targetDate)),this.unitsPerYear=dO(this.presenter.data.aggregation),this.anchorPrice=this.mainCont.getLastDataPoint(G.Close),this.sigmaAnnualized=this.studySeries.getVolatilityPercent()}computeProbabilities(){let e=this.sigmaAnnualized*Math.sqrt(this.periodTarget/this.unitsPerYear),t=t=>(t-this.anchorPrice)/(this.anchorPrice*e),n=uj(t(this.targetPrice));if(this.pricesCount>1){let e=uj(t(this.targetPrice2));this.probabilityAbove=1-n,this.probabilityBelow=e,this.probabilityBetween=n-e}else this.probabilityBelow=n,this.probabilityAbove=1-this.probabilityBelow;this.computed=!0}compute(){!this.haveInput||!this.haveData||(this.getData(),this.computeProbabilities())}getElements(){if(this.computed||this.compute(),!this.computed||!this.studyPlot.isVisible||!this.studyPlot.mainCurve.visible)return[];let e=[];return e.push(new ZO(this.points[0].point,!0,this.axis)),e.push(new ZO(this.points[0].point,!1,this.axis)),this.pricesCount>1&&e.push(new ZO(this.points[1].point,!1,this.axis)),e}getStyleForElement(e,t){return this.styles.length||this.makeStyles(),this.styles[t]}get hasPoint(){return this.points.length>0}getTimeScaleAdornments(){return this.hasPoint?[{time:this.points[0].time,color:this.traits.line.color}]:[]}getPriceScaleAdornments(){if(!this.hasPoint)return[];let e=[];return e.push({price:this.points[0].price,color:this.traits.line2.color}),this.pricesCount>1&&e.push({price:this.points[1].price,color:this.traits.line2.color}),e}adornElements(e,t){if(this.computed){let[e,n]=[!0,!1].map(e=>Math.abs(Mo(t,e))),r=this.pricesCount>1,i=this.points[0].point,a=r?this.points[1].point:i,o=this.traits.line2.color,s=xo(o),c=jo(t),l=[`Above`,`Below`,`Between`],u=(e,t)=>`${Xe(e*100,2).toFixed(2)}% Probability ${l[t]}`,d=(e,n)=>Fo(t,e,n,T.Right,s,o);if(d(u(this.probabilityAbove,0),{x:i.x-10,y:i.y-e}),r){let e=i.y+(a.y-i.y+c)/2;d(u(this.probabilityBetween,2),{x:i.x-10,y:e})}d(u(this.probabilityBelow,1),{x:a.x-10,y:a.y+n})}}},fj=new Qk,pj=e=>yj($k,AA,1,e),mj=e=>yj($k,hk,1,e),hj={Default:()=>function(){return fj},Line:()=>yj(_k,oA,!1),DateRange:()=>yj(_k,GA,!1),PriceRange:()=>yj(_k,KA,!1),DatePriceRange:()=>yj(_k,qA,!1),GannBox:()=>yj(_k,JA,!1),GannSquare:()=>yj(yk,QA),Ray:()=>yj(_k,oA,!1),GannLine:()=>yj(vk,oA,!1),VerticalLine:()=>yj($k,sA,1),HorizontalLine:()=>yj($k,cA,1),LongPosition:()=>yj($k,UA,1,!0),ShortPosition:()=>yj($k,UA,1,!1),FiftyPercentLine:function(e,t){return P(e)?yj(eA,lA,e.axis||t.mainAxis,e):yj($k,lA,2)},FibonacciRetracement:()=>yj(_k,fA,!1),TrendBasedFibExtension:()=>yj(_k,pA,!0),FibonacciFan:()=>yj(_k,_A,!1),FibonacciArcs:()=>yj(_k,CA,!1),FibonacciChannel:()=>yj(_k,tj,!0),GannFan:()=>yj(_k,wA,!1),SpeedResistanceFan:()=>yj(_k,TA,!1),SpeedResistanceArcs:()=>yj(_k,EA,!1),AndrewsPitchfork:()=>yj($k,DA,3),Rectangle:()=>yj(_k,Uk,!1),Ellipse:()=>yj(_k,OA,!1),TrendChannel:()=>yj(_k,kA,!0),SymbolArrowUp:()=>pj(`arrow_up`),SymbolArrowDown:()=>pj(`arrow_down`),SymbolArrowRight:()=>pj(`arrow_right`),SymbolArrowLeft:()=>pj(`arrow_left`),SymbolArrowHorizontal:()=>pj(`arrow_horizontal`),SymbolArrowVertical:()=>pj(`arrow_vertical`),SymbolArcDown:()=>pj(`arc_down`),SymbolArcUp:()=>pj(`arc_up`),SymbolThumbsUp:()=>pj(`thumbs_up`),SymbolThumbsDown:()=>pj(`thumbs_down`),SymbolZero:()=>pj(`zero`),SymbolOne:()=>pj(`one`),SymbolTwo:()=>pj(`two`),SymbolThree:()=>pj(`three`),SymbolFour:()=>pj(`four`),SymbolFive:()=>pj(`five`),SymbolSix:()=>pj(`six`),SymbolSeven:()=>pj(`seven`),SymbolEight:()=>pj(`eight`),SymbolNine:()=>pj(`nine`),SymbolQuestion:()=>pj(`question`),SymbolFishHook:()=>pj(`fish_hook`),SymbolLetterB:()=>pj(`letter_b`),SymbolLetterS:()=>pj(`letter_s`),SymbolLetterA:()=>pj(`letter_a`),SymbolLetterC:()=>pj(`letter_c`),SymbolLetterD:()=>pj(`letter_d`),SymbolLetterE:()=>pj(`letter_e`),FibonacciTimeZones:()=>yj(_k,jA,!1),Text:()=>yj(bk,mk,null),PickPoint:()=>function(){return new MA},ZoomIn:()=>function(){return new Kk},ProfitLoss:mj,RewardRisk:mj,VolumeAtPrice:function(e){return yj($k,nj,2,e)},ZigZag:function(e){return yj(eA,sj,null,e)},ProbabilityCones:function(e){return yj($k,dj,2,e)},LinearRegressionChannel:function(e){return yj(eA,lj,null,e)}};function gj(e,t=!1,n=null,r=null,i=null){let a=hj[e];return a=a(r,i),a(e,t,n)}function _j(e,t={}){e.enableTooltip(!0),e.resetActiveTool();let{axis:n,annotation:r,toolChange:i,annId:a}=t;P(n)&&e.onAnnotationsUpdated(n),P(r)&&e.onAnnotationModifiedByTool(r,i),[O.Cancelled,O.Executed,O.TextChanged].includes(i)&&e.onAnnotationDone(a,i)}function vj(e,t=!0,n=O.None){e.wasModifiedByTool();let r=e.axis,i={axis:r,annotation:e,toolChange:n};_j(r.pane.presenter,t?i:void 0)}function yj(e,t,n,r){return function(i,a,o){let s=rk(i,t,r,o);return s.annName=i,a?s:new e(s,n)}}function bj(e){e.button===E.Right&&_j(e.presenter)}function xj(e,t,n){let r={};r.inputs=dt(e.inputs);let i=r.inputs[B.INPUT_SOURCE],a=N(i)?G[i]:void 0;r.source=G[e.source]??a;let o=e.target!==void 0,s=P(n)?n:e.curves;return r.outFields=Oe(o?[G[e.target]]:s.map(e=>e.fields).flat()),r.target=o?G[e.target]:r.outFields[0],r.aggregation=t,r}function Sj(e){return Array.isArray(e.innerSeries)}function Cj(e){return e.query?.symbol===B.PLACEHOLDER_SYMBOL_NAME?!0:Sj(e)?e.innerSeries.some(e=>Cj(e)):!1}var wj=class extends WO{model;basePlot;_hasEvents;_params;_shiftFmt;_title;range;shouldMaybePriceMap;annIndex;_canPriceMap;#e(e=3){let t=this.model.inputs||[],n=t.length;if(n===0)return``;let r=``;n>e&&(t=t.slice(0,3),r=`, ...`);let i=this.model.study===`AVWAP`;return t.length===0?``:`(${t.map(e=>i&&e.name===`Anchor`?new Date(e.value).toLocaleString():e.value).join(`, `)}${r})`}get params(){return P(this._params)||(this._params=this.#e()),this._params}get fullParams(){return this.#e(Number.MAX_VALUE)}get shiftFmt(){if([`PC`,`TARGP`].includes(this.model.study))return``;if(!P(this._shiftFmt)){let e=this.curves.map(e=>Number(e.shift)).filter(e=>e!==0);this._shiftFmt=e.length===0?``:`[${e.join(`, `)}]`}return this._shiftFmt}get title(){if(!P(this._title)){let e=this.params,t=this.shiftFmt;this._title=`${this.model.study} ${e} ${t}`.trim()}return this._title}getStandalonePaneTitle(){let e=this.getStandalonePaneBasisTitle();return e?`${this.title} on ${e}`:this.title}getStandalonePaneBasisTitle(){if(this.model?.basis?.kind!==`seasonal`)return null;let e=this.basePlot;if(!e?.isSeasonal)return null;let t=e;if(t.isFutures&&!t.hasComputation){let t=e.metaData?.symbol;if(typeof t==`string`&&t.length>0)return t}return e.title||null}fromModel(e){this.model=e,super.fromModel(this.model)}getMetaData(e){let t=e.meta.decimals;this.metaData=t===void 0?this.basePlot.metaData:new Wa(t),P(e.meta.range)&&(this.range=e.meta.range)}getDetachedScaleMargins(){return this.model?.study===`VOL`&&this.axis?.pane.isMain?B.VOLUME_DETACHED_SCALE_MARGINS:super.getDetachedScaleMargins()}applySpecifics(e){let t=this.model.study,n=V(t);n.meta.shiftable===!0&&this.curves.forEach(t=>{Number.isFinite(e.inputs.Offset)&&(t.shift=e.inputs.Offset)});let r=(e,t,n)=>this.curves[e].zones[t].value=this.model.levels[n].value;switch(t){case`ICHCLD`:{let t=e.inputs.Displacement;this.curves[2].shift=-t,this.curves[3].shift=t,this.curves[4].shift=t,this.curves[5].shift=t;break}case`MARIB`:{let t=Math.min(Math.max(0,e.inputs.Count),10);this.curves.forEach((e,n)=>e.visible=e.visible&&n<t);break}case`CRS`:{let t=e.inputs.Display===`PercentChange`;this.axis.comparison=t?x.Percent:x.None;break}case`PERF`:{let t=e.inputs.Anchor===`VisibleStart`;this.axis.comparison=t?x.Percent:x.None;break}case`HV`:e.inputs.Calculation===`Absolute`&&delete n.meta.decimals;break;case`JPI`:case`CTTP`:case`CTTI`:{let t=De(10,e=>(e+1)*.025),n=e=>t.map(t=>_o(t)(e)),r=([e,t])=>[...n(e).reverse(),t,`#6a4a3a`,`#a000c8`,`#ffffff`];this.curves[0].colors=r(this.curves[0].colors),this.curves[1].colors=r(this.curves[1].colors);let i=this.curves[0].colors.length;this.curves[0].colors[i-1]=this.curves[1].colors[t.length],this.curves[1].colors[i-1]=this.curves[0].colors[t.length],this.shouldMaybePriceMap=e.inputs.Height===`Performance`;break}case`RSI`:case`RSIMOD`:case`RSISTO`:case`CCI`:r(0,0,0),r(0,1,2);break;case`STC`:r(0,0,0),r(0,1,1);break;case`RVOL`:case`DPO`:case`COPP`:r(0,0,0);break;case`VOL`:this.setCurveAttributes(0,e.inputs.BarColoring);break;case`MAVOL`:this.setCurveAttributes(1,e.inputs.BarColoring);break;case`VOLAP`:{this.notifyAboutPriceDomains=!0,this.customPlotValues=!0,P(this.annotations)||(this.annotations=[]);let t=this.curves[1],n=this.curves[2],r=gj(`VolumeAtPrice`,!0,{[B.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[B.AT_FILL]:{color:this.curves[0].colors[0]},[B.AT_FILL2]:{color:this.curves[0].colors[1]},[B.AT_FILL3]:{color:this.curves[0].colors[2]},[B.AT_FILL4]:{color:n.colors[0]},[B.AT_FILL5]:{color:n.colors[1]},[B.AT_FILL6]:{color:n.colors[2]}},this.id)(this.axis,!1);r.setOptions(e.inputs),this.annIndex=this.annotations.push(r)-1;break}case`PVACP`:{this.customPlotValues=!0,P(this.annotations)||(this.annotations=[]);let t=this.curves[1],n=this.curves[2],r=this.curves[3],i=gj(`VolumeAtPrice`,!0,{[B.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[B.AT_FILL]:{color:this.curves[0].colors[0]},[B.AT_FILL2]:{color:this.curves[0].colors[1]},[B.AT_FILL3]:{color:this.curves[0].colors[2]},[B.AT_FILL4]:{color:n.colors[0]},[B.AT_FILL5]:{color:n.colors[1]},[B.AT_FILL6]:{color:n.colors[2]},[B.AT_FILL7]:{color:r.colors[0]}},this.id)(this.axis,!1);i.setOptions(e.inputs),this.annIndex=this.annotations.push(i)-1;break}case`ZIGZAG`:{this.customPlotValues=!0,P(this.annotations)||(this.annotations=[]);let t=gj(`ZigZag`,!0,{[B.AT_LINE]:{color:this.curves[0].colors[0],width:this.curves[0].lineWidth,dashStyle:this.curves[0].dashStyle??`Solid`}},this.id)(this.axis,!1);t.setOptions(e.inputs),this.annIndex=this.annotations.push(t)-1;break}case`LINRCHN`:{this.customPlotValues=!0,P(this.annotations)||(this.annotations=[]);let e=this.curves[0],t=this.curves[1],n=this.curves[2],r=this.curves[3],i=this.curves[4],a=gj(`LinearRegressionChannel`,!0,{[B.AT_LINE]:{color:e.colors[0],width:e.lineWidth,dashStyle:e.dashStyle??`Solid`},[B.AT_LINE_2]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle??`Solid`},[B.AT_LINE_3]:{color:n.colors[0],width:n.lineWidth,dashStyle:n.dashStyle??`Solid`},[B.AT_FILL]:{color:r.colors[0]},[B.AT_FILL2]:{color:i.colors[0]}},this.id)(this.axis,!1);this.annIndex=this.annotations.push(a)-1;break}case`IVRANK`:{let t=G.ImplVolRank1Y;switch(e.inputs.TimeFrame){case`1-Year`:default:break;case`5-Day`:t=G.ImplVolRank5D;break;case`1-Month`:t=G.ImplVolRank1M;break;case`3-Month`:t=G.ImplVolRank3M;break;case`6-Month`:t=G.ImplVolRank6M;break;case`YTD`:t=G.ImplVolRankYTD;break}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case`IVPCTL`:{let t=G.ImplVolPerc1Y;switch(e.inputs.TimeFrame){case`1-Year`:default:break;case`5-Day`:t=G.ImplVolPerc5D;break;case`1-Month`:t=G.ImplVolPerc1M;break;case`3-Month`:t=G.ImplVolPerc3M;break;case`6-Month`:t=G.ImplVolPerc6M;break;case`YTD`:t=G.ImplVolPercYTD;break}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case`OPTIV`:{let t=[G.WeighImplVolHigh,G.WeighImplVol,G.WeighImplVolLow];switch(e.inputs.TimeFrame){case`Implied Volatility`:default:break;case`5-Day Average IV`:t=[G.WeighImplVolHigh5D,G.WeighImplVol5D,G.WeighImplVolLow5D];break;case`1-Month Average IV`:t=[G.WeighImplVolHigh1M,G.WeighImplVol1M,G.WeighImplVolLow1M];break;case`3-Month Average IV`:t=[G.WeighImplVolHigh3M,G.WeighImplVol3M,G.WeighImplVolLow3M];break;case`6-Month Average IV`:t=[G.WeighImplVolHigh6M,G.WeighImplVol6M,G.WeighImplVolLow6M];break;case`1-Year Average IV`:t=[G.WeighImplVolHigh1Y,G.WeighImplVol1Y,G.WeighImplVolLow1Y];break;case`YTD Average IV`:t=[G.WeighImplVolHighYTD,G.WeighImplVolYTD,G.WeighImplVolLowYTD];break}this.curves[0].fields[0]=t[0],this.curves[1].fields[0]=t[1],this.curves[2].fields[0]=t[2],e.outFields=[...t];break}case`PC`:{let t=e.inputs.PeriodForecast-1;this.curves.forEach(e=>e.shift=t),P(this.annotations)||(this.annotations=[]);let n=this.curves[11],r=this.curves[12],i=gj(`ProbabilityCones`,!0,{[B.AT_LINE]:{color:n.colors[0],width:n.lineWidth,dashStyle:n.dashStyle},[B.AT_LINE_2]:{color:r.colors[0],width:r.lineWidth,dashStyle:r.dashStyle}},this.id)(this.axis,!1);i.setOptions(e.inputs),this.annIndex=this.annotations.push(i)-1;break}case`TARGP`:this.curves.forEach(e=>e.shift=1);break}return n}getValueAt(e,t,n){return this.isVolAP?this.annotations[this.annIndex].getValueAt(e,t,n):super.getValueAt(e,t,n)}getColorOf(e){if(!this.isVolAP&&!this.isZigZag&&!this.isLinRegChannel)return null;let t=this.curves[0].colors;if(this.isZigZag)return t[0];switch(e){case G.UPVOL:return t[1];case G.DNVOL:return t[0];case G.TOTVOL:return t[2];case G.POC:case G.VAREA:case G.BARBACK:return B.COLOR_TRANSPARENT;case G.LINRUP:return t[0];case G.LINRMID:return this.curves[1].colors[0];case G.LINRLOW:return this.curves[2].colors[0];default:throw Error(`Unexpected Volume At Price field`)}}isEmpty(){return this.isVolAP||this.isZigZag||this.isLinRegChannel?!1:super.isEmpty()}setCurveAttributes(e,t){let n=t=>this.curves[e].attributes=[m[t]];switch(t){case`LikeMain`:{let t=this.axis.pane.presenter.mainPlot.curves[0].attributes,r=$().config.defaultVolumeBarColoring;P(t)?this.curves[e].attributes=[t[0]]:P(r)?n(r===`OpenToClose`?`OpenVsClose`:`ChangeBased`):n(`OpenVsClose`);break}case`OpenToClose`:n(`OpenVsClose`);break;case`CloseToClose`:n(`ChangeBased`);break;default:throw Error(`Unexpected bar coloring choice: ${t}`)}}get hasEvents(){return!!this._hasEvents&&this.curves.every(e=>e.visible)}get eventsSeries(){return this.timeSeries}doesSeriesEmitEvents(){let e=this.timeSeries.helpers;return e.includes(G.Buy)||e.includes(G.Sell)}getEventFor(e){let t=this.model?.study===`PACROSS`||this.model?.study===`MACROSS`?this.curves[0]?.colors:void 0;switch(e){case G.Buy:return{show:!0,title:`B`,color:t?.[1]??`#03c03c`};case G.Sell:return{show:!0,title:`S`,color:t?.[0]??`#c23b22`};default:return null}}getEventFields(){return this.hasEvents?[G.Buy,G.Sell]:[]}getRefPlot(e){return this.axis?.pane.isMain&&this.basePlot?this.basePlot:super.getRefPlot(e)}#t(){return this.model.basis??{kind:`main`}}#n(e){let t=this.axis.pane.presenter.allPlots.find(t=>t.uid===e.uid&&t.isSeasonal&&t.offset===e.offset);if(P(t))return t;throw Error(`Unable to resolve seasonal basis plot for uid '${e.uid}' and offset '${e.offset}'`)}#r(){let e=this.#t();switch(e.kind){case`main`:return this.axis.pane.presenter.mainPlot;case`seasonal`:return this.#n(e);default:throw Error(`Unknown study basis kind '${e.kind}'`)}}async initialize(){return da.call(this,async()=>{this.basePlot=this.#r(),await this.basePlot.initialize();let e=this.axis.pane.presenter.data.aggregation,t=xj(this.model,e,this.curves);if(this.basePlot.isSeasonal){let e=this.basePlot.mainCurve.fields[0];P(e)&&(t.source=e)}let n=this.applySpecifics(t);this.getMetaData(n);let r=this.basePlot.timeSeries;r instanceof ub&&(r=r.actual),this.timeSeries=DD(this.model.study,t,r),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;let i=this.title;return this.timeSeries.ready().then(e=>{let t=this.basePlot.timeSeries instanceof __||Cj(this.timeSeries);!e&&!this.timeSeries.hasData&&!t&&!this.timeSeries.computedServerSide&&I(`Unable to calculate study values for ${i}`,`error`)}),!0})}get isJpi(){return[`JPI`,`CTTP`,`CTTI`].includes(this.model.study)}get isVolAP(){return this.model.study===`VOLAP`||this.model.study===`PVACP`}get isZigZag(){return this.model.study===`ZIGZAG`}get isLinRegChannel(){return this.model.study===`LINRCHN`}invalidateAssociatedAnnotations(e){this.isVolAP&&this.annotations[this.annIndex].invalidate(e)}onPriceDomainsUpdated(){this.invalidateAssociatedAnnotations(`PriceDomainsChanged`)}shouldPriceMap(e){return this.isJpi?this.shouldMaybePriceMap?e.id===G.JPIB.id||e.id===G.JPIS.id:!1:super.shouldPriceMap(e)}canPriceMap(e,t){if(!this.isJpi)return super.canPriceMap(e,t);this._canPriceMap=e>0}priceMap(e,t,n){if(!this.isJpi)return super.priceMap(e,t,n);if(t>this.visToIndex)return e;let r=(e,t)=>this.timeSeries.container.getData(e)[t],i=r(G.JPIB,t),a=r(G.JPIS,t);if(i===null&&n.id===G.JPIB.id||a===null&&n.id===G.JPIS.id)return null;let o=0,s=this.visFromIndex,c=this.timeSeries.helpers[0],l=this.timeSeries.helpers[2];for(;s<=t;){let e=r(l,s);o+=e===1?0:r(c,s),s++}return o}},Tj=[G.Open,G.High,G.Low,G.Close,G.Volume],Ej=class extends WO{_expression;exprModel=null;symbols=null;errorText;get title(){return this.expression}get expression(){return this._expression}async parseExpression(){let e=yd(this._expression);if(this.exprModel=null,this.symbols=null,vd(e))this.errorText=e.error;else{let{model:t,clean:n,symbols:r}=e;this.errorText=void 0,this.symbols=r,this.exprModel=t,this._expression=n}}get isValid(){return!P(this.errorText)}#e(e){return{mapper:e=>e.query.symbol,loadMoreData:!0,recompute:d.Minimum,missing:u.UseNext,stretch:e=>!1,fieldMap:new Map(Tj.map(e=>[e,e])),noDataApproach:f.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:e}}getTimeSeries(){let e=this.getInnerSeries(),t=this.axis?.pane.presenter.data?.exprSkipLeadingEmpty??!1,n=new tb(this.exprModel,e,this.#e(t));this.timeSeries=this.wrapIfAdvancedStyle(n);let r=this.title;this.timeSeries.ready().then(e=>{e||I(`Unable to calculate expression: ${r}`,`error`)})}getInnerSeries(){let e=wd(this.exprModel),t=$().getTimeSeriesDataSource();return e.map(e=>{let n=this.makeQuery();return n.symbol=e,t.getTimeSeries(n)})}getRecord(){if(P(this.errorText))return;let e=this.metaData.inner.map(e=>[e.symbol,e.resolved]);this.record=new tp(e,F(this.exprModel)),this.record.ready().then(e=>e)}getMetaData(){this.isValid&&(this.metaData=new Ka(this.symbols),this.metaData.ready().then(e=>{e&&(this.getRecord(),this.presenter?.notifyHost(K.MD_CHANGED,{plot:this}))}))}fromModel(e){super.fromModel(e),this._expression=e.expression}async initialize(){return da.call(this,async()=>(await this.parseExpression(),this.isShutDown?!1:(this.getMetaData(),this.getTimeSeries(),!0)))}},Dj=class extends WO{suffix;_forward;offset;errorText;fwdModel=null;outField;roots=null;symbols=[];get title(){return`${this.forward}${this.suffix}`}get forward(){return this._forward}fromModel(e){super.fromModel(e);let t=e;this.offset=t.offset,this._forward=t.forward}async parseForward(){let e=yd(this.forward),t=vd(e);if(t?(this.errorText=e.error,this.fwdModel=null,this._forward=e.text):(this.errorText=void 0,this.fwdModel=e.model,this._forward=e.clean),t)this.roots=null;else{this.offset>0?(this.suffix=` (${le($h(this.offset),Qh(B.FMT_US_DATE_ONLY))(new Date)})`,this.outField=new Ff(`Close_${this.offset}`,v.Number,b.Forward,`Close (${this.offset})`),this.curves[0].fields[0]=this.outField):(this.suffix=``,this.outField=G.Close);let{yes:t,no:n}=A(e.symbols,e=>Ei(`${e}*1`)),r=(await Promise.all(t.map(e=>Wi(e)))).map(e=>e.map(e=>e.name));this.roots=t.reduce((e,t,n)=>(e[t]=r[n],e),{}),this.symbols=n}}get isValid(){return!P(this.errorText)}getMetaData(){if(this.isValid){let e=Object.values(this.roots).flat();this.metaData=new Ka(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(K.MD_CHANGED,{plot:this})})}}getForwardPolicy(e){return{mapper:e=>e.query.root,loadMoreData:!1,recompute:d.Everything,missing:u.UseNext,stretch:e=>!1,fieldMap:new Map([[G.Close,this.outField]]),noDataApproach:f.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1,valueProvider:e}}getTimeSeries(){let e=$().getTimeSeriesDataSource(),t=Object.keys(this.roots),n=this.offset===0?w.Forward:w.HistoricalForward,r=t.map(t=>{let r={seriesKind:n,root:t,offset:this.offset,symbols:this.roots[t],getHashKey:()=>`${n}|${t}|${this.offset}`};return e.getTimeSeries(r)}),i=this.symbols.length>0?new C_(this.symbols):void 0;this.timeSeries=new tb(this.fwdModel,r,this.getForwardPolicy(i)),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:re.Unspecified};this.presenter?.notifyHost(K.TS_MANYCHANGED,e)}})}async initialize(){return da.call(this,async()=>(await this.parseForward(),this.isShutDown?!1:(this.getMetaData(),this.getTimeSeries(),!0)))}},Oj=e=>e.substring(0,e.lastIndexOf(`::`)),kj=class extends WO{isAverage;hasComputation;offset;offsets;_seasonal;symbolToOffset;errorText;seaModel=null;isPlain=!1;isFutures=!1;suffix=``;outField;symbols;coreModel;coreHasComputation;refSeasonal;get title(){if(this.isAverage){let e=`YB `;return this.offset<-1&&(e=`${Math.abs(this.offset)}y `),`${e}Average`}return!this.hasComputation&&(this.symbols?.length??0)>0?this.outField.name:`${this.seasonal}${this.suffix}`}get seasonal(){return this._seasonal}fromModel(e){super.fromModel(e);let t=e;this.offset=t.offset,this.offsets=t.offsets,this.isAverage=t.offset<0,this._seasonal=this.refSeasonal=t.seasonal}constructSeasonal(e,t){return Cd(Ed(e,e=>this.applyOffset(e,t)))}constructAverage(e,t=null){let n=t===null?null:t.map(e=>this.symbolToOffset[e]),r=n===null,i=this.offsets.filter(e=>r?!0:n.includes(e)).map(t=>`(${this.constructSeasonal(e,t)})`);return`(${i.join(`+`)})/${i.length}`}prepareFields(){let e=this.isPlain?`${this.yearFromOffset(this.offset)}`:`${this.offset}Y`,t=this.isAverage?`Avg`:e;this.suffix=this.offset===0?``:` (${t})`,this.outField=new Ff(`Close_${t}`,v.Number,b.Seasonal,`Close${this.suffix}`),this.curves[0].fields[0]=this.outField}applyOffset(e,t){return`${this.isPlain?e:Xi(e,-t)}::${t}`}createSymbolToOffsetMapping(e){this.symbolToOffset={},e.forEach(e=>{this.offsets.forEach(t=>{this.symbolToOffset[this.applyOffset(e,t)]=t})})}async parseSeasonal(){let e=yd(this.seasonal,!0),t=vd(e),n=e=>(this.errorText=e,this.seaModel=null,null);if(t)return n(e.error);let{model:r,symbols:i}=e;this.prepareFields();let a=new Map;for(let e of i){let t=Bi(await wi(e));a.set(e,t)}r=Ed(r,e=>a.get(e)),i=Array.from(a.values());let o=i.every(e=>Ei(e)||Oi(e)),s=i.every(e=>Ai(e)),c=i.every(e=>!Ei(e)&&!Ai(e)&&!Oi(e));if(!o&&!s&&!c)return n(`Mixed types of symbols aren't supported yet`);this.isPlain=c,this.isFutures=o,this.createSymbolToOffsetMapping(i),this.coreModel=this.isAverage?r:null,this.coreHasComputation=Td(r);let{model:l,symbols:u}=yd(this.isAverage?this.constructAverage(r):this.constructSeasonal(r,this.offset),!0);this.seaModel=l,this.hasComputation=Td(l),this._seasonal=Cd(Ed(l,Oj)),this.symbols=u,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!P(this.errorText)}getActualSymbols(){return[...new Set(this.symbols.map(Oj))]}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){let e=Oj(this.symbols[0]);if(this.isPlain)return`${e} ${new Date().getFullYear()-this.offset}`;if(this.isFutures)return Bi(e,!0)}return this.title}getMetaData(){if(this.isValid){let e=this.getActualSymbols(),t=e.length===1&&!this.hasComputation&&!this.isAverage,n=$().getMetaDataSource();this.metaData=t?n.getMetaData(e[0]):new Ka(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(K.MD_CHANGED,{plot:this})})}}getNoDataApproach(){return this.isAverage&&!this.coreHasComputation?f.ModelTransformRequired:this.hasComputation?f.NoAction:f.IgnoreTimelineOnly}get seasonalPolicy(){return{mapper:e=>e.query.surrogate||e.query.symbol,loadMoreData:!1,recompute:d.Everything,missing:this.hasComputation?u.UsePrevious:u.UseNone,stretch:e=>this.shouldStretch(e),fieldMap:new Map([[G.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(e,t)=>t.length===0?this.seaModel:yd(this.constructAverage(this.coreModel,e)).model,skipLeadingEmpty:!1}}shouldStretch(e){return this.symbolToOffset[e]===0&&(this.isAverage&&this.symbols.length>1||this.offset>0)}shiftYears(e){return En(new Date,-e)}yearFromOffset(e){return ni(this.shiftYears(e))}getCmdtyRange(e){let t=this.shiftYears(e);return[nr(t),tr(t)]}getSeasonalRange(e,t,n){let r=P(e[0],e[1]);return this.isPlain&&!r?this.getCmdtyRange(t):this.isFutures?n!=null&&(n.from!=null||n.to!=null)?[null,null]:[En(e[1]??new Date,-(t+B.SEASONAL_FUTURES_FETCH_YEARS)),null]:this.isPlain&&t>0&&r?e.map(e=>En(e,-t)):e}getTimeSeries(){if(!this.isValid)return;let e=$().getTimeSeriesDataSource(),t=Object.keys(this.symbolToOffset).map(t=>{let n=this.makeQuery();return n.surrogate=t,n.symbol=Oj(t),n.offset=this.symbolToOffset[t],n.cacheMe=!this.isPlain||n.offset===0,n.range=this.getSeasonalRange(n.range,n.offset,n.visibleRange),n.offset>0&&(n.disableStreamingUpdates=!0),e.getTimeSeries(n)}),n=new tb(this.seaModel,t,this.seasonalPolicy);n.seasonalAverageOffset=this.offset,this.timeSeries=n,this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:re.Unspecified};this.presenter?.notifyHost(K.TS_MANYCHANGED,e)}})}async initialize(){return da.call(this,async()=>(await this.parseSeasonal(),this.isShutDown?!1:(this.getMetaData(),this.getTimeSeries(),!0)))}},Aj=[`top`,`bottom`,`right`,`left`],jj={bottom:`center`,top:`center`,right:`start`,left:`end`},Mj=class{lineWidth;arrowLength;position;textAlign;fontSize;fontFamily;padding;strokeColor;textColor;backgroundColor;constructor(e){this.lineWidth=1,this.arrowLength=7,this.position=`bottom`,this.textAlign=`center`,this.fontSize=12,this.fontFamily=`Arial`,this.padding=4,this.strokeColor=`white`,this.textColor=`white`,this.backgroundColor=`black`,e&&this.configure(e)}configure(e){Object.assign(this,e)}draw(e,t,n,r,i,a){let o=P(i);if(a||=this.fontSize+this.padding+this.padding+(o?this.padding:0),!Aj.includes(this.position.toLowerCase())){I(`Can not draw indicator in position [${this.position}]`,`error`);return}e.font=`bold ${this.fontSize}px ${this.fontFamily}`,e.textAlign=jj[this.position],e.strokeStyle=this.strokeColor,e.fillStyle=uo(this.backgroundColor),e.lineWidth=this.lineWidth;let s=[r,i??``].map(t=>e.measureText(t).width),c=Math.max(...s),l=this.position===`bottom`||this.position===`top`,u=l?0:this.arrowLength,d=Math.round(c+u+this.padding+this.padding),f=Math.round(d/2),p=Math.round(a/2);e.setLineDash([]);let m=t;e.beginPath(),e.moveTo(m,n);let h=n+p,g=n+2*p,_=n-p;if(this.position===`right`){e.lineTo(m,h);let t=m+d;o&&(e.lineTo(m,g),e.lineTo(t,g)),e.lineTo(t,h),e.lineTo(t,_),e.lineTo(m,_)}else if(this.position===`left`){e.lineTo(m,h);let t=m-d;o&&(e.lineTo(m,g),e.lineTo(t,g)),e.lineTo(t,h),e.lineTo(t,_),e.lineTo(m,n-p)}else if(l){let t=this.position===`top`?n-a:n+a,r=m-f,i=m+f;e.lineTo(m,n),e.lineTo(i,n),e.lineTo(i,t),e.lineTo(r,t),e.lineTo(r,n),e.lineTo(m,n)}if(e.closePath(),e.stroke(),e.fill(),e.fillStyle=this.textColor,e.textBaseline=`middle`,l){let t=this.position===`top`?n-a:n;e.fillText(r,m,t+jo(e,1))}else if(this.position===`right`){let t=m+this.arrowLength+this.padding;e.fillText(r,t,n),o&&e.fillText(i,t,n+this.padding+p)}else if(this.position===`left`){let t=m-this.arrowLength-this.padding;e.fillText(r,t,n),o&&e.fillText(i,t,n+this.padding+p)}}},Nj=({y:e,halfHeight:t})=>e-t,Pj=({y:e,halfHeight:t})=>e+t;function Fj(e,t){e.forEach((e,n,r)=>{if(n===0&&e.y-e.halfHeight<t.y)e.y=t.y+e.halfHeight+1;else if(n>0){let i=r[n-1],a=Nj(e),o=Pj(i);a<o&&(e.y=o+1+e.halfHeight),Pj(e)>t.y+t.height&&(e.y=t.y+t.height-e.halfHeight-1)}})}var Ij=4,Lj=({x:e,halfWidth:t})=>e-t-Ij,Rj=({x:e,halfWidth:t})=>e+t+Ij,zj=(e,t)=>e-1-t-Ij,Bj=(e,t)=>e+1+t+Ij;function Vj(e,t){let n=e.length-1;e.forEach((e,r,i)=>{let a=r===0,o=a?null:i[r-1],s=Lj(e),c=a?t.x:Rj(o);if(e.x-e.halfWidth<t.x&&(e.x=Bj(t.x,e.halfWidth)),s<c)e.x=Bj(c,e.halfWidth+Ij);else{let t=Rj(e),a=r<n?Lj(i[r+1]):2**53-1;if(t>a){let n=zj(e.x,t-a),r=zj(e.x,e.halfWidth-2),i=Bj(c,o?.halfWidth??0);e.x=Math.max(r,n,i)}}Rj(e)>t.x+t.width&&(e.x=zj(t.x+t.width,e.halfWidth))})}var Hj=Array.from([,,,,,,],(e,t)=>++t).reverse(),Uj=`8`,Wj=/\d/g;function Gj(e){return e.replace(Wj,Uj)}function Kj(e,t){let n=e.timeSeries.container;if(n===null||n.size<1)return[null,-1];let r=n.getLastDataPoint(t),i=n.getData(t),a=i.length-1,o=e.type===C.Study&&[`JPI`,`CTTP`,`CTTI`].includes(e.model.study);return r==null&&!o&&(a=ve(i,e=>e!==null),r=a===-1?null:i[a]),[r,a]}function qj(e){let t=e.plot.timeSeries.container;return t===null||t.size<1?null:e.getColor(t.size-1)}function Jj(e){return e.curves.filter(t=>e.isVisible&&t.visible&&(e.type!==C.Study||t.style!==h.Ribbon)).map(t=>{let n=t.pickMainField(),[r,i]=Kj(e,n);return{value:r,color:qj(t),field:n,index:i}})}var Yj=class{pane;annotationUndoOwner={axis:this};annotations=[];id;isCustomDomain=!1;primary=!1;onTheRight=!0;viewBox;plots=[];comparison;scale;yScale;label=``;crosshairIndicator;ticks;lastUsedOptions;config;_fullDomain;constructor(e){this.pane=e,this.id=bt(),this.ticks=null,this.lastUsedOptions=null;let{chart:{fontSize:t},yAxis:{fontSize:n}}=this.pane.presenter.display,r=n||t||12;this.config={innerTickSize:7,tickPadding:5,indicatorPadding:4,fontWeight:400,fontSize:r},this.crosshairIndicator=new Mj({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}makePlot(e){let t=null;switch(C[e.type]){case C.Symbol:t=new GO;break;case C.Expression:t=new Ej;break;case C.Study:t=new wj;break;case C.IncomeStatement:t=new KO(w.IncomeStatement);break;case C.BalanceSheet:t=new KO(w.BalanceSheet);break;case C.Forward:t=new Dj;break;case C.Seasonal:t=new kj;break;default:throw Error(`${e.type} isn't supported yet`)}return t.axis=this,t.fromModel(e),t}toPrice(e){let t=this.yScale.yToPrice(e);return this.comparison===x.None?t:this.pane.presenter.mainPlot.priceMap(t,void 0,G.Close,!0)}toTime(e){return this.pane.presenter.view.toTime(e)}toAnnotationPoint(e){let t=this.toPrice(e.y),n=this.toTime(e.x);return new QO(this,t,n||void 0)}toX(e){return this.pane.presenter.view.toX(e)}priceMap(e){return this.comparison===x.None?e:this.pane.presenter.mainPlot.priceMap(e,void 0,G.Close)}toY(e){let t=this.priceMap(e);return this.yScale.priceToY(t)}get plotAnnotations(){let e=[];return this.plots.forEach(t=>{t.isVisible&&t.annotations&&e.push(...t.annotations)}),e}annTimeToX(e){return this.pane.presenter.view.xAxis?.annTimeToX(e)}snapTo(e){let t={x:this.annTimeToX(e.time),y:this.toY(e.price)},n=this.pane.presenter,r=n.activeTool,i=r.annotation;return r.alignPointsMode&&i&&i.alignPointsSupported&&i.points.includes(e)?this.alignPoints(i,e,t):r.snapToSupported&&n.display.yAxis.snapAnnotationsToPrices&&!e.passive&&(e.moveDirection===te.Both||e.moveDirection===te.Vertical)&&this.snapToPrices(e,t),t}snapToPrices(e,t){let n=this.plots.find(e=>e.main);if(n&&n.timeSeries&&n.timeSeries.hasData){let r=n.timeSeries.container,i=Te(r.getTimeData(),+e.time,Number),a=[].concat(...n.curves.map(e=>e.fields)).filter(e=>r.hasField(e)).map(e=>{let n=r.getData(e)[i],a=this.toY(n);return{priceSnap:n,ySnap:a,dist:Math.abs(a-t.y)}}).filter(e=>e.dist<=B.SNAP_PROXIMITY_PIXELS).reduce((e,t)=>e===null||t.dist<e.dist?t:e,null);P(a)&&(e.price=a.priceSnap,t.y=a.ySnap,e.time=r.getTimeData()[i],t.x=this.toX(e.time))}}alignPoints(e,t,n){let r=e.points.find(e=>e!==t);if(t!==r&&r&&r.point){let e=r.point,i=(360+-so(e,n)*180/Math.PI)%360,a=45/2,o=i>360-a||i<a||i>180-a&&i<202.5,s=i>90-a&&i<112.5||i>270-a&&i<292.5;if(o)n.y=e.y,t.price=this.toPrice(n.y);else if(s)n.x=e.x,t.time=this.toTime(n.x);else{let r=Math.abs(n.x-e.x),i=e.y>n.y?-1:1;n.y=e.y+r*i,t.price=this.toPrice(n.y)}}}toPoint(e){if(P(this.pane.presenter.view))return this.snapTo(e)}makeAnnotation(e,t=!0){let n=gj(e.id,!0,e.traits)(this,!1);t&&e.uid&&(n.uid=e.uid);let r=n.activePoints,i=e.points.length-r.length;return i>0&&n.addPoints(i),n.activePoints.forEach((t,n)=>{let r=e.points[n];Ze(r.price)&&Ze(r.time)&&t.update(r.price,r.time)}),n.visible=e.visible,n.locked=e.locked,n}expand(e){let t=[];switch(e.type){case`Forward`:{let n=e.curves,r=e.offsets;delete e.curves,delete e.offsets;for(let i=0;i<n.length;i++){let a=Object.assign({},e);a.curves=[n[i]],a.offset=r[i],t.push(a)}break}case`Seasonal`:{let n=e.curves,r=e.offsets;delete e.curves,delete e.offsets;let i=r.filter(e=>e>=0);for(let a=0;a<n.length;a++){let o=Object.assign({},e);o.curves=[n[a]],o.offset=r[a];let s=o.offset<0;s?o.offsets=o.offset===-1?i:De(Math.abs(o.offset),e=>e+1):o.offsets=[o.offset],(!s||o.offsets.length>1)&&t.push(o)}break}default:t.push(e)}return t}fromModel(e){this.comparison=x[e.comparison??`None`],this.scale=S[e.scale??`Linear`],this.yScale=new TO(this.scale,this),this.label=e.label,this.plots=[].concat(...e.plots.map(e=>this.expand(e))).map(e=>this.makePlot(e));let t=e.annotations||[];this.annotations=t.map(e=>this.makeAnnotation(e));let{chart:{fontFamily:n,backgroundColor:r},yAxis:{textColor:i,crosshair:{color:a},primaryOnTheLeft:o}}=this.pane.presenter.display,s=o??!1;this.onTheRight=this.primary&&!s||!this.primary&&s,this.crosshairIndicator.configure({position:this.onTheRight?`right`:`left`,fontFamily:n,strokeColor:a,textColor:i,backgroundColor:_o(.15)(r)})}findIndex(e){return this.annotations.findIndex(t=>t.uid===e.uid)}addAnnotation(e){let t=this.makeAnnotation(e,!0);if(this.appendAnnotation(t),e.isUndoRedo&&e.position!==void 0){this.annotations.splice(this.findIndex(t),1);let n=xt(0,this.annotations.length,e.position);this.annotations.splice(n,0,t)}t.requestRedraw(),this.fireAnnotationsChanged()}appendAnnotation(e){this.findIndex(e)===-1&&this.annotations.push(e)}fireAnnotationsChanged(e=!1){this.pane.presenter.onAnnotationsUpdated(this,e)}deleteAnnotation(e,t=!0){e.isSelected&&this.pane.presenter.clearSelection();let n=this.findIndex(e);n!==-1&&this.annotations.splice(n,1),t&&this.fireAnnotationsChanged(!e.isSelected)}fliphorizontalAnnotation(e){e.flip(!0),this.fireAnnotationsChanged(!0)}flipverticalAnnotation(e){e.flip(!1),this.fireAnnotationsChanged(!0)}duplicateAnnotation(e){let t=e.axis,n=this.makeAnnotation(e.toModel(),!1);n.drawPoints(null,!0),n.offset({x:B.ANN_DUPLICATE_OFFSET,y:B.ANN_DUPLICATE_OFFSET}),t.appendAnnotation(n),n.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(e,t){e.isSelected&&!this.pane.presenter.annotationManipulation&&this.pane.presenter.clearSelection(),El(e.name,t.traits),e.updateFrom(t.traits,t.extras,t.isUndoRedo?null:t.points,t.visible,t.locked),t.isUndoRedo&&P(t.points)&&e.updateActivePoints(t.points),e.isSelected&&!e.isVisible&&this.pane.presenter.clearSelection(),t.isUndoRedo||this.pane.presenter.undoRedoManager.done(ek(e,O.Moved)),e.requestRedraw(),this.fireAnnotationsChanged()}setViewBox(e){this.viewBox=e;let{y:t,height:n}=this.viewBox;this.yScale.range([Math.floor(t),Math.floor(t+n)]),this.plots.forEach(t=>t.setViewBox(e))}get fullDomain(){return P(this._fullDomain)||(this._fullDomain=this.getDataDomain().domain),this._fullDomain}updateFullDomain(e=null){if(e===null&&this.comparison!==x.None)return;let t=this.fullDomain;this._fullDomain=this.getDataDomain([e,e],t).domain}getPlotDataDomain(e,t,n){let r=e.timeSeries;if(!r.hasData)return{domain:null};let i=r.container,a=i.getTimeData(),o=e=>Te(a,+e,Number),s=P(t),c=s?o(t):0,l=P(n),u=l?o(n):a.length-1,d=e.curves.map(e=>e.fields).flat().filter(e=>e.id!==G.Change.id),f=P(e.targetFields);f&&d.push(...e.targetFields);let p={},m=t=>{let n=f?e.curves[0]:e.curves.find(e=>e.fields.includes(t));if(!P(n)||n.shift===0)return[c,u];if(!P(p[n.id])){let e=n.shiftedTimeDomain;if(!P(e))return[c,u];p[n.id]=[o(e[0]),o(e[1])]}return p[n.id]},g=t=>{let[n,r]=m(t),a=i.getData(t),o=Math.max(n,0),s=Math.min(a.length-1,r);return a.slice(o,s+1).map((n,r)=>e.priceMapper(n,r,t))},_=e=>Ee(g(e)),v=[null,null],y=e=>e.id,b=new Set(be(i.fields,d,y).map(y));e.curves.filter(e=>e.visible).map(e=>{let t=e.fields.filter(e=>b.has(e.id));e.isStackedColumn?M(Ee(t.map(e=>g(e)).reduce((e,t)=>t.map((t,n)=>(e[n]||0)+(t||0)),[])),v):t.map(e=>{M(_(e),v)})});let x=(e.annotations||[]).filter(e=>e.isVisible).flatMap(e=>{let t=e.getDomainPrices;return typeof t==`function`?t.call(e):[]}).filter(e=>Ze(e));x.length>0&&M(Ee(x),v);let S=oe.None,C=[h.Column,h.MultiColumn,h.StackedColumn];if(s&&l&&!e.main&&e.curves.some(e=>C.includes(e.style))){let e=v[0]>0,t=v[1]<0;e?(S=oe.Min,v[0]=0):t&&(S=oe.Max,v[1]=0)}return{domain:v,clamped:S}}getDataDomain([e,t]=[null,null],n=[null,null]){let r=F(n),i=!1;for(let n of this.plots.filter(e=>e.isVisible&&e.hasVisibleCurves&&!e.hasDetachedScale)){let{domain:a,clamped:o}=this.getPlotDataDomain(n,e,t);P(a)&&(M(a,r),i||=o!==oe.None)}if(!P(r))return{domain:null};let[a,o]=r;if(!P(a,o))return{domain:null};let s=[Number(a),Number(o)];s[0]===s[1]&&(--s[0],s[1]+=1);let c=oe.None;return i&&(s[0]===0?c=oe.Min:s[1]===0&&(c=oe.Max)),{domain:s,clamped:c}}setDomain(){let e=this.pane.presenter,t=e.view.xAxis.xScale.domain();if(!P(t))return;for(let e of this.plots.filter(e=>e.isVisible&&e.hasVisibleCurves&&e.hasDetachedScale)){let{domain:n}=this.getPlotDataDomain(e,t[0],t[1]);P(n)&&e.yScale.domain(n)}if(this.isCustomDomain)return;let{domain:n,clamped:r}=this.getDataDomain(t);if(this===e.mainAxis&&e.mainPlot?.showPrevious){let t=e.mainPlot.getPreviousValue(),r=rt(e.display,!1,`chart`,`previous`,`forceVisible`);P(t,n)&&r&&(n[0]=Math.min(n[0],t),n[1]=Math.max(n[1],t))}if(this.yScale.domain(n),P(n)){let e=this.getPadding(r);P(e)&&this.yScale.padding(e)}}getInitialPadding(){let e=$i(this.pane.presenter.hostElement),t=na(`#${B.HEADER_SIZE_PLACEHOLDER_ID}`,e);if(!P(t)){t=sa(e,`div`),ra(t,{display:`none`}),ia(t,{id:B.HEADER_SIZE_PLACEHOLDER_ID,class:`bcharts-card bcharts-card-first`});let{lineHeight:n}=getComputedStyle(t);isNaN(Number.parseFloat(n))&&ra(t,{lineHeight:`120%`})}let{paddingTop:n,paddingBottom:r,marginTop:i,lineHeight:a}=getComputedStyle(t),o=this.pane.isMain?i:`0`;return this.pane.presenter.display.tooltip.mode===`cards`?[n,r,o,a].map(Number.parseFloat).reduce((e,t)=>e+t,0)+B.CARDS_Y_OFFSET:Number.parseFloat(o)}getPadding(e){let t=this.pane.presenter,n=this.viewBox?.height;if(n==null)return[0,0];let r=t.display,i=rt(r,null,`yAxis`,`minPaddingPercent`),a=rt(r,null,`yAxis`,`maxPaddingPercent`),o=P(i),s=P(a),c=o||s?0:this.getInitialPadding(),l=o?i:B.PANE_CAP_MIN_PADDING_PERCENT,u=s?a:B.PANE_CAP_MAX_PADDING_PERCENT,d=l*n,f=[s?u*n:Math.max(d,Math.min(u*n,c)),d];e===oe.Max?f[0]=B.PANE_TINY_PADDING_PIXELS:e===oe.Min&&(f[1]=B.PANE_TINY_PADDING_PIXELS);let p=t.mainPlot;return p&&p.hasEvents&&t.view&&(f[0]+=3*t.view.getEventRadius()),f}clearTicks(){this.ticks=null}getTicks(e,t=0){let{height:n}=this.viewBox,r=jo(e,1.3),i={height:n,approxLineHeight:r,domain:this.yScale.domain()};if(P(this.ticks)&&P(i.domain)&&P(this.lastUsedOptions)&&P(this.lastUsedOptions.domain)&&i.height===this.lastUsedOptions.height&&i.approxLineHeight===this.lastUsedOptions.approxLineHeight&&i.domain[0]===this.lastUsedOptions.domain[0]&&i.domain[1]===this.lastUsedOptions.domain[1])return this.ticks;this.lastUsedOptions=i;let a=Math.floor((n+40)/(r+40)),o=this.yScale.getTicks(a),s=rt($().config,null,`overrides`,`yAxis`,`tickProvider`);if(P(s)&&typeof s==`function`&&i.height>0&&P(i.domain)){let e=F(i);e.autoTicks=F(o),o=s(e)}let{innerTickSize:c,tickPadding:l,fontSize:u}=this.config,d=null,f=this.yScale?.checkTicks(),p=f?40/4*3:40;return this.ticks=o.map(n=>{let r=Math.round(this.yScale.priceToY(n)),i=Math.abs(r-(d??r));if(f&&d!==null&&i<p)return null;d=r;let a=rv(this,n),o=e.measureText(a).width,s={x1:0,x2:0,y1:r,y2:r,dy:0,label:a,labelX:0,labelY:r+u*.32};return this.onTheRight?(s.x1=t,s.x2=s.x1+c,s.labelX=s.x2+o+l):(s.x1=t-c,s.x2=s.x1+c,s.labelX=s.x1-l),s}).filter(e=>e!==null),this.ticks}widthNeeded(e){if(!P(this.fullDomain))return B.DEFAULT_PRICE_AXIS_WIDTH;e.save();let{fontWeight:t,fontSize:n}=this.config,{chart:{fontFamily:r}}=this.pane.presenter.display;e.font=`${t} ${n}px ${r}`;let i=Math.max(...this.fullDomain.map(t=>e.measureText(Gj(rv(this,t,!0))).width)),{innerTickSize:a,tickPadding:o}=this.config,s=P(this.label)?jo(e,1.6):0,c=i+a+2*o+s;return e.restore(),c}draw(e){let{chart:{fontFamily:t},yAxis:{gridLines:n,textColor:r,visible:i}}=this.pane.presenter.display;if(!i||!this.viewBox)return;e.save();let{x:a,y:o,width:s,height:c}=this.viewBox,{fontWeight:l,fontSize:u}=this.config;if(To(e,this.viewBox),e.font=`${l} ${u}px ${t}`,e.lineWidth=2,e.strokeStyle=n.color,e.textAlign=`end`,P(this.label)){e.save(),e.fillStyle=go(.4)(r),e.translate(0,0);let t=this.onTheRight?1:-1;e.rotate(t*Math.PI/2),e.textAlign=`center`;let n=jo(e),i=t*(o+c/2);this.onTheRight?e.fillText(this.label,i,-(a+s-n)):e.fillText(this.label,i,a+n),e.restore()}let d=this.onTheRight?a:s;e.setLineDash([]),Bo(e,d,o,o+c);let f=this.getTicks(e,d);this.drawTicks(e,f,r),this.drawPriceAdornments(e),e.restore()}drawTicks(e,t,n){t&&(e.fillStyle=n,t.forEach(t=>{e.fillText(t.label,t.labelX,t.labelY+t.dy)}))}drawCrosshairIndicator(e,t){if(!this.plots.some(e=>e.isVisible&&e.hasVisibleCurves)||!this.pane.presenter.display.yAxis.crosshair.enabled||!Number.isFinite(t)||!this.yScale)return;let n=this.onTheRight?this.viewBox.x:this.viewBox.width,r=this.yScale.yToPrice(t);if(r==null)return;let i=rv(this,r);this.crosshairIndicator.draw(e,n,t,i)}get indicatorHeight(){return this.config.fontSize+this.config.indicatorPadding+this.config.indicatorPadding}drawPriceAdornments(e){let t=this.pane.presenter,{chart:{fontFamily:n,previous:r},yAxis:{showLastValue:i,preventLabelOverlap:a,includePercentChangeWithLastValue:o}}=t.display,s=t.view,c=[],l=(e,t,n,r,i,a)=>{if(t!=null){let s=t;t=e.priceMapper(t,a,i);let l,u=e.is(C.Symbol)||e.is(C.Expression);if(o&&u){let t=e.axis.comparison===x.Percent?x.None:x.Percent;l=e.priceMapper(s,a,i,t)}let d=e.hasDetachedScale?e.metaData.format(t,i):void 0,f=P(l)?1:2;c.push({y:e.priceToY(t),formattedValue:d,value:t,auxValue:l,color:n,halfHeight:Math.round(this.indicatorHeight/f),priority:r})}};this.plots.forEach(e=>{if(!(!e.isVisible||!e.hasVisibleCurves||!e.timeSeries||!e.timeSeries.hasData)){if(i===`All`||i===`Main`&&e.main){let t=e.main?1:3;Jj(e).filter(e=>e.value!=null&&e.index!==-1).forEach(n=>l(e,n.value,n.color,t,n.field,n.index))}e.showPrevious&&l(e,e.getPreviousValue(),r.color,2,G.PreviousClose,void 0)}}),this.annotations.concat(this.plotAnnotations).filter(e=>e.isVisible).forEach(e=>{c.push(...e.getPriceScaleAdornments().map(e=>({y:this.toY(e.price),value:this.priceMap(e.price),color:e.color,halfHeight:Math.round(this.indicatorHeight/2),priority:4})))}),c.sort((e,t)=>e.y-t.y),a&&Fj(c,this.viewBox);let u=({y:t,value:r,formattedValue:i,color:a,auxValue:o})=>{let{leftOffset:c,rightOffset:l}=s,u=this.onTheRight?this.pane.viewBox.width-l:c,d=xo(a),f=new Mj({position:this.onTheRight?`right`:`left`,fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:n,textColor:d,strokeColor:a,backgroundColor:a}),p=i||rv(this,r),m,h=this.comparison===x.Percent;N(o)&&(m=h?nv(this,o):tv(o)),f.draw(e,u,t,p,m)};a?c.forEach(u):Hj.forEach(e=>c.filter(t=>t.priority===e).forEach(u))}};function Xj(e){let t=e.map(e=>e.plots).flat().filter(e=>C[e.type]==C.Symbol).map(e=>e.symbol).map(e=>Ki(e)).filter(e=>e!==null).map(e=>e.getFullYear());return t.length==0?null:Math.max(...t)}var Zj=Symbol.for(`__dloacip__`),Qj=class{presenter;id;axes=[];height=0;alignedToYear=null;viewBox;constructor(e){this.presenter=e,this.id=bt()}fromModel(e){this.height=e.height,e.alignOnExpirations===!0&&(this.alignedToYear=Xj(e.axes)),this.axes=e.axes.map((e,t)=>{let n=new Yj(this);return n.primary=t===0,n.fromModel(e),n},this)}getBounds(){return this.viewBox}setViewBox(e){this.viewBox=e}drawBackground(e){P(this.viewBox)&&(this.drawAxes(e),e.save(),this.clipToNoScales(e),this.drawGrid(e),e.restore())}draw(e){P(this.viewBox)&&(e.save(),this.clipToNoScales(e),this.drawPrevious(e),this.drawPlots(e),this.drawAnnotations(e),this.drawLogo(e),e.restore())}drawLogo(e){!this.isMain||this.presenter[Zj]===!1||Vk(e,this.getBoundsWithoutScales())}drawAxes(e){for(let t of this.axes)t.draw(e)}drawPrevious(e){let t=this.presenter.mainPlot;if(t.showPrevious&&this.isMain){let n=t.getPreviousValue();if(n=t.priceMapper(n,void 0,G.PreviousClose),n!=null){let{leftOffset:r,rightOffset:i}=this.presenter.view,a=r,o=this.viewBox.width-i,s=t.axis.yScale.priceToY(n),{color:c,dashStyle:l,lineWidth:u}=this.presenter.display.chart.previous,d=lo(l);e.save(),e.strokeStyle=c,e.lineWidth=u,e.setLineDash(d),Vo(e,s,a,o),e.restore()}}}getBoundsWithoutScales(){let e=this.viewBox.duplicate(),t=this.presenter.view;return e.x=t.leftOffset,e.width-=t.leftOffset+t.rightOffset,e}clipToNoScales(e){To(e,this.getBoundsWithoutScales())}drawAnnotations(e){e.save();try{let{chart:{fontFamily:t},yAxis:{fontSize:n}}=this.presenter.display;e.font=`${n??12}px ${t}`;let r=this.presenter.annotationPreviewUid,i=this.axes.flatMap(e=>e.annotations).find(e=>e.uid===r&&e.isVisible&&!e.computed),a=e=>i!==void 0&&e!==i,o=(t,n)=>{e.save();try{n&&(e.globalAlpha*=B.PLOT_HOVER_DIM_ALPHA),t.draw(e,!0)}finally{e.restore()}};this.axes.forEach(e=>{e.annotations.filter(e=>e.isVisible).forEach(e=>o(e,a(e))),e.plotAnnotations.filter(e=>e.isVisible).forEach(e=>o(e,!1))});let s=this.presenter.selectedAnnotation;this.presenter.annotationManipulation&&s?.axis.pane===this&&s.isVisible&&s.drawPoints(e,!1)}catch(e){throw this.presenter.setAnnotationPreview(),e}finally{e.restore()}}drawGrid(e){let{chart:{fontFamily:t},yAxis:{gridLines:n,visible:r,minorGridLines:i}}=this.presenter.display;if(!r||!n.visible)return;let{lineWidth:a,color:o,dashStyle:s}=n;e.save();let c=!(e=>e.plots.some(e=>e.isVisible&&e.hasVisibleCurves&&!e.hasDetachedScale))(this.axes[0])&&this.axes.length>1,l=this.axes[+!!c],{fontWeight:u,fontSize:d}=l.config;e.font=`${u} ${d}px ${t}`;let f=l.getTicks(e),{leftOffset:p,rightOffset:m}=this.presenter.view,h=p,g=this.viewBox.width-m,_=(t,n,r)=>{e.lineWidth=t,e.strokeStyle=n,e.setLineDash(lo(r)),e.beginPath()};if(_(a,o,s),f.forEach(t=>{e.moveTo(h,t.y1),e.lineTo(g,t.y2)}),e.stroke(),i&&i.visible&&f.length>=2){let{lineWidth:t,color:n,dashStyle:r}=i,a=(f[0].y1-f[1].y1)/5;_(t,n,r),f.forEach(t=>{for(let n=1;n<5;n++){let r=Math.ceil(t.y1+n*a);e.moveTo(h,r),e.lineTo(g,r)}}),e.stroke()}e.restore()}drawYCrosshair(e,t){let{yAxis:{crosshair:{enabled:n,showValue:r,color:i,dashStyle:a}}}=this.presenter.display;if(!n)return;let o=lo(a);e.strokeStyle=i,e.setLineDash(o);let s=this.presenter.view.leftOffset,c=this.viewBox.width-this.presenter.view.rightOffset,l=is();l.prolog(e),Vo(e,l.adjust(t.y),l.adjust(s),l.adjust(c)),l.epilog(e),r&&this.axes.forEach(n=>{n.drawCrosshairIndicator(e,t.y)})}drawNoData(e){e.save(),e.font=`800 14px ${this.presenter.display.chart.fontFamily}`,e.fillStyle=`#f00`,Fo(e,$().config.noDataText||B.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},T.Center),e.restore()}get isMain(){let e=this.presenter.mainPlot;return this.axes.some(t=>t.plots.includes(e))}drawPlots(e){e.save();let t=this.presenter.mainPlot,n=this.presenter.display.chart.showNoDataText,r=!P(n)||n,i=t=>t.draw(e),a=new Map,o=t=>t.drawEventsTopmost(e,a),s=!0,c=n=>{for(let e of this.axes){for(let r of e.plots){let e=r.isEmpty();s=s&&r.main&&e,r!==t&&!e&&n(r)}e.plots.includes(t)&&!t.isEmpty()&&n(t)}r&&s&&this.drawNoData(e)};c(i),c(o),e.restore()}};function $j(e,t){return{width:e,spacing:t,get totalWidth(){return this.width+this.spacing},offset:0}}var eM=class extends _O{timeline;aggregation;marginBars;bar;resetBar;wasZoomed;fitAllData;constructor(e,t){super(),this.timeline=e,this.aggregation=t;let n=e.presenter.display;this.marginBars=n.xAxis.marginBars||0,this.bar=$j(rt(n,B.DEFAULT_BAR_WIDTH,`chart`,`bar`,`width`),rt(n,B.DEFAULT_BAR_SPACING,`chart`,`bar`,`spacing`)),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}extent(e){return gO.call(this,`_extent`,e)}get presenter(){return this.timeline.presenter}get display(){return this.presenter.display}scaleBarToFit(){if(this.wasZoomed)return;if(this.fitAllData)return this._domain=null,this.scaleBarToFitDensity(this.timeline.withoutPrologEpilogLength);let e=this.display.xAxis.visibleRange;if(P(e))return this.scaleBarToFitRange([e.from,e.to]);let t=this.display.density;if(Number.isFinite(t))return this.scaleBarToFitDensity(t);let n=this.display.period;if(n===B.YTD_PERIOD)return this.scaleBarToFitYtd();if(Number.isFinite(n))return this.scaleBarToFitPeriod(n)}deriveExtentsFromBarWidth(e){if(!P(this._range)||this.timeline.length===0)return null;let t=this._range[1]-this._range[0],n=t/e.totalWidth,r=Math.ceil(n);e.offset=t-r*e.totalWidth;let i=this.timeline.lastSeriesIndex+this.marginBars,a=this._domain&&this._domain[1];return a&&(i=Te(this.timeline,+a,Number,dv)),[i-r+1,i]}adjustDomain(){if(!P(this._range))return;this.scaleBarToFit();let e=this.deriveExtentsFromBarWidth(this.bar);if(P(e))this.extent(e);else return;this.setDomainFromExtent()}xToTime(e){if(!this.ready)return null;let t=this.xToIndex(e);return this.timeline.at(t)}xToIndex(e){if(!this.ready)return null;let t=e-this._range[0]-this.bar.offset,n=Math.floor(t/this.bar.totalWidth);return this._extent[0]+n}timeToIndex(e){return this.ready?(e=typeof e==`number`?e:+e,Te(this.timeline,e,Number,dv)):null}indexToX(e){let t=e-this._extent[0];return this.bar.width/2+this.range()[0]+this.bar.offset+t*this.bar.totalWidth}timeToX(e){if(!this.ready)return null;let t=this.timeToIndex(e);return this.indexToX(t)}zoom(e){let t=e,n=t*this.bar.width/100,r=this.bar.width-n,i=this.bar.spacing-t*this.bar.spacing/100;if(r>B.MAXIMUM_BAR_WIDTH||r<B.MINIMUM_BAR_WIDTH)return!1;let a=$j(r,i),o=this.deriveExtentsFromBarWidth(a);return this.isUsableExtent(o)?(this.setBar(r,i),this.adjustDomain(),this.wasZoomed=!0,!0):!1}scaleBarToFitRange(e,t=!0){let n=(e,t,n,r)=>P(e)?Te(this.timeline,e,Number,dv,n,r):t,{from:r,to:i}=this.presenter.data.range||{},a=+e[0]===r&&+e[1]===i,{firstSeriesIndex:o,lastSeriesIndex:s}=this.timeline,c=a?o:void 0,l=a?s:void 0,u=[n(e[0],o,c,l),n(e[1],s,c,l)];this.timeline.at(u[1])>e[1]&&(u[1]=Math.max(0,u[1]-1));let d=u[1]-u[0]+1,f=t?this.marginBars:0;u[1]+=f,this.extent(u),this.setDomainFromExtent(),this.scaleBarToFitDensity(d,t)}scaleBarToFitDensity(e,t=!0){let n=Math.max(B.MINIMUM_BARS_VISIBLE,e),r=t&&this.display.xAxis.marginBars||0,i=(this._range[1]-this._range[0])/(n+r);this.setBar(2/3*i,1/3*i,!1)}scaleBarToFitYtd(){let e=this.timeline.at(this.timeline.lastSeriesIndex);e&&this.scaleBarToFitRange([nr(e),e])}scaleBarToFitPeriod(e){let t=this.timeline.lastSeriesIndex,n=this.timeline.at(t),r=n,i=t,a=this.presenter.data.aggregation;if(a.isEndOfDay||a.isIntraday&&e>=B.INTRA_THRESHOLD)for(;i>0&&Bn(n,r)<e;)i--,r=this.timeline.at(i);else if(!a.isTick){let t=Math.floor(e/B.ONE_DAY_MILLIS),r=e=>Gn(e,vn(e)),a=r(n),o=n;for(;i>0;){let e=this.timeline.at(i),n=Nn(e,o);if(t===0){if(r(e)<=a||!n)break}else n||(t--,o=e);i--}}this.scaleBarToFitDensity(t-i+1)}setBar(e,t,n=!0){let[r,i]=yt(e,t,B.MINIMUM_BAR_WIDTH,B.MAXIMUM_BAR_WIDTH);this.bar.width=r,this.bar.spacing=i,this.wasZoomed||(this.resetBar={width:r,spacing:i}),n&&(this.presenter.model.display.chart.bar={width:e,spacing:t})}resetZoom(){P(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=B.DEFAULT_BAR_WIDTH,this.bar.spacing=B.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(e){return P(e)&&P(e[0],e[1])&&e[0]>=0&&e[1]<this.timeline.withPrologEpilogLength&&e[1]-e[0]>=B.MINIMUM_BARS_VISIBLE}shiftBars(e,t=null){if(!this._extent)return;let n=this._extent.map(t=>t+e);this.isUsableExtent(n)&&(P(t)&&(this.bar.offset=t),this.extent(n),this.setDomainFromExtent())}setDomainFromExtent(){this.domain(this.extent().map(e=>this.timeline.at(e)))}pan(e){if(!Number.isFinite(e)||e===0)return;let t=e%this.bar.totalWidth,n=this.bar.offset+t,r=Math.sign(e),i=-(e<0?Math.ceil:Math.floor)(e/this.bar.totalWidth);(n>this.bar.totalWidth||n<-this.bar.totalWidth)&&(i+=n>0?-1:1,n-=r*this.bar.totalWidth),this.shiftBars(i,n)}getSeriesThatCouldLoadMoreData(){let e=this.domain();if(!P(e)||!P(e[0]))return[];let t=e[0].getTime();return this.timeline.presenter.allPlots.map(e=>e.timeSeries).filter(e=>{if(!P(e)||!e.hasData||e.container.size===0||e.canLoadMoreData!==!0)return!1;let n=e.container.getTimeData()[0];return P(n)&&t<=n.getTime()})}};function tM(e){return{date:e,priority:1,text:ev(e)}}var nM=class{view;xScale;ticks;lastUsedOptions;wasPanned;panningXAxisAllowed;config;isVisible;crosshairIndicator;contentBounds;axisStrips=[];overrideTickGetter;overrideFormatter;contractParityCache=null;contractParityCacheKey=null;constructor(e){this.view=e,this.xScale=new eM(e.presenter.timeline,e.presenter.data.aggregation),this.ticks=null,this.lastUsedOptions=null,this.wasPanned=!1,this.panningXAxisAllowed=rt(e.presenter.display,!0,`xAxis`,`panning`),this.updateConfigFromModel();let t=e.presenter.renderTo.id,n=rt($().config,null,`overrides`,`xAxis`,`tickProvider`);P(n)&&typeof n==`function`&&(this.overrideTickGetter=se(n,t));let r=rt($().config,null,`overrides`,`xAxis`,`formatter`);P(r)&&typeof r==`function`&&(this.overrideFormatter=se(r,t))}updateConfigFromModel(){let{chart:{fontFamily:e,backgroundColor:t,fontSize:n},xAxis:{textColor:r,visible:i,fontSize:a,crosshair:{color:o}}}=this.view.presenter.display,s=a||n||12;this.config={innerTickSize:5,tickPadding:5,indicatorPadding:5,fontWeight:400,fontSize:s},this.isVisible=i,this.crosshairIndicator=new Mj({position:`bottom`,fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:o,textColor:r,backgroundColor:_o(.15)(t),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();let e=this.view.presenter.display.period===B.FIFTY_YEARS_MILLIS;P(this.xScale.extent())&&!e&&this.checkForMoreData()}zoom(e){let t=this.xScale.zoom(e);return this.checkForMoreData(),t}checkForMoreData(){this.xScale.getSeriesThatCouldLoadMoreData().forEach(e=>e.loadMoreData())}shouldScrollIntoView(e){let t=this.xScale.extent();return P(t)?e-this.xScale.timeline.lastSeriesIndex>=0&&e-t[1]<=1:!1}pan(e){this.panningXAxisAllowed&&(this.xScale.pan(e),this.checkForMoreData(),this.view.setPriceAxesDomains(),this.wasPanned=!0)}get wasVisibleRangeChanged(){return this.wasPanned||this.xScale.wasZoomed}resetZoom(){this.xScale.resetZoom()}get barsToLast(){let e=this.xScale.timeline.lastSeriesIndex+this.getMaxCurveOffset(),t=this.xScale.extent();return e-(t?t[1]:e)}canGoToLast(){return this.barsToLast>0}getMaxCurveOffset(){return Math.max(...this.view.presenter.allCurves.map(e=>e.shift))}goToLatest(e=!1){if(this.canGoToLast()||e){let e=this.barsToLast===0?0:this.barsToLast+this.xScale.marginBars+1;this.xScale.shiftBars(e),this.view.setPriceAxesDomains(),this.view.redraw()}}get position(){return this.view.presenter.display.xAxis.position??`bottom`}setViewBox(e,t,n){this.contentBounds=e;let{x:r,y:i,width:a,height:o}=e;this.xScale.range([r,r+a]),this.axisStrips=[],t>0&&this.axisStrips.push({position:`top`,bounds:new Eo(r,i-t,a,t),baseline:i}),n>0&&this.axisStrips.push({position:`bottom`,bounds:new Eo(r,i+o,a,n),baseline:i+o})}contains(e){return this.axisStrips.some(t=>t.bounds.contains(e))}heightNeeded(e){if(!this.isVisible)return 0;let t=this.view.presenter.display.chart.fontFamily,{fontWeight:n,fontSize:r}=this.config;e.save(),e.font=`${n} ${r}px ${t}`;let{innerTickSize:i,tickPadding:a,indicatorPadding:o}=this.config,s=jo(e,1)+i+a+o;return e.restore(),s}getTickGetter(e){if(this.overrideTickGetter)return this.overrideTickGetter;let t=this.view.presenter.display.xAxis.isOrdinal||!1,n=L_(e);return t?tM:e=>n.getTick(e)}getTicks(e){if(P(this.lastUsedOptions)&&((e,t)=>e.unit===t.unit&&e.size===t.size&&e.spec===t.spec)(e.agg,this.lastUsedOptions.agg)&&e.unitWidth===this.lastUsedOptions.unitWidth&&e.barWidth===this.lastUsedOptions.barWidth&&e.extent[0]===this.lastUsedOptions.extent[0]&&e.extent[1]===this.lastUsedOptions.extent[1]&&e.formatString===this.lastUsedOptions.formatString&&e.minTickInterval===this.lastUsedOptions.minTickInterval&&P(this.ticks))return this.ticks;this.lastUsedOptions=e;let t=this.getTickGetter(e),n=Math.max(0,e.extent[0]),r=Math.min(this.xScale.timeline.withPrologEpilogLength-1,e.extent[1]+1);return this.ticks=this.view.presenter.timeline.slice(n,r).map((e,r)=>{if(!P(e)||Number.isNaN(e.getTime()))return null;let i=t(e);return P(i)&&(i.index=n+r),i}).filter(e=>P(e)),this.ticks}normalizeDuration(e){let t=I_(),n=t.Year,r=Object.keys(t);for(let i=0;i<r.length-1;++i){let a=t[r[i]].Multipliers,o=t[r[i+1]].Multipliers;if(e<=(xe(a)+Se(o))/2){n=t[r[i]];break}}let i=n.Multipliers,a=i.findIndex(t=>e<t),o=a===-1?xe(i):i[a];return n.Period===`P1M`?o*=.9:n.Period===`P1W`&&(o*=.84),o}draw(e){if(!this.isVisible)return;let{xAxis:{gridLines:t,textColor:n,minTickInterval:r,tickPixelInterval:i,format:a,forceTicksVisible:o},chart:{fontFamily:s}}=this.view.presenter.display,{fontWeight:c,fontSize:l,innerTickSize:u,tickPadding:d}=this.config,{x:f,y:p,width:m,height:h}=this.contentBounds,{lineWidth:g,color:_,dashStyle:v}=t,y=lo(v);e.textAlign=`center`,e.textBaseline=`alphabetic`,e.font=`${c} ${l}px ${s}`,e.lineWidth=1,e.strokeStyle=_,e.fillStyle=n,e.setLineDash([]),this.axisStrips.forEach(t=>Vo(e,t.baseline,f,f+m));let b=this.xScale.extent(),x=e=>!P(e)||!P(e[0],e[1]);if(x(b))return;let S=t=>e.measureText(t).width,C=(e,t)=>P(e)?Bn(t,e):B.FIFTY_YEARS_MILLIS,w=i>0?i:120,T=this.xScale.domain();if(x(T))return;let ee=(T[1].getTime()-T[0].getTime())*w*.6/m,E=this.normalizeDuration(ee),D=this.view.presenter.data.aggregation.isEndOfDay,te=(e,t)=>{if(e.date.valueOf()===B.ZERO_DATE.valueOf())return!0;if(C(e.date,t.date)<r)return!1;let n=t.x-e.x,i=t.date.getTime()-e.date.getTime()>=E,a=n>w;return!(e.x+e.textWidth/2>=t.x-t.textWidth/2)&&(a||(D?i:!1))},ne=f+m,re=({text:n,x:r,date:i,forced:a})=>{P(i)&&(this.axisStrips.forEach(({position:t,baseline:i})=>{let o=t===`top`,s=i+(o?-1:1)*u,c=o?s-d:s+d+l*.71;a||Bo(e,r,i,s),e.fillText(n,r,c)}),t.visible&&!a&&(e.save(),e.lineWidth=g,e.setLineDash(y),Bo(e,r,p,p+h),e.restore()))},ie={agg:this.view.presenter.data.aggregation,unitWidth:S(`M`),barWidth:this.xScale.bar.width,extent:b,formatString:a,minTickInterval:r||0,duration:ee},ae=this.getTicks(ie),O=e=>{let{x:t,textWidth:n}=e,r=t;if(o){let i=n/2;r=t-i<f?f+i:t,r=r+i>ne?ne-i:r,e.x=r,e.forced=t!==r}else e.forced=!1},oe={date:B.ZERO_DATE,priority:999,x:-999,text:``,index:-1,textWidth:0};ae.forEach(e=>{e.x=this.xScale.indexToX(e.index),e.textWidth=S(e.text),O(e),te(oe,e)?(re(oe),oe=e):e.priority<oe.priority&&(oe=e)}),re(oe),this.drawTimeTransitions(e),this.drawTimeAdornments(e)}drawTransitionsFor(e,t,n,r,i){let a=this.xScale.domain(),o=this.view.presenter?.mainPlot?.timeSeries.container;if(!N(o))return;let s=o.getTimeData(),c=t===null?s:o.getData(t);if(!P(c))return;let l=Te(s,+a[0],Number),u=Te(s,+a[1],Number,we,l);if(l<u){let{y:t,height:a}=this.contentBounds,o=this.view.leftOffset,d=this.contentBounds.x+this.contentBounds.width;if(r.save(),i){r.fillStyle=e.fillColor;let f=c[l],p=Math.max(o,this.xScale.timeToX(s[l]));for(let e=l+1;e<=u;++e){let o=e<c.length?c[e]:null;if(e===u||n(o,f)){let n=e<s.length?s[e]:null,c=N(n)?this.xScale.timeToX(n):d;c=Math.min(c,d),i(f)%2==0&&r.fillRect(p,t,c-p,a),f=o,p=c}}}let f=is();f.prolog(r),r.strokeStyle=e.color,r.lineWidth=e.width,r.setLineDash(lo(e.dashStyle));let p=null;for(let e=l;e<u;++e){let i=c[e];if(n(i,p)){let n=s[e],o=this.xScale.timeToX(n);P(o,p)&&Bo(r,o,t,t+a),p=i}}f.epilog(r),r.restore()}}drawTimeTransitions(e){let t=this.xScale.domain();if(!N(t)||!P(t[0],t[1]))return;let n=this.view.presenter,{xAxis:{contractTransition:r,cycleTransition:i}}=n.display,a=(e,t)=>e!==t;if(r.enabled&&n?.data?.aggregation.isMultiContract){let t=(n?.mainPlot?.timeSeries.container)?.getData(G.Symbol);if(t&&t.length>0){let n=t[0];if(this.contractParityCacheKey!==n||!this.contractParityCache){let e=[...new Set(t)];e.sort((e,t)=>{let n=Ki(e),r=Ki(t);return(n?.getTime()??0)-(r?.getTime()??0)});let r=0;if(this.contractParityCache)for(let t=0;t<e.length;t++){let n=e[t],i=this.contractParityCache.get(n);if(i!==void 0){r=(i-t)%2==0?0:1;break}}this.contractParityCache=new Map,e.forEach((e,t)=>this.contractParityCache.set(e,t+r)),this.contractParityCacheKey=n}this.drawTransitionsFor(r,G.Symbol,a,e,e=>this.contractParityCache.get(e)??0)}}i.enabled&&(n?.data?.aggregation.isIntraday?this.drawTransitionsFor(i,G.TradingDay,a,e,e=>e):n?.data?.aggregation.unit===g.Day?this.drawTransitionsFor(i,null,(e,t)=>!di(e,t),e,e=>e.getMonth()):n?.data?.aggregation.unit===g.Week&&this.drawTransitionsFor(i,null,(e,t)=>!pi(e,t),e,e=>e.getFullYear()))}getAnnXScore(e,t){return[Nn,li,di,pi].map((n,r)=>(4-r)*Number(n(e,t))).reduce((e,t)=>e+t,0)}annTimeToX(e){let t=this.xScale.timeToIndex(e);if(!N(t))return null;let n=this.xScale.timeline.at(t),r=this.xScale.timeToX(e);if(t>0&&n.valueOf()!==e.valueOf()){let i=t-1,a=this.xScale.timeline.at(i),o=this.xScale.indexToX(i);if(!this.view.presenter.display?.xAxis?.isOrdinal){if(a.valueOf()>e.valueOf())return r;let t=this.getAnnXScore(a,e),i=this.getAnnXScore(n,e);return t>i?o:i>t?r:this.view.presenter?.data?.aggregation?.isIntraday?o:r}let s=(e.valueOf()-a.valueOf())/(n.valueOf()-a.valueOf());return o+(r-o)*s}else return r}drawTimeAdornments(e){e.save();let t=this.view.presenter,{chart:{fontFamily:n},xAxis:{preventLabelOverlap:r}}=t.display,i=[],a=t.mainPane?.getBoundsWithoutScales()??new Eo(0,0,0,0);t.allAnnotations.concat(t.plotAnnotations).filter(e=>e.isVisible).forEach(n=>{i.push(...n.getTimeScaleAdornments().map(n=>{let r=this.annTimeToX(n.time);if(r<a.x||r>a.x+a.width)return null;let i=iv(t,this.view.presenter?.display?.xAxis?.isOrdinal?n.time:this.xScale.xToTime(r)),o=e.measureText(i).width/2;return{x:r,value:i,color:n.color,halfWidth:o}}).filter(e=>e!=null))}),i.sort((e,t)=>e.x-t.x),r&&Vj(i,this.contentBounds),i.forEach(t=>{let r=xo(t.color),i=new Mj({position:`bottom`,fontSize:this.config.fontSize,fontFamily:n,padding:this.config.indicatorPadding,strokeColor:B.COLOR_TRANSPARENT,textColor:r,backgroundColor:t.color,arrowLength:this.config.innerTickSize});this.axisStrips.forEach(({position:n,baseline:r})=>{i.configure({position:n}),i.draw(e,t.x,r+(n===`top`?-1:1),t.value)})}),e.restore()}drawCrosshair(e,{x:t}){if(!Number.isFinite(t))return!1;let n=this.view.presenter,r=n.display.xAxis,{enabled:i,showValue:a,color:o,dashStyle:s,format:c}=r.crosshair,l=this.xScale.xToTime(t);if(!(P(l)&&Fn(l)))return!1;if(!i)return!0;t=this.xScale.timeToX(l);let u=lo(s);e.strokeStyle=o,e.setLineDash(u);let d=is();d.prolog(e);let{y:f,height:p}=this.contentBounds;if(Bo(e,d.adjust(t),f,d.adjust(f+p)),d.epilog(e),!a||!r.visible)return!0;let m=iv(n,l,P(r.format)?c:void 0);this.axisStrips.forEach(({position:n,baseline:r,bounds:i})=>{this.crosshairIndicator.configure({position:n}),this.crosshairIndicator.draw(e,t,r+(n===`top`?-1:1),m,void 0,i.height-2)});let{plotHover:h}=n.display.chart;return h&&n.allPlots.filter(e=>e.isVisible&&!n.shouldDimPlot(e)).forEach(n=>n.curves.forEach(n=>n.drawHover(e,l,t))),!0}},rM={mousedown:`onMouseDown`,mousemove:`onMouseMove`,mouseup:`onMouseUp`,dblclick:`onMouseDblClick`,contextmenu:`onContextMenu`,mouseover:`onMouseEnter`,mouseout:`onMouseLeave`,wheel:`onWheel`,touchstart:`onMouseDown`,touchmove:`onMouseMove`,touchend:`onMouseUp`,keydown:`onKeyDown`},iM={Shift:`shiftKey`,Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`},aM=e=>e.startsWith(`touch`),oM=class{view;subscriptions=[];constructor(e){this.view=e}init(e){let t=Ie();Object.keys(rM).filter(e=>!aM(e)||t).forEach(t=>{let n=e=>{let n=rM[t];this.notifyActiveTool(n,e)===!0&&e.preventDefault()};e.addEventListener(t,n),this.subscriptions.push(()=>{e.removeEventListener(t,n)})})}shutdown(){this.subscriptions.forEach(e=>e()),this.subscriptions=[]}notifyActiveTool(e,t){let n=this.view.presenter;if(n===void 0||n.activeTool===null)return!1;let r=this.getPayload(t,n),i=n.activeTool,a=!1;return typeof i[e]==`function`&&(a=i[e](r)||!1),a}getPayload(e,t){let n=e instanceof MouseEvent,r=Ie()&&e instanceof TouchEvent;if(n||r){let i={x:0,y:0};if(r&&e.touches.length===1){let t=e.touches[0],{left:n,top:r}=e.target.getBoundingClientRect();i.x=t.clientX-n,i.y=t.clientY-r}else n&&(i.x=e.offsetX,i.y=e.offsetY);let a={button:n?e.which:E.Left,offset:i,view:t.view,presenter:t,originalEvent:e,getModifier:t=>e[iM[D[t]]]};if(e instanceof WheelEvent&&(a.delta=e.shiftKey?e.deltaX:e.deltaY),r&&e.touches.length===2){let t=e.touches[0],n=e.touches[1];a.pinchZoom=!0;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;a.pinchDistance=Math.sqrt(r*r+i*i)}return this.view.splitters.forEach((e,t)=>{e?.contains(i)&&(a.splitter=[t,t+1])}),t.panes.forEach(e=>{let t=e.getBounds();if(P(t)&&t.contains(i)){let t=e.axes.find(e=>e.viewBox?.contains(i));if(t)a.priceAxis=t;else{let t=e.axes.find(e=>e.primary);t&&(a.point=t.toAnnotationPoint(i))}}}),a}else if(e instanceof KeyboardEvent)return{key:e.key??e.keyIdentifier,code:e.keyCode||e.charCode,repeat:e.repeat,presenter:t,getModifier:t=>e.getModifierState(D[t])}}},sM=Ng.concat(G.PercentChange);function cM(e){let t=[],n=new Map;for(let r of e){if(!r.isSeasonal){t.push([r]);continue}let e=n.get(r.uid);e||(e=[],n.set(r.uid,e),t.push(e)),e.push(r)}return t}function lM(e,t){let n=cM(t),r=e.isSeasonal?n.find(t=>t.some(t=>t.uid===e.uid)):void 0,i=[];return r&&i.push(r),n.forEach(e=>{e!==r&&i.push(e)}),i}function uM(e,t){return lM(e,t).flat().filter(t=>t!==e)}var dM=class{view;id;isOptionsChart=!1;constructor(e){this.view=e,this.id=`bc-legend-${bt()}`}getLegendElem(){let e=this.view.el;return aa(this.id,e,`div`)}update(){let e=this.getLegendElem(),t=Lv(this.presenter.mainPane);if(!P(t))return;this.isOptionsChart=this.mainPlot?.title?.startsWith(B.FAKE_SYMBOL_PREFIX)??!1;let{left:n,right:r,top:i,width:a}=t;jk(e,`row`,n,r,i,a),oa(e,{"bcharts-card":!0,"bcharts-legend":!0});let o=this.mainPlot,s=o.isSeasonal||this.isOptionsChart?this.getFirstColorBadge(o):``,c=this.getPlotTitle(o),l=this.maybeGetQuote();if(o.isSeasonal){e.innerHTML=this.renderSeasonalLegend();return}e.innerHTML=`${this.div(`${s} ${c} `)+this.div(`${l}`)} ${this.maybeGetAdditionalPlots()}`}remove(){ta(this.getLegendElem())}get presenter(){return this.view.presenter}get mainPlot(){return this.presenter.mainPlot}getAttributes(e){return Object.entries(e).map(([e,t])=>t===null?``:`${e} = "${at(Array.isArray(t)?t.join(` `):t)}" `).join(` `)}span(e,t={}){return`<span ${this.getAttributes(t)}>${e}</span>`}div(e){return`<div class="plot" style="flex: 0 0 auto">${e}</div>`}spanAsPlot(e){return`<span class="plot" style="display:inline-flex; align-items:center">${e}</span>`}divAsGroup(e,t=!1){return`<div class="plot-group" style="display:block; flex:0 0 100%;${t?` margin-top:2px;`:``}">${e}</div>`}get meta(){return this.mainPlot.metaData}isSingleSymbolSeasonal(e){return e.isSeasonal&&!e.hasComputation}format(e,t,n){return(n??this.meta).format(e,t)}spanAsName(e){return this.span(it(e),{class:`field-name`})}spanAsValue(e,t=null,n=null){return this.span(it(e),{class:[`field-value`,t],style:n})}getQuoteFromRecord(e){let t=sM.map(t=>e.getValue(t));if(k(t)){let e=t[4],n=`field-${e>0?`up`:e<0?`down`:`same`}-value`;return`${t.slice(0,-1).map((e,t)=>{let r=sM[t],i=this.format(e,r),a=Hv(r);return`${this.spanAsName(a)}${this.spanAsValue(i,n)}`}).join(` `)} ${this.spanAsValue(`(${this.format(xe(t),xe(sM))})`,n)}`}return``}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries?.record?.isValid){let e=$().getRecordSource().getRecord(this.mainPlot.timeSeries.record.symbol);return this.getQuoteFromRecord(e)}else if(this.mainPlot.isExpression&&this.mainPlot.record.isValid){let e=this.mainPlot.record;return e.evaluate(),this.getQuoteFromRecord(e)}return``}getTitle(e,t,n,r=e.symbol){let i=t?`value-main`:null,a=`${it(e.name)} (${it(r)})`,o=this.span(a,{"data-plot-uid":n,class:[`value-title`,i]}),s=it(e.exchange);return`${o}${t?` ${this.span(s,{class:`value-subtitle`})}`:``}`}getPlotTitle(e){if(e.isSymbol){let t=Nv(e.title,e.metaData.symbol);return this.getTitle(e.metaData,e.main,e.uid,t)}else if(this.isSingleSymbolSeasonal(e)&&e.offset===0&&(e.symbols?.length??0)>0){let t=$().getMetaDataSource().getMetaData(e.getActualSymbols()[0]);return this.getTitle(t,!0,e.uid)}else{let t=it(Pv(e)??e.title);return this.span(t,{"data-plot-uid":e.uid,class:`value-title`})}}getCondensedSeasonalTitle(e){return!this.isSingleSymbolSeasonal(e)||!e.isPlain||!Ze(e.offset)?null:String(new Date().getFullYear()-e.offset)}getSeasonalFamilyTitle(e,t){if(t)return this.getPlotTitle(e);let n=this.getCondensedSeasonalTitle(e);return n?this.span(n,{"data-plot-uid":e.uid,class:`value-title`}):this.getPlotTitle(e)}renderSeasonalLegend(){let e=this.presenter.mainPane.axes.map(e=>e.plots).flat();return lM(this.mainPlot,e).map((e,t)=>{let n=e.map((e,t)=>{let n=this.getFirstColorBadge(e),r=e.isSeasonal?this.getSeasonalFamilyTitle(e,t===0):this.getPlotTitle(e);return this.spanAsPlot(`${n} ${r}`)}).join(` `);return e[0]?.isSeasonal?this.divAsGroup(n,t>0):n}).join(` `)}getFirstColorBadge(e){return xv(`rectangle`,e.mainCurve.colors[0])}getLastValues(e){return this.isOptionsChart?``:Jj(e).filter(e=>P(e.value)).map(t=>{let n=this.format(t.value,t.field,e.metaData);return this.spanAsValue(n,null,`color:${t.color}`)}).join(` `)}canBeDeleted(e){return e.isStudy||!e.main&&(e.isSymbol||this.isOptionsChart)}maybeGetAdditionalPlots(){let e=this.presenter.mainPane.axes.map(e=>e.plots).flat(),t=uM(this.mainPlot,e),n=this.presenter.display.yAxis.showLastValue;return t.length>0?t.map(e=>{let t=this.getFirstColorBadge(e),r=this.getPlotTitle(e),i=this.canBeDeleted(e)?jv(e.uid):``,a=n!==`All`&&!e.isSeasonal?this.getLastValues(e):``;return this.div(`${i} ${t} ${r} ${a}`)}).join(` `):``}},fM=class{presenter;splitters=[];canvasContainer=null;mouseCanvas=null;mainCanvas=null;mouseContext;mainContext;leftOffset=0;rightOffset=0;legend;notifyLayoutChanged;el=null;listeners=[];tooltip;width;height;customEventPopup=null;goToLatestButton=null;xAxis;eventCapture;resetZoomAndVisibleRange=!1;constructor(){this.legend=new dM(this),this.draw=this.draw.bind(this),this.notifyLayoutChanged=qe(K.CH_CHTLAYOUTCHANGED,B.LAYOUT_THROTTLE_DELAY)}get canShowLegend(){if(!this.presenter.hasLegend)return!1;let e=this.presenter.display.chart.showLegend;return!(typeof e==`boolean`&&!e)}updateLegend(){this.canShowLegend&&this.legend.update()}removeLegend(){this.legend.remove()}findSvgParentWithClass(e,t){return[e,e.parentElement,e.parentElement.parentElement].find(e=>P(e)&&e.className===t)}onNonToolHandledMouseDown(e){let t=this.presenter,n=e.target;if(typeof n.className==`string`&&n.className.split(` `).includes(`value-title`))t.onCardClicked(n);else{let r=this.findSvgParentWithClass(n,`move-pane`);if(N(r)){t.onMovePaneClicked(r);return}let i=this.findSvgParentWithClass(n,`delete-plot`);if(N(i)){t.deletePlotClicked(i);return}let a=this.findSvgParentWithClass(n,`show-hide-plot`);if(N(a)){t.showHidePlotClicked(a);return}let o=this.findSvgParentWithClass(n,`more-actions`);if(N(o)){t.plotMoreActionsClicked(o,e);return}}}initialize(e){this.presenter=e,this.el=this.presenter.hostElement;let t=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;this.setSize(e,n,!0),P(this.tooltip)&&this.tooltip.repositionAuto()}});t.observe(this.el.parentElement),this.listeners.push(()=>t.unobserve(this.el.parentElement));let n=e=>this.onNonToolHandledMouseDown(e);this.el.addEventListener(`mousedown`,n),this.listeners.push(()=>this.el.removeEventListener(`mousedown`,n)),ra(this.el,{flex:1,display:`flex`,position:`relative`,"flex-direction":`column`,"touch-action":`pan-x pan-y`}),this.tooltip=new Ok(this);let r=$().config.getCustomEventPopup;this.customEventPopup=r?r(this):null;let{clientHeight:i,clientWidth:a}=this.el;this.width=a,this.height=i,this.canvasContainer=sa(this.el,`div`),ia(this.canvasContainer,{class:`chart-canvas-container`}),ra(this.canvasContainer,{flex:1,display:`flex`,"flex-direction":`column`,position:`relative`,height:`100%`}),this.mainCanvas=sa(this.canvasContainer,`canvas`);let o={height:`${i}px`,width:`${a}px`,"z-index":2,position:`absolute`,top:0,left:0};ra(this.mainCanvas,o),this.mouseCanvas=sa(this.canvasContainer,`canvas`),ia(this.mouseCanvas,{tabIndex:0}),o[`z-index`]=3,o.outline=`none`,ra(this.mouseCanvas,o),this.goToLatestButton=sa(this.el,`button`),la(this.goToLatestButton,`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
40
40
|
<path d="M13.707 17.707l5-5c0.391-0.391 0.391-1.024 0-1.414l-5-5c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414l4.293 4.293-4.293 4.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0zM6.707 17.707l5-5c0.391-0.391 0.391-1.024 0-1.414l-5-5c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414l4.293 4.293-4.293 4.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0z"></path>
|
|
41
41
|
</svg>`),ra(this.goToLatestButton,{position:`absolute`,right:0,bottom:0,"z-index":3}),ia(this.goToLatestButton,{class:`go-to-latest`}),this.goToLatestButton.onclick=()=>{this.xAxis.goToLatest()},this.listeners.push(()=>{this.goToLatestButton.onclick=null}),this.mainContext=this.mainCanvas.getContext(`2d`),this.mouseContext=this.mouseCanvas.getContext(`2d`),this.splitters=[],this.xAxis=new nM(this),this.eventCapture=new oM(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(a,i);let s=$i(this.el);P(na(`.${B.SVG_ICONS_DOM_NODE}`,s))||hv(s)}reinitialize(){this.el&&ca(`.bcharts-card`,this.el).forEach(e=>e.remove()),this.customEventPopup?.hide(),this.drawCrosshair({ap:void 0}),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.resetZoomAndVisibleRange?this.xAxis=new nM(this):this.xAxis?.updateConfigFromModel(),this.recalculateLayout(),this.redraw()}setSize(e,t,n=!1){this.setChartSize(e,t),this.redraw(n)}setChartSize(e,t){let n={width:`${e}px`,height:`${t}px`};ra(this.el,n),this.width=e,this.height=t;let r=globalThis.devicePixelRatio||1,i={height:this.height*r,width:this.width*r};[this.mainCanvas,this.mouseCanvas].forEach(e=>{ia(e,i),ra(e,n)}),this.mainContext.scale(r,r),this.mouseContext.scale(r,r),this.recalculateLayout(),this.presenter&&kk(this.presenter)}widthNeeded(e,t){let n=this.presenter.allAxes.filter(e=>e.onTheRight===t&&e.plots.some(e=>e.isVisible&&e.hasVisibleCurves&&!e.hasDetachedScale));return n.length===0?0:Math.max(...n.map(t=>t.widthNeeded(e)))}recalculateLayout(){if(!this.isHostElementVisible)return;this.leftOffset=0,this.rightOffset=0,this.presenter.allAxes.forEach(e=>e.clearTicks()),this.splitters.length=0;let e=this.xAxis.heightNeeded(this.mainContext),t=this.widthNeeded(this.mainContext,!0),n=this.widthNeeded(this.mainContext,!1),r=this.xAxis.position===`bottom`?0:e,i=this.xAxis.position===`top`?0:e,a=Math.max(0,this.height-r-i),o=this.presenter.panes,s=pe(o.map(e=>e.height)),c=r,l=B.PANE_SPLITTER_PERCENT_HEIGHT/100,u=Math.floor(l*a);s*=1+(o.length-1)*l;let d=this.presenter.display?.yAxis?.primaryOnTheLeft??!1;this.presenter.display.yAxis.visible&&(o.some(e=>e.axes.length>1)?(this.leftOffset=n,this.rightOffset=t):d?this.leftOffset=n:this.rightOffset=t),o.forEach((e,n,r)=>{let i=n===r.length-1,o=Math.floor(a*e.height/s),l=new Eo(0,c,this.width,o);e.setViewBox(l);let d=new Eo(this.width-this.rightOffset,c,t,o),f=new Eo(0,c,this.leftOffset,o),p=e=>e.setViewBox(e.onTheRight?d:f);if(p(e.axes[0]),e.axes[1]&&p(e.axes[1]),c+=o,!i){let e=new Eo(this.leftOffset,c,this.width-this.rightOffset-this.leftOffset,u);this.splitters.push(e),c+=u}});let f=new Eo(this.leftOffset,r,this.width-this.rightOffset-this.leftOffset,c-r);this.xAxis.setViewBox(f,r,i),this.tooltip?.repositionForLayout(),ra(this.goToLatestButton,{right:`${t+5}px`,bottom:`${i+5}px`}),this.updateLegend(),this.xAxis.setDomain(),this.setPriceAxesDomains(),this.notifyLayoutChanged({chart:this.presenter.accessor})}setPriceAxesDomains(){this.presenter.allAxes.forEach(e=>{e.setDomain(),e.updateFullDomain()}),this.presenter.priceDomainsUpdated()}draw(){this.mainContext.save(),this.mainContext.miterLimit=1,this.drawBackground(this.mainContext);for(let e of this.presenter.panes)e.drawBackground(this.mainContext);this.xAxis.draw(this.mainContext);for(let e of this.presenter.panes)e.draw(this.mainContext);this.drawSplitters(this.mainContext),this.presenter.title.draw(this.mainContext),this.goToLatestButton.style.display=this.canShowGoToLatestButton()?`block`:`none`,this.mainContext.restore()}canShowGoToLatestButton(){let e=$().config.showGoToLatest,{showGoToLatest:t}=this.presenter.display.chart;return!!(P(e)?e:t)&&this.xAxis.panningXAxisAllowed&&this.xAxis.canGoToLast()}get isHostElementVisible(){return P(this.el)&&P(this.el.offsetParent)}redraw(e=!1){this.isHostElementVisible&&(e?this.draw():$().redraw(this.presenter.hostElement))}drawBackground(e){let t=this.presenter.display.chart.backgroundColor;e.clearRect(0,0,this.width,this.height),e.fillStyle=t,e.fillRect(0,0,this.width,this.height)}drawCrosshair({ap:e,offset:t}){let n=this.mouseContext;return n.clearRect(0,0,this.width,this.height),!e||!t||!this.xAxis||!this.xAxis.drawCrosshair(n,t)?!1:(this.presenter.display.yAxis.visible&&e.axis?.pane&&e.axis.pane.drawYCrosshair(n,t),!0)}drawSplitters(e){let t=this.presenter.display.chart.backgroundColor;e.strokeStyle=ho(t),e.lineWidth=2,this.splitters.forEach(t=>{let{x:n,y:r,width:i,height:a}=t,o=r+a/2;e.beginPath(),e.moveTo(n,o),e.lineTo(n+i,o),e.stroke()})}toTime(e){return this.xAxis.xScale.xToTime(e)}toIndex(e){return this.xAxis.xScale.timeToIndex(e)}toX(e){return this.xAxis.xScale.timeToX(e)}setCursor(e){let t=pM(e);ra(this.el,{cursor:t})}shutdown(){this.listeners.forEach(e=>e()),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&ca(`.bcharts-card`,this.el).forEach(e=>e.remove()),this.canvasContainer.remove()}getEventRadius(){let e=this.xAxis.xScale.bar.width/2;return Math.max(e,B.MIN_EVENT_RADIUS)}};function pM(e){switch(e){case ee.Arrow:default:return`default`;case ee.Crosshair:return`crosshair`;case ee.Hand:return`pointer`;case ee.Move:return`move`;case ee.ResizeVertical:return`ns-resize`;case ee.Grabbing:return`grabbing`;case ee.ResizeHorizontal:return`ew-resize`}}var mM=class{view;popupElement;date;value;visible;_initialized;constructor(e){this.view=e,this.date=null,this.value=null,this.visible=!1,this._initialized=!1}initialize(){this.popupElement=sa(this.view.el,`div`),ia(this.popupElement,{id:`${this.view.presenter.elementId}-custom-event-host`}),ra(this.popupElement,{visibility:`hidden`,position:`absolute`,"z-index":30,top:`0px`,left:`0px`,padding:`5px 10px 10px 10px`,display:`flex`,"flex-direction":`column`,background:`var(--chartPopupElemBg, #999)`,"box-shadow":`0px 2px 10px rgba(0,0,0,.3)`,"border-radius":`4px`,border:`1px solid var(--chartPopupElemBorderColor, #888)`,"max-height":`400px`,overflow:`auto`});let e=sa(this.popupElement,`a`);ia(e,{class:`custom-event-close-button`}),ra(e,{position:`absolute`,right:`10px`,top:`5px`,fill:`var(--text-color,#888)`,cursor:`pointer`}),e.innerHTML=`<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="12px" height="12px"><use xlink:href="#bchart-icon-delete"></use></svg>`,e.addEventListener(`click`,e=>this.hide()),this._initialized=!0}showValue(){}show(e,t,n){this._initialized||this.initialize(),this.date=t,this.value!==n&&(this.value=n,this.showValue()),ra(this.popupElement,{visibility:`visible`,top:`${e.y}px`,left:`${e.x}px`,width:`310px`}),this.visible=!0}hideValue(){}hide(){this.visible&&=(this.hideValue(),ra(this.popupElement,{visibility:`hidden`}),!1)}};function hM(e,t){return U(e,`..axes[${t.axisIndex}]`,e=>(e.annotations=t.annotations,e))}function gM(e){return e.annotations&&e.annotations.length>0}function _M(e,t){gM(e)&&(t.annotations=(t.annotations||[]).concat(e.annotations))}var vM=`..axes{..plots{.type==="Study"}}`;function yM(e){return H(e,`..plots{.type==="Study"}.study`)}function bM(e,t){let n=yM(e),r=yM(t);return n.length===r.length&&ge(n,r)}function xM(e,t,n){let r=t.find(t=>!n.has(t)&&bM(e,t));if(N(r))return r;let[i]=yM(e);return t.find(e=>!n.has(e)&&i===yM(e)[0])}function SM(e,t){let{mainAxis:n}=Ud(e),{mainAxis:r}=Ud(t);_M(n,r);let i=H(e,vM).filter(e=>e!==n),a=H(t,vM).filter(e=>e!==r),o=new Set;return i.forEach(e=>{let t=xM(e,a,o);N(t)&&(o.add(t),_M(e,t))}),t}function CM(e,t){let n=e=>`..panes[${e}]`,r=e;return t.paneHeights.forEach(e=>{r=U(r,n(e.index),t=>(t.height=e.relativeHeight,t))}),r}var wM={ok:!1,change:void 0,toApply:void 0};function TM(e){return e.toolChange===O.Reordered}var EM=class{presenter;paused=null;undoStack=[];redoStack=[];initial=new Map;isPaused=!1;constructor(e){this.presenter=e,this.clear()}clear(e=!1){this.undoStack=[],this.redoStack=[],this.initial=new Map,e&&this.presenter.allAnnotations.forEach(e=>this.initial.set(e.uid,ek(e,O.Moved)))}rebindOwners(e){let t=new Set(this.presenter.panes.flatMap(e=>e.axes)),n=(e,n)=>{e.annotationUndoOwner.axis=n,n&&(n.annotationUndoOwner=e.annotationUndoOwner,t.delete(n))},r=e.flatMap(e=>e.axes);for(let e of[`annotations`,`plots`])r=r.filter(r=>{let i=new Set(r[e].map(e=>e.uid)),a=[...t].filter(t=>t[e].some(e=>i.has(e.uid)));return a.length===1?(n(r,a[0]),!1):!0});for(let e of r){let i=e.pane,a=i.axes.map(e=>e.annotationUndoOwner.axis?.pane),o=new Set(a.filter(e=>e&&this.presenter.panes.includes(e))),s=o.size===1?[...o][0]:void 0,c=s?[...t].filter(e=>e.pane===s):[],l=e.plots.length===0&&e.annotations.length===0,u=r.filter(e=>e.pane===i).length===1;n(e,l&&u&&c.length===1?c[0]:void 0)}}done(e){if(this.isPaused){this.paused=e;return}this.undoStack.push(e),this.redoStack.length=0}undo(){this.undoRedo(this.undoStack,this.redoStack,!0)}pause(){this.isPaused=!0}resume(e){this.isPaused=!1,e&&N(this.paused)&&this.done(this.paused),this.paused=null}redo(){this.undoRedo(this.redoStack,this.undoStack,!1)}delete(e){let t={...e,id:`Delete`};this.presenter.handleAnnotationChange(t)}add(e){let t={annotation:e,id:`Add`};this.presenter.handleAnnotationChange(t)}applyOrder(e,t){let n=this.presenter.allAnnotations.find(t=>t.uid===e.uid)?.axis??e.owner?.axis;if(!n)return;let r=t?e.before:e.after,i=n.annotations.filter(e=>r.includes(e.uid));if(i.length<2)return;i.sort((e,t)=>r.indexOf(e.uid)-r.indexOf(t.uid));let a=0;n.annotations=n.annotations.map(e=>r.includes(e.uid)?i[a++]:e),this.presenter.onAnnotationsUpdated(n),this.presenter.view?.redraw();let o=n.annotations.find(t=>t.uid===e.uid),s=t?O.Undo:O.Redo;o&&this.presenter.onAnnotationModifiedByTool(o,s,!1,!0)}apply(e,t,n=!1){if(!P(e))return!1;if(TM(e))return this.applyOrder(e,n),!0;let r=e;switch(t){case O.None:case O.Undo:case O.Redo:I(`Unexpected tool change ${O[t]} for undo/redo`,`warn`);break;case O.Created:n?this.delete(r):this.add(r);break;case O.Deleted:n?this.add(r):this.delete(r);break;default:{let e={...r,id:`Update`};this.presenter.handleAnnotationChange(e);break}}let i=this.presenter.allAnnotations.find(e=>e.uid===r.uid),a=n?O.Undo:O.Redo;return P(i)&&this.presenter.onAnnotationModifiedByTool(i,a),!0}can(e){let t=e?this.undoStack:this.redoStack;if(t.length<1)return wM;let n=xe(t),r=n.toolChange;if(TM(n)||!(e&&r!==O.Deleted&&r!==O.Created))return{ok:!0,change:r,toApply:n};let i=Ce(t,e=>e.uid===n.uid&&!TM(e),t.length-2),a=i===-1?null:t[i],o=a===null;return o&&!this.initial.has(n.uid)?wM:{ok:!0,change:r,toApply:o?this.initial.get(n.uid):a}}get canUndo(){return this.can(!0).ok}get canRedo(){return this.can(!1).ok}undoRedo(e,t,n){let{ok:r,change:i,toApply:a}=this.can(n);r&&this.apply(a,i,n)&&t.push(e.pop())}},DM=class{presenter;text=null;align=`center`;verticalAlign=`top`;x=0;y=0;style={color:`#333`,fontSize:18};constructor(e){this.presenter=e}update({style:e,...t}){Object.assign(this,t),Object.assign(this.style,e)}draw(e){if(!this.text)return;let{fontFamily:t}=this.presenter.display.chart,{fontSize:n,color:r,fontWeight:i}=this.style,{x:a,y:o,width:s,height:c}=this.presenter.mainPlot.axis.pane.getBounds(),l=a+this.presenter.view.leftOffset,u=a+s-this.presenter.view.rightOffset,d=l;d=this.align===`center`?s/2:this.align===`right`?u:l;let f=o+n;this.verticalAlign===`middle`?f=o+n+c/2:this.verticalAlign===`bottom`&&(f=o+c),d+=this.x,f+=this.y,e.save(),e.font=`${i||`normal`} ${n}px ${t}`,e.textAlign=this.align,e.textBaseline=`bottom`,e.fillStyle=r,e.fillText(this.text,d,f),e.restore()}};function OM(e){let t=e.offset;return typeof t==`number`?t:void 0}function kM(e,t,n){let r=t.axis,i=r?.pane,a=i?e.panes.indexOf(i):-1,o=i&&r?i.axes.indexOf(r):-1,s=r?r.plots.indexOf(t):-1,c=t.uid??t.id,l=OM(t);return{id:typeof l==`number`&&(t.isSeasonal||t.isForward)?`${c}:${l}`:c,plotUid:c,plotType:C[t.type],plotTitle:Pv(t)??t.title,fieldIds:n.map(({field:e})=>e.id),seasonalOffset:t.isSeasonal?l:void 0,paneIndex:a,axisIndex:o,plotIndex:s,main:t.main}}function AM(e){return e.view?.xAxis?.xScale.extent()??null}function jM(e,t,n){let r=new Map;return t.main&&(r.set(G.DateTime,{field:G.DateTime,shift:0}),e.data.aggregation.isMultiContract&&!t.isExpression&&r.set(G.Symbol,{field:G.Symbol,shift:0})),t.curves.forEach(e=>{e.fields.forEach(t=>{n.includes(t.id)||r.set(t,{field:t,shift:e.shift})})}),Array.from(r.values())}function MM(e,t){let n=t.excludeFields??[],r=e.allPlots.map(t=>{let r=jM(e,t,n);return{plot:t,fields:r,source:kM(e,t,r)}}).filter(({fields:e})=>e.length>0);return t.sourceOrder?r.map((e,t)=>({source:e,index:t})).sort((e,n)=>t.sourceOrder(e.source.source,n.source.source)||e.index-n.index).map(({source:e})=>e):r}function NM(e,t,n){let r=`${t.id}.${n.id}`,i=r,a=2;for(;e.has(i);)i=`${r}.${a++}`;return e.add(i),i}function PM(e){let t=new Set;return e.flatMap(({source:e,fields:n})=>n.map(({field:n})=>({id:NM(t,e,n),name:n.name,fieldId:n.id,source:e})))}function FM(e,t){let n=[0,0];return e.allCurves.forEach(e=>{e.fields.every(e=>t.includes(e.id))||(e.shift<0&&(n[0]=Math.min(n[0],e.shift)),e.shift>0&&(n[1]=Math.max(n[1],e.shift)))}),n}function IM(e,t){return t.some(t=>{if(t.fieldId===G.DateTime.id)return!1;let n=e[t.id];return n!=null&&n!==``})}function LM(e,t,n,r,i,a){let o=e.timeline.at(r),s=n.plot.timeSeries.container,c=s.getTimeData(),l=t[n.plot.id]||0,u=Te(c,+o,Number,we,l),d=+o==+c[u];if(d&&(t[n.plot.id]=u),a===0)return d?s.getData(i)[u]??``:i===G.DateTime?o:``;let f=e.timeline.at(r-a);if(!P(f))return``;let p=Te(c,+f,Number,we,0);return+f==+c[p]?s.getData(i)[p]??``:``}function RM(e={}){let t=this.allPlots,n=t.every(e=>P(e.timeSeries)&&e.timeSeries.hasData),r=this.data.aggregation.isEndOfDay?B.FMT_ISO_DATE_ONLY:B.FMT_EXPORT_ALL_BUT_MILLIS;if(!n||t.length===0)return{columns:[],rows:[],dateFormatHint:r};let i=e.excludeFields??[],a=MM(this,e),o=PM(a),s={},c=this.timeline.lastSeriesIndex,l=Se(this.mainPlot.timeSeries.container.getTimeData()),u=Te(this.timeline,+l,Number,dv),d=FM(this,i),f=e.visibleRange?AM(this):null,p=f?f[0]:u+d[0],m=f?f[1]:c+d[1],h=[];for(let e=p;e<=m;e++){let t={};a.forEach(n=>{n.fields.forEach(({field:r,shift:i})=>{let a=o.find(e=>e.source===n.source&&e.fieldId===r.id);t[a.id]=LM(this,s,n,e,r,i)})}),IM(t,o)&&h.push(t)}return{columns:o,rows:h,dateFormatHint:r}}function zM(e){return`"${e}"`}function BM(e,t,n,r){return e instanceof Date?Yr(e,n.dateFormatHint??B.FMT_EXPORT_ALL_BUT_MILLIS):typeof e==`number`&&P(r.numDecimals)?Xe(e,r.numDecimals)?.toString()??``:e?.toString()??``}function VM(e,t){return t?.source.id===e.source.id?``:zM(`${e.source.plotType}: ${e.source.plotTitle}`)}function HM(e,t={}){if(e.columns.length===0)return`No data to export`;let n=t.excludeHeader??!1,r=[];return n||(r.push(e.columns.map((t,n)=>VM(t,e.columns[n-1]??null)).join(`,`)),r.push(e.columns.map(e=>zM(e.name)).join(`,`))),e.rows.forEach(n=>{let i=e.columns.map(r=>BM(n[r.id],r,e,t));e.columns.some((e,t)=>e.fieldId!==G.DateTime.id&&i[t].length>0)&&r.push(i.join(`,`))}),r.join(`
|
|
42
|
-
`)}function UM(e={}){return HM(RM.call(this,e),e)}function WM(e={}){let t=this.view.mainCanvas,{width:n,height:r}=t,{width:i,height:a,title:o}=e,s=(e,t)=>{let n=document.createElement(`canvas`);return n.width=e,n.height=t,n.getContext(`2d`)},c=s(n,r),l=globalThis.devicePixelRatio;if(c.drawImage(t,0,0),c.scale(l,l),N(o)){let e=new DM(this);e.update(o),e.draw(c)}let u=this.mainPlot?.timeSeries.container?.getLastDataPoint(G.DateTime);if(N(u)){let{fontFamily:e}=this.display.chart,{fontWeight:n,fontSize:r}=this.mainAxis.config;c.font=`${n} ${r*1.2}px ${e}`,c.textBaseline=`top`;let i=r*1.5,a=getComputedStyle(t),o=a.getPropertyValue(`--app-hc-color`),s=a.getPropertyValue(`--app-color-pl`),l={x:B.CARDS_X_OFFSET,y:B.CARDS_Y_OFFSET},d=Fv(this,u,l,void 0,!1,0),f=`${d.date} ${d.time??``}`.trim(),[p,m]=[1,5],h=(e,t)=>c.measureText(e).width+t,g=(e,t,n,r,i)=>(c.fillStyle=r,c.fillText(e,t,n),h(e,i)),_=(e,t)=>e.type===C[t],v=e=>{let t=e.name;return e.isMain&&_(e,`Symbol`)?t=`${e.description} (${e.name}) [${e.exchange}]`:_(e,`Study`)&&(t=`${e.description} ${e.name.substring(e.name.indexOf(` `))}`),t};d.panes.forEach(e=>{let{top:t,left:n,width:r,right:a}=e.bounds,c=n+r-a-m,u=n+l.x,d=t+l.y;e.plots.some(e=>e.isMain)&&(u+=g(f,u,d,o,m)),e.plots.forEach((e,t)=>{let r=v(e),a=!_(e,`Study`)&&e.values.length>1;if(!e.isMain&&t>0){let t=u+h(r,m);e.values.forEach(e=>{a&&(t+=h(e.abbreviation,p)),t+=h(e.value,m)}),t>=c&&(u=n+l.x,d+=i)}u+=g(r,u,d,o,m),e.values.forEach(e=>{a&&(u+=g(e.abbreviation,u,d,s,p)),u+=g(e.value,u,d,e.color,m)})})})}let d=e=>({width:i??n,height:a??r,data:e.toDataURL(`image/png`)});if(N(i)&&N(a)){let e=s(i,a);return e.drawImage(c.canvas,0,0,i,a),d(e.canvas)}else return d(c.canvas)}function GM(e){if(e!==void 0)return e===B.YTD_PERIOD?e:vt(e)}var KM=Symbol.for(`__ias__`),qM=class{accessor;view;defaultTool;_activeTool;tooltipEnabled=!0;timeline;sentInitialLoadNotification=!1;_hostElement=null;undoRedoManager;title;display;model;data;panes=[];_hasLegend;renderTo;seriesChangedToken=``;metaChangedToken=``;streamingSubscription=null;_previousMask=0;_ohlcMask;selectedAnnotation;annotationPreviewUid;hoverHighlightPlotIds=null;hoverDimPlotIds=null;hoverBasisByDependentPlotId=new Map;hoverDependentsByBasisPlotId=new Map;hoverHighlightablePlotIds=new Set;forceResetVisibleRange=!1;_maxOffset=0;_isShutdown=!1;notifySelectionChanged;notifyRecreated;notifyDefinitionChanged;constructor(e){this.accessor=e,this.defaultTool=gj(`Default`),this._activeTool=this.defaultTool,this.timeline=new fv(this),this.undoRedoManager=new EM(this),this.title=new DM(this),this.notifySelectionChanged=Ke(K.CH_ANNSELECTIONCHANGED),this.notifyRecreated=Ke(K.CH_RECREATED),this.notifyDefinitionChanged=Ke(K.CH_DEFINITION_CHANGED)}traceChart(e,t={}){Ih(e,{chartId:this.elementId,...t})}getModel(){return this.model}get isEmpty(){return!P(this.model)}notifyHost(e,t){Ge(e,t)}async fromModel(e,t){if(this._isShutdown)return;this.traceChart(`chart:fromModel:start`,{hadModel:P(this.model)}),P(this.model)&&this.allPlots.forEach(e=>e.shutdown()),this.sentInitialLoadNotification=!1,this.clearHoverHighlight(),this.clearHoverHighlightRelations(),this.annotationPreviewUid=void 0,this.clearSelection(),this.model=e;let n=F(e);this.data=n.data,this.data.aggregation=ju(n.data.aggregation),this.display=n.display,this.display.period=GM(n.display?.period);let r=this.panes;this.panes=n.panes.map(e=>{let t=new Qj(this);return t.fromModel(e),t},this),this.undoRedoManager.rebindOwners(r);let i=this.allPlots.map(e=>e.initialize());await Promise.all(i),!this._isShutdown&&(this.rebuildHoverHighlightRelations(),this.traceChart(`chart:fromModel:plots-ready`,{plotCount:this.allPlots.length}),this.timeline.invalidate(),this.checkZoomAndVisibleRange(e,t),P(e,t)&&this.notifyDefinitionChanged({chart:this.accessor}),this.reinitializeView())}checkZoomAndVisibleRange(e,t){if(this.view)if(this.forceResetVisibleRange)this.forceResetVisibleRange=!1,this.view.resetZoomAndVisibleRange=!0,this._maxOffset=0;else{let n=!t||QM(e,t,this);this.view.resetZoomAndVisibleRange=n,n&&(this._maxOffset=0)}}closeView(){P(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(P(this.view)?this.view.reinitialize():(this.view=new fM,this.view.initialize(this)),this.notifyRecreated({elementId:this.elementId}))}getCacheableEntities(e){let t={metaData:e.metaData.size,records:e.records.size,timeSeries:e.timeSeries.size};this.isEmpty||this.allPlots.map(t=>t.getCacheableEntities(e)),this.traceChart(`chart:cacheable-entities`,{plotCount:this.allPlots.length,addedMetaData:e.metaData.size-t.metaData,addedRecords:e.records.size-t.records,addedTimeSeries:e.timeSeries.size-t.timeSeries})}get activeTool(){return this._activeTool}set activeTool(e){P(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,P(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(K.TL_CHANGED,{chart:this.accessor})}get mainPlot(){return this.allPlots.find(e=>e.main)}get mainAxis(){return this.mainPlot?.axis}get mainPane(){return this.mainAxis?.pane}get allAxes(){let e=[];return this.panes.forEach(t=>{t.axes.forEach(t=>{e.push(t)})}),e}get plotAnnotations(){let e=[];return this.allPlots.forEach(t=>{t.isVisible&&t.annotations?.forEach(t=>{e.push(t)})}),e}get allAnnotations(){let e=[];return this.allAxes.forEach(t=>{t.annotations.forEach(t=>{e.push(t)})}),e}get allPlots(){let e=[];return this.allAxes.forEach(t=>{t.plots.forEach(t=>{e.push(t)})}),e}findAxis(e){return this.allAxes.find(t=>t.id===e)}findPlot(e){return this.allPlots.find(t=>t.id===e)}get allCurves(){let e=[];return this.allPlots.forEach(t=>{t.curves.forEach(t=>{e.push(t)})}),e}findCurve(e){return this.allCurves.find(t=>t.id===e)}get hasStudyBasisFocus(){return this.display?.chart?.studyBasisFocus===!0}get hasHoverHighlight(){return this.hoverHighlightPlotIds!==null||this.hoverDimPlotIds!==null}getStudyBasis(e){return e.isStudy?e.basePlot??null:null}isHoverSourcePlot(e){return e.isSeasonal||e.isSymbol}hasMultipleHoverSourcePlots(){return this.allPlots.filter(e=>e.isVisible&&this.isHoverSourcePlot(e)).length>1}get annotationManipulation(){return $()?.config.annotationManipulation===!0}setAnnotationPreview(e){this.annotationPreviewUid!==e&&(this.annotationPreviewUid=e,this.view?.redraw())}clearHoverHighlight(){this.hoverHighlightPlotIds=null,this.hoverDimPlotIds=null}clearHoverHighlightRelations(){this.hoverBasisByDependentPlotId.clear(),this.hoverDependentsByBasisPlotId.clear(),this.hoverHighlightablePlotIds.clear()}rebuildHoverHighlightRelations(){if(this.clearHoverHighlight(),this.clearHoverHighlightRelations(),this.hasStudyBasisFocus&&this.hasMultipleHoverSourcePlots())for(let e of this.allPlots){if(this.isHoverSourcePlot(e)&&this.hoverHighlightablePlotIds.add(e.id),!e.isStudy)continue;let t=this.getStudyBasis(e);if(!P(t))continue;this.hoverBasisByDependentPlotId.set(e.id,t.id);let n=this.hoverDependentsByBasisPlotId.get(t.id);P(n)||(n=new Set,this.hoverDependentsByBasisPlotId.set(t.id,n)),n.add(e.id),this.hoverHighlightablePlotIds.add(e.id),this.hoverHighlightablePlotIds.add(t.id)}}isHoverHighlightable(e){return this.hasStudyBasisFocus&&P(e)&&this.hoverHighlightablePlotIds.has(e.id)}getRelatedHoverPlotIdsForPlot(e){if(!this.isHoverHighlightable(e))return null;let t=new Set,n=this.hoverBasisByDependentPlotId.get(e.id);if(P(n))return t.add(e.id),t.add(n),t;let r=this.hoverDependentsByBasisPlotId.get(e.id);return P(r)&&r.size>0?(t.add(e.id),r.forEach(e=>t.add(e)),t):(t.add(e.id),t)}getRelatedHoverPlotIds(e){let t=new Set;for(let n of e){let e=this.getRelatedHoverPlotIdsForPlot(n);e!==null&&e.forEach(e=>t.add(e))}return t.size>0?t:null}getHoverDimPlotIds(e){if(!this.hasStudyBasisFocus||e===null)return null;let t=new Set;for(let n of this.hoverHighlightablePlotIds)e.has(n)||t.add(n);return t}sameHoverHighlight(e){let t=this.hoverHighlightPlotIds;if(t===null||e===null)return t===e;if(t.size!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;return!0}setHoverHighlight(e){if(!this.hasStudyBasisFocus)return this.hasHoverHighlight&&(this.clearHoverHighlight(),this.view?.redraw()),!1;let t=this.getRelatedHoverPlotIds(e);return this.sameHoverHighlight(t)?this.hoverHighlightPlotIds!==null:(this.hoverHighlightPlotIds=t,this.hoverDimPlotIds=this.getHoverDimPlotIds(t),this.view?.redraw(),t!==null)}shouldDimPlot(e){return this.hasStudyBasisFocus&&(this.hoverDimPlotIds?.has(e.id)??!1)}fixupDensityForForwards(){let e=this.allPlots.filter(e=>e.isForward).map(e=>e.timeSeries.container?.size??0);e.some(e=>e>0)&&(this.display.density=Math.max(...e))}onSeriesChanged(e,t){if(!this.view||!this.allPlots)return;let n=t.series,r=e=>e.timeSeries===n||e.eventsSeries===n,i=this.allPlots.find(r);if(!P(i))return;let a=P(i)&&i.main,o=!1,s=!1;if(e===K.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;o=!0}let c=P(t.index)?n.container.getTimeData()[t.index]:null,l=e===K.TS_EVENTSCHANGED,u=this.view.xAxis,d=u.xScale;if(e===K.TS_MANYCHANGED||l){if(a&&this.data.checkRange)if(P(this.display.xAxis.visibleRange)){let e={id:`Period`,context:{range:this.display.xAxis.visibleRange}};e[KM]=!0,this.accessor.change(e);return}else delete this.data.checkRange;i.isForward&&this.fixupDensityForForwards();let e=this.view.xAxis?.getMaxCurveOffset()??0;i.isStudy&&(e!==this._maxOffset&&(this._maxOffset=e,u.goToLatest(!0)),i.invalidateAssociatedAnnotations(`NewChunkArrived`));let n=P(this.display?.xAxis?.visibleRange);if((i.isSeasonal&&!u.wasVisibleRangeChanged&&!n||this.display?.xAxis?.isOrdinal)&&u.goToLatest(!0),t.part===re.Tail){let e=Te(this.timeline,c,Number,dv);u.shouldScrollIntoView(e)&&d.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach(e=>e.invalidatePriceMappingCache()),o=!0}else if(e===K.TS_DATAPOINTADDED){let e=this.timeline.mergeDateIntoTimeline(c);e!=-1&&u.shouldScrollIntoView(e)?(d.shiftBars(1),o=!0):s=!0,i.isStudy&&i.invalidateAssociatedAnnotations(`DataPointAdded`)}else e===K.TS_DATAPOINTCHANGED&&(s=!0,i.isStudy&&i.invalidateAssociatedAnnotations(`DataPointChanged`));if(!l&&r(this.mainPlot)&&n.hasData&&n.container.size===0&&this.notifyHost(K.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),o&&this.view.recalculateLayout(),s&&(o&&I(`Performance : redundant call to recompute price domains (layout recalculation took care of this)`,`warn`),this.allAxes.filter(e=>e.plots.includes(i)).forEach(e=>{e.setDomain(),P(c)&&e.updateFullDomain(c)})),!this.sentInitialLoadNotification&&e===K.TS_MANYCHANGED&&this.allPlots.every(e=>e.timeSeries&&e.timeSeries.hasData)){this.sentInitialLoadNotification=!0,this.notifyHost(K.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),kk(this);let e=this.display.period===B.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(d.fitAllData=!0,d.adjustDomain())}this.view.redraw()}onMetaChanged(e,t){e===K.MD_CHANGED&&this.view&&this.allPlots&&this.allPlots.find(e=>e.id===t.plot.id)&&(t.plot.main&&this.allAnnotations.forEach(e=>e.onFormatterChanged()),this.view.recalculateLayout(),this.view.redraw())}priceDomainsUpdated(){this.allPlots.forEach(e=>{e.notifyAboutPriceDomains&&e.onPriceDomainsUpdated()})}onScaleDomainChanged(e){let t=this.panes.indexOf(e.pane),n=e.pane.axes.indexOf(e),r={chart:this.accessor,paneIndex:t,axisIndex:n};this.notifyHost(K.CH_AXISSCALECHANGED,r)}get previousMask(){return P(this._previousMask)||(this._previousMask=Vf(G.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some(e=>e.updated&&t)}get hasLegend(){if(!P(this._hasLegend)){let e=ne[$()?.config.mode??`Unspecified`];this._hasLegend=[ne.cmdtyView,ne.EqPlus].includes(e)}return this._hasLegend}onStreamingUpdates(e){P(this.view)&&(this.mainPlot.showPrevious&&this.hasMatch(e,this.previousMask)&&this.view.redraw(),this.hasLegend&&this.hasMatch(e,this.ohlcMask)&&this.view.updateLegend())}get ohlcMask(){return P(this._ohlcMask)||(this._ohlcMask=Vf(G.Open,G.High,G.Low,G.Close,G.PreviousClose)),this._ohlcMask}updateMatches(e,t){if((e&this.ohlcMask)===0)return!1;let n=(e,t)=>N(e)&&e.isValid&&e.hasSymbol(t);return this.mainPlot.isSymbol?n(this.mainPlot.timeSeries.record,t):this.mainPlot.isExpression?n(this.mainPlot.record,t):!1}getStreamingSubscription(){return $().getRecordSource().subject.pipe(jm(e=>e.filter(e=>this.updateMatches(e.updated,e.data.symbol))),Pm(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return P(this._hostElement)?this._hostElement.id:null}initialize(e){if(this._hostElement=e instanceof HTMLElement?e:na(`#${e}`),!this._hostElement)throw Error(`There is no element ${e} in the DOM`);this.renderTo=e,this.seriesChangedToken=$y.default.subscribe(K.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=$y.default.subscribe(K.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return $y.default.unsubscribe(this.seriesChangedToken),$y.default.unsubscribe(this.metaChangedToken),P(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach(e=>e.shutdown()),this.model=void 0,this.closeView(),this.notifyHost(K.CH_SHUTDOWN,{elementId:this.elementId}),this._isShutdown=!0,!0}setSelection(e){this.selectedAnnotation!==e&&(this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=e,this.selectedAnnotation.isSelected=!0,this.selectedAnnotation.requestRedraw(),this.notifySelectionChanged({chart:this.accessor}))}clearSelection(){P(this.selectedAnnotation)&&(this.selectedAnnotation.isSelected=!1,this.selectedAnnotation.requestRedraw(),this.selectedAnnotation=void 0),this.notifySelectionChanged({chart:this.accessor})}resetActiveTool(){this.activeTool=this.defaultTool,this.view.setCursor(ee.Arrow)}print(e={}){let t=sa(document.body,`iframe`);t.src=``,t.style.display=`none`,t.onload=()=>{let{title:n}=e,r=WM.call(this,{title:n}),i=new Image;i.src=r.data,i.style.width=`100%`,t.contentDocument.body.appendChild(i),ua(i).then(()=>{let e=t.contentWindow;t.focus(),e.print(),t.remove()})}}setTitle(e,t=!1){this.title.update(e),P(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;let t=this.display.tooltip.mode===B.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){let t=this.display.tooltip,n=Ie();!e&&t.visible&&t.mode===B.TOOLTIP_CARDS&&ca(`.bcharts-card`,this.hostElement).forEach(e=>{let t=e.classList.contains(`bcharts-card-move`);n&&t||e.classList.contains(`bcharts-legend`)||(e.style.display=`none`)})}handleAnnotationChange(e){let t=(e,t=!0)=>({id:t?e.name:e.id,uid:e.uid,visible:e.visible});if(e.id===`List`)return this.allAnnotations.map(t);if(e.id===`Cache`)return H(this.model,`..annCache{.annotations}`).map(e=>({symbol:e.symbol,annotations:e.annotations.map(e=>t(e,!1))}));if(e.id===`Add`){let t=e.annotation;return(t.isUndoRedo?t.owner?.axis??this.mainAxis:this.mainAxis)?.addAnnotation(t)}let n=this.allAnnotations.find(t=>t.uid===e.uid);if(n!==void 0){if(e.id===`Delete`&&!e.isUndoRedo)return this.deleteAnnotationWithUndo(n);let t=n.axis,r=t[`${e.id.toLowerCase()}Annotation`];if(typeof r==`function`){r.call(t,n,e);return}}throw Error(`Unknown sub-action ${e.id} for action ${B.ANN_ACTION_ID}`)}deleteAnnotationWithUndo(e){this.undoRedoManager.done(ek(e,O.Deleted)),e.axis.deleteAnnotation(e),this.onAnnotationModifiedByTool(e,O.Deleted,!1)}getPlotInfoFromDom(e){let t=e.attributes.getNamedItem(`data-plot-uid`);if(!t)throw Error(`Unable to resolve plot info: missing data-plot-uid attribute.`);let n=t.value,r=0;for(let e of this.model.panes)for(let t of e.axes)for(let e of t.plots){if(e.uid===n)return{type:e.type,index:r};r++}throw Error(`Unable to resolve plot info: model plot index not found for uid '${n}'.`)}getSimplePlot(e,t){return this.accessor.change({id:`Plot`,context:{id:B.ACTION_GET,type:e,index:t}})[0]}onCardClicked(e){let t=this.getPlotInfoFromDom(e),n=this.getSimplePlot(t.type,t.index),r={chart:this.accessor,plot:n};this.notifyHost(K.CH_CARDPLOTCLICKED,r)}deletePlotClicked(e){let t=this.getPlotInfoFromDom(e),n=this.getSimplePlot(t.type,t.index);this.accessor.change({id:`Plot`,context:{id:`Delete`,type:t.type,index:t.index}});let r={chart:this.accessor,plot:n};this.notifyHost(K.CH_CARDPLOTREMOVED,r)}showHidePlotClicked(e){this.defaultTool.hideCrosshairAndTooltips(this.view,!0);let t=this.getPlotInfoFromDom(e),n=e.attributes.getNamedItem(`data-act`).value===`Show`;this.accessor.change({id:`Plot`,context:{id:`Update`,type:t.type,index:t.index,visible:n}});let r=this.getSimplePlot(t.type,t.index),i={chart:this.accessor,plot:r,visible:n};this.notifyHost(K.CH_CARDPLOTVISIBILITYCHANGED,i)}plotMoreActionsClicked(e,t){let n=this.getPlotInfoFromDom(e),r=this.getSimplePlot(n.type,n.index),i={x:t.clientX,y:t.clientY},a={chart:this.accessor,plot:r,offset:i,originalEvent:t};this.notifyHost(K.CH_PLOTNEEDSCONTEXTMENU,a)}onMovePaneClicked(e){let t=parseInt(e.attributes.getNamedItem(`data-pane`).value),n=e.attributes.getNamedItem(`data-dir`).value===`Down`,r=t+ +!!n,i=t-+!n;setTimeout(()=>{this.accessor.change({id:`MovePane`,context:{from:r,to:i}}),this.notifyHost(K.CH_PANESREORDERED,{chart:this.accessor})})}onAnnotationsUpdated(e,t=!1){let n=this.allAxes.indexOf(e),r=e.annotations.map(e=>e.toModel()),i=hM(this.model,{axisIndex:n,annotations:r});try{this.model=Mf(i,B.CHART_SCHEMA)}catch(e){I(`Cannot update annotation (corrupts definition), error is: ${e.message}`,`error`)}t&&this.view.draw(),this.notifyHost(K.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,n=!0,r=!1){if(t!==O.None){if(n&&t!==O.Undo&&t!==O.Redo){let n=ek(e,t);this.undoRedoManager.done(n)}let i=tk(e);i.toolChange=O[t],(r||t===O.Reordered)&&(i.orderOnly=!0),this.notifyHost(K.CH_ANNMODIFIEDBYTOOL,i)}}onAnnotationDone(e,t){let n={id:e,chart:this.accessor,toolChange:O[t]};this.notifyHost(K.CH_ANNMODIFIEDBYTOOL,n)}onPaneHeightsUpdated(){let e=this.panes.map((e,t)=>({index:t,relativeHeight:e.height}));this.model=CM(this.model,{paneHeights:e}),this.notifyHost(K.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){let e=this.mainPlot.timeSeries.container;if(!P(e)||e.size===0)return null;let t=e.getTimeData(),n=Se(t),r=xe(t);return P(n,r)?{dataRange:{from:n.getTime(),to:r.getTime()},barCount:e.size}:null}};function JM(e,t){return e?.from===t?.from&&e?.to===t?.to}var YM=[`Renko`,`Range`,`LineBreak`,`Kagi`,`PointAndFigure`];function XM(e,t){for(let n of Object.keys(e))if(e[n]!==t[n])return!0}function ZM(e,t){let n=e=>e.curves[0],r=n(e),i=n(t),a=YM.includes(r.style),o=YM.includes(i.style);return a===o?o?!!(r.style!==i.style||t.inputs&&XM(dt(e.inputs),dt(t.inputs))):!1:!0}function QM(e,t,n){let r={id:`Aggregation`,context:{id:`Get`}};if(XM(Au(PP(r,t,n)),Au(PP(r,e,n)))||!JM(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!JM(e.data?.range,t.data?.range)||e.data?.extendedHours!==t.data?.extendedHours||e.display?.period!==t.display?.period||e.display?.density!==t.display?.density)return!0;let i=Hd(t),a=Hd(e);if(ZM(i,a))return!0;let o=(e,t)=>e.type===t,s=e=>{let t=e.toLowerCase();return o(a,e)&&o(i,e)&&i[t]!==a[t]},c=i.type!==a.type,l=s(`Forward`),u=s(`Expression`),d=s(`Symbol`);return c||l||u||d}function $M(e,t,n){if(`paneIndex`in t||`axisIndex`in t)throw Error(`AnnotationManipulation paneIndex and axisIndex are output-only metadata; use uid`);let r=n?.selectedAnnotation?.uid,i=n?.annotationPreviewUid;return e.panes.flatMap((e,n)=>e.axes.flatMap((e,a)=>(e.annotations||[]).map((e,t)=>({uid:e.uid,paneIndex:n,axisIndex:a,position:t,selected:r===e.uid,preview:i===e.uid})).filter(e=>t.uid===void 0||e.uid===t.uid)))}function eN(e,t){return e===`Front`?t-1:e===`Back`?0:xt(0,t-1,e)}function tN(e,t,n){let{uid:r,position:i,selected:a,preview:o}=t;if(t.id!==void 0&&t.id!==`Update`)throw Error(`Invalid AnnotationManipulation sub-action`);if(i!==void 0&&!(i===`Front`||i===`Back`)&&!(Number.isInteger(i)&&i>=0))throw Error(`Annotation position must be Front, Back, or a non-negative integer`);if((i!==void 0||a===!0||o===!0)&&r===void 0)throw Error(`AnnotationManipulation requires uid for position, selection, or preview`);let s=$M(e,t,n),c=r===void 0?void 0:s[0],l=c&&n?.panes[c.paneIndex]?.axes[c.axisIndex],u=l?.annotations.find(e=>e.uid===r),d=u?.isVisible&&!u.computed?u:void 0;if(c&&i!==void 0){let t=e.panes[c.paneIndex].axes[c.axisIndex].annotations,r=eN(i,t.length);if(r!==c.position){let e=t.map(e=>e.uid);if(l&&u&&n){let t=[...e];t.splice(r,0,t.splice(c.position,1)[0]),l.annotations.sort((e,n)=>t.indexOf(e.uid)-t.indexOf(n.uid)),n.undoRedoManager.done({owner:l.annotationUndoOwner,uid:u.uid,toolChange:O.Reordered,before:e,after:t}),n.onAnnotationsUpdated(l),n.onAnnotationModifiedByTool(u,O.Reordered,!1),u.requestRedraw()}else t.splice(r,0,t.splice(c.position,1)[0])}}return n&&o!==void 0&&(o&&d?n.setAnnotationPreview(d.uid):!o&&(r===void 0||n.annotationPreviewUid===r)&&n.setAnnotationPreview()),n&&a!==void 0&&(a&&d?n.setSelection(d):!a&&s.some(e=>e.selected)&&n.clearSelection()),e}function nN(e,t){let[n,r]=Qe(t.crosshair),{color:i,dashStyle:a}=t.horizontal||{},{color:o,dashStyle:s}=t.vertical||{},c=(e,t,n)=>{t&&(e.color=t),n&&(e.dashStyle=n)},l=U(e,`.display.xAxis.crosshair`,e=>(e.enabled=n,c(e,o,s),e));return l=U(l,`.display.yAxis.crosshair`,e=>(e.enabled=r,c(e,i,a),e)),P(t.haloTracking)&&typeof t.haloTracking==`boolean`&&(l=U(l,`.display.chart`,e=>(e.plotHover=t.haloTracking,e))),l}function rN(e,t){return U(e,`.display.tooltip`,e=>(t.visible!=null&&(e.visible=t.visible),t.mode&&(e.mode=t.mode),t.showMainTitle!=null&&(e.showMainTitle=t.showMainTitle),t.mainTitle&&(e.mainTitle=t.mainTitle),e))}function iN(e,t){let n=F(t);return Object.keys(t).forEach(e=>{B.EVENTS.includes(e)||delete n[e];let r=t[e];typeof r==`boolean`?r={show:t[e]}:Object.keys(r).forEach(e=>{B.EVENT_PROPERTIES.includes(e)||delete r[e]}),n[e]=r}),U(e,Vd,e=>(e.type===`Symbol`&&(e.events=e.events||{},Object.keys(n).forEach(t=>{e.events[t]=e.events[t]||{},ct(e.events[t],n[t],!1)})),e))}function aN(e,t){let n=U(e,`..panes{${Vd}}.axes`,e=>(N(t.scale)&&(e.scale=t.scale),e));n=U(n,`.display.xAxis`,e=>(N(t.horizontalAxisPosition)&&(e.position=t.horizontalAxisPosition),N(t.marginBars)&&(e.marginBars=t.marginBars),N(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),N(t.ordinalName)&&(e.ordinalName=t.ordinalName),N(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e));let r=()=>I(`The 'minPadding' and 'maxPadding' are deprecated (ignored)`,`warn`),i=()=>I(`The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'`,`warn`);return n=U(n,`.display.yAxis`,e=>{(P(t.minPadding)||P(t.maxPadding))&&r();let n=N(t.preventLabelOverlap)&&!N(t.preventVerticalLabelOverlap);n&&i();let a=n?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return N(a)&&(e.preventLabelOverlap=a),P(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),P(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),P(t.primaryOnTheLeft)&&(e.primaryOnTheLeft=t.primaryOnTheLeft),e}),P(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach(e=>{let{axis:t,text:r,index:i,paneIndex:a}=e;P(t,r,i)&&t===`vertical`&&Number.isInteger(i)&&(n=U(n,`..panes[${a??0}]..axes[${i}]`,e=>P(e)?(e.label=r,e):B.NULL_OBJECT))}),N(t.contractTransition)&&(n=U(n,`.display.xAxis`,e=>(lt(e.contractTransition,t.contractTransition),e))),N(t.cycleTransition)&&(n=U(n,`.display.xAxis`,e=>(lt(e.cycleTransition,t.cycleTransition),e))),n}function oN(e,t,n){let r=e;if(P(t.comparisonMode)&&typeof t.comparisonMode==`string`&&nt(x,t.comparisonMode)&&(r=U(r,`..panes{${Vd}}.axes`,e=>(e.comparison=t.comparisonMode,e))),P(t.gridLines)){let[e,n]=Qe(t.gridLines);r=U(r,`.display.xAxis.gridLines`,t=>(t.visible=e,t)),r=U(r,`.display.yAxis.gridLines`,e=>(e.visible=n,e))}if(P(t.minorGridLines)){let[,e]=Qe(t.minorGridLines);r=U(r,`.display.yAxis.minorGridLines`,t=>(t.visible=e,t))}P(t.newPaneHeight)&&typeof t.newPaneHeight==`number`&&(r=U(r,`.display.chart{.newPaneHeight > 0}`,e=>(e.newPaneHeight=t.newPaneHeight,e))),P(t.showNavigator)&&typeof t.showNavigator==`boolean`&&(r=U(r,`.display.scrollbar`,e=>(e.visible=t.showNavigator,e))),P(t.plotHover)&&typeof t.plotHover==`boolean`&&(r=U(r,`.display.chart`,e=>(e.plotHover=t.plotHover,e))),P(t.showLastValue)&&typeof t.showLastValue==`string`&&(r=U(r,`.display.yAxis`,e=>(e.showLastValue=t.showLastValue,e))),P(t.showMinMaxArc)&&typeof t.showMinMaxArc==`boolean`&&(r=U(r,`.display.chart`,e=>(e.showMinMaxArc=t.showMinMaxArc,e))),P(t.showGoToLatest)&&typeof t.showGoToLatest==`boolean`&&(r=U(r,`.display.chart`,e=>(e.showGoToLatest=t.showGoToLatest,e))),P(t.showLegend)&&typeof t.showLegend==`boolean`&&(r=U(r,`.display.chart`,e=>(e.showLegend=t.showLegend,e)),t.showLegend||n.view.removeLegend()),P(t.allAnnotationsLocked)&&typeof t.allAnnotationsLocked==`boolean`&&(r=U(r,`.display`,e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e))),N(t.hiddenItems)&&OO.includes(t.hiddenItems)&&(r=U(r,`.display`,e=>(e.hiddenItems=t.hiddenItems,e))),P(t.exprSkipLeadingEmpty)&&typeof t.exprSkipLeadingEmpty==`boolean`&&(r=U(r,`.data`,e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e))),typeof t.useLastTrade==`boolean`&&(r=U(r,`.data`,e=>(e.useLastTrade=t.useLastTrade,e)));let i=[];if(P(t.extendedHours)&&typeof t.extendedHours==`boolean`&&(r=U(r,`.data`,e=>(e.extendedHours=t.extendedHours,e))),P(t.realTimeCboeBzx)&&typeof t.realTimeCboeBzx==`boolean`&&(r=U(r,`.data`,e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&i.push(`realTimeCboeBzx`),e.realTimeCboeBzx=t.realTimeCboeBzx,e))),P(t.buildContinuation)&&typeof t.buildContinuation==`boolean`&&(r=U(r,`.data`,e=>(e.buildContinuation=t.buildContinuation,e))),i.length>0){let e={chart:n.accessor,hostPropsChanged:i};n.notifyHost(K.CH_HOST_PROPS_CHANGED,e)}return r}var sN=`MARKED_FOR_DELETION`;function cN(e,t){if(t.plots.length===0)return e;let n=e;for(let e of t.plots){let t=_N(n,e);if(t===void 0)continue;let r=mN(t),i=hN(n,r);P(i)&&(P(e.type)&&i.type!==e.type||(n=U(n,r,e=>(e[sN]=!0,e))))}return n=U(n,`..plots{.${sN} === true}`,e=>B.NULL_OBJECT),n=U(n,`..plots{.type === "Study"}`,e=>{let t=V(e.study);return P(t)&&Bd(n,t,e.basis).eligible?e:B.NULL_OBJECT}),Nf(n)}function lN(e,t,n,r){let i=C[e.type],a={curves:F(e.curves),type:e.type,uid:e.uid};a.precision=e.precision,a.visible=e.visible,a.detachedScale=e.detachedScale;let o=(e,t)=>{P(e[t])?a[t]=e[t].map(e=>F(e)):a[t]=[]},s=(e,t,n=!1)=>{t.main===!0&&(e.main=!0,e.showPrevious=t.showPrevious,n&&t.events!=null&&(e.events=F(t.events)))},c=(e,t=e=>!0)=>{P(r)&&(e.subtitles=r.allPlots.filter(e=>e.type===i).filter(t).map(e=>e.title))};switch(i){case C.Symbol:{a.title=e.symbol;let t=a.curves[0].style,n=t=>{o(e,`inputs`),a.inputs.length===0&&(a.inputs=F(t))};switch(t){case`Renko`:n(B.DEFAULT_RENKO_INPUTS);break;case`Kagi`:n(B.DEFAULT_KAGI_INPUTS);break;case`PointAndFigure`:n(B.DEFAULT_PNF_INPUTS);break;case`LineBreak`:n(B.DEFAULT_LINEBREAK_INPUTS);break;case`Baseline`:n(B.DEFAULT_BASELINE_INPUTS);break}s(a,e,!0);break}case C.Study:{o(e,`inputs`);let r=V(e.study),i=a.inputs,s=e.study===`AVWAP`,c=i.length===0?``:` (${i.map(e=>s&&e.name===`Anchor`?new Date(e.value).toLocaleString():e.value).join(`, `)})`,l=a.curves.map(e=>Number(e.shift)).filter(e=>e>0),u=l.length===0?``:` [${l.join(`, `)}]`;a.title=`${r.id}${c}${u}`,a.studyId=r.id,o(e,`levels`),o(e,`bands`),a.basis=F(e.basis)||{kind:`main`},a.placement=t?n?`overlay`:`withMain`:`standalone`;break}case C.BalanceSheet:case C.IncomeStatement:{let t=G[e.curves[0].fields[0]];a.title=`${t.name} (${e.fundamental.substring(0,1)})`,a.fundamentalId=t.id,a.frequency=e.fundamental;break}case C.Expression:a.title=e.expression,s(a,e);break;case C.Forward:a.title=e.forward,o(e,`offsets`),c(a),s(a,e);break;case C.Seasonal:a.title=e.seasonal,c(a,e=>e.refSeasonal===a.title),o(e,`offsets`),s(a,e);break;default:throw Error(`Unexpected plot type`)}return a}function uN(e,{main:t,type:n,index:r,uid:i},a){let o=`..plots{.main === true}`,s=H(e,`..panes`).map((e,t)=>{let n=H(e,o).length===1;return H(e,`..axes`).map((e,r)=>{let i=H(e,o).length===1;return H(e,`..plots`).map(e=>{let o=lN(e,n,i,a);return o.paneIndex=t,o.axisIndex=r,o})})}).flat(2).map((e,t)=>(e.index=t,e));if(P(i))return s.filter(e=>e.uid===i);if(t)return s.filter(e=>e.main);if(P(n)){let e=s.filter(e=>e.type===n);return P(r)?e.filter(e=>e.index===r):e}else return s}var dN=[`overlay`,`standalone`,`withMain`,`clone`];function fN(e,t,n){t[n]&&(e[n]=t[n])}function pN(e,t){e.type===`Study`&&t.curves?.forEach(e=>delete e.varyColorPerBar),yN(e)?P(t.curves)&&(e.curves=t.curves):wN(e.curves,t.curves);let n=C[t.type],r=e;if(P(t.precision)?r.precision=t.precision:delete r.precision,n===C.Symbol)P(t.symbol)&&(e.symbol=t.symbol);else if(n===C.Study)P(t.basis)&&(e.basis=F(t.basis)),TN(e.inputs,t.inputs,e),[`bands`,`levels`,`detachedScale`].forEach(n=>fN(e,t,n));else if((n===C.BalanceSheet||n===C.IncomeStatement)&&t.frequency)e.fundamental=t.frequency;else if(n===C.Expression){let n=e;P(t.expression)&&(n.expression=t.expression)}else if(n===C.Forward){let n=e;P(t.offsets)&&(n.offsets=t.offsets),P(t.forward)&&(n.forward=t.forward)}else if(n===C.Seasonal){let n=e;P(t.offsets)&&(n.offsets=t.offsets),P(t.seasonal)&&(n.seasonal=t.seasonal),P(t.usesInAverage)&&(r.usesInAverage=t.usesInAverage),cu(n)}}var mN=e=>`..plots[${e}]`;function hN(e,t){let n=H(e,t);return n.length===1?n[0]:null}function gN(e,t){let n=0;for(let r of e.panes)for(let e of r.axes)for(let r of e.plots){if(r.uid===t)return n;n+=1}}function _N(e,t){return P(t.uid)?gN(e,t.uid):t.index}function vN(e){let t=C[e.type];return t===C.Symbol||t===C.Expression}function yN(e){let t=C[e.type];return t===C.Forward||t===C.Seasonal}function bN(e){let t=C[e.type];return t===C.Symbol||t===C.Expression||t===C.Seasonal}function xN(e,t,n){if(P(t))return t;let r=n?.uid;return typeof r==`string`?gN(e,r):void 0}function SN(e,t,n){if(P(t.placement)&&!dN.includes(t.placement))throw Error(`Unknown placement: ${t.placement}`);let r=_N(e,t),i=r===void 0?t.main?Vd:``:mN(r);if(!i)return e;let a=hN(e,i);if(!N(a)||N(t.type)&&a.type!==t.type)return e;let o=xN(e,r,a);if(t.type===C[C.Study]){let n=a,r=V(t.studyId??n.study);if(!N(r))return e;let i=P(t.basis)?t.basis:n.basis,o=Bd(e,r,i);if(!o.eligible)return I(`Cannot update study "${r.meta.title}" because ${o.reason}.`,`error`),e}if(N(t.visible))return a.visible=t.visible,e;if(a.main&&vN(a)){if(t.curves){let n=e=>e.curves[0].style===h[h.Range],[r,i]=[n(a),n(t)];r&&!i?e=ef(e,{unit:`Day`,size:1,spec:`None`}):!r&&i&&(e=ef(e,{unit:`Intraday`,size:100,spec:`PerRange`}))}t.type||=a.type;let n=a;P(t.precision)?n.precision=t.precision:delete n.precision,P(t.showPrevious)&&(e=U(e,Vd,e=>(e.showPrevious=t.showPrevious,e)));let r=t.curves?ed(e,t):e;return P(t.oppositeScale)&&bN(a)&&P(o)&&(r=Id(r,o,+!!t.oppositeScale)),r}else{let s=U(e,i,e=>(pN(e,t),e));if(P(t.oppositeScale)&&bN(a)&&P(o)&&(s=Id(s,o,+!!t.oppositeScale)),!(t.type===C[C.Study]&&P(t.placement)))return s;let c=P(r)?r:t.index,l=uN(s,{...t,index:c},n).find(e=>e.index===c);if(!P(l))return e;if(t.placement===l.placement)return s;let u=hN(s,i);if(!P(u))return e;s=cN(s,{id:`Delete`,plots:[{uid:u.uid,type:t.type}]});let d=AN(s,t.placement,t.cloneIndex,t.cloneUid);return d!==null&&d.plots.push(u),s}}function CN(e){return e!==void 0}function wN(e,t){if(CN(t)&&t.length===e.length)for(let n=0;n<e.length;++n){let r=t[n],i=e[n];lt(i,r);for(let e of[`shift`,`dashStyle`,`lineSmoothing`,`lineMarker`]){let t=r[e];P(t)&&(i[e]=t)}}}function TN(e,t,n){let r=dt(e),i=dt(t);lt(r,i);let a=ft(i);a.length>0&&(n.inputs=a)}function EN(){return{plots:[]}}function DN(e){let t=e.display.chart.newPaneHeight??1;return{axes:[EN()],height:t}}function ON(e){let t=DN(e);return e.panes.push(t),t}function kN(e,t){let n=N(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:ON(e),r=n.axes[0];return t.oppositeScale??!1?XN(n,r):r}function AN(e,t,n,r,i){let a=null,{mainPane:o,mainAxis:s}=Ud(e),c=(()=>{if(i?.kind!==`seasonal`)return null;for(let t of e.panes)for(let e of t.axes)for(let n of e.plots){if(n.uid!==i.uid||n.type!==`Seasonal`)continue;let r=n.offsets;if(Array.isArray(r)&&r.includes(i.offset))return{pane:t,axis:e}}return null})();switch(t){case`withMain`:a=c?XN(c.pane,c.axis):XN(o,s);break;case`overlay`:a=c?.axis??s;break;case`standalone`:a=ON(e).axes[0];break;case`clone`:{let t={main:!1,type:C[C.Study]};if(typeof r==`string`&&r.length>0?t.uid=r:typeof n==`number`&&(t.index=n),t.uid||typeof t.index==`number`){let n=uN(e,t).find(e=>e.type===C[C.Study]&&(t.uid?e.uid===t.uid:e.index===t.index));if(!n)break;a=H(e,`..panes[${n.paneIndex}]..axes[${n.axisIndex}]`)[0]}break}}return a}function jN(e,t){let n=V(t.studyId);if(!N(n))return I(`Unknown or unavailable study with the id '${t.studyId}'`,`error`),e;let r=Bd(e,n,t.basis);if(!r.eligible)return I(`Cannot add study "${n.meta.title}" because ${r.reason}.`,`error`),e;let i=t.placement||(n.meta.overlay?`overlay`:`standalone`),a=t.uid??bt();P(t.uid)&&jd(e,a);let o={uid:a,type:`Study`,study:t.studyId,visible:!0};i===`overlay`&&t.studyId===`VOL`&&(o.detachedScale=!0),t.curves!==void 0&&(o.curves=n.defaults.curves),pN(o,t);let s=AN(e,i,t.cloneIndex,t.cloneUid,t.basis);P(s)&&s.plots.push(o);let c=e.data.aggregation;return $d(e,c.unit===`Tick`&&c.spec===`None`)}function MN(e,t){e.panes.push({axes:[{plots:[t]}]})}function NN(e,t){let n=Hd(e);if(n.type!==C[C.Symbol])throw Error(`Cannot add fundamental to the chart whose main plot is not a Symbol plot.`);let r=n.symbol,i=t.uid??bt();P(t.uid)&&jd(e,i);let a={uid:i,curves:[{fields:[t.fundamentalId],lineWidth:2,style:`Line`,varyColorPerBar:!1,visible:!0,colors:[`#888`]}],fundamental:`Quarter`,symbol:r,type:b[G[t.fundamentalId].category],visible:!0};return pN(a,t),MN(e,a),e}var PN=[{fields:[G.Close.id],colors:[`#888`],style:`Line`,lineWidth:2,varyColorPerBar:!1,visible:!0}];function FN(e){return e.type===`Symbol`}function IN(e,t){let n=Hd(e),r=F(FN(n)?n.curves:PN),i=t.uid??bt();P(t.uid)&&jd(e,i);let a={uid:i,curves:r,expression:``,type:`Expression`,visible:!0};return pN(a,t),kN(e,t).plots.push(a),e}function LN(e,t){let n=t.uid??bt();P(t.uid)&&jd(e,n);let r={uid:n,curves:F(PN),offsets:[0],seasonal:``,type:`Seasonal`,visible:!0,main:!1};return pN(r,t),kN(e,t).plots.push(r),e}var RN={attributes:[`OpenVsClose`],colors:[`#b63400`,`#007f3e`,`#1664db`],fields:[`Open`,`High`,`Low`,`Close`,`Change`],style:`Candlestick`,varyColorPerBar:!0,lineWidth:1};function zN(e,t){let n=Hd(e),r=$().getDefaultMultiFieldCurve(),i=P(r)?r:RN,a=n.curves?.length,o=a===t.curves.length&&a===1?(e=>F(e?n.curves:[i]))(FN(n)):t.curves,s=t.uid??bt();P(t.uid)&&jd(e,s);let c={uid:s,curves:o,symbol:``,type:`Symbol`,visible:!0};return pN(c,t),kN(e,t).plots.push(c),e}function BN(e,t){switch(t.type){case`Study`:return jN(e,t);case`IncomeStatement`:case`BalanceSheet`:return NN(e,t);case`Expression`:return IN(e,t);case`Symbol`:return zN(e,t);case`Seasonal`:return LN(e,t);default:throw Error("Unexpected plot type '${type}', not supported currently")}}var VN=0,HN=B.AUTO_COLORS,UN=`Symbol`,WN=`Expression`,GN=`Seasonal`;function KN(e,t){let n={attributes:[],colors:HN.slice(VN,VN+1),fields:e?[G.Last.id]:[G.Close.id],style:`Line`,dashStyle:`Solid`,varyColorPerBar:!1,lineWidth:2,lineMarker:void 0,lineSmoothing:void 0},r={uid:t.uid??bt(),curves:[n]},{curves:i,oppositeScale:a,...o}=t;return ut(r,o),N(i)&&(r.curves=i.map(e=>{let t=F(e);return ut(t,n),t})),r.main=!1,VN=(VN+1)%HN.length,r}function qN(e){return P(e.symbols)&&(I(`Use of 'symbols' for Compare API is deprecated. Please see docs for the latest version which supports more plot types`,`warn`),e.plots=e.symbols.map(e=>(e.type=UN,e))),e.plots?.some(e=>P(e.leftScale))?(I(`Use of 'leftScale' for Compare API is deprecated. Please use 'oppositeScale'`,`warn`),e.plots.map(e=>{let t=e.leftScale;return delete e.leftScale,{...e,oppositeScale:t}})):e.plots}function JN(e,t){let n=qN(t),r=n.map(e=>e.uid).filter(e=>typeof e==`string`),i=new Set;for(let t of r){if(i.has(t))throw Error(`Plot uid '${t}' is duplicated in the Compare request.`);i.add(t),jd(e,t)}let{yes:a,no:o}=A(n,e=>e.oppositeScale??!1),{mainPane:s,mainAxis:c}=Ud(e);s.alignOnExpirations=t.alignOnExpirations||!1;let l=XN(s,c),u=e=>![UN,WN,GN].includes(e.type);l.plots=l.plots.filter(u);let d=c.plots.filter(e=>e.main||u(e)),f=e.data.aggregation.unit===`Tick`;VN=0;let p=se(KN,f);return c.plots=d.concat(o.map(p)),a.length>0&&(l.plots.push(...a.map(p)),l.comparison=c.comparison,l.scale=c.scale),Nf(e)}var YN=`..plots{(.type === "Symbol" || .type === "Expression" || .type === "Seasonal") && .main !== true}`;function XN(e,t){let n=e.axes.find(e=>e!==t);return P(n)||(n=EN(),e.axes.push(n)),n}function ZN(e,t){let n=H(e,YN),r=H(t,YN),i=Math.max(0,4-r.length);if(i===0)return t;let a=n.filter(e=>!r.find(t=>e.symbol===t.symbol)).slice(0,i);if(a.length===0)return t;let{mainPane:o,mainAxis:s}=Ud(t),{mainAxis:c}=Ud(e);return a.forEach(e=>{c.plots.includes(e)?s.plots.push(e):XN(o,s).plots.push(e)}),t}function QN(e,t){let n=e.panes;return n.splice(t.to,0,n.splice(t.from,1)[0]),e}var $N=()=>B.NULL_OBJECT;function eP(e){return U(e,`..axes.annotations`,$N)}function tP(e){return Nf(U(e,`..plots{.type === "Symbol" && .main !== true}`,$N))}function nP(e,t){let n=F(e);if(t.strip.main){let e=Hd(n),t=e.type.toLowerCase();e[t]=B.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(n=eP(n)),t.strip.compare&&(n=tP(n)),n=U(n,`.data`,e=>(e.range&&(delete e.range,e.checkRange=!0),e)),n}function rP(e,t,n){let r=uN(e,{main:!0},n)[0],i=r.title===B.PLACEHOLDER_SYMBOL_NAME,a=r.type===`Symbol`,o=r.type===`Expression`,s=yd(r.title),c=[];return o&&!vd(s)?c=s.symbols:i||(c=[r.title]),{isTemplate:i,isDefinition:!i,main:{isSymbol:a,isExpression:o,symbols:c,title:i?null:r.title},compare:H(e,YN).map(e=>e.symbol),annotations:H(e,`..annotations`).map(e=>e.id),studies:uN(e,{type:`Study`},n).map(e=>e.title)}}function iP(e,t,n){let r=H(e,`..panes`).map((e,t)=>H(e,`..axes`).map((e,n)=>H(e,`.annotations`).map(e=>({...e,paneIndex:t,axisIndex:n})))).flat(2).map((e,t)=>({...e,index:t}));return P(t.index)&&Number.isFinite(t.index)?t.index<r.length?[r[t.index]]:B.EMPTY_ARRAY:r}function aP(e,t){let n=oP(t.annotation),{mainAxis:r}=Ud(e);return r.annotations??=[],r.annotations.some(e=>e.uid===n.uid)||r.annotations.push(n),e}function oP(e){let t={id:e.id,uid:e.uid,points:(e.points??[]).map(e=>({price:e.price,time:e.time}))};return e.traits!==void 0&&(t.traits=F(e.traits)),e.visible!==void 0&&(t.visible=e.visible),e.locked!==void 0&&(t.locked=e.locked),t}function sP(e,t){let n=H(e,`..axes`);for(let e of n){let n=e.annotations?.find(e=>e.uid===t.uid);if(n){t.traits!==void 0&&(n.traits=F(t.traits)),t.points!==void 0&&(n.points=t.points.map(e=>({price:e.price,time:e.time}))),t.visible!==void 0&&(n.visible=t.visible),t.locked!==void 0&&(n.locked=t.locked);break}}return e}function cP(e,t){let n=H(e,`..axes`);for(let e of n)if(e.annotations?.some(e=>e.uid===t.uid)){e.annotations=e.annotations.filter(e=>e.uid!==t.uid);break}return e}function lP(e,t,n){let r=H(e,`..panes{${Vd}}.axes.comparison`)[0],i=e.display,a=(e,t)=>rt(e,!1,t,`visible`),o=e=>$e(a(i.xAxis,e),a(i.yAxis,e)),s=rt(i.chart,!0,`showLegend`);return{comparison:r,gridLines:o(`gridLines`),minorGridLines:o(`minorGridLines`),newPaneHeight:i.chart.newPaneHeight,showLastValue:i.yAxis.showLastValue,showLegend:s,showMinMaxArc:i.chart.showMinMaxArc,allAnnotationsLocked:i.allAnnotationsLocked,hiddenItems:AO(i),exprSkipLeadingEmpty:e.data?.exprSkipLeadingEmpty??!1,useLastTrade:e.data?.useLastTrade??!1,extendedHours:e.data?.extendedHours??!1,realTimeCboeBzx:e.data?.realTimeCboeBzx??!1,buildContinuation:e.data?.buildContinuation??!1}}function uP(e,t){let n=e,{backgroundColor:r,axis:{gridLinesColor:i,textColor:a,crosshairColor:o,gridLinesStyle:s},fontSize:c}=t,{chart:l,xAxis:u,yAxis:d}=c||{};if((r||l)&&(n=U(e,`.display.chart`,e=>(r&&(e.backgroundColor=r),l&&(e.fontSize=l),e))),i){let e=e=>(e.color=i,e);n=U(n,`.display.xAxis.gridLines`,e),n=U(n,`.display.yAxis.gridLines`,e),n=U(n,`.display.yAxis.minorGridLines`,e)}if(s){let e=e=>(e.dashStyle=s,e);n=U(n,`.display.xAxis.gridLines`,e),n=U(n,`.display.yAxis.gridLines`,e),n=U(n,`.display.yAxis.minorGridLines`,e)}if(a){let e=e=>(e.textColor=a,e);n=U(n,`.display.xAxis`,e),n=U(n,`.display.yAxis`,e)}if(o){let e=e=>(e.color=o,e);n=U(n,`.display.xAxis.crosshair`,e),n=U(n,`.display.yAxis.crosshair`,e)}if(u||d){let e=e=>t=>(t.fontSize=e,t);u&&(n=U(n,`.display.xAxis`,e(u))),d&&(n=U(n,`.display.yAxis`,e(d)))}return n}function dP(e,t,n){let{chart:r,xAxis:i,yAxis:a}=e.display||{},{fontSize:o,backgroundColor:s}=r||{},{fontSize:c,gridLines:l,textColor:u,crosshair:d}=i||{},{color:f,dashStyle:p}=l||{},{fontSize:m}=a||{},{color:h}=d||{};return{backgroundColor:s,axis:{gridLinesColor:f,textColor:u,crosshairColor:h,gridLinesStyle:p},fontSize:{chart:o,xAxis:c,yAxis:m}}}function fP(e,t,n){let{mainAxis:r}=Ud(e),i=H(e,`.display.xAxis`)[0],a=H(e,`.display.yAxis`)[0];return{scale:r.scale,marginBars:i.marginBars??0,horizontalAxisPosition:i.position??`bottom`,preventLabelOverlap:a.preventLabelOverlap,preventVerticalLabelOverlap:a.preventLabelOverlap,preventHorizontalLabelOverlap:i.preventLabelOverlap,snapAnnotationsToPrices:a.snapAnnotationsToPrices,primaryOnTheLeft:a.primaryOnTheLeft??!1,nonEodLabelWithDate:i.nonEodLabelWithDate??!1,includePercentChangeWithLastValue:a.includePercentChangeWithLastValue??!1,ordinalName:i.ordinalName??``,contractTransition:i.contractTransition,cycleTransition:i.cycleTransition}}function pP(e,t,n){let r=t=>H(e,t)[0],i=r(`.display.chart`),a=r(`.display.xAxis.crosshair`),o=r(`.display.yAxis.crosshair`),s=`none`;return a.enabled&&o.enabled?s=`both`:a.enabled?s=`vertical`:o.enabled&&(s=`horizontal`),{crosshair:s,horizontal:{color:o.color,dashStyle:o.dashStyle},vertical:{color:a.color,dashStyle:a.dashStyle},haloTracking:i.plotHover}}function mP(e,t,n){return F(e.data.aggregation)}function hP(e,t){let n=H(e,YN),{mainPane:r,mainAxis:i}=Ud(e),a=[];for(let e of n){let t=!i.plots.includes(e),n=e.type.toLowerCase(),r={curves:F(e.curves),type:e.type,[n]:e[n],oppositeScale:t,leftScale:t};a.push(r)}return{plots:a,alignOnExpirations:r.alignOnExpirations}}function gP(e,t,n){let{paneIndex:r,annotations:i,studies:a}=t||{},o=`..panes${Number.isInteger(r)?`[${r}]`:``}`,s=e,c=e=>B.NULL_OBJECT;return i===!0&&(n.allAnnotations.forEach(e=>n.onAnnotationModifiedByTool(e,O.Deleted,!1)),s=U(s,`${o}..annotations`,c)),a===!0&&(s=U(s,`${o}..plots{.type=="Study"}`,c)),s=Nf(s),s}var _P=`.display.chart.previous`;function vP(e,t,n){return H(e,_P)[0]}function yP(e,t,n){return U(e,_P,e=>(lt(e,t),e))}function bP(e,t,n){let r=[],i=_N(e,t);if(i===void 0||hN(e,mN(i))?.type!==t.type)return r;let a=Nd(e,i);if(a===null)return r;let o=a.pane,s=o===0,c=o===e.panes.length-1,l=e.panes[o].axes.reduce((e,t)=>e+t.plots.length,0)===1;return s||r.push(`ExistingAbove`),l||r.push(`NewAbove`),c||r.push(`ExistingBelow`),l||r.push(`NewBelow`),r}function xP(e,t,n){if(!bP(e,t,n).includes(t.targetPane))return e;let r=_N(e,t);if(r===void 0)return e;let i=Nd(e,r);if(i===null)return e;let a=hN(e,mN(r));e.panes[i.pane].axes[i.axis].plots.splice(i.plot,1);let o=i.pane,s=!0;switch(t.targetPane){case`ExistingAbove`:o--;break;case`NewAbove`:e.panes.splice(o,0,DN(e)),s=!1;break;case`ExistingBelow`:o++;break;case`NewBelow`:o++,s=!1,e.panes.splice(o,0,DN(e));break}let{mainPane:c}=Ud(e),l=e.panes[o]===c;s&&l&&a?.type===`Study`&&a.study===`VOL`&&(a.detachedScale=!0);let u=e.panes[o];u.axes.length<2&&u.axes[0].plots.length>0&&u.axes.push(EN());let d=u.axes.findIndex(e=>e.plots.length===0),f=d===-1?u.axes.length-1:d;u.axes[f].plots.push(a);let p=Fd(e,i.pane);return p=Fd(p,o),Nf(p)}function SP(e,t,n){return P(t.period)&&t.period&&(delete e.display.period,Qd(e),n&&(n.forceResetVisibleRange=!0)),e}function CP(e,t,n){let r=[],i=_N(e,t);if(i===void 0)return r;let a=hN(e,mN(i));if(a?.type!==t.type)return r;let o=Nd(e,i);if(o===null)return r;let s=e.panes[o.pane],c=o.axis===0,l=s.axes.some((e,t)=>e.plots.some((e,n)=>!(t===o.axis&&n===o.plot)&&!e.detachedScale)),u=a.detachedScale===!0;return(c||u)&&r.push(`SecondaryAxis`),(!c||u)&&r.push(`PrimaryAxis`),l&&r.push(`NoAxis`),r}function wP(e,t,n){if(!CP(e,t,n).includes(t.targetAxis))return e;let r=_N(e,t);if(r===void 0)return e;let i=-1;switch(t.targetAxis){case`PrimaryAxis`:i=0;break;case`SecondaryAxis`:i=1;break;case`NoAxis`:return Ld(e,r)}return Id(e,r,i)}function TP(e,t,n){let r=H(e,`.display.tooltip`)[0];return{visible:r.visible,mode:r.mode,showMainTitle:r.showMainTitle,mainTitle:r.mainTitle}}var EP=`..plots{.type === "Seasonal" && .main === true}`,DP=`..plots{.type === "Seasonal" && .main !== true}`,OP=B.AUTO_COLORS;function kP(e){return JSON.parse(JSON.stringify(e))}function AP(e,t){let n=H(e,EP);if(n.length===0)return e;let r=n[0];if(!r.offsets||r.offsets.length===0)return e;let i=r.offsets,a=H(e,DP);for(let e of a){let t=e.offsets??[],n=e.curves??[],r=new Map;t.length===n.length?t.forEach((e,t)=>{let i=n[t];i&&r.set(e,kP(i))}):n.forEach((e,t)=>{let n=i[t];e&&P(n)&&r.set(n,kP(e))});let a=r.get(0);a?.colors?.[0];let o=i.map((e,t)=>{let n=r.get(e);if(n)return n;let i=OP[t%OP.length];return{...a?kP(a):{},colors:[i],fields:[`Close`],style:`Line`,dashStyle:`Solid`,varyColorPerBar:!1,lineWidth:2}});e.offsets=[...i],e.curves=o}return Nf(e)}var jP={MainPlot:Zd,Aggregation:{Update:ef,Get:mP},Period:{Update:Gu,Delete:SP},Crosshair:{Update:nN,Get:pP},Tooltip:{Update:rN,Get:TP},Events:iN,Scale:{Update:aN,Get:fP},Other:{Update:oN,Get:lP},Plot:{Add:BN,Get:uN,Delete:cN,Update:SN},Compare:{Update:JN,Get:hP},AnnotationManipulation:{Get:$M,Update:tN},Annotation:{Get:iP,Add:aP,Update:sP,Delete:cP},MovePane:QN,Template:nP,Outline:rP,Theme:{Update:uP,Get:dP},Clear:gP,Previous:{Update:yP,Get:vP},MovePlot:{Update:xP,Get:bP},PinPlot:{Update:wP,Get:CP},SeasonalOffsets:{Update:AP}};function MP(e){return typeof e==`function`}function NP(e,t){let n=jP[e];if(MP(n))return n;{let e=t===void 0?void 0:n[t];if(!MP(e)&&(e=n[B.DEFAULT_ACCESSOR_SUBACTION],!MP(e)))throw Error(`Invalid accesor id and/or sub id`);return e}}function PP(e,t,n){return NP(e.id,e.context.id)(t,e.context,n)}function FP(e){return{id:`MainPlot`,context:e}}var IP={id:`SeasonalOffsets`,context:{}};function LP(e){return Array.isArray(e)&&e.some(e=>e?.type===`Seasonal`)}function RP(e){let{id:t,context:n}=e;if(!P(n))return!1;if(t===`Compare`)return LP(n.plots);if(t!==B.ACTION_PLOT)return!1;let r=n.id;return r===`Add`||r===`Update`?n.type===`Seasonal`:r===B.ACTION_DELETE?LP(n.plots):!1}function zP(e){return e.some(RP)?e[e.length-1]?.id!==`SeasonalOffsets`:!1}var BP={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},VP=Symbol.for(`__ias__`),HP=class{headless;presenter;_model;constructor(e=!1){this.headless=e,this.presenter=e?null:new qM(this)}get elementId(){return this.headless?null:this.presenter?.elementId??null}get hostElement(){return this.headless?null:this.presenter?.hostElement??null}initialize(e,t=null){if(this.headless){I(`You cannot initialize a headless chart.`,`error`);return}if(this.presenter.initialize(e),N(t)){let e=typeof t==`string`;e?I(`Initializing the chart with symbol name is deprecated. Please use object form instead (see docs for details). This API will be removed in the future.`,`warn`):(t.template&&this.load(t.template),delete t.template);let n=e?{symbol:t}:t;this.change(FP(n))}}shutdown(){if(!this.headless){let e=this.presenter?.shutdown();return this.presenter=null,e}return!1}annotate(e,t=null,n=null){if(!this.headless)if(P(e)){Dl(e,t),El(e,t);let r=gj(e,!1,t,n,this.presenter);r.isDrawingAnnotation&&this.presenter.view.setCursor(ee.Crosshair),this.presenter.activeTool=r,Ie()||this.presenter.view.mouseCanvas.focus({preventScroll:!0})}else this.presenter.resetActiveTool()}cancelAnnotation(){this.headless||this.presenter.resetActiveTool()}setMainAxisAnnotations(e){let t=this.presenter?.mainAxis;P(t)&&(t.annotations=e.map(e=>t.makeAnnotation(e)),t.fireAnnotationsChanged(),this.presenter.view?.redraw())}toMainAxisPoint(e){let t=this.presenter?.mainAxis;if(!P(t))return null;let n=t.toAnnotationPoint(e);return{price:n.price,time:n.time}}fromMainAxisPoint(e){let t=this.presenter?.mainAxis;if(!P(t))return null;let n=t.toX(new Date(e.time)),r=t.toY(e.price);return!P(n)||!P(r)?null:{x:n,y:r}}zoom(e){!this.headless&&typeof e==`boolean`&&(e?this.annotate(`ZoomIn`):this.presenter.defaultTool.resetView(this.presenter))}getDefaultTemplate(){return pF()}get model(){return(this.headless?this._model:this.presenter.getModel())||pF()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:B.ACTION_TEMPLATE,context:{strip:e}})}change(...e){if(e.length>1&&e.some(e=>e.id===`AnnotationManipulation`))throw Error(`AnnotationManipulation must be executed as a standalone action`);let t={chart:this,actions:e.filter(e=>!e[VP])};t.actions.length>0&&this.presenter?.notifyHost(K.CH_API_ACTIONS_RECEIVED,t);let n=$().config.validateInput,r=e.map(e=>n?Mf(e,B.ACCESSOR_SCHEMA):e);if(r.length===1){let e=r[0];if(e.id===B.ACTION_TEMPLATE||e.context.id===B.ACTION_GET)return PP(e,this.model,this.presenter);if(!this.headless&&e.id===`AnnotationManipulation`){PP(e,this.model,this.presenter);return}else if(!this.headless&&e.id===B.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}let{yes:i,no:a}=A(r,e=>e.id===B.ACTION_PLOT&&P(e.context)&&e.context.id===B.ACTION_DELETE),o=F(this.model),s=F(this.model),c=a;i.length>0&&c.push({id:B.ACTION_PLOT,context:{id:B.ACTION_DELETE,plots:i.map(e=>e.context)}}),c.forEach(e=>{if(s=PP(e,s,this.presenter),!P(s))throw Error(`Forgot to return model from accessor`)}),zP(c)&&(s=PP(IP,s,this.presenter)),this.fromModel(s,o)}async fromModel(e,t){let n=Mf(e,B.CHART_SCHEMA);this.headless?this._model=n:await this.presenter?.fromModel(n,t)}async load(e,t){let n={...BP,...t},r=Mf(JSON.parse(e),B.CHART_SCHEMA),i=this.model,a=F(i);if(P(i)){if(r=Wd(i,r,n.keepNewAnnotations),n.keepNewAnnotations||(r=eP(r)),n.keepOldAnnotations&&(r=SM(i,r)),n.keepNewCompare||(r=tP(r)),n.keepOldCompare&&(r=ZN(i,r)),n.keepOldAggregation){let e={id:B.ACTION_AGGREGATION,context:i.data.aggregation},t=r.display.density;r=PP(e,r,this.presenter),n.keepNewBarWidth&&P(t)&&(r.display.density=t)}await this.fromModel(r,a),this.clearUndoRedo()}}save(){return JSON.stringify(this.model)}clearUndoRedo(){!this.headless&&this.presenter?.undoRedoManager&&this.presenter.undoRedoManager.clear(!0)}reset(e=!0){let t=pF();if(this.headless)this._model=t;else if(this.presenter.getModel()){let n=this.presenter.mainPlot,r=null,i=n;if(n.isSymbol?r={symbol:i.symbol}:n.isExpression?r={expression:i.expression}:n.isForward?r={forward:i.forward}:n.isSeasonal&&(r={seasonal:i.seasonal}),P(r)){let n=PP({id:`Theme`,context:{id:`Get`}},this.model,this.presenter),i=PP(FP(r),t,this.presenter);e&&(i=PP({id:`Theme`,context:n},i,this.presenter)),this.presenter?.fromModel(i)}}this.clearUndoRedo(),this.presenter?.notifyHost(K.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){I(`Obsolete: please use 'exportImage' method instead.`,`warn`)}setTitle(e){this.headless||this.presenter.setTitle(e)}getPaneBounds(e=!0){if(!this.headless)return this.presenter.panes.map(t=>e?t.getBounds():t.getBoundsWithoutScales())}exportData(e={}){return this.headless?null:UM.call(this.presenter,e)}exportTable(e={}){return this.headless?null:RM.call(this.presenter,e)}exportImage(e={}){return this.headless?null:WM.call(this.presenter,e)}getDataStats(){return this.presenter.getDataStats()}get canUndo(){return!this.headless&&(this.presenter?.undoRedoManager?.canUndo??!1)}get canRedo(){return!this.headless&&(this.presenter?.undoRedoManager?.canRedo??!1)}undo(){this.canUndo&&this.presenter?.undoRedoManager?.undo()}redo(){this.canRedo&&this.presenter?.undoRedoManager?.redo()}pauseUndoRedo(){this.headless||this.presenter?.undoRedoManager?.pause()}resumeUndoRedo(e){this.headless||this.presenter?.undoRedoManager?.resume(e)}priceToY(e,t=0,n=0){let r=this.presenter;if(this.headless||t<0||n<0||t>r.panes.length)return null;let i=r.panes[t];return n>i.axes.length?null:i.axes[n].toY(e)}yToPrices(e){let t=this.presenter;if(this.headless)return null;for(let[n,r]of t.panes.entries()){let t=r.getBounds();if(P(t)&&e>=t.y&&e<=t.y+t.height)return{pane:n,prices:r.axes.map(t=>t.toPrice(e))}}return{pane:-1,prices:[]}}activate(){this.presenter?.notifyHost(K.CH_DIDBECOMEACTIVE,{chart:this})}};function UP(e){let t=e.split(`.`);if(!t||t.length!==4)return!1;let n=t.map(Number);if(!n.every(e=>Number.isFinite(e)&&e>=0&&e<=255))return!1;let[r,i]=n;return r===10||r===172&&i>=16&&i<=31||r===192&&i===168}function WP(){let e=globalThis.parent?.location?.hostname||``;return[``,`localhost`,`127.0.0.1`].includes(e)||UP(e)}function GP(){let e=document.domain,t=e.split(`.`),n=`__tld`+new Date().getTime(),r=0;for(;r<t.length-1&&document.cookie.indexOf(`${n}=${n}`)===-1;)e=t.slice(-1-++r).join(`.`),document.cookie=`${n}=${n};domain=${e};`;return document.cookie=`${n}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=${e};`,e}function KP(e,t){return ot(t),`${e}/?${new URLSearchParams(t).toString()}`}var qP=`aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ==`,JP=`YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy`;function YP(e,t=``){return KP(atob(qP),{module:atob(JP),secret:t,referer:e})}function XP(e,t){return e+Math.random()*(t-e)}var ZP=Function(atob(`Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg`)),QP=Function(`f`,atob(`Zi5yZW1vdmVBbGxDaGFydHMoKTsg`)),$P=Function(`m`,atob(`cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiIHx8IG0gPT09ICJFcVBsdXMiOw==`)),eF=`YXV0aG9yaXplZA==`,tF=`ZGF0YS1lbmRwb2ludA==`,nF=`YWxsb3dDcmVkZW50aWFscw==`;async function rF(e,t){if(t&&!$P(e.mode))return;let n=!1,r=0,i=25;for(;!n&&r<5;){let t=WP()||e.mode===`FreeWidget`,a=t?e.apiKey:``;try{let i=YP(t?``:GP(),a),o=await fetch(i);if(!o.ok)r++;else{let t=await o.json(),r=t[atob(eF)];e.knownSite=r,r?(e.dataEndpoint=(t[atob(tF)]||``).replace(/\/$/g,``),e.allowCredentials=t[atob(nF)]):(e.dataEndpoint=``,e.allowCredentials=!1),n=!0;break}}catch{}r++,i*=2,await new Promise(e=>setTimeout(e,i))}(!n||!e.knownSite)&&iF()}function iF(){setTimeout(ZP,XP(2e3,3e3)),setTimeout(()=>QP($()),XP(4e3,5e3))}var aF={major:2,minor:403,patch:0,prerelease:!1},oF={environment:`Browser`,validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${B.CHART_DEFINITION}`,cachedAnnotationsCount:0,showResizeHandles:!1,scrollBehavior:`wheel+shift`,bypassSmoothing:!1,showGoToLatest:void 0,tooltipMovement:`Auto`,tooltipHeaders:void 0,touchCrosshairTimeoutMillis:void 0,touchCrosshairDelayMillis:void 0,mode:`Unspecified`,hostingModel:`Page`,overrides:void 0,logo:void 0,logoClickable:void 0,noDataText:void 0,useAllFieldsForComparison:void 0,colorfulAnnotations:!1,annotationManipulation:void 0,baseUrl:{instruments:`/proxies/instruments`,futures:`/proxies/futures`,extras:`/extras`,timeseries:`/proxies/timeseries`,timeseriesNew:`/proxies/new-timeseries`,ondemand:`/proxies/ondemand`,options:`/proxies/core-api`},credentials:void 0,apiKey:void 0,extensions:void 0,defaultVolumeBarColoring:void 0,defaultMainPlotBarColoring:void 0,async fetch(e,t){let n=this.baseUrl[e],r=`${n}${t}`;if($P(this.mode)&&this.knownSite){let{username:i,password:a}=this.credentials||{},o=P(i,a),s=(e===`timeseries`||e===`timeseriesNew`)&&o&&this.allowCredentials?`&username=${i}&password=${a}`:``;r=`https://${this.dataEndpoint}${n}${t}${s}`}return await(await fetch(r)).text()},getCustomEventPopup:e=>null};async function sF(e,t){let n=$()?.config;if(!n||!n.fetch)throw Error(`You should call initFeed first`);let r=t;return e===`timeseries`?r=`/historical${t}`:e===`options`&&(r=`/options-historical${t}`),await n.fetch.call(n,e,r)}var cF=!1,lF=null;function uF(){let e=aF,t=e.prerelease?`-${e.prerelease.identifier}.${e.prerelease.ordinal}`:``;return`${e.major}.${e.minor}.${e.patch}${t}`}function dF(e){let t=e.extensions?.studyProvider;if(!P(t))return;let n=t.getFields(),r=t.getStudies(),i=F(Xs(B.CHART_SCHEMA)),a=i.definitions,o=a.studyField.enum,s=a.study.enum;for(let e of n)if(o.includes(e.id))throw Error(`Field with id ${e.id} already exists`);for(let e of r)if(s.includes(e.id))throw Error(`Study with id ${e.id} already exists`);o.push(...n.map(e=>e.id)),s.push(...r.map(e=>e.id)),Of(B.CHART_SCHEMA,i),Rf(n),tc(r)}function fF(e,t={}){if(cF)throw Error(`You should only call initFeed once during page's lifetime`);cF=!0;let n=Object.assign(oF);return lt(n,t),N(n.logo)&&Rk(n.logo,n.logoClickable??!1),dF(n),lF=new e(n),lF.version=uF(),I(`%cBarchart Chart version ${lF.version}`,`info`,`font-size: larger`),lF.cachesData&&(lF.subject?.subscribe(lF.onPerformInternalGc.bind(lF)),$y.default.subscribe(K.CH_ALL,lF.onChartChanged.bind(lF))),lF}function $(){return lF}function pF(){return F($()?.template)}function mF(){N(lF)&&(lF.shutdown(),cF=!1,lF=null)}function hF(){return new HP(!0)}function gF(e){let t=hF();return t.load(e),t.change({id:`Outline`,context:{id:`Get`}})}function _F(e,t,n,r=null){return new Proxy(e,{get:function(e,i,a){return i===t?function(t){let a=r?t[r]:t;return(n.handlesRequestsFor(a)?n:e)[i](t)}:Reflect.get(e,i,a)}})}var vF=class{config;version;cachesData;timeSeriesSource;metaDataSource;recordSource;charts;pendingRedraw;template;ongoingAnimationCallbackId;_altDataSource;_subject;knowDefaultCurve;defaultOhlcCurve;knowDefaultAggregation;defaultAggregation;knowDefaultPeriod;defaultPeriod;knowDefaultDensity;defaultDensity;id;_mainFeed=null;onBrowserOnline;constructor(e){this.config=e,this.timeSeriesSource=this.metaDataSource=this.recordSource=null,this.charts=new Map,this.pendingRedraw=new Set,this.ongoingAnimationCallbackId=null,this.drawCharts=this.drawCharts.bind(this),this.template=null,this.cachesData=!1,this._altDataSource=null,this._subject=null,this.id=bt(),this.onBrowserOnline=()=>{!this.cachesData||this.isAuxiliary||(this.traceFeed(`refresh:online`),this.refreshCaches())},globalThis.addEventListener?.(`online`,this.onBrowserOnline)}traceFeed(e,t={}){Ih(e,{feedId:this.id,isAuxiliary:this.isAuxiliary,...t})}get subject(){return!this.isAuxiliary&&!N(this._subject)&&(this.traceFeed(`gc:stream:init`,{gcMillis:B.INTERNAL_GC_MILLIS}),this._subject=new $p().pipe(Fm(B.INTERNAL_GC_MILLIS),Pm(e=>e.length>0))),this._subject}get isAuxiliary(){return window.opener!==null}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=_F(this.timeSeriesSource,`getTimeSeries`,e,`symbol`),this.metaDataSource=_F(this.metaDataSource,`getMetaData`,e),this.recordSource=_F(this.recordSource,`getRecord`,e)}replaceDataSources(e){this._altDataSource=e._altDataSource,this.timeSeriesSource=e.timeSeriesSource,this.metaDataSource=e.metaDataSource,this.recordSource=e.recordSource}getAltDataSource(){return this._altDataSource}getTimeSeriesDataSource(){if(!N(this.timeSeriesSource))throw Error(`No time series source defined`);return this.timeSeriesSource}getMetaDataSource(){if(!N(this.metaDataSource))throw Error(`No metadata source defined`);return this.metaDataSource}getRecordSource(){if(!N(this.recordSource))throw Error(`No record source defined`);return this.recordSource}async ready(){return da.call(this,async()=>{let e=this instanceof CF||this instanceof yF||this instanceof EF;await rF(this.config,e);let t=this.config.defaultTemplate;if(!t)throw Error(`Must provide a default template`);return typeof t==`string`&&(t=await(await fetch(t)).json()),this.template=Mf(t,B.CHART_SCHEMA),!0})}getHeadlessChart(){return hF()}fixupRenderTo(e){if(!N(e))return null;if(e instanceof HTMLElement)return e;let t=na(`#${e}`);if(N(t))return t;let n=[...this.charts.keys()].find(t=>t.id===e);return N(n)?n:null}checkChart(e,t){let n=this.fixupRenderTo(e),r=N(n)&&this.charts.has(n);return N(t)&&t!==r&&I(`There is ${t?`no`:`already a`} chart inside the element ${e}`,`error`),n}addChart(e,t=null){let n=this.checkChart(e,!1),r=new HP;return this.charts.set(n,r),r.initialize(e,t),r}removeChart(e){let t=this.checkChart(e,!0);N(t)&&(this.charts.get(t).shutdown(),this.charts.delete(t))}removeAllCharts(){for(let e of this.charts.keys())this.removeChart(e)}getChart(e){let t=this.checkChart(e);return N(t)?this.charts.get(t):null}redraw(e){let t=this.checkChart(e,!0);N(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),N(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach(e=>{let t=this.getChart(e);if(!N(t?.presenter?.view))return;let n=t.presenter.view;n.isHostElementVisible&&n.draw()}),this.pendingRedraw.clear()}get emptyEntities(){return{metaData:new Set,records:new Set,timeSeries:new Set}}getAllCacheableEntities(e){for(let t of this.charts.values())t.presenter.getCacheableEntities(e)}getCacheableEntities(){let e=this.emptyEntities;return this.getAllCacheableEntities(e),e.timeSeries.forEach(t=>{N(t)&&(N(t.record)&&e.records.add(t.record),N(t.records)&&Object.values(t.records).forEach(t=>e.records.add(t)))}),e}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){let e=this.getCacheableEntities();this.traceFeed(`refresh:caches`,{metaData:e.metaData.size,records:e.records.size,timeSeries:e.timeSeries.size}),this.getMetaDataSource().refresh?.(),this.getRecordSource().refresh?.(e.records),e.timeSeries.forEach(e=>{e.isCached||e.refresh()}),this.getTimeSeriesDataSource().refresh(),Ge(K.DF_STREAMRECONNECTED,{})}evictUnused(e){this.getMetaDataSource().evictUnused(e.metaData),this.getRecordSource().evictUnused(e.records),this.getTimeSeriesDataSource().evictUnused(e.timeSeries)}onPerformInternalGc(){let e=this.getCacheableEntities();this.traceFeed(`gc:run`,{chartCount:this.charts.size,metaData:e.metaData.size,records:e.records.size,timeSeries:e.timeSeries.size}),this.evictUnused(e)}triggerGc(e=`unknown`){this.traceFeed(`gc:request`,{reason:e}),this.subject?.next()}onChartChanged(e,t){(e===K.CH_RECREATED||e===K.CH_SHUTDOWN)&&(this.isAuxiliary?this._mainFeed?.triggerGc(`${e}:aux:${this.id}`):this.triggerGc(e))}getDefaultMultiFieldCurve(){if(!N(this.template))return null;if(!this.knowDefaultCurve){let e=Hd(this.template);e.curves.length===1&&Ku(e.curves[0].style)?this.defaultOhlcCurve=F(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=F(this.template.data.aggregation),this.knowDefaultAggregation=!0),this.defaultAggregation}getDefaultPeriod(){return!this.knowDefaultPeriod&&this.template&&(this.defaultPeriod=this.template.display?.period,this.knowDefaultPeriod=!0),this.defaultPeriod}getDefaultDensity(){return!this.knowDefaultDensity&&this.template&&(this.defaultDensity=this.template.display?.density,this.knowDefaultDensity=!0),this.defaultDensity}shutdown(){globalThis.removeEventListener?.(`online`,this.onBrowserOnline),this.isAuxiliary||this.clearCaches(),this.removeAllCharts()}},yF=class extends vF{constructor(e){super(e),this.timeSeriesSource=new D_(!1),this.metaDataSource=new Ja,this.recordSource=new Bh}},bF=class extends vF{constructor(e){super(e),this.timeSeriesSource=new D_(!0),this.metaDataSource=new Ja,this.recordSource=new Vh}},xF=class extends vF{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new D_(!0),this.metaDataSource=new Ja,this.recordSource=new Bh}},SF=[`drazen.dotlic@barchart.com`,`princec`,`b.hebert24@barchart.com`],CF=class extends vF{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;_connection;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new D_(!0),this.metaDataSource=new Ya,this.recordSource=new Hh,this.onEvents=this.onEvents.bind(this),this.onTimestamp=this.onTimestamp.bind(this),this.resetStreamingState()}resetStreamingState(){this.lastStreamingTimestamp=null,this._isActivelyStreaming=null,this.needToResubscribe=!1}get connection(){return this._connection}set connection(e){this._connection=e,N(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){N(this._isActivelyStreaming)&&!this._isActivelyStreaming&&e&&(this.debug(`need to refresh caches`),this.refreshCaches()),this._isActivelyStreaming=e}get isActivelyStreaming(){return this._isActivelyStreaming}initializeStreaming(){this.resetStreamingState(),this.connection.on(`events`,this.onEvents),this.connection.on(`timestamp`,this.onTimestamp)}onTimestamp(e){this.isActivelyStreaming&&(this.lastStreamingTimestamp=e)}debug(e){this.connection&&SF.includes(this.connection._username)&&I(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===B.BC_EVENT_DISCONNECTED||e===B.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):(e===B.BC_EVENT_LOGGED_IN||e===B.BC_EVENT_FEED_RESUMED)&&(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),N(this._connection)&&(this.connection.off(`timestamp`,this.onTimestamp),this.connection.off(`events`,this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}};function wF(e,t){return new TF(e,t)}var TF=class{_client;_subscriptions=new Map;_listeners=new Set;constructor(e,t){this._client=e;let n=e=>e.find(e=>this._subscriptions.has(e))??null;t.onConnected=()=>{this._listeners.forEach(e=>e?.onConnected())},t.onMessageWithMetadata=(e,t)=>{let r=e.marketSnapshot;if(N(r)){let e=n(t);e!==null&&this._listeners.forEach(t=>t.onSnapshot?.(r,e))}let i=e.marketUpdate;if(N(i)){let e=n(t);e!==null&&this._listeners.forEach(t=>t.onUpdate?.(i,e))}},t.onDisconnected=()=>{this._listeners.forEach(e=>e?.onDisconnected())},t.onHeartBeat=e=>{this._listeners.forEach(t=>t.onHeartBeat?.(e))}}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}async ready(){return N(await this._client.connection)}shutdown(){N(this._client)&&(this._client.dispose(),this._subscriptions.clear(),this._listeners.clear())}subscribeToRealTime(e){if(this._subscriptions.has(e)||!N(this._client))return;let t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribeFromRealTime(e){if(!this._subscriptions.has(e)||!N(this._client))return;let t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e)}async getInstrument(e){return await(await this._client.connection)?.getInstrument(e)??[]}},EF=class extends vF{_adapter=null;_auxFeeds=[];constructor(e){super(e),this.cachesData=!0,this.isAuxiliary||(this.timeSeriesSource=new D_(!0),this.metaDataSource=new Xa,this.recordSource=new Uh,$y.default.subscribe(K.TS_ALL,this.onTimeSeriesMessage.bind(this)))}onTimeSeriesMessage(e,t){if(!this.isAuxiliary)for(let n of this._auxFeeds)n.notifySeriesMessage(e,t)}notifySeriesMessage(e,t){this.isAuxiliary&&Ge(e,t)}getAdapter(){return this.isAuxiliary?this._mainFeed?._adapter:this._adapter}setAdapter(e){if(this.isAuxiliary)throw Error(`Cannot set adapter on auxiliary feed`);this._adapter=e,this._adapter.addListener(this)}async ready(){if(this.isAuxiliary){let e=await this._mainFeed?.ready()??!1;return e&&(this.template=this._mainFeed.template),e}return await super.ready(),await this._adapter?.ready()??!1}subscribe(e){this.traceFeed(`openfeed:subscribe`,{symbol:e}),this.getAdapter()?.subscribeToRealTime(e)}unsubscribe(e){this.traceFeed(`openfeed:unsubscribe`,{symbol:e}),this.getAdapter()?.unsubscribeFromRealTime(e)}shutdown(){super.shutdown(),this.isAuxiliary?(this._mainFeed?.removeAuxFeed(this),this._mainFeed=null):this._adapter?.shutdown()}onConnected(){this.refreshCaches()}onDisconnected(){}onHeartBeat(){}onUpdate(e,t){this.ofRecordSource.onUpdate(e,t)}onSnapshot(e,t){this.ofRecordSource.onSnapshot(e,t)}get ofRecordSource(){return this.recordSource}replaceDataSources(e){super.replaceDataSources(e),this._mainFeed=e}addAuxFeed(e){e.replaceDataSources(this),this._auxFeeds.push(e),this._adapter?.addListener(e)}removeAuxFeed(e){let t=this._auxFeeds.findIndex(t=>t.id==e.id);t!==-1&&(this._auxFeeds.splice(t,1),this._adapter?.removeListener(e),this.triggerGc(`removeAuxFeed:${e.id}`))}getAllCacheableEntities(e){if(super.getAllCacheableEntities(e),!this.isAuxiliary)for(let t of this._auxFeeds)t.getAllCacheableEntities(e)}},DF=$y.default;export{Ru as Aggregation,_ as AggregationSpec,g as AggregationUnit,yF as BarchartSiteDataFeed,vF as BaseDataFeed,zh as BaseRecordSource,re as ChunkPart,v_ as ContainerWrapperTimeSeries,mM as CustomEventPopup,Gf as EmptyRecord,u as ExpressionMissingBar,f as ExpressionNoDataApproach,d as ExpressionRecompute,tb as ExpressionSeries,Ff as Field,b as FieldCategory,y as FieldFormat,v as FieldValueType,G as Fields,CF as MarketDataFeed,xF as MiniWidgetDataFeed,hg as OHLCDataPointBuilder,EF as OpenFeed,DF as PubSub,w as SeriesKind,bF as SnapshotDataFeed,J as StudySeries,_g as TimeSeriesContainer,Qy as TimeSeriesQuery,K as Topics,wF as adaptOpenFeedClient,sa as appendDOMElement,da as asyncReady,cc as canBeBasedOnSeasonal,Z as convertSeries,HM as convertTableToCsv,lg as dateToOptionValue,Td as doesExpressionHaveComputation,oc as doesStudyExist,bd as evaluateExpression,Cd as formatExpression,Ia as formatPriceWithDecimals,bt as generateUid,ic as getAnnotationTraits,gF as getChartOutline,La as getCombinedMetaData,wd as getExpressionSymbols,$ as getFeed,bo as getLightness,xj as getStudyOptions,pc as getTaxonomies,Hi as hasOpenInterest,fF as initFeed,QD as linReg,eb as makeExpression,q as makeHelperField,DD as makeStudy,Q as mapSeries,Y as movAvg,X as movExp,MD as movHul,AD as movSmo,jD as movWei,cg as optionValueToDate,yd as parseExpression,Ed as replaceExpressionSymbols,UD as roc,ia as setAttributesDOMElement,mF as shutdownFeed,KD as stdDev,ra as styleDOMElement,RD as trueRange,HD as typical};
|
|
42
|
+
`)}function UM(e={}){return HM(RM.call(this,e),e)}function WM(e={}){let t=this.view.mainCanvas,{width:n,height:r}=t,{width:i,height:a,title:o}=e,s=(e,t)=>{let n=document.createElement(`canvas`);return n.width=e,n.height=t,n.getContext(`2d`)},c=s(n,r),l=globalThis.devicePixelRatio;if(c.drawImage(t,0,0),c.scale(l,l),N(o)){let e=new DM(this);e.update(o),e.draw(c)}let u=this.mainPlot?.timeSeries.container?.getLastDataPoint(G.DateTime);if(N(u)){let{fontFamily:e}=this.display.chart,{fontWeight:n,fontSize:r}=this.mainAxis.config;c.font=`${n} ${r*1.2}px ${e}`,c.textBaseline=`top`;let i=r*1.5,a=getComputedStyle(t),o=a.getPropertyValue(`--app-hc-color`),s=a.getPropertyValue(`--app-color-pl`),l={x:B.CARDS_X_OFFSET,y:B.CARDS_Y_OFFSET},d=Fv(this,u,l,void 0,!1,0),f=`${d.date} ${d.time??``}`.trim(),[p,m]=[1,5],h=(e,t)=>c.measureText(e).width+t,g=(e,t,n,r,i)=>(c.fillStyle=r,c.fillText(e,t,n),h(e,i)),_=(e,t)=>e.type===C[t],v=e=>{let t=e.name;return e.isMain&&_(e,`Symbol`)?t=`${e.description} (${e.name}) [${e.exchange}]`:_(e,`Study`)&&(t=`${e.description} ${e.name.substring(e.name.indexOf(` `))}`),t};d.panes.forEach(e=>{let{top:t,left:n,width:r,right:a}=e.bounds,c=n+r-a-m,u=n+l.x,d=t+l.y;e.plots.some(e=>e.isMain)&&(u+=g(f,u,d,o,m)),e.plots.forEach((e,t)=>{let r=v(e),a=!_(e,`Study`)&&e.values.length>1;if(!e.isMain&&t>0){let t=u+h(r,m);e.values.forEach(e=>{a&&(t+=h(e.abbreviation,p)),t+=h(e.value,m)}),t>=c&&(u=n+l.x,d+=i)}u+=g(r,u,d,o,m),e.values.forEach(e=>{a&&(u+=g(e.abbreviation,u,d,s,p)),u+=g(e.value,u,d,e.color,m)})})})}let d=e=>({width:i??n,height:a??r,data:e.toDataURL(`image/png`)});if(N(i)&&N(a)){let e=s(i,a);return e.drawImage(c.canvas,0,0,i,a),d(e.canvas)}else return d(c.canvas)}function GM(e){if(e!==void 0)return e===B.YTD_PERIOD?e:vt(e)}var KM=Symbol.for(`__ias__`),qM=class{accessor;view;defaultTool;_activeTool;tooltipEnabled=!0;timeline;sentInitialLoadNotification=!1;_hostElement=null;undoRedoManager;title;display;model;data;panes=[];_hasLegend;renderTo;seriesChangedToken=``;metaChangedToken=``;streamingSubscription=null;_previousMask=0;_ohlcMask;selectedAnnotation;annotationPreviewUid;hoverHighlightPlotIds=null;hoverDimPlotIds=null;hoverBasisByDependentPlotId=new Map;hoverDependentsByBasisPlotId=new Map;hoverHighlightablePlotIds=new Set;forceResetVisibleRange=!1;_maxOffset=0;_isShutdown=!1;notifySelectionChanged;notifyRecreated;notifyDefinitionChanged;constructor(e){this.accessor=e,this.defaultTool=gj(`Default`),this._activeTool=this.defaultTool,this.timeline=new fv(this),this.undoRedoManager=new EM(this),this.title=new DM(this),this.notifySelectionChanged=Ke(K.CH_ANNSELECTIONCHANGED),this.notifyRecreated=Ke(K.CH_RECREATED),this.notifyDefinitionChanged=Ke(K.CH_DEFINITION_CHANGED)}traceChart(e,t={}){Ih(e,{chartId:this.elementId,...t})}getModel(){return this.model}get isEmpty(){return!P(this.model)}notifyHost(e,t){Ge(e,t)}async fromModel(e,t){if(this._isShutdown)return;this.traceChart(`chart:fromModel:start`,{hadModel:P(this.model)}),P(this.model)&&this.allPlots.forEach(e=>e.shutdown()),this.sentInitialLoadNotification=!1,this.clearHoverHighlight(),this.clearHoverHighlightRelations(),this.annotationPreviewUid=void 0,this.clearSelection(),this.model=e;let n=F(e);this.data=n.data,this.data.aggregation=ju(n.data.aggregation),this.display=n.display,this.display.period=GM(n.display?.period);let r=this.panes;this.panes=n.panes.map(e=>{let t=new Qj(this);return t.fromModel(e),t},this),this.undoRedoManager.rebindOwners(r);let i=this.allPlots.map(e=>e.initialize());await Promise.all(i),!this._isShutdown&&(this.rebuildHoverHighlightRelations(),this.traceChart(`chart:fromModel:plots-ready`,{plotCount:this.allPlots.length}),this.timeline.invalidate(),this.checkZoomAndVisibleRange(e,t),P(e,t)&&this.notifyDefinitionChanged({chart:this.accessor}),this.reinitializeView())}checkZoomAndVisibleRange(e,t){if(this.view)if(this.forceResetVisibleRange)this.forceResetVisibleRange=!1,this.view.resetZoomAndVisibleRange=!0,this._maxOffset=0;else{let n=!t||QM(e,t,this);this.view.resetZoomAndVisibleRange=n,n&&(this._maxOffset=0)}}closeView(){P(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(P(this.view)?this.view.reinitialize():(this.view=new fM,this.view.initialize(this)),this.notifyRecreated({elementId:this.elementId}))}getCacheableEntities(e){let t={metaData:e.metaData.size,records:e.records.size,timeSeries:e.timeSeries.size};this.isEmpty||this.allPlots.map(t=>t.getCacheableEntities(e)),this.traceChart(`chart:cacheable-entities`,{plotCount:this.allPlots.length,addedMetaData:e.metaData.size-t.metaData,addedRecords:e.records.size-t.records,addedTimeSeries:e.timeSeries.size-t.timeSeries})}get activeTool(){return this._activeTool}set activeTool(e){P(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,P(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(K.TL_CHANGED,{chart:this.accessor})}get mainPlot(){return this.allPlots.find(e=>e.main)}get mainAxis(){return this.mainPlot?.axis}get mainPane(){return this.mainAxis?.pane}get allAxes(){let e=[];return this.panes.forEach(t=>{t.axes.forEach(t=>{e.push(t)})}),e}get plotAnnotations(){let e=[];return this.allPlots.forEach(t=>{t.isVisible&&t.annotations?.forEach(t=>{e.push(t)})}),e}get allAnnotations(){let e=[];return this.allAxes.forEach(t=>{t.annotations.forEach(t=>{e.push(t)})}),e}get allPlots(){let e=[];return this.allAxes.forEach(t=>{t.plots.forEach(t=>{e.push(t)})}),e}findAxis(e){return this.allAxes.find(t=>t.id===e)}findPlot(e){return this.allPlots.find(t=>t.id===e)}get allCurves(){let e=[];return this.allPlots.forEach(t=>{t.curves.forEach(t=>{e.push(t)})}),e}findCurve(e){return this.allCurves.find(t=>t.id===e)}get hasStudyBasisFocus(){return this.display?.chart?.studyBasisFocus===!0}get hasHoverHighlight(){return this.hoverHighlightPlotIds!==null||this.hoverDimPlotIds!==null}getStudyBasis(e){return e.isStudy?e.basePlot??null:null}isHoverSourcePlot(e){return e.isSeasonal||e.isSymbol}hasMultipleHoverSourcePlots(){return this.allPlots.filter(e=>e.isVisible&&this.isHoverSourcePlot(e)).length>1}get annotationManipulation(){return $()?.config.annotationManipulation===!0}setAnnotationPreview(e){this.annotationPreviewUid!==e&&(this.annotationPreviewUid=e,this.view?.redraw())}clearHoverHighlight(){this.hoverHighlightPlotIds=null,this.hoverDimPlotIds=null}clearHoverHighlightRelations(){this.hoverBasisByDependentPlotId.clear(),this.hoverDependentsByBasisPlotId.clear(),this.hoverHighlightablePlotIds.clear()}rebuildHoverHighlightRelations(){if(this.clearHoverHighlight(),this.clearHoverHighlightRelations(),this.hasStudyBasisFocus&&this.hasMultipleHoverSourcePlots())for(let e of this.allPlots){if(this.isHoverSourcePlot(e)&&this.hoverHighlightablePlotIds.add(e.id),!e.isStudy)continue;let t=this.getStudyBasis(e);if(!P(t))continue;this.hoverBasisByDependentPlotId.set(e.id,t.id);let n=this.hoverDependentsByBasisPlotId.get(t.id);P(n)||(n=new Set,this.hoverDependentsByBasisPlotId.set(t.id,n)),n.add(e.id),this.hoverHighlightablePlotIds.add(e.id),this.hoverHighlightablePlotIds.add(t.id)}}isHoverHighlightable(e){return this.hasStudyBasisFocus&&P(e)&&this.hoverHighlightablePlotIds.has(e.id)}getRelatedHoverPlotIdsForPlot(e){if(!this.isHoverHighlightable(e))return null;let t=new Set,n=this.hoverBasisByDependentPlotId.get(e.id);if(P(n))return t.add(e.id),t.add(n),t;let r=this.hoverDependentsByBasisPlotId.get(e.id);return P(r)&&r.size>0?(t.add(e.id),r.forEach(e=>t.add(e)),t):(t.add(e.id),t)}getRelatedHoverPlotIds(e){let t=new Set;for(let n of e){let e=this.getRelatedHoverPlotIdsForPlot(n);e!==null&&e.forEach(e=>t.add(e))}return t.size>0?t:null}getHoverDimPlotIds(e){if(!this.hasStudyBasisFocus||e===null)return null;let t=new Set;for(let n of this.hoverHighlightablePlotIds)e.has(n)||t.add(n);return t}sameHoverHighlight(e){let t=this.hoverHighlightPlotIds;if(t===null||e===null)return t===e;if(t.size!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;return!0}setHoverHighlight(e){if(!this.hasStudyBasisFocus)return this.hasHoverHighlight&&(this.clearHoverHighlight(),this.view?.redraw()),!1;let t=this.getRelatedHoverPlotIds(e);return this.sameHoverHighlight(t)?this.hoverHighlightPlotIds!==null:(this.hoverHighlightPlotIds=t,this.hoverDimPlotIds=this.getHoverDimPlotIds(t),this.view?.redraw(),t!==null)}shouldDimPlot(e){return this.hasStudyBasisFocus&&(this.hoverDimPlotIds?.has(e.id)??!1)}fixupDensityForForwards(){let e=this.allPlots.filter(e=>e.isForward).map(e=>e.timeSeries.container?.size??0);e.some(e=>e>0)&&(this.display.density=Math.max(...e))}onSeriesChanged(e,t){if(!this.view||!this.allPlots)return;let n=t.series,r=e=>e.timeSeries===n||e.eventsSeries===n,i=this.allPlots.find(r);if(!P(i))return;let a=P(i)&&i.main,o=!1,s=!1;if(e===K.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;o=!0}let c=P(t.index)?n.container.getTimeData()[t.index]:null,l=e===K.TS_EVENTSCHANGED,u=this.view.xAxis,d=u.xScale;if(e===K.TS_MANYCHANGED||l){if(a&&this.data.checkRange)if(P(this.display.xAxis.visibleRange)){let e={id:`Period`,context:{range:this.display.xAxis.visibleRange}};e[KM]=!0,this.accessor.change(e);return}else delete this.data.checkRange;i.isForward&&this.fixupDensityForForwards();let e=this.view.xAxis?.getMaxCurveOffset()??0;i.isStudy&&(e!==this._maxOffset&&(this._maxOffset=e,u.goToLatest(!0)),i.invalidateAssociatedAnnotations(`NewChunkArrived`));let n=P(this.display?.xAxis?.visibleRange);if((i.isSeasonal&&!u.wasVisibleRangeChanged&&!n||this.display?.xAxis?.isOrdinal)&&u.goToLatest(!0),t.part===re.Tail){let e=Te(this.timeline,c,Number,dv);u.shouldScrollIntoView(e)&&d.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach(e=>e.invalidatePriceMappingCache()),o=!0}else if(e===K.TS_DATAPOINTADDED){let e=this.timeline.mergeDateIntoTimeline(c);e!=-1&&u.shouldScrollIntoView(e)?(d.shiftBars(1),o=!0):s=!0,i.isStudy&&i.invalidateAssociatedAnnotations(`DataPointAdded`)}else e===K.TS_DATAPOINTCHANGED&&(s=!0,i.isStudy&&i.invalidateAssociatedAnnotations(`DataPointChanged`));if(!l&&r(this.mainPlot)&&n.hasData&&n.container.size===0&&this.notifyHost(K.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),o&&this.view.recalculateLayout(),s&&(o&&I(`Performance : redundant call to recompute price domains (layout recalculation took care of this)`,`warn`),this.allAxes.filter(e=>e.plots.includes(i)).forEach(e=>{e.setDomain(),P(c)&&e.updateFullDomain(c)})),!this.sentInitialLoadNotification&&e===K.TS_MANYCHANGED&&this.allPlots.every(e=>e.timeSeries&&e.timeSeries.hasData)){this.sentInitialLoadNotification=!0,this.notifyHost(K.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),kk(this);let e=this.display.period===B.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(d.fitAllData=!0,d.adjustDomain())}this.view.redraw()}onMetaChanged(e,t){e===K.MD_CHANGED&&this.view&&this.allPlots&&this.allPlots.find(e=>e.id===t.plot.id)&&(t.plot.main&&this.allAnnotations.forEach(e=>e.onFormatterChanged()),this.view.recalculateLayout(),this.view.redraw())}priceDomainsUpdated(){this.allPlots.forEach(e=>{e.notifyAboutPriceDomains&&e.onPriceDomainsUpdated()})}onScaleDomainChanged(e){let t=this.panes.indexOf(e.pane),n=e.pane.axes.indexOf(e),r={chart:this.accessor,paneIndex:t,axisIndex:n};this.notifyHost(K.CH_AXISSCALECHANGED,r)}get previousMask(){return P(this._previousMask)||(this._previousMask=Vf(G.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some(e=>e.updated&&t)}get hasLegend(){if(!P(this._hasLegend)){let e=ne[$()?.config.mode??`Unspecified`];this._hasLegend=[ne.cmdtyView,ne.EqPlus].includes(e)}return this._hasLegend}onStreamingUpdates(e){P(this.view)&&(this.mainPlot.showPrevious&&this.hasMatch(e,this.previousMask)&&this.view.redraw(),this.hasLegend&&this.hasMatch(e,this.ohlcMask)&&this.view.updateLegend())}get ohlcMask(){return P(this._ohlcMask)||(this._ohlcMask=Vf(G.Open,G.High,G.Low,G.Close,G.PreviousClose)),this._ohlcMask}updateMatches(e,t){if((e&this.ohlcMask)===0)return!1;let n=(e,t)=>N(e)&&e.isValid&&e.hasSymbol(t);return this.mainPlot.isSymbol?n(this.mainPlot.timeSeries.record,t):this.mainPlot.isExpression?n(this.mainPlot.record,t):!1}getStreamingSubscription(){return $().getRecordSource().subject.pipe(jm(e=>e.filter(e=>this.updateMatches(e.updated,e.data.symbol))),Pm(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return P(this._hostElement)?this._hostElement.id:null}initialize(e){if(this._hostElement=e instanceof HTMLElement?e:na(`#${e}`),!this._hostElement)throw Error(`There is no element ${e} in the DOM`);this.renderTo=e,this.seriesChangedToken=$y.default.subscribe(K.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=$y.default.subscribe(K.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return $y.default.unsubscribe(this.seriesChangedToken),$y.default.unsubscribe(this.metaChangedToken),P(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach(e=>e.shutdown()),this.model=void 0,this.closeView(),this.notifyHost(K.CH_SHUTDOWN,{elementId:this.elementId}),this._isShutdown=!0,!0}setSelection(e){this.selectedAnnotation!==e&&(this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=e,this.selectedAnnotation.isSelected=!0,this.selectedAnnotation.requestRedraw(),this.notifySelectionChanged({chart:this.accessor}))}clearSelection(){P(this.selectedAnnotation)&&(this.selectedAnnotation.isSelected=!1,this.selectedAnnotation.requestRedraw(),this.selectedAnnotation=void 0),this.notifySelectionChanged({chart:this.accessor})}resetActiveTool(){this.activeTool=this.defaultTool,this.view.setCursor(ee.Arrow)}print(e={}){let t=sa(document.body,`iframe`);t.src=``,t.style.display=`none`,t.onload=()=>{let{title:n}=e,r=WM.call(this,{title:n}),i=new Image;i.src=r.data,i.style.width=`100%`,t.contentDocument.body.appendChild(i),ua(i).then(()=>{let e=t.contentWindow;t.focus(),e.print(),t.remove()})}}setTitle(e,t=!1){this.title.update(e),P(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;let t=this.display.tooltip.mode===B.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){let t=this.display.tooltip,n=Ie();!e&&t.visible&&t.mode===B.TOOLTIP_CARDS&&ca(`.bcharts-card`,this.hostElement).forEach(e=>{let t=e.classList.contains(`bcharts-card-move`);n&&t||e.classList.contains(`bcharts-legend`)||(e.style.display=`none`)})}handleAnnotationChange(e){let t=(e,t=!0)=>({id:t?e.name:e.id,uid:e.uid,visible:e.visible});if(e.id===`List`)return this.allAnnotations.map(t);if(e.id===`Cache`)return H(this.model,`..annCache{.annotations}`).map(e=>({symbol:e.symbol,annotations:e.annotations.map(e=>t(e,!1))}));if(e.id===`Add`){let t=e.annotation;return(t.isUndoRedo?t.owner?.axis??this.mainAxis:this.mainAxis)?.addAnnotation(t)}let n=this.allAnnotations.find(t=>t.uid===e.uid);if(n!==void 0){if(e.id===`Delete`&&!e.isUndoRedo)return this.deleteAnnotationWithUndo(n);let t=n.axis,r=t[`${e.id.toLowerCase()}Annotation`];if(typeof r==`function`){r.call(t,n,e);return}}throw Error(`Unknown sub-action ${e.id} for action ${B.ANN_ACTION_ID}`)}deleteAnnotationWithUndo(e){this.undoRedoManager.done(ek(e,O.Deleted)),e.axis.deleteAnnotation(e),this.onAnnotationModifiedByTool(e,O.Deleted,!1)}getPlotInfoFromDom(e){let t=e.attributes.getNamedItem(`data-plot-uid`);if(!t)throw Error(`Unable to resolve plot info: missing data-plot-uid attribute.`);let n=t.value,r=0;for(let e of this.model.panes)for(let t of e.axes)for(let e of t.plots){if(e.uid===n)return{type:e.type,index:r};r++}throw Error(`Unable to resolve plot info: model plot index not found for uid '${n}'.`)}getSimplePlot(e,t){return this.accessor.change({id:`Plot`,context:{id:B.ACTION_GET,type:e,index:t}})[0]}onCardClicked(e){let t=this.getPlotInfoFromDom(e),n=this.getSimplePlot(t.type,t.index),r={chart:this.accessor,plot:n};this.notifyHost(K.CH_CARDPLOTCLICKED,r)}deletePlotClicked(e){let t=this.getPlotInfoFromDom(e),n=this.getSimplePlot(t.type,t.index);this.accessor.change({id:`Plot`,context:{id:`Delete`,type:t.type,index:t.index}});let r={chart:this.accessor,plot:n};this.notifyHost(K.CH_CARDPLOTREMOVED,r)}showHidePlotClicked(e){this.defaultTool.hideCrosshairAndTooltips(this.view,!0);let t=this.getPlotInfoFromDom(e),n=e.attributes.getNamedItem(`data-act`).value===`Show`;this.accessor.change({id:`Plot`,context:{id:`Update`,type:t.type,index:t.index,visible:n}});let r=this.getSimplePlot(t.type,t.index),i={chart:this.accessor,plot:r,visible:n};this.notifyHost(K.CH_CARDPLOTVISIBILITYCHANGED,i)}plotMoreActionsClicked(e,t){let n=this.getPlotInfoFromDom(e),r=this.getSimplePlot(n.type,n.index),i={x:t.clientX,y:t.clientY},a={chart:this.accessor,plot:r,offset:i,originalEvent:t};this.notifyHost(K.CH_PLOTNEEDSCONTEXTMENU,a)}onMovePaneClicked(e){let t=parseInt(e.attributes.getNamedItem(`data-pane`).value),n=e.attributes.getNamedItem(`data-dir`).value===`Down`,r=t+ +!!n,i=t-+!n;setTimeout(()=>{this.accessor.change({id:`MovePane`,context:{from:r,to:i}}),this.notifyHost(K.CH_PANESREORDERED,{chart:this.accessor})})}onAnnotationsUpdated(e,t=!1){let n=this.allAxes.indexOf(e),r=e.annotations.map(e=>e.toModel()),i=hM(this.model,{axisIndex:n,annotations:r});try{this.model=Mf(i,B.CHART_SCHEMA)}catch(e){I(`Cannot update annotation (corrupts definition), error is: ${e.message}`,`error`)}t&&this.view.draw(),this.notifyHost(K.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,n=!0,r=!1){if(t!==O.None){if(n&&t!==O.Undo&&t!==O.Redo){let n=ek(e,t);this.undoRedoManager.done(n)}let i=tk(e);i.toolChange=O[t],(r||t===O.Reordered)&&(i.orderOnly=!0),this.notifyHost(K.CH_ANNMODIFIEDBYTOOL,i)}}onAnnotationDone(e,t){let n={id:e,chart:this.accessor,toolChange:O[t]};this.notifyHost(K.CH_ANNMODIFIEDBYTOOL,n)}onPaneHeightsUpdated(){let e=this.panes.map((e,t)=>({index:t,relativeHeight:e.height}));this.model=CM(this.model,{paneHeights:e}),this.notifyHost(K.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){let e=this.mainPlot.timeSeries.container;if(!P(e)||e.size===0)return null;let t=e.getTimeData(),n=Se(t),r=xe(t);return P(n,r)?{dataRange:{from:n.getTime(),to:r.getTime()},barCount:e.size}:null}};function JM(e,t){return e?.from===t?.from&&e?.to===t?.to}var YM=[`Renko`,`Range`,`LineBreak`,`Kagi`,`PointAndFigure`];function XM(e,t){for(let n of Object.keys(e))if(e[n]!==t[n])return!0}function ZM(e,t){let n=e=>e.curves[0],r=n(e),i=n(t),a=YM.includes(r.style),o=YM.includes(i.style);return a===o?o?!!(r.style!==i.style||t.inputs&&XM(dt(e.inputs),dt(t.inputs))):!1:!0}function QM(e,t,n){let r={id:`Aggregation`,context:{id:`Get`}};if(XM(Au(PP(r,t,n)),Au(PP(r,e,n)))||!JM(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!JM(e.data?.range,t.data?.range)||e.data?.extendedHours!==t.data?.extendedHours||e.display?.period!==t.display?.period||e.display?.density!==t.display?.density)return!0;let i=Hd(t),a=Hd(e);if(ZM(i,a))return!0;let o=(e,t)=>e.type===t,s=e=>{let t=e.toLowerCase();return o(a,e)&&o(i,e)&&i[t]!==a[t]},c=i.type!==a.type,l=s(`Forward`),u=s(`Expression`),d=s(`Symbol`);return c||l||u||d}function $M(e,t,n){if(`paneIndex`in t||`axisIndex`in t)throw Error(`AnnotationManipulation paneIndex and axisIndex are output-only metadata; use uid`);let r=n?.selectedAnnotation?.uid,i=n?.annotationPreviewUid;return e.panes.flatMap((e,n)=>e.axes.flatMap((e,a)=>(e.annotations||[]).map((e,t)=>({uid:e.uid,paneIndex:n,axisIndex:a,position:t,selected:r===e.uid,preview:i===e.uid})).filter(e=>t.uid===void 0||e.uid===t.uid)))}function eN(e,t){return e===`Front`?t-1:e===`Back`?0:xt(0,t-1,e)}function tN(e,t,n){let{uid:r,position:i,selected:a,preview:o}=t;if(t.id!==void 0&&t.id!==`Update`)throw Error(`Invalid AnnotationManipulation sub-action`);if(i!==void 0&&!(i===`Front`||i===`Back`)&&!(Number.isInteger(i)&&i>=0))throw Error(`Annotation position must be Front, Back, or a non-negative integer`);if((i!==void 0||a===!0||o===!0)&&r===void 0)throw Error(`AnnotationManipulation requires uid for position, selection, or preview`);let s=$M(e,t,n),c=r===void 0?void 0:s[0],l=c&&n?.panes[c.paneIndex]?.axes[c.axisIndex],u=l?.annotations.find(e=>e.uid===r),d=u?.isVisible&&!u.computed?u:void 0;if(c&&i!==void 0){let t=e.panes[c.paneIndex].axes[c.axisIndex].annotations,r=eN(i,t.length);if(r!==c.position){let e=t.map(e=>e.uid);if(l&&u&&n){let t=[...e];t.splice(r,0,t.splice(c.position,1)[0]),l.annotations.sort((e,n)=>t.indexOf(e.uid)-t.indexOf(n.uid)),n.undoRedoManager.done({owner:l.annotationUndoOwner,uid:u.uid,toolChange:O.Reordered,before:e,after:t}),n.onAnnotationsUpdated(l),n.onAnnotationModifiedByTool(u,O.Reordered,!1),u.requestRedraw()}else t.splice(r,0,t.splice(c.position,1)[0])}}return n&&o!==void 0&&(o&&d?n.setAnnotationPreview(d.uid):!o&&(r===void 0||n.annotationPreviewUid===r)&&n.setAnnotationPreview()),n&&a!==void 0&&(a&&d?n.setSelection(d):!a&&s.some(e=>e.selected)&&n.clearSelection()),e}function nN(e,t){let[n,r]=Qe(t.crosshair),{color:i,dashStyle:a}=t.horizontal||{},{color:o,dashStyle:s}=t.vertical||{},c=(e,t,n)=>{t&&(e.color=t),n&&(e.dashStyle=n)},l=U(e,`.display.xAxis.crosshair`,e=>(e.enabled=n,c(e,o,s),e));return l=U(l,`.display.yAxis.crosshair`,e=>(e.enabled=r,c(e,i,a),e)),P(t.haloTracking)&&typeof t.haloTracking==`boolean`&&(l=U(l,`.display.chart`,e=>(e.plotHover=t.haloTracking,e))),l}function rN(e,t){return U(e,`.display.tooltip`,e=>(t.visible!=null&&(e.visible=t.visible),t.mode&&(e.mode=t.mode),t.showMainTitle!=null&&(e.showMainTitle=t.showMainTitle),t.mainTitle&&(e.mainTitle=t.mainTitle),e))}function iN(e,t){let n=F(t);return Object.keys(t).forEach(e=>{B.EVENTS.includes(e)||delete n[e];let r=t[e];typeof r==`boolean`?r={show:t[e]}:Object.keys(r).forEach(e=>{B.EVENT_PROPERTIES.includes(e)||delete r[e]}),n[e]=r}),U(e,Vd,e=>(e.type===`Symbol`&&(e.events=e.events||{},Object.keys(n).forEach(t=>{e.events[t]=e.events[t]||{},ct(e.events[t],n[t],!1)})),e))}function aN(e,t){let n=U(e,`..panes{${Vd}}.axes`,e=>(N(t.scale)&&(e.scale=t.scale),e));n=U(n,`.display.xAxis`,e=>(N(t.horizontalAxisPosition)&&(e.position=t.horizontalAxisPosition),N(t.marginBars)&&(e.marginBars=t.marginBars),N(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),N(t.ordinalName)&&(e.ordinalName=t.ordinalName),N(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e));let r=()=>I(`The 'minPadding' and 'maxPadding' are deprecated (ignored)`,`warn`),i=()=>I(`The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'`,`warn`);return n=U(n,`.display.yAxis`,e=>{(P(t.minPadding)||P(t.maxPadding))&&r();let n=N(t.preventLabelOverlap)&&!N(t.preventVerticalLabelOverlap);n&&i();let a=n?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return N(a)&&(e.preventLabelOverlap=a),P(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),P(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),P(t.primaryOnTheLeft)&&(e.primaryOnTheLeft=t.primaryOnTheLeft),e}),P(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach(e=>{let{axis:t,text:r,index:i,paneIndex:a}=e;P(t,r,i)&&t===`vertical`&&Number.isInteger(i)&&(n=U(n,`..panes[${a??0}]..axes[${i}]`,e=>P(e)?(e.label=r,e):B.NULL_OBJECT))}),N(t.contractTransition)&&(n=U(n,`.display.xAxis`,e=>(lt(e.contractTransition,t.contractTransition),e))),N(t.cycleTransition)&&(n=U(n,`.display.xAxis`,e=>(lt(e.cycleTransition,t.cycleTransition),e))),n}function oN(e,t,n){let r=e;if(P(t.comparisonMode)&&typeof t.comparisonMode==`string`&&nt(x,t.comparisonMode)&&(r=U(r,`..panes{${Vd}}.axes`,e=>(e.comparison=t.comparisonMode,e))),P(t.gridLines)){let[e,n]=Qe(t.gridLines);r=U(r,`.display.xAxis.gridLines`,t=>(t.visible=e,t)),r=U(r,`.display.yAxis.gridLines`,e=>(e.visible=n,e))}if(P(t.minorGridLines)){let[,e]=Qe(t.minorGridLines);r=U(r,`.display.yAxis.minorGridLines`,t=>(t.visible=e,t))}P(t.newPaneHeight)&&typeof t.newPaneHeight==`number`&&(r=U(r,`.display.chart{.newPaneHeight > 0}`,e=>(e.newPaneHeight=t.newPaneHeight,e))),P(t.showNavigator)&&typeof t.showNavigator==`boolean`&&(r=U(r,`.display.scrollbar`,e=>(e.visible=t.showNavigator,e))),P(t.plotHover)&&typeof t.plotHover==`boolean`&&(r=U(r,`.display.chart`,e=>(e.plotHover=t.plotHover,e))),P(t.showLastValue)&&typeof t.showLastValue==`string`&&(r=U(r,`.display.yAxis`,e=>(e.showLastValue=t.showLastValue,e))),P(t.showMinMaxArc)&&typeof t.showMinMaxArc==`boolean`&&(r=U(r,`.display.chart`,e=>(e.showMinMaxArc=t.showMinMaxArc,e))),P(t.showGoToLatest)&&typeof t.showGoToLatest==`boolean`&&(r=U(r,`.display.chart`,e=>(e.showGoToLatest=t.showGoToLatest,e))),P(t.showLegend)&&typeof t.showLegend==`boolean`&&(r=U(r,`.display.chart`,e=>(e.showLegend=t.showLegend,e)),t.showLegend||n.view.removeLegend()),P(t.allAnnotationsLocked)&&typeof t.allAnnotationsLocked==`boolean`&&(r=U(r,`.display`,e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e))),N(t.hiddenItems)&&OO.includes(t.hiddenItems)&&(r=U(r,`.display`,e=>(e.hiddenItems=t.hiddenItems,e))),P(t.exprSkipLeadingEmpty)&&typeof t.exprSkipLeadingEmpty==`boolean`&&(r=U(r,`.data`,e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e))),typeof t.useLastTrade==`boolean`&&(r=U(r,`.data`,e=>(e.useLastTrade=t.useLastTrade,e)));let i=[];if(P(t.extendedHours)&&typeof t.extendedHours==`boolean`&&(r=U(r,`.data`,e=>(e.extendedHours=t.extendedHours,e))),P(t.realTimeCboeBzx)&&typeof t.realTimeCboeBzx==`boolean`&&(r=U(r,`.data`,e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&i.push(`realTimeCboeBzx`),e.realTimeCboeBzx=t.realTimeCboeBzx,e))),P(t.buildContinuation)&&typeof t.buildContinuation==`boolean`&&(r=U(r,`.data`,e=>(e.buildContinuation=t.buildContinuation,e))),i.length>0){let e={chart:n.accessor,hostPropsChanged:i};n.notifyHost(K.CH_HOST_PROPS_CHANGED,e)}return r}var sN=`MARKED_FOR_DELETION`;function cN(e,t){if(t.plots.length===0)return e;let n=e;for(let e of t.plots){let t=_N(n,e);if(t===void 0)continue;let r=mN(t),i=hN(n,r);P(i)&&(P(e.type)&&i.type!==e.type||(n=U(n,r,e=>(e[sN]=!0,e))))}return n=U(n,`..plots{.${sN} === true}`,e=>B.NULL_OBJECT),n=U(n,`..plots{.type === "Study"}`,e=>{let t=V(e.study);return P(t)&&Bd(n,t,e.basis).eligible?e:B.NULL_OBJECT}),Nf(n)}function lN(e,t,n,r){let i=C[e.type],a={curves:F(e.curves),type:e.type,uid:e.uid};a.precision=e.precision,a.visible=e.visible,a.detachedScale=e.detachedScale;let o=(e,t)=>{P(e[t])?a[t]=e[t].map(e=>F(e)):a[t]=[]},s=(e,t,n=!1)=>{t.main===!0&&(e.main=!0,e.showPrevious=t.showPrevious,n&&t.events!=null&&(e.events=F(t.events)))},c=(e,t=e=>!0)=>{P(r)&&(e.subtitles=r.allPlots.filter(e=>e.type===i).filter(t).map(e=>e.title))};switch(i){case C.Symbol:{a.title=e.symbol;let t=a.curves[0].style,n=t=>{o(e,`inputs`),a.inputs.length===0&&(a.inputs=F(t))};switch(t){case`Renko`:n(B.DEFAULT_RENKO_INPUTS);break;case`Kagi`:n(B.DEFAULT_KAGI_INPUTS);break;case`PointAndFigure`:n(B.DEFAULT_PNF_INPUTS);break;case`LineBreak`:n(B.DEFAULT_LINEBREAK_INPUTS);break;case`Baseline`:n(B.DEFAULT_BASELINE_INPUTS);break}s(a,e,!0);break}case C.Study:{o(e,`inputs`);let r=V(e.study),i=a.inputs,s=e.study===`AVWAP`,c=i.length===0?``:` (${i.map(e=>s&&e.name===`Anchor`?new Date(e.value).toLocaleString():e.value).join(`, `)})`,l=a.curves.map(e=>Number(e.shift)).filter(e=>e>0),u=l.length===0?``:` [${l.join(`, `)}]`;a.title=`${r.id}${c}${u}`,a.studyId=r.id,o(e,`levels`),o(e,`bands`),a.basis=F(e.basis)||{kind:`main`},a.placement=t?n?`overlay`:`withMain`:`standalone`;break}case C.BalanceSheet:case C.IncomeStatement:{let t=G[e.curves[0].fields[0]];a.title=`${t.name} (${e.fundamental.substring(0,1)})`,a.fundamentalId=t.id,a.frequency=e.fundamental;break}case C.Expression:a.title=e.expression,s(a,e);break;case C.Forward:a.title=e.forward,o(e,`offsets`),c(a),s(a,e);break;case C.Seasonal:a.title=e.seasonal,c(a,e=>e.refSeasonal===a.title),o(e,`offsets`),s(a,e);break;default:throw Error(`Unexpected plot type`)}return a}function uN(e,{main:t,type:n,index:r,uid:i},a){let o=`..plots{.main === true}`,s=H(e,`..panes`).map((e,t)=>{let n=H(e,o).length===1;return H(e,`..axes`).map((e,r)=>{let i=H(e,o).length===1;return H(e,`..plots`).map(e=>{let o=lN(e,n,i,a);return o.paneIndex=t,o.axisIndex=r,o})})}).flat(2).map((e,t)=>(e.index=t,e));if(P(i))return s.filter(e=>e.uid===i);if(t)return s.filter(e=>e.main);if(P(n)){let e=s.filter(e=>e.type===n);return P(r)?e.filter(e=>e.index===r):e}else return s}var dN=[`overlay`,`standalone`,`withMain`,`clone`];function fN(e,t,n){t[n]&&(e[n]=t[n])}function pN(e,t){e.type===`Study`&&t.curves?.forEach(e=>delete e.varyColorPerBar),yN(e)?P(t.curves)&&(e.curves=t.curves):wN(e.curves,t.curves);let n=C[t.type],r=e;if(P(t.precision)?r.precision=t.precision:delete r.precision,n===C.Symbol)P(t.symbol)&&(e.symbol=t.symbol);else if(n===C.Study)P(t.basis)&&(e.basis=F(t.basis)),TN(e.inputs,t.inputs,e),[`bands`,`levels`,`detachedScale`].forEach(n=>fN(e,t,n));else if((n===C.BalanceSheet||n===C.IncomeStatement)&&t.frequency)e.fundamental=t.frequency;else if(n===C.Expression){let n=e;P(t.expression)&&(n.expression=t.expression)}else if(n===C.Forward){let n=e;P(t.offsets)&&(n.offsets=t.offsets),P(t.forward)&&(n.forward=t.forward)}else if(n===C.Seasonal){let n=e;P(t.offsets)&&(n.offsets=t.offsets),P(t.seasonal)&&(n.seasonal=t.seasonal),P(t.usesInAverage)&&(r.usesInAverage=t.usesInAverage),cu(n)}}var mN=e=>`..plots[${e}]`;function hN(e,t){let n=H(e,t);return n.length===1?n[0]:null}function gN(e,t){let n=0;for(let r of e.panes)for(let e of r.axes)for(let r of e.plots){if(r.uid===t)return n;n+=1}}function _N(e,t){return P(t.uid)?gN(e,t.uid):t.index}function vN(e){let t=C[e.type];return t===C.Symbol||t===C.Expression}function yN(e){let t=C[e.type];return t===C.Forward||t===C.Seasonal}function bN(e){let t=C[e.type];return t===C.Symbol||t===C.Expression||t===C.Seasonal}function xN(e,t,n){if(P(t))return t;let r=n?.uid;return typeof r==`string`?gN(e,r):void 0}function SN(e,t,n){if(P(t.placement)&&!dN.includes(t.placement))throw Error(`Unknown placement: ${t.placement}`);let r=_N(e,t),i=r===void 0?t.main?Vd:``:mN(r);if(!i)return e;let a=hN(e,i);if(!N(a)||N(t.type)&&a.type!==t.type)return e;let o=xN(e,r,a);if(t.type===C[C.Study]){let n=a,r=V(t.studyId??n.study);if(!N(r))return e;let i=P(t.basis)?t.basis:n.basis,o=Bd(e,r,i);if(!o.eligible)return I(`Cannot update study "${r.meta.title}" because ${o.reason}.`,`error`),e}if(N(t.visible))return a.visible=t.visible,e;if(a.main&&vN(a)){if(t.curves){let n=e=>e.curves[0].style===h[h.Range],[r,i]=[n(a),n(t)];r&&!i?e=ef(e,{unit:`Day`,size:1,spec:`None`}):!r&&i&&(e=ef(e,{unit:`Intraday`,size:100,spec:`PerRange`}))}t.type||=a.type;let n=a;P(t.precision)?n.precision=t.precision:delete n.precision,P(t.showPrevious)&&(e=U(e,Vd,e=>(e.showPrevious=t.showPrevious,e)));let r=t.curves?ed(e,t):e;return P(t.oppositeScale)&&bN(a)&&P(o)&&(r=Id(r,o,+!!t.oppositeScale)),r}else{let s=U(e,i,e=>(pN(e,t),e));if(P(t.oppositeScale)&&bN(a)&&P(o)&&(s=Id(s,o,+!!t.oppositeScale)),!(t.type===C[C.Study]&&P(t.placement)))return s;let c=P(r)?r:t.index,l=uN(s,{...t,index:c},n).find(e=>e.index===c);if(!P(l))return e;if(t.placement===l.placement)return s;let u=hN(s,i);if(!P(u))return e;s=cN(s,{id:`Delete`,plots:[{uid:u.uid,type:t.type}]});let d=AN(s,t.placement,t.cloneIndex,t.cloneUid);return d!==null&&d.plots.push(u),s}}function CN(e){return e!==void 0}function wN(e,t){if(CN(t)&&t.length===e.length)for(let n=0;n<e.length;++n){let r=t[n],i=e[n];lt(i,r);for(let e of[`shift`,`dashStyle`,`lineSmoothing`,`lineMarker`]){let t=r[e];P(t)&&(i[e]=t)}}}function TN(e,t,n){let r=dt(e),i=dt(t);lt(r,i);let a=ft(i);a.length>0&&(n.inputs=a)}function EN(){return{plots:[]}}function DN(e){let t=e.display.chart.newPaneHeight??1;return{axes:[EN()],height:t}}function ON(e){let t=DN(e);return e.panes.push(t),t}function kN(e,t){let n=N(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:ON(e),r=n.axes[0];return t.oppositeScale??!1?XN(n,r):r}function AN(e,t,n,r,i){let a=null,{mainPane:o,mainAxis:s}=Ud(e),c=(()=>{if(i?.kind!==`seasonal`)return null;for(let t of e.panes)for(let e of t.axes)for(let n of e.plots){if(n.uid!==i.uid||n.type!==`Seasonal`)continue;let r=n.offsets;if(Array.isArray(r)&&r.includes(i.offset))return{pane:t,axis:e}}return null})();switch(t){case`withMain`:a=c?XN(c.pane,c.axis):XN(o,s);break;case`overlay`:a=c?.axis??s;break;case`standalone`:a=ON(e).axes[0];break;case`clone`:{let t={main:!1,type:C[C.Study]};if(typeof r==`string`&&r.length>0?t.uid=r:typeof n==`number`&&(t.index=n),t.uid||typeof t.index==`number`){let n=uN(e,t).find(e=>e.type===C[C.Study]&&(t.uid?e.uid===t.uid:e.index===t.index));if(!n)break;a=H(e,`..panes[${n.paneIndex}]..axes[${n.axisIndex}]`)[0]}break}}return a}function jN(e,t){let n=V(t.studyId);if(!N(n))return I(`Unknown or unavailable study with the id '${t.studyId}'`,`error`),e;let r=Bd(e,n,t.basis);if(!r.eligible)return I(`Cannot add study "${n.meta.title}" because ${r.reason}.`,`error`),e;let i=t.placement||(n.meta.overlay?`overlay`:`standalone`),a=t.uid??bt();P(t.uid)&&jd(e,a);let o={uid:a,type:`Study`,study:t.studyId,visible:!0};i===`overlay`&&t.studyId===`VOL`&&(o.detachedScale=!0),t.curves!==void 0&&(o.curves=n.defaults.curves),pN(o,t);let s=AN(e,i,t.cloneIndex,t.cloneUid,t.basis);P(s)&&s.plots.push(o);let c=e.data.aggregation;return $d(e,c.unit===`Tick`&&c.spec===`None`)}function MN(e,t){e.panes.push({axes:[{plots:[t]}]})}function NN(e,t){let n=Hd(e);if(n.type!==C[C.Symbol])throw Error(`Cannot add fundamental to the chart whose main plot is not a Symbol plot.`);let r=n.symbol,i=t.uid??bt();P(t.uid)&&jd(e,i);let a={uid:i,curves:[{fields:[t.fundamentalId],lineWidth:2,style:`Line`,varyColorPerBar:!1,visible:!0,colors:[`#888`]}],fundamental:`Quarter`,symbol:r,type:b[G[t.fundamentalId].category],visible:!0};return pN(a,t),MN(e,a),e}var PN=[{fields:[G.Close.id],colors:[`#888`],style:`Line`,lineWidth:2,varyColorPerBar:!1,visible:!0}];function FN(e){return e.type===`Symbol`}function IN(e,t){let n=Hd(e),r=F(FN(n)?n.curves:PN),i=t.uid??bt();P(t.uid)&&jd(e,i);let a={uid:i,curves:r,expression:``,type:`Expression`,visible:!0};return pN(a,t),kN(e,t).plots.push(a),e}function LN(e,t){let n=t.uid??bt();P(t.uid)&&jd(e,n);let r={uid:n,curves:F(PN),offsets:[0],seasonal:``,type:`Seasonal`,visible:!0,main:!1};return pN(r,t),kN(e,t).plots.push(r),e}var RN={attributes:[`OpenVsClose`],colors:[`#b63400`,`#007f3e`,`#1664db`],fields:[`Open`,`High`,`Low`,`Close`,`Change`],style:`Candlestick`,varyColorPerBar:!0,lineWidth:1};function zN(e,t){let n=Hd(e),r=$().getDefaultMultiFieldCurve(),i=P(r)?r:RN,a=n.curves?.length,o=a===t.curves.length&&a===1?(e=>F(e?n.curves:[i]))(FN(n)):t.curves,s=t.uid??bt();P(t.uid)&&jd(e,s);let c={uid:s,curves:o,symbol:``,type:`Symbol`,visible:!0};return pN(c,t),kN(e,t).plots.push(c),e}function BN(e,t){switch(t.type){case`Study`:return jN(e,t);case`IncomeStatement`:case`BalanceSheet`:return NN(e,t);case`Expression`:return IN(e,t);case`Symbol`:return zN(e,t);case`Seasonal`:return LN(e,t);default:throw Error("Unexpected plot type '${type}', not supported currently")}}var VN=0,HN=B.AUTO_COLORS,UN=`Symbol`,WN=`Expression`,GN=`Seasonal`;function KN(e,t){let n={attributes:[],colors:HN.slice(VN,VN+1),fields:e?[G.Last.id]:[G.Close.id],style:`Line`,dashStyle:`Solid`,varyColorPerBar:!1,lineWidth:2,lineMarker:void 0,lineSmoothing:void 0},r={uid:t.uid??bt(),curves:[n]},{curves:i,oppositeScale:a,...o}=t;return ut(r,o),N(i)&&(r.curves=i.map(e=>{let t=F(e);return ut(t,n),t})),r.main=!1,VN=(VN+1)%HN.length,r}function qN(e){return P(e.symbols)&&(I(`Use of 'symbols' for Compare API is deprecated. Please see docs for the latest version which supports more plot types`,`warn`),e.plots=e.symbols.map(e=>(e.type=UN,e))),e.plots?.some(e=>P(e.leftScale))?(I(`Use of 'leftScale' for Compare API is deprecated. Please use 'oppositeScale'`,`warn`),e.plots.map(e=>{let t=e.leftScale;return delete e.leftScale,{...e,oppositeScale:t}})):e.plots}function JN(e,t){let n=qN(t),r=n.map(e=>e.uid).filter(e=>typeof e==`string`),i=new Set;for(let t of r){if(i.has(t))throw Error(`Plot uid '${t}' is duplicated in the Compare request.`);i.add(t),jd(e,t)}let{yes:a,no:o}=A(n,e=>e.oppositeScale??!1),{mainPane:s,mainAxis:c}=Ud(e);s.alignOnExpirations=t.alignOnExpirations||!1;let l=XN(s,c),u=e=>![UN,WN,GN].includes(e.type);l.plots=l.plots.filter(u);let d=c.plots.filter(e=>e.main||u(e)),f=e.data.aggregation.unit===`Tick`;VN=0;let p=se(KN,f);return c.plots=d.concat(o.map(p)),a.length>0&&(l.plots.push(...a.map(p)),l.comparison=c.comparison,l.scale=c.scale),Nf(e)}var YN=`..plots{(.type === "Symbol" || .type === "Expression" || .type === "Seasonal") && .main !== true}`;function XN(e,t){let n=e.axes.find(e=>e!==t);return P(n)||(n=EN(),e.axes.push(n)),n}function ZN(e,t){let n=H(e,YN),r=H(t,YN),i=Math.max(0,4-r.length);if(i===0)return t;let a=n.filter(e=>!r.find(t=>e.symbol===t.symbol)).slice(0,i);if(a.length===0)return t;let{mainPane:o,mainAxis:s}=Ud(t),{mainAxis:c}=Ud(e);return a.forEach(e=>{c.plots.includes(e)?s.plots.push(e):XN(o,s).plots.push(e)}),t}function QN(e,t){let n=e.panes;return n.splice(t.to,0,n.splice(t.from,1)[0]),e}var $N=()=>B.NULL_OBJECT;function eP(e){return U(e,`..axes.annotations`,$N)}function tP(e){return Nf(U(e,`..plots{.type === "Symbol" && .main !== true}`,$N))}function nP(e,t){let n=F(e);if(t.strip.main){let e=Hd(n),t=e.type.toLowerCase();e[t]=B.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(n=eP(n)),t.strip.compare&&(n=tP(n)),n=U(n,`.data`,e=>(e.range&&(delete e.range,e.checkRange=!0),e)),n}function rP(e,t,n){let r=uN(e,{main:!0},n)[0],i=r.title===B.PLACEHOLDER_SYMBOL_NAME,a=r.type===`Symbol`,o=r.type===`Expression`,s=yd(r.title),c=[];return o&&!vd(s)?c=s.symbols:i||(c=[r.title]),{isTemplate:i,isDefinition:!i,main:{isSymbol:a,isExpression:o,symbols:c,title:i?null:r.title},compare:H(e,YN).map(e=>e.symbol),annotations:H(e,`..annotations`).map(e=>e.id),studies:uN(e,{type:`Study`},n).map(e=>e.title)}}function iP(e,t,n){let r=H(e,`..panes`).map((e,t)=>H(e,`..axes`).map((e,n)=>H(e,`.annotations`).map(e=>({...e,paneIndex:t,axisIndex:n})))).flat(2).map((e,t)=>({...e,index:t}));return P(t.index)&&Number.isFinite(t.index)?t.index<r.length?[r[t.index]]:B.EMPTY_ARRAY:r}function aP(e,t){let n=oP(t.annotation),{mainAxis:r}=Ud(e);return r.annotations??=[],r.annotations.some(e=>e.uid===n.uid)||r.annotations.push(n),e}function oP(e){let t={id:e.id,uid:e.uid,points:(e.points??[]).map(e=>({price:e.price,time:e.time}))};return e.traits!==void 0&&(t.traits=F(e.traits)),e.visible!==void 0&&(t.visible=e.visible),e.locked!==void 0&&(t.locked=e.locked),t}function sP(e,t){let n=H(e,`..axes`);for(let e of n){let n=e.annotations?.find(e=>e.uid===t.uid);if(n){t.traits!==void 0&&(n.traits=F(t.traits)),t.points!==void 0&&(n.points=t.points.map(e=>({price:e.price,time:e.time}))),t.visible!==void 0&&(n.visible=t.visible),t.locked!==void 0&&(n.locked=t.locked);break}}return e}function cP(e,t){let n=H(e,`..axes`);for(let e of n)if(e.annotations?.some(e=>e.uid===t.uid)){e.annotations=e.annotations.filter(e=>e.uid!==t.uid);break}return e}function lP(e,t,n){let r=H(e,`..panes{${Vd}}.axes.comparison`)[0],i=e.display,a=(e,t)=>rt(e,!1,t,`visible`),o=e=>$e(a(i.xAxis,e),a(i.yAxis,e)),s=rt(i.chart,!0,`showLegend`);return{comparison:r,gridLines:o(`gridLines`),minorGridLines:o(`minorGridLines`),newPaneHeight:i.chart.newPaneHeight,showLastValue:i.yAxis.showLastValue,showLegend:s,showMinMaxArc:i.chart.showMinMaxArc,allAnnotationsLocked:i.allAnnotationsLocked,hiddenItems:AO(i),exprSkipLeadingEmpty:e.data?.exprSkipLeadingEmpty??!1,useLastTrade:e.data?.useLastTrade??!1,extendedHours:e.data?.extendedHours??!1,realTimeCboeBzx:e.data?.realTimeCboeBzx??!1,buildContinuation:e.data?.buildContinuation??!1}}function uP(e,t){let n=e,{backgroundColor:r,axis:{gridLinesColor:i,textColor:a,crosshairColor:o,gridLinesStyle:s},fontSize:c}=t,{chart:l,xAxis:u,yAxis:d}=c||{};if((r||l)&&(n=U(e,`.display.chart`,e=>(r&&(e.backgroundColor=r),l&&(e.fontSize=l),e))),i){let e=e=>(e.color=i,e);n=U(n,`.display.xAxis.gridLines`,e),n=U(n,`.display.yAxis.gridLines`,e),n=U(n,`.display.yAxis.minorGridLines`,e)}if(s){let e=e=>(e.dashStyle=s,e);n=U(n,`.display.xAxis.gridLines`,e),n=U(n,`.display.yAxis.gridLines`,e),n=U(n,`.display.yAxis.minorGridLines`,e)}if(a){let e=e=>(e.textColor=a,e);n=U(n,`.display.xAxis`,e),n=U(n,`.display.yAxis`,e)}if(o){let e=e=>(e.color=o,e);n=U(n,`.display.xAxis.crosshair`,e),n=U(n,`.display.yAxis.crosshair`,e)}if(u||d){let e=e=>t=>(t.fontSize=e,t);u&&(n=U(n,`.display.xAxis`,e(u))),d&&(n=U(n,`.display.yAxis`,e(d)))}return n}function dP(e,t,n){let{chart:r,xAxis:i,yAxis:a}=e.display||{},{fontSize:o,backgroundColor:s}=r||{},{fontSize:c,gridLines:l,textColor:u,crosshair:d}=i||{},{color:f,dashStyle:p}=l||{},{fontSize:m}=a||{},{color:h}=d||{};return{backgroundColor:s,axis:{gridLinesColor:f,textColor:u,crosshairColor:h,gridLinesStyle:p},fontSize:{chart:o,xAxis:c,yAxis:m}}}function fP(e,t,n){let{mainAxis:r}=Ud(e),i=H(e,`.display.xAxis`)[0],a=H(e,`.display.yAxis`)[0];return{scale:r.scale,marginBars:i.marginBars??0,horizontalAxisPosition:i.position??`bottom`,preventLabelOverlap:a.preventLabelOverlap,preventVerticalLabelOverlap:a.preventLabelOverlap,preventHorizontalLabelOverlap:i.preventLabelOverlap,snapAnnotationsToPrices:a.snapAnnotationsToPrices,primaryOnTheLeft:a.primaryOnTheLeft??!1,nonEodLabelWithDate:i.nonEodLabelWithDate??!1,includePercentChangeWithLastValue:a.includePercentChangeWithLastValue??!1,ordinalName:i.ordinalName??``,contractTransition:i.contractTransition,cycleTransition:i.cycleTransition}}function pP(e,t,n){let r=t=>H(e,t)[0],i=r(`.display.chart`),a=r(`.display.xAxis.crosshair`),o=r(`.display.yAxis.crosshair`),s=`none`;return a.enabled&&o.enabled?s=`both`:a.enabled?s=`vertical`:o.enabled&&(s=`horizontal`),{crosshair:s,horizontal:{color:o.color,dashStyle:o.dashStyle},vertical:{color:a.color,dashStyle:a.dashStyle},haloTracking:i.plotHover}}function mP(e,t,n){return F(e.data.aggregation)}function hP(e,t){let n=H(e,YN),{mainPane:r,mainAxis:i}=Ud(e),a=[];for(let e of n){let t=!i.plots.includes(e),n=e.type.toLowerCase(),r={curves:F(e.curves),type:e.type,[n]:e[n],oppositeScale:t,leftScale:t};a.push(r)}return{plots:a,alignOnExpirations:r.alignOnExpirations}}function gP(e,t,n){let{paneIndex:r,annotations:i,studies:a}=t||{},o=`..panes${Number.isInteger(r)?`[${r}]`:``}`,s=e,c=e=>B.NULL_OBJECT;return i===!0&&(n.allAnnotations.forEach(e=>n.onAnnotationModifiedByTool(e,O.Deleted,!1)),s=U(s,`${o}..annotations`,c)),a===!0&&(s=U(s,`${o}..plots{.type=="Study"}`,c)),s=Nf(s),s}var _P=`.display.chart.previous`;function vP(e,t,n){return H(e,_P)[0]}function yP(e,t,n){return U(e,_P,e=>(lt(e,t),e))}function bP(e,t,n){let r=[],i=_N(e,t);if(i===void 0||hN(e,mN(i))?.type!==t.type)return r;let a=Nd(e,i);if(a===null)return r;let o=a.pane,s=o===0,c=o===e.panes.length-1,l=e.panes[o].axes.reduce((e,t)=>e+t.plots.length,0)===1;return s||r.push(`ExistingAbove`),l||r.push(`NewAbove`),c||r.push(`ExistingBelow`),l||r.push(`NewBelow`),r}function xP(e,t,n){if(!bP(e,t,n).includes(t.targetPane))return e;let r=_N(e,t);if(r===void 0)return e;let i=Nd(e,r);if(i===null)return e;let a=hN(e,mN(r));e.panes[i.pane].axes[i.axis].plots.splice(i.plot,1);let o=i.pane,s=!0;switch(t.targetPane){case`ExistingAbove`:o--;break;case`NewAbove`:e.panes.splice(o,0,DN(e)),s=!1;break;case`ExistingBelow`:o++;break;case`NewBelow`:o++,s=!1,e.panes.splice(o,0,DN(e));break}let{mainPane:c}=Ud(e),l=e.panes[o]===c;s&&l&&a?.type===`Study`&&a.study===`VOL`&&(a.detachedScale=!0);let u=e.panes[o];u.axes.length<2&&u.axes[0].plots.length>0&&u.axes.push(EN());let d=u.axes.findIndex(e=>e.plots.length===0),f=d===-1?u.axes.length-1:d;u.axes[f].plots.push(a);let p=Fd(e,i.pane);return p=Fd(p,o),Nf(p)}function SP(e,t,n){return P(t.period)&&t.period&&(delete e.display.period,Qd(e),n&&(n.forceResetVisibleRange=!0)),e}function CP(e,t,n){let r=[],i=_N(e,t);if(i===void 0)return r;let a=hN(e,mN(i));if(a?.type!==t.type)return r;let o=Nd(e,i);if(o===null)return r;let s=e.panes[o.pane],c=o.axis===0,l=s.axes.some((e,t)=>e.plots.some((e,n)=>!(t===o.axis&&n===o.plot)&&!e.detachedScale)),u=a.detachedScale===!0;return(c||u)&&r.push(`SecondaryAxis`),(!c||u)&&r.push(`PrimaryAxis`),l&&r.push(`NoAxis`),r}function wP(e,t,n){if(!CP(e,t,n).includes(t.targetAxis))return e;let r=_N(e,t);if(r===void 0)return e;let i=-1;switch(t.targetAxis){case`PrimaryAxis`:i=0;break;case`SecondaryAxis`:i=1;break;case`NoAxis`:return Ld(e,r)}return Id(e,r,i)}function TP(e,t,n){let r=H(e,`.display.tooltip`)[0];return{visible:r.visible,mode:r.mode,showMainTitle:r.showMainTitle,mainTitle:r.mainTitle}}var EP=`..plots{.type === "Seasonal" && .main === true}`,DP=`..plots{.type === "Seasonal" && .main !== true}`,OP=B.AUTO_COLORS;function kP(e){return JSON.parse(JSON.stringify(e))}function AP(e,t){let n=H(e,EP);if(n.length===0)return e;let r=n[0];if(!r.offsets||r.offsets.length===0)return e;let i=r.offsets,a=H(e,DP);for(let e of a){let t=e.offsets??[],n=e.curves??[],r=new Map;t.length===n.length?t.forEach((e,t)=>{let i=n[t];i&&r.set(e,kP(i))}):n.forEach((e,t)=>{let n=i[t];e&&P(n)&&r.set(n,kP(e))});let a=r.get(0);a?.colors?.[0];let o=i.map((e,t)=>{let n=r.get(e);if(n)return n;let i=OP[t%OP.length];return{...a?kP(a):{},colors:[i],fields:[`Close`],style:`Line`,dashStyle:`Solid`,varyColorPerBar:!1,lineWidth:2}});e.offsets=[...i],e.curves=o}return Nf(e)}var jP={MainPlot:Zd,Aggregation:{Update:ef,Get:mP},Period:{Update:Gu,Delete:SP},Crosshair:{Update:nN,Get:pP},Tooltip:{Update:rN,Get:TP},Events:iN,Scale:{Update:aN,Get:fP},Other:{Update:oN,Get:lP},Plot:{Add:BN,Get:uN,Delete:cN,Update:SN},Compare:{Update:JN,Get:hP},AnnotationManipulation:{Get:$M,Update:tN},Annotation:{Get:iP,Add:aP,Update:sP,Delete:cP},MovePane:QN,Template:nP,Outline:rP,Theme:{Update:uP,Get:dP},Clear:gP,Previous:{Update:yP,Get:vP},MovePlot:{Update:xP,Get:bP},PinPlot:{Update:wP,Get:CP},SeasonalOffsets:{Update:AP}};function MP(e){return typeof e==`function`}function NP(e,t){let n=jP[e];if(MP(n))return n;{let e=t===void 0?void 0:n[t];if(!MP(e)&&(e=n[B.DEFAULT_ACCESSOR_SUBACTION],!MP(e)))throw Error(`Invalid accesor id and/or sub id`);return e}}function PP(e,t,n){return NP(e.id,e.context.id)(t,e.context,n)}function FP(e){return{id:`MainPlot`,context:e}}var IP={id:`SeasonalOffsets`,context:{}};function LP(e){return Array.isArray(e)&&e.some(e=>e?.type===`Seasonal`)}function RP(e){let{id:t,context:n}=e;if(!P(n))return!1;if(t===`Compare`)return LP(n.plots);if(t!==B.ACTION_PLOT)return!1;let r=n.id;return r===`Add`||r===`Update`?n.type===`Seasonal`:r===B.ACTION_DELETE?LP(n.plots):!1}function zP(e){return e.some(RP)?e[e.length-1]?.id!==`SeasonalOffsets`:!1}var BP={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},VP=Symbol.for(`__ias__`),HP=class{headless;presenter;_model;constructor(e=!1){this.headless=e,this.presenter=e?null:new qM(this)}get elementId(){return this.headless?null:this.presenter?.elementId??null}get hostElement(){return this.headless?null:this.presenter?.hostElement??null}initialize(e,t=null){if(this.headless){I(`You cannot initialize a headless chart.`,`error`);return}if(this.presenter.initialize(e),N(t)){let e=typeof t==`string`;e?I(`Initializing the chart with symbol name is deprecated. Please use object form instead (see docs for details). This API will be removed in the future.`,`warn`):(t.template&&this.load(t.template),delete t.template);let n=e?{symbol:t}:t;this.change(FP(n))}}shutdown(){if(!this.headless){let e=this.presenter?.shutdown();return this.presenter=null,e}return!1}annotate(e,t=null,n=null){if(!this.headless)if(P(e)){Dl(e,t),El(e,t);let r=gj(e,!1,t,n,this.presenter);r.isDrawingAnnotation&&this.presenter.view.setCursor(ee.Crosshair),this.presenter.activeTool=r,Ie()||this.presenter.view.mouseCanvas.focus({preventScroll:!0})}else this.presenter.resetActiveTool()}cancelAnnotation(){this.headless||this.presenter.resetActiveTool()}setMainAxisAnnotations(e){let t=this.presenter?.mainAxis;P(t)&&(t.annotations=e.map(e=>t.makeAnnotation(e)),t.fireAnnotationsChanged(),this.presenter.view?.redraw())}toMainAxisPoint(e){let t=this.presenter?.mainAxis;if(!P(t))return null;let n=t.toAnnotationPoint(e);return{price:n.price,time:n.time}}fromMainAxisPoint(e){let t=this.presenter?.mainAxis;if(!P(t))return null;let n=t.toX(new Date(e.time)),r=t.toY(e.price);return!P(n)||!P(r)?null:{x:n,y:r}}zoom(e){!this.headless&&typeof e==`boolean`&&(e?this.annotate(`ZoomIn`):this.presenter.defaultTool.resetView(this.presenter))}getDefaultTemplate(){return pF()}get model(){return(this.headless?this._model:this.presenter.getModel())||pF()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:B.ACTION_TEMPLATE,context:{strip:e}})}change(...e){if(e.length>1&&e.some(e=>e.id===`AnnotationManipulation`))throw Error(`AnnotationManipulation must be executed as a standalone action`);let t={chart:this,actions:e.filter(e=>!e[VP])};t.actions.length>0&&this.presenter?.notifyHost(K.CH_API_ACTIONS_RECEIVED,t);let n=$().config.validateInput,r=e.map(e=>n?Mf(e,B.ACCESSOR_SCHEMA):e);if(r.length===1){let e=r[0];if(e.id===B.ACTION_TEMPLATE||e.context.id===B.ACTION_GET)return PP(e,this.model,this.presenter);if(!this.headless&&e.id===`AnnotationManipulation`){PP(e,this.model,this.presenter);return}else if(!this.headless&&e.id===B.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}let{yes:i,no:a}=A(r,e=>e.id===B.ACTION_PLOT&&P(e.context)&&e.context.id===B.ACTION_DELETE),o=F(this.model),s=F(this.model),c=a;i.length>0&&c.push({id:B.ACTION_PLOT,context:{id:B.ACTION_DELETE,plots:i.map(e=>e.context)}}),c.forEach(e=>{if(s=PP(e,s,this.presenter),!P(s))throw Error(`Forgot to return model from accessor`)}),zP(c)&&(s=PP(IP,s,this.presenter)),this.fromModel(s,o)}async fromModel(e,t){let n=Mf(e,B.CHART_SCHEMA);this.headless?this._model=n:await this.presenter?.fromModel(n,t)}async load(e,t){let n={...BP,...t},r=Mf(JSON.parse(e),B.CHART_SCHEMA),i=this.model,a=F(i);if(P(i)){if(r=Wd(i,r,n.keepNewAnnotations),n.keepNewAnnotations||(r=eP(r)),n.keepOldAnnotations&&(r=SM(i,r)),n.keepNewCompare||(r=tP(r)),n.keepOldCompare&&(r=ZN(i,r)),n.keepOldAggregation){let e={id:B.ACTION_AGGREGATION,context:i.data.aggregation},t=r.display.density;r=PP(e,r,this.presenter),n.keepNewBarWidth&&P(t)&&(r.display.density=t)}await this.fromModel(r,a),this.clearUndoRedo()}}save(){return JSON.stringify(this.model)}clearUndoRedo(){!this.headless&&this.presenter?.undoRedoManager&&this.presenter.undoRedoManager.clear(!0)}reset(e=!0){let t=pF();if(this.headless)this._model=t;else if(this.presenter.getModel()){let n=this.presenter.mainPlot,r=null,i=n;if(n.isSymbol?r={symbol:i.symbol}:n.isExpression?r={expression:i.expression}:n.isForward?r={forward:i.forward}:n.isSeasonal&&(r={seasonal:i.seasonal}),P(r)){let n=PP({id:`Theme`,context:{id:`Get`}},this.model,this.presenter),i=PP(FP(r),t,this.presenter);e&&(i=PP({id:`Theme`,context:n},i,this.presenter)),this.presenter?.fromModel(i)}}this.clearUndoRedo(),this.presenter?.notifyHost(K.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){I(`Obsolete: please use 'exportImage' method instead.`,`warn`)}setTitle(e){this.headless||this.presenter.setTitle(e)}getPaneBounds(e=!0){if(!this.headless)return this.presenter.panes.map(t=>e?t.getBounds():t.getBoundsWithoutScales())}exportData(e={}){return this.headless?null:UM.call(this.presenter,e)}exportTable(e={}){return this.headless?null:RM.call(this.presenter,e)}exportImage(e={}){return this.headless?null:WM.call(this.presenter,e)}getDataStats(){return this.presenter.getDataStats()}get canUndo(){return!this.headless&&(this.presenter?.undoRedoManager?.canUndo??!1)}get canRedo(){return!this.headless&&(this.presenter?.undoRedoManager?.canRedo??!1)}undo(){this.canUndo&&this.presenter?.undoRedoManager?.undo()}redo(){this.canRedo&&this.presenter?.undoRedoManager?.redo()}pauseUndoRedo(){this.headless||this.presenter?.undoRedoManager?.pause()}resumeUndoRedo(e){this.headless||this.presenter?.undoRedoManager?.resume(e)}priceToY(e,t=0,n=0){let r=this.presenter;if(this.headless||t<0||n<0||t>r.panes.length)return null;let i=r.panes[t];return n>i.axes.length?null:i.axes[n].toY(e)}yToPrices(e){let t=this.presenter;if(this.headless)return null;for(let[n,r]of t.panes.entries()){let t=r.getBounds();if(P(t)&&e>=t.y&&e<=t.y+t.height)return{pane:n,prices:r.axes.map(t=>t.toPrice(e))}}return{pane:-1,prices:[]}}activate(){this.presenter?.notifyHost(K.CH_DIDBECOMEACTIVE,{chart:this})}};function UP(e){let t=e.split(`.`);if(!t||t.length!==4)return!1;let n=t.map(Number);if(!n.every(e=>Number.isFinite(e)&&e>=0&&e<=255))return!1;let[r,i]=n;return r===10||r===172&&i>=16&&i<=31||r===192&&i===168}function WP(){let e=globalThis.parent?.location?.hostname||``;return[``,`localhost`,`127.0.0.1`].includes(e)||UP(e)}function GP(){let e=document.domain,t=e.split(`.`),n=`__tld`+new Date().getTime(),r=0;for(;r<t.length-1&&document.cookie.indexOf(`${n}=${n}`)===-1;)e=t.slice(-1-++r).join(`.`),document.cookie=`${n}=${n};domain=${e};`;return document.cookie=`${n}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=${e};`,e}function KP(e,t){return ot(t),`${e}/?${new URLSearchParams(t).toString()}`}var qP=`aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ==`,JP=`YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy`;function YP(e,t=``){return KP(atob(qP),{module:atob(JP),secret:t,referer:e})}function XP(e,t){return e+Math.random()*(t-e)}var ZP=Function(atob(`Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg`)),QP=Function(`f`,atob(`Zi5yZW1vdmVBbGxDaGFydHMoKTsg`)),$P=Function(`m`,atob(`cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiIHx8IG0gPT09ICJFcVBsdXMiOw==`)),eF=`YXV0aG9yaXplZA==`,tF=`ZGF0YS1lbmRwb2ludA==`,nF=`YWxsb3dDcmVkZW50aWFscw==`;async function rF(e,t){if(t&&!$P(e.mode))return;let n=!1,r=0,i=25;for(;!n&&r<5;){let t=WP()||e.mode===`FreeWidget`,a=t?e.apiKey:``;try{let i=YP(t?``:GP(),a),o=await fetch(i);if(!o.ok)r++;else{let t=await o.json(),r=t[atob(eF)];e.knownSite=r,r?(e.dataEndpoint=(t[atob(tF)]||``).replace(/\/$/g,``),e.allowCredentials=t[atob(nF)]):(e.dataEndpoint=``,e.allowCredentials=!1),n=!0;break}}catch{}r++,i*=2,await new Promise(e=>setTimeout(e,i))}(!n||!e.knownSite)&&iF()}function iF(){setTimeout(ZP,XP(2e3,3e3)),setTimeout(()=>QP($()),XP(4e3,5e3))}var aF={major:2,minor:404,patch:0,prerelease:!1},oF={environment:`Browser`,validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${B.CHART_DEFINITION}`,cachedAnnotationsCount:0,showResizeHandles:!1,scrollBehavior:`wheel+shift`,bypassSmoothing:!1,showGoToLatest:void 0,tooltipMovement:`Auto`,tooltipHeaders:void 0,touchCrosshairTimeoutMillis:void 0,touchCrosshairDelayMillis:void 0,mode:`Unspecified`,hostingModel:`Page`,overrides:void 0,logo:void 0,logoClickable:void 0,noDataText:void 0,useAllFieldsForComparison:void 0,colorfulAnnotations:!1,annotationManipulation:void 0,baseUrl:{instruments:`/proxies/instruments`,futures:`/proxies/futures`,extras:`/extras`,timeseries:`/proxies/timeseries`,timeseriesNew:`/proxies/new-timeseries`,ondemand:`/proxies/ondemand`,options:`/proxies/core-api`},credentials:void 0,apiKey:void 0,extensions:void 0,defaultVolumeBarColoring:void 0,defaultMainPlotBarColoring:void 0,async fetch(e,t){let n=this.baseUrl[e],r=`${n}${t}`;if($P(this.mode)&&this.knownSite){let{username:i,password:a}=this.credentials||{},o=P(i,a),s=(e===`timeseries`||e===`timeseriesNew`)&&o&&this.allowCredentials?`&username=${i}&password=${a}`:``;r=`https://${this.dataEndpoint}${n}${t}${s}`}return await(await fetch(r)).text()},getCustomEventPopup:e=>null};async function sF(e,t){let n=$()?.config;if(!n||!n.fetch)throw Error(`You should call initFeed first`);let r=t;return e===`timeseries`?r=`/historical${t}`:e===`options`&&(r=`/options-historical${t}`),await n.fetch.call(n,e,r)}var cF=!1,lF=null;function uF(){let e=aF,t=e.prerelease?`-${e.prerelease.identifier}.${e.prerelease.ordinal}`:``;return`${e.major}.${e.minor}.${e.patch}${t}`}function dF(e){let t=e.extensions?.studyProvider;if(!P(t))return;let n=t.getFields(),r=t.getStudies(),i=F(Xs(B.CHART_SCHEMA)),a=i.definitions,o=a.studyField.enum,s=a.study.enum;for(let e of n)if(o.includes(e.id))throw Error(`Field with id ${e.id} already exists`);for(let e of r)if(s.includes(e.id))throw Error(`Study with id ${e.id} already exists`);o.push(...n.map(e=>e.id)),s.push(...r.map(e=>e.id)),Of(B.CHART_SCHEMA,i),Rf(n),tc(r)}function fF(e,t={}){if(cF)throw Error(`You should only call initFeed once during page's lifetime`);cF=!0;let n=Object.assign(oF);return lt(n,t),N(n.logo)&&Rk(n.logo,n.logoClickable??!1),dF(n),lF=new e(n),lF.version=uF(),I(`%cBarchart Chart version ${lF.version}`,`info`,`font-size: larger`),lF.cachesData&&(lF.subject?.subscribe(lF.onPerformInternalGc.bind(lF)),$y.default.subscribe(K.CH_ALL,lF.onChartChanged.bind(lF))),lF}function $(){return lF}function pF(){return F($()?.template)}function mF(){N(lF)&&(lF.shutdown(),cF=!1,lF=null)}function hF(){return new HP(!0)}function gF(e){let t=hF();return t.load(e),t.change({id:`Outline`,context:{id:`Get`}})}function _F(e,t,n,r=null){return new Proxy(e,{get:function(e,i,a){return i===t?function(t){let a=r?t[r]:t;return(n.handlesRequestsFor(a)?n:e)[i](t)}:Reflect.get(e,i,a)}})}var vF=class{config;version;cachesData;timeSeriesSource;metaDataSource;recordSource;charts;pendingRedraw;template;ongoingAnimationCallbackId;_altDataSource;_subject;knowDefaultCurve;defaultOhlcCurve;knowDefaultAggregation;defaultAggregation;knowDefaultPeriod;defaultPeriod;knowDefaultDensity;defaultDensity;id;_mainFeed=null;onBrowserOnline;constructor(e){this.config=e,this.timeSeriesSource=this.metaDataSource=this.recordSource=null,this.charts=new Map,this.pendingRedraw=new Set,this.ongoingAnimationCallbackId=null,this.drawCharts=this.drawCharts.bind(this),this.template=null,this.cachesData=!1,this._altDataSource=null,this._subject=null,this.id=bt(),this.onBrowserOnline=()=>{!this.cachesData||this.isAuxiliary||(this.traceFeed(`refresh:online`),this.refreshCaches())},globalThis.addEventListener?.(`online`,this.onBrowserOnline)}traceFeed(e,t={}){Ih(e,{feedId:this.id,isAuxiliary:this.isAuxiliary,...t})}get subject(){return!this.isAuxiliary&&!N(this._subject)&&(this.traceFeed(`gc:stream:init`,{gcMillis:B.INTERNAL_GC_MILLIS}),this._subject=new $p().pipe(Fm(B.INTERNAL_GC_MILLIS),Pm(e=>e.length>0))),this._subject}get isAuxiliary(){return window.opener!==null}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=_F(this.timeSeriesSource,`getTimeSeries`,e,`symbol`),this.metaDataSource=_F(this.metaDataSource,`getMetaData`,e),this.recordSource=_F(this.recordSource,`getRecord`,e)}replaceDataSources(e){this._altDataSource=e._altDataSource,this.timeSeriesSource=e.timeSeriesSource,this.metaDataSource=e.metaDataSource,this.recordSource=e.recordSource}getAltDataSource(){return this._altDataSource}getTimeSeriesDataSource(){if(!N(this.timeSeriesSource))throw Error(`No time series source defined`);return this.timeSeriesSource}getMetaDataSource(){if(!N(this.metaDataSource))throw Error(`No metadata source defined`);return this.metaDataSource}getRecordSource(){if(!N(this.recordSource))throw Error(`No record source defined`);return this.recordSource}async ready(){return da.call(this,async()=>{let e=this instanceof CF||this instanceof yF||this instanceof EF;await rF(this.config,e);let t=this.config.defaultTemplate;if(!t)throw Error(`Must provide a default template`);return typeof t==`string`&&(t=await(await fetch(t)).json()),this.template=Mf(t,B.CHART_SCHEMA),!0})}getHeadlessChart(){return hF()}fixupRenderTo(e){if(!N(e))return null;if(e instanceof HTMLElement)return e;let t=na(`#${e}`);if(N(t))return t;let n=[...this.charts.keys()].find(t=>t.id===e);return N(n)?n:null}checkChart(e,t){let n=this.fixupRenderTo(e),r=N(n)&&this.charts.has(n);return N(t)&&t!==r&&I(`There is ${t?`no`:`already a`} chart inside the element ${e}`,`error`),n}addChart(e,t=null){let n=this.checkChart(e,!1),r=new HP;return this.charts.set(n,r),r.initialize(e,t),r}removeChart(e){let t=this.checkChart(e,!0);N(t)&&(this.charts.get(t).shutdown(),this.charts.delete(t))}removeAllCharts(){for(let e of this.charts.keys())this.removeChart(e)}getChart(e){let t=this.checkChart(e);return N(t)?this.charts.get(t):null}redraw(e){let t=this.checkChart(e,!0);N(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),N(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach(e=>{let t=this.getChart(e);if(!N(t?.presenter?.view))return;let n=t.presenter.view;n.isHostElementVisible&&n.draw()}),this.pendingRedraw.clear()}get emptyEntities(){return{metaData:new Set,records:new Set,timeSeries:new Set}}getAllCacheableEntities(e){for(let t of this.charts.values())t.presenter.getCacheableEntities(e)}getCacheableEntities(){let e=this.emptyEntities;return this.getAllCacheableEntities(e),e.timeSeries.forEach(t=>{N(t)&&(N(t.record)&&e.records.add(t.record),N(t.records)&&Object.values(t.records).forEach(t=>e.records.add(t)))}),e}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){let e=this.getCacheableEntities();this.traceFeed(`refresh:caches`,{metaData:e.metaData.size,records:e.records.size,timeSeries:e.timeSeries.size}),this.getMetaDataSource().refresh?.(),this.getRecordSource().refresh?.(e.records),e.timeSeries.forEach(e=>{e.isCached||e.refresh()}),this.getTimeSeriesDataSource().refresh(),Ge(K.DF_STREAMRECONNECTED,{})}evictUnused(e){this.getMetaDataSource().evictUnused(e.metaData),this.getRecordSource().evictUnused(e.records),this.getTimeSeriesDataSource().evictUnused(e.timeSeries)}onPerformInternalGc(){let e=this.getCacheableEntities();this.traceFeed(`gc:run`,{chartCount:this.charts.size,metaData:e.metaData.size,records:e.records.size,timeSeries:e.timeSeries.size}),this.evictUnused(e)}triggerGc(e=`unknown`){this.traceFeed(`gc:request`,{reason:e}),this.subject?.next()}onChartChanged(e,t){(e===K.CH_RECREATED||e===K.CH_SHUTDOWN)&&(this.isAuxiliary?this._mainFeed?.triggerGc(`${e}:aux:${this.id}`):this.triggerGc(e))}getDefaultMultiFieldCurve(){if(!N(this.template))return null;if(!this.knowDefaultCurve){let e=Hd(this.template);e.curves.length===1&&Ku(e.curves[0].style)?this.defaultOhlcCurve=F(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=F(this.template.data.aggregation),this.knowDefaultAggregation=!0),this.defaultAggregation}getDefaultPeriod(){return!this.knowDefaultPeriod&&this.template&&(this.defaultPeriod=this.template.display?.period,this.knowDefaultPeriod=!0),this.defaultPeriod}getDefaultDensity(){return!this.knowDefaultDensity&&this.template&&(this.defaultDensity=this.template.display?.density,this.knowDefaultDensity=!0),this.defaultDensity}shutdown(){globalThis.removeEventListener?.(`online`,this.onBrowserOnline),this.isAuxiliary||this.clearCaches(),this.removeAllCharts()}},yF=class extends vF{constructor(e){super(e),this.timeSeriesSource=new D_(!1),this.metaDataSource=new Ja,this.recordSource=new Bh}},bF=class extends vF{constructor(e){super(e),this.timeSeriesSource=new D_(!0),this.metaDataSource=new Ja,this.recordSource=new Vh}},xF=class extends vF{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new D_(!0),this.metaDataSource=new Ja,this.recordSource=new Bh}},SF=[`drazen.dotlic@barchart.com`,`princec`,`b.hebert24@barchart.com`],CF=class extends vF{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;_connection;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new D_(!0),this.metaDataSource=new Ya,this.recordSource=new Hh,this.onEvents=this.onEvents.bind(this),this.onTimestamp=this.onTimestamp.bind(this),this.resetStreamingState()}resetStreamingState(){this.lastStreamingTimestamp=null,this._isActivelyStreaming=null,this.needToResubscribe=!1}get connection(){return this._connection}set connection(e){this._connection=e,N(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){N(this._isActivelyStreaming)&&!this._isActivelyStreaming&&e&&(this.debug(`need to refresh caches`),this.refreshCaches()),this._isActivelyStreaming=e}get isActivelyStreaming(){return this._isActivelyStreaming}initializeStreaming(){this.resetStreamingState(),this.connection.on(`events`,this.onEvents),this.connection.on(`timestamp`,this.onTimestamp)}onTimestamp(e){this.isActivelyStreaming&&(this.lastStreamingTimestamp=e)}debug(e){this.connection&&SF.includes(this.connection._username)&&I(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===B.BC_EVENT_DISCONNECTED||e===B.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):(e===B.BC_EVENT_LOGGED_IN||e===B.BC_EVENT_FEED_RESUMED)&&(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),N(this._connection)&&(this.connection.off(`timestamp`,this.onTimestamp),this.connection.off(`events`,this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}};function wF(e,t){return new TF(e,t)}var TF=class{_client;_subscriptions=new Map;_listeners=new Set;constructor(e,t){this._client=e;let n=e=>e.find(e=>this._subscriptions.has(e))??null;t.onConnected=()=>{this._listeners.forEach(e=>e?.onConnected())},t.onMessageWithMetadata=(e,t)=>{let r=e.marketSnapshot;if(N(r)){let e=n(t);e!==null&&this._listeners.forEach(t=>t.onSnapshot?.(r,e))}let i=e.marketUpdate;if(N(i)){let e=n(t);e!==null&&this._listeners.forEach(t=>t.onUpdate?.(i,e))}},t.onDisconnected=()=>{this._listeners.forEach(e=>e?.onDisconnected())},t.onHeartBeat=e=>{this._listeners.forEach(t=>t.onHeartBeat?.(e))}}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}async ready(){return N(await this._client.connection)}shutdown(){N(this._client)&&(this._client.dispose(),this._subscriptions.clear(),this._listeners.clear())}subscribeToRealTime(e){if(this._subscriptions.has(e)||!N(this._client))return;let t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribeFromRealTime(e){if(!this._subscriptions.has(e)||!N(this._client))return;let t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e)}async getInstrument(e){return await(await this._client.connection)?.getInstrument(e)??[]}},EF=class extends vF{_adapter=null;_auxFeeds=[];constructor(e){super(e),this.cachesData=!0,this.isAuxiliary||(this.timeSeriesSource=new D_(!0),this.metaDataSource=new Xa,this.recordSource=new Uh,$y.default.subscribe(K.TS_ALL,this.onTimeSeriesMessage.bind(this)))}onTimeSeriesMessage(e,t){if(!this.isAuxiliary)for(let n of this._auxFeeds)n.notifySeriesMessage(e,t)}notifySeriesMessage(e,t){this.isAuxiliary&&Ge(e,t)}getAdapter(){return this.isAuxiliary?this._mainFeed?._adapter:this._adapter}setAdapter(e){if(this.isAuxiliary)throw Error(`Cannot set adapter on auxiliary feed`);this._adapter=e,this._adapter.addListener(this)}async ready(){if(this.isAuxiliary){let e=await this._mainFeed?.ready()??!1;return e&&(this.template=this._mainFeed.template),e}return await super.ready(),await this._adapter?.ready()??!1}subscribe(e){this.traceFeed(`openfeed:subscribe`,{symbol:e}),this.getAdapter()?.subscribeToRealTime(e)}unsubscribe(e){this.traceFeed(`openfeed:unsubscribe`,{symbol:e}),this.getAdapter()?.unsubscribeFromRealTime(e)}shutdown(){super.shutdown(),this.isAuxiliary?(this._mainFeed?.removeAuxFeed(this),this._mainFeed=null):this._adapter?.shutdown()}onConnected(){this.refreshCaches()}onDisconnected(){}onHeartBeat(){}onUpdate(e,t){this.ofRecordSource.onUpdate(e,t)}onSnapshot(e,t){this.ofRecordSource.onSnapshot(e,t)}get ofRecordSource(){return this.recordSource}replaceDataSources(e){super.replaceDataSources(e),this._mainFeed=e}addAuxFeed(e){e.replaceDataSources(this),this._auxFeeds.push(e),this._adapter?.addListener(e)}removeAuxFeed(e){let t=this._auxFeeds.findIndex(t=>t.id==e.id);t!==-1&&(this._auxFeeds.splice(t,1),this._adapter?.removeListener(e),this.triggerGc(`removeAuxFeed:${e.id}`))}getAllCacheableEntities(e){if(super.getAllCacheableEntities(e),!this.isAuxiliary)for(let t of this._auxFeeds)t.getAllCacheableEntities(e)}},DF=$y.default;export{Ru as Aggregation,_ as AggregationSpec,g as AggregationUnit,yF as BarchartSiteDataFeed,vF as BaseDataFeed,zh as BaseRecordSource,re as ChunkPart,v_ as ContainerWrapperTimeSeries,mM as CustomEventPopup,Gf as EmptyRecord,u as ExpressionMissingBar,f as ExpressionNoDataApproach,d as ExpressionRecompute,tb as ExpressionSeries,Ff as Field,b as FieldCategory,y as FieldFormat,v as FieldValueType,G as Fields,CF as MarketDataFeed,xF as MiniWidgetDataFeed,hg as OHLCDataPointBuilder,EF as OpenFeed,DF as PubSub,w as SeriesKind,bF as SnapshotDataFeed,J as StudySeries,_g as TimeSeriesContainer,Qy as TimeSeriesQuery,K as Topics,wF as adaptOpenFeedClient,sa as appendDOMElement,da as asyncReady,cc as canBeBasedOnSeasonal,Z as convertSeries,HM as convertTableToCsv,lg as dateToOptionValue,Td as doesExpressionHaveComputation,oc as doesStudyExist,bd as evaluateExpression,Cd as formatExpression,Ia as formatPriceWithDecimals,bt as generateUid,ic as getAnnotationTraits,gF as getChartOutline,La as getCombinedMetaData,wd as getExpressionSymbols,$ as getFeed,bo as getLightness,xj as getStudyOptions,pc as getTaxonomies,Hi as hasOpenInterest,fF as initFeed,QD as linReg,eb as makeExpression,q as makeHelperField,DD as makeStudy,Q as mapSeries,Y as movAvg,X as movExp,MD as movHul,AD as movSmo,jD as movWei,cg as optionValueToDate,yd as parseExpression,Ed as replaceExpressionSymbols,UD as roc,ia as setAttributesDOMElement,mF as shutdownFeed,KD as stdDev,ra as styleDOMElement,RD as trueRange,HD as typical};
|