@barchart/chart-lib 2.344.0 → 2.345.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.
@@ -1,21 +1,21 @@
1
- function e(e){return e&&e.__esModule?e.default:e}var t,i,s,r,n,a,o,l,u,h,c,d,p,f,m,g,y,T,A,S,v,b,P,C,E,_,M,L,x,O,I=globalThis,D={},w={},R=I.parcelRequireffd0;null==R&&((R=function(e){if(e in D)return D[e].exports;if(e in w){var t=w[e];delete w[e];var i={id:e,exports:{}};return D[e]=i,t.call(i.exports,i,i.exports),i.exports}var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(e,t){w[e]=t},I.parcelRequireffd0=R);var N=R.register;N("3DQaT",function(e,t){!function(){var t=function(){var e,t,i,s;function r(){for(var e,t=n();f("|");)v(),(e||(e=[t])).push(n());return e?{type:8,args:e}:t}function n(){return f("(")?a():l()}function a(){T("(");var e=r();T(")");for(var t,i=[];t=o();)i.push(t);return i.length?1===e.type?(e.parts=e.parts.concat(i),e):(i.unshift(e),{type:1,parts:i}):e}function o(){var e,t;return f("[")?(T("["),e=function(){if(f(":"))return v(),{type:10,toIdx:p()};var e=p();return f(":")?(v(),f("]"))?{type:10,fromIdx:e}:{type:10,fromIdx:e,toIdx:p()}:{type:10,idx:e}}(),T("]"),{type:4,arg:e}):f("{")?(T("{"),t=u(),T("}"),{type:3,arg:t}):f("(")?a():void 0}function l(){m()||C(v());var e,t=!1;f("^")?(v(),t=!0):y()&&(e=v().val.substr(1));for(var i,s,r,n,a=[];n=g()?(s=v().val,r=A(),(f("*")||1===r.type||3===r.type)&&(i=v().val),{type:2,selector:s,prop:i}):o();)a.push(n);return{type:1,fromRoot:t,subst:e,parts:a}}function u(){for(var e,t=h();f("||");)v(),(e||(e=[t])).push(h());return e?{type:5,op:"||",args:e}:t}function h(){for(var e,t=c();f("&&");)v(),(e||(e=[t])).push(c());return e?{type:5,op:"&&",args:e}:t}function c(){for(var e=function e(){for(var t=function(){for(var e=d();f("+")||f("-");)e={type:7,op:v().val,args:[e,d()]};return e}();f("<")||f(">")||f("<=")||f(">=");)t={type:6,op:v().val,args:[t,e()]};return t}();f("==")||f("!=")||f("===")||f("!==")||f("^==")||f("==^")||f("^=")||f("=^")||f("$==")||f("==$")||f("$=")||f("=$")||f("*==")||f("==*")||f("*=")||f("=*");)e={type:6,op:v().val,args:[e,c()]};return e}function d(){for(var e=p();f("*")||f("/")||f("%");)e={type:7,op:v().val,args:[e,d()]};return e}function p(){var e,t;return f("!")||f("-")?{type:9,op:v().val,arg:p()}:3===(e=A().type)||2===e||4===e||5===e?{type:11,val:v().val}:m()?l():f("(")?(T("("),t=u(),T(")"),t):C(v())}function f(e){var t=A();return 6===t.type&&t.val===e}function m(){return g()||y()||f("^")}function g(){var e=A();if(6===e.type){var t=e.val;return"."===t||".."===t}return!1}function y(){var e=A();return 1===e.type&&"$"===e.val[0]}function T(e){var t=v();(6!==t.type||t.val!==e)&&C(t)}function A(){if(null!==i)return i;var e=t;return i=S(),t=e,i}function S(){for(;i=e[t]," \r\n ".indexOf(i)>-1;)++t;if(t>=s)return{type:7,range:[t,t]};var i,r=function(){var i=t,s=e[t],r=e[t+1];if("."===s){if(b(r))return;return"."===e[++t]?{type:6,val:"..",range:[i,++t]}:{type:6,val:".",range:[i,t]}}if("="===r){var n=e[t+2];if("="===n){if("=!^$*".indexOf(s)>=0)return{type:6,val:s+r+n,range:[i,t+=3]}}else if("^$*".indexOf(n)>=0){if("="===s)return{type:6,val:s+r+n,range:[i,t+=3]}}else if("=!^$*><".indexOf(s)>=0)return{type:6,val:s+r,range:[i,t+=2]}}else if("="===s&&"^$*".indexOf(r)>=0)return{type:6,val:s+r,range:[i,t+=2]};return s===r&&("|"===s||"&"===s)?{type:6,val:s+r,range:[i,t+=2]}:":{}()[]^+-*/%!><|".indexOf(s)>=0?{type:6,val:s,range:[i,++t]}:void 0}();if(r||(r=function(){var i=e[t];if(P(i)){for(var r,n=t,a=i;++t<s&&(P(r=i=e[t])||r>="0"&&r<="9");){;a+=i}switch(a){case"true":case"false":return{type:4,val:"true"===a,range:[n,t]};case"null":return{type:5,val:null,range:[n,t]};default:return{type:1,val:a,range:[n,t]}}}}())||(r=function(){if('"'===e[t]||"'"===e[t]){for(var i,r=e[t],n=++t,a="",o=!1;t<s;){if("\\"===(i=e[t++]))i=e[t++];else if(('"'===i||"'"===i)&&i===r){o=!0;break}a+=i}if(o)return{type:3,val:a,range:[n,t]}}}())||(r=function(){var i=t,r=e[t],n="."===r;if(n||b(r)){for(var a=r;++t<s;){if("."===(r=e[t])){if(n)return;n=!0}else if(!b(r))break;a+=r}return{type:2,val:n?parseFloat(a):parseInt(a,10),range:[i,t]}}}()))return r;r={range:[t,t]},t>=s?r.type=7:r.val=e[t],C(r)}function v(){var e;return i?(t=i.range[1],e=i,i=null,e):S()}function b(e){return"0123456789".indexOf(e)>=0}function P(e){return"$"===e||"@"===e||"_"===e||e>="a"&&e<="z"||e>="A"&&e<="Z"}function C(e){7===e.type&&E(e,"Unexpected end of path"),E(e,'Unexpected token "%0"',e.val)}function E(e,t){var i=Array.prototype.slice.call(arguments,2),s=Error(t.replace(/%(\d)/g,function(e,t){return i[t]||""}));throw s.column=e.range[0],s}return function(n){e=n.split(""),t=0,i=null,s=e.length;var a=r(),o=v();return 7!==o.type&&C(o),a}}(),i=function(){function e(){if(A.length)return A.shift();var e="v"+ ++T;return y.push(e),e}function t(){for(var e=arguments,t=e.length;t--;)A.push(e[t])}function i(o,h,c){switch(o.type){case 1:var d,p,f,m,y,T,A,v,b,P,C,E,_,M,L,x,O,I,D,w,R,N,V=o.parts,H=0,F=V.length;for(g.push(h,"=",o.fromRoot?"data":o.subst?"subst."+o.subst:c,";","isArr("+h+") || ("+h+" = ["+h+"]);");H<F;){var k=V[H++];switch(k.type){case 2:".."===k.selector?function(i,s,r){var n=i.prop,o=e(),l=e(),u=e(),h=e(),c=e(),d=e(),p=e(),f=e();g.push(o,"=",r,".slice(),",f,"= [];","while(",o,".length) {",l,"=",o,".shift();"),n?g.push("if(typeof ",l,'=== "object" &&',l,") {"):g.push("if(typeof ",l,"!= null) {"),g.push(u,"= [];","if(isArr(",l,")) {",h,"= 0,",p,"=",l,".length;","while(",h,"<",p,") {",d,"=",l,"[",h,"++];"),n&&g.push("if(typeof ",d,'=== "object") {'),a(u,d),n&&g.push("}"),g.push("}","}","else {"),n?"*"!==n&&(g.push(d,"=",l,'["'+n+'"];'),a(f,d)):(a(f,l),g.push("if(typeof ",l,'=== "object") {')),g.push("for(",c," in ",l,") {","if(",l,".hasOwnProperty(",c,")) {",d,"=",l,"[",c,"];"),a(u,d),"*"===n&&a(f,d),g.push("}","}"),n||g.push("}"),g.push("}",u,".length &&",o,".unshift.apply(",o,",",u,");","}","}",s,"=",f,";"),t(o,l,u,h,c,d,p,f)}(k,h,h):function(i,s,r){if(i.prop){var o=n(i.prop),l=e(),u=e(),h=e(),c=e(),d=e(),p=e(),f=e();g.push(l,"= [];",u,"= 0;",h,"=",r,".length;",f,"= [];","while(",u,"<",h,") {",c,"=",r,"[",u,"++];","if(",c,"!= null) {"),"*"===i.prop?(g.push("if(typeof ",c,'=== "object") {',"if(isArr(",c,")) {",l,"=",l,".concat(",c,");","}","else {","for(",d," in ",c,") {","if(",c,".hasOwnProperty(",d,")) {",p,"=",c,"[",d,"];"),a(l,p),g.push("}","}","}","}")):(g.push(p,"=",c,"[",o,"];"),a(l,p,f,h)),g.push("}","}",s,"=",h,"> 1 &&",f,".length?",f,".length > 1?","concat.apply(",l,",",f,") :",l,".concat(",f,"[0]) :",l,";"),t(l,u,h,c,d,p,f)}}(k,h,h);break;case 3:!function(s,r,n){var a=e(),o=e(),u=e(),h=e(),c=e();g.push(a,"= [];",o,"= 0;",u,"=",n,".length;","while(",o,"<",u,") {",c,"=",n,"[",o,"++];"),i(s.arg,h,c),g.push(l(s.arg,h),"&&",a,".push(",c,");","}",r,"=",a,";"),t(a,o,u,c,h)}(k,h,h);break;case 4:!function(s,r,n){var a,o,l=s.arg;if(l.idx){var u=e();return i(l.idx,u,n),g.push(u,"< 0 && (",u,"=",n,".length +",u,");",r,"=",n,"[",u,"] == null? [] : [",n,"[",u,"]];"),t(u)}l.fromIdx?l.toIdx?(i(l.fromIdx,a=e(),n),i(l.toIdx,o=e(),n),g.push(r,"=",n,".slice(",a,",",o,");"),t(a,o)):(i(l.fromIdx,a=e(),n),g.push(r,"=",n,".slice(",a,");"),t(a)):(i(l.toIdx,o=e(),n),g.push(r,"=",n,".slice(0,",o,");"),t(o))}(k,h,h);break;case 8:r(k,h,h)}}break;case 8:r(o,h,c);break;case 6:d=o,p=h,f=c,m=e(),y=e(),T=e(),A=e(),v=e(),b=e(),P=e(),C=e(),E=d.args[0],_=d.args[1],g.push(p,"= false;"),i(E,m,f),i(_,y,f),M=1===E.type,L=11===_.type,g.push(T,"="),M?g.push("true;"):g.push("isArr(",m,");"),g.push(A,"="),L?g.push("false;"):g.push("isArr(",y,");"),g.push("if("),M||g.push(T,"&&"),g.push(m,".length === 1) {",m,"=",m,"[0];",T,"= false;","}"),L||g.push("if(",A,"&&",y,".length === 1) {",y,"=",y,"[0];",A,"= false;","}"),g.push(v,"= 0;","if(",T,") {",P,"=",m,".length;"),L||(g.push("if(",A,") {",C,"=",y,".length;","while(",v,"<",P,"&& !",p,") {",b,"= 0;","while(",b,"<",C,") {"),s(d.op,m+"["+v+"]",y+"["+b+"]"),g.push(p,"= true;","break;","}","++",b,";","}","++",v,";","}","}","else {")),g.push("while(",v,"<",P,") {"),s(d.op,m+"["+v+"]",y),g.push(p,"= true;","break;","}","++",v,";","}"),L||g.push("}"),g.push("}"),L||(g.push("else if(",A,") {",C,"=",y,".length;","while(",v,"<",C,") {"),s(d.op,m,y+"["+v+"]"),g.push(p,"= true;","break;","}","++",v,";","}","}")),g.push("else {",p,"=",S[d.op](m,y),";","}"),t(m,y,T,A,v,b,P,C);break;case 7:x=o,O=h,I=c,D=e(),w=e(),i((R=x.args)[0],D,I),i(R[1],w,I),g.push(O,"=",S[x.op](u(R[0],D),u(R[1],w)),";"),t(D,w);break;case 5:!function(s,r,n){var a,o=[],u=s.args,h=u.length,c=0;switch(g.push(r,"= false;"),s.op){case"&&":for(;c<h;)o.push(a=e()),i(u[c],a,n),g.push("if(",l(u[c++],a),") {");g.push(r,"= true;");break;case"||":for(;c<h;)o.push(a=e()),i(u[c],a,n),g.push("if(",l(u[c],a),") {",r,"= true;","}"),c+++1<h&&g.push("else {");--h}for(;h--;)g.push("}");t.apply(null,o)}(o,h,c);break;case 9:var B=o,U=h,W=c,$=e(),G=B.arg;switch(i(G,$,W),B.op){case"!":g.push(U,"= !",l(G,$)+";");break;case"-":g.push(U,"= -",u(G,$)+";")}t($);break;case 11:g.push(h,"="),N=o.val,g.push("string"==typeof N?n(N):null===N?"null":N),g.push(";")}}function s(e,t,i){g.push("if(",S[e](t,i),") {")}function r(s,r,n){for(var a=[],o=s.args,l=o.length,u=0;u<l;)a.push(e()),i(o[u],a[u++],n);g.push(r,"= concat.call(",a.join(","),");"),t.apply(null,a)}function n(e){return"'"+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"}function a(e,t,i,s){g.push("if(typeof ",t,'!== "undefined") {',"if(isArr(",t,")) {"),i&&(g.push(s,"> 1?"),o(i,t),g.push(":")),g.push(e,"=",e,".length?",e,".concat(",t,") :",t,".slice()",";","}","else {"),i&&g.push("if(",i,".length) {",e,"= concat.apply(",e,",",i,");",i,"= [];","}"),o(e,t),g.push(";","}","}")}function o(e,t){g.push(e,".length?",e,".push(",t,") :",e,"[0] =",t)}function l(e,t){switch(e.type){case 5:return t;case 11:return"!!"+t;case 1:return t+".length > 0";default:return"(typeof "+t+'=== "boolean"?'+t+":isArr("+t+")?"+t+".length > 0 : !!"+t+")"}}function u(e,t){switch(e.type){case 11:return t;case 1:return t+"[0]";default:return"(isArr("+t+")?"+t+"[0] : "+t+")"}}function h(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string" &&'+e+".indexOf("+t+") === 0"}function c(e,t){return e+"!= null &&"+t+"!= null &&"+e+".toString().toLowerCase().indexOf("+t+".toString().toLowerCase()) === 0"}function d(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string" &&'+e+".length >="+t+".length &&"+e+".lastIndexOf("+t+") ==="+e+".length -"+t+".length"}function p(e,t){return e+"!= null &&"+t+"!= null &&("+e+"="+e+".toString()).length >=("+t+"="+t+".toString()).length &&("+e+".toLowerCase()).lastIndexOf(("+t+".toLowerCase())) ==="+e+".length -"+t+".length"}function f(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string" &&'+e+".indexOf("+t+") > -1"}function m(e,t){return e+"!= null && "+t+"!= null &&"+e+".toString().toLowerCase().indexOf("+t+".toString().toLowerCase()) > -1"}var g,y,T,A,S={"===":function(e,t){return e+"==="+t},"==":function(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string"?'+e+".toLowerCase() ==="+t+".toLowerCase() :"+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},"!=":function(e,t){return e+"!="+t},"^==":h,"==^":function(e,t){return h(t,e)},"^=":c,"=^":function(e,t){return c(t,e)},"$==":d,"==$":function(e,t){return d(t,e)},"$=":p,"=$":function(e,t){return p(t,e)},"*==":f,"==*":function(e,t){return f(t,e)},"=*":function(e,t){return m(t,e)},"*=":m,"+":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 function(e){if(g=[],y=["res"],T=0,A=[],i(e,"res","data"),g.unshift("var ",Array.isArray?"isArr = Array.isArray":'toStr = Object.prototype.toString, isArr = function(o) { return toStr.call(o) === "[object Array]"; }',", concat = Array.prototype.concat",",",y.join(","),";"),1===e.type){var t=e.parts[e.parts.length-1];t&&4===t.type&&"idx"in t.arg&&g.push("res = res[0];")}return g.push("return res;"),g.join("")}}();function s(e){return Function("data,subst",i(t(e)))}var r={},n=[],a={cacheSize:100},o={cacheSize:function(e,t){if(t<e&&n.length>t)for(var i=n.splice(0,n.length-t),s=i.length;s--;)delete r[i[s]]}},l=function(e,t,i){return!r[e]&&(r[e]=s(e),n.push(e)>a.cacheSize&&delete r[n.shift()]),r[e](t,i||{})};l.version="0.3.4",l.params=function(e){if(!arguments.length)return a;for(var t in e)e.hasOwnProperty(t)&&(o[t]&&o[t](a[t],e[t]),a[t]=e[t])},l.compile=s,l.apply=l,"object"==typeof e.exports?e.exports=l:"object"==typeof modules?modules.define("jspath",function(e){e(l)}):"function"==typeof define?define(function(e,t,i){i.exports=l}):window.JSPath=l}()}),N("2nrEA",function(e,t){(function(){var t=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return(i=new Date).setTime(e.getTime()),i;if(e instanceof RegExp)return new RegExp(e);if(e instanceof Array){i=[];for(var i,s=0,r=e.length;s<r;s++)i[s]=t(e[s]);return i}if(e instanceof Object){for(var n in i={},e)e.hasOwnProperty(n)&&(i[n]=t(e[n]));return i}throw Error("Unable to clone object!")},i=function(e){for(var i=[t(e[0])],s=i[0].key,r=i[0].object,n=1,a=e.length;n<a;n++)r=r[s],i.push({object:r,key:s=e[n].key});return i},s=function(e,t){var i=e.length-1,s=e[i].key;t[i].object[s]=e[i].object[s]},r={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},n={null:function(e){return null===e},string:function(e){return"string"==typeof e},boolean:function(e){return"boolean"==typeof e},number:function(e){return"number"==typeof e&&e==e},integer:function(e){return"number"==typeof e&&e%1==0},object:function(e){return e&&"object"==typeof e&&!Array.isArray(e)},array:function(e){return Array.isArray(e)},date:function(e){return e instanceof Date}},a={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))&&-1===e.indexOf("/")},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)||!1},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)}},o={readOnly:function(e,t){return!1},minimum:function(e,t,i){return!(e<t||i.exclusiveMinimum&&e<=t)},maximum:function(e,t,i){return!(e>t||i.exclusiveMaximum&&e>=t)},multipleOf:function(e,t){return e/t%1==0||"number"!=typeof e},pattern:function(e,t){var i,s;return"string"!=typeof e||("string"==typeof t?i=t:(i=t[0],s=t[1]),new RegExp(i,s).test(e))},minLength:function(e,t){return e.length>=t||"string"!=typeof e},maxLength:function(e,t){return e.length<=t||"string"!=typeof e},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 i,s={},r=0,n=e.length;r<n;r++){if(i=JSON.stringify(e[r]),s.hasOwnProperty(i))return!1;s[i]=!0}return!0},minProperties:function(e,t){if("object"!=typeof e)return!0;var i=0;for(var s in e)e.hasOwnProperty(s)&&(i+=1);return i>=t},maxProperties:function(e,t){if("object"!=typeof e)return!0;var i=0;for(var s in e)e.hasOwnProperty(s)&&(i+=1);return i<=t},constant:function(e,t){return JSON.stringify(e)==JSON.stringify(t)},enum:function(e,t){var i,s,r;if("object"==typeof e){for(i=0,r=JSON.stringify(e),s=t.length;i<s;i++)if(r===JSON.stringify(t[i]))return!0}else for(i=0,s=t.length;i<s;i++)if(e===t[i])return!0;return!1}},l=function(e){return -1===e.indexOf("://")?e:e.split("#")[0]},u=function(e,t,i){var s,r,n,a;if(-1===(n=i.indexOf("#")))return e.schema.hasOwnProperty(i)?[e.schema[i]]:null;if(n>0)if(a=i.substr(0,n),i=i.substr(n+1),e.schema.hasOwnProperty(a))t=[e.schema[a]];else{if(!t||t[0].id!==a)return null;t=[t[0]]}else{if(!t)return null;i=i.substr(1)}if(""===i)return[t[0]];if("/"!==i.charAt(0))return null;for(i=i.substr(1),s=t[0],r=i.split("/");r.length>0;){if(!s.hasOwnProperty(r[0]))return null;s=s[r[0]],t.push(s),r.shift()}return t},h=function(e,t){var i,s,r,n,a=e.length-1,o=/^(\d+)/.exec(t);if(o){if(t=t.substr(o[0].length),(r=parseInt(o[1],10))<0||r>a)return;if(n=e[a-r],"#"===t)return n.key}else n=e[0];if(s=n.object[n.key],""===t)return s;if("/"===t.charAt(0)){for(i=(t=t.substr(1)).split("/");i.length>0;){if(i[0]=i[0].replace(/~1/g,"/").replace(/~0/g,"~"),!s.hasOwnProperty(i[0]))return;s=s[i[0]],i.shift()}return s}},c=function(e,t,n,a){var o,l,d,p,f,m,g,y,T,A,S,v,b,P=!1,C={},E=t.length-1,_=t[E],M=n.length-1,L=n[M].object,x=n[M].key,O=L[x];if(_.hasOwnProperty("$ref"))return(t=u(e,t,_.$ref))?c(e,t,n,a):{$ref:_.$ref};if(_.hasOwnProperty("type"))if("string"==typeof _.type){if(a.useCoerce&&e.coerceType.hasOwnProperty(_.type)&&(O=L[x]=e.coerceType[_.type](O)),!e.fieldType[_.type](O))return{type:_.type}}else{for(d=0,P=!0,p=_.type.length;d<p&&P;d++)e.fieldType[_.type[d]](O)&&(P=!1);if(P)return{type:_.type}}if(_.hasOwnProperty("allOf")){for(d=0,p=_.allOf.length;d<p;d++)if(A=c(e,t.concat(_.allOf[d]),n,a))return A}if(a.useCoerce||a.useDefault||a.removeAdditional){if(_.hasOwnProperty("oneOf")){for(d=0,l=1/0,p=_.oneOf.length,f=0;d<p;d++)if(b=i(n),A=c(e,t.concat(_.oneOf[d]),b,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else{if((f+=1)>1)break;s(b,n)}if(f>1)return{oneOf:!0};if(f<1)return C;C={}}if(_.hasOwnProperty("anyOf")){for(d=0,C=null,l=1/0,p=_.anyOf.length;d<p;d++)if(b=i(n),A=c(e,t.concat(_.anyOf[d]),b,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else{s(b,n),C=null;break}if(C)return C}if(_.hasOwnProperty("not")&&(b=i(n),!(A=c(e,t.concat(_.not),b,a))))return{not:!0}}else{if(_.hasOwnProperty("oneOf")){for(d=0,l=1/0,p=_.oneOf.length,f=0;d<p;d++)if(A=c(e,t.concat(_.oneOf[d]),n,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else if((f+=1)>1)break;if(f>1)return{oneOf:!0};if(f<1)return C;C={}}if(_.hasOwnProperty("anyOf")){for(d=0,C=null,l=1/0,p=_.anyOf.length;d<p;d++)if(A=c(e,t.concat(_.anyOf[d]),n,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else{C=null;break}if(C)return C}if(_.hasOwnProperty("not")&&!(A=c(e,t.concat(_.not),n,a)))return{not:!0}}if(_.hasOwnProperty("dependencies")){for(y in _.dependencies)if(_.dependencies.hasOwnProperty(y)&&O.hasOwnProperty(y)){if(Array.isArray(_.dependencies[y])){for(d=0,p=_.dependencies[y].length;d<p;d++)if(!O.hasOwnProperty(_.dependencies[y][d]))return{dependencies:!0}}else if(A=c(e,t.concat(_.dependencies[y]),n,a))return A}}if(Array.isArray(O)){if(_.hasOwnProperty("items"))if(Array.isArray(_.items)){for(d=0,p=_.items.length;d<p;d++)null!==(A=c(e,t.concat(_.items[d]),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0);if(O.length>p&&_.hasOwnProperty("additionalItems"))if("boolean"==typeof _.additionalItems){if(!_.additionalItems)return{additionalItems:!0}}else for(d=p,p=O.length;d<p;d++)null!==(A=c(e,t.concat(_.additionalItems),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0)}else for(d=0,p=O.length;d<p;d++)null!==(A=c(e,t.concat(_.items),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0);else if(_.hasOwnProperty("additionalItems")&&"boolean"!=typeof _.additionalItems)for(d=0,p=O.length;d<p;d++)null!==(A=c(e,t.concat(_.additionalItems),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0);if(P)return{schema:C}}else{for(y in S=[],C={},O)O.hasOwnProperty(y)&&S.push(y);if(a.checkRequired&&_.required)for(d=0,p=_.required.length;d<p;d++)O.hasOwnProperty(_.required[d])||(C[_.required[d]]={required:!0},P=!0);if(m=_.hasOwnProperty("properties"),g=_.hasOwnProperty("patternProperties"),m||g)for(d=S.length;d--;){if(v=!1,m&&_.properties.hasOwnProperty(S[d])&&(v=!0,null!==(A=c(e,t.concat(_.properties[S[d]]),n.concat({object:O,key:S[d]}),a))&&(C[S[d]]=A,P=!0)),g)for(y in _.patternProperties)_.patternProperties.hasOwnProperty(y)&&S[d].match(y)&&(v=!0,null!==(A=c(e,t.concat(_.patternProperties[y]),n.concat({object:O,key:S[d]}),a))&&(C[S[d]]=A,P=!0));v&&S.splice(d,1)}if(a.useDefault&&m&&!P)for(y in _.properties)_.properties.hasOwnProperty(y)&&!O.hasOwnProperty(y)&&_.properties[y].hasOwnProperty("default")&&(O[y]=_.properties[y].default);if(a.removeAdditional&&m&&!0!==_.additionalProperties&&"object"!=typeof _.additionalProperties)for(d=0,p=S.length;d<p;d++)delete O[S[d]];else if(_.hasOwnProperty("additionalProperties"))if("boolean"==typeof _.additionalProperties){if(!_.additionalProperties)for(d=0,p=S.length;d<p;d++)C[S[d]]={additional:!0},P=!0}else for(d=0,p=S.length;d<p;d++)null!==(A=c(e,t.concat(_.additionalProperties),n.concat({object:O,key:S[d]}),a))&&(C[S[d]]=A,P=!0);if(P)return{schema:C}}for(T in _)_.hasOwnProperty(T)&&!r.hasOwnProperty(T)&&("format"===T?e.fieldFormat.hasOwnProperty(_[T])&&!e.fieldFormat[_[T]](O,_,n,a)&&(C[T]=!0,P=!0):e.fieldValidate.hasOwnProperty(T)&&!e.fieldValidate[T](O,_[T].hasOwnProperty("$data")?h(n,_[T].$data):_[T],_,n,a)&&(C[T]=!0,P=!0));return P?C:null},d={useDefault:!1,useCoerce:!1,checkRequired:!0,removeAdditional:!1};function p(){if(!(this instanceof p))return new p;this.coerceType={},this.fieldType=t(n),this.fieldValidate=t(o),this.fieldFormat=t(a),this.defaultOptions=t(d),this.schema={}}p.prototype={validate:function(e,t,i){var s=[e],r=null;if("string"==typeof e&&!(s=u(this,null,e)))throw Error("jjv: could not find schema '"+e+"'.");if(i)for(var n in this.defaultOptions)this.defaultOptions.hasOwnProperty(n)&&!i.hasOwnProperty(n)&&(i[n]=this.defaultOptions[n]);else i=this.defaultOptions;return(r=c(this,s,[{object:{__root__:t},key:"__root__"}],i))?{validation:r.hasOwnProperty("schema")?r.schema:r}:null},resolveRef:function(e,t){return u(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")&&"string"==typeof t.id&&t.id!==e){if("/"===t.id.charAt(0))throw Error("jjv: schema id's starting with / are invalid.");this.schema[l(t.id)]=t}else if(!e)throw Error("jjv: schema needs either a name or id attribute.");e&&(this.schema[l(e)]=t)}},void 0!==e.exports?e.exports=p:"function"==typeof define&&define.amd?define(function(){return p}):this.jjv=p}).call(e.exports)}),N("9J8r2",function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.default=function(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)},e.exports=e.exports.default}),N("6ejce",function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.default=function(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()},e.exports=e.exports.default}),N("eG07G",function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.default=function(e,t){if(null==e)throw TypeError("assign requires that input parameter not be null or undefined");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.exports=e.exports.default}),N("c15IW",function(e,t){var i,s;i="object"==typeof window&&window||this,s={},i.PubSub?(s=i.PubSub,console.warn("PubSub already loaded, using existing version")):(i.PubSub=s,function(e){var t={},i=-1;function s(e,t,i){try{e(t,i)}catch(e){setTimeout(function(){throw e},0)}}function r(e,t,i){e(t,i)}function n(e,i,n,a){var o,l=t[i],u=a?r:s;if(Object.prototype.hasOwnProperty.call(t,i))for(o in l)Object.prototype.hasOwnProperty.call(l,o)&&u(l[o],e,n)}function a(e){var i=String(e);return!!(Object.prototype.hasOwnProperty.call(t,i)&&function(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t[i]))}function o(e,t,i,s){var r,o=(r=e="symbol"==typeof e?e.toString():e,function(){var e=String(r),i=e.lastIndexOf(".");for(n(r,r,t,s);-1!==i;)i=(e=e.substr(0,i)).lastIndexOf("."),n(r,e,t,s);n(r,"*",t,s)});return!!function(e){for(var t=String(e),i=a(t)||a("*"),s=t.lastIndexOf(".");!i&&-1!==s;)s=(t=t.substr(0,s)).lastIndexOf("."),i=a(t);return i}(e)&&(!0===i?o():setTimeout(o,0),!0)}e.publish=function(t,i){return o(t,i,!1,e.immediateExceptions)},e.publishSync=function(t,i){return o(t,i,!0,e.immediateExceptions)},e.subscribe=function(e,s){if("function"!=typeof s)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var r="uid_"+String(++i);return t[e][r]=s,r},e.subscribeAll=function(t){return e.subscribe("*",t)},e.subscribeOnce=function(t,i){var s=e.subscribe(t,function(){e.unsubscribe(s),i.apply(this,arguments)});return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var i;for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)&&delete t[i]},e.countSubscriptions=function(e){var i,s,r=0;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)){for(s in t[i])r++;break}return r},e.getSubscriptions=function(e){var i,s=[];for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)&&s.push(i);return s},e.unsubscribe=function(i){var s,r,n,a="string"==typeof i&&(Object.prototype.hasOwnProperty.call(t,i)||function(e){var i;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e))return!0;return!1}(i)),o=!a&&"string"==typeof i,l="function"==typeof i,u=!1;if(a)return void e.clearSubscriptions(i);for(s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(r=t[s],o&&r[i]){delete r[i],u=i;break}if(l)for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&r[n]===i&&(delete r[n],u=!0)}return u}}(s)),void 0!==e&&e.exports&&(t=e.exports=s),t.PubSub=s,e.exports=t=s});var V=((i={})[i.Browser=0]="Browser",i[i.NodeJs=1]="NodeJs",i),H=((s={})[s.UsePrevious=0]="UsePrevious",s[s.UseNext=1]="UseNext",s[s.UseNone=2]="UseNone",s),F=((r={})[r.Minimum=0]="Minimum",r[r.Everything=1]="Everything",r[r.Manual=2]="Manual",r),k=((n={})[n.NoAction=0]="NoAction",n[n.IgnoreTimelineOnly=1]="IgnoreTimelineOnly",n[n.ModelTransformRequired=2]="ModelTransformRequired",n),B=((a={})[a.Down=0]="Down",a[a.Up=1]="Up",a[a.Same=2]="Same",a),U=((o={})[o.ChangeBased=0]="ChangeBased",o[o.OpenVsClose=1]="OpenVsClose",o),W=((l={})[l.OHLC=0]="OHLC",l[l.Line=1]="Line",l[l.Candlestick=2]="Candlestick",l[l.Area=3]="Area",l[l.Column=4]="Column",l[l.Dots=5]="Dots",l[l.HLC=6]="HLC",l[l.HL=7]="HL",l[l.Ribbon=8]="Ribbon",l[l.Step=9]="Step",l[l.HollowCandles=10]="HollowCandles",l[l.HeikinAshi=11]="HeikinAshi",l[l.ElderImpulseSystem=12]="ElderImpulseSystem",l[l.Renko=13]="Renko",l[l.Range=14]="Range",l[l.LineBreak=15]="LineBreak",l[l.Kagi=16]="Kagi",l[l.PointAndFigure=17]="PointAndFigure",l[l.Baseline=18]="Baseline",l[l.PercentChange=19]="PercentChange",l[l.MultiColumn=20]="MultiColumn",l[l.StackedColumn=21]="StackedColumn",l),$=((u={})[u.Tick=0]="Tick",u[u.Intraday=1]="Intraday",u[u.Day=2]="Day",u[u.Week=3]="Week",u[u.Month=4]="Month",u[u.Quarter=5]="Quarter",u[u.Year=6]="Year",u),G=((h={})[h.None=0]="None",h[h.Nearest=1]="Nearest",h[h.Continue=2]="Continue",h[h.PerCount=3]="PerCount",h[h.PerVolume=4]="PerVolume",h[h.PerRange=5]="PerRange",h[h.PerSeconds=6]="PerSeconds",h),z=((c={})[c.Number=0]="Number",c[c.String=1]="String",c[c.Date=2]="Date",c),Y=((d={})[d.FromMetaData=0]="FromMetaData",d[d.AsInteger=1]="AsInteger",d[d.UseMetricUnit=2]="UseMetricUnit",d[d.AsPercent=3]="AsPercent",d),j=((p={})[p.Common=0]="Common",p[p.Study=1]="Study",p[p.BalanceSheet=2]="BalanceSheet",p[p.IncomeStatement=3]="IncomeStatement",p[p.Forward=4]="Forward",p[p.Seasonal=5]="Seasonal",p[p.Event=6]="Event",p[p.Option=7]="Option",p),K=((f={})[f.None=0]="None",f[f.Value=1]="Value",f[f.Percent=2]="Percent",f),q=((m={})[m.Linear=0]="Linear",m[m.Logarithmic=1]="Logarithmic",m),X=((g={})[g.Symbol=0]="Symbol",g[g.Expression=1]="Expression",g[g.Study=2]="Study",g[g.Forward=3]="Forward",g[g.BalanceSheet=4]="BalanceSheet",g[g.IncomeStatement=5]="IncomeStatement",g[g.Seasonal=6]="Seasonal",g),Z=((y={})[y.Normal=0]="Normal",y[y.Forward=1]="Forward",y[y.HistoricalForward=2]="HistoricalForward",y[y.Study=3]="Study",y[y.BalanceSheet=4]="BalanceSheet",y[y.IncomeStatement=5]="IncomeStatement",y[y.Events=6]="Events",y[y.Options=7]="Options",y),J=((T={})[T.Left=0]="Left",T[T.Center=1]="Center",T[T.Right=2]="Right",T),Q=((A={})[A.Arrow=0]="Arrow",A[A.Crosshair=1]="Crosshair",A[A.Move=2]="Move",A[A.Hand=3]="Hand",A[A.ResizeVertical=4]="ResizeVertical",A[A.Grabbing=5]="Grabbing",A[A.ResizeHorizontal=6]="ResizeHorizontal",A),ee=((S={})[S.NotApplicable=0]="NotApplicable",S[S.Left=1]="Left",S[S.Middle=2]="Middle",S[S.Right=3]="Right",S),et=((v={})[v.Shift=0]="Shift",v[v.Alt=1]="Alt",v[v.Control=2]="Control",v[v.Meta=3]="Meta",v),ei=((b={})[b.None=0]="None",b[b.Horizontal=1]="Horizontal",b[b.Vertical=2]="Vertical",b[b.Both=3]="Both",b),es=((P={})[P.Unspecified=0]="Unspecified",P[P.GBE=1]="GBE",P[P.cmdtyView=2]="cmdtyView",P[P.DemoSite=3]="DemoSite",P[P.InternalFeed=4]="InternalFeed",P[P.Widget=5]="Widget",P[P.FreeWidget=6]="FreeWidget",P),er=((C={})[C.Unspecified=0]="Unspecified",C[C.Head=1]="Head",C[C.Tail=2]="Tail",C),en=((E={})[E.wheel=0]="wheel",E[E["wheel+shift"]=1]="wheel+shift",E[E.none=2]="none",E),ea=((_={})[_.Page=0]="Page",_[_.Application=1]="Application",_),eo=((M={})[M.None=0]="None",M[M.Created=1]="Created",M[M.Deleted=2]="Deleted",M[M.Moved=3]="Moved",M[M.PointMoved=4]="PointMoved",M[M.TextChanged=5]="TextChanged",M[M.Undo=6]="Undo",M[M.Redo=7]="Redo",M[M.Cancelled=8]="Cancelled",M[M.Executed=9]="Executed",M),el=((L={})[L.None=0]="None",L[L.Min=1]="Min",L[L.Max=2]="Max",L);function eu(e,t){return function(...i){return e.apply(this,[t,...i])}}function eh(e,t,i){return function(...s){return e.apply(this,[t,i,...s])}}function ec(...e){let t=e?e.length:0,i=this;return function(...s){let r=0,n=t?e[r].apply(i,s):s[0];for(;++r<t;)n=e[r].call(i,n);return n}}function ed(e){return e}function ep(e){return null!==e}function ef(e){return e.reduce((e,t)=>e+t,0)}function em(e){let t=e.length;return t>0?ef(e)/t:0}function eg(e){return e.every(e=>null!==e)}function ey(e,t){return Array.from(Array(t)).map((t,i)=>i+e)}function eT(e,t){let i=[],s=[];return e.forEach(e=>{t(e)?i.push(e):s.push(e)}),{yes:i,no:s}}function eA(e,t){if(e.length<1)return -1;for(let i=e.length-1;i>=0;--i)if(t(e[i]))return i;return -1}function eS(e,t){return e.filter(e=>!t.includes(e))}function ev(e,t,i=ed){let s=[];return e.forEach(e=>{let r=i(e);!s.map(i).includes(r)&&t.map(i).includes(r)&&s.push(e)}),s}function eb(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function eP(e){if(!(e.length<1))return e[0]}function eC(e,t,i=null){if(e.length<1)return -1;let s=Number.isFinite(i)&&i<e.length?i:e.length-1;for(let i=s;i>=0;--i)if(t(e[i]))return i;return -1}let eE=(e,t)=>e[t];function e_(e,t,i=e=>e,s=eE,r=0,n=e.length-1){let a=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN;for(;r<n;){let o=r+n>>>1;0>a(i(s(e,o)),t)?r=o+1:n=o}return r}function eM(e,t=0,i=e.length-1,s=(e,t)=>e){if(t<0||i>=e.length)return[null,null];let r=null,n=null;for(let a=t;a<=i;a++){let t=s(e[a],a);null!=t&&t>=t&&(null==r?r=n=t:(r>t&&(r=t),n<t&&(n=t)))}return[r,n]}function eL(e,t){return Array.from({length:e},(e,i)=>t(i))}function ex(e,t){let i=eH;if(!i(e)||!i(t))return;let[s,r]=e,[n,a]=t;(i(n,s)&&s<n||i(s)&&!i(n))&&(t[0]=s),(i(a,r)&&r>a||i(r)&&!i(a))&&(t[1]=r)}let eO=null;function eI(){return null===eO&&(eO="ontouchstart"in globalThis),eO}function eD(e,t){return"Escape"===e||27===t}function ew(e,t){return"ArrowLeft"===e||37===t}function eR(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function eN(e,t=100){var i,s;let r;return i=t=>eR(e,t),s=t,r=null,function(...e){let t=this;clearTimeout(r),r=setTimeout(function(){i.apply(t,e)},s)}}function eV(e){return null!=e}function eH(...e){return e.every(e=>null!=e)}function eF(e,t){var i="round",s=e,r=-t;if(void 0===r||0==+r)return Math[i](s);if(r*=1,isNaN(s*=1)||"number"!=typeof r||r%1!=0)return NaN;let n=s.toString().split("e"),a=Math[i](+(n[0]+"e"+(n[1]?n[1]-r:-r))).toString().split("e");return+(a[0]+"e"+(a[1]?+a[1]+r:r))}function ek(e){return eH(e)&&Number.isFinite(e)}function eB(e){let t="both"===e;return[t||"vertical"===e,t||"horizontal"===e]}function eU(e,t,i){return t.includes(e)?e:i}function eW(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function e$(e,t,...i){if(!eH(e))return t;let s=e;for(let e of i){if(!eH(s)||!eW(s,e))return t;s=s[e]}return s}function eG(e){return null==e?e:JSON.parse(JSON.stringify(e))}function ez(e,t,i=!0){let s=Object.keys(t),r=Object.keys(e),n=e=>!i||r.includes(e);for(let i of s)if(n(i)){var a;let s=e[i];void 0===s||"object"!=typeof s||Array.isArray(s)?e[i]=t[i]:(a=e[i],ez(a,t[i]))}}function eY(e,t){for(let i of Object.keys(t))e[i]=e[i]||t[i]}function ej(e=[]){return e.reduce((e,t)=>(e[t.name]=t.value,e),{})}function eK(e){return e?new Date(e):null}function eq(e){let t="";for(let i in e){let s=`${i}=${encodeURIComponent(e[i])}`;t+=(t.length>0?"&":"")+s}return t}let eX=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,eZ=[1e3,60,60,24,7,30/7,12];function eJ(e){let t=eX.exec(e);if(!eH(t))return null;let i=t.slice(2,9).map(e=>eH(e)?parseFloat(e):0).reverse();return eZ.forEach((e,t)=>{for(let s=t;s<i.length;s++)i[s]=i[s]*e}),Math.floor(ef(i))}function eQ(e,t,i,s){let r=e,n=t;return 0===r||0===n?n=(r=i)/2:r>s?(n=s/r*n,r=s):r<i&&(n=i/r*n,r=i),[r,n]}function e0(){return((e=21)=>{let t="",i=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&i[e]];return t})(12)}function e1(e,t,i){return Math.min(Math.max(i,e),t)}var e2={},e3={};e3={number:e=>"number"==typeof e&&!isNaN(e),nan:e=>"number"==typeof e&&isNaN(e),integer:e=>"number"==typeof e&&!isNaN(e)&&(0|e)===e,large:e=>"number"==typeof e&&!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=>"string"==typeof e,date:e=>e instanceof Date,fn:e=>"function"==typeof e,array:e=>Array.isArray(e),boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&null!==e,null:e=>null===e,undefined:e=>void 0===e,zeroLengthString(e){return this.string(e)&&0===e.length},extension(e,t){return this.fn(e)&&this.fn(t)&&t.prototype instanceof e}};var e4={},e5={};e5=(()=>{function e(e,i,s,r,n){s===String?e3.string(e)||t(i,"string",n):s===Number?e3.number(e)||t(i,"number",n):s===Function?e3.fn(e)||t(i,"function",n):s===Boolean?e3.boolean(e)||t(i,"boolean",n):s===Date?e3.date(e)||t(i,"date",n):s===Array?e3.array(e)||t(i,"array",n):e instanceof(s||Object)||t(i,r,n)}function t(e,t,i){throw Error("number"==typeof i?`The argument [ ${e||"unspecified"} ], at index [ ${i.toString()} ] must be a [ ${t||"unknown"} ]`:`The argument [ ${e||"unspecified"} ] must be a [ ${t||"Object"} ]`)}function i(e,t){throw Error(`The argument [ ${e||"unspecified"} ] failed a validation check [ ${t||"No description available"} ]`)}return{argumentIsRequired(t,i,s,r){e(t,i,s,r)},argumentIsOptional(t,s,r,n,a,o){null!=t&&(e(t,s,r,n),e3.fn(a)&&!a(t)&&i(s,o))},argumentIsArray(t,i,s,r){if(this.argumentIsRequired(t,i,Array),s){let n;n="function"==typeof s&&s!==Function?(e,t)=>void 0!==s.prototype&&e instanceof s||s(e,`${i}[${t}]`):(t,n)=>e(t,i,s,r,n),t.forEach((e,t)=>{n(e,t)})}},argumentIsValid(e,t,s,r){s(e)||i(t,r)},areEqual(e,t,i,s){if(e!==t)throw Error(`The objects must be equal [${i||e.toString()}] and [${s||t.toString()}]`)},areNotEqual(e,t,i,s){if(e===t)throw Error(`The objects cannot be equal [${i||e.toString()}] and [${s||t.toString()}]`)}}})(),e4=(()=>{let e={};return e.camel={},e.camel.violations=/\b[A-Z]/g,{startCase:e=>e.split(" ").reduce((e,t)=>(0!==t.length&&e.push(t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()),e),[]).join(" "),camelCase:t=>(e5.argumentIsRequired(t,"s",String),t.replace(e.camel.violations,e=>e.toLocaleLowerCase())),truncate:(e,t)=>e3.string(e)&&e.length>t?e.substring(0,t)+" ...":e,padLeft(e,t,i){if(e5.argumentIsRequired(e,"s",String),e5.argumentIsRequired(t,"length",Number),e5.argumentIsRequired(i,"character",String),1!==i.length)throw Error('The "character" argument must be one character in length.');return i.repeat(t-e.length)+e},format:(e,...t)=>(e5.argumentIsRequired(e,"s",String),e.replace(/{(\d+)}/g,(e,i)=>{let s;if(i<t.length){let r=t[i];s=e3.undefined(r)||e3.null(r)?e:r.toString()}else s=e;return s}))}})();var e6={},e7={};e7=(()=>{let e=new Map;class t{constructor(i,s){e5.argumentIsRequired(i,"code",String),e5.argumentIsRequired(s,"description",String),this._code=i,this._description=s;let r=this.constructor;e.has(r)||e.set(r,[]),null===t.fromCode(r,i)&&e.get(r).push(this)}get code(){return this._code}get description(){return this._description}equals(e){return e===this||e instanceof t&&e.constructor===this.constructor&&e.code===this.code}toJSON(){return this.code}static fromCode(e,i){return t.getItems(e).find(e=>e.code===i)||null}static getItems(t){return e.get(t)||[]}toString(){return"[Enum]"}}return t})(),e6=(()=>{class e extends e7{constructor(e,t,i){super(e,t),this._id=i}get id(){return this._id}toJSON(){return this._id}static parse(t){return e7.fromCode(e,t)}static fromId(t){return e7.getItems(e).find(e=>e.id===t)||null}static get STOCK(){return t}static get STOCK_OPTION(){return i}static get FUTURE(){return s}static get FUTURE_OPTION(){return r}static get FOREX(){return n}static get CMDTY_STATS(){return a}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}let t=new e("STK","U.S. Equity",1),i=new e("STKOPT","Equity Option",34),s=new e("FUT","Future",2),r=new e("FUTOPT","Future Option",12),n=new e("FOREX","FOREX",10),a=new e("CMDTY","cmdtyStats",24);return e})(),e2=(()=>{class e{constructor(){}static getIsConcrete(e){return e3.string(e)&&!this.getIsReference(e)}static getIsReference(e){return e3.string(e)&&n.futures.alias.test(e)}static getIsFuture(e){return e3.string(e)&&(n.futures.concrete.test(e)||n.futures.alias.test(e))}static getIsCash(t){return e.getIsFuture(t)&&n.futures.cash.test(t)}static getIsFutureSpread(e){return e3.string(e)&&n.futures.spread.test(e)}static getIsFutureOption(e){return e3.string(e)&&(n.futures.options.short.test(e)||n.futures.options.long.test(e)||n.futures.options.historical.test(e))}static getIsForex(e){return e3.string(e)&&n.forex.test(e)}static getIsCrypto(e){return e3.string(e)&&n.crypto.test(e)}static getIsIndex(e){return e3.string(e)&&n.indicies.external.test(e)}static getIsSector(e){return e3.string(e)&&n.indicies.sector.test(e)}static getIsCanadianFund(e){return e3.string(e)&&n.funds.canadian.test(e)}static getIsCmdty(e){return e3.string(e)&&(n.cmdty.stats.test(e)||n.cmdty.internal.test(e)||n.cmdty.external.test(e))}static getIsCmdtyStats(e){return e3.string(e)&&n.cmdty.stats.test(e)}static getIsBats(e){return e3.string(e)&&r.bats.test(e)}static getIsEquityOption(e){return e3.string(e)&&n.equities.options.test(e)}static getIsExpired(t){let i=e.parseInstrumentType(t),r=!1;if(null!==i&&i.year&&i.month){let e=l();i.year<e?r=!0:i.year===e&&s.hasOwnProperty(i.month)&&new Date().getMonth()+1>s[i.month]&&(r=!0)}return r}static getIsC3(e){return e3.string(e)&&(n.c3.concrete.test(e)||n.c3.alias.test(e))}static getIsPlatts(e){return e3.string(e)&&(n.platts.concrete.test(e)||n.platts.alias.test(e))}static getIsPit(e,t){return e3.string(e)&&e3.string(t)&&r.pit.test(t)}static getIsGrainBid(e){return e3.string(e)&&n.bids.test(e)}static parseInstrumentType(e){if(!e3.string(e))return null;let t=null;for(let i=0;i<a.length&&null===t;i++)t=(0,a[i])(e);return t}static getProducerSymbol(e){if(!e3.string(e))return null;let t=null;for(let i=0;i<o.length&&null===t;i++)t=(0,o[i])(e);return t}static getFuturesOptionPipelineFormat(t){let i=e.parseInstrumentType(t),s=null;if("future_option"===i.type){let e=c(i.option_type);s=`${i.root}${i.month}${u(i.year,1)}|${i.strike}${e}`}return s}static getFuturesExplicitFormat(t){let i=null;if(e.getIsFuture(t)&&e.getIsConcrete(t)){let s=e.parseInstrumentType(t);i=`${s.root}${s.month}${e4.padLeft(Math.floor(s.year%100).toString(),2,"0")}`}return i}static getFuturesYear(e,t){return h(e,t)}static displayUsingPercent(e){return e3.string(e)&&r.percent.test(e)}toString(){return"[SymbolParser]"}}let t={F:"A",G:"B",H:"C",J:"D",K:"E",M:"I",N:"L",Q:"O",U:"P",V:"R",X:"S",Z:"T"},i={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},s={F:1,G:2,H:3,J:4,K:5,M:6,N:7,Q:8,U:9,V:10,X:11,Z:12},r={};r.bats=/^(.*)\.BZ$/i,r.percent=/(\.RT)$/,r.pit=/\(P(it)?\)/;let n={};n.bids=/^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i,n.c3={},n.c3.alias=/^(C3:)(.*)$/i,n.c3.concrete=/(\.C3)$/i,n.cmdty={},n.cmdty.stats=/(\.CS)$/i,n.cmdty.internal=/(\.CM)$/i,n.cmdty.external=/(\.CP)$/i,n.crypto=/^\^([A-Z]{3})([A-Z]{3,4})$/i,n.equities={},n.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,n.forex=/^\^([A-Z]{3})([A-Z]{3})$/i,n.funds={},n.funds.canadian=/(.*)(\.CF)$/i,n.futures={},n.futures.alias=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1,2})$/i,n.futures.concrete=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,n.futures.spread=/^_S_/i,n.futures.cash=/(.*)(Y00)$/,n.futures.options={},n.futures.options.historical=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,n.futures.options.long=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,n.futures.options.short=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,n.indicies={},n.indicies.external=/^\$(.*)$/i,n.indicies.sector=/^\-(.*)$/i,n.platts={},n.platts.alias=/^(PLATTS:)(.*)$/i,n.platts.concrete=/^(.*)(\.PT)$/i;let a=[];a.push(e=>{let t=null;return n.futures.spread.test(e)&&((t={}).symbol=e,t.type="future_spread"),t}),a.push(e=>{let t=null,i=e.match(n.futures.concrete);return null!==i&&((t={}).symbol=e,t.type="future",t.asset=e6.FUTURE,t.dynamic=!1,t.root=i[1],t.month=i[2],t.year=h(i[3],i[2])),t}),a.push(e=>{let t=null,i=e.match(n.futures.alias);return null!==i&&((t={}).symbol=e,t.type="future",t.asset=e6.FUTURE,t.dynamic=!0,t.root=i[1],t.dynamicCode=i[3]),t}),a.push(e=>{let t=null;return n.forex.test(e)&&((t={}).symbol=e,t.type="forex",t.asset=e6.FOREX),t}),a.push(e=>{let t=null,i=e.match(n.equities.options);if(null!==i){let s=void 0!==i[4]?i[4]:"";(t={}).symbol=e,t.type="equity_option",t.asset=e6.STOCK_OPTION,t.option_type="C"===i[9]?"call":"put",t.strike=parseFloat(i[8]),t.root=`${i[1]}${s}`,t.month=parseInt(i[6]),t.day=parseInt(i[7]),t.year=parseInt(i[5]),t.adjusted=""!==i[3]}return t}),a.push(e=>{let t=null;return n.indicies.external.test(e)&&((t={}).symbol=e,t.type="index"),t}),a.push(e=>{let t=null;return n.indicies.sector.test(e)&&((t={}).symbol=e,t.type="sector"),t}),a.push(e=>{let t=null,i=e.match(n.futures.options.short);if(null!==i){let s,r;t={};let n=i[4].charCodeAt(0);n<80?(s="call",r=n-67):(s="put",r=n-80),t.symbol=e,t.type="future_option",t.asset=e6.FUTURE_OPTION,t.option_type=s,t.strike=parseInt(i[3]),t.root=i[1],t.month=i[2],t.year=l()+r}return t}),a.push(e=>{var t;let s=null,r=e.match(n.futures.options.long)||e.match(n.futures.options.historical);return null!==r&&((s={}).symbol=e,s.type="future_option",s.asset=e6.FUTURE_OPTION,s.option_type="C"===r[5]?"call":"put",s.strike=parseInt(r[4]),s.root=r[1],s.month=i[t=r[2]]||t,s.year=h(r[3])),s}),a.push(e=>{let t=null;return null!==e.match(n.cmdty.stats)&&((t={}).symbol=e,t.type="cmdtyStats",t.asset=e6.CMDTY_STATS),t});let o=[];function l(){return new Date().getFullYear()}function u(e,t){let i=e.toString();return i.substring(i.length-t,i.length)}function h(e,t){let i=l(),s=parseInt(e);if(0===s&&"Y"===t)s=100*Math.floor(i/100)+100;else if(s<10&&1===e.length){let e=+(s<i%10);s=10*Math.floor(i/10)+s+10*e}else s<100&&(s=100*Math.floor(i/100)+s,i+25<s&&(s-=100));return s}function c(e){return"call"===e?"C":"put"===e?"P":null}return o.push(i=>{let s=null;if(e.getIsFuture(i)&&e.getIsConcrete(i)){let e=i.match(n.futures.concrete);if(null!==e){let i=e[1],r=e[2],n=h(e[3],r);if(n>l()+9){let e=t[r];e&&(s=`${i}${e}${u(n,1)}`)}}}return s}),o.push(t=>{let i=null;return e.getIsFuture(t)&&e.getIsConcrete(t)&&(i=t.replace(/(.{1,3})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,"$1$2$4")||null),i}),o.push(t=>{let i=null;if(e.getIsFutureOption(t)){let s=e.parseInstrumentType(t),r=c(s.option_type);if(s.root.length<3){let e=r.charCodeAt(0);i=`${s.root}${s.month}${s.strike}${String.fromCharCode(e+s.year-l())}`}else i=`${s.root}${s.month}${u(s.year,1)}|${s.strike}${r}`}return i}),o.push(e=>{let t=null;return n.c3.alias.test(e)&&(t=e.replace(n.c3.alias,"$2.C3")),t}),o.push(e=>{let t=null;return n.platts.alias.test(e)&&(t=e.replace(n.platts.alias,"$2.PT")),t}),o.push(e=>e),e})();var e8={};function e9(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function te(e,t){if(t.length<e)throw TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function tt(e){return(tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ti(e){te(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===tt(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):(("string"==typeof e||"[object String]"===t)&&"undefined"!=typeof console&&(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 ts(e,t){te(2,arguments);var i=ti(e),s=e9(t);if(isNaN(s))return new Date(NaN);if(!s)return i;var r=i.getDate(),n=new Date(i.getTime());return(n.setMonth(i.getMonth()+s+1,0),r>=n.getDate())?n:(i.setFullYear(n.getFullYear(),n.getMonth(),r),i)}function tr(e,t){return te(2,arguments),ts(e,12*e9(t))}function tn(e){te(1,arguments);var t=ti(e),i=new Date(0);return i.setFullYear(t.getFullYear(),0,1),i.setHours(0,0,0,0),i}function ta(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 to(e){te(1,arguments);var t=ti(e);return t.setHours(0,0,0,0),t}function tl(e,t){te(2,arguments);var i=to(e),s=to(t);return Math.round((i.getTime()-ta(i)-(s.getTime()-ta(s)))/864e5)}function tu(e){return te(1,arguments),ti(e).getFullYear()}function th(e){te(1,arguments);var t=ti(e);return t.setDate(1),t.setHours(0,0,0,0),t}function tc(t){return e(e2).parseInstrumentType(t)}e8=(()=>{let e={},t={};function i(i,s,r){e[i]=s,t[i]=r}return i("F","January",1),i("G","February",2),i("H","March",3),i("J","April",4),i("K","May",5),i("M","June",6),i("N","July",7),i("Q","August",8),i("U","September",9),i("V","October",10),i("X","November",11),i("Z","December",12),i("Y","Cash",0),{getCodeToNameMap:()=>Object.assign({},e),getCodeToNumberMap:()=>Object.assign({},t)}})();let td=function(e){let t=new Map;return(...i)=>{let s=JSON.stringify(i);return t.has(s)||t.set(s,e(...i).catch(e=>(t.delete(s),Promise.reject(e)))),t.get(s)}}(async function e(e,t){let i=await tM(e);if(!Array.isArray(i))throw Error("Invalid server response");let s=i.find(e=>e.isNearest)?.name||"";return{symbols:i.map(e=>e.name),nearest:s}}),tp=e=>td(e,function(e){te(1,arguments);var t=ti(e);return tl(t,tn(t))+1}(Date.now()));async function tf(e){if(!tC(e))return e;let{root:t,dynamic:i,dynamicCode:s}=tc(e);if(!eH(t,i,s))return null;let{symbols:r,nearest:n}=await tp(t),a=parseInt(s);if(0===a)return n;let o=a-1;return o<r.length?r[o]:null}function tm(t){return e(e2).getIsFutureOption(t)}function tg(t){return e(e2).getIsFuture(t)}let ty=/^_S_SP_([^_]+)_([^_]+)$/;function tT(e){let t=e.match(ty);return!!t&&3===t.length&&tg(t[1])&&tg(t[2])}let tA=/^([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 tS(e){return tA.test(e)}function tv(t){return e(e2).getIsEquityOption(t)}function tb(e){return String(e%100).padStart(2,"0")}function tP(e,t=!1){if(!tg(e))return e;let i=tc(e);return function(e,t,i,s=!1){return`${e}${t}${s?i:tb(i)}`}(i.root,i.month,i.year,t)}function tC(e){let t=tc(e);return eH(t)&&!0===t.dynamic}function tE(e){let t=tg(e)||tm(e),i="_S_"===e.substring(0,2);return(t||tv(e))&&!i}function t_(e){return tg(e)?"America/Chicago":"America/New_York"}async function tM(e){let t=JSON.parse(await yq("futures",`?root=${e}`));return t[e]?t[e].contracts.filter(e=>"Y"!==e.month).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 tL(t){if(!tg(t))return null;let i=tc(t),s=e(e8).getCodeToNumberMap()[i.month];return th(new Date(i.year,s-1))}function tx(e,t){let i=tc(e),s=(i.year+t)%100;return`${i.root}${i.month}${tb(s)}`}async function tO(e){let t=e=>[e,!1,!1],i=tg(e),s=tS(e),r=!!tg(e)&&"Y"===tc(e).month;if(!i&&!s||r)return t(e);if(i){let{root:t,month:i}=tc(e),s=await tf(`${t}*1`);if(!tC(e)){let s=(await tp(t))?.symbols??[];if(s.includes(e))return[e,!0,!1];for(let e of s)if(tc(e).month===i)return[e,!0,!0]}return[s,!0,!0]}if(s){let i=tA.exec(e);return t(`${i[1]}${tb(tu(new Date))}${i[3]}`)}return t(e)}function tI(e){let t=e.getRootNode();return t===document?document.body:t}function tD(e,t=document){let i=tw(e,t);return eH(i)?i.innerHTML:null}function tw(e,t=document){return tk(e,t)[0]}function tR(e,t){for(let i in t)e.style[i]=t[i]}function tN(e,t){for(let i in t)e.setAttribute(i,t[i])}function tV(e,t,i){let s=tw(`#${e}`,t);if(eH(s))return s;let r=tF(t,i);return r.id=e,r}function tH(e,t){"string"==typeof t?e.className=t:Array.isArray(t)?e.className=t.join(" "):"object"==typeof t&&(e.className="",Object.keys(t).forEach(i=>{t[i]&&e.classList.add(i)}))}function tF(e,t){return e.appendChild(document.createElement(t))}function tk(e,t=document){return t.querySelectorAll(e)}function tB(e,t){e&&(e.innerHTML=t)}async function tU(e,t="asyncReadyWork"){eH(this[t])||(this[t]={});let i=this[t];return eH(i.result)?Promise.resolve(i.result):(eH(i.promise)||(i.promise=e.call(this),i.promise.then(e=>{i.result=e})),i.promise)}class tW{_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}}let t$=globalThis.devicePixelRatio||1,tG={EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:eI()?20*t$:5*t$,HALF_ANN_POINT_DIMENSION:eI()?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,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,MAXIMUM_BAR_WIDTH:180,MINIMUM_BARS_VISIBLE:5,COLOR_TRANSPARENT:"rgba(0, 0, 0, 0)",AT_LINE:"line",AT_LINE_2:"line2",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:0x1d4d4c5a75dde5},CROSSHAIR_ID:"crosshair_elem_id",ZOOM_X_AXIS_PERCENT:.02,DEFAULT_MAX_RECORDS:640,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:3e5,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:[W.Renko,W.LineBreak,W.Kagi,W.PointAndFigure],INTRA_THRESHOLD:eJ("P30D"),ONE_DAY_MILLIS:eJ("P1D"),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:eJ("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,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",value:14},{name:"Source",value:"Close"},{name:"BrickSize",value:10}],DEFAULT_LINEBREAK_INPUTS:[{name:"LineCount",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",value:14},{name:"ReversalAmount",value:30}],DEFAULT_PNF_INPUTS:[{name:"Source",value:"Close"},{name:"BoxSizeMethod",value:"ATR"},{name:"Period",value:14},{name:"BoxSize",value:20},{name:"ReversalAmount",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"};var tz={},tY={};tY=function(e,t,i,s){if(!e3.number(e))return"";(!e3.string(i)||i.length>1)&&(i="");let r=e<0&&!0===s;r&&(e=0-e);let n=e.toFixed(t);if(i&&(e<-999||e>999)){let s=n.length,a=e<0,o=0===t,l=0,u=[];for(let e=s-1;!(e<0);e--){3!==l||a&&0===e||(u.unshift(i),l=0);let t=n.charAt(e);u.unshift(t),o?l+=1:"."===t&&(o=!0)}r&&(u.unshift("("),u.push(")")),n=u.join("")}else r&&(n="("+n+")");return n};var tj={};tj=function(e,t,i,s,r){var n;let a,o;if(!e3.number(e)||!e3.number(t)||!e3.number(i))return"";(!e3.string(s)||s.length>1)&&(s=".");let l=Math.abs(e),u=function(e,t){let i=Math.floor(e);return 0===i&&""===t?"":i}(l,s),h=(n=Math.floor(parseFloat(((l-Math.floor(l))*t).toFixed(1))),("000"+Math.floor(n)).substr(-1*i));return e<0?(r=e3.boolean(r)&&r)?(a="(",o=")"):(a="-",o=""):(a="",o=""),[a,u,s,h,o].join("")};var tK={},tq={},tX={};!function(e){var t,i="[big.js] ",s=i+"Invalid ",r=s+"decimal places",n=s+"rounding mode",a=i+"Division by zero",o={},l=void 0,u=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function h(e,t,i,s){var r=e.c;if(i===l&&(i=e.constructor.RM),0!==i&&1!==i&&2!==i&&3!==i)throw Error(n);if(t<1)s=3===i&&(s||!!r[0])||0===t&&(1===i&&r[0]>=5||2===i&&(r[0]>5||5===r[0]&&(s||r[1]!==l))),r.length=1,s?(e.e=e.e-t+1,r[0]=1):r[0]=e.e=0;else if(t<r.length){if(s=1===i&&r[t]>=5||2===i&&(r[t]>5||5===r[t]&&(s||r[t+1]!==l||1&r[t-1]))||3===i&&(s||!!r[0]),r.length=t,s){for(;++r[--t]>9;)if(r[t]=0,0===t){++e.e,r.unshift(1);break}}for(t=r.length;!r[--t];)r.pop()}return e}function c(e,t,i){var s=e.e,r=e.c.join(""),n=r.length;if(t)r=r.charAt(0)+(n>1?"."+r.slice(1):"")+(s<0?"e":"e+")+s;else if(s<0){for(;++s;)r="0"+r;r="0."+r}else if(s>0)if(++s>n)for(s-=n;s--;)r+="0";else s<n&&(r=r.slice(0,s)+"."+r.slice(s));else n>1&&(r=r.charAt(0)+"."+r.slice(1));return e.s<0&&i?"-"+r:r}o.abs=function(){var e=new this.constructor(this);return e.s=1,e},o.cmp=function(e){var t,i=this.c,s=(e=new this.constructor(e)).c,r=this.s,n=e.s,a=this.e,o=e.e;if(!i[0]||!s[0])return i[0]?r:s[0]?-n:0;if(r!=n)return r;if(t=r<0,a!=o)return a>o^t?1:-1;for(r=-1,n=(a=i.length)<(o=s.length)?a:o;++r<n;)if(i[r]!=s[r])return i[r]>s[r]^t?1:-1;return a==o?0:a>o^t?1:-1},o.div=function(e){var t=this.constructor,i=this.c,s=(e=new t(e)).c,n=this.s==e.s?1:-1,o=t.DP;if(o!==~~o||o<0||o>1e6)throw Error(r);if(!s[0])throw Error(a);if(!i[0])return e.s=n,e.c=[e.e=0],e;var u,c,d,p,f,m=s.slice(),g=u=s.length,y=i.length,T=i.slice(0,u),A=T.length,S=e,v=S.c=[],b=0,P=o+(S.e=this.e-e.e)+1;for(S.s=n,n=P<0?0:P,m.unshift(0);A++<u;)T.push(0);do{for(d=0;d<10;d++){if(u!=(A=T.length))p=u>A?1:-1;else for(f=-1,p=0;++f<u;)if(s[f]!=T[f]){p=s[f]>T[f]?1:-1;break}if(p<0){for(c=A==u?s:m;A;){if(T[--A]<c[A]){for(f=A;f&&!T[--f];)T[f]=9;--T[f],T[A]+=10}T[A]-=c[A]}for(;!T[0];)T.shift()}else break}v[b++]=p?d:++d,T[0]&&p?T[A]=i[g]||0:T=[i[g]]}while((g++<y||T[0]!==l)&&n--)return!v[0]&&1!=b&&(v.shift(),S.e--,P--),b>P&&h(S,P,t.RM,T[0]!==l),S},o.eq=function(e){return 0===this.cmp(e)},o.gt=function(e){return this.cmp(e)>0},o.gte=function(e){return this.cmp(e)>-1},o.lt=function(e){return 0>this.cmp(e)},o.lte=function(e){return 1>this.cmp(e)},o.minus=o.sub=function(e){var t,i,s,r,n=this.constructor,a=this.s,o=(e=new n(e)).s;if(a!=o)return e.s=-o,this.plus(e);var l=this.c.slice(),u=this.e,h=e.c,c=e.e;if(!l[0]||!h[0])return h[0]?e.s=-o:l[0]?e=new n(this):e.s=1,e;if(a=u-c){for((r=a<0)?(a=-a,s=l):(c=u,s=h),s.reverse(),o=a;o--;)s.push(0);s.reverse()}else for(i=((r=l.length<h.length)?l:h).length,a=o=0;o<i;o++)if(l[o]!=h[o]){r=l[o]<h[o];break}if(r&&(s=l,l=h,h=s,e.s=-e.s),(o=(i=h.length)-(t=l.length))>0)for(;o--;)l[t++]=0;for(o=t;i>a;){if(l[--i]<h[i]){for(t=i;t&&!l[--t];)l[t]=9;--l[t],l[i]+=10}l[i]-=h[i]}for(;0===l[--o];)l.pop();for(;0===l[0];)l.shift(),--c;return l[0]||(e.s=1,l=[c=0]),e.c=l,e.e=c,e},o.mod=function(e){var t,i=this,s=i.constructor,r=i.s,n=(e=new s(e)).s;if(!e.c[0])throw Error(a);return(i.s=e.s=1,t=1==e.cmp(i),i.s=r,e.s=n,t)?new s(i):(r=s.DP,n=s.RM,s.DP=s.RM=0,i=i.div(e),s.DP=r,s.RM=n,this.minus(i.times(e)))},o.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},o.plus=o.add=function(e){var t,i,s,r=this.constructor;if(e=new r(e),this.s!=e.s)return e.s=-e.s,this.minus(e);var n=this.e,a=this.c,o=e.e,l=e.c;if(!a[0]||!l[0])return l[0]||(a[0]?e=new r(this):e.s=this.s),e;if(a=a.slice(),t=n-o){for(t>0?(o=n,s=l):(t=-t,s=a),s.reverse();t--;)s.push(0);s.reverse()}for(a.length-l.length<0&&(s=l,l=a,a=s),t=l.length,i=0;t;a[t]%=10)i=(a[--t]=a[t]+l[t]+i)/10|0;for(i&&(a.unshift(i),++o),t=a.length;0===a[--t];)a.pop();return e.c=a,e.e=o,e},o.pow=function(e){var t=this,i=new t.constructor("1"),r=i,n=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(s+"exponent");for(n&&(e=-e);1&e&&(r=r.times(t)),e>>=1;)t=t.times(t);return n?i.div(r):r},o.prec=function(e,t){if(e!==~~e||e<1||e>1e6)throw Error(s+"precision");return h(new this.constructor(this),e,t)},o.round=function(e,t){if(e===l)e=0;else if(e!==~~e||e<-1e6||e>1e6)throw Error(r);return h(new this.constructor(this),e+this.e+1,t)},o.sqrt=function(){var e,t,s,r=this.constructor,n=this.s,a=this.e,o=new r("0.5");if(!this.c[0])return new r(this);if(n<0)throw Error(i+"No square root");0===(n=Math.sqrt(+c(this,!0,!0)))||n===1/0?((t=this.c.join("")).length+a&1||(t+="0"),a=((a+1)/2|0)-(a<0||1&a),e=new r(((n=Math.sqrt(t))==1/0?"5e":(n=n.toExponential()).slice(0,n.indexOf("e")+1))+a)):e=new r(n+""),a=e.e+(r.DP+=4);do s=e,e=o.times(s.plus(this.div(s)));while(s.c.slice(0,a).join("")!==e.c.slice(0,a).join(""))return h(e,(r.DP-=4)+e.e+1,r.RM)},o.times=o.mul=function(e){var t,i=this.constructor,s=this.c,r=(e=new i(e)).c,n=s.length,a=r.length,o=this.e,l=e.e;if(e.s=this.s==e.s?1:-1,!s[0]||!r[0])return e.c=[e.e=0],e;for(e.e=o+l,n<a&&(t=s,s=r,r=t,l=n,n=a,a=l),t=Array(l=n+a);l--;)t[l]=0;for(o=a;o--;){for(a=0,l=n+o;l>o;)a=t[l]+r[o]*s[l-o-1]+a,t[l--]=a%10,a=a/10|0;t[l]=a}for(a?++e.e:t.shift(),o=t.length;!t[--o];)t.pop();return e.c=t,e},o.toExponential=function(e,t){var i=this,s=i.c[0];if(e!==l){if(e!==~~e||e<0||e>1e6)throw Error(r);for(i=h(new i.constructor(i),++e,t);i.c.length<e;)i.c.push(0)}return c(i,!0,!!s)},o.toFixed=function(e,t){var i=this,s=i.c[0];if(e!==l){if(e!==~~e||e<0||e>1e6)throw Error(r);for(i=h(new i.constructor(i),e+i.e+1,t),e=e+i.e+1;i.c.length<e;)i.c.push(0)}return c(i,!1,!!s)},o.toJSON=o.toString=function(){var e=this.constructor;return c(this,this.e<=e.NE||this.e>=e.PE,!!this.c[0])},o.toNumber=function(){var e=+c(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(i+"Imprecise conversion");return e},o.toPrecision=function(e,t){var i=this,r=i.constructor,n=i.c[0];if(e!==l){if(e!==~~e||e<1||e>1e6)throw Error(s+"precision");for(i=h(new r(i),e,t);i.c.length<e;)i.c.push(0)}return c(i,e<=i.e||i.e<=r.NE||i.e>=r.PE,!!n)},o.valueOf=function(){var e=this.constructor;if(!0===e.strict)throw Error(i+"valueOf disallowed");return c(this,this.e<=e.NE||this.e>=e.PE,!0)},(t=function e(){function t(i){if(!(this instanceof t))return i===l?e():new t(i);if(i instanceof t)this.s=i.s,this.e=i.e,this.c=i.c.slice();else{if("string"!=typeof i){if(!0===t.strict&&"bigint"!=typeof i)throw TypeError(s+"value");i=0===i&&1/i<0?"-0":String(i)}!function(e,t){var i,r,n;if(!u.test(t))throw Error(s+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(i=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(i<0&&(i=r),i+=+t.slice(r+1),t=t.substring(0,r)):i<0&&(i=t.length),n=t.length,r=0;r<n&&"0"==t.charAt(r);)++r;if(r==n)e.c=[e.e=0];else{for(;n>0&&"0"==t.charAt(--n););for(e.e=i-r-1,e.c=[],i=0;r<=n;)e.c[i++]=+t.charAt(r++)}}(this,i)}this.constructor=t}return t.prototype=o,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.strict=!1,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}()).default=t.Big=t,"function"==typeof define&&define.amd?define(function(){return t}):tX?tX=t:e.Big=t}(tX),tq=(()=>{class e{constructor(e){this._big=o(e)}add(t){return new e(this._big.plus(o(t)))}subtract(t){return new e(this._big.minus(o(t)))}multiply(t){return new e(this._big.times(o(t)))}divide(t){return new e(this._big.div(o(t)))}raise(t){return e5.argumentIsRequired(t,"exponent",Number),new e(this._big.pow(t))}round(t,i){e5.argumentIsRequired(t,"places",Number),e5.argumentIsOptional(i,"mode",l,"RoundingMode");let s=i||l.NORMAL;return new e(this._big.round(t,s.value))}mod(t){return new e(this._big.mod(o(t)))}absolute(){return new e(this._big.abs())}opposite(){return this.multiply(-1)}getIsZero(e,i){return e5.argumentIsOptional(e,"approximate",Boolean),e5.argumentIsOptional(i,"places",Number),this._big.eq(t)||e3.boolean(e)&&e&&this.round(i||tX.DP,l.NORMAL).getIsZero()}getIsPositive(){return this._big.gt(t)}getIsNegative(){return this._big.lt(t)}getIsGreaterThan(e){return this._big.gt(o(e))}getIsGreaterThanOrEqual(e){return this._big.gte(o(e))}getIsLessThan(e){return this._big.lt(o(e))}getIsLessThanOrEqual(e){return this._big.lte(o(e))}getIsBetween(e,t,i){return(e5.argumentIsOptional(i,"exclusive",Boolean),e3.boolean(i)&&i)?this.getIsGreaterThan(e)&&this.getIsLessThan(t):this.getIsGreaterThanOrEqual(e)&&this.getIsLessThanOrEqual(t)}getIsEqual(e){return this._big.eq(o(e))}getIsApproximate(t,i){if(0===i)return this.getIsEqual(t);let s=this.subtract(t).absolute(),r=e.ONE.divide(new e(10).raise(i));return s.getIsLessThan(r)}getIsInteger(){return this.getIsEqual(this.round(0))}getDecimalPlaces(){let e=this.toFixed().match(/-?\d*\.(\d*)/);return null===e?0:e[1].length}toFloat(e){return e5.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 e5.argumentIsRequired(t,"value",e,"Decimal"),new e(t._big)}static parse(t){return new e(t)}static get ZERO(){return r}static get ONE(){return n}static get NEGATIVE_ONE(){return a}static get ROUNDING_MODE(){return l}static getIsZero(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsZero()}static getIsNotZero(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),!t.getIsZero()}static getIsPositive(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()}static getIsNotPositive(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()}static getIsNotNegative(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,i){return(e5.argumentIsRequired(t,"a",e,"Decimal"),e5.argumentIsRequired(i,"b",e,"Decimal"),t._big.gt(i._big))?1:t._big.lt(i._big)?-1:0}toString(){return"[Decimal]"}}let t=new tX(0),i=new tX(1),s=new tX(-1),r=new e(t),n=new e(i),a=new e(s);function o(t){return t instanceof tX?t:t instanceof e?t._big:new tX(t)}class l extends e7{constructor(e,t){super(e.toString(),t),this._value=e}get value(){return this._value}static get UP(){return u}static get DOWN(){return h}static get NORMAL(){return c}toString(){return"[RoundingMode]"}}let u=new l(3,"up"),h=new l(0,"down"),c=new l(1,"normal");return e})(),tK=(()=>{class e extends e7{constructor(e,t,i,s,r,n,a,o){super(e,e),this._baseCode=t,this._decimalDigits=i,this._supportsFractions=s,s?(this._fractionFactor=r,this._fractionDigits=n,this._fractionFactorSpecial=a||r,this._fractionDigitsSpecial=o||n):(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!0===e?this._fractionFactorSpecial:this._fractionFactor}getFractionDigits(e){return!0===e?this._fractionDigitsSpecial:this._fractionDigits}getMinimumTick(e){e5.argumentIsValid(e,"tickIncrement",e3.integer,"must be an integer");let t=new tq(1),i=new tq(10);return(this.supportsFractions?t.divide(this._fractionFactor):t.divide(i.raise(this._decimalDigits))).multiply(e).toFloat()}getMinimumTickValue(e,t){return e5.argumentIsValid(e,"tickIncrement",e3.integer,"must be an integer"),e5.argumentIsValid(t,"pointValue",e3.number,"must be a number"),new tq(this.getMinimumTick(e)).multiply(t).toFloat()}roundToNearestTick(e,t,i){let s;e5.argumentIsValid(e,"value",e=>e3.number(e)||e instanceof tq,"must be a number primitive or a Decimal instance"),e5.argumentIsValid(t,"minimumTick",e=>e3.number(e)||e instanceof tq,"must be a number primitive or a Decimal instance"),e5.argumentIsOptional(i,"roundToZero",Boolean);let r=(s=e instanceof tq?e:new tq(e)).divide(t);return s.mod(t).getIsZero()||(r=r.round(0,e3.boolean(i)&&i?tq.ROUNDING_MODE.DOWN:tq.ROUNDING_MODE.NORMAL)),r.multiply(t).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(t){return e7.fromCode(e,t)}static fromBaseCode(t){return e7.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})(),tz=function(e,t,i,s,r,n){if(!e3.number(e))return"";let a=tK.parse(t);if(null===a)return"";if((!e3.string(i)||i.length>1)&&(i="."),s=e3.boolean(s)&&s,n=e3.boolean(n)&&n,!a.supportsFractions||"."===i)return tY(e,a.decimalDigits,r,n);{let t=a.getFractionFactor(s),r=a.getFractionDigits(s);return tj(e,t,r,i,n)}};var tZ={};tZ=(()=>{let e={};return e.ZB=/^BB\d$/,e.ZT=/^BT\d$/,e.ZF=/^BF\d$/,e.ZN=/^BN\d$/,function(t,i,s){if(s.asset===e6.FUTURE_OPTION){let i=s.root;if("ZB"===i||"ZN"===i||e.ZB.test(i)||e.ZN.test(i))return tj(t,64,2,"-",!1);if("ZT"===i||"ZF"===i||e.ZT.test(i)||e.ZF.test(i))return tj(t,640,3,"-",!1)}return tz(t,i,"-",!0,",")}})();let tJ=[{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}];function tQ(e){if(eH(e)){let t=e$(yQ().config,null,"overrides","symbology","translateSymbol");if(eH(t)&&"function"==typeof t)try{let i=t(e);if(eH(i))return i}catch(t){yj(`Failed translating the symbol '${e}', error is ${t.message}`,"warn")}}return e}function t0(t,i,s){if(null==t)return"";if(!this.isReady)return t.toFixed(0);if(i.format===Y.FromMetaData)return function(t,i,s){let r=yQ().config;return r.mode===es[es.cmdtyView]&&null!=s?e(tZ)(t,i,s):e(tz)(t,i,"-",r.isAlt64,",",!1)}(t,this.unitCode,this._profile);switch(i.format){case Y.AsInteger:return t.toFixed();case Y.UseMetricUnit:{let e=Object.assign({},{range:[t,t],allDigits:!1},s=s||{});if(s.allDigits)return t3(t,0);Array.isArray(e.range)&&e.range.length||(e.range=[t,t]);let i=Math.max(Math.abs(e.range[0]),Math.abs(e.range[1])),r=function(e,t){let i=eA(e,t);return -1===i?null:e[i]}(tJ,e=>i>e.min)||tJ[0];return`${(t/r.divider).toFixed(r.decimals)}${r.suffix}`}case Y.AsPercent:return`${(100*t).toFixed(2)}%`;default:return""}}function t1(e,t,i){let s=i?.overridePrecision;return Number.isFinite(s)&&s>=0?t3(e,s):null}class t2{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=t_(tQ(this.symbol)),this._profile=null}initialize(e){t6(e)||ez(this,e),this._profile=e}get isReady(){return this.unitCode.length>0}get minMovement(){if(!this.isReady)return 0;if(null==this._minMovement){let e=Number.parseInt(this.unitCode,16);this._minMovement=this.tickIncrement*(1/(e<8?2<<e:10**(e-8)))}return this._minMovement}format(e,t,i){let s=t1(e,t,i);return null!==s?s:t0.call(this,e,t,i)}parse(e){throw Error("Not implemented yet")}getInlineMetadata(e){let t=tD(`#${tG.INLINE_DATA_ELEMENT_ID}`);if(!eH(t))return null;let i=JSON.parse(t),s=e;return s in i||(s=function(e,t){if(!tg(e))return e;let i=tc(e);return t.find(e=>tc(e).root===i.root)||e}(e,Object.keys(i)))in i?i[s].instrument:null}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),i=await yq("ondemand",`/${this.getFallbackApi()}.json?symbols=${t}`),s=JSON.parse(i);if(200===s.status.code&&1===s.results.length){let e=s.results[0];return this.processFallback(e)}}catch(t){yj(`Failed fetching the metadata for ${e}, error is ${t.message}`,"warn")}return{name:"",exchange:"",unitCode:"A",pointValue:1,tickIncrement:1}}}function t3(t,i){return e(tY)(t,i,",",!1)}function t4(e,t=!1){return new is(e,t)}class t5 extends t2{shutdown(){}async ready(){return tU.call(this,async()=>{let e=tQ(this.symbol),t=this.getInlineMetadata(e);return t6(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0})}getCacheableEntities(e){e.add(this)}}function t6(e){return!eV(e)||!eH(e.unitCode,e.name,e.exchange)||0===e.unitCode.length}class t7 extends t2{shutdown(){}equityOptionProfile(){return{name:this.symbol,exchange:"",unitCode:"A",pointValue:1,tickIncrement:1,symbolType:"EquityOption"}}async ready(){return tU.call(this,async()=>{let e=tQ(this.symbol);if(tv(e))return this.initialize(this.equityOptionProfile()),!0;let t=tC(e),i=await (t?tf(e):e);this.resolved=tP(i);let[s,r]=await tO(this.resolved),n=new Promise(e=>{setTimeout(()=>e(null),tG.META_DATA_GET_TIMETOUT)}),a=await Promise.race([n,this.getProfile(s)]);return t6(a)&&(a=this.getInlineMetadata(s)),t6(a)&&(a=await this.getFallbackMetadata(s)),a?.symbolType==="Unknown"&&r&&(a.symbolType="Future"),this.initialize(a),!0})}async getProfile(e){return Promise.reject(Error("Method shold be implemented in the derived class."))}getCacheableEntities(e){e.add(this)}}class t8 extends t7{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=yQ(),i=await t.connection.getMarketState().getProfile(e);return{symbolType:this.getType(i.asset),name:i.name,exchange:i.exchange,unitCode:i.unitCode,pointValue:i.pointValue,tickIncrement:i.tickIncrement,timeZone:i.exchangeRef?.timeZoneDdf}}}var t9=((x=t9||{})[x.UNKNOWN_INSTRUMENT_TYPE=0]="UNKNOWN_INSTRUMENT_TYPE",x[x.FOREX=1]="FOREX",x[x.INDEX=2]="INDEX",x[x.EQUITY=3]="EQUITY",x[x.FUTURE=4]="FUTURE",x[x.OPTION=5]="OPTION",x[x.SPREAD=6]="SPREAD",x[x.MUTUAL_FUND=7]="MUTUAL_FUND",x[x.MONEY_MARKET_FUND=8]="MONEY_MARKET_FUND",x[x.USER_DEFINED_SPREAD=9]="USER_DEFINED_SPREAD",x[x.EQUITY_OPTION=10]="EQUITY_OPTION",x[x.OTHER=99]="OTHER",x[x.UNRECOGNIZED=-1]="UNRECOGNIZED",x);class ie extends t7{_profileSource=new tW;priceDenominator=1;quantityDenominator=1;priceScaling=1;expirationDate;asPrice(e){return void 0===e?null:e.toNumber()/this.priceDenominator*this.priceScaling}asQuantity(e){return void 0===e?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"}processFallback(e){let t=e.definition;return t.instrumentType=t9[t.instrumentType],this.getProfileFromInstrumentDefinition(t)}getProfileFromInstrumentDefinition(e){this.expirationDate=e.symbolExpiration;let{priceDenominator:t,priceScalingExponent:i,quantityDenominator:s}=e;if(0!==t&&(this.priceDenominator=t),0!==s&&(this.quantityDenominator=s),i&&0!==i){let e=1;i<0?e/=Math.pow(10,-i):e*=Math.pow(10,i),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=yQ(),i=await t.adapter?.getInstrument(this.getRequest(e))??[];return i.length<1?null:this.getProfileFromInstrumentDefinition(i[0])}}class it{_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,i){if(null==e)return"";let s=t1(e,t,i);return null!==s?s:t3(e,this._decimals)}getCacheableEntities(e){}}class ii{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,i){return null==e?"":eH(e)?e.toFixed(0):""}getCacheableEntities(e){}}class is{inner;forceDecimals;unitCode="";pointValue=1;tickIncrement=1;minMovement=0;symbol="";symbolType="Unknown";resolved="";name="";exchange="";constructor(e,t=!1){let i=yQ().getMetaDataSource();this.inner=e.map(e=>i.getMetaData(e)),this.forceDecimals=t}get isReady(){return null!=this.unitCode}async ready(){return tU.call(this,async()=>{let e=(await Promise.all(this.inner.map(e=>e.ready()))).every(ed);if(e){let e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:i,no:s}=eT(this.inner,e=>t(e)>=8),r=this.inner.length,n=e=>Math.max(...e).toString(16).toUpperCase();if(this.forceDecimals||i.length!==r&&s.length!==r){let r=i.map(t).concat(s.map(t).map(e=>String.fromCharCode(e-2+66)).map(e));this.unitCode=n(r)}else this.unitCode=n(this.inner.map(t));this.minMovement=Math.min(...this.inner.map(e=>e.minMovement))}return e})}format(e,t,i){let s=t1(e,t,i);return null!==s?s:t0.call(this,e,t,i)}getCacheableEntities(e){this.inner.forEach(t=>e.add(t))}shutdown(){}}class ir{metaDataCache;constructor(){this.metaDataCache=new Map}getMetaData(e){if(e===tG.PLACEHOLDER_SYMBOL_NAME)return new ii;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,i]of this.metaDataCache)e.has(i)||(i.shutdown(),this.metaDataCache.delete(t))}}class ia extends ir{metaDataCreator(e){return new t5(e)}}class io extends ir{metaDataCreator(e){return new t8(e)}}class il extends ir{metaDataCreator(e){return new ie(e)}}let iu=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,ih=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,ic=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,id={r:255,g:255,b:255,a:1},ip={r:0,g:0,b:0,a:1};function im(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function ig(e,t){let i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)}function iy(e,t){return{x:e.x-t.x,y:e.y-t.y}}function iT(e,t){return{x:e.x+t.x,y:e.y+t.y}}function iA(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function iS(e,t,i){let[s,r]=e,n=r.x-s.x,a=r.y-s.y,o=t.x-s.x,l=t.y-s.y;if(0===n&&0===a)return Math.abs(o)<=i&&Math.abs(l)<=i;let u=Math.atan2(a,n),h=Math.sqrt(n*n+a*a),c=Math.atan2(l,o),d=Math.sqrt(o*o+l*l),p=d*Math.cos(c-u);return Math.abs(d*Math.sin(c-u))<=i&&-i<=p&&p<=h+i}function iv(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(ed)}function ib(e){var t=iM(e);let i=e=>{let t=e.toString(16);return 2===t.length?t:"0"+t};return`#${i(t.r)}${i(t.g)}${i(t.b)}`}function iP(e,t){let i=iM(e);return i.a=t,iO(i)}function iC(e,t,i,s=!1){let r=e.a,n=s=>Math.floor(e[s]+(t[s]-e[s])*i);return{r:n("r"),g:n("g"),b:n("b"),a:Math.min(1,(1+(s?i:0))*r)}}let iE=(e,t=!1)=>ec(iM,i=>iC(i,ip,e,t),iO);function i_(e,t=!1){return ec(iM,i=>iC(i,id,e,t),iO)}function iM(e){if(["r","g","b","a"].map(t=>e[t]).every(e=>eH(e)))return e;let t=eH(e.linearGradient)?e._refColor:e,i=iu.exec(t);if(null!==i){let e=eH(i[2]),t=i[1]+(i[2]||""),s=i=>e?parseInt(t.substr(2*i,2),16):17*parseInt(t.charAt(i),16);return{r:s(0),g:s(1),b:s(2),a:1}}{let e=ic.exec(t),i=ih.exec(t),s=(e,t)=>eH(e)&&e.length===t,r=s(e,5),n=s(i,4);if(!r&&!n)throw Error("Color is neither a hex color nor a rgba one.");let a=r?e:i,o=e=>parseInt(a[e]),l=parseFloat(a[4]);return{r:o(1),g:o(2),b:o(3),a:r?l:1}}}function iL(e){var t;let{r:i,g:s,b:r}=iM(e),[n,a,o]=[i,s,r].map(e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)});return(t=.2126*n+.7152*a+.0722*o)<=.008856?903.3*t:116*Math.pow(t,1/3)-16}function ix(e){return iL(e)>66.66?"#000":"#fff"}function iO(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function iI(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}class iD{x;y;width;height;constructor(e,t,i,s){this.x=e,this.y=t,this.width=i,this.height=s}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 iD(this.x,this.y,this.width,this.height)}}class iw{cx;cy;radiusX;radiusY;constructor(e,t,i,s){this.cx=e,this.cy=t,this.radiusX=i,this.radiusY=s}contains(e){let t=Math.abs(e.x-this.cx)/this.radiusX,i=Math.abs(e.y-this.cy)/this.radiusY;return 1>=Math.sqrt(t*t+i*i)}}function iR(e,t){e.moveTo(t.x,t.y)}function iN(e,t){e.lineTo(t.x,t.y)}function iV(e,t,i){e.rect(t.x,t.y,i.x-t.x,i.y-t.y)}function iH(e,t=tG.LINE_HEIGHT_MULTIPLIER){return t*e.measureText("M").width}function iF(e,t=!1,i=1){let s=ik(e,t,i).y;return s-Math.sign(s)*tG.DEFAULT_ADORN_OFFSET.y}function ik(e,t=!1,i=1){let s={...tG.DEFAULT_ADORN_OFFSET};return t&&(s.y=-(i*iH(e,1)+s.y)),s}function iB(e,t,i,s=J.Left){var r;let n=Array.isArray(t)?t:[t],a=iH(e,1),o=Math.max(...n.map(t=>e.measureText(t).width)),l=a*n.length,u=i.x;return s===J.Right&&(u-=o),s===J.Center&&(u-=o/2),r=new iD(u,i.y-a,o,l),r.x-=4,r.y-=4,r.width+=8,r.height+=8,r}function iU(e,t,i,s=J.Left,r,n){e.save();let a=Array.isArray(t)?t:[t],o=iH(e,1);if(eH(n)){let r=iB(e,t,i,s);e.fillStyle=n,iW(e,r,!1)}eH(r)&&(e.fillStyle=r);let l=i.x,u=i.y;a.forEach(t=>{e.textAlign=J[s].toLowerCase(),e.fillText(t,l,u),u+=o}),e.restore()}function iW(e,t,i=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),i&&e.stroke(),e.fill()}function i$(e,t,i,s=0,r=Math.PI,n=!1,a=!1){e.beginPath(),a&&e.moveTo(t.x,t.y),e.arc(t.x,t.y,Math.abs(i),s,r,n),e.stroke(),a&&e.fill()}function iG(e,{x:t,y:i},{x:s,y:r}){e.beginPath(),e.moveTo(t,i),e.lineTo(s,r),e.stroke()}function iz(e,t,i,s){iG(e,{x:t,y:i},{x:t,y:s})}function iY(e,t,i,s){iG(e,{x:i,y:t},{x:s,y:t})}function ij(e,t,i){e.save();let s=t.centerX,r=t.centerY,n=Math.floor(Math.min(t.width/2,t.height/2));e.strokeStyle=e.fillStyle,e.lineWidth=Math.max(1,.1*n),i$(e,{x:s,y:r},n,0,2*Math.PI),e.textAlign="center",e.font=`${2*n}px Arial`,e.textBaseline="middle",e.fillText(i,s,r+.15*n),e.restore()}function iK(e,t=1){let i=Math.floor(e.centerX),s=Math.floor(e.centerY),{width:r,height:n}=e;n=(r=.9*Math.min(r,n*t))/t;let a=Math.floor(i-r/2),o=Math.floor(i+r/2),l=Math.floor(s-n/2),u=Math.floor(s+n/2);return{cx:i,cy:s,left:a,right:o,top:l,bottom:u,halfBaseSize:.21*Math.min(r,n)}}function iq(e){let t=Math.floor(e.centerX),i=Math.floor(e.centerY),{width:s,height:r}=e,n=Math.floor(Math.min(s,r)),a=Math.floor(t-(n*=.9)/2),o=Math.floor(t+n/2);return{cx:t,cy:i,left:a,right:o,arcWidth:.075*n,deflection:.3*n}}function iX(){let e=yQ().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?eF(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}let iZ=(e,t)=>!0,iJ=(e,t)=>e.map((e,i)=>({shown:t(e,i),value:e,line:{width:1,color:iQ(i),dashStyle:"Solid"}})),iQ=e=>i8[e%i8.length],i0=e=>e.filter(e=>e.shown),i1={width:1,color:"#000",dashStyle:"Solid"},i2={width:1,color:"rgba(136,136,136,0.75)",dashStyle:"Dash"},i3={color:tG.COLOR_TRANSPARENT},i4={[tG.AT_SINGLE_STYLE]:!0,[tG.AT_SHOW_BACKGROUND]:!1};function i5(e,t){let i=eG(e$(e,i1,"annotationTraits","line")),s=eG(e$(e,i2,"annotationTraits","line2")),r=eG(e$(e,i3,"annotationTraits","fill")),n=sA[t],a=n?.defaults||{};yQ().config.colorfulAnnotations||(ez(a,i4),("GannBox"===t||"GannSquare"===t)&&(a[tG.AT_SHOW_BACKGROUND]=!0));let o=n?.editable.includes(tG.AT_LINE_2),l=eH(a[tG.AT_LINE_2]),u={line:i,fill:r,...a};return o&&!l&&(u.line2=s),u}function i6(e,t){Object.keys(t).forEach(i=>{i===tG.LINE_DASH_PROP_NAME?e.setLineDash(t[i]):e[i]=t[i]})}function i7(e){let t=ec(iM,iO);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:iv(e.line.dashStyle)}}let i8=["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)"],i9=[tG.AT_LINE,tG.AT_ALLOW_PRICES_CHANGE_UI],se=[tG.AT_FILL,tG.AT_ALLOW_PRICES_CHANGE_UI],st=[tG.AT_LINE,tG.AT_FILL,tG.AT_ALLOW_PRICES_CHANGE_UI],si=[...st,tG.AT_FILL_TEXT],ss=[tG.AT_TEXT_LINES,tG.AT_FILL,tG.AT_ALLOW_PRICES_CHANGE_UI],sr=[...i9,tG.AT_LINE_2,tG.AT_SHOW_PRICES,tG.AT_SHOW_LEVELS,tG.AT_LEVELS_KIND,tG.AT_LABELS,tG.AT_EXTEND_LEFT,tG.AT_EXTEND_RIGHT,tG.AT_SHOW_TRENDLINE,tG.AT_FACTORS,tG.AT_PRICES_ON_SCALE,tG.AT_REVERSE,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY,tG.AT_LEVELS_RESPECT_LOG_SCALE],sn=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],sa=e=>({[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_PRICES]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_EXTEND_LEFT]:!1,[tG.AT_EXTEND_RIGHT]:!1,[tG.AT_SHOW_TRENDLINE]:!0,[tG.AT_FACTORS]:iJ(sn.slice(2),(t,i)=>0<=t&&t<=e),[tG.AT_PRICES_ON_SCALE]:!1,[tG.AT_REVERSE]:!1,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),so=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_SHOW_TRENDLINE,type:"bool"},{id:tG.AT_LINE_2,type:"line",enabledIf:tG.AT_SHOW_TRENDLINE},{id:tG.AT_EXTEND_LEFT,type:"bool"},{id:tG.AT_EXTEND_RIGHT,type:"bool"},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"},{id:tG.AT_SHOW_PRICES,type:"bool"},{id:tG.AT_PRICES_ON_SCALE,type:"bool"},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LEVELS_KIND,type:"string",enum:[tG.AT_LEVELS_PERCENTS,tG.AT_LEVELS_VALUES],enabledIf:tG.AT_SHOW_LEVELS},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]},{id:tG.AT_LEVELS_RESPECT_LOG_SCALE,type:"bool"}],sl={[tG.AT_LINE]:{color:"#3861f6",width:1,dashStyle:"Solid"},[tG.AT_FILL]:{color:"rgba(56, 97, 246, 0.2)"},[tG.AT_FILL_TEXT]:{color:"#f0f0f0"},[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},su=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_FILL,type:"color"},{id:tG.AT_FILL_TEXT,type:"color"}],sh=[0,.25,.382,.5,.618,.75,1],sc=[8,4,3,2,1].map(e=>`1/${e}`).concat([2,3,4,8].map(e=>`${e}/1`)),sd=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_SHOW_PRICES,type:"bool"},{id:tG.AT_RATIO,type:"bool"},{id:tG.AT_SHOW_PERCENTDIFF,type:"bool"},{id:tG.AT_SHOW_BARCOUNT,type:"bool"},{id:tG.AT_EXTEND_PT_1,type:"bool"},{id:tG.AT_EXTEND_PT_2,type:"bool"},{id:tG.AT_MARKER,type:"object",properties:[{id:tG.AT_KIND,type:"string",enum:[tG.AT_ARROW]},{id:tG.AT_VERTEX,type:"string",enum:[tG.AT_VERTEX_NONE,tG.AT_VERTEX_START,tG.AT_VERTEX_END,tG.AT_VERTEX_BOTH]}]}],sp=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"}],sf=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_FILL,type:"color"}],sm=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_FILL,type:"color"},{id:tG.AT_FILL2,type:"color"},{id:tG.AT_FILL_TEXT,type:"color"},{id:tG.AT_COMPACT,type:"bool"},{id:tG.AT_ACCOUNT_SIZE,type:"number"},{id:tG.AT_RISK,type:"number"},{id:tG.AT_RISK_IS_PERCENT,type:"bool"}],sg=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_FILL,type:"color"}],sy={[tG.AT_KIND]:tG.AT_ARROW,[tG.AT_VERTEX]:tG.AT_VERTEX_NONE},sT=[tG.AT_LINE,tG.AT_RATIO,tG.AT_SHOW_PRICES,tG.AT_ALLOW_PRICES_CHANGE_UI,tG.AT_SHOW_BARCOUNT,tG.AT_SHOW_PERCENTDIFF,tG.AT_EXTEND_PT_1,tG.AT_EXTEND_PT_2,tG.AT_MARKER],sA={Line:{editable:sT,defaults:{[tG.AT_SHOW_PRICES]:!1,[tG.AT_SHOW_BARCOUNT]:!1,[tG.AT_SHOW_PERCENTDIFF]:!1,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!1,[tG.AT_MARKER]:sy,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sd,numPoints:2},Ray:{editable:sT,defaults:{[tG.AT_SHOW_PRICES]:!1,[tG.AT_SHOW_BARCOUNT]:!1,[tG.AT_SHOW_PERCENTDIFF]:!1,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!0,[tG.AT_MARKER]:sy,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sd,numPoints:2},VerticalLine:{editable:[tG.AT_LINE,tG.AT_SHOW_TIMESTAMPS,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_SHOW_TIMESTAMPS]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_SHOW_TIMESTAMPS,type:"bool"}],numPoints:1},HorizontalLine:{editable:[tG.AT_LINE,tG.AT_SHOW_PRICES,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_SHOW_PRICES]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:1},TrendChannel:{editable:[...i9,tG.AT_EXTEND_PT_1,tG.AT_EXTEND_PT_2],defaults:{[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!1,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...sp,{id:tG.AT_EXTEND_PT_1,type:"bool"},{id:tG.AT_EXTEND_PT_2,type:"bool"}],numPoints:3},GannLine:{editable:sT,defaults:{[tG.AT_SHOW_PRICES]:!1,[tG.AT_SHOW_BARCOUNT]:!1,[tG.AT_SHOW_PERCENTDIFF]:!1,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!0,[tG.AT_MARKER]:sy,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sd,numPoints:2},SpeedResistanceArcs:{editable:i9,types:sp,numPoints:2},SpeedResistanceFan:{editable:i9,types:sp,numPoints:2},AndrewsPitchfork:{editable:i9,types:sp,numPoints:3},Rectangle:{editable:st,types:sf,numPoints:2},Ellipse:{editable:st,types:sf,numPoints:2},DateRange:{editable:si,defaults:sl,types:su,numPoints:2},PriceRange:{editable:si,defaults:sl,types:su,numPoints:2},DatePriceRange:{editable:[...si,tG.AT_DRAW_BORDER],defaults:{...sl,[tG.AT_DRAW_BORDER]:!1},types:[...su,{id:tG.AT_DRAW_BORDER,type:"bool"}],numPoints:2},GannBox:{editable:[tG.AT_LINE,tG.AT_LINE_2,tG.AT_ALLOW_PRICES_CHANGE_UI,tG.AT_PRICE_LEVELS,tG.AT_TIME_LEVELS,tG.AT_SHOW_LEFT_LABELS,tG.AT_SHOW_RIGHT_LABELS,tG.AT_SHOW_TOP_LABELS,tG.AT_SHOW_BOTTOM_LABELS,tG.AT_SHOW_ANGLES,tG.AT_REVERSE,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_LINE]:{color:"#33776b",width:1,dashStyle:"Solid"},[tG.AT_LINE_2]:{color:"#33776b",width:1,dashStyle:"Solid"},[tG.AT_PRICE_LEVELS]:iJ(sh,iZ),[tG.AT_TIME_LEVELS]:iJ(sh,iZ),[tG.AT_SHOW_LEFT_LABELS]:!0,[tG.AT_SHOW_RIGHT_LABELS]:!0,[tG.AT_SHOW_TOP_LABELS]:!0,[tG.AT_SHOW_BOTTOM_LABELS]:!0,[tG.AT_SHOW_ANGLES]:!1,[tG.AT_REVERSE]:!1,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_PRICE_LEVELS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_LEFT_LABELS,type:"bool"},{id:tG.AT_SHOW_RIGHT_LABELS,type:"bool"},{id:tG.AT_TIME_LEVELS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_TOP_LABELS,type:"bool"},{id:tG.AT_SHOW_BOTTOM_LABELS,type:"bool"},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"},{id:tG.AT_SHOW_ANGLES,type:"bool"},{id:tG.AT_LINE_2,type:"line",enabledIf:tG.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[...i9,tG.AT_LEVELS,tG.AT_FANS,tG.AT_ARCS,tG.AT_REVERSE,tG.AT_SHOW_RANGES_RATIO,tG.AT_PRICE_BAR_RATIO,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_LINE]:{color:"#712b9c",width:1,dashStyle:"Solid"},[tG.AT_LEVELS]:iJ([0,1,2,3,4,5],iZ),[tG.AT_FANS]:iJ(["8x1","5x1","4x1","3x1","2x1","1x1","1x2","1x3","1x4","1x5","1x8"],(e,t)=>t>3&&t<7),[tG.AT_ARCS]:iJ(["1x0","1x1","1.5x0","2x0","2x1","3x0","3x1","4x0","4x1","5x0","5x1"],iZ),[tG.AT_REVERSE]:!1,[tG.AT_SHOW_RANGES_RATIO]:!0,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_LEVELS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_FANS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_ARCS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"},{id:tG.AT_PRICE_BAR_RATIO,type:"number",editable:!0},{id:tG.AT_SHOW_RANGES_RATIO,type:"bool"}],numPoints:2},LongPosition:{editable:[tG.AT_LINE,tG.AT_FILL,tG.AT_FILL2,tG.AT_FILL_TEXT,tG.AT_COMPACT,tG.AT_ACCOUNT_SIZE,tG.AT_RISK,tG.AT_RISK_IS_PERCENT,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_FILL]:{color:"rgba(0, 160, 0, 0.2)"},[tG.AT_FILL2]:{color:"rgba(205, 0, 0, 0.2)"},[tG.AT_FILL_TEXT]:{color:"#fff"},[tG.AT_COMPACT]:!1,[tG.AT_ACCOUNT_SIZE]:1e3,[tG.AT_RISK]:25,[tG.AT_RISK_IS_PERCENT]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sm,numPoints:4},ShortPosition:{editable:[tG.AT_LINE,tG.AT_FILL,tG.AT_FILL2,tG.AT_FILL_TEXT,tG.AT_COMPACT,tG.AT_ACCOUNT_SIZE,tG.AT_RISK,tG.AT_RISK_IS_PERCENT,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_FILL]:{color:"rgba(205, 0, 0, 0.2)"},[tG.AT_FILL2]:{color:"rgba(0, 160, 0, 0.2)"},[tG.AT_FILL_TEXT]:{color:"#fff"},[tG.AT_COMPACT]:!1,[tG.AT_ACCOUNT_SIZE]:1e3,[tG.AT_RISK]:25,[tG.AT_RISK_IS_PERCENT]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sm,numPoints:4},FiftyPercentLine:{editable:[tG.AT_USE_52WEEK_PRICES,tG.AT_LINE,tG.AT_LINE_2,tG.AT_SHOW_PRICES,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_USE_52WEEK_PRICES]:!1,[tG.AT_SHOW_PRICES]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_USE_52WEEK_PRICES,type:"bool"},{id:tG.AT_LINE,type:"line"},{id:tG.AT_LINE_2,type:"line"},{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:2},FibonacciRetracement:{editable:sr,defaults:sa(1),types:so,numPoints:2},TrendBasedFibExtension:{editable:sr,defaults:sa(5),types:so,numPoints:3},FibonacciFan:{editable:[...i9,tG.AT_SHOW_LEVELS,tG.AT_LABELS,tG.AT_FACTORS,tG.AT_REVERSE,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_REVERSE]:!1,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_FACTORS]:iJ(sn.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"}],numPoints:2},FibonacciArcs:{editable:[...i9,tG.AT_LINE_2,tG.AT_SHOW_TRENDLINE,tG.AT_FACTORS,tG.AT_SHOW_LEVELS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_TRENDLINE]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_FACTORS]:iJ(sn.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_SHOW_TRENDLINE,type:"bool"},{id:tG.AT_LINE_2,type:"line",enabledIf:tG.AT_SHOW_TRENDLINE},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},FibonacciChannel:{editable:[...i9,tG.AT_SHOW_PRICES,tG.AT_SHOW_LEVELS,tG.AT_LEVELS_KIND,tG.AT_LABELS,tG.AT_EXTEND_PT_1,tG.AT_EXTEND_PT_2,tG.AT_FACTORS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_PRICES]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!1,[tG.AT_FACTORS]:iJ(sn.slice(2),iZ),[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_EXTEND_PT_1,type:"bool"},{id:tG.AT_EXTEND_PT_2,type:"bool"},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_PRICES,type:"bool"},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LEVELS_KIND,type:"string",enum:[tG.AT_LEVELS_PERCENTS,tG.AT_LEVELS_VALUES],enabledIf:tG.AT_SHOW_LEVELS},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[...i9,tG.AT_ANGLES,tG.AT_SHOW_LEVELS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_ANGLES]:iJ(sc,iZ)},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_ANGLES,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},SymbolArrowUp:{editable:se,types:sg,numPoints:1},SymbolArrowDown:{editable:se,types:sg,numPoints:1},SymbolArrowRight:{editable:se,types:sg,numPoints:1},SymbolArrowLeft:{editable:se,types:sg,numPoints:1},SymbolArrowHorizontal:{editable:se,types:sg,numPoints:1},SymbolArrowVertical:{editable:se,types:sg,numPoints:1},SymbolArcDown:{editable:se,types:sg,numPoints:1},SymbolArcUp:{editable:se,types:sg,numPoints:1},SymbolThumbsUp:{editable:se,types:sg,numPoints:1},SymbolThumbsDown:{editable:se,types:sg,numPoints:1},SymbolZero:{editable:se,types:sg,numPoints:1},SymbolOne:{editable:se,types:sg,numPoints:1},SymbolTwo:{editable:se,types:sg,numPoints:1},SymbolThree:{editable:se,types:sg,numPoints:1},SymbolFour:{editable:se,types:sg,numPoints:1},SymbolFive:{editable:se,types:sg,numPoints:1},SymbolSix:{editable:se,types:sg,numPoints:1},SymbolSeven:{editable:se,types:sg,numPoints:1},SymbolEight:{editable:se,types:sg,numPoints:1},SymbolNine:{editable:se,types:sg,numPoints:1},SymbolQuestion:{editable:se,types:sg,numPoints:1},SymbolFishHook:{editable:se,types:sg,numPoints:1},SymbolBuy:{editable:se,types:sg,numPoints:1},SymbolSell:{editable:se,types:sg,numPoints:1},FibonacciTimeZones:{editable:[...i9,tG.AT_FACTORS,tG.AT_SHOW_LEVELS,tG.AT_LABELS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_FACTORS]:iJ([0,1,2,3,5,8,13,21,34,55,89,144],iZ),[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:ss,types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_TEXT_LINES,type:"array",items:{ref:tG.AT_TEXT_ITEM}},{id:tG.AT_TEXT_ITEM,type:"string"},{id:tG.AT_FILL,type:"color"}],numPoints:2},ProfitLoss:{editable:[...st,tG.AT_SHOW_PRICES,tG.AT_NUM_CONTRACTS,tG.AT_POSITION,tG.AT_PROFIT_LOSS],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!1,[tG.AT_SHOW_PRICES]:!0,[tG.AT_NUM_CONTRACTS]:1,[tG.AT_POSITION]:tG.AT_POSITION_LONG,[tG.AT_PROFIT_LOSS]:void 0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_PROFIT_LOSS,type:"number",editable:!1},{id:tG.AT_NUM_CONTRACTS,type:"number"},{id:tG.AT_POSITION,type:"string",enum:[tG.AT_POSITION_SHORT,tG.AT_POSITION_LONG]},...sf,{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:2},RewardRisk:{editable:[...st,tG.AT_SHOW_PRICES,tG.AT_NUM_CONTRACTS,tG.AT_POSITION,tG.AT_RISK,tG.AT_REWARD,tG.AT_RATIO],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!1,[tG.AT_SHOW_PRICES]:!0,[tG.AT_NUM_CONTRACTS]:1,[tG.AT_POSITION]:tG.AT_POSITION_LONG,[tG.AT_RISK]:void 0,[tG.AT_REWARD]:void 0,[tG.AT_RATIO]:void 0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_REWARD,type:"number",editable:!1},{id:tG.AT_RISK,type:"number",editable:!1},{id:tG.AT_RATIO,type:"number",editable:!1},{id:tG.AT_NUM_CONTRACTS,type:"number"},{id:tG.AT_POSITION,type:"string",enum:[tG.AT_POSITION_SHORT,tG.AT_POSITION_LONG]},...sf,{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:2}};function sS(e){return e?sA[e].editable:sA}var sv={};sv=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart HTML5 Charts","definitions":{"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"]},"period":{"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)?)?$"},"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","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","BOLLBW","BOLLBP","OBVOL","OBVOLAVG","ATR","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","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","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","REATRHI","REATRLO","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","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","BOLLSQ","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"]},"generalField":{"type":"string","enum":["DateTime","Open","High","Low","Close","TradeSize","Volume","OpenInterest","Last","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","BSQUEEZE","OBVOL","ATR","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","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRHI","REATRLO","LINRCHN","CSHO","CSHB","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"]},"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","SymbolBuy","SymbolSell","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"}}},"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"},"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"},"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","dashStyle":"LongDashDot"}},"cycleTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","dashStyle":"ShortDashDot"}}}}]},"annotationTraits":{"$ref":"#/definitions/annTraits"},"curveTraits":{"type":"array","items":{"$ref":"#/definitions/curveTrait"}},"allAnnotationsLocked":{"type":"boolean","default":false}}},"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"}}},"stringInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"string"}}},"input":{"type":"object","oneOf":[{"$ref":"#/definitions/numberInput"},{"$ref":"#/definitions/stringInput"}]},"inputs":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/input"}},"curves":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curve"}},"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},"type":{"$ref":"#/definitions/symbolType"},"main":{"type":"boolean","default":false},"inputs":{"$ref":"#/definitions/inputs"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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"},"type":{"$ref":"#/definitions/fundamentalType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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"},"studyPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"basis":{"type":"string","default":"$main"},"study":{"$ref":"#/definitions/study"},"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":["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"},"type":{"$ref":"#/definitions/exprType"},"main":{"type":"boolean","default":false},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["expression","type"]},"forwardType":{"type":"string","pattern":"Forward"},"intOffset":{"type":"integer","minimum":0,"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]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/forwardType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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]},"usesInAverage":{"type":"array","minItems":0,"items":{"type":"boolean"},"default":[]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/seasonalType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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"},"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":{"type":"string"},"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"]}},"type":"object","additionalProperties":false,"properties":{"data":{"$ref":"#/definitions/data"},"display":{"$ref":"#/definitions/display"},"panes":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/pane"}},"version":{"type":"integer","minimum":148,"multipleOf":1}},"required":["panes","version"]}');var sb={};sb=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart studies for HTML5 Charts","definitions":{"studyMetadata":{"type":"object","additionalProperties":false,"properties":{"title":{"type":"string"},"overlay":{"type":"boolean","default":true},"decimals":{"type":"number"},"shiftable":{"type":"boolean"},"range":{"type":"object","additionalProperties":false,"properties":{"min":{"type":"number"},"max":{"type":"number"}}},"enumerations":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/enumeration"}}},"required":["title"]},"enumeration":{"type":"object","additionalProperties":false,"properties":{"input":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}}},"studyDefaults":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"chart.schema.json#/definitions/curves"},"source":{"$ref":"chart.schema.json#/definitions/curveField"},"inputs":{"$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":false,"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"}}');var sP={};sP=JSON.parse('{"$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":false,"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"}}');var sC={};sC=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema","title":"JSON schema for the Barchart API of the HTML5 Charts","definitions":{"curvesNonStrict":{"type":"array","maxItems":1,"items":{"$ref":"chart.schema.json#/definitions/curveNonStrict"}},"mainPlotSymbolContext":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"}},"required":["symbol"]},"mainPlotExpressionContext":{"type":"object","additionalProperties":false,"properties":{"expression":{"type":"string"}},"required":["expression"]},"mainPlotForwardContext":{"type":"object","additionalProperties":false,"properties":{"forward":{"type":"string"}},"required":["forward"]},"mainPlotSeasonalContext":{"type":"object","additionalProperties":false,"properties":{"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":{"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"}}}},"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"},"percentChange":{"type":"boolean"},"comparisonMode":{"type":"string","enum":["None","Percent","Value"]},"showLastValue":{"type":"string","enum":["None","All","Main"]},"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"},"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":"chart.schema.json#/definitions/inputs"},"curves":{"$ref":"#/definitions/curvesNonStrict"},"levels":{"$ref":"chart.schema.json#/definitions/studyLevels"},"bands":{"$ref":"chart.schema.json#/definitions/studyBands"},"placement":{"$ref":"#/definitions/placement"},"cloneIndex":{"$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"]},"compareAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Compare"},"context":{"type":"object","additionalProperties":false,"properties":{"symbols":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/compareSymbol"}}}}},"required":["id","context"]},"annotationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Annotation"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Delete","Update","Duplicate","List","FlipHorizontal","FlipVertical"]},"uid":{"type":"string","default":""},"visible":{"type":"boolean"},"traits":{"$ref":"chart.schema.json#/definitions/annTraits"},"extras":{"type":"object","additionalProperties":true},"points":{"type":"array","items":{"$ref":"chart.schema.json#/definitions/annPoint"}}},"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"]},"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"}}}}}}}},"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/templateAccessor"},{"$ref":"#/definitions/outlineAccessor"},{"$ref":"#/definitions/themeAccessor"}]}');var sE={};function s_(t){switch(t){case tG.CHART_SCHEMA:return e(sv);case tG.STUDIES_SCHEMA:return e(sb);case tG.FIELDS_SCHEMA:return e(sP);case tG.ACCESSOR_SCHEMA:return e(sC);default:throw Error(`Unknown schema name: ${t}`)}}sE=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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#ae272d"],"fields":["OSC"]}]}},{"id":"OSCIVOL","meta":{"title":"Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#9326ff"],"fields":["VOSC"]}]}},{"id":"MAENV","meta":{"title":"Moving Average Envelope","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Width","value":2}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":9},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#bc41ce"],"fields":["WMA"]}]}},{"id":"MAHLC","meta":{"title":"Moving Average High/Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":8}],"curves":[{"colors":["#00b04b"],"fields":["MAHI"]},{"colors":["#ef4226"],"fields":["MALO"]}]}},{"id":"MACD","meta":{"title":"MACD Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MACDEXP","meta":{"title":"MACD Oscillator Exponential","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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":0,"name":"Zero","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},{"name":"Period2","value":26},{"name":"Period3","value":9},{"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},"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}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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}},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":9},{"name":"Period2","value":45},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14},{"name":"Range","value":20},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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},{"name":"Period2","value":10}],"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},"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}],"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},{"name":"Period2","value":3},{"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},{"name":"Period2","value":3},{"name":"Period3","value":3},{"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Width","value":2},{"name":"Offset","value":0},{"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":"Modified Bollinger Bands","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"MultInside","value":3},{"name":"MultOutside","value":4},{"name":"Offset","value":0},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#f18900"],"fields":["BOLLBW"]}]}},{"id":"BPERC","meta":{"title":"Bollinger Bands %B","decimals":4,"overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#138484"],"fields":["BOLLBP"]}],"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}],"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},{"name":"Smoothing","value":"SMA"},{"name":"Period2","value":20}],"curves":[{"colors":["#ffaf1c"],"fields":["ATR"]},{"colors":["#1c6cff"],"fields":["ATRMA"]}]}},{"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},{"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"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"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},{"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},{"name":"DiLength","value":14}],"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},{"name":"DiLength","value":14}],"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}],"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},{"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},{"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}],"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}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#2284dd"],"fields":["ROC"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"TRIX","meta":{"title":"Triple Exponential","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":15}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":15},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["DEMA"]}]}},{"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"]}]},"defaults":{"inputs":[{"name":"Period","value":15},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["TEMA"]}]}},{"id":"TSI","meta":{"title":"True Strength Index","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":25},{"name":"Period2","value":13},{"name":"Period3","value":7}],"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}],"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}],"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},{"name":"PeriodLower","value":14},{"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},{"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},{"name":"Period2","value":8},{"name":"Period3","value":5}],"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},{"name":"Period2","value":34},{"name":"Period3","value":10}],"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}],"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},{"name":"Period2","value":10}],"curves":[{"colors":["#808080"],"fields":["CHAVOL"]}]}},{"id":"DPO","meta":{"title":"Detrended Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20}],"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}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#674ea7"],"fields":["HMA"],"style":"Line"}]}},{"id":"COPP","meta":{"title":"Coppock Curve","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodWma","value":10},{"name":"PeriodRocLong","value":14},{"name":"PeriodRocShort","value":11}],"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}],"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}],"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}],"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}],"curves":[{"colors":["#ae272d"],"fields":["ERBRPOW"],"style":"Column"}]}},{"id":"FI","meta":{"title":"Force Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":13}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Movement","value":20}],"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}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#0c32ff"],"fields":["MSD"]}]}},{"id":"PCTCHG","meta":{"title":"Percent Change","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#037d27"],"fields":["PCTCHG"]}]}},{"id":"NVI","meta":{"title":"Negative Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#480048"],"fields":["NVI"]},{"colors":["#7f8000"],"fields":["NVIEMA"]}]}},{"id":"PVI","meta":{"title":"Positive Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#00b04b"],"fields":["PVI"]},{"colors":["#005716"],"fields":["PVIEMA"]}]}},{"id":"PPO","meta":{"title":"Percentage Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#7f8000"],"fields":["HV"]}]}},{"id":"PERF","meta":{"title":"Price Performance","overlay":false,"decimals":2,"enumerations":[{"input":"Anchor","values":["SeriesStart","VisibleStart"]}]},"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},{"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":"REATRHI","meta":{"title":"Retracement ATR High","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"High"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#25329b"],"fields":["REATRHI"],"style":"Dots"}]}},{"id":"REATRLO","meta":{"title":"Retracement ATR Low","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#b25900"],"fields":["REATRLO"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Offset","value":0}],"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":"COTLC","meta":{"title":"Commitment of Traders (COT) Chart","overlay":false,"decimals":0},"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},"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},"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},"defaults":{"curves":[{"colors":["#ffc270"],"fields":["IMPVOL"]}]}},{"id":"CTM","meta":{"title":"CommodityTrends Cycle Trading Momentum","overlay":false},"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},"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},{"name":"Period2","value":5},{"name":"Period3","value":8},{"name":"Period4","value":10},{"name":"Period5","value":12},{"name":"Period6","value":15},{"name":"Period7","value":30},{"name":"Period8","value":35},{"name":"Period9","value":40},{"name":"Period10","value":45},{"name":"Period11","value":50},{"name":"Period12","value":60}],"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},{"name":"Period2","value":3}],"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},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":9}],"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":"Volatility Stop","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"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},{"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},{"name":"PeriodBaseLine","value":26},{"name":"PeriodLaggingSpan2","value":52},{"name":"Displacement","value":26}],"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}],"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},{"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":9},{"name":"Period2","value":18}],"curves":[{"colors":["#ae4ac7"],"fields":["MAS"]},{"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period","value":20}],"curves":[{"colors":["#ffb347"],"fields":["AVG"]}]}},{"id":"VOIN","meta":{"title":"Vortex Indicator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"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"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":200},{"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}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodRsi","value":14},{"name":"PeriodEma1","value":5},{"name":"PeriodEma2","value":3},{"name":"PeriodMa","value":9},{"name":"PeriodSig","value":9}],"curves":[{"colors":["#ef5350","#26a69a"],"fields":["DOSCH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]},{"colors":["#cc66ff"],"fields":["DOSCS"]}]}},{"id":"BSQUEEZE","meta":{"title":"Bollinger Bands Squeeze","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#3d8283"],"fields":["BOLLSQ"]}]}},{"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":20},{"name":"Increment","value":5},{"name":"Count","value":10},{"name":"Offset","value":0}],"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},{"name":"Smoothing2","value":"EMA"},{"name":"Period2","value":10}],"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},{"name":"WidthBollinger","value":2},{"name":"PeriodEmaKeltner","value":20},{"name":"MultiplierKeltner","value":1.5},{"name":"PeriodAtrKeltner","value":20},{"name":"PeriodMomentum","value":12}],"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},{"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},{"name":"SlowPeriod","value":17},{"name":"HandbrakePeriod","value":40},{"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}],"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},{"name":"Period2","value":20},{"name":"Period3","value":10}],"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}],"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","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},{"name":"LevelMode","value":"Count"},{"name":"LevelSize","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},{"name":"PeriodRoc2","value":15},{"name":"PeriodRoc3","value":20},{"name":"PeriodRoc4","value":30},{"name":"PeriodMa1","value":10},{"name":"PeriodMa2","value":10},{"name":"PeriodMa3","value":10},{"name":"PeriodMa4","value":15},{"name":"PeriodSig","value":9},{"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},{"name":"PeriodLong","value":50},{"name":"PeriodStoch1","value":10},{"name":"PeriodStoch2","value":3},{"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},{"name":"Period2","value":39},{"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},{"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},{"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},{"name":"Period1Mom","value":9},{"name":"Period2Rsi","value":3},{"name":"Period2Ma","value":3},{"name":"PeriodFastMa","value":13},{"name":"PeriodSlowMa","value":33}],"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"]}]},"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"},{"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":["1-Day","5-Day","1-Month","3-Month","6-Month","1-Year","YTD"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"1-Day"}],"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},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":21},{"name":"Period2","value":34}],"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},{"name":"PeriodTarget","value":30},{"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"]}]}}]');let sM=[],sL=!1,sx=!0;function sO(e){sM=sM.concat(n9(e,tG.STUDIES_SCHEMA))}let sI=new Map;function sD(){sL||(sO(e(sE)),sL=!0);let t=es[yQ()?.config.mode??"Unspecified"];if(!sx)return sM;if(!sI.has(t)){let e=eu(sk,t);sI.set(t,sM.filter(e))}return sI.get(t)}function sw(e){return eG(sN(e))}function sR(e){return i5(y0().display,e)}function sN(e){return sD().find(t=>t.id===e)}function sV(e){return void 0!==sN(e)}function sH(e){let t=[an.Open,an.High,an.Low,an.Close,an.Volume].map(e=>e.id);return e.defaults.source&&!t.includes(e.defaults.source)}function sF(e){return[es.DemoSite,es.cmdtyView].includes(e)}function sk(e,t){let i=t.id;if("PVACP"===i)return[es.cmdtyView,es.DemoSite].includes(e);let s=[es.GBE,es.cmdtyView];return!(["CPMI","CTPI","CTM","JPI","CTTP","CTTI"].includes(i)&&!s.includes(e))}let sB=null,sU=!1;function sW(){if(!sU){let e=[j.Study,j.BalanceSheet,j.IncomeStatement],t=e.reduce((e,t)=>(e[t]=[],e),{});Object.values(an).filter(t=>e.includes(t.category)).map(e=>{t[e.category].push({id:e.id,name:e.name,shortName:e.shortName})});let i=Object.keys(W).filter(e=>{let t=parseInt(e);if(Number.isFinite(t))return W[t]}),s=eG(sD()).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),r=Object.entries(sS()).map(([e,t])=>({id:e,options:t.editable,types:t.types,numPoints:t.numPoints}));sB={studies:s,incomeStatements:t[j.IncomeStatement],balanceSheets:t[j.BalanceSheet],studyFields:t[j.Study],curveStyles:i,annotations:r},sU=!0}return sB}var s$={};function sG(e,t,i){return[].concat((0,s$.apply)(t,e,i))}function sz(e,t,i){let s=eG(e),r=sG(s,t),n=r.map(i);if(n.some(e=>void 0===e))throw Error(`Forgot to return transformed value from accessor ${i}`);return function e(t,i,s){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||null===t)return t;if(Array.isArray(t))return t.map(t=>e(t,i,s)).filter(e=>e!==tG.NULL_OBJECT);{let r=i.indexOf(t);if(-1!==r)return s[r];let n={};for(let r in t){let a=t[r];n[r]=e(a,i,s)}return n}}(s,r,n)}s$=R("3DQaT");let sY=["1D","5D","1M","3M","6M","1Y","5Y","Max"];function sj(e){return 1===e.length}function sK(e){return 1===e.length}let sq={ATRLTR:"REATRHI",ATRSTR:"REATRLO",PeriodMARng:"PeriodAdjATR",PeriodAdjATR:"FactorAdjATR"},sX={BBANDS:{colors:["#89211e"],fields:["BOLLBM"],visible:!1},DONCHN:{colors:["#ff6a00"],fields:["DONMID"],visible:!1}},sZ={[tG.AT_SINGLE_STYLE]:!0,[tG.AT_SHOW_BACKGROUND]:!1,[tG.AT_BACKGROUND_OPACITY]:.2},sJ={[tG.AT_SHOW_PRICES]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_LEFT,[tG.AT_EXTEND_LEFT]:!1,[tG.AT_EXTEND_RIGHT]:!0,[tG.AT_REVERSE]:!1,...sZ},sQ={FibonacciFan:{[tG.AT_SHOW_LEVELS]:!1,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_REVERSE]:!1,...sZ},FibonacciArcs:{[tG.AT_SHOW_LEVELS]:!1,...sZ},FibonacciRetracement:{...sJ},TrendBasedFibExtension:{...sJ},FibonacciChannel:{[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_LEFT,...sZ},FibonacciTimeZones:{[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,...sZ},GannFan:{[tG.AT_SHOW_LEVELS]:!1,...sZ},GannBox:{...sZ,[tG.AT_SHOW_BACKGROUND]:!0},GannSquare:{...sZ,[tG.AT_SHOW_BACKGROUND]:!0}},s0=()=>({width:1,color:iQ(Math.floor(100*Math.random())),dashStyle:"Solid"}),s1=["FibonacciFan","FibonacciArcs","FibonacciChannel","FibonacciTimeZones","FibonacciRetracement","TrendBasedFibExtension"],s2=[...s1,"GannFan","GannBox","GannSquare"],s3=["Line","Ray","GannLine"],s4=["ComputedText","ProfitLoss","RewardRisk"];function s5(e){return s1.includes(e)?["factors"]:"GannFan"===e?["angles"]:"GannBox"===e?["priceLevels","timeLevels"]:"GannSquare"===e?["levels","fans","arcs"]:[]}function s6(e,t,i){let s=!eW(e,t)||!Array.isArray(e[t]),r=!s&&e[t].some(e=>!eH(e.value));if(s||r)return e[t]=i[t],!0}function s7(e,t){if(!eH(t))return;let i=s5(e),s=i5(null,e);for(let e of i)if(!s6(t,e,s))for(let i of t[e])Number.isFinite(i.value)&&(i.value=eF(i.value,6))}function s8(e,t,i=!1){let s="FibonacciFan"===e,r=eH(t);if(s2.includes(e)&&r){i&&eY(t,sQ[e]);let r=s5(e),n=i5(null,e);for(let e of r)if(!s6(t,e,n))for(let i of t[e]){let t=n[e].find(e=>e.value===i.value)||n[e].find(e=>e.value===Math.abs(i.value));eH(i.line)||(i.line=t?t.line:s0()),s&&0===i.value&&!eH(i.shown)&&(i.shown=!0)}"FibonacciChannel"===e&&t[tG.AT_SHOW_LABELS]?(t[tG.AT_SHOW_LEVELS]=t[tG.AT_SHOW_LABELS],delete t[(0,tG).AT_SHOW_LABELS]):"FibonacciArcs"!==e||t[tG.AT_SHOW_TRENDLINE]||(t[tG.AT_SHOW_TRENDLINE]=!0)}s3.includes(e)&&r&&!eH(t[tG.AT_MARKER])&&(t[tG.AT_MARKER]={...sy}),r&&(t[tG.AT_ALLOW_PRICES_CHANGE_UI]=!s4.includes(e))}let s9=[3,4,5,6,7,8,9,10,11],re=[12,13,14,15,16,17,18,19,20],rt=[{name:"Source",value:"Close"},{name:"Average",value:"MA"}];function ri(e){return function(t){return t.version=e,t}}let rs=ri(44),rr=ri(45),rn=ri(46),ra=ri(47),ro=ri(48),rl=ri(49),ru=ri(50),rh=ri(51),rc=ri(52),rd=ri(53),rp=ri(54),rf=ri(55),rm=ri(56),rg=ri(58),ry=ri(59),rT=ri(61),rA=ri(62),rS=ri(63),rv=ri(64),rb=ri(67),rP=ri(69),rC=ri(74),rE=ri(75),r_=ri(76),rM=ri(81),rL=ri(82),rx=ri(83),rO=ri(85),rI=ri(86),rD=ri(88),rw=ri(89),rR=ri(92),rN=ri(93),rV=ri(94),rH=ri(95),rF=ri(97),rk=ri(98),rB=ri(99),rU=ri(100),rW=ri(101),r$=ri(103),rG=ri(105),rz=ri(107),rY=ri(108),rj=ri(110),rK=ri(112),rq=ri(115),rX=ri(118),rZ=ri(119),rJ=ri(121),rQ=ri(122),r0=ri(123),r1=ri(124),r2=ri(126),r3=ri(127),r4=ri(129),r5=ri(130),r6=ri(132),r7=ri(133),r8=ri(134),r9=ri(135),ne=ri(136),nt=ri(138),ni=ri(139),ns=ri(141),nr=ri(143),nn=ri(146),na={_3to4:function(e){let t=e.data.period;if(null!==t){let i="Max"===t?tG.AUTOFIT_PERIOD:`P${t}`,s=sY.findIndex(e=>e===t),r={unit:"Day"};s<2?r={unit:"Intraday",size:15}:s>5&&(r={unit:"Month"}),delete e.data.period,e.display.period=i,e.data.aggregation=r,e.version=4}return e},_4to5:function(e){let t=sG(e,'..panes[0]..plots{.type === "Symbol"}[0].curves{.style === "Candlestick" && .attributes === "Hollow" }');if(1===t.length){let e=t[0];e.attributes.splice(e.attributes.indexOf("Hollow"),1),0===e.attributes.length&&delete e.attributes,e.style="HollowCandles",e.colors=eG(tG.COLOR_DEFAULT_VARY)}return e.version=5,e},_5to6:function(e){let t=sG(e,'..panes[0]..plots{.type === "Symbol"}[0]');return 1===t.length&&(t[0].main=!0),e.version=6,e},_6to7:function(e){let t=sG(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,i=iM(e.curves[t].colors[0]);i.a=.1,e.curves.push({colors:[iO(i)],fields:e.curves[0].fields.concat(e.curves[t].fields),lineWidth:0,style:"Ribbon"})}}),e.version=7,e},_7to8:function(e){let t=sG(e,'..plots{.type === "Study" && (.study === "ADX" || .study === "ADXMOD")}');return t.length>0&&t.forEach(e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===tG.INPUT_PERIOD){let t=e.inputs[0].value;e.inputs=[{name:"AdxSmoothing",value:t},{name:"DiLength",value:t}]}}),e.version=8,e},_8to9:function(e){let t=".display.yAxis",i=".minorGridLines",s=sG(e,t);if(sj(s)&&!sj(sG(s,i))){let e=sG(yQ().template,t+i);sj(e)&&(s[0].minorGridLines=e[0])}return e.version=9,e},_9to10:function(e){let t=".display.navigator",i=".enabled",s=sG(e,t);if(sK(s)&&!sK(sG(s,i))){let e=sG(yQ().template,t+i);sK(e)&&(s[0].enabled=e[0])}return e.version=10,e},_10to11:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "TCHN"}');return t.length>0&&t.forEach(e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===tG.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},_11to12:function(e){let t=sG(e,".display.navigator");if(1===t.length){let e=t[0];e.visible=e.enabled&&e.visible||!1,delete e.enabled}return e.version=12,e},_12to13:function(e){return sG(e,"..annotations").forEach(e=>{if("AndrewsPitchfork"===e.id){let[t,i,s]=e.points;e.points=[i,t,s]}}),e.version=13,e},_13to14:function(e){let t=sG(e,".display");if(1===t.length){let e=t[0];e.scrollbar.visible=e.navigator.visible||!1,delete e.navigator}return e.version=14,e},_14to15:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ATRLTR","ATRSTR"]}),i=e=>eW(sq,e)?sq[e]:e;return t.length>0&&t.forEach(e=>{e.curves&&e.curves[0].fields&&(e.curves[0].fields=e.curves[0].fields.map(i)),e.inputs&&(e.inputs=e.inputs.map(e=>(e.name=i(e.name),e))),e.study=i(e.study)}),e.version=15,e},_15to16:function(e){let t=sG(e,"..annotations"),i="FibonacciRetracement",s=e=>({shown:!1,value:e}),r=[-.618,-.236].map(s),n=[1.272,1.618,2.618].map(s);return t.forEach(e=>{if(e.id===i){let t=e.traits;if(eH(t)&&eH(t.factors)){let e=i5(null,i).factors,s=t.factors.map((t,i)=>{let s=!eH(t);return{shown:!s,value:s?e[i+2].value:t}});t.factors=r.concat(s).concat(n)}}}),e.version=16,e},_16to17:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHM","STOCHS"]});return t.length>0&&t.forEach(e=>{let t="STOCHM"===e.study,i=sw(t?"STOCHS":e.study);eH(e.inputs)?e.inputs.push({name:"Smoothing",value:t?"EMA":"MA"}):e.inputs=i.defaults.inputs.map(e=>("Smoothing"===e.name&&t&&(e.value="EMA"),e)),t&&(e.study="STOCHS")}),e.version=17,e},_17to18:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["BBANDS","DONCHN"]});return t.length>0&&t.forEach(e=>{if(eH(e.curves)&&e.curves?.length===3){let t=eG(sX[e.study]);e.curves.push(t)}}),e.version=18,e},_18to19:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["REATRHI","REATRLO"]});return t.length>0&&t.forEach(e=>{e.inputs&&4===e.inputs.length&&e.inputs.push({name:"FactorATR",value:2})}),e.version=19,e},_19to20:function(e){let t=sG(e,".display.yAxis");if(1===t.length){let e=t[0];eH(e.showLastValue)&&(e.showLastValue=e.showLastValue?"All":"None")}return e.version=20,e},_20to21:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CTMF","TPI"]});return t.length>0&&t.forEach(e=>{let t="CTMF"===e.study?"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},_21to22:function(e){let t=sG(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},_22to23:function(e){let t=e.display.yAxis;return delete t.minPadding,delete t.maxPadding,e.version=23,e},_23to24:function(e){let t=sG(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},_24to25:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "MOM"}');if(t.length>0){let e=sw("MOM");t.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&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},_25to26:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MA","MAEXP"]});return t.length>0&&t.forEach(e=>{e.source&&delete e.source,e.inputs&&1===e.inputs.length?e.inputs.push({name:"Source",value:"Close"}):e.inputs=sw(e.study).defaults.inputs}),e.version=26,e},_26to27:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "ATR"}');if(t.length>0){let e=sw("ATR");t.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&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},_27to28:function(e){let t=sG(e,'..plots{.type === "Study"}'),i=sw("ALLG");return t.length>0&&t.forEach(e=>{delete e.shift,"ALLG"===e.study&&e.curves&&e.curves.forEach(e=>{let t=(e=>{let t=i.defaults.curves.find(t=>t.fields[0]===e.fields[0]);if(eH(t))return t.shift})(e);eH(t)&&(e.shift=t)})}),e.version=28,e},_28to29:function(e){let t=ae(sz(e,'..plots{.type === "Study" && .study === "DEMARK"}',e=>tG.NULL_OBJECT));return t.version=29,t},_29to30:function(e){let t=ae(sz(e,'..plots{.type === "Study" && .study === "ULTOSC"}',e=>tG.NULL_OBJECT));return t.version=30,t},_30to31:function(e){let t=sG(e,"..annotations"),i="FibonacciRetracement";return t.forEach(e=>{if(e.id===i){let[t,s]=e.points;t.time>s.time&&(e.points=[s,t]);let r=e.traits;eH(r)&&(r.line2=i5(null,i).line2)}}),e.version=31,e},_31to32:function(e){return e.version=32,e},_32to33:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:sD().filter(e=>!0===e.meta.shiftable).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},_33to34:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "VWAP"}'),i=sw("VWAP");return t.length>0&&t.forEach(e=>{eH(e.inputs)||(e.inputs=i.defaults.inputs.slice()),e.curves?.length===1&&e.curves.push(...i.defaults.curves.slice(1))}),e.version=34,e},_34to35:function(e){let t="OBVOL",i=sG(e,`..plots{.type === "Study" && .study === "${t}"}`);if(i.length>0){let e=sw(t);i.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&t.curves.push(e.defaults.curves[1]),!t.inputs&&e.defaults.inputs&&(t.inputs=e.defaults.inputs)})}return e.version=35,e},_35to36:function(e){return sG(e,"..annotations").forEach(e=>{e.uid=e0()}),e.version=36,e},_36to37:function(e){return e.version=37,e},_37to38:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "CRS"}'),i=sw("CRS");return t.length>0&&t.forEach(e=>{e.inputs?.length===3&&e.inputs.push(i.defaults.inputs[3])}),e.version=38,e},_38to39:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "PERF"}'),i=sw("PERF");return t.length>0&&t.forEach(e=>{e.inputs?.length===0&&(e.inputs=i.defaults.inputs)}),e.version=39,e},_39to40:function(e){return e.version=40,e},_40to41:function(e){return e.version=41,e},_41to42:function(e){return e.version=42,e},_42to43:function(e){let t=sG(e,"..annotations"),i=["FibonacciTimeZones","FibonacciFan","FibonacciArcs"],s=sS();return t.forEach(e=>{let t=e.id;i.includes(t)?e.traits.factors=eG(s[t].defaults.factors):"GannFan"===t&&(e.traits.angles=eG(s[t].defaults.angles))}),e.version=43,e},_43to44:rs,_44to45:rr,_45to46:rn,_46to47:ra,_47to48:ro,_48to49:rl,_49to50:ru,_50to51:rh,_51to52:rc,_52to53:rd,_53to54:rp,_54to55:rf,_55to56:rm,_56to57:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["RSI","RSIMOD","RSISTO","STOCHF","STOCHS","GTPI"]});return t.length>0&&t.forEach(e=>{e.levels&&3===e.levels.length&&!e.levels[1].name&&(e.levels[1].name="Center")}),e.version=57,e},_57to58:rg,_58to59:ry,_59to60:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["VOL","MAVOL"]}),i=sw("MAVOL");return t.length>0&&t.forEach(e=>{if(!eH(e.curves))return;let t=+("VOL"!==e.study);eH(e.inputs)||(e.inputs=[]),1===t&&e.curves?.length===1&&e.curves.push(eG(i.defaults.curves[1])),e.inputs.push({name:"BarColoring",value:(e=>{if(!eH(e)||e.length<1)return"LikeMain";switch(e[0]){case"ChangeBased":return"CloseToClose";case"OpenVsClose":return"OpenToClose";default:return"LikeMain"}})(e.curves[t].attributes)}),delete e.curves[t].attributes}),e.version=60,e},_60to61:rT,_61to62:rA,_62to63:rS,_63to64:rv,_64to65:function(e){let t="DIFA",i=sG(e,`..plots{.type === "Study" && .study === "${t}"}`),s=sw(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===2&&e.inputs.push(s.defaults.inputs[2])}),e.version=65,e},_65to66:function(e){return sG(e,"..annotations").forEach(e=>{if("FibonacciTimeZones"===e.id){let t=e.points;if(1===t.length){let e=eG(t[0]);e.time+=1,t.push(e)}}}),e.version=66,e},_66to67:rb,_67to68:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "DPO"}'),i=sw("DPO");return t.length>0&&t.forEach(e=>{if(eH(e.curves)&&e.curves?.length===1&&!eH(e.levels)){let t=e.curves[0];if(t.colors?.length===1&&!eH(t.zones)){e.levels=i.defaults.levels,t.zones=i.defaults.curves[0].zones;let s=iP(t.colors[0],.3);t.colors=[s,s]}}}),e.version=68,e},_68to69:rP,_69to70:function(e){let t="RSISTO",i=sG(e,`..plots{.type === "Study" && .study === "${t}"}`),s=sw(t);return i.length>0&&i.forEach(e=>{e.curves?.length===1&&e.inputs?.length===2&&(e.curves.push(s.defaults.curves[1]),e.inputs.push(...s.defaults.inputs.slice(2)))}),e.version=70,e},_70to71:function(e){return sG(e,"..annotations").forEach(e=>s8(e.id,e.traits,!0)),e.version=71,e},_71to72:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["GTPI","GPMI","CBMI"]}),i=sw("JPI");return t.length>0&&t.forEach(e=>{let t=(t,i)=>{e.study=t,e.curves?.length&&e.curves.forEach(e=>{for(let t of i){let[i,s]=t;e.fields?.length===1&&e.fields[0]===i&&(e.fields[0]=s)}})};"GTPI"===e.study?t("CTPI",[["GTPI","CTPI"]]):"GPMI"===e.study?t("CPMI",[["GPMI","CPMI"]]):"CBMI"===e.study&&(t("JPI",[["CBMB","JPIB"],["CBMS","JPIS"]]),e.inputs?.length===3&&(e.inputs=e.inputs.map(e=>"FastNumber"===e.name?{name:"FastPeriod",value:s9[Number(e.value)-1]}:"SlowNumber"===e.name?{name:"SlowPeriod",value:re[Number(e.value)-1]}:e),e.inputs.splice(2,0,i.defaults.inputs[2])))}),e.version=72,e},_72to73:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["JPI"]}),i=sw("JPI").defaults.inputs.find(e=>"HandbrakePeriod"===e.name);return t.length>0&&t.forEach(e=>{e.inputs?.length===4&&e.inputs.push(i)}),e.version=73,e},_73to74:rC,_74to75:rE,_75to76:r_,_76to77:function(e){let t="COPP",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[`${t}`]}),s=sw(t);return i.length>0&&i.forEach(e=>{eH(e.inputs)&&(e.curves=s.defaults.curves,e.levels=s.defaults.levels)}),e.version=77,e},_77to78:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MFI"]}),i=sw("MFI");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels,e.bands=i.defaults.bands)}),e.version=78,e},_78to79:function(e){let t="RSIMOD",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["RSI",t]}),s=sw("RSI"),r=sw(t);return i.length>0&&i.forEach(e=>{if(eH(e.inputs)){let t="RSI"===e.study?s.defaults:r.defaults;e.inputs.push(...t.inputs.slice(1)),e.curves.push(...t.curves.slice(1))}}),e.version=79,e},_79to80:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CCI"]}),i=sw("CCI");return t.length>0&&t.forEach(e=>{if(eV(e.inputs)){let t=e.curves[0].colors[0],s=iP(t,.3);e.curves=i.defaults.curves;let r=e.curves[0].colors;r[0]=r[3]=s,r[2]=t,eV(e.levels)?e.levels.splice(1,0,i.defaults.levels[1]):e.levels=i.defaults.levels,eV(e.bands)||(e.bands=i.defaults.bands)}}),e.version=80,e},_80to81:rM,_81to82:rL,_82to83:rx,_83to84:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP"]}),i=sw("MACD");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=84,e},_84to85:rO,_85to86:rI,_86to87:function(e){let t="BBANDS",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===3&&e.inputs.push(s.defaults.inputs[3])}),e.version=87,e},_87to88:rD,_88to89:rw,_89to90:function(e){let t=sG(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},_90to91:function(e){let t="MCCLO",i=sG(e,`..plots{.type === "Study" && .study === "${t}" }`),s=sw(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===3&&e.inputs.push(s.defaults.inputs[3])}),e.version=91,e},_91to92:rR,_92to93:rN,_93to94:rV,_94to95:rH,_95to96:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PMO"]}),i=sw("PMO");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=96,e},_96to97:rF,_97to98:rk,_98to99:rB,_99to100:rU,_100to101:rW,_101to102:function(e){return sG(e,"..annotations").forEach(e=>{if("ComputedText"===e.id){e.points.splice(2);let[t,i]=["ProfitLoss","RewardRisk"];e.traits.kind===t?e.id=t:e.traits.kind===i&&(e.id=i),e.traits[tG.AT_SHOW_PRICES]=e.traits[tG.AT_DRAW_LINES]??!0,delete e.traits[(0,tG).AT_DRAW_LINES],e.traits[tG.AT_POSITION]=e.traits.pos??"Long",delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[tG.AT_ALLOW_PRICES_CHANGE_UI]=!1}}),e.version=102,e},_102to103:r$,_103to104:function(e){let t="UseAllFields";return sG(e,`..curves{.attributes === "${t}"}`).forEach(e=>{let i=e.attributes.indexOf(t);e.attributes.splice(i,1),"Column"===e.style&&(e.style="MultiColumn",e.varyColorPerBar=!1)}),e.version=104,e},_104to105:rG,_105to106:function(e){let t=sG(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(eV(t)){let e=e=>t.findIndex(t=>t.name===e),i=(i,s,r)=>{if(e(i)>=0)return;let n={name:i,value:s};r<0?t.push(n):t.splice(r,0,n)};i("Source","Close",e("Offset")),i("Offset",0,-1)}}),e.version=106,e},_106to107:rz,_107to108:rY,_108to109:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MASIG","MACDSIG"]});return t.length>0&&t.forEach(e=>{let t="MASIG"===e.study;e.study=t?"PACROSS":"MACROSS";let i=e.inputs;eV(i)&&i.splice(0,0,...rt);let s=e.curves;eV(s)&&t&&(s[0].fields[0]="AVG")}),e.version=109,e},_109to110:rj,_110to111:function(e){return sG(e,"..annotations").forEach(e=>{("LongPosition"===e.id||"ShortPosition"===e.id)&&(e.traits[tG.AT_ALLOW_PRICES_CHANGE_UI]=!0)}),e.version=111,e},_111to112:rK,_112to113:function(e){let t="CHEXI",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t).defaults;return i.length>0&&i.forEach(e=>{eV(e.inputs)&&e.inputs.length===s.inputs?.length&&e.inputs.forEach((e,t)=>{let i=Number(e.value);e.value=Number.isInteger(i)?i:s.inputs[t].value})}),e.version=113,e},_113to114:function(e){let t=sG(e,"..plots{.detachedScale}");return t.length>0&&t.forEach(e=>{e.detachedScale=!0}),e.version=114,e},_114to115:rq,_115to116:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHS"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;eV(e.inputs)&&eV(e.curves)&&(e.curves[0]=t.curves[0],"STOCHF"===e.study&&"#00b04b"===e.curves[1].colors[0]&&(e.curves[1].colors[0]=t.curves[1].colors[0]))}),e.version=116,e},_116to117:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHAMF"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;eV(e.inputs)&&eV(e.curves)&&(e.curves[0]=t.curves[0])}),e.version=117,e},_117to118:rX,_118to119:rZ,_119to120:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHDMOMOSC","TSI","DIFA"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;if(eV(e.inputs)&&eV(e.curves))switch(e.study){case"CHDMOMOSC":case"TSI":{let i=e.levels?.[0];e.levels=t.levels,eV(i)&&(e.levels[1]=i);break}case"DIFA":{let[i,s]=e.curves[0].colors;e.curves=t.curves,e.curves[0].colors=[i,ib(i),s,ib(s)]}}}),e.version=120,e},_120to121:rJ,_121to122:rQ,_122to123:r0,_123to124:r1,_124to125:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP","PPO"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;if(eV(e.inputs)&&eV(e.curves))switch(e.study){case"MACD":case"MACDEXP":{let i=e.curves[2],s=i.colors;if(delete i.zones,2===s.length){let e=s.map(e=>iP(e,.3));i.colors=[e[0],s[0],e[1],s[1]]}else i.colors=t.curves[2].colors;i.varyColorPerBar=!0;break}case"PPO":e.curves[2]=t.curves[2]}}),e.version=125,e},_125to126:r2,_126to127:r3,_127to128:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CRS"]}),i=sw("CRS");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=128,e},_128to129:r4,_129to130:r5,_130to131:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PC"]}),i=sw("PC");return t.length>0&&t.forEach(e=>{if(eV(e.inputs)&&6===e.inputs.length){let t=e.inputs[0].value;e.inputs[0].name=i.defaults.inputs[0].name,e.inputs[0].value=`HV ${t}`,e.inputs.splice(1,0,i.defaults.inputs[1])}}),e.version=131,e},_131to132:r6,_132to133:r7,_133to134:r8,_134to135:r9,_135to136:ne,_136to137:function(e){let t="VOLAP",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{if(eV(e.inputs)&&5===e.inputs.length){let t=e.inputs.find(e=>"Bars"===e.name);eV(t)&&(t.name="LevelSize"),e.inputs=[{name:"LevelMode",value:"Count"},...e.inputs,{name:"ValueRangePercent",value:70}]}if(eV(e.curves)&&1===e.curves.length){let t=e.curves[0].colors.pop();e.curves.push(...s.defaults.curves.slice(1)),e.curves[1].colors=[t],e.curves[2].colors=e.curves[0].colors.map(e=>iP(e,.6))}}),e.version=137,e},_137to138:nt,_138to139:ni,_139to140:function(e){let t="ADXMOD",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ADX",t]}),s=sw("ADX"),r=sw(t);return i.length>0&&i.forEach(e=>{if(eH(e.inputs)){let t="ADX"===e.study?s.defaults:r.defaults;e.levels=[...t.levels]}}),e.version=140,e},_140to141:ns,_141to142:function(e){let t="CHDMOMOSC",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{if(eH(e.inputs)){let t=s.defaults;e.inputs.push(...t.inputs.slice(1,3)),e.curves.push(...t.curves.slice(1,2))}}),e.version=142,e},_142to143:nr,_143to144:function(e){let t="MACDV",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{if(eV(e.inputs)){let t=s.defaults,i=e.levels[0];e.levels=[...t.levels],e.levels[2]=i}}),e.version=144,e},_144to145:function(e){let t="KELCHN",i="KELEXP",s="KELBND",r=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i,s]}),n=sw(t),a=sw(s);return r.length>0&&r.forEach(e=>{if(eV(e.inputs))switch(e.study){case t:e.inputs.push(n.defaults.inputs[1]);break;case i:e.study=t,e.inputs.push(a.defaults.inputs[2]);for(let t=0;t<4;t++)e.curves[t].fields=n.defaults.curves[t].fields;break;case s:e.inputs.push(a.defaults.inputs[2])}}),e.version=145,e},_145to146:nn,_146to147:ri(147),_147to148:ri(148)};function no(e,t){te(2,arguments);var i=to(e),s=to(t);return i.getTime()===s.getTime()}function nl(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function nu(e){te(1,arguments);var t=ti(e),i=t.getMonth();return t.setMonth(i-i%3,1),t.setHours(0,0,0,0),t}function nh(e,t){te(2,arguments);var i=nu(e),s=nu(t);return i.getTime()===s.getTime()}var nc={};function nd(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.weekStartsOn)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.weekStartsOn)?r:nc.weekStartsOn)?s:null==(l=nc.locale)||null==(u=l.options)?void 0:u.weekStartsOn)?i:0);if(!(h>=0&&h<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=ti(e),d=c.getDay();return c.setDate(c.getDate()-(7*(d<h)+d-h)),c.setHours(0,0,0,0),c}function np(e,t,i){te(2,arguments);var s=nd(e,i),r=nd(t,i);return s.getTime()===r.getTime()}function nf(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getFullYear()===s.getFullYear()}function nm(e){return{unit:e$(e,"Day","unit"),size:e$(e,1,"size"),spec:e$(e,"None","spec"),isContractVolume:e$(e,!1,"isContractVolume"),dividendsAdjust:e$(e,!1,"dividendsAdjust"),backAdjust:e$(e,!1,"backAdjust"),daysToExpiration:e$(e,1,"daysToExpiration"),contractRoll:e$(e,"combined","contractRoll")}}function ng(e){let t=nm(e);return new nb($[t.unit],t.size,G[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function ny(e,t){return no(e,t)&&nA(e,t)}function nT(e,t){return np(e,t)&&nA(e,t)}function nA(e,t){return nl(e,t)&&nf(e,t)}function nS(e,t){return nh(e,t)&&nf(e,t)}function nv(e,t){return+e==+t}class nb{unit;size;spec;isContractVolume;dividendsAdjust;backAdjust;daysToExpiration;contractRoll;constructor(e=$.Day,t=1,i=G.None,s=!1,r=!1,n=!1,a=1,o="combined"){this.unit=e,this.size=t,this.spec=i,this.isContractVolume=s,this.dividendsAdjust=r,this.backAdjust=n,this.daysToExpiration=a,this.contractRoll=o}duplicate(){return new nb(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===$.Tick){let e="T",t=!0;switch(this.spec){case G.PerCount:e="Tpb";break;case G.PerVolume:e="Vpb";break;case G.PerRange:e="Rpb";break;case G.PerSeconds:e="Spb";break;default:t=!1}return`${t?this.size:""}${e}`}if(this.unit===$.Intraday)return this.size%60==0?`${this.size/60}h`:`${this.size}`;{let e="";return this.spec===G.Nearest?e="n":this.spec===G.Continue&&(e="c"),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e="";switch(this.unit){case $.Tick:e="Tick";break;case $.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 $.Day:e="Daily";break;case $.Week:e="Weekly";break;case $.Month:e="Monthly";break;case $.Quarter:e="Quarterly";break;case $.Year:e="Yearly"}return e}describe(){let e=this.unitToString();switch(this.spec){case G.Nearest:e+=" Nearest";break;case G.Continue:e+=" Continue";break;case G.PerCount:e="Ticks Per Bar";break;case G.PerVolume:e="Volume Per Bar";break;case G.PerRange:e="Range Per Bar";break;case G.PerSeconds:e="Seconds Per Bar";case G.None:}return e}get hasSpec(){return this.spec!==G.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===$.Tick}get isIntraday(){return this.unit===$.Intraday}get isMultiContract(){let e=this.spec===G.Nearest,t=this.spec===G.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}}function nP(e){delete e.display.chart.bar}function nC(e){eH(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,eH(e.data.range)&&delete e.data.range,delete e.data.checkRange}function nE(e){n6(e.display.period)&&delete e.display.period}function n_(e){eH(e.display.density)&&delete e.display.density}function nM(e){switch(W[e]){case W.Candlestick:case W.HollowCandles:case W.HeikinAshi:case W.ElderImpulseSystem:case W.Column:case W.Renko:case W.Range:case W.Kagi:case W.PointAndFigure:case W.LineBreak:case W.HLC:return!0;default:return!1}}function nL(e,t){let i=yQ().getDefaultMultiFieldCurve();if(null!==i&&i.style===e)return i;let s=e=>e.id,r=[an.Open,an.High,an.Low,an.Close,an.Change].map(s);W[e]===W.HLC&&r.splice(0,1);let n=[an.Close].map(s),a=eG(tG.COLOR_DEFAULT_AREA),o=eG(tG.COLOR_DEFAULT_OHLC),l=eG(tG.COLOR_DEFAULT_VARY),u={fields:r,colors:l,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch(W[e]){case W.OHLC:case W.HLC:case W.Renko:case W.LineBreak:case W.Range:case W.Kagi:case W.PointAndFigure:u.colors=t?l:[o];break;case W.Candlestick:case W.HollowCandles:case W.HeikinAshi:case W.MultiColumn:break;case W.ElderImpulseSystem:u.colors=l.concat(a);break;case W.Line:case W.PercentChange:u.fields=n,u.colors=[o];break;case W.Area:u.fields=n,u.colors=[iP(a,.5),a];break;case W.Baseline:u.fields=n,u.colors=l.map(e=>iP(e,.5)),u.zones=[{value:0,colors:1},{colors:1}];break;case W.Column:u.fields=n;break;default:throw Error(`Curve style "${e}" is not supported here.`)}return u}let nx=["Renko","Kagi","PointAndFigure","LineBreak","Baseline"];function nO(e,t){let i=t.curves[0],s=nY(e);return s.curves=[function(e,t){var i;Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||nM(e.style)||void 0!==(i=e.attributes)&&i.length>0&&i.some(e=>e===U[U.ChangeBased]||e===U[U.OpenVsClose]));let s=function(e,t){switch(e){case X.Symbol:case X.Expression:{let e=t.style||"Candlestick",i=t.varyColorPerBar||nM(e);return nL(e,i)}case X.Forward:case X.Seasonal:return{fields:["Close","Change"],style:"Line",lineWidth:2,visible:!0,colors:["#888"],varyColorPerBar:!1};default:throw Error(`Unexpected plot type '${X[e]}', don't know its default curve.`)}}(X[t],e);return ez(s,e,!1),s}(i,t.type)],t.isMultiCurveMain&&t.curves.length>1&&s.curves.push(...t.curves.slice(1)),"Symbol"===t.type&&eH(i)&&nx.includes(i.style)&&(eH(t.inputs)?s.inputs=t.inputs:delete s.inputs),e}function nI(e,t,i){return(i=i||" ",e.length>t)?e:(t-=e.length,e+(i+=i.repeat(t)).slice(0,t))}class nD extends Error{static buildMessage(e,t){function i(e){return e.charCodeAt(0).toString(16).toUpperCase()}function s(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"+i(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+i(e))}function r(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"+i(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+i(e))}function n(e){switch(e.type){case"literal":return'"'+s(e.text)+'"';case"class":let t=e.parts.map(e=>Array.isArray(e)?r(e[0])+"-"+r(e[1]):r(e));return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}return"Expected "+function(e){let t,i,s=e.map(n);if(s.sort(),s.length>0){for(t=1,i=1;t<s.length;t++)s[t-1]!==s[t]&&(s[i]=s[t],i++);s.length=i}switch(s.length){case 1:return s[0];case 2:return s[0]+" or "+s[1];default:return s.slice(0,-1).join(", ")+", or "+s[s.length-1]}}(e)+" but "+(t?'"'+s(t)+'"':"end of input")+" found."}message;expected;found;location;name;constructor(e,t,i,s){super(),this.message=e,this.expected=t,this.found=i,this.location=s,this.name="SyntaxError","function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(this,nD.prototype):this.__proto__=nD.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,nD)}format(e){let t="Error: "+this.message;if(this.location){let i,s=null;for(i=0;i<e.length;i++)if(e[i].source===this.location.source){s=e[i].text.split(/\r\n|\n|\r/g);break}let r=this.location.start,n=this.location.source+":"+r.line+":"+r.column;if(s){let e=this.location.end,i=nI("",r.line.toString().length," "),a=s[r.line-1],o=r.line===e.line?e.column:a.length+1;t+="\n --\x3e "+n+"\n"+i+" |\n"+r.line+" | "+a+"\n"+i+" | "+nI("",r.column-1," ")+nI("",o-r.column,"^")}else t+="\n at "+n}return t}}let nw=function(e,t){var i,s,r;let n,a={},o=(t=void 0!==t?t:{}).grammarSource,l={expr:k},u=k,h=R("+",!1),c=R("-",!1),d=function(e,t){var i,s;return i=t,s=e,i.reduce(function(e,t){var i=t.filter(e=>"ws"!==e.op);return{op:i[0],left:e,right:i[1]}},s)},p=R("*",!1),f=R("/",!1),m=R("^",!1),g=R("(",!1),y=R(")",!1),T=/^[0-9]/,A=N([["0","9"]],!1,!1),S=R(".",!1),v=R("{",!1),b=/^[A-Za-z0-9\^*$-.|:_]/,P=N([["A","Z"],["a","z"],["0","9"],"^","*",["$","."],"|",":","_"],!1,!1),C=R("}",!1),E=/^[A-Za-z]/,_=N([["A","Z"],["a","z"]],!1,!1),M=/^[ \t\r\n]/,L=N([" "," ","\r","\n"],!1,!1),x=0,O=0,I=[{line:1,column:1}],D=0,w=[];if(void 0!==t.startRule){if(!(t.startRule in l))throw Error("Can't start parsing from rule \""+t.startRule+'".');u=l[t.startRule]}function R(e,t){return{type:"literal",text:e,ignoreCase:t}}function N(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function V(t){let i,s=I[t];if(s)return s;for(i=t-1;!I[i];)i--;for(s={line:(s=I[i]).line,column:s.column};i<t;)10===e.charCodeAt(i)?(s.line++,s.column=1):s.column++,i++;return I[t]=s,s}function H(e,t){let i=V(e),s=V(t);return{source:o,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:s.line,column:s.column}}}function F(e){x<D||(x>D&&(D=x,w=[]),w.push(e))}function k(){return B()}function B(){let t,i,s,r,n,o,l;if(t=x,(i=U())!==a){if(s=[],r=x,(n=z())!==a?(43===e.charCodeAt(x)?(o="+",x++):(o=a,F(h)),o===a&&(45===e.charCodeAt(x)?(o="-",x++):(o=a,F(c))),o!==a&&(l=U())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a),r!==a)for(;r!==a;)s.push(r),r=x,(n=z())!==a?(43===e.charCodeAt(x)?(o="+",x++):(o=a,F(h)),o===a&&(45===e.charCodeAt(x)?(o="-",x++):(o=a,F(c))),o!==a&&(l=U())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a);else s=a;s!==a?(O=t,t=i=d(i,s)):(x=t,t=a)}else x=t,t=a;return t===a&&(t=U()),t}function U(){let t,i,s,r,n,o,l;if(t=x,(i=G())!==a){if(s=[],r=x,(n=z())!==a?(42===e.charCodeAt(x)?(o="*",x++):(o=a,F(p)),o===a&&(47===e.charCodeAt(x)?(o="/",x++):(o=a,F(f))),o!==a&&(l=G())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a),r!==a)for(;r!==a;)s.push(r),r=x,(n=z())!==a?(42===e.charCodeAt(x)?(o="*",x++):(o=a,F(p)),o===a&&(47===e.charCodeAt(x)?(o="/",x++):(o=a,F(f))),o!==a&&(l=G())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a);else s=a;s!==a?(O=t,t=i=d(i,s)):(x=t,t=a)}else x=t,t=a;return t===a&&(t=G()),t}function W(){let t,i,s,r;return(t=x,(i=$())!==a&&z()!==a&&(94===e.charCodeAt(x)?(s="^",x++):(s=a,F(m)),s!==a&&z()!==a&&(r=$())!==a))?(O=t,t=i={op:"^",left:i,right:r}):(x=t,t=a),t===a&&(t=$()),t}function $(){let t,i,s,r;return(t=function(){let t,i,s,r,n,o,l,u;if(t=x,(i=z())!==a){if(s=x,r=[],T.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(A)),n!==a)for(;n!==a;)r.push(n),T.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(A));else r=a;if(r!==a){if(n=x,46===e.charCodeAt(x)?(o=".",x++):(o=a,F(S)),o===a&&(o=null),o!==a){for(l=[],T.test(e.charAt(x))?(u=e.charAt(x),x++):(u=a,F(A));u!==a;)l.push(u),T.test(e.charAt(x))?(u=e.charAt(x),x++):(u=a,F(A));l!==a?n=o=[o,l]:(x=n,n=a)}else x=n,n=a;n===a&&(n=null),n!==a?s=r=[r,n]:(x=s,s=a)}else x=s,s=a;s!==a?(O=t,t=i={op:"num",left:parseFloat(e.substring(O,x))}):(x=t,t=a)}else x=t,t=a;return t}())===a&&(t=function(){let t,i,s,r,n,o,l,u,h;if(t=x,(i=z())!==a)if(123===e.charCodeAt(x)?(s="{",x++):(s=a,F(v)),s!==a){if(r=[],b.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(P)),n!==a)for(;n!==a;)r.push(n),b.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(P));else r=a;if(r!==a)if(125===e.charCodeAt(x)?(n="}",x++):(n=a,F(C)),n!==a){if(o=x,46===e.charCodeAt(x)?(l=".",x++):(l=a,F(S)),l!==a){if(u=[],E.test(e.charAt(x))?(h=e.charAt(x),x++):(h=a,F(_)),h!==a)for(;h!==a;)u.push(h),E.test(e.charAt(x))?(h=e.charAt(x),x++):(h=a,F(_));else u=a;u!==a?o=l=[l,u]:(x=o,o=a)}else x=o,o=a;if(o===a&&(o=null),o!==a){var c,d;O=t,c=r,d=o,t=i={op:"sym",left:c.join(""),right:null==d?null:d[1].join("")}}else x=t,t=a}else x=t,t=a;else x=t,t=a}else x=t,t=a;else x=t,t=a;return t}())===a&&((t=x,z()!==a&&(40===e.charCodeAt(x)?(i="(",x++):(i=a,F(g)),i!==a&&z()!==a&&(s=B())!==a&&z()!==a&&(41===e.charCodeAt(x)?(r=")",x++):(r=a,F(y)),r!==a)))?(O=t,t={op:"grp",left:s}):(x=t,t=a)),t}function G(){let t,i,s;return(t=x,z()!==a&&(45===e.charCodeAt(x)?(i="-",x++):(i=a,F(c)),i!==a&&z()!==a&&(s=W())!==a))?(O=t,t={op:i,left:s}):(x=t,t=a),t===a&&(t=W()),t}function z(){let t,i,s;for(t=x,i=[],M.test(e.charAt(x))?(s=e.charAt(x),x++):(s=a,F(L));s!==a;)i.push(s),M.test(e.charAt(x))?(s=e.charAt(x),x++):(s=a,F(L));return i!==a&&(O=t,i={op:"ws"}),t=i}if((n=u())!==a&&x===e.length)return n;throw n!==a&&x<e.length&&F({type:"end"}),i=w,s=D<e.length?e.charAt(D):null,r=D<e.length?H(D,D+1):H(D,D),new nD(nD.buildMessage(i,s),i,s,r)},nR=new Map,nN=/\w[:]\w/;function nV(e){return"error"in e}function nH(e,t=!1,i=!0){let s=e.trim();if(t&&nR.has(s))return eG(nR.get(s));try{var r;let n=nw(s);n$(n,e=>e.toUpperCase(),!0,!0);let a=nU(n);i&&(r=a,r.some(e=>e.includes(":"))&&(nk(n,(e,t,i)=>{let s=(e,t=null,i="sym")=>({op:i,left:e,right:t});if("sym"!==e.op||!nN.test(t))return null;let r=t.split(":");return e.op="grp",e.left=s(s(r[0]),s(r[1]),"-"),null}),1))&&(a=nU(n));let o=nB(n),l={text:e,model:n,clean:o,symbols:a};return t&&nR.set(s,l),l}catch(i){let t=i.location.start;return{text:e,error:`${i.message}
2
- Location: line ${t.line}, column ${t.column}.`}}}function nF(e,t){var i;return nk(e,(i=t,(e,t,s)=>{if(function(e){return!eH(e.right)}(e)){if(null===t)return null;switch(e.op){case"-":return-t;case"grp":case"num":return t;case"sym":return i(t);default:throw Error(`Unrecognized unary operator ${e.op}`)}}if(null===t||null===s)return null;switch(e.op){case"+":return t+s;case"-":return t-s;case"*":return t*s;case"/":return t/s;case"^":return Math.pow(t,s);case"sym":return i(t,s);default:throw Error(`Unrecognized binary operator ${e.op}`)}}))}function nk(e,t){if(!eH(e))return null;let i=typeof e;if("number"===i||"string"===i)return e;let s=nk(e.left,t),r=nk(e.right,t);return t(e,s,r)}function nB(e){return nk(e,nG)}function nU(e){let t=new Set;return nk(e,(e,i,s)=>("sym"===e.op&&t.add(i),null)),Array.from(t)}function nW(e){let t=0,i=["+","-","*","/","^"];return nk(e,(e,s,r)=>(i.includes(e.op)&&t++,null)),t>0}function n$(e,t,i=!1,s=!1){let r=i?e:eG(e);return nk(r,(e,i,r)=>("sym"===e.op&&(e.left=t(i),s&&e.right&&(e.right=t(e.right))),null)),r}function nG(e,t,i){if(eH(e.right))switch(e.op){case"+":case"-":case"*":case"/":case"^":return`${t} ${e.op} ${i}`;case"sym":return`{${t}}.${i}`;default:throw Error(`Unrecognized binary operator ${e.op}`)}switch(e.op){case"-":return`${e.op}${t}`;case"grp":return`(${t})`;case"sym":return`{${t}}`;case"num":return t.toString();default:throw Error(`Unrecognized unary operator ${e.op}`)}}let nz="..plots{.main === true}";function nY(e){return sG(e,nz)[0]}function nj(e){let t=sG(e,`..panes{${nz}}`)[0],i=sG(t,`..axes{${nz}}`)[0];return{mainPane:t,mainAxis:i}}let nK="Symbol",nq="Expression",nX="Forward",nZ="Seasonal",nJ=[nK,nq,nX,nZ];function nQ(e){let t=nH(e),i=nV(t),s=i?0:t.symbols.length,r=!i&&s>0?t.symbols[0]:null,n=i?void 0:t.clean,a=i?t.error:void 0;return{clean:n,hasErrors:i,symbolCount:s,firstSymbol:r,error:a}}function n0(e,t){let i=nY(e),s=e=>eH(t[e.toLowerCase()]),r=nJ.find(e=>s(e)),n=r.toLowerCase(),a=t[n],o=a===tG.PLACEHOLDER_SYMBOL_NAME,l=s(nq)||s(nX)||s(nZ),u=nJ.some(e=>s(e)&&i.type!==e),h=yQ().config.cachedAnnotationsCount||0,{mainAxis:c}=nj(e);u&&(c.comparison="None");let d=nQ(a),p=e=>{throw Error(e)};!o&&(l?(d.hasErrors&&p(`[Main Plot] "${a}" is an invalid expression.
3
- ${d.error}`),a=d.clean):d.hasErrors||p(`[Main Plot] "${a}" is an expression, unsupported for ${n}.`));let f=(e,t)=>e.findIndex(e=>e.symbol===t),m=(e,t)=>{if(e===tG.PLACEHOLDER_SYMBOL_NAME)return;let i=t.annotations||[],s=t.annCache||[],r=f(s,e);-1!==r&&s.splice(r,1),i.length>0&&(s.length+1>h&&s.splice(0,s.length+1-h),s.push({symbol:e,annotations:i})),t.annCache=s},g=(e,t)=>{let i=t.annCache||[],s=f(i,e);-1!==s&&(t.annotations=i[s].annotations)},y=e=>{if(i.type===nK)m(i.symbol,e);else if(i.type===nq)m(i.expression,e);else if(i.type===nZ){let t=nQ(i.seasonal);1===t.symbolCount&&m(t.firstSymbol,e)}delete e.annotations,s(nK)?g(t.symbol,e):s(nq)?g(t.expression,e):s(nZ)&&1===d.symbolCount&&g(t.seasonal,e)};if(h>0)for(let t of sG(e,"..axes"))y(t);let T=s(nq)&&i.type===nK||s(nK)&&i.type===nq,A=sz(e,nz,e=>(u&&(delete e.expression,delete e.symbol,delete e.showPrevious,delete e.forward,delete e.offsets,delete e.seasonal,e.type=r,T||(e.curves=[{}]),(s(nX)||s(nZ))&&(e.offsets=[0])),e[n]=a,e));if(u)if(s(nX))A.data.aggregation={unit:"Month"},A.display.period="P10Y";else if(s(nZ)&&!A.data.aggregation.isEndOfDay)A.data.aggregation={unit:"Day"},A.display.period=s(nZ)?"P9M":"P1Y10D";else if(i.type===nX||i.type===nZ){A.data.aggregation=yQ().getDefaultAggregation(),A.data.maxDataPoints=tG.DEFAULT_MAX_RECORDS;let e=yQ().getDefaultPeriod();eH(e)&&(A.display.period=e)}else s(nq)&&i.type===nK&&(nx.includes(i.curves[0].style)&&(A=sz(A,nz,e=>(delete e.inputs,e))),"PerRange"===A.data.aggregation.spec&&(A.data.aggregation={unit:"Day"}));for(let[e,t]of new Map([['..plots{.type === "Study"}',e=>{let t=sw(e.study);if(!eV(t))return tG.NULL_OBJECT;let i=sH(t);return s(nX)||s(nZ)||s(nq)&&i?tG.NULL_OBJECT:e}],['..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}',e=>s(nK)?(e.symbol=a,e):tG.NULL_OBJECT],["..plots{..events}",e=>(s(nK)||delete e.events,e)]]))A=sz(A,e,t);return u&&!T&&(A=nO(A,{type:r,curves:[{}]})),A=ae(A)}function n1(e){let t=yQ().getDefaultDensity();eH(t)&&(e.display.density=t)}function n2(e,t){return sz(e,'..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}',e=>(e.fields=t?[an.TradeSize.id]:[an.Volume.id],e))}function n3(e,t){let i=ng(e.data.aggregation),s=i.isTick&&!i.hasSpec,r=ng(t),n=r.isTick&&!r.hasSpec,a=e=>e.isIntraday&&e.hasSpec&&e.spec===G.PerRange,o=a(i),l=a(r),u=sz(e,`${nz}.curves[0]`,e=>{let t=[an.Open.id,an.High.id,an.Low.id,an.Close.id,an.Change.id].slice();if(!o&&l)return nL("Range",!0);if(o&&!l&&(e.style="OHLC"),!n&&s){let i=yQ().getDefaultMultiFieldCurve();if(null!==i)return i;e.fields=t,"Candlestick"!==e.style&&"OHLC"!==e.style&&"HLC"!==e.style&&(e.style="Candlestick",e.colors=["#ff6961","#77dd77"],e.varyColorPerBar=!0),"HLC"===e.style&&e.fields.splice(0,1)}else n&&!s&&(e.fields=[an.Last.id,an.Change.id],e.style="Line",e.colors=["#0055cc"],e.varyColorPerBar=!1);return e});return ez((u=u=n2(u,n)).data.aggregation,t,!1),(i.unit!==r.unit||i.size!==r.size)&&(nE(u),nC(u),n1(u),nP(u)),u}function n4(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getTime()<s.getTime()}function n5(e,t){return te(2,arguments),ts(e,-e9(t))}function n6(e){return eH(e)&&e!==tG.AUTOFIT_PERIOD}var n7={};n7=R("2nrEA");let n8=null;function n9(t,i){null===n8&&((n8=e(n7)()).defaultOptions.useDefault=!0,[tG.CHART_SCHEMA,tG.STUDIES_SCHEMA,tG.FIELDS_SCHEMA,tG.ACCESSOR_SCHEMA].forEach(e=>{n8.addSchema(e,s_(e))}));let s=function(e,t){if(t===tG.CHART_SCHEMA){let s=sG(s_(t),".properties.version.minimum")[0],r=e.version;if(r<s){var i=r;let t=e;try{for(sx=!1;i<s;)t=(0,na[`_${i}to${i+1}`])(t),i+=1}finally{sx=!0}return t}}return e}(t,i);i===tG.CHART_SCHEMA&&(sG(s,`..plots{.type==="${X[X.Study]}"}`).forEach(e=>{let t=sw(e.study);eH(t)&&eY(e,t.defaults)}),s=function(e){let t=sG(e,"..axes{.annotations{.points{!.price || !.time}}}");t.length>0&&t.forEach(e=>{let t=e.annotations.map(e=>{let t=e.points.find(e=>eH(e.price)),i=e.points.find(e=>eH(e.time));return eH(t)&&eH(i)?(e.points.forEach(e=>{eH(e.price)||(e.price=t.price),eH(e.time)||(e.time=i.time)}),e):null}).filter(e=>eH(e));t.length>0?e.annotations=t:delete e.annotations});let i=sG(e,"..panes"),s=e=>eH(e.height)?e.height:1,r=Math.min(...i.map(e=>s(e))),n=r<.01?5/r:1;i.forEach(e=>e.height=eF(n*s(e),4));let a=yQ().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=a;let o="wheel+shift",l=yQ().config.scrollBehavior||o;Object.values(en).filter(e=>"string"==typeof e).includes(l)||(l=o),e.display.scrollBehavior=l;let u=sG(e,'..plots{.type === "Study" && .study === "RSI"}');u.length>0&&u.forEach(e=>{if(eH(e.bands)&&e.bands.length>0){let t=e.inputs&&1===e.inputs.length&&e.inputs[0].name===tG.INPUT_PERIOD?e.inputs[0].value:null,i=sw("RSI").defaults;e.curves=i.curves,e.inputs=i.inputs,eH(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=i.levels}}),e.display?.density?(nE(e),nC(e)):n6(e.display?.period)&&nC(e);let h=e$(e.display,null,"chart","bar");if(eH(h)){let[e,t]=eQ(h.width||0,h.spacing||0,tG.MINIMUM_BAR_WIDTH,tG.MAXIMUM_BAR_WIDTH);h.width=e,h.spacing=t}e.display?.period&&"YTD"===e.display.period&&delete e.display.period;let c=sG(e,"..annotations{.traits.fill.color === null}");c.length>0&&c.forEach(e=>{e.traits.fill.color="rgba(0, 0, 0, 0)"});let{from:d,to:p}=e.display?.xAxis?.visibleRange||{},f=null===d,m=null===p;f&&delete e.display.xAxis.visibleRange.from,m&&delete e.display.xAxis.visibleRange.to,f&&m&&delete e.display.xAxis.visibleRange;let g=sG(e,"..panes[0].axes[0].scale");if(1===g.length){let t=g[0],i=sG(e,"..panes[0]..axes");i.length>0&&i.forEach(e=>e.scale=t)}let[y]=sG(e,nz);eH(y)&&y.type===X[X.Symbol]&&!nx.includes(y.curves[0].style)&&eH(y.inputs)&&delete y.inputs;let[T]=sG(e,nz);eH(T)&&T.type===X[X.Symbol]&&T.curves[0].style===W[W.Renko]&&eH(T.inputs)&&T.inputs.map(e=>e.value).some(e=>void 0===e)&&(T.inputs=eG(tG.DEFAULT_RENKO_INPUTS)),function(e){let[t]=sG(e,nz);if(eH(t)&&t.type===X[X.Expression]){let i=t.curves[0].style,s=i===W[W.Range],r=i===W[W.Baseline],n=nx.includes(i);s&&e.data?.aggregation.spec===G[G.PerRange]&&(e.data.aggregation={unit:"Day"}),!r&&(n||s)&&(delete t.inputs,t.curves[0]=nL("Candlestick",!0))}}(e),sG(e,"..annotations").forEach(e=>{let{id:t,traits:i}=e;s8(t,i),s7(t,i)});try{sx=!1,sG(e,'..plots{.type === "Study" && .curves.zones}').forEach(e=>{let t=sw(e.study).defaults;for(let i=0;i<(e.curves?.length??0);i++){let s=e.curves[i];if(s.zones&&(s.colors?.length??0)<(t.curves[i].colors?.length??0)){let e=t.curves[i].colors.slice(s.colors?.length??0);s.colors?.length?s.colors.push(...e):s.colors=e}}})}finally{sx=!0}let[A]=sG(e,nz);if("Symbol"===A.type&&A.curves?.length===1){let e=A.curves[0];if("HLC"===e.style){let t=e.colors?.length;if(1===t){let t=e.colors[0];e.colors=[t,t],e.varyColorPerBar=!0,e.attributes=["OpenVsClose"]}else 2!==t||e.attributes||(e.attributes=["OpenVsClose"])}}let S=sG(e,"..annotations{.id === 'RewardRisk' || .id === 'ProfitLoss' }");S.length>0&&S.forEach(e=>{e.traits.prices=e.traits.prices.map(e=>"string"==typeof e?Number.parseFloat(e):e),"RewardRisk"===e.id&&(e.traits.ratio=Math.abs(e.traits.ratio),e.traits.textLines=e.traits.textLines.map(e=>e.match(/Ratio/)?e.replace("-",""):e))}),yQ()?.config?.mode==="cmdtyView"&&(delete e.data?.extendedHours,delete e.data?.buildContinuation);let v=e.data?.aggregation,b=eV(e.data?.extendedHours);v&&"FormT"===v.spec&&(v.spec="None",b||(e.data.extendedHours=!0));let P=e.data?.buildContinuation,C=eV(P),E=e.data?.aggregation;C&&E&&("Continue"!==E.spec||P||(E.spec="None"),P&&(E.spec="Continue"));try{sx=!1,sG(e,'..plots{.type === "Study" && .curves.varyColorPerBar}').forEach(e=>{let t=sw(e.study).defaults;if(e?.curves?.length===t?.curves.length&&t?.curves.length>0)for(let i=0;i<e.curves.length;i++)e.curves[i].varyColorPerBar=t.curves[i].varyColorPerBar})}finally{sx=!0}try{sx=!1,sG(e,'..plots{.type === "Study"}').forEach(e=>{let t=sw(e.study).defaults;eV(e.inputs)&&e.inputs.forEach((e,i)=>{let s=t.inputs?.[i]?.value;!eV(e.value)&&eV(s)&&(e.value=s)}),eV(e.levels)&&e.levels.forEach((e,i)=>{let s=t.levels?.[i]?.value;!eV(e.value)&&eV(s)&&(e.value=s)}),eV(e.bands)&&e.bands.forEach((e,i)=>{let s=t.bands?.[i]?.range;!eV(e.range.from)&&eV(s?.from)&&(e.range.from=s.from),!eV(e.range.to)&&eV(s?.to)&&(e.range.to=s.to)})})}finally{sx=!0}let _=sz(e,"..annCache{!.annotations}",e=>tG.NULL_OBJECT);_=sz(_,"..annCache",e=>{let t=tL(e.symbol);return null===t?e:n4(t,n5(new Date,3))?tG.NULL_OBJECT:e});let M=(_=sz(_,"..annotations{.id === 'ComputedText' && !.traits.textLines}",e=>tG.NULL_OBJECT)).data.aggregation;return n2(_,"Tick"===M.unit&&"None"===M.spec)}(s));let r=n8.validate(i,s);if(r){let e=JSON.stringify(r,null,4);throw Error(`Document not valid according to schema ${i}; error is ${e}`)}return i===tG.ACCESSOR_SCHEMA&&function(e){let{id:t,context:i}=e,s=e=>eH(i[e]),r=(e,t)=>{if(!eH(i[e]))throw Error(`${t} plot accessor: you must provide '${e}'`)},n=e=>{if(s("placement")&&"clone"===i.placement&&!s("cloneIndex"))throw Error(`${e} plot accessor: when placement is 'clone', you must provide 'cloneIndex'.`)};if("Plot"===t)switch(i.id){case"Add":switch(r("type","Add"),i.type){case"Study":r("studyId","Add"),n("Add");break;case"IncomeStatement":case"BalanceSheet":r("fundamentalId","Add");break;case"Expression":r("expression","Add")}break;case"Get":if(!s("main")&&!s("type"))throw Error("Get plot accessor: you must provide either 'main' or 'type'");break;case"Delete":r("type","Delete"),r("index","Delete");break;case"Update":switch(r("type","Update"),!s("main")&&r("index","Update"),n("Update"),i.type){case"Forward":if(!eH(i.forward)){if(!eH(i.curves)||!eH(i.offsets))throw Error("Update forward plot accessor: you must provide either 'forward' or 'curves' and 'offsets'");if(i.curves.length!==i.offsets.length)throw Error("Update forward plot accessor: you must provide same number of elements for 'curves' and 'offsets'")}break;case"Seasonal":if(!eH(i.seasonal)){if(!eH(i.curves)||!eH(i.offsets))throw Error("Update seasonal plot accessor: you must provide either 'seasonal' or 'curves' and 'offsets'");if(i.curves.length!==i.offsets.length&&i.curves.length!==i.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":{r("studyId","Update"),n("Update");let e=e=>e.reduce((e,t)=>e.concat(t.fields),[]),t=sw(i.studyId);if(!eH(i.curves)||i.curves.length!==t.defaults.curves.length)throw Error("Update study plot accessor: you must provide same number of elements for 'curves' of the study as defined in the taxonomy");let s=e(i.curves);if(0!==eS(e(t.defaults.curves),s).length){let e;throw Error((e="fields",`Update study plot accessor: incoming list of ${e} is different from the ${e} as defined in the taxonomy`))}}}}}(s),s}function ae(e){let t=sz(e,"..panes{.axes{!.plots}}",e=>(1===e.axes.length?e.axes=[]:0===e.axes[1].plots.length&&(e.axes.pop(),0===e.axes[0].plots.length&&(e.axes=[])),e));return sz(t,"..panes{!.axes}",e=>tG.NULL_OBJECT)}var at={};at=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":"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":"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":"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":"BOLLBW","category":"Study","name":"Bollinger-Width","shortName":"BOLLW"},{"id":"BOLLBP","category":"Study","name":"Bollinger-Percent","shortName":"%B"},{"id":"BOLLSQ","category":"Study","name":"Bollinger-Squeeze","shortName":"BOLL(S)"},{"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":"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":"REATRHI","category":"Study","name":"RetraceATRHigh","shortName":"REATRHI"},{"id":"REATRLO","category":"Study","name":"RetraceATRLow","shortName":"REATRLO"},{"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":"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":"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":"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"}]');class ai{id;type;category;name;format;shortName;constructor(e,t=z.Number,i=j.Common,s,r=Y.FromMetaData,n){this.id=e,this.type=t,this.category=i,this.name=s,this.format=r,this.shortName=n;let a="_"===e.charAt(0);null==s&&(this.name=a?e:this.id.replace(/([A-Z])/g," $1").trim()),this.shortName=n??this.name}}let as={};function ar(e){n9(e,tG.FIELDS_SCHEMA).map(e=>{as[e.id]=new ai(e.id,z[e.type],j[e.category],e.name,Y[e.format],e.shortName)})}let an=(ar(e(at)),as),aa={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"},ao=[an.Open,an.High,an.Low,an.Close,an.Volume,an.Change,an.PercentChange,an.PreviousClose].reduce((e,t,i)=>(e.set(t.id,1<<i),e),new Map);function al(...e){return e.reduce((e,t)=>ao.has(t.id)?e|ao.get(t.id):e,0)}class au{symbol;storage;fields;_updated;isValid;constructor(e=""){this.symbol=e,this.fields=[],this._updated=0,this.isValid=!1,this.storage=new Map,this.isValid=!1,this.resetUpdated()}get updated(){return this._updated}resetUpdated(){this._updated=0}addFields(...e){this.fields=function(e,t){let i=e?e.slice():[];return t.forEach(e=>{i.includes(e)||i.push(e)}),i}(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 i=e.id,s=this.storage.get(i);this.storage.set(i,t);let r=s!==t;return r&&ao.has(i)&&(this._updated=this._updated|ao.get(i)),r}}computeWellKnown(){let e=this.getValue(an.Close),t=this.getValue(an.PreviousClose);eH(e,t)&&(this.hasField(an.Change)&&this.update(an.Change,e-t),this.hasField(an.PercentChange)&&this.update(an.PercentChange,(e-t)/t))}hasField(e){return eH(this.fields)&&this.fields.includes(e)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}}class ah extends au{translated;constructor(e){super(),this.symbol=e,this.translated=tQ(this.symbol)}hasSymbol(e){return this.symbol===e}}class ac extends au{actual;constructor(e){super(tG.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}}class ad extends au{constructor(e){super(),this.symbol=e}hasSymbol(e){return this.symbol===e}async ready(){return!0}hasField(e){return!1}getValue(e){return null}}let ap={previousOpen:an.PreviousOpen,previousClose:an.PreviousClose,previousHigh:an.PreviousHigh,previousLow:an.PreviousLow,weeklyPreviousClose:an.WeekPreviousClose,weeklyPreviousHigh:an.WeekPreviousHigh,weeklyPreviousLow:an.WeekPreviousLow,monthlyPreviousClose:an.MonthPreviousClose,monthlyPreviousHigh:an.MonthPreviousHigh,monthlyPreviousLow:an.MonthPreviousLow,fiftyTwoWkHigh:an.YearHigh,fiftyTwoWkLow:an.YearLow},af={open:an.Open,high:an.High,low:an.Low,close:an.Close,lastPrice:an.Last,volume:an.Volume,netChange:an.Change,percentChange:an.PercentChange},am=Object.values(ap),ag=Object.keys(ap),ay=Object.keys(af);class aT extends ah{triedFetchingExtraValues=!1;includeBaseFields=!1;async ready(){return tU.call(this,async()=>{let e=yQ().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid})}shutdown(){}getValue(e){return this.hasField(e)&&am.includes(e)&&null===super.getValue(e)&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,yq("ondemand",`/getQuote.json?symbols=${this.translated}&fields=${ag.join(",")}`).then(e=>{try{let t=JSON.parse(e);if(200===t.status.code&&1===t.results.length){let e=t.results[0];ag.forEach(t=>this.update(ap[t],e[t])),this.includeBaseFields&&ay.forEach(t=>this.update(af[t],e[t])),yQ().getRecordSource().subject.next({topic:aa.RT_QUOTE,data:{symbol:this.symbol}})}}catch(e){yj(`Failed to fetch extra values for ${this.translated}`,"error")}})}}class aA extends aT{constructor(e){super(e),this.includeBaseFields=!0,this.supplementPreviousValues()}async ready(){return Promise.resolve(!0)}}class aS extends ah{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){eH(t)&&(this.addFields(e),this.update(e,t))}async ready(){return tU.call(this,async()=>{let e=yQ().config.environment===V[V.NodeJs]?null:tD(`#${tG.INLINE_DATA_ELEMENT_ID}`);if(eH(e)){let t=JSON.parse(e);if(this.translated in t){let e=t[this.translated].quote;this.update(an.Open,e.open),this.update(an.High,e.high),this.update(an.Low,e.low),this.update(an.Close,e.close),this.update(an.PreviousClose,e.previousClose),this.update(an.Volume,e.volume),ag.filter(e=>"previousClose"!==e).forEach(t=>{this.addOptionalField(ap[t],e[t])}),this.isValid=!0}else this.isValid=!1}else this.isValid=!1;return this.isValid})}}let av=[an.Open,an.High,an.Low,an.Close,an.PreviousClose];class ab extends au{mapping;resolved;model;constructor(e,t){super(),this.resolved=e.map(([e,t])=>t),this.mapping=new Map(e.map(([e,t])=>[e,yQ().getRecordSource().getRecord(t)])),this.model=t;let i=av.concat(an.Change,an.PercentChange);this.addFields(...i.filter(e=>e!==an.Volume))}async ready(){return tU.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(){av.forEach(e=>{let t=nF(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)}),this.computeWellKnown()}}function aP(e,t){return i=>i.topic===e&&i.data.symbol===t}var aC=function(e,t){return(aC=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function aE(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}aC(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function a_(e,t){var i,s,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function o(o){return function(l){var u=[o,l];if(i)throw TypeError("Generator is already executing.");for(;n&&(n=0,u[0]&&(a=0)),a;)try{if(i=1,s&&(r=2&u[0]?s.return:u[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,u[1])).done)return r;switch(s=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,s=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){a.label=u[1];break}if(6===u[0]&&a.label<r[1]){a.label=r[1],r=u;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(u);break}r[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],s=0}finally{i=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function aM(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],s=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function aL(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return a}function ax(e,t,i){if(i||2==arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}function aO(e){return this instanceof aO?(this.v=e,this):new aO(e)}function aI(e){return"function"==typeof e}function aD(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 aw=aD(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function aR(e,t){if(e){var i=e.indexOf(t);0<=i&&e.splice(i,1)}}var aN=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e,t,i,s,r,n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=aM(n),o=a.next();!o.done;o=a.next())o.value.remove(this)}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else n.remove(this);var l=this.initialTeardown;if(aI(l))try{l()}catch(e){r=e instanceof aw?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=aM(u),c=h.next();!c.done;c=h.next()){var d=c.value;try{aF(d)}catch(e){r=null!=r?r:[],e instanceof aw?r=ax(ax([],aL(r)),aL(e.errors)):r.push(e)}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}}if(r)throw new aw(r)}},t.prototype.add=function(e){var i;if(e&&e!==this)if(this.closed)aF(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!=(i=this._finalizers)?i:[]).push(e)}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&aR(t,e)},t.prototype.remove=function(e){var i=this._finalizers;i&&aR(i,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),aV=aN.EMPTY;function aH(e){return e instanceof aN||e&&"closed"in e&&aI(e.remove)&&aI(e.add)&&aI(e.unsubscribe)}function aF(e){aI(e)?e():e.unsubscribe()}var ak=function(e){function t(t,i){return e.call(this)||this}return aE(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(aN),aB={setInterval:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=aB.delegate;return(null==r?void 0:r.setInterval)?r.setInterval.apply(r,ax([e,t],aL(i))):setInterval.apply(void 0,ax([e,t],aL(i)))},clearInterval:function(e){var t=aB.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},aU=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.scheduler=t,s.work=i,s.pending=!1,s}return aE(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var i,s=this.id,r=this.scheduler;return null!=s&&(this.id=this.recycleAsyncId(r,s,t)),this.pending=!0,this.delay=t,this.id=null!=(i=this.id)?i:this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,i){return void 0===i&&(i=0),aB.setInterval(e.flush.bind(e,this),i)},t.prototype.recycleAsyncId=function(e,t,i){if(void 0===i&&(i=0),null!=i&&this.delay===i&&!1===this.pending)return t;null!=t&&aB.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var i=this._execute(e,t);if(i)return i;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var i,s=!1;try{this.work(e)}catch(e){s=!0,i=e||Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,i=this.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,aR(s,this),null!=t&&(this.id=this.recycleAsyncId(i,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ak),aW={now:function(){return(aW.delegate||Date).now()},delegate:void 0},a$=function(){function e(t,i){void 0===i&&(i=e.now),this.schedulerActionCtor=t,this.now=i}return e.prototype.schedule=function(e,t,i){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(i,t)},e.now=aW.now,e}(),aG=new(function(e){function t(t,i){void 0===i&&(i=a$.now);var s=e.call(this,t,i)||this;return s.actions=[],s._active=!1,s}return aE(t,e),t.prototype.flush=function(e){var t,i=this.actions;if(this._active)return void i.push(e);this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=i.shift())if(this._active=!1,t){for(;e=i.shift();)e.unsubscribe();throw t}},t}(a$))(aU),az=void 0,aY={setTimeout:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=aY.delegate;return(null==r?void 0:r.setTimeout)?r.setTimeout.apply(r,ax([e,t],aL(i))):setTimeout.apply(void 0,ax([e,t],aL(i)))},clearTimeout:function(e){var t=aY.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function aj(e){aY.setTimeout(function(){!1;throw e})}function aK(){}var aq=aX("C",void 0,void 0);function aX(e,t,i){return{kind:e,value:t,error:i}}var aZ=null;function aJ(e){var t,i,s,r;1;e()}var aQ=function(e){function t(t){var i=e.call(this)||this;return i.isStopped=!1,t?(i.destination=t,aH(t)&&t.add(i)):i.destination=a6,i}return aE(t,e),t.create=function(e,t,i){return new a3(e,t,i)},t.prototype.next=function(e){this.isStopped?a5(aX("N",e,void 0),this):this._next(e)},t.prototype.error=function(e){this.isStopped?a5(aX("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?a5(aq,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}(aN),a0=Function.prototype.bind;function a1(e,t){return a0.call(e,t)}var a2=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){a4(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){a4(e)}else a4(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){a4(e)}},e}(),a3=function(e){function t(t,i,s){var r,n,a=e.call(this)||this;return aI(t)||!t?r={next:null!=t?t:void 0,error:null!=i?i:void 0,complete:null!=s?s:void 0}:r=t,a.destination=new a2(r),a}return aE(t,e),t}(aQ);function a4(e){1;aj(e)}function a5(e,t){}var a6={closed:!0,next:aK,error:function(e){throw e},complete:aK},a7="function"==typeof Symbol&&Symbol.observable||"@@observable",a8=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var i=new e;return i.source=this,i.operator=t,i},e.prototype.subscribe=function(e,t,i){var s=this,r=!function(e){return e&&e instanceof aQ||e&&aI(e.next)&&aI(e.error)&&aI(e.complete)&&aH(e)}(e)?new a3(e,t,i):e;return aJ(function(){var e=s.operator,t=s.source;r.add(e?e.call(r,t):t?s._subscribe(r):s._trySubscribe(r))}),r},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var i=this;return new(t=a9(t))(function(t,s){var r=new a3({next:function(t){try{e(t)}catch(e){s(e),r.unsubscribe()}},error:s,complete:t});i.subscribe(r)})},e.prototype._subscribe=function(e){var t;return null==(t=this.source)?void 0:t.subscribe(e)},e.prototype[a7]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===e.length?function(e){return e}:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=a9(e))(function(e,i){var s;t.subscribe(function(e){return s=e},function(e){return i(e)},function(){return e(s)})})},e.create=function(t){return new e(t)},e}();function a9(e){var t;return null!=(t=null!=e?e:az)?t:Promise}function oe(e){return e&&aI(e.schedule)}function ot(e,t){var i,s,r,n;return void 0===e&&(e=0),void 0===t&&(t=aG),e<0&&(e=0),i=e,s=e,void 0===i&&(i=0),void 0===(r=t)&&(r=aG),n=-1,null!=s&&(oe(s)?r=s:n=s),new a8(function(e){var t,s=(t=i)instanceof Date&&!isNaN(t)?i-r.now():i;s<0&&(s=0);var a=0;return r.schedule(function(){e.closed||(e.next(a++),0<=n?this.schedule(void 0,n):e.complete())},s)})}var oi=aD(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),os=function(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 aE(t,e),t.prototype.lift=function(e){var t=new or(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new oi},t.prototype.next=function(e){var t=this;aJ(function(){var i,s;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var r=aM(t.currentObservers),n=r.next();!n.done;n=r.next())n.value.next(e)}catch(e){i={error:e}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(i)throw i.error}}}})},t.prototype.error=function(e){var t=this;aJ(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var i=t.observers;i.length;)i.shift().error(e)}})},t.prototype.complete=function(){var e=this;aJ(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(){var e;return(null==(e=this.observers)?void 0:e.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,i=this.hasError,s=this.isStopped,r=this.observers;return i||s?aV:(this.currentObservers=null,r.push(e),new aN(function(){t.currentObservers=null,aR(r,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,i=this.thrownError,s=this.isStopped;t?e.error(i):s&&e.complete()},t.prototype.asObservable=function(){var e=new a8;return e.source=this,e},t.create=function(e,t){return new or(e,t)},t}(a8),or=function(e){function t(t,i){var s=e.call(this)||this;return s.destination=t,s.source=i,s}return aE(t,e),t.prototype.next=function(e){var t,i;null==(i=null==(t=this.destination)?void 0:t.next)||i.call(t,e)},t.prototype.error=function(e){var t,i;null==(i=null==(t=this.destination)?void 0:t.error)||i.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=null==(e=this.destination)?void 0:e.complete)||t.call(e)},t.prototype._subscribe=function(e){var t,i;return null!=(i=null==(t=this.source)?void 0:t.subscribe(e))?i:aV},t}(os);function on(e){return function(t){if(aI(null==t?void 0:t.lift))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}function oa(e,t,i,s,r){return new oo(e,t,i,s,r)}var oo=function(e){function t(t,i,s,r,n,a){var o=e.call(this,t)||this;return o.onFinalize=n,o.shouldUnsubscribe=a,o._next=i?function(e){try{i(e)}catch(e){t.error(e)}}:e.prototype._next,o._error=r?function(e){try{r(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,o._complete=s?function(){try{s()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,o}return aE(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;e.prototype.unsubscribe.call(this),i||null==(t=this.onFinalize)||t.call(this)}},t}(aQ),ol="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function ou(e){return new a8(function(t){(function(e,t){var i,s,r,n,a,o,l,u;return a=this,o=void 0,l=void 0,u=function(){var a;return a_(this,function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),i=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=aM(e),t={},s("next"),s("throw"),s("return"),t[Symbol.asyncIterator]=function(){return this},t);function s(i){t[i]=e[i]&&function(t){return new Promise(function(s,r){var n,a,o;n=s,a=r,o=(t=e[i](t)).done,Promise.resolve(t.value).then(function(e){n({value:e,done:o})},a)})}}}(e),o.label=1;case 1:return[4,i.next()];case 2:if((s=o.sent()).done)return[3,4];if(a=s.value,t.next(a),t.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return r={error:o.sent()},[3,11];case 6:if(o.trys.push([6,,9,10]),!(s&&!s.done&&(n=i.return)))return[3,8];return[4,n.call(i)];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(r)throw r.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})},new(l||(l=Promise))(function(e,t){function i(e){try{r(u.next(e))}catch(e){t(e)}}function s(e){try{r(u.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):((r=t.value)instanceof l?r:new l(function(e){e(r)})).then(i,s)}r((u=u.apply(a,o||[])).next())})})(e,t).catch(function(e){return t.error(e)})})}function oh(e,t){return on(function(i,s){var r=0;i.subscribe(oa(s,function(i){return e.call(t,i,r++)&&s.next(i)}))})}function oc(e){return(oc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function od(e){return te(1,arguments),(!!function(e){return te(1,arguments),e instanceof Date||"object"===oc(e)&&"[object Date]"===Object.prototype.toString.call(e)}(e)||"number"==typeof e)&&!isNaN(Number(ti(e)))}function op(e,t){return te(2,arguments),new Date(ti(e).getTime()+e9(t))}function of(e,t){return te(2,arguments),op(e,-e9(t))}function om(e){te(1,arguments);var t=ti(e),i=t.getUTCDay();return t.setUTCDate(t.getUTCDate()-(7*(i<1)+i-1)),t.setUTCHours(0,0,0,0),t}function og(e){te(1,arguments);var t=ti(e),i=t.getUTCFullYear(),s=new Date(0);s.setUTCFullYear(i+1,0,4),s.setUTCHours(0,0,0,0);var r=om(s),n=new Date(0);n.setUTCFullYear(i,0,4),n.setUTCHours(0,0,0,0);var a=om(n);return t.getTime()>=r.getTime()?i+1:t.getTime()>=a.getTime()?i:i-1}function oy(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.weekStartsOn)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.weekStartsOn)?r:nc.weekStartsOn)?s:null==(l=nc.locale)||null==(u=l.options)?void 0:u.weekStartsOn)?i:0);if(!(h>=0&&h<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=ti(e),d=c.getUTCDay();return c.setUTCDate(c.getUTCDate()-(7*(d<h)+d-h)),c.setUTCHours(0,0,0,0),c}function oT(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=ti(e),c=h.getUTCFullYear(),d=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.firstWeekContainsDate)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.firstWeekContainsDate)?r:nc.firstWeekContainsDate)?s:null==(l=nc.locale)||null==(u=l.options)?void 0:u.firstWeekContainsDate)?i:1);if(!(d>=1&&d<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(c+1,0,d),p.setUTCHours(0,0,0,0);var f=oy(p,t),m=new Date(0);m.setUTCFullYear(c,0,d),m.setUTCHours(0,0,0,0);var g=oy(m,t);return h.getTime()>=f.getTime()?c+1:h.getTime()>=g.getTime()?c:c-1}function oA(e,t){for(var i=Math.abs(e).toString();i.length<t;)i="0"+i;return(e<0?"-":"")+i}var oS=function(e,t){var i=e.getUTCFullYear(),s=i>0?i:1-i;return oA("yy"===t?s%100:s,t.length)},ov=function(e,t){var i=e.getUTCMonth();return"M"===t?String(i+1):oA(i+1,2)},ob=function(e,t){var i=t.length;return oA(Math.floor(e.getUTCMilliseconds()*Math.pow(10,i-3)),t.length)};function oP(e,t){var i=e>0?"-":"+",s=Math.abs(e),r=Math.floor(s/60),n=s%60;return 0===n?i+String(r):i+String(r)+(t||"")+oA(n,2)}function oC(e,t){return e%60==0?(e>0?"-":"+")+oA(Math.abs(e)/60,2):oE(e,t)}function oE(e,t){var i=Math.abs(e);return(e>0?"-":"+")+oA(Math.floor(i/60),2)+(t||"")+oA(i%60,2)}var o_={G:function(e,t,i){var s=+(e.getUTCFullYear()>0);switch(t){case"G":case"GG":case"GGG":return i.era(s,{width:"abbreviated"});case"GGGGG":return i.era(s,{width:"narrow"});default:return i.era(s,{width:"wide"})}},y:function(e,t,i){if("yo"===t){var s=e.getUTCFullYear();return i.ordinalNumber(s>0?s:1-s,{unit:"year"})}return oS(e,t)},Y:function(e,t,i,s){var r=oT(e,s),n=r>0?r:1-r;return"YY"===t?oA(n%100,2):"Yo"===t?i.ordinalNumber(n,{unit:"year"}):oA(n,t.length)},R:function(e,t){return oA(og(e),t.length)},u:function(e,t){return oA(e.getUTCFullYear(),t.length)},Q:function(e,t,i){var s=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return oA(s,2);case"Qo":return i.ordinalNumber(s,{unit:"quarter"});case"QQQ":return i.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return i.quarter(s,{width:"narrow",context:"formatting"});default:return i.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,i){var s=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return oA(s,2);case"qo":return i.ordinalNumber(s,{unit:"quarter"});case"qqq":return i.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return i.quarter(s,{width:"narrow",context:"standalone"});default:return i.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,i){var s=e.getUTCMonth();switch(t){case"M":case"MM":return ov(e,t);case"Mo":return i.ordinalNumber(s+1,{unit:"month"});case"MMM":return i.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return i.month(s,{width:"narrow",context:"formatting"});default:return i.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,i){var s=e.getUTCMonth();switch(t){case"L":return String(s+1);case"LL":return oA(s+1,2);case"Lo":return i.ordinalNumber(s+1,{unit:"month"});case"LLL":return i.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return i.month(s,{width:"narrow",context:"standalone"});default:return i.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,i,s){var r=function(e,t){te(1,arguments);var i=ti(e);return Math.round((oy(i,t).getTime()-(function(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.firstWeekContainsDate)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.firstWeekContainsDate)?r:nc.firstWeekContainsDate)?s:null==(l=nc.locale)||null==(u=l.options)?void 0:u.firstWeekContainsDate)?i:1),c=oT(e,t),d=new Date(0);return d.setUTCFullYear(c,0,h),d.setUTCHours(0,0,0,0),oy(d,t)})(i,t).getTime())/6048e5)+1}(e,s);return"wo"===t?i.ordinalNumber(r,{unit:"week"}):oA(r,t.length)},I:function(e,t,i){var s=function(e){te(1,arguments);var t=ti(e);return Math.round((om(t).getTime()-(function(e){te(1,arguments);var t=og(e),i=new Date(0);return i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0),om(i)})(t).getTime())/6048e5)+1}(e);return"Io"===t?i.ordinalNumber(s,{unit:"week"}):oA(s,t.length)},d:function(e,t,i){var s,r;return"do"===t?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):(s=e,r=t,oA(s.getUTCDate(),r.length))},D:function(e,t,i){var s=function(e){te(1,arguments);var t=ti(e),i=t.getTime();return t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),Math.floor((i-t.getTime())/864e5)+1}(e);return"Do"===t?i.ordinalNumber(s,{unit:"dayOfYear"}):oA(s,t.length)},E:function(e,t,i){var s=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return i.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return i.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(s,{width:"short",context:"formatting"});default:return i.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,i,s){var r=e.getUTCDay(),n=(r-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(n);case"ee":return oA(n,2);case"eo":return i.ordinalNumber(n,{unit:"day"});case"eee":return i.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(r,{width:"short",context:"formatting"});default:return i.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,i,s){var r=e.getUTCDay(),n=(r-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(n);case"cc":return oA(n,t.length);case"co":return i.ordinalNumber(n,{unit:"day"});case"ccc":return i.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(r,{width:"narrow",context:"standalone"});case"cccccc":return i.day(r,{width:"short",context:"standalone"});default:return i.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,i){var s=e.getUTCDay(),r=0===s?7:s;switch(t){case"i":return String(r);case"ii":return oA(r,t.length);case"io":return i.ordinalNumber(r,{unit:"day"});case"iii":return i.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return i.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return i.day(s,{width:"short",context:"formatting"});default:return i.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,i){var s=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return i.dayPeriod(s,{width:"narrow",context:"formatting"});default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,i){var s,r=e.getUTCHours();switch(s=12===r?"noon":0===r?"midnight":r/12>=1?"pm":"am",t){case"b":case"bb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return i.dayPeriod(s,{width:"narrow",context:"formatting"});default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,i){var s,r=e.getUTCHours();switch(s=r>=17?"evening":r>=12?"afternoon":r>=4?"morning":"night",t){case"B":case"BB":case"BBB":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return i.dayPeriod(s,{width:"narrow",context:"formatting"});default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,i){if("ho"===t){var s,r,n=e.getUTCHours()%12;return 0===n&&(n=12),i.ordinalNumber(n,{unit:"hour"})}return s=e,r=t,oA(s.getUTCHours()%12||12,r.length)},H:function(e,t,i){var s,r;return"Ho"===t?i.ordinalNumber(e.getUTCHours(),{unit:"hour"}):(s=e,r=t,oA(s.getUTCHours(),r.length))},K:function(e,t,i){var s=e.getUTCHours()%12;return"Ko"===t?i.ordinalNumber(s,{unit:"hour"}):oA(s,t.length)},k:function(e,t,i){var s=e.getUTCHours();return(0===s&&(s=24),"ko"===t)?i.ordinalNumber(s,{unit:"hour"}):oA(s,t.length)},m:function(e,t,i){var s,r;return"mo"===t?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):(s=e,r=t,oA(s.getUTCMinutes(),r.length))},s:function(e,t,i){var s,r;return"so"===t?i.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):(s=e,r=t,oA(s.getUTCSeconds(),r.length))},S:function(e,t){return ob(e,t)},X:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return oC(r);case"XXXX":case"XX":return oE(r);default:return oE(r,":")}},x:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"x":return oC(r);case"xxxx":case"xx":return oE(r);default:return oE(r,":")}},O:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+oP(r,":");default:return"GMT"+oE(r,":")}},z:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+oP(r,":");default:return"GMT"+oE(r,":")}},t:function(e,t,i,s){return oA(Math.floor((s._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,i,s){return oA((s._originalDate||e).getTime(),t.length)}},oM=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"})}},oL=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"})}},ox={p:oL,P:function(e,t){var i,s=e.match(/(P+)(p+)?/)||[],r=s[1],n=s[2];if(!n)return oM(e,t);switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"})}return i.replace("{{date}}",oM(r,t)).replace("{{time}}",oL(n,t))}},oO=["D","DD"],oI=["YY","YYYY"];function oD(e,t,i){if("YYYY"===e)throw RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var ow={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"}};function oR(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.width?String(t.width):e.defaultWidth;return e.formats[i]||e.formats[e.defaultWidth]}}var oN={date:oR({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:oR({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:oR({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},oV={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function oH(e){return function(t,i){var s;if("formatting"===(null!=i&&i.context?String(i.context):"standalone")&&e.formattingValues){var r=e.defaultFormattingWidth||e.defaultWidth,n=null!=i&&i.width?String(i.width):r;s=e.formattingValues[n]||e.formattingValues[r]}else{var a=e.defaultWidth,o=null!=i&&i.width?String(i.width):e.defaultWidth;s=e.values[o]||e.values[a]}return s[e.argumentCallback?e.argumentCallback(t):t]}}function oF(e){return function(t){var i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=s.width,n=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(n);if(!a)return null;var o=a[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(l)?function(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i}(l,function(e){return e.test(o)}):function(e,t){for(var i in e)if(e.hasOwnProperty(i)&&t(e[i]))return i}(l,function(e){return e.test(o)});return i=e.valueCallback?e.valueCallback(u):u,{value:i=s.valueCallback?s.valueCallback(i):i,rest:t.slice(o.length)}}}function ok(e){return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=t.match(e.matchPattern);if(!s)return null;var r=s[0],n=t.match(e.parsePattern);if(!n)return null;var a=e.valueCallback?e.valueCallback(n[0]):n[0];return{value:a=i.valueCallback?i.valueCallback(a):a,rest:t.slice(r.length)}}}var oB={code:"en-US",formatDistance:function(e,t,i){var s,r=ow[e];if(s="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",t.toString()),null!=i&&i.addSuffix)if(i.comparison&&i.comparison>0)return"in "+s;else return s+" ago";return s},formatLong:oN,formatRelative:function(e,t,i,s){return oV[e]},localize:{ordinalNumber:function(e,t){var i=Number(e),s=i%100;if(s>20||s<10)switch(s%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},era:oH({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:oH({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:oH({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:oH({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:oH({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"})},match:{ordinalNumber:ok({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:oF({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:oF({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:oF({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:oF({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:oF({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}},oU=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,oW=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,o$=/^'([^]*?)'?$/,oG=/''/g,oz=/[a-zA-Z]/;function oY(e,t,i){te(2,arguments);var s,r,n,a,o,l,u,h,c,d,p,f,m,g,y,T,A,S,v=String(t),b=null!=(s=null!=(r=null==i?void 0:i.locale)?r:nc.locale)?s:oB,P=e9(null!=(n=null!=(a=null!=(o=null!=(l=null==i?void 0:i.firstWeekContainsDate)?l:null==i||null==(u=i.locale)||null==(h=u.options)?void 0:h.firstWeekContainsDate)?o:nc.firstWeekContainsDate)?a:null==(c=nc.locale)||null==(d=c.options)?void 0:d.firstWeekContainsDate)?n:1);if(!(P>=1&&P<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=e9(null!=(p=null!=(f=null!=(m=null!=(g=null==i?void 0:i.weekStartsOn)?g:null==i||null==(y=i.locale)||null==(T=y.options)?void 0:T.weekStartsOn)?m:nc.weekStartsOn)?f:null==(A=nc.locale)||null==(S=A.options)?void 0:S.weekStartsOn)?p:0);if(!(C>=0&&C<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!b.localize)throw RangeError("locale must contain localize property");if(!b.formatLong)throw RangeError("locale must contain formatLong property");var E=ti(e);if(!od(E))throw RangeError("Invalid time value");var _=ta(E),M=of(E,_),L={firstWeekContainsDate:P,weekStartsOn:C,locale:b,_originalDate:E};return v.match(oW).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,ox[t])(e,b.formatLong):e}).join("").match(oU).map(function(s){if("''"===s)return"'";var r,n,a=s[0];if("'"===a){return(n=(r=s).match(o$))?n[1].replace(oG,"'"):r}var o=o_[a];if(o)return null!=i&&i.useAdditionalWeekYearTokens||-1===oI.indexOf(s)||oD(s,t,String(e)),null!=i&&i.useAdditionalDayOfYearTokens||-1===oO.indexOf(s)||oD(s,t,String(e)),o(M,s,b.localize,L);if(a.match(oz))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join("")}var oj={year:0,month:1,day:2,hour:3,minute:4,second:5},oK={};function oq(e,t,i,s,r,n,a){var o=new Date(0);return o.setUTCFullYear(e,t,i),o.setUTCHours(s,r,n,a),o}var oX=/^(Z)$/,oZ=/^([+-]\d{2})$/,oJ=/^([+-]\d{2}):?(\d{2})$/;function oQ(e,t,i){if(!e||(s=oX.exec(e)))return 0;if(s=oZ.exec(e))return o1(n=parseInt(s[1],10))?-(36e5*n):NaN;if(s=oJ.exec(e)){var s,r,n=parseInt(s[1],10),a=parseInt(s[2],10);return o1(n,a)?(r=36e5*Math.abs(n)+6e4*a,n>0?-r:r):NaN}if(function(e){if(o2[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),o2[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var o,l=o0(i?t:oq((o=t).getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds()),e);return-(i?l:function(e,t,i){var s=e.getTime()-t,r=o0(new Date(s),i);if(t===r)return t;var n=o0(new Date(s-=r-t),i);return r===n?r:Math.max(r,n)}(t,l,e))}return NaN}function o0(e,t){var i,s,r,n,a,o=(a=function(e){if(!oK[e]){var t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));oK[e]="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t?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"}):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"})}return oK[e]}(t)).formatToParts?function(e,t){try{for(var i=e.formatToParts(t),s=[],r=0;r<i.length;r++){var n=oj[i[r].type];n>=0&&(s[n]=parseInt(i[r].value,10))}return s}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(a,e):(i=a,s=e,r=i.format(s).replace(/\u200E/g,""),[(n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(r))[3],n[1],n[2],n[4],n[5],n[6]]),l=oq(o[0],o[1]-1,o[2],o[3]%24,o[4],o[5],0).getTime(),u=e.getTime(),h=u%1e3;return l-(u-=h>=0?h:1e3+h)}function o1(e,t){return -23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var o2={},o3=R("9J8r2"),o4=R("6ejce"),o5=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,o6=/^([0-9W+-]+)(T| )(.*)/,o7=/^([0-9W+-]+)(.*)/,o8=/^(\d{2})$/,o9=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],le=/^(\d{4})/,lt=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],li=/^-(\d{2})$/,ls=/^-?(\d{3})$/,lr=/^-?(\d{2})-?(\d{2})$/,ln=/^-?W(\d{2})$/,la=/^-?W(\d{2})-?(\d{1})$/,lo=/^(\d{2}([.,]\d*)?)$/,ll=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,lu=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/;function lh(t,i){if(arguments.length<1)throw TypeError("1 argument required, but only "+arguments.length+" present");if(null===t)return new Date(NaN);var s=i||{},r=null==s.additionalDigits?2:e(o3)(s.additionalDigits);if(2!==r&&1!==r&&0!==r)throw RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))return new Date(t.getTime());if("number"==typeof t||"[object Number]"===Object.prototype.toString.call(t))return new Date(t);if("string"!=typeof t&&"[object String]"!==Object.prototype.toString.call(t))return new Date(NaN);var n=function(e){var t,i={},s=o6.exec(e);if(s?(i.date=s[1],t=s[3]):(s=o7.exec(e))?(i.date=s[1],t=s[2]):(i.date=null,t=e),t){var r=o5.exec(t);r?(i.time=t.replace(r[1],""),i.timeZone=r[1].trim()):i.time=t}return i}(t),a=function(e,t){var i,s=o9[t],r=lt[t];if(i=le.exec(e)||r.exec(e)){var n=i[1];return{year:parseInt(n,10),restDateString:e.slice(n.length)}}if(i=o8.exec(e)||s.exec(e)){var a=i[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(n.date,r),o=a.year,l=function(e,t){if(null===t)return null;if(0===e.length)return(n=new Date(0)).setUTCFullYear(t),n;if(i=li.exec(e))return(n=new Date(0),lm(t,s=parseInt(i[1],10)-1))?(n.setUTCFullYear(t,s),n):new Date(NaN);if(i=ls.exec(e)){var i,s,r,n=new Date(0),a=parseInt(i[1],10);return!function(e,t){if(t<1)return!1;var i=lf(e);return(!i||!(t>366))&&(!!i||!(t>365))}(t,a)?new Date(NaN):(n.setUTCFullYear(t,0,a),n)}if(i=lr.exec(e)){n=new Date(0),s=parseInt(i[1],10)-1;var o=parseInt(i[2],10);return lm(t,s,o)?(n.setUTCFullYear(t,s,o),n):new Date(NaN)}if(i=ln.exec(e))return lg(t,r=parseInt(i[1],10)-1)?lc(t,r):new Date(NaN);if(i=la.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return lg(t,r,l)?lc(t,r,l):new Date(NaN)}return null}(a.restDateString,o);if(isNaN(l)||!l)return new Date(NaN);var u,h=l.getTime(),c=0;if(n.time&&isNaN(c=function(e){if(t=lo.exec(e))return ly(i=parseFloat(t[1].replace(",",".")))?i%24*36e5:NaN;if(t=ll.exec(e))return ly(i=parseInt(t[1],10),s=parseFloat(t[2].replace(",",".")))?i%24*36e5+6e4*s:NaN;if(t=lu.exec(e)){var t,i=parseInt(t[1],10),s=parseInt(t[2],10),r=parseFloat(t[3].replace(",","."));return ly(i,s,r)?i%24*36e5+6e4*s+1e3*r:NaN}return null}(n.time)))return new Date(NaN);if(n.timeZone||s.timeZone){if(isNaN(u=oQ(n.timeZone||s.timeZone,new Date(h+c))))return new Date(NaN)}else u=e(o4)(new Date(h+c)),u=e(o4)(new Date(h+c+u));return new Date(h+c+u)}function lc(e,t,i){t=t||0,i=i||0;var s=new Date(0);s.setUTCFullYear(e,0,4);var r=7*t+i+1-(s.getUTCDay()||7);return s.setUTCDate(s.getUTCDate()+r),s}var ld=[31,28,31,30,31,30,31,31,30,31,30,31],lp=[31,29,31,30,31,30,31,31,30,31,30,31];function lf(e){return e%400==0||e%4==0&&e%100!=0}function lm(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var s=lf(e);if(s&&i>lp[t]||!s&&i>ld[t])return!1}return!0}function lg(e,t,i){return!(t<0)&&!(t>52)&&(null==i||!(i<0)&&!(i>6))}function ly(e,t,i){return(null==e||!(e<0)&&!(e>=25))&&(null==t||!(t<0)&&!(t>=60))&&(null==i||!(i<0)&&!(i>=60))}var lT={};Object.defineProperty(lT,"__esModule",{value:!0}),lT.default=function(e){return(0,lA.default)({},e)};var lA=(t=R("eG07G"))&&t.__esModule?t:{default:t};lT=lT.default;let lS=[an.Open,an.High,an.Low,an.Last,an.Close,an.TradingDay,an.PreviousClose,an.PreviousHigh,an.PreviousLow,an.PreviousOpen,an.Volume,an.Change,an.PercentChange,an.YearHigh,an.YearLow,an.WeekPreviousClose,an.WeekPreviousHigh,an.WeekPreviousLow,an.MonthPreviousClose,an.MonthPreviousHigh,an.MonthPreviousLow];class lv{recordCache;translateSymbolBack;_subject;constructor(){this.recordCache=new Map,this.translateSymbolBack=new Map}get subject(){if(!eH(this._subject)){var e;let t=ot(Math.max(tG.MINIMUM_THROTTLE,yQ().config.throttleMillis||0)),i=ot(tG.BACKGROUND_TAB_THROTTLE);this._subject=new os().pipe((e=()=>globalThis.document?.hidden?i:t,on(function(t,i){var s=null,r=null,n=function(){null==r||r.unsubscribe();var t=s;s=[],t&&i.next(t),(function(e){if(e instanceof a8)return e;if(null!=e){var t,i,s,r;if(aI(e[a7])){return t=e,new a8(function(e){var i=t[a7]();if(aI(i.subscribe))return i.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")})}if(e&&"number"==typeof e.length&&"function"!=typeof e){return i=e,new a8(function(e){for(var t=0;t<i.length&&!e.closed;t++)e.next(i[t]);e.complete()})}if(aI(null==e?void 0:e.then)){return s=e,new a8(function(e){s.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,aj)})}if(Symbol.asyncIterator&&aI(null==e?void 0:e[Symbol.asyncIterator]))return ou(e);if(aI(null==e?void 0:e[ol])){return r=e,new a8(function(e){var t,i;try{for(var s=aM(r),n=s.next();!n.done;n=s.next()){var a=n.value;if(e.next(a),e.closed)return}}catch(e){t={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}e.complete()})}if(aI(null==e?void 0:e.getReader))return ou(function(e){return function(e,t,i){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var s,r=i.apply(e,t||[]),n=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(e){r[e]&&(s[e]=function(t){return new Promise(function(i,s){n.push([e,t,i,s])>1||o(e,t)})})}function o(e,t){try{var i;(i=r[e](t)).value instanceof aO?Promise.resolve(i.value.v).then(l,u):h(n[0][2],i)}catch(e){h(n[0][3],e)}}function l(e){o("next",e)}function u(e){o("throw",e)}function h(e,t){e(t),n.shift(),n.length&&o(n[0][0],n[0][1])}}(this,arguments,function(){var t,i,s;return a_(this,function(r){switch(r.label){case 0:t=e.getReader(),r.label=1;case 1:r.trys.push([1,,9,10]),r.label=2;case 2:return[4,aO(t.read())];case 3:if(s=(i=r.sent()).value,!i.done)return[3,5];return[4,aO(void 0)];case 4:return[2,r.sent()];case 5:return[4,aO(s)];case 6:return[4,r.sent()];case 7:return r.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}(e))}throw TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")})(e()).subscribe(r=oa(i,n,aK))};n(),t.subscribe(oa(i,function(e){return null==s?void 0:s.push(e)},function(){s&&i.next(s),i.complete()},void 0,function(){return s=r=null}))})),oh(e=>e.length>0))}return this._subject}addRecordForSymbol(e,t){let i=tQ(e);i!==e&&this.translateSymbolBack.set(i,e),this.recordCache.set(e,t)}removeRecordForSymbol(e){this.recordCache.delete(e);let t=tQ(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 lS}makeAndCacheRecord(e,t){if(e===tG.PLACEHOLDER_SYMBOL_NAME)return new ac(tG.PLACEHOLDER_SYMBOL_NAME);if(this.recordCache.has(e))return this.recordCache.get(e);let i=t(e),s=this.getSupportedFields();return i.addFields(...s),this.addRecordForSymbol(e,i),i.ready().then(e=>{this.postInit(e,i)}),i}evictUnused(e,t){for(let[i,s]of this.recordCache)e.has(s)||(t(s),this.removeRecordForSymbol(i))}postInit(e,t){}}class lb extends lv{getRecord(e){return this.makeAndCacheRecord(e,()=>new aS(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class lP extends lv{getRecord(e){return this.makeAndCacheRecord(e,()=>new aA(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class lC extends lv{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),yQ().connection.off("marketUpdate",this.onMarketUpdate,e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new aT(e))}postInit(e,t){e&&yQ().connection.on("marketUpdate",this.onMarketUpdate,t.translated)}onMarketUpdate(e){if(e.type===tG.REALTIME_INITIAL_QUOTE){let t=this.updateFromQuote(e,!0);this.subject.next({topic:aa.RT_QUOTE,data:e,updated:t})}else if(e.type===tG.REALTIME_TRADE){let t=yQ().connection.getMarketState().getQuote(e.symbol),i=this.updateFromQuote(t);this.subject.next({topic:aa.RT_TRADE,data:e,updated:i}),e.symbol===tG.DEBUG_SYMBOL&&console.log(`Trade
4
- Symbol: ${e.symbol} %cPrice: ${e.tradePrice} %cSize: ${e.tradeSize} %cTime: ${oY(e.time,tG.DEBUG_TIME_FORMAT)} %cSession: ${e.session}`,"color:#0f0","color:#a7a","color:#f96","color:#bee")}else if(e.type===tG.REALTIME_VOLUME){let t=this.updateFromVolume(e);0!==t&&(this.subject.next({topic:aa.RT_VOLUME,data:e,updated:t}),e.symbol===tG.DEBUG_SYMBOL&&console.log(`Volume
5
- Symbol: ${e.symbol} %cValue: ${e.value} %cSession: ${e.session}`,"color:#a7a","color:#bee"))}}updateFromQuote(e,t=!1){let i=this.findRecordForSymbol(e.symbol);i.resetUpdated(),i.update(an.Open,e.openPrice),i.update(an.High,e.highPrice),i.update(an.Low,e.lowPrice),i.update(an.Last,e.lastPrice),i.update(an.Close,e.lastPrice);let s=(e,t)=>{eH(t)&&i.update(e,t)};return s(an.Volume,e.volume),i.update(an.PreviousClose,e.previousPrice),t&&(s(an.PreviousOpen,e.previousOpenPrice),s(an.PreviousHigh,e.previousHighPrice),s(an.PreviousLow,e.previousLowPrice)),i.computeWellKnown(),i.updated}updateFromVolume(e){let t=this.findRecordForSymbol(e.symbol);return t.resetUpdated(),t.update(an.Volume,e.value),t.updated}}class lE extends lv{localTimeZone;constructor(){super(),this.localTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone}get feed(){return yQ()}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),this.feed.unsubscribe(e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new aT(e))}postInit(e,t){e&&this.feed.subscribe(t.translated)}onSnapshot(e,t){let i=this.findRecordForSymbol(t),s=yQ().metaDataSource.getMetaData(t);if(!s.isReady)return;let r=(e,t)=>{if(eV(t)){let r=s.asPrice(t);return i.update(e,r),r}};i.resetUpdated();let n=r(an.Open,e.open?.price),a=r(an.High,e.high?.price),o=r(an.Low,e.low?.price),l=r(an.Last,e.last?.price);if(eV(r(an.Close,e.close?.price))||r(an.Close,e.settlement?.price),eV(e.instrumentStatus?.tradeDate)){let t=e.instrumentStatus.tradeDate%100;i.update(an.TradingDay,t)}e.volume?.volume&&i.update(an.Volume,s.asQuantity(e.volume.volume));let u=this.toExchangeTime(e.transactionTime,s.timeZone);eV(r(an.PreviousClose,e.prevClose?.price))||r(an.PreviousClose,e.previousSession?.settlement?.price),r(an.PreviousOpen,e.previousSession?.open?.price),r(an.PreviousHigh,e.previousSession?.high?.price),r(an.PreviousLow,e.previousSession?.low?.price),r(an.YearHigh,e.yearHigh?.price),r(an.YearLow,e.yearLow?.price),i.computeWellKnown();let h={topic:"rt.quote",data:{symbol:t,openPrice:n,highPrice:a,lowPrice:o,lastPrice:l,tradeTime:u},updated:i.updated};this.subject.next(h)}skip(e){return void 0===e||e.blockTrade||e.doesNotUpdateLast||e.doesNotUpdateVolume}asDate(e){return!eV(e)||e.isZero()?null:new Date(e.div(1e6).toNumber())}toExchangeTime(t,i){var s,r,n,a;let o=this.asDate(t);if(null===o)return null;let l=function(t,i,s){if("string"==typeof t&&!t.match(o5)){var r=e(lT)(void 0);return r.timeZone=i,lh(t,r)}var n=lh(t,void 0),a=oq(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()).getTime(),o=oQ(i,new Date(a));return new Date(a+o)}(o,this.localTimeZone);return r=oQ(i,s=lh(l,void 0),!0),n=new Date(s.getTime()-r),(a=new Date(0)).setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),a.setHours(n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()),a}onUpdate(e,t){if(!this.recordCache.has(t))return void yj(`[OpenFeed] update for unsubscribed symbol: ${t}`,"warn");let i=yQ().metaDataSource.getMetaData(t);if(!i.isReady)return;let s=this.toExchangeTime(e.transactionTime,i.timeZone);if(e.trades?.trades)for(let{trade:r}of e.trades.trades){if(this.skip(r))continue;let e=i.asPrice(r.price),n=i.asQuantity(r.quantity);if(null===e||0===n)continue;let a=this.toExchangeTime(r.transactionTime,i.timeZone),o=this.findRecordForSymbol(t),[l,u,h,c]=["High","Low","Volume","TradingDay"].map(e=>an[e]).map(e=>o.getValue(e));(!eV(u)||e<u)&&o.update(an.Low,e),(!eV(l)||e>l)&&o.update(an.High,e),o.update(an.Last,e),o.update(an.Close,e),o.update(an.Volume,(eV(h)?h:0)+n),o.computeWellKnown();let d={data:{symbol:t,tradePrice:e,tradeSize:n,session:r.session,time:a??s,tradingDay:c},topic:"rt.trade",updated:o.updated};this.subject.next(d)}}}function l_(e,t){var i=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 i<0?-1:i>0?1:i}function lM(e,t){te(2,arguments);var i=ti(e),s=ti(t),r=l_(i,s),n=Math.abs(tl(i,s));i.setDate(i.getDate()-r*n);var a=Number(l_(i,s)===-r),o=r*(n-a);return 0===o?0:o}function lL(e){te(1,arguments);var t=ti(e);return t.setHours(23,59,59,999),t}function lx(e,t){te(2,arguments);var i=ti(e),s=e9(t);return isNaN(s)?new Date(NaN):(s&&i.setDate(i.getDate()+s),i)}function lO(e,t){return te(2,arguments),lx(e,-e9(t))}function lI(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return i.length>=t?e.apply(null,i.slice(0,t).reverse()):function(){for(var s=arguments.length,r=Array(s),n=0;n<s;n++)r[n]=arguments[n];return lI(e,t,i.concat(r))}}var lD=lI(oY,2),lw=lI(lx,2);function lR(e,t){return te(2,arguments),op(e,6e4*e9(t))}var lN=lI(lR,2),lV=lI(ts,2),lH=lI(function(e,t){return te(2,arguments),ts(e,3*e9(t))},2);function lF(e,t){return te(2,arguments),op(e,1e3*e9(t))}var lk=lI(lF,2),lB=lI(function(e,t){return te(2,arguments),lx(e,7*e9(t))},2),lU=lI(tr,2);function lW(e,t){switch(e){case $.Tick:return lk(t);case $.Intraday:return lN(t);case $.Day:return lw(t);case $.Week:return lB(t);case $.Month:return lV(t);case $.Quarter:return lH(t);case $.Year:return lU(t);default:throw Error(`Unexpected aggregation unit ${$[e]}`)}}function l$(e,t){return t.getFullYear()-1-(t.getFullYear()-1)%e}function lG(e){return new Date(e*tG.OPTIONS_DATA_INCREMENT+tG.OPTIONS_DATA_BASE)}function lz(e,t=tG.ZERO_DATE){let i=new Date(`${e}T00:00:00`);return od(i)?i:t}function lY(e){return e.size-1}class lj{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(an.DateTime)}prepend(e){this.base.prepend(e),this.processRetrieved()}append(e){this.base.append(e),this.processRetrieved()}}class lK extends lj{constructor(e){super(),this.container=e,this.retryCountForChunk=tG.FETCH_TICK_CHUNK_RETRY_COUNT}getFirstDate(e){let t=super.getFirstDate(0);return e>0&&e<this.retryCountForChunk?lL(lO(t,e)):t}process(e){let t=this.container,i=t.size>0?t.getLastDataPoint(an.Last):null,s=t.getLastDataPoint(an.DateTime),r=e.time;return void 0!==s&&r<=s&&(r=op(s,1)),t.addDataPoint(an.DateTime,r),t.addDataPoint(an.Last,e.tradePrice),t.addDataPoint(an.TradeSize,e.tradeSize),t.addDataPoint(an.Change,eH(i)?e.tradePrice-i:null),t.hasField(an.TradingDay)&&t.addDataPoint(an.TradingDay,e.tradingDay),{isUpdate:!1,time:r.getTime(),index:lY(t)}}}class lq extends lj{agg;durationAdd;constructor(e,t){super(),this.agg=t,this.container=e,this.durationAdd=function(e){switch(e.unit){case $.Tick:case $.Intraday:case $.Day:return lW(e.unit,e.size);case $.Week:case $.Month:case $.Quarter:case $.Year:return lW(e.unit,1);default:throw Error(`Unexpected aggregation unit ${$[e.unit]}`)}}(t)}isSameBar(e,t){switch(this.agg.unit){case $.Tick:case $.Intraday:case $.Day:return n4(t,this.durationAdd(e));case $.Week:return np(e,t);case $.Month:return nl(e,t);case $.Quarter:return nh(e,t);case $.Year:return nf(e,t);default:throw Error(`Unexpected aggregation unit ${$[this.agg.unit]}`)}}fixupTimeBasedAggregationTimestamp(e){return e}isCorrection(e,t){let i=n4(t,e);return i&&yj("Currently not handling data corrections (updates of the past historical data)","error"),i}computeNextStamp(e,t){if(this.isCorrection(e,t))return null;let i=e;for(;!this.isSameBar(i,t);)i=this.durationAdd(i);return i}isUpdate(e,t,i,s){return function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getTime()===s.getTime()}(i,e)}getPosition(e){if(0===this.container.size){let t=this.fixupTimeBasedAggregationTimestamp(e.time);return{lastTimestamp:null,newTimestamp:t,nextTimestamp:t,isUpdate:!1}}let t=this.container.getLastDataPoint(an.DateTime),i=e.time,s=this.computeNextStamp(t,i);if(null===s)return null;let r=this.isUpdate(t,i,s,e);return null===r?null:{lastTimestamp:t,newTimestamp:i,nextTimestamp:s,isUpdate:r}}createBar(e,t,i,s,r,n,a){let o=this.container,l=o.size>0?o.getLastDataPoint(an.Close):null;o.addDataPoint(an.DateTime,n),o.addDataPoint(an.Open,e),o.addDataPoint(an.High,t),o.addDataPoint(an.Low,i),o.addDataPoint(an.Close,s),o.addDataPoint(an.Change,eH(l)?s-l:null),o.addDataPoint(an.Volume,r),o.hasField(an.OpenInterest)&&o.addDataPoint(an.OpenInterest,null),o.hasField(an.TradingDay)&&o.addDataPoint(an.TradingDay,a??null)}addBar(e,t){let{nextTimestamp:i}=t,{tradePrice:s,tradingDay:r}=e;return this.createBar(s,s,s,s,e.tradeSize,i,r),{isUpdate:!1,time:i.getTime(),index:lY(this.container)}}updateLastBar(e,t,i,s){let r=this.container,n=e=>r.getLastDataPoint(e);if(eH(e)&&e>n(an.High)&&r.setLastDataPoint(an.High,e),eH(t)&&t<n(an.Low)&&r.setLastDataPoint(an.Low,t),eH(i)){r.setLastDataPoint(an.Close,i);let e=r.getData(an.Close)[r.size-2];r.setLastDataPoint(an.Change,i-e)}if(eH(s)){let e=r.getLastDataPoint(an.Volume)+s;r.setLastDataPoint(an.Volume,e)}}changeLastBar(e,t){let{lastTimestamp:i}=t,s=e.tradePrice;return this.updateLastBar(s,s,s,e.tradeSize),{isUpdate:!0,time:i.getTime(),index:lY(this.container)}}process(e){let t=this.getPosition(e);if(null===t)return null;let i=lD(tG.DEBUG_TIME_FORMAT);return t.isUpdate?(e.symbol===tG.DEBUG_SYMBOL&&console.log(`Adding ${this.agg.describe()} Bar
1
+ function e(e){return e&&e.__esModule?e.default:e}var t,i,s,r,n,a,o,l,u,h,c,d,p,f,m,g,y,T,A,S,v,b,P,C,E,_,M,L,x,O,I=globalThis,D={},w={},R=I.parcelRequireffd0;null==R&&((R=function(e){if(e in D)return D[e].exports;if(e in w){var t=w[e];delete w[e];var i={id:e,exports:{}};return D[e]=i,t.call(i.exports,i,i.exports),i.exports}var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(e,t){w[e]=t},I.parcelRequireffd0=R);var N=R.register;N("3DQaT",function(e,t){!function(){var t=function(){var e,t,i,s;function r(){for(var e,t=n();f("|");)v(),(e||(e=[t])).push(n());return e?{type:8,args:e}:t}function n(){return f("(")?a():l()}function a(){T("(");var e=r();T(")");for(var t,i=[];t=o();)i.push(t);return i.length?1===e.type?(e.parts=e.parts.concat(i),e):(i.unshift(e),{type:1,parts:i}):e}function o(){var e,t;return f("[")?(T("["),e=function(){if(f(":"))return v(),{type:10,toIdx:p()};var e=p();return f(":")?(v(),f("]"))?{type:10,fromIdx:e}:{type:10,fromIdx:e,toIdx:p()}:{type:10,idx:e}}(),T("]"),{type:4,arg:e}):f("{")?(T("{"),t=u(),T("}"),{type:3,arg:t}):f("(")?a():void 0}function l(){m()||C(v());var e,t=!1;f("^")?(v(),t=!0):y()&&(e=v().val.substr(1));for(var i,s,r,n,a=[];n=g()?(s=v().val,r=A(),(f("*")||1===r.type||3===r.type)&&(i=v().val),{type:2,selector:s,prop:i}):o();)a.push(n);return{type:1,fromRoot:t,subst:e,parts:a}}function u(){for(var e,t=h();f("||");)v(),(e||(e=[t])).push(h());return e?{type:5,op:"||",args:e}:t}function h(){for(var e,t=c();f("&&");)v(),(e||(e=[t])).push(c());return e?{type:5,op:"&&",args:e}:t}function c(){for(var e=function e(){for(var t=function(){for(var e=d();f("+")||f("-");)e={type:7,op:v().val,args:[e,d()]};return e}();f("<")||f(">")||f("<=")||f(">=");)t={type:6,op:v().val,args:[t,e()]};return t}();f("==")||f("!=")||f("===")||f("!==")||f("^==")||f("==^")||f("^=")||f("=^")||f("$==")||f("==$")||f("$=")||f("=$")||f("*==")||f("==*")||f("*=")||f("=*");)e={type:6,op:v().val,args:[e,c()]};return e}function d(){for(var e=p();f("*")||f("/")||f("%");)e={type:7,op:v().val,args:[e,d()]};return e}function p(){var e,t;return f("!")||f("-")?{type:9,op:v().val,arg:p()}:3===(e=A().type)||2===e||4===e||5===e?{type:11,val:v().val}:m()?l():f("(")?(T("("),t=u(),T(")"),t):C(v())}function f(e){var t=A();return 6===t.type&&t.val===e}function m(){return g()||y()||f("^")}function g(){var e=A();if(6===e.type){var t=e.val;return"."===t||".."===t}return!1}function y(){var e=A();return 1===e.type&&"$"===e.val[0]}function T(e){var t=v();(6!==t.type||t.val!==e)&&C(t)}function A(){if(null!==i)return i;var e=t;return i=S(),t=e,i}function S(){for(;i=e[t]," \r\n ".indexOf(i)>-1;)++t;if(t>=s)return{type:7,range:[t,t]};var i,r=function(){var i=t,s=e[t],r=e[t+1];if("."===s){if(b(r))return;return"."===e[++t]?{type:6,val:"..",range:[i,++t]}:{type:6,val:".",range:[i,t]}}if("="===r){var n=e[t+2];if("="===n){if("=!^$*".indexOf(s)>=0)return{type:6,val:s+r+n,range:[i,t+=3]}}else if("^$*".indexOf(n)>=0){if("="===s)return{type:6,val:s+r+n,range:[i,t+=3]}}else if("=!^$*><".indexOf(s)>=0)return{type:6,val:s+r,range:[i,t+=2]}}else if("="===s&&"^$*".indexOf(r)>=0)return{type:6,val:s+r,range:[i,t+=2]};return s===r&&("|"===s||"&"===s)?{type:6,val:s+r,range:[i,t+=2]}:":{}()[]^+-*/%!><|".indexOf(s)>=0?{type:6,val:s,range:[i,++t]}:void 0}();if(r||(r=function(){var i=e[t];if(P(i)){for(var r,n=t,a=i;++t<s&&(P(r=i=e[t])||r>="0"&&r<="9");){;a+=i}switch(a){case"true":case"false":return{type:4,val:"true"===a,range:[n,t]};case"null":return{type:5,val:null,range:[n,t]};default:return{type:1,val:a,range:[n,t]}}}}())||(r=function(){if('"'===e[t]||"'"===e[t]){for(var i,r=e[t],n=++t,a="",o=!1;t<s;){if("\\"===(i=e[t++]))i=e[t++];else if(('"'===i||"'"===i)&&i===r){o=!0;break}a+=i}if(o)return{type:3,val:a,range:[n,t]}}}())||(r=function(){var i=t,r=e[t],n="."===r;if(n||b(r)){for(var a=r;++t<s;){if("."===(r=e[t])){if(n)return;n=!0}else if(!b(r))break;a+=r}return{type:2,val:n?parseFloat(a):parseInt(a,10),range:[i,t]}}}()))return r;r={range:[t,t]},t>=s?r.type=7:r.val=e[t],C(r)}function v(){var e;return i?(t=i.range[1],e=i,i=null,e):S()}function b(e){return"0123456789".indexOf(e)>=0}function P(e){return"$"===e||"@"===e||"_"===e||e>="a"&&e<="z"||e>="A"&&e<="Z"}function C(e){7===e.type&&E(e,"Unexpected end of path"),E(e,'Unexpected token "%0"',e.val)}function E(e,t){var i=Array.prototype.slice.call(arguments,2),s=Error(t.replace(/%(\d)/g,function(e,t){return i[t]||""}));throw s.column=e.range[0],s}return function(n){e=n.split(""),t=0,i=null,s=e.length;var a=r(),o=v();return 7!==o.type&&C(o),a}}(),i=function(){function e(){if(A.length)return A.shift();var e="v"+ ++T;return y.push(e),e}function t(){for(var e=arguments,t=e.length;t--;)A.push(e[t])}function i(o,h,c){switch(o.type){case 1:var d,p,f,m,y,T,A,v,b,P,C,E,_,M,L,x,O,I,D,w,R,N,V=o.parts,H=0,F=V.length;for(g.push(h,"=",o.fromRoot?"data":o.subst?"subst."+o.subst:c,";","isArr("+h+") || ("+h+" = ["+h+"]);");H<F;){var k=V[H++];switch(k.type){case 2:".."===k.selector?function(i,s,r){var n=i.prop,o=e(),l=e(),u=e(),h=e(),c=e(),d=e(),p=e(),f=e();g.push(o,"=",r,".slice(),",f,"= [];","while(",o,".length) {",l,"=",o,".shift();"),n?g.push("if(typeof ",l,'=== "object" &&',l,") {"):g.push("if(typeof ",l,"!= null) {"),g.push(u,"= [];","if(isArr(",l,")) {",h,"= 0,",p,"=",l,".length;","while(",h,"<",p,") {",d,"=",l,"[",h,"++];"),n&&g.push("if(typeof ",d,'=== "object") {'),a(u,d),n&&g.push("}"),g.push("}","}","else {"),n?"*"!==n&&(g.push(d,"=",l,'["'+n+'"];'),a(f,d)):(a(f,l),g.push("if(typeof ",l,'=== "object") {')),g.push("for(",c," in ",l,") {","if(",l,".hasOwnProperty(",c,")) {",d,"=",l,"[",c,"];"),a(u,d),"*"===n&&a(f,d),g.push("}","}"),n||g.push("}"),g.push("}",u,".length &&",o,".unshift.apply(",o,",",u,");","}","}",s,"=",f,";"),t(o,l,u,h,c,d,p,f)}(k,h,h):function(i,s,r){if(i.prop){var o=n(i.prop),l=e(),u=e(),h=e(),c=e(),d=e(),p=e(),f=e();g.push(l,"= [];",u,"= 0;",h,"=",r,".length;",f,"= [];","while(",u,"<",h,") {",c,"=",r,"[",u,"++];","if(",c,"!= null) {"),"*"===i.prop?(g.push("if(typeof ",c,'=== "object") {',"if(isArr(",c,")) {",l,"=",l,".concat(",c,");","}","else {","for(",d," in ",c,") {","if(",c,".hasOwnProperty(",d,")) {",p,"=",c,"[",d,"];"),a(l,p),g.push("}","}","}","}")):(g.push(p,"=",c,"[",o,"];"),a(l,p,f,h)),g.push("}","}",s,"=",h,"> 1 &&",f,".length?",f,".length > 1?","concat.apply(",l,",",f,") :",l,".concat(",f,"[0]) :",l,";"),t(l,u,h,c,d,p,f)}}(k,h,h);break;case 3:!function(s,r,n){var a=e(),o=e(),u=e(),h=e(),c=e();g.push(a,"= [];",o,"= 0;",u,"=",n,".length;","while(",o,"<",u,") {",c,"=",n,"[",o,"++];"),i(s.arg,h,c),g.push(l(s.arg,h),"&&",a,".push(",c,");","}",r,"=",a,";"),t(a,o,u,c,h)}(k,h,h);break;case 4:!function(s,r,n){var a,o,l=s.arg;if(l.idx){var u=e();return i(l.idx,u,n),g.push(u,"< 0 && (",u,"=",n,".length +",u,");",r,"=",n,"[",u,"] == null? [] : [",n,"[",u,"]];"),t(u)}l.fromIdx?l.toIdx?(i(l.fromIdx,a=e(),n),i(l.toIdx,o=e(),n),g.push(r,"=",n,".slice(",a,",",o,");"),t(a,o)):(i(l.fromIdx,a=e(),n),g.push(r,"=",n,".slice(",a,");"),t(a)):(i(l.toIdx,o=e(),n),g.push(r,"=",n,".slice(0,",o,");"),t(o))}(k,h,h);break;case 8:r(k,h,h)}}break;case 8:r(o,h,c);break;case 6:d=o,p=h,f=c,m=e(),y=e(),T=e(),A=e(),v=e(),b=e(),P=e(),C=e(),E=d.args[0],_=d.args[1],g.push(p,"= false;"),i(E,m,f),i(_,y,f),M=1===E.type,L=11===_.type,g.push(T,"="),M?g.push("true;"):g.push("isArr(",m,");"),g.push(A,"="),L?g.push("false;"):g.push("isArr(",y,");"),g.push("if("),M||g.push(T,"&&"),g.push(m,".length === 1) {",m,"=",m,"[0];",T,"= false;","}"),L||g.push("if(",A,"&&",y,".length === 1) {",y,"=",y,"[0];",A,"= false;","}"),g.push(v,"= 0;","if(",T,") {",P,"=",m,".length;"),L||(g.push("if(",A,") {",C,"=",y,".length;","while(",v,"<",P,"&& !",p,") {",b,"= 0;","while(",b,"<",C,") {"),s(d.op,m+"["+v+"]",y+"["+b+"]"),g.push(p,"= true;","break;","}","++",b,";","}","++",v,";","}","}","else {")),g.push("while(",v,"<",P,") {"),s(d.op,m+"["+v+"]",y),g.push(p,"= true;","break;","}","++",v,";","}"),L||g.push("}"),g.push("}"),L||(g.push("else if(",A,") {",C,"=",y,".length;","while(",v,"<",C,") {"),s(d.op,m,y+"["+v+"]"),g.push(p,"= true;","break;","}","++",v,";","}","}")),g.push("else {",p,"=",S[d.op](m,y),";","}"),t(m,y,T,A,v,b,P,C);break;case 7:x=o,O=h,I=c,D=e(),w=e(),i((R=x.args)[0],D,I),i(R[1],w,I),g.push(O,"=",S[x.op](u(R[0],D),u(R[1],w)),";"),t(D,w);break;case 5:!function(s,r,n){var a,o=[],u=s.args,h=u.length,c=0;switch(g.push(r,"= false;"),s.op){case"&&":for(;c<h;)o.push(a=e()),i(u[c],a,n),g.push("if(",l(u[c++],a),") {");g.push(r,"= true;");break;case"||":for(;c<h;)o.push(a=e()),i(u[c],a,n),g.push("if(",l(u[c],a),") {",r,"= true;","}"),c+++1<h&&g.push("else {");--h}for(;h--;)g.push("}");t.apply(null,o)}(o,h,c);break;case 9:var B=o,U=h,W=c,$=e(),G=B.arg;switch(i(G,$,W),B.op){case"!":g.push(U,"= !",l(G,$)+";");break;case"-":g.push(U,"= -",u(G,$)+";")}t($);break;case 11:g.push(h,"="),N=o.val,g.push("string"==typeof N?n(N):null===N?"null":N),g.push(";")}}function s(e,t,i){g.push("if(",S[e](t,i),") {")}function r(s,r,n){for(var a=[],o=s.args,l=o.length,u=0;u<l;)a.push(e()),i(o[u],a[u++],n);g.push(r,"= concat.call(",a.join(","),");"),t.apply(null,a)}function n(e){return"'"+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"}function a(e,t,i,s){g.push("if(typeof ",t,'!== "undefined") {',"if(isArr(",t,")) {"),i&&(g.push(s,"> 1?"),o(i,t),g.push(":")),g.push(e,"=",e,".length?",e,".concat(",t,") :",t,".slice()",";","}","else {"),i&&g.push("if(",i,".length) {",e,"= concat.apply(",e,",",i,");",i,"= [];","}"),o(e,t),g.push(";","}","}")}function o(e,t){g.push(e,".length?",e,".push(",t,") :",e,"[0] =",t)}function l(e,t){switch(e.type){case 5:return t;case 11:return"!!"+t;case 1:return t+".length > 0";default:return"(typeof "+t+'=== "boolean"?'+t+":isArr("+t+")?"+t+".length > 0 : !!"+t+")"}}function u(e,t){switch(e.type){case 11:return t;case 1:return t+"[0]";default:return"(isArr("+t+")?"+t+"[0] : "+t+")"}}function h(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string" &&'+e+".indexOf("+t+") === 0"}function c(e,t){return e+"!= null &&"+t+"!= null &&"+e+".toString().toLowerCase().indexOf("+t+".toString().toLowerCase()) === 0"}function d(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string" &&'+e+".length >="+t+".length &&"+e+".lastIndexOf("+t+") ==="+e+".length -"+t+".length"}function p(e,t){return e+"!= null &&"+t+"!= null &&("+e+"="+e+".toString()).length >=("+t+"="+t+".toString()).length &&("+e+".toLowerCase()).lastIndexOf(("+t+".toLowerCase())) ==="+e+".length -"+t+".length"}function f(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string" &&'+e+".indexOf("+t+") > -1"}function m(e,t){return e+"!= null && "+t+"!= null &&"+e+".toString().toLowerCase().indexOf("+t+".toString().toLowerCase()) > -1"}var g,y,T,A,S={"===":function(e,t){return e+"==="+t},"==":function(e,t){return"typeof "+e+'=== "string" && typeof '+t+'=== "string"?'+e+".toLowerCase() ==="+t+".toLowerCase() :"+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},"!=":function(e,t){return e+"!="+t},"^==":h,"==^":function(e,t){return h(t,e)},"^=":c,"=^":function(e,t){return c(t,e)},"$==":d,"==$":function(e,t){return d(t,e)},"$=":p,"=$":function(e,t){return p(t,e)},"*==":f,"==*":function(e,t){return f(t,e)},"=*":function(e,t){return m(t,e)},"*=":m,"+":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 function(e){if(g=[],y=["res"],T=0,A=[],i(e,"res","data"),g.unshift("var ",Array.isArray?"isArr = Array.isArray":'toStr = Object.prototype.toString, isArr = function(o) { return toStr.call(o) === "[object Array]"; }',", concat = Array.prototype.concat",",",y.join(","),";"),1===e.type){var t=e.parts[e.parts.length-1];t&&4===t.type&&"idx"in t.arg&&g.push("res = res[0];")}return g.push("return res;"),g.join("")}}();function s(e){return Function("data,subst",i(t(e)))}var r={},n=[],a={cacheSize:100},o={cacheSize:function(e,t){if(t<e&&n.length>t)for(var i=n.splice(0,n.length-t),s=i.length;s--;)delete r[i[s]]}},l=function(e,t,i){return!r[e]&&(r[e]=s(e),n.push(e)>a.cacheSize&&delete r[n.shift()]),r[e](t,i||{})};l.version="0.3.4",l.params=function(e){if(!arguments.length)return a;for(var t in e)e.hasOwnProperty(t)&&(o[t]&&o[t](a[t],e[t]),a[t]=e[t])},l.compile=s,l.apply=l,"object"==typeof e.exports?e.exports=l:"object"==typeof modules?modules.define("jspath",function(e){e(l)}):"function"==typeof define?define(function(e,t,i){i.exports=l}):window.JSPath=l}()}),N("2nrEA",function(e,t){(function(){var t=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return(i=new Date).setTime(e.getTime()),i;if(e instanceof RegExp)return new RegExp(e);if(e instanceof Array){i=[];for(var i,s=0,r=e.length;s<r;s++)i[s]=t(e[s]);return i}if(e instanceof Object){for(var n in i={},e)e.hasOwnProperty(n)&&(i[n]=t(e[n]));return i}throw Error("Unable to clone object!")},i=function(e){for(var i=[t(e[0])],s=i[0].key,r=i[0].object,n=1,a=e.length;n<a;n++)r=r[s],i.push({object:r,key:s=e[n].key});return i},s=function(e,t){var i=e.length-1,s=e[i].key;t[i].object[s]=e[i].object[s]},r={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},n={null:function(e){return null===e},string:function(e){return"string"==typeof e},boolean:function(e){return"boolean"==typeof e},number:function(e){return"number"==typeof e&&e==e},integer:function(e){return"number"==typeof e&&e%1==0},object:function(e){return e&&"object"==typeof e&&!Array.isArray(e)},array:function(e){return Array.isArray(e)},date:function(e){return e instanceof Date}},a={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))&&-1===e.indexOf("/")},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)||!1},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)}},o={readOnly:function(e,t){return!1},minimum:function(e,t,i){return!(e<t||i.exclusiveMinimum&&e<=t)},maximum:function(e,t,i){return!(e>t||i.exclusiveMaximum&&e>=t)},multipleOf:function(e,t){return e/t%1==0||"number"!=typeof e},pattern:function(e,t){var i,s;return"string"!=typeof e||("string"==typeof t?i=t:(i=t[0],s=t[1]),new RegExp(i,s).test(e))},minLength:function(e,t){return e.length>=t||"string"!=typeof e},maxLength:function(e,t){return e.length<=t||"string"!=typeof e},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 i,s={},r=0,n=e.length;r<n;r++){if(i=JSON.stringify(e[r]),s.hasOwnProperty(i))return!1;s[i]=!0}return!0},minProperties:function(e,t){if("object"!=typeof e)return!0;var i=0;for(var s in e)e.hasOwnProperty(s)&&(i+=1);return i>=t},maxProperties:function(e,t){if("object"!=typeof e)return!0;var i=0;for(var s in e)e.hasOwnProperty(s)&&(i+=1);return i<=t},constant:function(e,t){return JSON.stringify(e)==JSON.stringify(t)},enum:function(e,t){var i,s,r;if("object"==typeof e){for(i=0,r=JSON.stringify(e),s=t.length;i<s;i++)if(r===JSON.stringify(t[i]))return!0}else for(i=0,s=t.length;i<s;i++)if(e===t[i])return!0;return!1}},l=function(e){return -1===e.indexOf("://")?e:e.split("#")[0]},u=function(e,t,i){var s,r,n,a;if(-1===(n=i.indexOf("#")))return e.schema.hasOwnProperty(i)?[e.schema[i]]:null;if(n>0)if(a=i.substr(0,n),i=i.substr(n+1),e.schema.hasOwnProperty(a))t=[e.schema[a]];else{if(!t||t[0].id!==a)return null;t=[t[0]]}else{if(!t)return null;i=i.substr(1)}if(""===i)return[t[0]];if("/"!==i.charAt(0))return null;for(i=i.substr(1),s=t[0],r=i.split("/");r.length>0;){if(!s.hasOwnProperty(r[0]))return null;s=s[r[0]],t.push(s),r.shift()}return t},h=function(e,t){var i,s,r,n,a=e.length-1,o=/^(\d+)/.exec(t);if(o){if(t=t.substr(o[0].length),(r=parseInt(o[1],10))<0||r>a)return;if(n=e[a-r],"#"===t)return n.key}else n=e[0];if(s=n.object[n.key],""===t)return s;if("/"===t.charAt(0)){for(i=(t=t.substr(1)).split("/");i.length>0;){if(i[0]=i[0].replace(/~1/g,"/").replace(/~0/g,"~"),!s.hasOwnProperty(i[0]))return;s=s[i[0]],i.shift()}return s}},c=function(e,t,n,a){var o,l,d,p,f,m,g,y,T,A,S,v,b,P=!1,C={},E=t.length-1,_=t[E],M=n.length-1,L=n[M].object,x=n[M].key,O=L[x];if(_.hasOwnProperty("$ref"))return(t=u(e,t,_.$ref))?c(e,t,n,a):{$ref:_.$ref};if(_.hasOwnProperty("type"))if("string"==typeof _.type){if(a.useCoerce&&e.coerceType.hasOwnProperty(_.type)&&(O=L[x]=e.coerceType[_.type](O)),!e.fieldType[_.type](O))return{type:_.type}}else{for(d=0,P=!0,p=_.type.length;d<p&&P;d++)e.fieldType[_.type[d]](O)&&(P=!1);if(P)return{type:_.type}}if(_.hasOwnProperty("allOf")){for(d=0,p=_.allOf.length;d<p;d++)if(A=c(e,t.concat(_.allOf[d]),n,a))return A}if(a.useCoerce||a.useDefault||a.removeAdditional){if(_.hasOwnProperty("oneOf")){for(d=0,l=1/0,p=_.oneOf.length,f=0;d<p;d++)if(b=i(n),A=c(e,t.concat(_.oneOf[d]),b,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else{if((f+=1)>1)break;s(b,n)}if(f>1)return{oneOf:!0};if(f<1)return C;C={}}if(_.hasOwnProperty("anyOf")){for(d=0,C=null,l=1/0,p=_.anyOf.length;d<p;d++)if(b=i(n),A=c(e,t.concat(_.anyOf[d]),b,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else{s(b,n),C=null;break}if(C)return C}if(_.hasOwnProperty("not")&&(b=i(n),!(A=c(e,t.concat(_.not),b,a))))return{not:!0}}else{if(_.hasOwnProperty("oneOf")){for(d=0,l=1/0,p=_.oneOf.length,f=0;d<p;d++)if(A=c(e,t.concat(_.oneOf[d]),n,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else if((f+=1)>1)break;if(f>1)return{oneOf:!0};if(f<1)return C;C={}}if(_.hasOwnProperty("anyOf")){for(d=0,C=null,l=1/0,p=_.anyOf.length;d<p;d++)if(A=c(e,t.concat(_.anyOf[d]),n,a))(o=A.schema?Object.keys(A.schema).length:1)<l&&(l=o,C=A);else{C=null;break}if(C)return C}if(_.hasOwnProperty("not")&&!(A=c(e,t.concat(_.not),n,a)))return{not:!0}}if(_.hasOwnProperty("dependencies")){for(y in _.dependencies)if(_.dependencies.hasOwnProperty(y)&&O.hasOwnProperty(y)){if(Array.isArray(_.dependencies[y])){for(d=0,p=_.dependencies[y].length;d<p;d++)if(!O.hasOwnProperty(_.dependencies[y][d]))return{dependencies:!0}}else if(A=c(e,t.concat(_.dependencies[y]),n,a))return A}}if(Array.isArray(O)){if(_.hasOwnProperty("items"))if(Array.isArray(_.items)){for(d=0,p=_.items.length;d<p;d++)null!==(A=c(e,t.concat(_.items[d]),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0);if(O.length>p&&_.hasOwnProperty("additionalItems"))if("boolean"==typeof _.additionalItems){if(!_.additionalItems)return{additionalItems:!0}}else for(d=p,p=O.length;d<p;d++)null!==(A=c(e,t.concat(_.additionalItems),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0)}else for(d=0,p=O.length;d<p;d++)null!==(A=c(e,t.concat(_.items),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0);else if(_.hasOwnProperty("additionalItems")&&"boolean"!=typeof _.additionalItems)for(d=0,p=O.length;d<p;d++)null!==(A=c(e,t.concat(_.additionalItems),n.concat({object:O,key:d}),a))&&(C[d]=A,P=!0);if(P)return{schema:C}}else{for(y in S=[],C={},O)O.hasOwnProperty(y)&&S.push(y);if(a.checkRequired&&_.required)for(d=0,p=_.required.length;d<p;d++)O.hasOwnProperty(_.required[d])||(C[_.required[d]]={required:!0},P=!0);if(m=_.hasOwnProperty("properties"),g=_.hasOwnProperty("patternProperties"),m||g)for(d=S.length;d--;){if(v=!1,m&&_.properties.hasOwnProperty(S[d])&&(v=!0,null!==(A=c(e,t.concat(_.properties[S[d]]),n.concat({object:O,key:S[d]}),a))&&(C[S[d]]=A,P=!0)),g)for(y in _.patternProperties)_.patternProperties.hasOwnProperty(y)&&S[d].match(y)&&(v=!0,null!==(A=c(e,t.concat(_.patternProperties[y]),n.concat({object:O,key:S[d]}),a))&&(C[S[d]]=A,P=!0));v&&S.splice(d,1)}if(a.useDefault&&m&&!P)for(y in _.properties)_.properties.hasOwnProperty(y)&&!O.hasOwnProperty(y)&&_.properties[y].hasOwnProperty("default")&&(O[y]=_.properties[y].default);if(a.removeAdditional&&m&&!0!==_.additionalProperties&&"object"!=typeof _.additionalProperties)for(d=0,p=S.length;d<p;d++)delete O[S[d]];else if(_.hasOwnProperty("additionalProperties"))if("boolean"==typeof _.additionalProperties){if(!_.additionalProperties)for(d=0,p=S.length;d<p;d++)C[S[d]]={additional:!0},P=!0}else for(d=0,p=S.length;d<p;d++)null!==(A=c(e,t.concat(_.additionalProperties),n.concat({object:O,key:S[d]}),a))&&(C[S[d]]=A,P=!0);if(P)return{schema:C}}for(T in _)_.hasOwnProperty(T)&&!r.hasOwnProperty(T)&&("format"===T?e.fieldFormat.hasOwnProperty(_[T])&&!e.fieldFormat[_[T]](O,_,n,a)&&(C[T]=!0,P=!0):e.fieldValidate.hasOwnProperty(T)&&!e.fieldValidate[T](O,_[T].hasOwnProperty("$data")?h(n,_[T].$data):_[T],_,n,a)&&(C[T]=!0,P=!0));return P?C:null},d={useDefault:!1,useCoerce:!1,checkRequired:!0,removeAdditional:!1};function p(){if(!(this instanceof p))return new p;this.coerceType={},this.fieldType=t(n),this.fieldValidate=t(o),this.fieldFormat=t(a),this.defaultOptions=t(d),this.schema={}}p.prototype={validate:function(e,t,i){var s=[e],r=null;if("string"==typeof e&&!(s=u(this,null,e)))throw Error("jjv: could not find schema '"+e+"'.");if(i)for(var n in this.defaultOptions)this.defaultOptions.hasOwnProperty(n)&&!i.hasOwnProperty(n)&&(i[n]=this.defaultOptions[n]);else i=this.defaultOptions;return(r=c(this,s,[{object:{__root__:t},key:"__root__"}],i))?{validation:r.hasOwnProperty("schema")?r.schema:r}:null},resolveRef:function(e,t){return u(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")&&"string"==typeof t.id&&t.id!==e){if("/"===t.id.charAt(0))throw Error("jjv: schema id's starting with / are invalid.");this.schema[l(t.id)]=t}else if(!e)throw Error("jjv: schema needs either a name or id attribute.");e&&(this.schema[l(e)]=t)}},void 0!==e.exports?e.exports=p:"function"==typeof define&&define.amd?define(function(){return p}):this.jjv=p}).call(e.exports)}),N("9J8r2",function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.default=function(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)},e.exports=e.exports.default}),N("6ejce",function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.default=function(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()},e.exports=e.exports.default}),N("eG07G",function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.default=function(e,t){if(null==e)throw TypeError("assign requires that input parameter not be null or undefined");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.exports=e.exports.default}),N("c15IW",function(e,t){var i,s;i="object"==typeof window&&window||this,s={},i.PubSub?(s=i.PubSub,console.warn("PubSub already loaded, using existing version")):(i.PubSub=s,function(e){var t={},i=-1;function s(e,t,i){try{e(t,i)}catch(e){setTimeout(function(){throw e},0)}}function r(e,t,i){e(t,i)}function n(e,i,n,a){var o,l=t[i],u=a?r:s;if(Object.prototype.hasOwnProperty.call(t,i))for(o in l)Object.prototype.hasOwnProperty.call(l,o)&&u(l[o],e,n)}function a(e){var i=String(e);return!!(Object.prototype.hasOwnProperty.call(t,i)&&function(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t[i]))}function o(e,t,i,s){var r,o=(r=e="symbol"==typeof e?e.toString():e,function(){var e=String(r),i=e.lastIndexOf(".");for(n(r,r,t,s);-1!==i;)i=(e=e.substr(0,i)).lastIndexOf("."),n(r,e,t,s);n(r,"*",t,s)});return!!function(e){for(var t=String(e),i=a(t)||a("*"),s=t.lastIndexOf(".");!i&&-1!==s;)s=(t=t.substr(0,s)).lastIndexOf("."),i=a(t);return i}(e)&&(!0===i?o():setTimeout(o,0),!0)}e.publish=function(t,i){return o(t,i,!1,e.immediateExceptions)},e.publishSync=function(t,i){return o(t,i,!0,e.immediateExceptions)},e.subscribe=function(e,s){if("function"!=typeof s)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var r="uid_"+String(++i);return t[e][r]=s,r},e.subscribeAll=function(t){return e.subscribe("*",t)},e.subscribeOnce=function(t,i){var s=e.subscribe(t,function(){e.unsubscribe(s),i.apply(this,arguments)});return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var i;for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)&&delete t[i]},e.countSubscriptions=function(e){var i,s,r=0;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)){for(s in t[i])r++;break}return r},e.getSubscriptions=function(e){var i,s=[];for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)&&s.push(i);return s},e.unsubscribe=function(i){var s,r,n,a="string"==typeof i&&(Object.prototype.hasOwnProperty.call(t,i)||function(e){var i;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e))return!0;return!1}(i)),o=!a&&"string"==typeof i,l="function"==typeof i,u=!1;if(a)return void e.clearSubscriptions(i);for(s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(r=t[s],o&&r[i]){delete r[i],u=i;break}if(l)for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&r[n]===i&&(delete r[n],u=!0)}return u}}(s)),void 0!==e&&e.exports&&(t=e.exports=s),t.PubSub=s,e.exports=t=s});var V=((i={})[i.Browser=0]="Browser",i[i.NodeJs=1]="NodeJs",i),H=((s={})[s.UsePrevious=0]="UsePrevious",s[s.UseNext=1]="UseNext",s[s.UseNone=2]="UseNone",s),F=((r={})[r.Minimum=0]="Minimum",r[r.Everything=1]="Everything",r[r.Manual=2]="Manual",r),k=((n={})[n.NoAction=0]="NoAction",n[n.IgnoreTimelineOnly=1]="IgnoreTimelineOnly",n[n.ModelTransformRequired=2]="ModelTransformRequired",n),B=((a={})[a.Down=0]="Down",a[a.Up=1]="Up",a[a.Same=2]="Same",a),U=((o={})[o.ChangeBased=0]="ChangeBased",o[o.OpenVsClose=1]="OpenVsClose",o),W=((l={})[l.OHLC=0]="OHLC",l[l.Line=1]="Line",l[l.Candlestick=2]="Candlestick",l[l.Area=3]="Area",l[l.Column=4]="Column",l[l.Dots=5]="Dots",l[l.HLC=6]="HLC",l[l.HL=7]="HL",l[l.Ribbon=8]="Ribbon",l[l.Step=9]="Step",l[l.HollowCandles=10]="HollowCandles",l[l.HeikinAshi=11]="HeikinAshi",l[l.ElderImpulseSystem=12]="ElderImpulseSystem",l[l.Renko=13]="Renko",l[l.Range=14]="Range",l[l.LineBreak=15]="LineBreak",l[l.Kagi=16]="Kagi",l[l.PointAndFigure=17]="PointAndFigure",l[l.Baseline=18]="Baseline",l[l.PercentChange=19]="PercentChange",l[l.MultiColumn=20]="MultiColumn",l[l.StackedColumn=21]="StackedColumn",l),$=((u={})[u.Tick=0]="Tick",u[u.Intraday=1]="Intraday",u[u.Day=2]="Day",u[u.Week=3]="Week",u[u.Month=4]="Month",u[u.Quarter=5]="Quarter",u[u.Year=6]="Year",u),G=((h={})[h.None=0]="None",h[h.Nearest=1]="Nearest",h[h.Continue=2]="Continue",h[h.PerCount=3]="PerCount",h[h.PerVolume=4]="PerVolume",h[h.PerRange=5]="PerRange",h[h.PerSeconds=6]="PerSeconds",h),z=((c={})[c.Number=0]="Number",c[c.String=1]="String",c[c.Date=2]="Date",c),Y=((d={})[d.FromMetaData=0]="FromMetaData",d[d.AsInteger=1]="AsInteger",d[d.UseMetricUnit=2]="UseMetricUnit",d[d.AsPercent=3]="AsPercent",d),j=((p={})[p.Common=0]="Common",p[p.Study=1]="Study",p[p.BalanceSheet=2]="BalanceSheet",p[p.IncomeStatement=3]="IncomeStatement",p[p.Forward=4]="Forward",p[p.Seasonal=5]="Seasonal",p[p.Event=6]="Event",p[p.Option=7]="Option",p),K=((f={})[f.None=0]="None",f[f.Value=1]="Value",f[f.Percent=2]="Percent",f),q=((m={})[m.Linear=0]="Linear",m[m.Logarithmic=1]="Logarithmic",m),X=((g={})[g.Symbol=0]="Symbol",g[g.Expression=1]="Expression",g[g.Study=2]="Study",g[g.Forward=3]="Forward",g[g.BalanceSheet=4]="BalanceSheet",g[g.IncomeStatement=5]="IncomeStatement",g[g.Seasonal=6]="Seasonal",g),Z=((y={})[y.Normal=0]="Normal",y[y.Forward=1]="Forward",y[y.HistoricalForward=2]="HistoricalForward",y[y.Study=3]="Study",y[y.BalanceSheet=4]="BalanceSheet",y[y.IncomeStatement=5]="IncomeStatement",y[y.Events=6]="Events",y[y.Options=7]="Options",y),J=((T={})[T.Left=0]="Left",T[T.Center=1]="Center",T[T.Right=2]="Right",T),Q=((A={})[A.Arrow=0]="Arrow",A[A.Crosshair=1]="Crosshair",A[A.Move=2]="Move",A[A.Hand=3]="Hand",A[A.ResizeVertical=4]="ResizeVertical",A[A.Grabbing=5]="Grabbing",A[A.ResizeHorizontal=6]="ResizeHorizontal",A),ee=((S={})[S.NotApplicable=0]="NotApplicable",S[S.Left=1]="Left",S[S.Middle=2]="Middle",S[S.Right=3]="Right",S),et=((v={})[v.Shift=0]="Shift",v[v.Alt=1]="Alt",v[v.Control=2]="Control",v[v.Meta=3]="Meta",v),ei=((b={})[b.None=0]="None",b[b.Horizontal=1]="Horizontal",b[b.Vertical=2]="Vertical",b[b.Both=3]="Both",b),es=((P={})[P.Unspecified=0]="Unspecified",P[P.GBE=1]="GBE",P[P.cmdtyView=2]="cmdtyView",P[P.DemoSite=3]="DemoSite",P[P.InternalFeed=4]="InternalFeed",P[P.Widget=5]="Widget",P[P.FreeWidget=6]="FreeWidget",P),er=((C={})[C.Unspecified=0]="Unspecified",C[C.Head=1]="Head",C[C.Tail=2]="Tail",C),en=((E={})[E.wheel=0]="wheel",E[E["wheel+shift"]=1]="wheel+shift",E[E.none=2]="none",E),ea=((_={})[_.Page=0]="Page",_[_.Application=1]="Application",_),eo=((M={})[M.None=0]="None",M[M.Created=1]="Created",M[M.Deleted=2]="Deleted",M[M.Moved=3]="Moved",M[M.PointMoved=4]="PointMoved",M[M.TextChanged=5]="TextChanged",M[M.Undo=6]="Undo",M[M.Redo=7]="Redo",M[M.Cancelled=8]="Cancelled",M[M.Executed=9]="Executed",M),el=((L={})[L.None=0]="None",L[L.Min=1]="Min",L[L.Max=2]="Max",L);function eu(e,t){return function(...i){return e.apply(this,[t,...i])}}function eh(e,t,i){return function(...s){return e.apply(this,[t,i,...s])}}function ec(...e){let t=e?e.length:0,i=this;return function(...s){let r=0,n=t?e[r].apply(i,s):s[0];for(;++r<t;)n=e[r].call(i,n);return n}}function ed(e){return e}function ep(e){return null!==e}function ef(e){return e.reduce((e,t)=>e+t,0)}function em(e){let t=e.length;return t>0?ef(e)/t:0}function eg(e){return e.every(e=>null!==e)}function ey(e,t){return Array.from(Array(t)).map((t,i)=>i+e)}function eT(e,t){let i=[],s=[];return e.forEach(e=>{t(e)?i.push(e):s.push(e)}),{yes:i,no:s}}function eA(e,t){if(e.length<1)return -1;for(let i=e.length-1;i>=0;--i)if(t(e[i]))return i;return -1}function eS(e,t){return e.filter(e=>!t.includes(e))}function ev(e,t,i=ed){let s=[];return e.forEach(e=>{let r=i(e);!s.map(i).includes(r)&&t.map(i).includes(r)&&s.push(e)}),s}function eb(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function eP(e){if(!(e.length<1))return e[0]}function eC(e,t,i=null){if(e.length<1)return -1;let s=Number.isFinite(i)&&i<e.length?i:e.length-1;for(let i=s;i>=0;--i)if(t(e[i]))return i;return -1}let eE=(e,t)=>e[t];function e_(e,t,i=e=>e,s=eE,r=0,n=e.length-1){let a=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN;for(;r<n;){let o=r+n>>>1;0>a(i(s(e,o)),t)?r=o+1:n=o}return r}function eM(e,t=0,i=e.length-1,s=(e,t)=>e){if(t<0||i>=e.length)return[null,null];let r=null,n=null;for(let a=t;a<=i;a++){let t=s(e[a],a);null!=t&&t>=t&&(null==r?r=n=t:(r>t&&(r=t),n<t&&(n=t)))}return[r,n]}function eL(e,t){return Array.from({length:e},(e,i)=>t(i))}function ex(e,t){let i=eH;if(!i(e)||!i(t))return;let[s,r]=e,[n,a]=t;(i(n,s)&&s<n||i(s)&&!i(n))&&(t[0]=s),(i(a,r)&&r>a||i(r)&&!i(a))&&(t[1]=r)}let eO=null;function eI(){return null===eO&&(eO="ontouchstart"in globalThis),eO}function eD(e,t){return"Escape"===e||27===t}function ew(e,t){return"ArrowLeft"===e||37===t}function eR(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function eN(e,t=100){var i,s;let r;return i=t=>eR(e,t),s=t,r=null,function(...e){let t=this;clearTimeout(r),r=setTimeout(function(){i.apply(t,e)},s)}}function eV(e){return null!=e}function eH(...e){return e.every(e=>null!=e)}function eF(e,t){var i="round",s=e,r=-t;if(void 0===r||0==+r)return Math[i](s);if(r*=1,isNaN(s*=1)||"number"!=typeof r||r%1!=0)return NaN;let n=s.toString().split("e"),a=Math[i](+(n[0]+"e"+(n[1]?n[1]-r:-r))).toString().split("e");return+(a[0]+"e"+(a[1]?+a[1]+r:r))}function ek(e){return eH(e)&&Number.isFinite(e)}function eB(e){let t="both"===e;return[t||"vertical"===e,t||"horizontal"===e]}function eU(e,t,i){return t.includes(e)?e:i}function eW(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function e$(e,t,...i){if(!eH(e))return t;let s=e;for(let e of i){if(!eH(s)||!eW(s,e))return t;s=s[e]}return s}function eG(e){return null==e?e:JSON.parse(JSON.stringify(e))}function ez(e,t,i=!0){let s=Object.keys(t),r=Object.keys(e),n=e=>!i||r.includes(e);for(let i of s)if(n(i)){var a;let s=e[i];void 0===s||"object"!=typeof s||Array.isArray(s)?e[i]=t[i]:(a=e[i],ez(a,t[i]))}}function eY(e,t){for(let i of Object.keys(t))e[i]=e[i]||t[i]}function ej(e=[]){return e.reduce((e,t)=>(e[t.name]=t.value,e),{})}function eK(e){return e?new Date(e):null}function eq(e){let t="";for(let i in e){let s=`${i}=${encodeURIComponent(e[i])}`;t+=(t.length>0?"&":"")+s}return t}let eX=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,eZ=[1e3,60,60,24,7,30/7,12];function eJ(e){let t=eX.exec(e);if(!eH(t))return null;let i=t.slice(2,9).map(e=>eH(e)?parseFloat(e):0).reverse();return eZ.forEach((e,t)=>{for(let s=t;s<i.length;s++)i[s]=i[s]*e}),Math.floor(ef(i))}function eQ(e,t,i,s){let r=e,n=t;return 0===r||0===n?n=(r=i)/2:r>s?(n=s/r*n,r=s):r<i&&(n=i/r*n,r=i),[r,n]}function e0(){return((e=21)=>{let t="",i=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&i[e]];return t})(12)}function e1(e,t,i){return Math.min(Math.max(i,e),t)}var e2={},e3={};e3={number:e=>"number"==typeof e&&!isNaN(e),nan:e=>"number"==typeof e&&isNaN(e),integer:e=>"number"==typeof e&&!isNaN(e)&&(0|e)===e,large:e=>"number"==typeof e&&!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=>"string"==typeof e,date:e=>e instanceof Date,fn:e=>"function"==typeof e,array:e=>Array.isArray(e),boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&null!==e,null:e=>null===e,undefined:e=>void 0===e,zeroLengthString(e){return this.string(e)&&0===e.length},extension(e,t){return this.fn(e)&&this.fn(t)&&t.prototype instanceof e}};var e4={},e5={};e5=(()=>{function e(e,i,s,r,n){s===String?e3.string(e)||t(i,"string",n):s===Number?e3.number(e)||t(i,"number",n):s===Function?e3.fn(e)||t(i,"function",n):s===Boolean?e3.boolean(e)||t(i,"boolean",n):s===Date?e3.date(e)||t(i,"date",n):s===Array?e3.array(e)||t(i,"array",n):e instanceof(s||Object)||t(i,r,n)}function t(e,t,i){throw Error("number"==typeof i?`The argument [ ${e||"unspecified"} ], at index [ ${i.toString()} ] must be a [ ${t||"unknown"} ]`:`The argument [ ${e||"unspecified"} ] must be a [ ${t||"Object"} ]`)}function i(e,t){throw Error(`The argument [ ${e||"unspecified"} ] failed a validation check [ ${t||"No description available"} ]`)}return{argumentIsRequired(t,i,s,r){e(t,i,s,r)},argumentIsOptional(t,s,r,n,a,o){null!=t&&(e(t,s,r,n),e3.fn(a)&&!a(t)&&i(s,o))},argumentIsArray(t,i,s,r){if(this.argumentIsRequired(t,i,Array),s){let n;n="function"==typeof s&&s!==Function?(e,t)=>void 0!==s.prototype&&e instanceof s||s(e,`${i}[${t}]`):(t,n)=>e(t,i,s,r,n),t.forEach((e,t)=>{n(e,t)})}},argumentIsValid(e,t,s,r){s(e)||i(t,r)},areEqual(e,t,i,s){if(e!==t)throw Error(`The objects must be equal [${i||e.toString()}] and [${s||t.toString()}]`)},areNotEqual(e,t,i,s){if(e===t)throw Error(`The objects cannot be equal [${i||e.toString()}] and [${s||t.toString()}]`)}}})(),e4=(()=>{let e={};return e.camel={},e.camel.violations=/\b[A-Z]/g,{startCase:e=>e.split(" ").reduce((e,t)=>(0!==t.length&&e.push(t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()),e),[]).join(" "),camelCase:t=>(e5.argumentIsRequired(t,"s",String),t.replace(e.camel.violations,e=>e.toLocaleLowerCase())),truncate:(e,t)=>e3.string(e)&&e.length>t?e.substring(0,t)+" ...":e,padLeft(e,t,i){if(e5.argumentIsRequired(e,"s",String),e5.argumentIsRequired(t,"length",Number),e5.argumentIsRequired(i,"character",String),1!==i.length)throw Error('The "character" argument must be one character in length.');return i.repeat(t-e.length)+e},format:(e,...t)=>(e5.argumentIsRequired(e,"s",String),e.replace(/{(\d+)}/g,(e,i)=>{let s;if(i<t.length){let r=t[i];s=e3.undefined(r)||e3.null(r)?e:r.toString()}else s=e;return s}))}})();var e6={},e7={};e7=(()=>{let e=new Map;class t{constructor(i,s){e5.argumentIsRequired(i,"code",String),e5.argumentIsRequired(s,"description",String),this._code=i,this._description=s;let r=this.constructor;e.has(r)||e.set(r,[]),null===t.fromCode(r,i)&&e.get(r).push(this)}get code(){return this._code}get description(){return this._description}equals(e){return e===this||e instanceof t&&e.constructor===this.constructor&&e.code===this.code}toJSON(){return this.code}static fromCode(e,i){return t.getItems(e).find(e=>e.code===i)||null}static getItems(t){return e.get(t)||[]}toString(){return"[Enum]"}}return t})(),e6=(()=>{class e extends e7{constructor(e,t,i){super(e,t),this._id=i}get id(){return this._id}toJSON(){return this._id}static parse(t){return e7.fromCode(e,t)}static fromId(t){return e7.getItems(e).find(e=>e.id===t)||null}static get STOCK(){return t}static get STOCK_OPTION(){return i}static get FUTURE(){return s}static get FUTURE_OPTION(){return r}static get FOREX(){return n}static get CMDTY_STATS(){return a}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}let t=new e("STK","U.S. Equity",1),i=new e("STKOPT","Equity Option",34),s=new e("FUT","Future",2),r=new e("FUTOPT","Future Option",12),n=new e("FOREX","FOREX",10),a=new e("CMDTY","cmdtyStats",24);return e})(),e2=(()=>{class e{constructor(){}static getIsConcrete(e){return e3.string(e)&&!this.getIsReference(e)}static getIsReference(e){return e3.string(e)&&n.futures.alias.test(e)}static getIsFuture(e){return e3.string(e)&&(n.futures.concrete.test(e)||n.futures.alias.test(e))}static getIsCash(t){return e.getIsFuture(t)&&n.futures.cash.test(t)}static getIsFutureSpread(e){return e3.string(e)&&n.futures.spread.test(e)}static getIsFutureOption(e){return e3.string(e)&&(n.futures.options.short.test(e)||n.futures.options.long.test(e)||n.futures.options.historical.test(e))}static getIsForex(e){return e3.string(e)&&n.forex.test(e)}static getIsCrypto(e){return e3.string(e)&&n.crypto.test(e)}static getIsIndex(e){return e3.string(e)&&n.indicies.external.test(e)}static getIsSector(e){return e3.string(e)&&n.indicies.sector.test(e)}static getIsCanadianFund(e){return e3.string(e)&&n.funds.canadian.test(e)}static getIsCmdty(e){return e3.string(e)&&(n.cmdty.stats.test(e)||n.cmdty.internal.test(e)||n.cmdty.external.test(e))}static getIsCmdtyStats(e){return e3.string(e)&&n.cmdty.stats.test(e)}static getIsBats(e){return e3.string(e)&&r.bats.test(e)}static getIsEquityOption(e){return e3.string(e)&&n.equities.options.test(e)}static getIsExpired(t){let i=e.parseInstrumentType(t),r=!1;if(null!==i&&i.year&&i.month){let e=l();i.year<e?r=!0:i.year===e&&s.hasOwnProperty(i.month)&&new Date().getMonth()+1>s[i.month]&&(r=!0)}return r}static getIsC3(e){return e3.string(e)&&(n.c3.concrete.test(e)||n.c3.alias.test(e))}static getIsPlatts(e){return e3.string(e)&&(n.platts.concrete.test(e)||n.platts.alias.test(e))}static getIsPit(e,t){return e3.string(e)&&e3.string(t)&&r.pit.test(t)}static getIsGrainBid(e){return e3.string(e)&&n.bids.test(e)}static parseInstrumentType(e){if(!e3.string(e))return null;let t=null;for(let i=0;i<a.length&&null===t;i++)t=(0,a[i])(e);return t}static getProducerSymbol(e){if(!e3.string(e))return null;let t=null;for(let i=0;i<o.length&&null===t;i++)t=(0,o[i])(e);return t}static getFuturesOptionPipelineFormat(t){let i=e.parseInstrumentType(t),s=null;if("future_option"===i.type){let e=c(i.option_type);s=`${i.root}${i.month}${u(i.year,1)}|${i.strike}${e}`}return s}static getFuturesExplicitFormat(t){let i=null;if(e.getIsFuture(t)&&e.getIsConcrete(t)){let s=e.parseInstrumentType(t);i=`${s.root}${s.month}${e4.padLeft(Math.floor(s.year%100).toString(),2,"0")}`}return i}static getFuturesYear(e,t){return h(e,t)}static displayUsingPercent(e){return e3.string(e)&&r.percent.test(e)}toString(){return"[SymbolParser]"}}let t={F:"A",G:"B",H:"C",J:"D",K:"E",M:"I",N:"L",Q:"O",U:"P",V:"R",X:"S",Z:"T"},i={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},s={F:1,G:2,H:3,J:4,K:5,M:6,N:7,Q:8,U:9,V:10,X:11,Z:12},r={};r.bats=/^(.*)\.BZ$/i,r.percent=/(\.RT)$/,r.pit=/\(P(it)?\)/;let n={};n.bids=/^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i,n.c3={},n.c3.alias=/^(C3:)(.*)$/i,n.c3.concrete=/(\.C3)$/i,n.cmdty={},n.cmdty.stats=/(\.CS)$/i,n.cmdty.internal=/(\.CM)$/i,n.cmdty.external=/(\.CP)$/i,n.crypto=/^\^([A-Z]{3})([A-Z]{3,4})$/i,n.equities={},n.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,n.forex=/^\^([A-Z]{3})([A-Z]{3})$/i,n.funds={},n.funds.canadian=/(.*)(\.CF)$/i,n.futures={},n.futures.alias=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1,2})$/i,n.futures.concrete=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,n.futures.spread=/^_S_/i,n.futures.cash=/(.*)(Y00)$/,n.futures.options={},n.futures.options.historical=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,n.futures.options.long=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,n.futures.options.short=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,n.indicies={},n.indicies.external=/^\$(.*)$/i,n.indicies.sector=/^\-(.*)$/i,n.platts={},n.platts.alias=/^(PLATTS:)(.*)$/i,n.platts.concrete=/^(.*)(\.PT)$/i;let a=[];a.push(e=>{let t=null;return n.futures.spread.test(e)&&((t={}).symbol=e,t.type="future_spread"),t}),a.push(e=>{let t=null,i=e.match(n.futures.concrete);return null!==i&&((t={}).symbol=e,t.type="future",t.asset=e6.FUTURE,t.dynamic=!1,t.root=i[1],t.month=i[2],t.year=h(i[3],i[2])),t}),a.push(e=>{let t=null,i=e.match(n.futures.alias);return null!==i&&((t={}).symbol=e,t.type="future",t.asset=e6.FUTURE,t.dynamic=!0,t.root=i[1],t.dynamicCode=i[3]),t}),a.push(e=>{let t=null;return n.forex.test(e)&&((t={}).symbol=e,t.type="forex",t.asset=e6.FOREX),t}),a.push(e=>{let t=null,i=e.match(n.equities.options);if(null!==i){let s=void 0!==i[4]?i[4]:"";(t={}).symbol=e,t.type="equity_option",t.asset=e6.STOCK_OPTION,t.option_type="C"===i[9]?"call":"put",t.strike=parseFloat(i[8]),t.root=`${i[1]}${s}`,t.month=parseInt(i[6]),t.day=parseInt(i[7]),t.year=parseInt(i[5]),t.adjusted=""!==i[3]}return t}),a.push(e=>{let t=null;return n.indicies.external.test(e)&&((t={}).symbol=e,t.type="index"),t}),a.push(e=>{let t=null;return n.indicies.sector.test(e)&&((t={}).symbol=e,t.type="sector"),t}),a.push(e=>{let t=null,i=e.match(n.futures.options.short);if(null!==i){let s,r;t={};let n=i[4].charCodeAt(0);n<80?(s="call",r=n-67):(s="put",r=n-80),t.symbol=e,t.type="future_option",t.asset=e6.FUTURE_OPTION,t.option_type=s,t.strike=parseInt(i[3]),t.root=i[1],t.month=i[2],t.year=l()+r}return t}),a.push(e=>{var t;let s=null,r=e.match(n.futures.options.long)||e.match(n.futures.options.historical);return null!==r&&((s={}).symbol=e,s.type="future_option",s.asset=e6.FUTURE_OPTION,s.option_type="C"===r[5]?"call":"put",s.strike=parseInt(r[4]),s.root=r[1],s.month=i[t=r[2]]||t,s.year=h(r[3])),s}),a.push(e=>{let t=null;return null!==e.match(n.cmdty.stats)&&((t={}).symbol=e,t.type="cmdtyStats",t.asset=e6.CMDTY_STATS),t});let o=[];function l(){return new Date().getFullYear()}function u(e,t){let i=e.toString();return i.substring(i.length-t,i.length)}function h(e,t){let i=l(),s=parseInt(e);if(0===s&&"Y"===t)s=100*Math.floor(i/100)+100;else if(s<10&&1===e.length){let e=+(s<i%10);s=10*Math.floor(i/10)+s+10*e}else s<100&&(s=100*Math.floor(i/100)+s,i+25<s&&(s-=100));return s}function c(e){return"call"===e?"C":"put"===e?"P":null}return o.push(i=>{let s=null;if(e.getIsFuture(i)&&e.getIsConcrete(i)){let e=i.match(n.futures.concrete);if(null!==e){let i=e[1],r=e[2],n=h(e[3],r);if(n>l()+9){let e=t[r];e&&(s=`${i}${e}${u(n,1)}`)}}}return s}),o.push(t=>{let i=null;return e.getIsFuture(t)&&e.getIsConcrete(t)&&(i=t.replace(/(.{1,3})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,"$1$2$4")||null),i}),o.push(t=>{let i=null;if(e.getIsFutureOption(t)){let s=e.parseInstrumentType(t),r=c(s.option_type);if(s.root.length<3){let e=r.charCodeAt(0);i=`${s.root}${s.month}${s.strike}${String.fromCharCode(e+s.year-l())}`}else i=`${s.root}${s.month}${u(s.year,1)}|${s.strike}${r}`}return i}),o.push(e=>{let t=null;return n.c3.alias.test(e)&&(t=e.replace(n.c3.alias,"$2.C3")),t}),o.push(e=>{let t=null;return n.platts.alias.test(e)&&(t=e.replace(n.platts.alias,"$2.PT")),t}),o.push(e=>e),e})();var e8={};function e9(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function te(e,t){if(t.length<e)throw TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function tt(e){return(tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ti(e){te(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===tt(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):(("string"==typeof e||"[object String]"===t)&&"undefined"!=typeof console&&(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 ts(e,t){te(2,arguments);var i=ti(e),s=e9(t);if(isNaN(s))return new Date(NaN);if(!s)return i;var r=i.getDate(),n=new Date(i.getTime());return(n.setMonth(i.getMonth()+s+1,0),r>=n.getDate())?n:(i.setFullYear(n.getFullYear(),n.getMonth(),r),i)}function tr(e,t){return te(2,arguments),ts(e,12*e9(t))}function tn(e){te(1,arguments);var t=ti(e),i=new Date(0);return i.setFullYear(t.getFullYear(),0,1),i.setHours(0,0,0,0),i}function ta(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 to(e){te(1,arguments);var t=ti(e);return t.setHours(0,0,0,0),t}function tl(e,t){te(2,arguments);var i=to(e),s=to(t);return Math.round((i.getTime()-ta(i)-(s.getTime()-ta(s)))/864e5)}function tu(e){return te(1,arguments),ti(e).getFullYear()}function th(e){te(1,arguments);var t=ti(e);return t.setDate(1),t.setHours(0,0,0,0),t}function tc(t){return e(e2).parseInstrumentType(t)}e8=(()=>{let e={},t={};function i(i,s,r){e[i]=s,t[i]=r}return i("F","January",1),i("G","February",2),i("H","March",3),i("J","April",4),i("K","May",5),i("M","June",6),i("N","July",7),i("Q","August",8),i("U","September",9),i("V","October",10),i("X","November",11),i("Z","December",12),i("Y","Cash",0),{getCodeToNameMap:()=>Object.assign({},e),getCodeToNumberMap:()=>Object.assign({},t)}})();let td=function(e){let t=new Map;return(...i)=>{let s=JSON.stringify(i);return t.has(s)||t.set(s,e(...i).catch(e=>(t.delete(s),Promise.reject(e)))),t.get(s)}}(async function e(e,t){let i=await tM(e);if(!Array.isArray(i))throw Error("Invalid server response");let s=i.find(e=>e.isNearest)?.name||"";return{symbols:i.map(e=>e.name),nearest:s}}),tp=e=>td(e,function(e){te(1,arguments);var t=ti(e);return tl(t,tn(t))+1}(Date.now()));async function tf(e){if(!tC(e))return e;let{root:t,dynamic:i,dynamicCode:s}=tc(e);if(!eH(t,i,s))return null;let{symbols:r,nearest:n}=await tp(t),a=parseInt(s);if(0===a)return n;let o=a-1;return o<r.length?r[o]:null}function tm(t){return e(e2).getIsFutureOption(t)}function tg(t){return e(e2).getIsFuture(t)}let ty=/^_S_SP_([^_]+)_([^_]+)$/;function tT(e){let t=e.match(ty);return!!t&&3===t.length&&tg(t[1])&&tg(t[2])}let tA=/^([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 tS(e){return tA.test(e)}function tv(t){return e(e2).getIsEquityOption(t)}function tb(e){return String(e%100).padStart(2,"0")}function tP(e,t=!1){if(!tg(e))return e;let i=tc(e);return function(e,t,i,s=!1){return`${e}${t}${s?i:tb(i)}`}(i.root,i.month,i.year,t)}function tC(e){let t=tc(e);return eH(t)&&!0===t.dynamic}function tE(e){let t=tg(e)||tm(e),i="_S_"===e.substring(0,2);return(t||tv(e))&&!i}function t_(e){return tg(e)?"America/Chicago":"America/New_York"}async function tM(e){let t=JSON.parse(await yX("futures",`?root=${e}`));return t[e]?t[e].contracts.filter(e=>"Y"!==e.month).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 tL(t){if(!tg(t))return null;let i=tc(t),s=e(e8).getCodeToNumberMap()[i.month];return th(new Date(i.year,s-1))}function tx(e,t){let i=tc(e),s=(i.year+t)%100;return`${i.root}${i.month}${tb(s)}`}async function tO(e){let t=e=>[e,!1,!1],i=tg(e),s=tS(e),r=!!tg(e)&&"Y"===tc(e).month;if(!i&&!s||r)return t(e);if(i){let{root:t,month:i}=tc(e),s=await tf(`${t}*1`);if(!tC(e)){let s=(await tp(t))?.symbols??[];if(s.includes(e))return[e,!0,!1];for(let e of s)if(tc(e).month===i)return[e,!0,!0]}return[s,!0,!0]}if(s){let i=tA.exec(e);return t(`${i[1]}${tb(tu(new Date))}${i[3]}`)}return t(e)}function tI(e){let t=e.getRootNode();return t===document?document.body:t}function tD(e,t=document){let i=tw(e,t);return eH(i)?i.innerHTML:null}function tw(e,t=document){return tk(e,t)[0]}function tR(e,t){for(let i in t)e.style[i]=t[i]}function tN(e,t){for(let i in t)e.setAttribute(i,t[i])}function tV(e,t,i){let s=tw(`#${e}`,t);if(eH(s))return s;let r=tF(t,i);return r.id=e,r}function tH(e,t){"string"==typeof t?e.className=t:Array.isArray(t)?e.className=t.join(" "):"object"==typeof t&&(e.className="",Object.keys(t).forEach(i=>{t[i]&&e.classList.add(i)}))}function tF(e,t){return e.appendChild(document.createElement(t))}function tk(e,t=document){return t.querySelectorAll(e)}function tB(e,t){e&&(e.innerHTML=t)}async function tU(e,t="asyncReadyWork"){eH(this[t])||(this[t]={});let i=this[t];return eH(i.result)?Promise.resolve(i.result):(eH(i.promise)||(i.promise=e.call(this),i.promise.then(e=>{i.result=e})),i.promise)}class tW{_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}}let t$=globalThis.devicePixelRatio||1,tG={EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:eI()?20*t$:5*t$,HALF_ANN_POINT_DIMENSION:eI()?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,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,MAXIMUM_BAR_WIDTH:180,MINIMUM_BARS_VISIBLE:5,COLOR_TRANSPARENT:"rgba(0, 0, 0, 0)",AT_LINE:"line",AT_LINE_2:"line2",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:0x1d4d4c5a75dde5},CROSSHAIR_ID:"crosshair_elem_id",ZOOM_X_AXIS_PERCENT:.02,DEFAULT_MAX_RECORDS:640,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:3e5,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:[W.Renko,W.LineBreak,W.Kagi,W.PointAndFigure],INTRA_THRESHOLD:eJ("P30D"),ONE_DAY_MILLIS:eJ("P1D"),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:eJ("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,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",value:14},{name:"Source",value:"Close"},{name:"BrickSize",value:10}],DEFAULT_LINEBREAK_INPUTS:[{name:"LineCount",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",value:14},{name:"ReversalAmount",value:30}],DEFAULT_PNF_INPUTS:[{name:"Source",value:"Close"},{name:"BoxSizeMethod",value:"ATR"},{name:"Period",value:14},{name:"BoxSize",value:20},{name:"ReversalAmount",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"};var tz={},tY={};tY=function(e,t,i,s){if(!e3.number(e))return"";(!e3.string(i)||i.length>1)&&(i="");let r=e<0&&!0===s;r&&(e=0-e);let n=e.toFixed(t);if(i&&(e<-999||e>999)){let s=n.length,a=e<0,o=0===t,l=0,u=[];for(let e=s-1;!(e<0);e--){3!==l||a&&0===e||(u.unshift(i),l=0);let t=n.charAt(e);u.unshift(t),o?l+=1:"."===t&&(o=!0)}r&&(u.unshift("("),u.push(")")),n=u.join("")}else r&&(n="("+n+")");return n};var tj={};tj=function(e,t,i,s,r){var n;let a,o;if(!e3.number(e)||!e3.number(t)||!e3.number(i))return"";(!e3.string(s)||s.length>1)&&(s=".");let l=Math.abs(e),u=function(e,t){let i=Math.floor(e);return 0===i&&""===t?"":i}(l,s),h=(n=Math.floor(parseFloat(((l-Math.floor(l))*t).toFixed(1))),("000"+Math.floor(n)).substr(-1*i));return e<0?(r=e3.boolean(r)&&r)?(a="(",o=")"):(a="-",o=""):(a="",o=""),[a,u,s,h,o].join("")};var tK={},tq={},tX={};!function(e){var t,i="[big.js] ",s=i+"Invalid ",r=s+"decimal places",n=s+"rounding mode",a=i+"Division by zero",o={},l=void 0,u=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function h(e,t,i,s){var r=e.c;if(i===l&&(i=e.constructor.RM),0!==i&&1!==i&&2!==i&&3!==i)throw Error(n);if(t<1)s=3===i&&(s||!!r[0])||0===t&&(1===i&&r[0]>=5||2===i&&(r[0]>5||5===r[0]&&(s||r[1]!==l))),r.length=1,s?(e.e=e.e-t+1,r[0]=1):r[0]=e.e=0;else if(t<r.length){if(s=1===i&&r[t]>=5||2===i&&(r[t]>5||5===r[t]&&(s||r[t+1]!==l||1&r[t-1]))||3===i&&(s||!!r[0]),r.length=t,s){for(;++r[--t]>9;)if(r[t]=0,0===t){++e.e,r.unshift(1);break}}for(t=r.length;!r[--t];)r.pop()}return e}function c(e,t,i){var s=e.e,r=e.c.join(""),n=r.length;if(t)r=r.charAt(0)+(n>1?"."+r.slice(1):"")+(s<0?"e":"e+")+s;else if(s<0){for(;++s;)r="0"+r;r="0."+r}else if(s>0)if(++s>n)for(s-=n;s--;)r+="0";else s<n&&(r=r.slice(0,s)+"."+r.slice(s));else n>1&&(r=r.charAt(0)+"."+r.slice(1));return e.s<0&&i?"-"+r:r}o.abs=function(){var e=new this.constructor(this);return e.s=1,e},o.cmp=function(e){var t,i=this.c,s=(e=new this.constructor(e)).c,r=this.s,n=e.s,a=this.e,o=e.e;if(!i[0]||!s[0])return i[0]?r:s[0]?-n:0;if(r!=n)return r;if(t=r<0,a!=o)return a>o^t?1:-1;for(r=-1,n=(a=i.length)<(o=s.length)?a:o;++r<n;)if(i[r]!=s[r])return i[r]>s[r]^t?1:-1;return a==o?0:a>o^t?1:-1},o.div=function(e){var t=this.constructor,i=this.c,s=(e=new t(e)).c,n=this.s==e.s?1:-1,o=t.DP;if(o!==~~o||o<0||o>1e6)throw Error(r);if(!s[0])throw Error(a);if(!i[0])return e.s=n,e.c=[e.e=0],e;var u,c,d,p,f,m=s.slice(),g=u=s.length,y=i.length,T=i.slice(0,u),A=T.length,S=e,v=S.c=[],b=0,P=o+(S.e=this.e-e.e)+1;for(S.s=n,n=P<0?0:P,m.unshift(0);A++<u;)T.push(0);do{for(d=0;d<10;d++){if(u!=(A=T.length))p=u>A?1:-1;else for(f=-1,p=0;++f<u;)if(s[f]!=T[f]){p=s[f]>T[f]?1:-1;break}if(p<0){for(c=A==u?s:m;A;){if(T[--A]<c[A]){for(f=A;f&&!T[--f];)T[f]=9;--T[f],T[A]+=10}T[A]-=c[A]}for(;!T[0];)T.shift()}else break}v[b++]=p?d:++d,T[0]&&p?T[A]=i[g]||0:T=[i[g]]}while((g++<y||T[0]!==l)&&n--)return!v[0]&&1!=b&&(v.shift(),S.e--,P--),b>P&&h(S,P,t.RM,T[0]!==l),S},o.eq=function(e){return 0===this.cmp(e)},o.gt=function(e){return this.cmp(e)>0},o.gte=function(e){return this.cmp(e)>-1},o.lt=function(e){return 0>this.cmp(e)},o.lte=function(e){return 1>this.cmp(e)},o.minus=o.sub=function(e){var t,i,s,r,n=this.constructor,a=this.s,o=(e=new n(e)).s;if(a!=o)return e.s=-o,this.plus(e);var l=this.c.slice(),u=this.e,h=e.c,c=e.e;if(!l[0]||!h[0])return h[0]?e.s=-o:l[0]?e=new n(this):e.s=1,e;if(a=u-c){for((r=a<0)?(a=-a,s=l):(c=u,s=h),s.reverse(),o=a;o--;)s.push(0);s.reverse()}else for(i=((r=l.length<h.length)?l:h).length,a=o=0;o<i;o++)if(l[o]!=h[o]){r=l[o]<h[o];break}if(r&&(s=l,l=h,h=s,e.s=-e.s),(o=(i=h.length)-(t=l.length))>0)for(;o--;)l[t++]=0;for(o=t;i>a;){if(l[--i]<h[i]){for(t=i;t&&!l[--t];)l[t]=9;--l[t],l[i]+=10}l[i]-=h[i]}for(;0===l[--o];)l.pop();for(;0===l[0];)l.shift(),--c;return l[0]||(e.s=1,l=[c=0]),e.c=l,e.e=c,e},o.mod=function(e){var t,i=this,s=i.constructor,r=i.s,n=(e=new s(e)).s;if(!e.c[0])throw Error(a);return(i.s=e.s=1,t=1==e.cmp(i),i.s=r,e.s=n,t)?new s(i):(r=s.DP,n=s.RM,s.DP=s.RM=0,i=i.div(e),s.DP=r,s.RM=n,this.minus(i.times(e)))},o.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},o.plus=o.add=function(e){var t,i,s,r=this.constructor;if(e=new r(e),this.s!=e.s)return e.s=-e.s,this.minus(e);var n=this.e,a=this.c,o=e.e,l=e.c;if(!a[0]||!l[0])return l[0]||(a[0]?e=new r(this):e.s=this.s),e;if(a=a.slice(),t=n-o){for(t>0?(o=n,s=l):(t=-t,s=a),s.reverse();t--;)s.push(0);s.reverse()}for(a.length-l.length<0&&(s=l,l=a,a=s),t=l.length,i=0;t;a[t]%=10)i=(a[--t]=a[t]+l[t]+i)/10|0;for(i&&(a.unshift(i),++o),t=a.length;0===a[--t];)a.pop();return e.c=a,e.e=o,e},o.pow=function(e){var t=this,i=new t.constructor("1"),r=i,n=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(s+"exponent");for(n&&(e=-e);1&e&&(r=r.times(t)),e>>=1;)t=t.times(t);return n?i.div(r):r},o.prec=function(e,t){if(e!==~~e||e<1||e>1e6)throw Error(s+"precision");return h(new this.constructor(this),e,t)},o.round=function(e,t){if(e===l)e=0;else if(e!==~~e||e<-1e6||e>1e6)throw Error(r);return h(new this.constructor(this),e+this.e+1,t)},o.sqrt=function(){var e,t,s,r=this.constructor,n=this.s,a=this.e,o=new r("0.5");if(!this.c[0])return new r(this);if(n<0)throw Error(i+"No square root");0===(n=Math.sqrt(+c(this,!0,!0)))||n===1/0?((t=this.c.join("")).length+a&1||(t+="0"),a=((a+1)/2|0)-(a<0||1&a),e=new r(((n=Math.sqrt(t))==1/0?"5e":(n=n.toExponential()).slice(0,n.indexOf("e")+1))+a)):e=new r(n+""),a=e.e+(r.DP+=4);do s=e,e=o.times(s.plus(this.div(s)));while(s.c.slice(0,a).join("")!==e.c.slice(0,a).join(""))return h(e,(r.DP-=4)+e.e+1,r.RM)},o.times=o.mul=function(e){var t,i=this.constructor,s=this.c,r=(e=new i(e)).c,n=s.length,a=r.length,o=this.e,l=e.e;if(e.s=this.s==e.s?1:-1,!s[0]||!r[0])return e.c=[e.e=0],e;for(e.e=o+l,n<a&&(t=s,s=r,r=t,l=n,n=a,a=l),t=Array(l=n+a);l--;)t[l]=0;for(o=a;o--;){for(a=0,l=n+o;l>o;)a=t[l]+r[o]*s[l-o-1]+a,t[l--]=a%10,a=a/10|0;t[l]=a}for(a?++e.e:t.shift(),o=t.length;!t[--o];)t.pop();return e.c=t,e},o.toExponential=function(e,t){var i=this,s=i.c[0];if(e!==l){if(e!==~~e||e<0||e>1e6)throw Error(r);for(i=h(new i.constructor(i),++e,t);i.c.length<e;)i.c.push(0)}return c(i,!0,!!s)},o.toFixed=function(e,t){var i=this,s=i.c[0];if(e!==l){if(e!==~~e||e<0||e>1e6)throw Error(r);for(i=h(new i.constructor(i),e+i.e+1,t),e=e+i.e+1;i.c.length<e;)i.c.push(0)}return c(i,!1,!!s)},o.toJSON=o.toString=function(){var e=this.constructor;return c(this,this.e<=e.NE||this.e>=e.PE,!!this.c[0])},o.toNumber=function(){var e=+c(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(i+"Imprecise conversion");return e},o.toPrecision=function(e,t){var i=this,r=i.constructor,n=i.c[0];if(e!==l){if(e!==~~e||e<1||e>1e6)throw Error(s+"precision");for(i=h(new r(i),e,t);i.c.length<e;)i.c.push(0)}return c(i,e<=i.e||i.e<=r.NE||i.e>=r.PE,!!n)},o.valueOf=function(){var e=this.constructor;if(!0===e.strict)throw Error(i+"valueOf disallowed");return c(this,this.e<=e.NE||this.e>=e.PE,!0)},(t=function e(){function t(i){if(!(this instanceof t))return i===l?e():new t(i);if(i instanceof t)this.s=i.s,this.e=i.e,this.c=i.c.slice();else{if("string"!=typeof i){if(!0===t.strict&&"bigint"!=typeof i)throw TypeError(s+"value");i=0===i&&1/i<0?"-0":String(i)}!function(e,t){var i,r,n;if(!u.test(t))throw Error(s+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(i=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(i<0&&(i=r),i+=+t.slice(r+1),t=t.substring(0,r)):i<0&&(i=t.length),n=t.length,r=0;r<n&&"0"==t.charAt(r);)++r;if(r==n)e.c=[e.e=0];else{for(;n>0&&"0"==t.charAt(--n););for(e.e=i-r-1,e.c=[],i=0;r<=n;)e.c[i++]=+t.charAt(r++)}}(this,i)}this.constructor=t}return t.prototype=o,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.strict=!1,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}()).default=t.Big=t,"function"==typeof define&&define.amd?define(function(){return t}):tX?tX=t:e.Big=t}(tX),tq=(()=>{class e{constructor(e){this._big=o(e)}add(t){return new e(this._big.plus(o(t)))}subtract(t){return new e(this._big.minus(o(t)))}multiply(t){return new e(this._big.times(o(t)))}divide(t){return new e(this._big.div(o(t)))}raise(t){return e5.argumentIsRequired(t,"exponent",Number),new e(this._big.pow(t))}round(t,i){e5.argumentIsRequired(t,"places",Number),e5.argumentIsOptional(i,"mode",l,"RoundingMode");let s=i||l.NORMAL;return new e(this._big.round(t,s.value))}mod(t){return new e(this._big.mod(o(t)))}absolute(){return new e(this._big.abs())}opposite(){return this.multiply(-1)}getIsZero(e,i){return e5.argumentIsOptional(e,"approximate",Boolean),e5.argumentIsOptional(i,"places",Number),this._big.eq(t)||e3.boolean(e)&&e&&this.round(i||tX.DP,l.NORMAL).getIsZero()}getIsPositive(){return this._big.gt(t)}getIsNegative(){return this._big.lt(t)}getIsGreaterThan(e){return this._big.gt(o(e))}getIsGreaterThanOrEqual(e){return this._big.gte(o(e))}getIsLessThan(e){return this._big.lt(o(e))}getIsLessThanOrEqual(e){return this._big.lte(o(e))}getIsBetween(e,t,i){return(e5.argumentIsOptional(i,"exclusive",Boolean),e3.boolean(i)&&i)?this.getIsGreaterThan(e)&&this.getIsLessThan(t):this.getIsGreaterThanOrEqual(e)&&this.getIsLessThanOrEqual(t)}getIsEqual(e){return this._big.eq(o(e))}getIsApproximate(t,i){if(0===i)return this.getIsEqual(t);let s=this.subtract(t).absolute(),r=e.ONE.divide(new e(10).raise(i));return s.getIsLessThan(r)}getIsInteger(){return this.getIsEqual(this.round(0))}getDecimalPlaces(){let e=this.toFixed().match(/-?\d*\.(\d*)/);return null===e?0:e[1].length}toFloat(e){return e5.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 e5.argumentIsRequired(t,"value",e,"Decimal"),new e(t._big)}static parse(t){return new e(t)}static get ZERO(){return r}static get ONE(){return n}static get NEGATIVE_ONE(){return a}static get ROUNDING_MODE(){return l}static getIsZero(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsZero()}static getIsNotZero(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),!t.getIsZero()}static getIsPositive(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()}static getIsNotPositive(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()}static getIsNotNegative(t){return e5.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,i){return(e5.argumentIsRequired(t,"a",e,"Decimal"),e5.argumentIsRequired(i,"b",e,"Decimal"),t._big.gt(i._big))?1:t._big.lt(i._big)?-1:0}toString(){return"[Decimal]"}}let t=new tX(0),i=new tX(1),s=new tX(-1),r=new e(t),n=new e(i),a=new e(s);function o(t){return t instanceof tX?t:t instanceof e?t._big:new tX(t)}class l extends e7{constructor(e,t){super(e.toString(),t),this._value=e}get value(){return this._value}static get UP(){return u}static get DOWN(){return h}static get NORMAL(){return c}toString(){return"[RoundingMode]"}}let u=new l(3,"up"),h=new l(0,"down"),c=new l(1,"normal");return e})(),tK=(()=>{class e extends e7{constructor(e,t,i,s,r,n,a,o){super(e,e),this._baseCode=t,this._decimalDigits=i,this._supportsFractions=s,s?(this._fractionFactor=r,this._fractionDigits=n,this._fractionFactorSpecial=a||r,this._fractionDigitsSpecial=o||n):(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!0===e?this._fractionFactorSpecial:this._fractionFactor}getFractionDigits(e){return!0===e?this._fractionDigitsSpecial:this._fractionDigits}getMinimumTick(e){e5.argumentIsValid(e,"tickIncrement",e3.integer,"must be an integer");let t=new tq(1),i=new tq(10);return(this.supportsFractions?t.divide(this._fractionFactor):t.divide(i.raise(this._decimalDigits))).multiply(e).toFloat()}getMinimumTickValue(e,t){return e5.argumentIsValid(e,"tickIncrement",e3.integer,"must be an integer"),e5.argumentIsValid(t,"pointValue",e3.number,"must be a number"),new tq(this.getMinimumTick(e)).multiply(t).toFloat()}roundToNearestTick(e,t,i){let s;e5.argumentIsValid(e,"value",e=>e3.number(e)||e instanceof tq,"must be a number primitive or a Decimal instance"),e5.argumentIsValid(t,"minimumTick",e=>e3.number(e)||e instanceof tq,"must be a number primitive or a Decimal instance"),e5.argumentIsOptional(i,"roundToZero",Boolean);let r=(s=e instanceof tq?e:new tq(e)).divide(t);return s.mod(t).getIsZero()||(r=r.round(0,e3.boolean(i)&&i?tq.ROUNDING_MODE.DOWN:tq.ROUNDING_MODE.NORMAL)),r.multiply(t).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(t){return e7.fromCode(e,t)}static fromBaseCode(t){return e7.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})(),tz=function(e,t,i,s,r,n){if(!e3.number(e))return"";let a=tK.parse(t);if(null===a)return"";if((!e3.string(i)||i.length>1)&&(i="."),s=e3.boolean(s)&&s,n=e3.boolean(n)&&n,!a.supportsFractions||"."===i)return tY(e,a.decimalDigits,r,n);{let t=a.getFractionFactor(s),r=a.getFractionDigits(s);return tj(e,t,r,i,n)}};var tZ={};tZ=(()=>{let e={};return e.ZB=/^BB\d$/,e.ZT=/^BT\d$/,e.ZF=/^BF\d$/,e.ZN=/^BN\d$/,function(t,i,s){if(s.asset===e6.FUTURE_OPTION){let i=s.root;if("ZB"===i||"ZN"===i||e.ZB.test(i)||e.ZN.test(i))return tj(t,64,2,"-",!1);if("ZT"===i||"ZF"===i||e.ZT.test(i)||e.ZF.test(i))return tj(t,640,3,"-",!1)}return tz(t,i,"-",!0,",")}})();let tJ=[{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}];function tQ(e){if(eH(e)){let t=e$(y0().config,null,"overrides","symbology","translateSymbol");if(eH(t)&&"function"==typeof t)try{let i=t(e);if(eH(i))return i}catch(t){yK(`Failed translating the symbol '${e}', error is ${t.message}`,"warn")}}return e}function t0(t,i,s){if(null==t)return"";if(!this.isReady)return t.toFixed(0);if(i.format===Y.FromMetaData)return function(t,i,s){let r=y0().config;return r.mode===es[es.cmdtyView]&&null!=s?e(tZ)(t,i,s):e(tz)(t,i,"-",r.isAlt64,",",!1)}(t,this.unitCode,this._profile);switch(i.format){case Y.AsInteger:return t.toFixed();case Y.UseMetricUnit:{let e=Object.assign({},{range:[t,t],allDigits:!1},s=s||{});if(s.allDigits)return t3(t,0);Array.isArray(e.range)&&e.range.length||(e.range=[t,t]);let i=Math.max(Math.abs(e.range[0]),Math.abs(e.range[1])),r=function(e,t){let i=eA(e,t);return -1===i?null:e[i]}(tJ,e=>i>e.min)||tJ[0];return`${(t/r.divider).toFixed(r.decimals)}${r.suffix}`}case Y.AsPercent:return`${(100*t).toFixed(2)}%`;default:return""}}function t1(e,t,i){let s=i?.overridePrecision;return Number.isFinite(s)&&s>=0?t3(e,s):null}class t2{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=t_(tQ(this.symbol)),this._profile=null}initialize(e){t6(e)||ez(this,e),this._profile=e}get isReady(){return this.unitCode.length>0}get minMovement(){if(!this.isReady)return 0;if(null==this._minMovement){let e=Number.parseInt(this.unitCode,16);this._minMovement=this.tickIncrement*(1/(e<8?2<<e:10**(e-8)))}return this._minMovement}format(e,t,i){let s=t1(e,t,i);return null!==s?s:t0.call(this,e,t,i)}parse(e){throw Error("Not implemented yet")}getInlineMetadata(e){let t=tD(`#${tG.INLINE_DATA_ELEMENT_ID}`);if(!eH(t))return null;let i=JSON.parse(t),s=e;return s in i||(s=function(e,t){if(!tg(e))return e;let i=tc(e);return t.find(e=>tc(e).root===i.root)||e}(e,Object.keys(i)))in i?i[s].instrument:null}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),i=await yX("ondemand",`/${this.getFallbackApi()}.json?symbols=${t}`),s=JSON.parse(i);if(200===s.status.code&&1===s.results.length){let e=s.results[0];return this.processFallback(e)}}catch(t){yK(`Failed fetching the metadata for ${e}, error is ${t.message}`,"warn")}return{name:"",exchange:"",unitCode:"A",pointValue:1,tickIncrement:1}}}function t3(t,i){return e(tY)(t,i,",",!1)}function t4(e,t=!1){return new is(e,t)}class t5 extends t2{shutdown(){}async ready(){return tU.call(this,async()=>{let e=tQ(this.symbol),t=this.getInlineMetadata(e);return t6(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0})}getCacheableEntities(e){e.add(this)}}function t6(e){return!eV(e)||!eH(e.unitCode,e.name,e.exchange)||0===e.unitCode.length}class t7 extends t2{shutdown(){}equityOptionProfile(){return{name:this.symbol,exchange:"",unitCode:"A",pointValue:1,tickIncrement:1,symbolType:"EquityOption"}}async ready(){return tU.call(this,async()=>{let e=tQ(this.symbol);if(tv(e))return this.initialize(this.equityOptionProfile()),!0;let t=tC(e),i=await (t?tf(e):e);this.resolved=tP(i);let[s,r]=await tO(this.resolved),n=new Promise(e=>{setTimeout(()=>e(null),tG.META_DATA_GET_TIMETOUT)}),a=await Promise.race([n,this.getProfile(s)]);return t6(a)&&(a=this.getInlineMetadata(s)),t6(a)&&(a=await this.getFallbackMetadata(s)),a?.symbolType==="Unknown"&&r&&(a.symbolType="Future"),this.initialize(a),!0})}async getProfile(e){return Promise.reject(Error("Method shold be implemented in the derived class."))}getCacheableEntities(e){e.add(this)}}class t8 extends t7{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=y0(),i=await t.connection.getMarketState().getProfile(e);return{symbolType:this.getType(i.asset),name:i.name,exchange:i.exchange,unitCode:i.unitCode,pointValue:i.pointValue,tickIncrement:i.tickIncrement,timeZone:i.exchangeRef?.timeZoneDdf}}}var t9=((x=t9||{})[x.UNKNOWN_INSTRUMENT_TYPE=0]="UNKNOWN_INSTRUMENT_TYPE",x[x.FOREX=1]="FOREX",x[x.INDEX=2]="INDEX",x[x.EQUITY=3]="EQUITY",x[x.FUTURE=4]="FUTURE",x[x.OPTION=5]="OPTION",x[x.SPREAD=6]="SPREAD",x[x.MUTUAL_FUND=7]="MUTUAL_FUND",x[x.MONEY_MARKET_FUND=8]="MONEY_MARKET_FUND",x[x.USER_DEFINED_SPREAD=9]="USER_DEFINED_SPREAD",x[x.EQUITY_OPTION=10]="EQUITY_OPTION",x[x.OTHER=99]="OTHER",x[x.UNRECOGNIZED=-1]="UNRECOGNIZED",x);class ie extends t7{_profileSource=new tW;priceDenominator=1;quantityDenominator=1;priceScaling=1;expirationDate;asPrice(e){return void 0===e?null:e.toNumber()/this.priceDenominator*this.priceScaling}asQuantity(e){return void 0===e?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"}processFallback(e){let t=e.definition;return t.instrumentType=t9[t.instrumentType],this.getProfileFromInstrumentDefinition(t)}getProfileFromInstrumentDefinition(e){this.expirationDate=e.symbolExpiration;let{priceDenominator:t,priceScalingExponent:i,quantityDenominator:s}=e;if(0!==t&&(this.priceDenominator=t),0!==s&&(this.quantityDenominator=s),i&&0!==i){let e=1;i<0?e/=Math.pow(10,-i):e*=Math.pow(10,i),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=y0(),i=await t.adapter?.getInstrument(this.getRequest(e))??[];return i.length<1?null:this.getProfileFromInstrumentDefinition(i[0])}}class it{_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,i){if(null==e)return"";let s=t1(e,t,i);return null!==s?s:t3(e,this._decimals)}getCacheableEntities(e){}}class ii{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,i){return null==e?"":eH(e)?e.toFixed(0):""}getCacheableEntities(e){}}class is{inner;forceDecimals;unitCode="";pointValue=1;tickIncrement=1;minMovement=0;symbol="";symbolType="Unknown";resolved="";name="";exchange="";constructor(e,t=!1){let i=y0().getMetaDataSource();this.inner=e.map(e=>i.getMetaData(e)),this.forceDecimals=t}get isReady(){return null!=this.unitCode}async ready(){return tU.call(this,async()=>{let e=(await Promise.all(this.inner.map(e=>e.ready()))).every(ed);if(e){let e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:i,no:s}=eT(this.inner,e=>t(e)>=8),r=this.inner.length,n=e=>Math.max(...e).toString(16).toUpperCase();if(this.forceDecimals||i.length!==r&&s.length!==r){let r=i.map(t).concat(s.map(t).map(e=>String.fromCharCode(e-2+66)).map(e));this.unitCode=n(r)}else this.unitCode=n(this.inner.map(t));this.minMovement=Math.min(...this.inner.map(e=>e.minMovement))}return e})}format(e,t,i){let s=t1(e,t,i);return null!==s?s:t0.call(this,e,t,i)}getCacheableEntities(e){this.inner.forEach(t=>e.add(t))}shutdown(){}}class ir{metaDataCache;constructor(){this.metaDataCache=new Map}getMetaData(e){if(e===tG.PLACEHOLDER_SYMBOL_NAME)return new ii;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,i]of this.metaDataCache)e.has(i)||(i.shutdown(),this.metaDataCache.delete(t))}}class ia extends ir{metaDataCreator(e){return new t5(e)}}class io extends ir{metaDataCreator(e){return new t8(e)}}class il extends ir{metaDataCreator(e){return new ie(e)}}let iu=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,ih=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,ic=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,id={r:255,g:255,b:255,a:1},ip={r:0,g:0,b:0,a:1};function im(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function ig(e,t){let i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)}function iy(e,t){return{x:e.x-t.x,y:e.y-t.y}}function iT(e,t){return{x:e.x+t.x,y:e.y+t.y}}function iA(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function iS(e,t,i){let[s,r]=e,n=r.x-s.x,a=r.y-s.y,o=t.x-s.x,l=t.y-s.y;if(0===n&&0===a)return Math.abs(o)<=i&&Math.abs(l)<=i;let u=Math.atan2(a,n),h=Math.sqrt(n*n+a*a),c=Math.atan2(l,o),d=Math.sqrt(o*o+l*l),p=d*Math.cos(c-u);return Math.abs(d*Math.sin(c-u))<=i&&-i<=p&&p<=h+i}function iv(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(ed)}function ib(e){var t=iM(e);let i=e=>{let t=e.toString(16);return 2===t.length?t:"0"+t};return`#${i(t.r)}${i(t.g)}${i(t.b)}`}function iP(e,t){let i=iM(e);return i.a=t,iO(i)}function iC(e,t,i,s=!1){let r=e.a,n=s=>Math.floor(e[s]+(t[s]-e[s])*i);return{r:n("r"),g:n("g"),b:n("b"),a:Math.min(1,(1+(s?i:0))*r)}}let iE=(e,t=!1)=>ec(iM,i=>iC(i,ip,e,t),iO);function i_(e,t=!1){return ec(iM,i=>iC(i,id,e,t),iO)}function iM(e){if(["r","g","b","a"].map(t=>e[t]).every(e=>eH(e)))return e;let t=eH(e.linearGradient)?e._refColor:e,i=iu.exec(t);if(null!==i){let e=eH(i[2]),t=i[1]+(i[2]||""),s=i=>e?parseInt(t.substr(2*i,2),16):17*parseInt(t.charAt(i),16);return{r:s(0),g:s(1),b:s(2),a:1}}{let e=ic.exec(t),i=ih.exec(t),s=(e,t)=>eH(e)&&e.length===t,r=s(e,5),n=s(i,4);if(!r&&!n)throw Error("Color is neither a hex color nor a rgba one.");let a=r?e:i,o=e=>parseInt(a[e]),l=parseFloat(a[4]);return{r:o(1),g:o(2),b:o(3),a:r?l:1}}}function iL(e){var t;let{r:i,g:s,b:r}=iM(e),[n,a,o]=[i,s,r].map(e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)});return(t=.2126*n+.7152*a+.0722*o)<=.008856?903.3*t:116*Math.pow(t,1/3)-16}function ix(e){return iL(e)>66.66?"#000":"#fff"}function iO(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function iI(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}class iD{x;y;width;height;constructor(e,t,i,s){this.x=e,this.y=t,this.width=i,this.height=s}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 iD(this.x,this.y,this.width,this.height)}}class iw{cx;cy;radiusX;radiusY;constructor(e,t,i,s){this.cx=e,this.cy=t,this.radiusX=i,this.radiusY=s}contains(e){let t=Math.abs(e.x-this.cx)/this.radiusX,i=Math.abs(e.y-this.cy)/this.radiusY;return 1>=Math.sqrt(t*t+i*i)}}function iR(e,t){e.moveTo(t.x,t.y)}function iN(e,t){e.lineTo(t.x,t.y)}function iV(e,t,i){e.rect(t.x,t.y,i.x-t.x,i.y-t.y)}function iH(e,t=tG.LINE_HEIGHT_MULTIPLIER){return t*e.measureText("M").width}function iF(e,t=!1,i=1){let s=ik(e,t,i).y;return s-Math.sign(s)*tG.DEFAULT_ADORN_OFFSET.y}function ik(e,t=!1,i=1){let s={...tG.DEFAULT_ADORN_OFFSET};return t&&(s.y=-(i*iH(e,1)+s.y)),s}function iB(e,t,i,s=J.Left){var r;let n=Array.isArray(t)?t:[t],a=iH(e,1),o=Math.max(...n.map(t=>e.measureText(t).width)),l=a*n.length,u=i.x;return s===J.Right&&(u-=o),s===J.Center&&(u-=o/2),r=new iD(u,i.y-a,o,l),r.x-=4,r.y-=4,r.width+=8,r.height+=8,r}function iU(e,t,i,s=J.Left,r,n){e.save();let a=Array.isArray(t)?t:[t],o=iH(e,1);if(eH(n)){let r=iB(e,t,i,s);e.fillStyle=n,iW(e,r,!1)}eH(r)&&(e.fillStyle=r);let l=i.x,u=i.y;a.forEach(t=>{e.textAlign=J[s].toLowerCase(),e.fillText(t,l,u),u+=o}),e.restore()}function iW(e,t,i=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),i&&e.stroke(),e.fill()}function i$(e,t,i,s=0,r=Math.PI,n=!1,a=!1){e.beginPath(),a&&e.moveTo(t.x,t.y),e.arc(t.x,t.y,Math.abs(i),s,r,n),e.stroke(),a&&e.fill()}function iG(e,{x:t,y:i},{x:s,y:r}){e.beginPath(),e.moveTo(t,i),e.lineTo(s,r),e.stroke()}function iz(e,t,i,s){iG(e,{x:t,y:i},{x:t,y:s})}function iY(e,t,i,s){iG(e,{x:i,y:t},{x:s,y:t})}function ij(e,t,i){e.save();let s=t.centerX,r=t.centerY,n=Math.floor(Math.min(t.width/2,t.height/2));e.strokeStyle=e.fillStyle,e.lineWidth=Math.max(1,.1*n),i$(e,{x:s,y:r},n,0,2*Math.PI),e.textAlign="center",e.font=`${2*n}px Arial`,e.textBaseline="middle",e.fillText(i,s,r+.15*n),e.restore()}function iK(e,t=1){let i=Math.floor(e.centerX),s=Math.floor(e.centerY),{width:r,height:n}=e;n=(r=.9*Math.min(r,n*t))/t;let a=Math.floor(i-r/2),o=Math.floor(i+r/2),l=Math.floor(s-n/2),u=Math.floor(s+n/2);return{cx:i,cy:s,left:a,right:o,top:l,bottom:u,halfBaseSize:.21*Math.min(r,n)}}function iq(e){let t=Math.floor(e.centerX),i=Math.floor(e.centerY),{width:s,height:r}=e,n=Math.floor(Math.min(s,r)),a=Math.floor(t-(n*=.9)/2),o=Math.floor(t+n/2);return{cx:t,cy:i,left:a,right:o,arcWidth:.075*n,deflection:.3*n}}function iX(){let e=y0().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?eF(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}let iZ=(e,t)=>!0,iJ=(e,t)=>e.map((e,i)=>({shown:t(e,i),value:e,line:{width:1,color:iQ(i),dashStyle:"Solid"}})),iQ=e=>i8[e%i8.length],i0=e=>e.filter(e=>e.shown),i1={width:1,color:"#000",dashStyle:"Solid"},i2={width:1,color:"rgba(136,136,136,0.75)",dashStyle:"Dash"},i3={color:tG.COLOR_TRANSPARENT},i4={[tG.AT_SINGLE_STYLE]:!0,[tG.AT_SHOW_BACKGROUND]:!1};function i5(e,t){let i=eG(e$(e,i1,"annotationTraits","line")),s=eG(e$(e,i2,"annotationTraits","line2")),r=eG(e$(e,i3,"annotationTraits","fill")),n=sA[t],a=n?.defaults||{};y0().config.colorfulAnnotations||(ez(a,i4),("GannBox"===t||"GannSquare"===t)&&(a[tG.AT_SHOW_BACKGROUND]=!0));let o=n?.editable.includes(tG.AT_LINE_2),l=eH(a[tG.AT_LINE_2]),u={line:i,fill:r,...a};return o&&!l&&(u.line2=s),u}function i6(e,t){Object.keys(t).forEach(i=>{i===tG.LINE_DASH_PROP_NAME?e.setLineDash(t[i]):e[i]=t[i]})}function i7(e){let t=ec(iM,iO);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:iv(e.line.dashStyle)}}let i8=["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)"],i9=[tG.AT_LINE,tG.AT_ALLOW_PRICES_CHANGE_UI],se=[tG.AT_FILL,tG.AT_ALLOW_PRICES_CHANGE_UI],st=[tG.AT_LINE,tG.AT_FILL,tG.AT_ALLOW_PRICES_CHANGE_UI],si=[...st,tG.AT_FILL_TEXT],ss=[tG.AT_TEXT_LINES,tG.AT_FILL,tG.AT_ALLOW_PRICES_CHANGE_UI],sr=[...i9,tG.AT_LINE_2,tG.AT_SHOW_PRICES,tG.AT_SHOW_LEVELS,tG.AT_LEVELS_KIND,tG.AT_LABELS,tG.AT_EXTEND_LEFT,tG.AT_EXTEND_RIGHT,tG.AT_SHOW_TRENDLINE,tG.AT_FACTORS,tG.AT_PRICES_ON_SCALE,tG.AT_REVERSE,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY,tG.AT_LEVELS_RESPECT_LOG_SCALE],sn=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],sa=e=>({[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_PRICES]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_EXTEND_LEFT]:!1,[tG.AT_EXTEND_RIGHT]:!1,[tG.AT_SHOW_TRENDLINE]:!0,[tG.AT_FACTORS]:iJ(sn.slice(2),(t,i)=>0<=t&&t<=e),[tG.AT_PRICES_ON_SCALE]:!1,[tG.AT_REVERSE]:!1,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),so=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_SHOW_TRENDLINE,type:"bool"},{id:tG.AT_LINE_2,type:"line",enabledIf:tG.AT_SHOW_TRENDLINE},{id:tG.AT_EXTEND_LEFT,type:"bool"},{id:tG.AT_EXTEND_RIGHT,type:"bool"},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"},{id:tG.AT_SHOW_PRICES,type:"bool"},{id:tG.AT_PRICES_ON_SCALE,type:"bool"},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LEVELS_KIND,type:"string",enum:[tG.AT_LEVELS_PERCENTS,tG.AT_LEVELS_VALUES],enabledIf:tG.AT_SHOW_LEVELS},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]},{id:tG.AT_LEVELS_RESPECT_LOG_SCALE,type:"bool"}],sl={[tG.AT_LINE]:{color:"#3861f6",width:1,dashStyle:"Solid"},[tG.AT_FILL]:{color:"rgba(56, 97, 246, 0.2)"},[tG.AT_FILL_TEXT]:{color:"#f0f0f0"},[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},su=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_FILL,type:"color"},{id:tG.AT_FILL_TEXT,type:"color"}],sh=[0,.25,.382,.5,.618,.75,1],sc=[8,4,3,2,1].map(e=>`1/${e}`).concat([2,3,4,8].map(e=>`${e}/1`)),sd=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_SHOW_PRICES,type:"bool"},{id:tG.AT_RATIO,type:"bool"},{id:tG.AT_SHOW_PERCENTDIFF,type:"bool"},{id:tG.AT_SHOW_BARCOUNT,type:"bool"},{id:tG.AT_EXTEND_PT_1,type:"bool"},{id:tG.AT_EXTEND_PT_2,type:"bool"},{id:tG.AT_MARKER,type:"object",properties:[{id:tG.AT_KIND,type:"string",enum:[tG.AT_ARROW]},{id:tG.AT_VERTEX,type:"string",enum:[tG.AT_VERTEX_NONE,tG.AT_VERTEX_START,tG.AT_VERTEX_END,tG.AT_VERTEX_BOTH]}]}],sp=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"}],sf=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_FILL,type:"color"}],sm=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_FILL,type:"color"},{id:tG.AT_FILL2,type:"color"},{id:tG.AT_FILL_TEXT,type:"color"},{id:tG.AT_COMPACT,type:"bool"},{id:tG.AT_ACCOUNT_SIZE,type:"number"},{id:tG.AT_RISK,type:"number"},{id:tG.AT_RISK_IS_PERCENT,type:"bool"}],sg=[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_FILL,type:"color"}],sy={[tG.AT_KIND]:tG.AT_ARROW,[tG.AT_VERTEX]:tG.AT_VERTEX_NONE},sT=[tG.AT_LINE,tG.AT_RATIO,tG.AT_SHOW_PRICES,tG.AT_ALLOW_PRICES_CHANGE_UI,tG.AT_SHOW_BARCOUNT,tG.AT_SHOW_PERCENTDIFF,tG.AT_EXTEND_PT_1,tG.AT_EXTEND_PT_2,tG.AT_MARKER],sA={Line:{editable:sT,defaults:{[tG.AT_SHOW_PRICES]:!1,[tG.AT_SHOW_BARCOUNT]:!1,[tG.AT_SHOW_PERCENTDIFF]:!1,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!1,[tG.AT_MARKER]:sy,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sd,numPoints:2},Ray:{editable:sT,defaults:{[tG.AT_SHOW_PRICES]:!1,[tG.AT_SHOW_BARCOUNT]:!1,[tG.AT_SHOW_PERCENTDIFF]:!1,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!0,[tG.AT_MARKER]:sy,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sd,numPoints:2},VerticalLine:{editable:[tG.AT_LINE,tG.AT_SHOW_TIMESTAMPS,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_SHOW_TIMESTAMPS]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_SHOW_TIMESTAMPS,type:"bool"}],numPoints:1},HorizontalLine:{editable:[tG.AT_LINE,tG.AT_SHOW_PRICES,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_SHOW_PRICES]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_LINE,type:"line"},{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:1},TrendChannel:{editable:[...i9,tG.AT_EXTEND_PT_1,tG.AT_EXTEND_PT_2],defaults:{[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!1,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...sp,{id:tG.AT_EXTEND_PT_1,type:"bool"},{id:tG.AT_EXTEND_PT_2,type:"bool"}],numPoints:3},GannLine:{editable:sT,defaults:{[tG.AT_SHOW_PRICES]:!1,[tG.AT_SHOW_BARCOUNT]:!1,[tG.AT_SHOW_PERCENTDIFF]:!1,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!0,[tG.AT_MARKER]:sy,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sd,numPoints:2},SpeedResistanceArcs:{editable:i9,types:sp,numPoints:2},SpeedResistanceFan:{editable:i9,types:sp,numPoints:2},AndrewsPitchfork:{editable:i9,types:sp,numPoints:3},Rectangle:{editable:st,types:sf,numPoints:2},Ellipse:{editable:st,types:sf,numPoints:2},DateRange:{editable:si,defaults:sl,types:su,numPoints:2},PriceRange:{editable:si,defaults:sl,types:su,numPoints:2},DatePriceRange:{editable:[...si,tG.AT_DRAW_BORDER],defaults:{...sl,[tG.AT_DRAW_BORDER]:!1},types:[...su,{id:tG.AT_DRAW_BORDER,type:"bool"}],numPoints:2},GannBox:{editable:[tG.AT_LINE,tG.AT_LINE_2,tG.AT_ALLOW_PRICES_CHANGE_UI,tG.AT_PRICE_LEVELS,tG.AT_TIME_LEVELS,tG.AT_SHOW_LEFT_LABELS,tG.AT_SHOW_RIGHT_LABELS,tG.AT_SHOW_TOP_LABELS,tG.AT_SHOW_BOTTOM_LABELS,tG.AT_SHOW_ANGLES,tG.AT_REVERSE,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_LINE]:{color:"#33776b",width:1,dashStyle:"Solid"},[tG.AT_LINE_2]:{color:"#33776b",width:1,dashStyle:"Solid"},[tG.AT_PRICE_LEVELS]:iJ(sh,iZ),[tG.AT_TIME_LEVELS]:iJ(sh,iZ),[tG.AT_SHOW_LEFT_LABELS]:!0,[tG.AT_SHOW_RIGHT_LABELS]:!0,[tG.AT_SHOW_TOP_LABELS]:!0,[tG.AT_SHOW_BOTTOM_LABELS]:!0,[tG.AT_SHOW_ANGLES]:!1,[tG.AT_REVERSE]:!1,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_PRICE_LEVELS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_LEFT_LABELS,type:"bool"},{id:tG.AT_SHOW_RIGHT_LABELS,type:"bool"},{id:tG.AT_TIME_LEVELS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_TOP_LABELS,type:"bool"},{id:tG.AT_SHOW_BOTTOM_LABELS,type:"bool"},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"},{id:tG.AT_SHOW_ANGLES,type:"bool"},{id:tG.AT_LINE_2,type:"line",enabledIf:tG.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[...i9,tG.AT_LEVELS,tG.AT_FANS,tG.AT_ARCS,tG.AT_REVERSE,tG.AT_SHOW_RANGES_RATIO,tG.AT_PRICE_BAR_RATIO,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_LINE]:{color:"#712b9c",width:1,dashStyle:"Solid"},[tG.AT_LEVELS]:iJ([0,1,2,3,4,5],iZ),[tG.AT_FANS]:iJ(["8x1","5x1","4x1","3x1","2x1","1x1","1x2","1x3","1x4","1x5","1x8"],(e,t)=>t>3&&t<7),[tG.AT_ARCS]:iJ(["1x0","1x1","1.5x0","2x0","2x1","3x0","3x1","4x0","4x1","5x0","5x1"],iZ),[tG.AT_REVERSE]:!1,[tG.AT_SHOW_RANGES_RATIO]:!0,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_LEVELS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_FANS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_ARCS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"},{id:tG.AT_PRICE_BAR_RATIO,type:"number",editable:!0},{id:tG.AT_SHOW_RANGES_RATIO,type:"bool"}],numPoints:2},LongPosition:{editable:[tG.AT_LINE,tG.AT_FILL,tG.AT_FILL2,tG.AT_FILL_TEXT,tG.AT_COMPACT,tG.AT_ACCOUNT_SIZE,tG.AT_RISK,tG.AT_RISK_IS_PERCENT,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_FILL]:{color:"rgba(0, 160, 0, 0.2)"},[tG.AT_FILL2]:{color:"rgba(205, 0, 0, 0.2)"},[tG.AT_FILL_TEXT]:{color:"#fff"},[tG.AT_COMPACT]:!1,[tG.AT_ACCOUNT_SIZE]:1e3,[tG.AT_RISK]:25,[tG.AT_RISK_IS_PERCENT]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sm,numPoints:4},ShortPosition:{editable:[tG.AT_LINE,tG.AT_FILL,tG.AT_FILL2,tG.AT_FILL_TEXT,tG.AT_COMPACT,tG.AT_ACCOUNT_SIZE,tG.AT_RISK,tG.AT_RISK_IS_PERCENT,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_FILL]:{color:"rgba(205, 0, 0, 0.2)"},[tG.AT_FILL2]:{color:"rgba(0, 160, 0, 0.2)"},[tG.AT_FILL_TEXT]:{color:"#fff"},[tG.AT_COMPACT]:!1,[tG.AT_ACCOUNT_SIZE]:1e3,[tG.AT_RISK]:25,[tG.AT_RISK_IS_PERCENT]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sm,numPoints:4},FiftyPercentLine:{editable:[tG.AT_USE_52WEEK_PRICES,tG.AT_LINE,tG.AT_LINE_2,tG.AT_SHOW_PRICES,tG.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tG.AT_USE_52WEEK_PRICES]:!1,[tG.AT_SHOW_PRICES]:!0,[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_USE_52WEEK_PRICES,type:"bool"},{id:tG.AT_LINE,type:"line"},{id:tG.AT_LINE_2,type:"line"},{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:2},FibonacciRetracement:{editable:sr,defaults:sa(1),types:so,numPoints:2},TrendBasedFibExtension:{editable:sr,defaults:sa(5),types:so,numPoints:3},FibonacciFan:{editable:[...i9,tG.AT_SHOW_LEVELS,tG.AT_LABELS,tG.AT_FACTORS,tG.AT_REVERSE,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_REVERSE]:!1,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_FACTORS]:iJ(sn.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_REVERSE,type:"bool"}],numPoints:2},FibonacciArcs:{editable:[...i9,tG.AT_LINE_2,tG.AT_SHOW_TRENDLINE,tG.AT_FACTORS,tG.AT_SHOW_LEVELS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_TRENDLINE]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_FACTORS]:iJ(sn.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_SHOW_TRENDLINE,type:"bool"},{id:tG.AT_LINE_2,type:"line",enabledIf:tG.AT_SHOW_TRENDLINE},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},FibonacciChannel:{editable:[...i9,tG.AT_SHOW_PRICES,tG.AT_SHOW_LEVELS,tG.AT_LEVELS_KIND,tG.AT_LABELS,tG.AT_EXTEND_PT_1,tG.AT_EXTEND_PT_2,tG.AT_FACTORS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_PRICES]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_EXTEND_PT_1]:!1,[tG.AT_EXTEND_PT_2]:!1,[tG.AT_FACTORS]:iJ(sn.slice(2),iZ),[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_EXTEND_PT_1,type:"bool"},{id:tG.AT_EXTEND_PT_2,type:"bool"},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_PRICES,type:"bool"},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LEVELS_KIND,type:"string",enum:[tG.AT_LEVELS_PERCENTS,tG.AT_LEVELS_VALUES],enabledIf:tG.AT_SHOW_LEVELS},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[...i9,tG.AT_ANGLES,tG.AT_SHOW_LEVELS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2,[tG.AT_ANGLES]:iJ(sc,iZ)},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_ANGLES,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"string",editable:!1,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},SymbolArrowUp:{editable:se,types:sg,numPoints:1},SymbolArrowDown:{editable:se,types:sg,numPoints:1},SymbolArrowRight:{editable:se,types:sg,numPoints:1},SymbolArrowLeft:{editable:se,types:sg,numPoints:1},SymbolArrowHorizontal:{editable:se,types:sg,numPoints:1},SymbolArrowVertical:{editable:se,types:sg,numPoints:1},SymbolArcDown:{editable:se,types:sg,numPoints:1},SymbolArcUp:{editable:se,types:sg,numPoints:1},SymbolThumbsUp:{editable:se,types:sg,numPoints:1},SymbolThumbsDown:{editable:se,types:sg,numPoints:1},SymbolZero:{editable:se,types:sg,numPoints:1},SymbolOne:{editable:se,types:sg,numPoints:1},SymbolTwo:{editable:se,types:sg,numPoints:1},SymbolThree:{editable:se,types:sg,numPoints:1},SymbolFour:{editable:se,types:sg,numPoints:1},SymbolFive:{editable:se,types:sg,numPoints:1},SymbolSix:{editable:se,types:sg,numPoints:1},SymbolSeven:{editable:se,types:sg,numPoints:1},SymbolEight:{editable:se,types:sg,numPoints:1},SymbolNine:{editable:se,types:sg,numPoints:1},SymbolQuestion:{editable:se,types:sg,numPoints:1},SymbolFishHook:{editable:se,types:sg,numPoints:1},SymbolBuy:{editable:se,types:sg,numPoints:1},SymbolSell:{editable:se,types:sg,numPoints:1},FibonacciTimeZones:{editable:[...i9,tG.AT_FACTORS,tG.AT_SHOW_LEVELS,tG.AT_LABELS,tG.AT_SINGLE_STYLE,tG.AT_SHOW_BACKGROUND,tG.AT_BACKGROUND_OPACITY],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tG.AT_FACTORS]:iJ([0,1,2,3,5,8,13,21,34,55,89,144],iZ),[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_SINGLE_STYLE]:!1,[tG.AT_SHOW_BACKGROUND]:!0,[tG.AT_BACKGROUND_OPACITY]:.2},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_SINGLE_STYLE,type:"bool"},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SINGLE_STYLE},{id:tG.AT_FACTORS,type:"array",items:{ref:tG.AT_FACTOR_ITEM}},{id:tG.AT_FACTOR_ITEM,type:"object",properties:[{id:tG.AT_SHOWN,type:"bool",label:!1},{id:tG.AT_VALUE,type:"number",editable:!0,enabledIf:tG.AT_SHOWN},{id:tG.AT_LINE,type:"line",enabledIf:tG.AT_SHOWN}]},{id:tG.AT_SHOW_BACKGROUND,type:"bool"},{id:tG.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tG.AT_SHOW_BACKGROUND},{id:tG.AT_SHOW_LEVELS,type:"bool"},{id:tG.AT_LABELS,type:"string",enum:[tG.AT_LABELS_LEFT,tG.AT_LABELS_CENTER,tG.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:ss,types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_TEXT_LINES,type:"array",items:{ref:tG.AT_TEXT_ITEM}},{id:tG.AT_TEXT_ITEM,type:"string"},{id:tG.AT_FILL,type:"color"}],numPoints:2},ProfitLoss:{editable:[...st,tG.AT_SHOW_PRICES,tG.AT_NUM_CONTRACTS,tG.AT_POSITION,tG.AT_PROFIT_LOSS],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!1,[tG.AT_SHOW_PRICES]:!0,[tG.AT_NUM_CONTRACTS]:1,[tG.AT_POSITION]:tG.AT_POSITION_LONG,[tG.AT_PROFIT_LOSS]:void 0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_PROFIT_LOSS,type:"number",editable:!1},{id:tG.AT_NUM_CONTRACTS,type:"number"},{id:tG.AT_POSITION,type:"string",enum:[tG.AT_POSITION_SHORT,tG.AT_POSITION_LONG]},...sf,{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:2},RewardRisk:{editable:[...st,tG.AT_SHOW_PRICES,tG.AT_NUM_CONTRACTS,tG.AT_POSITION,tG.AT_RISK,tG.AT_REWARD,tG.AT_RATIO],defaults:{[tG.AT_ALLOW_PRICES_CHANGE_UI]:!1,[tG.AT_SHOW_PRICES]:!0,[tG.AT_NUM_CONTRACTS]:1,[tG.AT_POSITION]:tG.AT_POSITION_LONG,[tG.AT_RISK]:void 0,[tG.AT_REWARD]:void 0,[tG.AT_RATIO]:void 0},types:[{id:tG.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tG.AT_REWARD,type:"number",editable:!1},{id:tG.AT_RISK,type:"number",editable:!1},{id:tG.AT_RATIO,type:"number",editable:!1},{id:tG.AT_NUM_CONTRACTS,type:"number"},{id:tG.AT_POSITION,type:"string",enum:[tG.AT_POSITION_SHORT,tG.AT_POSITION_LONG]},...sf,{id:tG.AT_SHOW_PRICES,type:"bool"}],numPoints:2}};function sS(e){return e?sA[e].editable:sA}var sv={};sv=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart HTML5 Charts","definitions":{"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"]},"period":{"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)?)?$"},"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","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","BOLLBW","BOLLBP","OBVOL","OBVOLAVG","ATR","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","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","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","REATRHI","REATRLO","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","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","BOLLSQ","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"]},"generalField":{"type":"string","enum":["DateTime","Open","High","Low","Close","TradeSize","Volume","OpenInterest","Last","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","BSQUEEZE","OBVOL","ATR","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","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRHI","REATRLO","LINRCHN","CSHO","CSHB","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"]},"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","SymbolBuy","SymbolSell","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"}}},"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"},"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"},"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","dashStyle":"LongDashDot"}},"cycleTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","dashStyle":"ShortDashDot"}}}}]},"annotationTraits":{"$ref":"#/definitions/annTraits"},"curveTraits":{"type":"array","items":{"$ref":"#/definitions/curveTrait"}},"allAnnotationsLocked":{"type":"boolean","default":false}}},"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"}}},"stringInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"string"}}},"input":{"type":"object","oneOf":[{"$ref":"#/definitions/numberInput"},{"$ref":"#/definitions/stringInput"}]},"inputs":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/input"}},"curves":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curve"}},"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},"type":{"$ref":"#/definitions/symbolType"},"main":{"type":"boolean","default":false},"inputs":{"$ref":"#/definitions/inputs"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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"},"type":{"$ref":"#/definitions/fundamentalType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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"},"studyPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"basis":{"type":"string","default":"$main"},"study":{"$ref":"#/definitions/study"},"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":["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"},"type":{"$ref":"#/definitions/exprType"},"main":{"type":"boolean","default":false},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/forwardType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/seasonalType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["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"},"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":{"type":"string"},"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"]}},"type":"object","additionalProperties":false,"properties":{"data":{"$ref":"#/definitions/data"},"display":{"$ref":"#/definitions/display"},"panes":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/pane"}},"version":{"type":"integer","minimum":149,"multipleOf":1}},"required":["panes","version"]}');var sb={};sb=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart studies for HTML5 Charts","definitions":{"studyMetadata":{"type":"object","additionalProperties":false,"properties":{"title":{"type":"string"},"overlay":{"type":"boolean","default":true},"decimals":{"type":"number"},"shiftable":{"type":"boolean"},"range":{"type":"object","additionalProperties":false,"properties":{"min":{"type":"number"},"max":{"type":"number"}}},"enumerations":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/enumeration"}}},"required":["title"]},"enumeration":{"type":"object","additionalProperties":false,"properties":{"input":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}}},"studyDefaults":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"chart.schema.json#/definitions/curves"},"source":{"$ref":"chart.schema.json#/definitions/curveField"},"inputs":{"$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":false,"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"}}');var sP={};sP=JSON.parse('{"$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":false,"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"}}');var sC={};sC=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema","title":"JSON schema for the Barchart API of the HTML5 Charts","definitions":{"curvesNonStrict":{"type":"array","maxItems":1,"items":{"$ref":"chart.schema.json#/definitions/curveNonStrict"}},"mainPlotSymbolContext":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"}},"required":["symbol"]},"mainPlotExpressionContext":{"type":"object","additionalProperties":false,"properties":{"expression":{"type":"string"}},"required":["expression"]},"mainPlotForwardContext":{"type":"object","additionalProperties":false,"properties":{"forward":{"type":"string"}},"required":["forward"]},"mainPlotSeasonalContext":{"type":"object","additionalProperties":false,"properties":{"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":{"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"}}}},"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"},"percentChange":{"type":"boolean"},"comparisonMode":{"type":"string","enum":["None","Percent","Value"]},"showLastValue":{"type":"string","enum":["None","All","Main"]},"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"},"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":"chart.schema.json#/definitions/inputs"},"curves":{"$ref":"#/definitions/curvesNonStrict"},"levels":{"$ref":"chart.schema.json#/definitions/studyLevels"},"bands":{"$ref":"chart.schema.json#/definitions/studyBands"},"placement":{"$ref":"#/definitions/placement"},"cloneIndex":{"$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"]},"compareAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Compare"},"context":{"type":"object","additionalProperties":false,"properties":{"symbols":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/compareSymbol"}}}}},"required":["id","context"]},"annotationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Annotation"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Delete","Update","Duplicate","List","FlipHorizontal","FlipVertical"]},"uid":{"type":"string","default":""},"visible":{"type":"boolean"},"traits":{"$ref":"chart.schema.json#/definitions/annTraits"},"extras":{"type":"object","additionalProperties":true},"points":{"type":"array","items":{"$ref":"chart.schema.json#/definitions/annPoint"}}},"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"]},"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"}}}}}}}},"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/templateAccessor"},{"$ref":"#/definitions/outlineAccessor"},{"$ref":"#/definitions/themeAccessor"}]}');var sE={};function s_(t){switch(t){case tG.CHART_SCHEMA:return e(sv);case tG.STUDIES_SCHEMA:return e(sb);case tG.FIELDS_SCHEMA:return e(sP);case tG.ACCESSOR_SCHEMA:return e(sC);default:throw Error(`Unknown schema name: ${t}`)}}sE=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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#ae272d"],"fields":["OSC"]}]}},{"id":"OSCIVOL","meta":{"title":"Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#9326ff"],"fields":["VOSC"]}]}},{"id":"MAENV","meta":{"title":"Moving Average Envelope","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Width","value":2}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":9},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#bc41ce"],"fields":["WMA"]}]}},{"id":"MAHLC","meta":{"title":"Moving Average High/Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":8}],"curves":[{"colors":["#00b04b"],"fields":["MAHI"]},{"colors":["#ef4226"],"fields":["MALO"]}]}},{"id":"MACD","meta":{"title":"MACD Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MACDEXP","meta":{"title":"MACD Oscillator Exponential","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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":0,"name":"Zero","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},{"name":"Period2","value":26},{"name":"Period3","value":9},{"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},"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}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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}},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":9},{"name":"Period2","value":45},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14},{"name":"Range","value":20},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"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},{"name":"Period2","value":10}],"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},"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}],"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},{"name":"Period2","value":3},{"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},{"name":"Period2","value":3},{"name":"Period3","value":3},{"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Width","value":2},{"name":"Offset","value":0},{"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":"Modified Bollinger Bands","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"MultInside","value":3},{"name":"MultOutside","value":4},{"name":"Offset","value":0},{"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#f18900"],"fields":["BOLLBW"]}]}},{"id":"BPERC","meta":{"title":"Bollinger Bands %B","decimals":4,"overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#138484"],"fields":["BOLLBP"]}],"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}],"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},{"name":"Smoothing","value":"SMA"},{"name":"Period2","value":20}],"curves":[{"colors":["#ffaf1c"],"fields":["ATR"]},{"colors":["#1c6cff"],"fields":["ATRMA"]}]}},{"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},{"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"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"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},{"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},{"name":"DiLength","value":14}],"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},{"name":"DiLength","value":14}],"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}],"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},{"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},{"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}],"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}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#2284dd"],"fields":["ROC"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"TRIX","meta":{"title":"Triple Exponential","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":15}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":15},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["DEMA"]}]}},{"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"]}]},"defaults":{"inputs":[{"name":"Period","value":15},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["TEMA"]}]}},{"id":"TSI","meta":{"title":"True Strength Index","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":25},{"name":"Period2","value":13},{"name":"Period3","value":7}],"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}],"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}],"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},{"name":"PeriodLower","value":14},{"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},{"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},{"name":"Period2","value":8},{"name":"Period3","value":5}],"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},{"name":"Period2","value":34},{"name":"Period3","value":10}],"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}],"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},{"name":"Period2","value":10}],"curves":[{"colors":["#808080"],"fields":["CHAVOL"]}]}},{"id":"DPO","meta":{"title":"Detrended Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20}],"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}],"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"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#674ea7"],"fields":["HMA"],"style":"Line"}]}},{"id":"COPP","meta":{"title":"Coppock Curve","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodWma","value":10},{"name":"PeriodRocLong","value":14},{"name":"PeriodRocShort","value":11}],"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}],"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}],"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}],"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}],"curves":[{"colors":["#ae272d"],"fields":["ERBRPOW"],"style":"Column"}]}},{"id":"FI","meta":{"title":"Force Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":13}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Movement","value":20}],"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}],"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},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#0c32ff"],"fields":["MSD"]}]}},{"id":"PCTCHG","meta":{"title":"Percent Change","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#037d27"],"fields":["PCTCHG"]}]}},{"id":"NVI","meta":{"title":"Negative Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#480048"],"fields":["NVI"]},{"colors":["#7f8000"],"fields":["NVIEMA"]}]}},{"id":"PVI","meta":{"title":"Positive Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#00b04b"],"fields":["PVI"]},{"colors":["#005716"],"fields":["PVIEMA"]}]}},{"id":"PPO","meta":{"title":"Percentage Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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},{"name":"Period2","value":26},{"name":"Period3","value":9}],"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},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#7f8000"],"fields":["HV"]}]}},{"id":"PERF","meta":{"title":"Price Performance","overlay":false,"decimals":2,"enumerations":[{"input":"Anchor","values":["SeriesStart","VisibleStart"]}]},"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},{"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":"REATRHI","meta":{"title":"Retracement ATR High","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"High"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#25329b"],"fields":["REATRHI"],"style":"Dots"}]}},{"id":"REATRLO","meta":{"title":"Retracement ATR Low","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#b25900"],"fields":["REATRLO"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Offset","value":0}],"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":"COTLC","meta":{"title":"Commitment of Traders (COT) Chart","overlay":false,"decimals":0},"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},"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},"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},"defaults":{"curves":[{"colors":["#ffc270"],"fields":["IMPVOL"]}]}},{"id":"CTM","meta":{"title":"CommodityTrends Cycle Trading Momentum","overlay":false},"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},"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},{"name":"Period2","value":5},{"name":"Period3","value":8},{"name":"Period4","value":10},{"name":"Period5","value":12},{"name":"Period6","value":15},{"name":"Period7","value":30},{"name":"Period8","value":35},{"name":"Period9","value":40},{"name":"Period10","value":45},{"name":"Period11","value":50},{"name":"Period12","value":60}],"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},{"name":"Period2","value":3}],"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},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":9}],"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":"Volatility Stop","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"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},{"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},{"name":"PeriodBaseLine","value":26},{"name":"PeriodLaggingSpan2","value":52},{"name":"Displacement","value":26}],"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}],"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},{"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":9},{"name":"Period2","value":18}],"curves":[{"colors":["#ae4ac7"],"fields":["MAS"]},{"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period","value":20}],"curves":[{"colors":["#ffb347"],"fields":["AVG"]}]}},{"id":"VOIN","meta":{"title":"Vortex Indicator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"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"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":200},{"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}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodRsi","value":14},{"name":"PeriodEma1","value":5},{"name":"PeriodEma2","value":3},{"name":"PeriodMa","value":9},{"name":"PeriodSig","value":9}],"curves":[{"colors":["#ef5350","#26a69a"],"fields":["DOSCH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]},{"colors":["#cc66ff"],"fields":["DOSCS"]}]}},{"id":"BSQUEEZE","meta":{"title":"Bollinger Bands Squeeze","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#3d8283"],"fields":["BOLLSQ"]}]}},{"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":20},{"name":"Increment","value":5},{"name":"Count","value":10},{"name":"Offset","value":0}],"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},{"name":"Smoothing2","value":"EMA"},{"name":"Period2","value":10}],"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},{"name":"WidthBollinger","value":2},{"name":"PeriodEmaKeltner","value":20},{"name":"MultiplierKeltner","value":1.5},{"name":"PeriodAtrKeltner","value":20},{"name":"PeriodMomentum","value":12}],"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},{"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},{"name":"SlowPeriod","value":17},{"name":"HandbrakePeriod","value":40},{"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}],"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},{"name":"Period2","value":20},{"name":"Period3","value":10}],"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}],"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","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},{"name":"LevelMode","value":"Count"},{"name":"LevelSize","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},{"name":"PeriodRoc2","value":15},{"name":"PeriodRoc3","value":20},{"name":"PeriodRoc4","value":30},{"name":"PeriodMa1","value":10},{"name":"PeriodMa2","value":10},{"name":"PeriodMa3","value":10},{"name":"PeriodMa4","value":15},{"name":"PeriodSig","value":9},{"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},{"name":"PeriodLong","value":50},{"name":"PeriodStoch1","value":10},{"name":"PeriodStoch2","value":3},{"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},{"name":"Period2","value":39},{"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},{"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},{"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},{"name":"Period1Mom","value":9},{"name":"Period2Rsi","value":3},{"name":"Period2Ma","value":3},{"name":"PeriodFastMa","value":13},{"name":"PeriodSlowMa","value":33}],"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"]}]},"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"},{"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":["1-Day","5-Day","1-Month","3-Month","6-Month","1-Year","YTD"]}]},"defaults":{"inputs":[{"name":"TimeFrame","value":"1-Day"}],"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},{"name":"Offset","value":0}],"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"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":21},{"name":"Period2","value":34}],"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},{"name":"PeriodTarget","value":30},{"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"]}]}}]');let sM=[],sL=!1,sx=!0;function sO(e){sM=sM.concat(ae(e,tG.STUDIES_SCHEMA))}let sI=new Map;function sD(){sL||(sO(e(sE)),sL=!0);let t=es[y0()?.config.mode??"Unspecified"];if(!sx)return sM;if(!sI.has(t)){let e=eu(sk,t);sI.set(t,sM.filter(e))}return sI.get(t)}function sw(e){return eG(sN(e))}function sR(e){return i5(y1().display,e)}function sN(e){return sD().find(t=>t.id===e)}function sV(e){return void 0!==sN(e)}function sH(e){let t=[aa.Open,aa.High,aa.Low,aa.Close,aa.Volume].map(e=>e.id);return e.defaults.source&&!t.includes(e.defaults.source)}function sF(e){return[es.DemoSite,es.cmdtyView].includes(e)}function sk(e,t){let i=t.id;if("PVACP"===i)return[es.cmdtyView,es.DemoSite].includes(e);let s=[es.GBE,es.cmdtyView];return!(["CPMI","CTPI","CTM","JPI","CTTP","CTTI"].includes(i)&&!s.includes(e))}let sB=null,sU=!1;function sW(){if(!sU){let e=[j.Study,j.BalanceSheet,j.IncomeStatement],t=e.reduce((e,t)=>(e[t]=[],e),{});Object.values(aa).filter(t=>e.includes(t.category)).map(e=>{t[e.category].push({id:e.id,name:e.name,shortName:e.shortName})});let i=Object.keys(W).filter(e=>{let t=parseInt(e);if(Number.isFinite(t))return W[t]}),s=eG(sD()).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),r=Object.entries(sS()).map(([e,t])=>({id:e,options:t.editable,types:t.types,numPoints:t.numPoints}));sB={studies:s,incomeStatements:t[j.IncomeStatement],balanceSheets:t[j.BalanceSheet],studyFields:t[j.Study],curveStyles:i,annotations:r},sU=!0}return sB}var s$={};function sG(e,t,i){return[].concat((0,s$.apply)(t,e,i))}function sz(e,t,i){let s=eG(e),r=sG(s,t),n=r.map(i);if(n.some(e=>void 0===e))throw Error(`Forgot to return transformed value from accessor ${i}`);return function e(t,i,s){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||null===t)return t;if(Array.isArray(t))return t.map(t=>e(t,i,s)).filter(e=>e!==tG.NULL_OBJECT);{let r=i.indexOf(t);if(-1!==r)return s[r];let n={};for(let r in t){let a=t[r];n[r]=e(a,i,s)}return n}}(s,r,n)}s$=R("3DQaT");let sY=["1D","5D","1M","3M","6M","1Y","5Y","Max"];function sj(e){return 1===e.length}function sK(e){return 1===e.length}let sq={ATRLTR:"REATRHI",ATRSTR:"REATRLO",PeriodMARng:"PeriodAdjATR",PeriodAdjATR:"FactorAdjATR"},sX={BBANDS:{colors:["#89211e"],fields:["BOLLBM"],visible:!1},DONCHN:{colors:["#ff6a00"],fields:["DONMID"],visible:!1}},sZ={[tG.AT_SINGLE_STYLE]:!0,[tG.AT_SHOW_BACKGROUND]:!1,[tG.AT_BACKGROUND_OPACITY]:.2},sJ={[tG.AT_SHOW_PRICES]:!0,[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_LEFT,[tG.AT_EXTEND_LEFT]:!1,[tG.AT_EXTEND_RIGHT]:!0,[tG.AT_REVERSE]:!1,...sZ},sQ={FibonacciFan:{[tG.AT_SHOW_LEVELS]:!1,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,[tG.AT_REVERSE]:!1,...sZ},FibonacciArcs:{[tG.AT_SHOW_LEVELS]:!1,...sZ},FibonacciRetracement:{...sJ},TrendBasedFibExtension:{...sJ},FibonacciChannel:{[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LEVELS_KIND]:tG.AT_LEVELS_PERCENTS,[tG.AT_LABELS]:tG.AT_LABELS_LEFT,...sZ},FibonacciTimeZones:{[tG.AT_SHOW_LEVELS]:!0,[tG.AT_LABELS]:tG.AT_LABELS_RIGHT,...sZ},GannFan:{[tG.AT_SHOW_LEVELS]:!1,...sZ},GannBox:{...sZ,[tG.AT_SHOW_BACKGROUND]:!0},GannSquare:{...sZ,[tG.AT_SHOW_BACKGROUND]:!0}},s0=()=>({width:1,color:iQ(Math.floor(100*Math.random())),dashStyle:"Solid"}),s1=["FibonacciFan","FibonacciArcs","FibonacciChannel","FibonacciTimeZones","FibonacciRetracement","TrendBasedFibExtension"],s2=[...s1,"GannFan","GannBox","GannSquare"],s3=["Line","Ray","GannLine"],s4=["ComputedText","ProfitLoss","RewardRisk"];function s5(e){return s1.includes(e)?["factors"]:"GannFan"===e?["angles"]:"GannBox"===e?["priceLevels","timeLevels"]:"GannSquare"===e?["levels","fans","arcs"]:[]}function s6(e,t,i){let s=!eW(e,t)||!Array.isArray(e[t]),r=!s&&e[t].some(e=>!eH(e.value));if(s||r)return e[t]=i[t],!0}function s7(e,t){if(!eH(t))return;let i=s5(e),s=i5(null,e);for(let e of i)if(!s6(t,e,s))for(let i of t[e])Number.isFinite(i.value)&&(i.value=eF(i.value,6))}function s8(e,t,i=!1){let s="FibonacciFan"===e,r=eH(t);if(s2.includes(e)&&r){i&&eY(t,sQ[e]);let r=s5(e),n=i5(null,e);for(let e of r)if(!s6(t,e,n))for(let i of t[e]){let t=n[e].find(e=>e.value===i.value)||n[e].find(e=>e.value===Math.abs(i.value));eH(i.line)||(i.line=t?t.line:s0()),s&&0===i.value&&!eH(i.shown)&&(i.shown=!0)}"FibonacciChannel"===e&&t[tG.AT_SHOW_LABELS]?(t[tG.AT_SHOW_LEVELS]=t[tG.AT_SHOW_LABELS],delete t[(0,tG).AT_SHOW_LABELS]):"FibonacciArcs"!==e||t[tG.AT_SHOW_TRENDLINE]||(t[tG.AT_SHOW_TRENDLINE]=!0)}s3.includes(e)&&r&&!eH(t[tG.AT_MARKER])&&(t[tG.AT_MARKER]={...sy}),r&&(t[tG.AT_ALLOW_PRICES_CHANGE_UI]=!s4.includes(e))}let s9=[3,4,5,6,7,8,9,10,11],re=[12,13,14,15,16,17,18,19,20],rt=[{name:"Source",value:"Close"},{name:"Average",value:"MA"}];function ri(e){let t=e.curves?.length??0,i=e.offsets?.length??0;if(0!==t&&0!==i&&t===i+1){let i=e.usesInAverage;Array.isArray(i)&&6===i.length?(e.curves.splice(1,5),e.offsets=[0,-5]):t>2?e.offsets?.push(-1):e.curves.splice(-1,1),delete e.usesInAverage}}function rs(e){return function(t){return t.version=e,t}}let rr=rs(44),rn=rs(45),ra=rs(46),ro=rs(47),rl=rs(48),ru=rs(49),rh=rs(50),rc=rs(51),rd=rs(52),rp=rs(53),rf=rs(54),rm=rs(55),rg=rs(56),ry=rs(58),rT=rs(59),rA=rs(61),rS=rs(62),rv=rs(63),rb=rs(64),rP=rs(67),rC=rs(69),rE=rs(74),r_=rs(75),rM=rs(76),rL=rs(81),rx=rs(82),rO=rs(83),rI=rs(85),rD=rs(86),rw=rs(88),rR=rs(89),rN=rs(92),rV=rs(93),rH=rs(94),rF=rs(95),rk=rs(97),rB=rs(98),rU=rs(99),rW=rs(100),r$=rs(101),rG=rs(103),rz=rs(105),rY=rs(107),rj=rs(108),rK=rs(110),rq=rs(112),rX=rs(115),rZ=rs(118),rJ=rs(119),rQ=rs(121),r0=rs(122),r1=rs(123),r2=rs(124),r3=rs(126),r4=rs(127),r5=rs(129),r6=rs(130),r7=rs(132),r8=rs(133),r9=rs(134),ne=rs(135),nt=rs(136),ni=rs(138),ns=rs(139),nr=rs(141),nn=rs(143),na=rs(146),no={_3to4:function(e){let t=e.data.period;if(null!==t){let i="Max"===t?tG.AUTOFIT_PERIOD:`P${t}`,s=sY.findIndex(e=>e===t),r={unit:"Day"};s<2?r={unit:"Intraday",size:15}:s>5&&(r={unit:"Month"}),delete e.data.period,e.display.period=i,e.data.aggregation=r,e.version=4}return e},_4to5:function(e){let t=sG(e,'..panes[0]..plots{.type === "Symbol"}[0].curves{.style === "Candlestick" && .attributes === "Hollow" }');if(1===t.length){let e=t[0];e.attributes.splice(e.attributes.indexOf("Hollow"),1),0===e.attributes.length&&delete e.attributes,e.style="HollowCandles",e.colors=eG(tG.COLOR_DEFAULT_VARY)}return e.version=5,e},_5to6:function(e){let t=sG(e,'..panes[0]..plots{.type === "Symbol"}[0]');return 1===t.length&&(t[0].main=!0),e.version=6,e},_6to7:function(e){let t=sG(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,i=iM(e.curves[t].colors[0]);i.a=.1,e.curves.push({colors:[iO(i)],fields:e.curves[0].fields.concat(e.curves[t].fields),lineWidth:0,style:"Ribbon"})}}),e.version=7,e},_7to8:function(e){let t=sG(e,'..plots{.type === "Study" && (.study === "ADX" || .study === "ADXMOD")}');return t.length>0&&t.forEach(e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===tG.INPUT_PERIOD){let t=e.inputs[0].value;e.inputs=[{name:"AdxSmoothing",value:t},{name:"DiLength",value:t}]}}),e.version=8,e},_8to9:function(e){let t=".display.yAxis",i=".minorGridLines",s=sG(e,t);if(sj(s)&&!sj(sG(s,i))){let e=sG(y0().template,t+i);sj(e)&&(s[0].minorGridLines=e[0])}return e.version=9,e},_9to10:function(e){let t=".display.navigator",i=".enabled",s=sG(e,t);if(sK(s)&&!sK(sG(s,i))){let e=sG(y0().template,t+i);sK(e)&&(s[0].enabled=e[0])}return e.version=10,e},_10to11:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "TCHN"}');return t.length>0&&t.forEach(e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===tG.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},_11to12:function(e){let t=sG(e,".display.navigator");if(1===t.length){let e=t[0];e.visible=e.enabled&&e.visible||!1,delete e.enabled}return e.version=12,e},_12to13:function(e){return sG(e,"..annotations").forEach(e=>{if("AndrewsPitchfork"===e.id){let[t,i,s]=e.points;e.points=[i,t,s]}}),e.version=13,e},_13to14:function(e){let t=sG(e,".display");if(1===t.length){let e=t[0];e.scrollbar.visible=e.navigator.visible||!1,delete e.navigator}return e.version=14,e},_14to15:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ATRLTR","ATRSTR"]}),i=e=>eW(sq,e)?sq[e]:e;return t.length>0&&t.forEach(e=>{e.curves&&e.curves[0].fields&&(e.curves[0].fields=e.curves[0].fields.map(i)),e.inputs&&(e.inputs=e.inputs.map(e=>(e.name=i(e.name),e))),e.study=i(e.study)}),e.version=15,e},_15to16:function(e){let t=sG(e,"..annotations"),i="FibonacciRetracement",s=e=>({shown:!1,value:e}),r=[-.618,-.236].map(s),n=[1.272,1.618,2.618].map(s);return t.forEach(e=>{if(e.id===i){let t=e.traits;if(eH(t)&&eH(t.factors)){let e=i5(null,i).factors,s=t.factors.map((t,i)=>{let s=!eH(t);return{shown:!s,value:s?e[i+2].value:t}});t.factors=r.concat(s).concat(n)}}}),e.version=16,e},_16to17:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHM","STOCHS"]});return t.length>0&&t.forEach(e=>{let t="STOCHM"===e.study,i=sw(t?"STOCHS":e.study);eH(e.inputs)?e.inputs.push({name:"Smoothing",value:t?"EMA":"MA"}):e.inputs=i.defaults.inputs.map(e=>("Smoothing"===e.name&&t&&(e.value="EMA"),e)),t&&(e.study="STOCHS")}),e.version=17,e},_17to18:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["BBANDS","DONCHN"]});return t.length>0&&t.forEach(e=>{if(eH(e.curves)&&e.curves?.length===3){let t=eG(sX[e.study]);e.curves.push(t)}}),e.version=18,e},_18to19:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["REATRHI","REATRLO"]});return t.length>0&&t.forEach(e=>{e.inputs&&4===e.inputs.length&&e.inputs.push({name:"FactorATR",value:2})}),e.version=19,e},_19to20:function(e){let t=sG(e,".display.yAxis");if(1===t.length){let e=t[0];eH(e.showLastValue)&&(e.showLastValue=e.showLastValue?"All":"None")}return e.version=20,e},_20to21:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CTMF","TPI"]});return t.length>0&&t.forEach(e=>{let t="CTMF"===e.study?"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},_21to22:function(e){let t=sG(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},_22to23:function(e){let t=e.display.yAxis;return delete t.minPadding,delete t.maxPadding,e.version=23,e},_23to24:function(e){let t=sG(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},_24to25:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "MOM"}');if(t.length>0){let e=sw("MOM");t.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&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},_25to26:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MA","MAEXP"]});return t.length>0&&t.forEach(e=>{e.source&&delete e.source,e.inputs&&1===e.inputs.length?e.inputs.push({name:"Source",value:"Close"}):e.inputs=sw(e.study).defaults.inputs}),e.version=26,e},_26to27:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "ATR"}');if(t.length>0){let e=sw("ATR");t.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&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},_27to28:function(e){let t=sG(e,'..plots{.type === "Study"}'),i=sw("ALLG");return t.length>0&&t.forEach(e=>{delete e.shift,"ALLG"===e.study&&e.curves&&e.curves.forEach(e=>{let t=(e=>{let t=i.defaults.curves.find(t=>t.fields[0]===e.fields[0]);if(eH(t))return t.shift})(e);eH(t)&&(e.shift=t)})}),e.version=28,e},_28to29:function(e){let t=at(sz(e,'..plots{.type === "Study" && .study === "DEMARK"}',e=>tG.NULL_OBJECT));return t.version=29,t},_29to30:function(e){let t=at(sz(e,'..plots{.type === "Study" && .study === "ULTOSC"}',e=>tG.NULL_OBJECT));return t.version=30,t},_30to31:function(e){let t=sG(e,"..annotations"),i="FibonacciRetracement";return t.forEach(e=>{if(e.id===i){let[t,s]=e.points;t.time>s.time&&(e.points=[s,t]);let r=e.traits;eH(r)&&(r.line2=i5(null,i).line2)}}),e.version=31,e},_31to32:function(e){return e.version=32,e},_32to33:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:sD().filter(e=>!0===e.meta.shiftable).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},_33to34:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "VWAP"}'),i=sw("VWAP");return t.length>0&&t.forEach(e=>{eH(e.inputs)||(e.inputs=i.defaults.inputs.slice()),e.curves?.length===1&&e.curves.push(...i.defaults.curves.slice(1))}),e.version=34,e},_34to35:function(e){let t="OBVOL",i=sG(e,`..plots{.type === "Study" && .study === "${t}"}`);if(i.length>0){let e=sw(t);i.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&t.curves.push(e.defaults.curves[1]),!t.inputs&&e.defaults.inputs&&(t.inputs=e.defaults.inputs)})}return e.version=35,e},_35to36:function(e){return sG(e,"..annotations").forEach(e=>{e.uid=e0()}),e.version=36,e},_36to37:function(e){return e.version=37,e},_37to38:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "CRS"}'),i=sw("CRS");return t.length>0&&t.forEach(e=>{e.inputs?.length===3&&e.inputs.push(i.defaults.inputs[3])}),e.version=38,e},_38to39:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "PERF"}'),i=sw("PERF");return t.length>0&&t.forEach(e=>{e.inputs?.length===0&&(e.inputs=i.defaults.inputs)}),e.version=39,e},_39to40:function(e){return e.version=40,e},_40to41:function(e){return e.version=41,e},_41to42:function(e){return e.version=42,e},_42to43:function(e){let t=sG(e,"..annotations"),i=["FibonacciTimeZones","FibonacciFan","FibonacciArcs"],s=sS();return t.forEach(e=>{let t=e.id;i.includes(t)?e.traits.factors=eG(s[t].defaults.factors):"GannFan"===t&&(e.traits.angles=eG(s[t].defaults.angles))}),e.version=43,e},_43to44:rr,_44to45:rn,_45to46:ra,_46to47:ro,_47to48:rl,_48to49:ru,_49to50:rh,_50to51:rc,_51to52:rd,_52to53:rp,_53to54:rf,_54to55:rm,_55to56:rg,_56to57:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["RSI","RSIMOD","RSISTO","STOCHF","STOCHS","GTPI"]});return t.length>0&&t.forEach(e=>{e.levels&&3===e.levels.length&&!e.levels[1].name&&(e.levels[1].name="Center")}),e.version=57,e},_57to58:ry,_58to59:rT,_59to60:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["VOL","MAVOL"]}),i=sw("MAVOL");return t.length>0&&t.forEach(e=>{if(!eH(e.curves))return;let t=+("VOL"!==e.study);eH(e.inputs)||(e.inputs=[]),1===t&&e.curves?.length===1&&e.curves.push(eG(i.defaults.curves[1])),e.inputs.push({name:"BarColoring",value:(e=>{if(!eH(e)||e.length<1)return"LikeMain";switch(e[0]){case"ChangeBased":return"CloseToClose";case"OpenVsClose":return"OpenToClose";default:return"LikeMain"}})(e.curves[t].attributes)}),delete e.curves[t].attributes}),e.version=60,e},_60to61:rA,_61to62:rS,_62to63:rv,_63to64:rb,_64to65:function(e){let t="DIFA",i=sG(e,`..plots{.type === "Study" && .study === "${t}"}`),s=sw(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===2&&e.inputs.push(s.defaults.inputs[2])}),e.version=65,e},_65to66:function(e){return sG(e,"..annotations").forEach(e=>{if("FibonacciTimeZones"===e.id){let t=e.points;if(1===t.length){let e=eG(t[0]);e.time+=1,t.push(e)}}}),e.version=66,e},_66to67:rP,_67to68:function(e){let t=sG(e,'..plots{.type === "Study" && .study === "DPO"}'),i=sw("DPO");return t.length>0&&t.forEach(e=>{if(eH(e.curves)&&e.curves?.length===1&&!eH(e.levels)){let t=e.curves[0];if(t.colors?.length===1&&!eH(t.zones)){e.levels=i.defaults.levels,t.zones=i.defaults.curves[0].zones;let s=iP(t.colors[0],.3);t.colors=[s,s]}}}),e.version=68,e},_68to69:rC,_69to70:function(e){let t="RSISTO",i=sG(e,`..plots{.type === "Study" && .study === "${t}"}`),s=sw(t);return i.length>0&&i.forEach(e=>{e.curves?.length===1&&e.inputs?.length===2&&(e.curves.push(s.defaults.curves[1]),e.inputs.push(...s.defaults.inputs.slice(2)))}),e.version=70,e},_70to71:function(e){return sG(e,"..annotations").forEach(e=>s8(e.id,e.traits,!0)),e.version=71,e},_71to72:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["GTPI","GPMI","CBMI"]}),i=sw("JPI");return t.length>0&&t.forEach(e=>{let t=(t,i)=>{e.study=t,e.curves?.length&&e.curves.forEach(e=>{for(let t of i){let[i,s]=t;e.fields?.length===1&&e.fields[0]===i&&(e.fields[0]=s)}})};"GTPI"===e.study?t("CTPI",[["GTPI","CTPI"]]):"GPMI"===e.study?t("CPMI",[["GPMI","CPMI"]]):"CBMI"===e.study&&(t("JPI",[["CBMB","JPIB"],["CBMS","JPIS"]]),e.inputs?.length===3&&(e.inputs=e.inputs.map(e=>"FastNumber"===e.name?{name:"FastPeriod",value:s9[Number(e.value)-1]}:"SlowNumber"===e.name?{name:"SlowPeriod",value:re[Number(e.value)-1]}:e),e.inputs.splice(2,0,i.defaults.inputs[2])))}),e.version=72,e},_72to73:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["JPI"]}),i=sw("JPI").defaults.inputs.find(e=>"HandbrakePeriod"===e.name);return t.length>0&&t.forEach(e=>{e.inputs?.length===4&&e.inputs.push(i)}),e.version=73,e},_73to74:rE,_74to75:r_,_75to76:rM,_76to77:function(e){let t="COPP",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[`${t}`]}),s=sw(t);return i.length>0&&i.forEach(e=>{eH(e.inputs)&&(e.curves=s.defaults.curves,e.levels=s.defaults.levels)}),e.version=77,e},_77to78:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MFI"]}),i=sw("MFI");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels,e.bands=i.defaults.bands)}),e.version=78,e},_78to79:function(e){let t="RSIMOD",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["RSI",t]}),s=sw("RSI"),r=sw(t);return i.length>0&&i.forEach(e=>{if(eH(e.inputs)){let t="RSI"===e.study?s.defaults:r.defaults;e.inputs.push(...t.inputs.slice(1)),e.curves.push(...t.curves.slice(1))}}),e.version=79,e},_79to80:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CCI"]}),i=sw("CCI");return t.length>0&&t.forEach(e=>{if(eV(e.inputs)){let t=e.curves[0].colors[0],s=iP(t,.3);e.curves=i.defaults.curves;let r=e.curves[0].colors;r[0]=r[3]=s,r[2]=t,eV(e.levels)?e.levels.splice(1,0,i.defaults.levels[1]):e.levels=i.defaults.levels,eV(e.bands)||(e.bands=i.defaults.bands)}}),e.version=80,e},_80to81:rL,_81to82:rx,_82to83:rO,_83to84:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP"]}),i=sw("MACD");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=84,e},_84to85:rI,_85to86:rD,_86to87:function(e){let t="BBANDS",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===3&&e.inputs.push(s.defaults.inputs[3])}),e.version=87,e},_87to88:rw,_88to89:rR,_89to90:function(e){let t=sG(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},_90to91:function(e){let t="MCCLO",i=sG(e,`..plots{.type === "Study" && .study === "${t}" }`),s=sw(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===3&&e.inputs.push(s.defaults.inputs[3])}),e.version=91,e},_91to92:rN,_92to93:rV,_93to94:rH,_94to95:rF,_95to96:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PMO"]}),i=sw("PMO");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=96,e},_96to97:rk,_97to98:rB,_98to99:rU,_99to100:rW,_100to101:r$,_101to102:function(e){return sG(e,"..annotations").forEach(e=>{if("ComputedText"===e.id){e.points.splice(2);let[t,i]=["ProfitLoss","RewardRisk"];e.traits.kind===t?e.id=t:e.traits.kind===i&&(e.id=i),e.traits[tG.AT_SHOW_PRICES]=e.traits[tG.AT_DRAW_LINES]??!0,delete e.traits[(0,tG).AT_DRAW_LINES],e.traits[tG.AT_POSITION]=e.traits.pos??"Long",delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[tG.AT_ALLOW_PRICES_CHANGE_UI]=!1}}),e.version=102,e},_102to103:rG,_103to104:function(e){let t="UseAllFields";return sG(e,`..curves{.attributes === "${t}"}`).forEach(e=>{let i=e.attributes.indexOf(t);e.attributes.splice(i,1),"Column"===e.style&&(e.style="MultiColumn",e.varyColorPerBar=!1)}),e.version=104,e},_104to105:rz,_105to106:function(e){let t=sG(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(eV(t)){let e=e=>t.findIndex(t=>t.name===e),i=(i,s,r)=>{if(e(i)>=0)return;let n={name:i,value:s};r<0?t.push(n):t.splice(r,0,n)};i("Source","Close",e("Offset")),i("Offset",0,-1)}}),e.version=106,e},_106to107:rY,_107to108:rj,_108to109:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MASIG","MACDSIG"]});return t.length>0&&t.forEach(e=>{let t="MASIG"===e.study;e.study=t?"PACROSS":"MACROSS";let i=e.inputs;eV(i)&&i.splice(0,0,...rt);let s=e.curves;eV(s)&&t&&(s[0].fields[0]="AVG")}),e.version=109,e},_109to110:rK,_110to111:function(e){return sG(e,"..annotations").forEach(e=>{("LongPosition"===e.id||"ShortPosition"===e.id)&&(e.traits[tG.AT_ALLOW_PRICES_CHANGE_UI]=!0)}),e.version=111,e},_111to112:rq,_112to113:function(e){let t="CHEXI",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t).defaults;return i.length>0&&i.forEach(e=>{eV(e.inputs)&&e.inputs.length===s.inputs?.length&&e.inputs.forEach((e,t)=>{let i=Number(e.value);e.value=Number.isInteger(i)?i:s.inputs[t].value})}),e.version=113,e},_113to114:function(e){let t=sG(e,"..plots{.detachedScale}");return t.length>0&&t.forEach(e=>{e.detachedScale=!0}),e.version=114,e},_114to115:rX,_115to116:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHS"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;eV(e.inputs)&&eV(e.curves)&&(e.curves[0]=t.curves[0],"STOCHF"===e.study&&"#00b04b"===e.curves[1].colors[0]&&(e.curves[1].colors[0]=t.curves[1].colors[0]))}),e.version=116,e},_116to117:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHAMF"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;eV(e.inputs)&&eV(e.curves)&&(e.curves[0]=t.curves[0])}),e.version=117,e},_117to118:rZ,_118to119:rJ,_119to120:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHDMOMOSC","TSI","DIFA"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;if(eV(e.inputs)&&eV(e.curves))switch(e.study){case"CHDMOMOSC":case"TSI":{let i=e.levels?.[0];e.levels=t.levels,eV(i)&&(e.levels[1]=i);break}case"DIFA":{let[i,s]=e.curves[0].colors;e.curves=t.curves,e.curves[0].colors=[i,ib(i),s,ib(s)]}}}),e.version=120,e},_120to121:rQ,_121to122:r0,_122to123:r1,_123to124:r2,_124to125:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP","PPO"]});return t.length>0&&t.forEach(e=>{let t=sw(e.study).defaults;if(eV(e.inputs)&&eV(e.curves))switch(e.study){case"MACD":case"MACDEXP":{let i=e.curves[2],s=i.colors;if(delete i.zones,2===s.length){let e=s.map(e=>iP(e,.3));i.colors=[e[0],s[0],e[1],s[1]]}else i.colors=t.curves[2].colors;i.varyColorPerBar=!0;break}case"PPO":e.curves[2]=t.curves[2]}}),e.version=125,e},_125to126:r3,_126to127:r4,_127to128:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CRS"]}),i=sw("CRS");return t.length>0&&t.forEach(e=>{eH(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=128,e},_128to129:r5,_129to130:r6,_130to131:function(e){let t=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PC"]}),i=sw("PC");return t.length>0&&t.forEach(e=>{if(eV(e.inputs)&&6===e.inputs.length){let t=e.inputs[0].value;e.inputs[0].name=i.defaults.inputs[0].name,e.inputs[0].value=`HV ${t}`,e.inputs.splice(1,0,i.defaults.inputs[1])}}),e.version=131,e},_131to132:r7,_132to133:r8,_133to134:r9,_134to135:ne,_135to136:nt,_136to137:function(e){let t="VOLAP",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{if(eV(e.inputs)&&5===e.inputs.length){let t=e.inputs.find(e=>"Bars"===e.name);eV(t)&&(t.name="LevelSize"),e.inputs=[{name:"LevelMode",value:"Count"},...e.inputs,{name:"ValueRangePercent",value:70}]}if(eV(e.curves)&&1===e.curves.length){let t=e.curves[0].colors.pop();e.curves.push(...s.defaults.curves.slice(1)),e.curves[1].colors=[t],e.curves[2].colors=e.curves[0].colors.map(e=>iP(e,.6))}}),e.version=137,e},_137to138:ni,_138to139:ns,_139to140:function(e){let t="ADXMOD",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ADX",t]}),s=sw("ADX"),r=sw(t);return i.length>0&&i.forEach(e=>{if(eH(e.inputs)){let t="ADX"===e.study?s.defaults:r.defaults;e.levels=[...t.levels]}}),e.version=140,e},_140to141:nr,_141to142:function(e){let t="CHDMOMOSC",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{if(eH(e.inputs)){let t=s.defaults;e.inputs.push(...t.inputs.slice(1,3)),e.curves.push(...t.curves.slice(1,2))}}),e.version=142,e},_142to143:nn,_143to144:function(e){let t="MACDV",i=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sw(t);return i.length>0&&i.forEach(e=>{if(eV(e.inputs)){let t=s.defaults,i=e.levels[0];e.levels=[...t.levels],e.levels[2]=i}}),e.version=144,e},_144to145:function(e){let t="KELCHN",i="KELEXP",s="KELBND",r=sG(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i,s]}),n=sw(t),a=sw(s);return r.length>0&&r.forEach(e=>{if(eV(e.inputs))switch(e.study){case t:e.inputs.push(n.defaults.inputs[1]);break;case i:e.study=t,e.inputs.push(a.defaults.inputs[2]);for(let t=0;t<4;t++)e.curves[t].fields=n.defaults.curves[t].fields;break;case s:e.inputs.push(a.defaults.inputs[2])}}),e.version=145,e},_145to146:na,_146to147:rs(147),_147to148:rs(148),_148to149:function(e){let t=sG(e,'..plots{.type === "Seasonal"}');return t.length>0&&t.forEach(e=>{ri(e)}),e.version=149,e}};function nl(e,t){te(2,arguments);var i=to(e),s=to(t);return i.getTime()===s.getTime()}function nu(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function nh(e){te(1,arguments);var t=ti(e),i=t.getMonth();return t.setMonth(i-i%3,1),t.setHours(0,0,0,0),t}function nc(e,t){te(2,arguments);var i=nh(e),s=nh(t);return i.getTime()===s.getTime()}var nd={};function np(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.weekStartsOn)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.weekStartsOn)?r:nd.weekStartsOn)?s:null==(l=nd.locale)||null==(u=l.options)?void 0:u.weekStartsOn)?i:0);if(!(h>=0&&h<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=ti(e),d=c.getDay();return c.setDate(c.getDate()-(7*(d<h)+d-h)),c.setHours(0,0,0,0),c}function nf(e,t,i){te(2,arguments);var s=np(e,i),r=np(t,i);return s.getTime()===r.getTime()}function nm(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getFullYear()===s.getFullYear()}function ng(e){return{unit:e$(e,"Day","unit"),size:e$(e,1,"size"),spec:e$(e,"None","spec"),isContractVolume:e$(e,!1,"isContractVolume"),dividendsAdjust:e$(e,!1,"dividendsAdjust"),backAdjust:e$(e,!1,"backAdjust"),daysToExpiration:e$(e,1,"daysToExpiration"),contractRoll:e$(e,"combined","contractRoll")}}function ny(e){let t=ng(e);return new nP($[t.unit],t.size,G[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function nT(e,t){return nl(e,t)&&nS(e,t)}function nA(e,t){return nf(e,t)&&nS(e,t)}function nS(e,t){return nu(e,t)&&nm(e,t)}function nv(e,t){return nc(e,t)&&nm(e,t)}function nb(e,t){return+e==+t}class nP{unit;size;spec;isContractVolume;dividendsAdjust;backAdjust;daysToExpiration;contractRoll;constructor(e=$.Day,t=1,i=G.None,s=!1,r=!1,n=!1,a=1,o="combined"){this.unit=e,this.size=t,this.spec=i,this.isContractVolume=s,this.dividendsAdjust=r,this.backAdjust=n,this.daysToExpiration=a,this.contractRoll=o}duplicate(){return new nP(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===$.Tick){let e="T",t=!0;switch(this.spec){case G.PerCount:e="Tpb";break;case G.PerVolume:e="Vpb";break;case G.PerRange:e="Rpb";break;case G.PerSeconds:e="Spb";break;default:t=!1}return`${t?this.size:""}${e}`}if(this.unit===$.Intraday)return this.size%60==0?`${this.size/60}h`:`${this.size}`;{let e="";return this.spec===G.Nearest?e="n":this.spec===G.Continue&&(e="c"),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e="";switch(this.unit){case $.Tick:e="Tick";break;case $.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 $.Day:e="Daily";break;case $.Week:e="Weekly";break;case $.Month:e="Monthly";break;case $.Quarter:e="Quarterly";break;case $.Year:e="Yearly"}return e}describe(){let e=this.unitToString();switch(this.spec){case G.Nearest:e+=" Nearest";break;case G.Continue:e+=" Continue";break;case G.PerCount:e="Ticks Per Bar";break;case G.PerVolume:e="Volume Per Bar";break;case G.PerRange:e="Range Per Bar";break;case G.PerSeconds:e="Seconds Per Bar";case G.None:}return e}get hasSpec(){return this.spec!==G.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===$.Tick}get isIntraday(){return this.unit===$.Intraday}get isMultiContract(){let e=this.spec===G.Nearest,t=this.spec===G.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}}function nC(e){delete e.display.chart.bar}function nE(e){eH(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,eH(e.data.range)&&delete e.data.range,delete e.data.checkRange}function n_(e){n7(e.display.period)&&delete e.display.period}function nM(e){eH(e.display.density)&&delete e.display.density}function nL(e){switch(W[e]){case W.Candlestick:case W.HollowCandles:case W.HeikinAshi:case W.ElderImpulseSystem:case W.Column:case W.Renko:case W.Range:case W.Kagi:case W.PointAndFigure:case W.LineBreak:case W.HLC:return!0;default:return!1}}function nx(e,t){let i=y0().getDefaultMultiFieldCurve();if(null!==i&&i.style===e)return i;let s=e=>e.id,r=[aa.Open,aa.High,aa.Low,aa.Close,aa.Change].map(s);W[e]===W.HLC&&r.splice(0,1);let n=[aa.Close].map(s),a=eG(tG.COLOR_DEFAULT_AREA),o=eG(tG.COLOR_DEFAULT_OHLC),l=eG(tG.COLOR_DEFAULT_VARY),u={fields:r,colors:l,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch(W[e]){case W.OHLC:case W.HLC:case W.Renko:case W.LineBreak:case W.Range:case W.Kagi:case W.PointAndFigure:u.colors=t?l:[o];break;case W.Candlestick:case W.HollowCandles:case W.HeikinAshi:case W.MultiColumn:break;case W.ElderImpulseSystem:u.colors=l.concat(a);break;case W.Line:case W.PercentChange:u.fields=n,u.colors=[o];break;case W.Area:u.fields=n,u.colors=[iP(a,.5),a];break;case W.Baseline:u.fields=n,u.colors=l.map(e=>iP(e,.5)),u.zones=[{value:0,colors:1},{colors:1}];break;case W.Column:u.fields=n;break;default:throw Error(`Curve style "${e}" is not supported here.`)}return u}let nO=["Renko","Kagi","PointAndFigure","LineBreak","Baseline"];function nI(e,t){let i=t.curves[0],s=nj(e);return s.curves=[function(e,t){var i;Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||nL(e.style)||void 0!==(i=e.attributes)&&i.length>0&&i.some(e=>e===U[U.ChangeBased]||e===U[U.OpenVsClose]));let s=function(e,t){switch(e){case X.Symbol:case X.Expression:{let e=t.style||"Candlestick",i=t.varyColorPerBar||nL(e);return nx(e,i)}case X.Forward:case X.Seasonal:return{fields:["Close"],style:"Line",lineWidth:2,visible:!0,colors:["#888"],varyColorPerBar:!1};default:throw Error(`Unexpected plot type '${X[e]}', don't know its default curve.`)}}(X[t],e);return ez(s,e,!1),s}(i,t.type)],t.isMultiCurveMain&&t.curves.length>1&&s.curves.push(...t.curves.slice(1)),"Symbol"===t.type&&eH(i)&&nO.includes(i.style)&&(eH(t.inputs)?s.inputs=t.inputs:delete s.inputs),e}function nD(e,t,i){return(i=i||" ",e.length>t)?e:(t-=e.length,e+(i+=i.repeat(t)).slice(0,t))}class nw extends Error{static buildMessage(e,t){function i(e){return e.charCodeAt(0).toString(16).toUpperCase()}function s(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"+i(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+i(e))}function r(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"+i(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+i(e))}function n(e){switch(e.type){case"literal":return'"'+s(e.text)+'"';case"class":let t=e.parts.map(e=>Array.isArray(e)?r(e[0])+"-"+r(e[1]):r(e));return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}return"Expected "+function(e){let t,i,s=e.map(n);if(s.sort(),s.length>0){for(t=1,i=1;t<s.length;t++)s[t-1]!==s[t]&&(s[i]=s[t],i++);s.length=i}switch(s.length){case 1:return s[0];case 2:return s[0]+" or "+s[1];default:return s.slice(0,-1).join(", ")+", or "+s[s.length-1]}}(e)+" but "+(t?'"'+s(t)+'"':"end of input")+" found."}message;expected;found;location;name;constructor(e,t,i,s){super(),this.message=e,this.expected=t,this.found=i,this.location=s,this.name="SyntaxError","function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(this,nw.prototype):this.__proto__=nw.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,nw)}format(e){let t="Error: "+this.message;if(this.location){let i,s=null;for(i=0;i<e.length;i++)if(e[i].source===this.location.source){s=e[i].text.split(/\r\n|\n|\r/g);break}let r=this.location.start,n=this.location.source+":"+r.line+":"+r.column;if(s){let e=this.location.end,i=nD("",r.line.toString().length," "),a=s[r.line-1],o=r.line===e.line?e.column:a.length+1;t+="\n --\x3e "+n+"\n"+i+" |\n"+r.line+" | "+a+"\n"+i+" | "+nD("",r.column-1," ")+nD("",o-r.column,"^")}else t+="\n at "+n}return t}}let nR=function(e,t){var i,s,r;let n,a={},o=(t=void 0!==t?t:{}).grammarSource,l={expr:k},u=k,h=R("+",!1),c=R("-",!1),d=function(e,t){var i,s;return i=t,s=e,i.reduce(function(e,t){var i=t.filter(e=>"ws"!==e.op);return{op:i[0],left:e,right:i[1]}},s)},p=R("*",!1),f=R("/",!1),m=R("^",!1),g=R("(",!1),y=R(")",!1),T=/^[0-9]/,A=N([["0","9"]],!1,!1),S=R(".",!1),v=R("{",!1),b=/^[A-Za-z0-9\^*$-.|:_]/,P=N([["A","Z"],["a","z"],["0","9"],"^","*",["$","."],"|",":","_"],!1,!1),C=R("}",!1),E=/^[A-Za-z]/,_=N([["A","Z"],["a","z"]],!1,!1),M=/^[ \t\r\n]/,L=N([" "," ","\r","\n"],!1,!1),x=0,O=0,I=[{line:1,column:1}],D=0,w=[];if(void 0!==t.startRule){if(!(t.startRule in l))throw Error("Can't start parsing from rule \""+t.startRule+'".');u=l[t.startRule]}function R(e,t){return{type:"literal",text:e,ignoreCase:t}}function N(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function V(t){let i,s=I[t];if(s)return s;for(i=t-1;!I[i];)i--;for(s={line:(s=I[i]).line,column:s.column};i<t;)10===e.charCodeAt(i)?(s.line++,s.column=1):s.column++,i++;return I[t]=s,s}function H(e,t){let i=V(e),s=V(t);return{source:o,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:s.line,column:s.column}}}function F(e){x<D||(x>D&&(D=x,w=[]),w.push(e))}function k(){return B()}function B(){let t,i,s,r,n,o,l;if(t=x,(i=U())!==a){if(s=[],r=x,(n=z())!==a?(43===e.charCodeAt(x)?(o="+",x++):(o=a,F(h)),o===a&&(45===e.charCodeAt(x)?(o="-",x++):(o=a,F(c))),o!==a&&(l=U())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a),r!==a)for(;r!==a;)s.push(r),r=x,(n=z())!==a?(43===e.charCodeAt(x)?(o="+",x++):(o=a,F(h)),o===a&&(45===e.charCodeAt(x)?(o="-",x++):(o=a,F(c))),o!==a&&(l=U())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a);else s=a;s!==a?(O=t,t=i=d(i,s)):(x=t,t=a)}else x=t,t=a;return t===a&&(t=U()),t}function U(){let t,i,s,r,n,o,l;if(t=x,(i=G())!==a){if(s=[],r=x,(n=z())!==a?(42===e.charCodeAt(x)?(o="*",x++):(o=a,F(p)),o===a&&(47===e.charCodeAt(x)?(o="/",x++):(o=a,F(f))),o!==a&&(l=G())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a),r!==a)for(;r!==a;)s.push(r),r=x,(n=z())!==a?(42===e.charCodeAt(x)?(o="*",x++):(o=a,F(p)),o===a&&(47===e.charCodeAt(x)?(o="/",x++):(o=a,F(f))),o!==a&&(l=G())!==a?r=n=[n,o,l]:(x=r,r=a)):(x=r,r=a);else s=a;s!==a?(O=t,t=i=d(i,s)):(x=t,t=a)}else x=t,t=a;return t===a&&(t=G()),t}function W(){let t,i,s,r;return(t=x,(i=$())!==a&&z()!==a&&(94===e.charCodeAt(x)?(s="^",x++):(s=a,F(m)),s!==a&&z()!==a&&(r=$())!==a))?(O=t,t=i={op:"^",left:i,right:r}):(x=t,t=a),t===a&&(t=$()),t}function $(){let t,i,s,r;return(t=function(){let t,i,s,r,n,o,l,u;if(t=x,(i=z())!==a){if(s=x,r=[],T.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(A)),n!==a)for(;n!==a;)r.push(n),T.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(A));else r=a;if(r!==a){if(n=x,46===e.charCodeAt(x)?(o=".",x++):(o=a,F(S)),o===a&&(o=null),o!==a){for(l=[],T.test(e.charAt(x))?(u=e.charAt(x),x++):(u=a,F(A));u!==a;)l.push(u),T.test(e.charAt(x))?(u=e.charAt(x),x++):(u=a,F(A));l!==a?n=o=[o,l]:(x=n,n=a)}else x=n,n=a;n===a&&(n=null),n!==a?s=r=[r,n]:(x=s,s=a)}else x=s,s=a;s!==a?(O=t,t=i={op:"num",left:parseFloat(e.substring(O,x))}):(x=t,t=a)}else x=t,t=a;return t}())===a&&(t=function(){let t,i,s,r,n,o,l,u,h;if(t=x,(i=z())!==a)if(123===e.charCodeAt(x)?(s="{",x++):(s=a,F(v)),s!==a){if(r=[],b.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(P)),n!==a)for(;n!==a;)r.push(n),b.test(e.charAt(x))?(n=e.charAt(x),x++):(n=a,F(P));else r=a;if(r!==a)if(125===e.charCodeAt(x)?(n="}",x++):(n=a,F(C)),n!==a){if(o=x,46===e.charCodeAt(x)?(l=".",x++):(l=a,F(S)),l!==a){if(u=[],E.test(e.charAt(x))?(h=e.charAt(x),x++):(h=a,F(_)),h!==a)for(;h!==a;)u.push(h),E.test(e.charAt(x))?(h=e.charAt(x),x++):(h=a,F(_));else u=a;u!==a?o=l=[l,u]:(x=o,o=a)}else x=o,o=a;if(o===a&&(o=null),o!==a){var c,d;O=t,c=r,d=o,t=i={op:"sym",left:c.join(""),right:null==d?null:d[1].join("")}}else x=t,t=a}else x=t,t=a;else x=t,t=a}else x=t,t=a;else x=t,t=a;return t}())===a&&((t=x,z()!==a&&(40===e.charCodeAt(x)?(i="(",x++):(i=a,F(g)),i!==a&&z()!==a&&(s=B())!==a&&z()!==a&&(41===e.charCodeAt(x)?(r=")",x++):(r=a,F(y)),r!==a)))?(O=t,t={op:"grp",left:s}):(x=t,t=a)),t}function G(){let t,i,s;return(t=x,z()!==a&&(45===e.charCodeAt(x)?(i="-",x++):(i=a,F(c)),i!==a&&z()!==a&&(s=W())!==a))?(O=t,t={op:i,left:s}):(x=t,t=a),t===a&&(t=W()),t}function z(){let t,i,s;for(t=x,i=[],M.test(e.charAt(x))?(s=e.charAt(x),x++):(s=a,F(L));s!==a;)i.push(s),M.test(e.charAt(x))?(s=e.charAt(x),x++):(s=a,F(L));return i!==a&&(O=t,i={op:"ws"}),t=i}if((n=u())!==a&&x===e.length)return n;throw n!==a&&x<e.length&&F({type:"end"}),i=w,s=D<e.length?e.charAt(D):null,r=D<e.length?H(D,D+1):H(D,D),new nw(nw.buildMessage(i,s),i,s,r)},nN=new Map,nV=/\w[:]\w/;function nH(e){return"error"in e}function nF(e,t=!1,i=!0){let s=e.trim();if(t&&nN.has(s))return eG(nN.get(s));try{var r;let n=nR(s);nG(n,e=>e.toUpperCase(),!0,!0);let a=nW(n);i&&(r=a,r.some(e=>e.includes(":"))&&(nB(n,(e,t,i)=>{let s=(e,t=null,i="sym")=>({op:i,left:e,right:t});if("sym"!==e.op||!nV.test(t))return null;let r=t.split(":");return e.op="grp",e.left=s(s(r[0]),s(r[1]),"-"),null}),1))&&(a=nW(n));let o=nU(n),l={text:e,model:n,clean:o,symbols:a};return t&&nN.set(s,l),l}catch(i){let t=i.location.start;return{text:e,error:`${i.message}
2
+ Location: line ${t.line}, column ${t.column}.`}}}function nk(e,t){var i;return nB(e,(i=t,(e,t,s)=>{if(function(e){return!eH(e.right)}(e)){if(null===t)return null;switch(e.op){case"-":return-t;case"grp":case"num":return t;case"sym":return i(t);default:throw Error(`Unrecognized unary operator ${e.op}`)}}if(null===t||null===s)return null;switch(e.op){case"+":return t+s;case"-":return t-s;case"*":return t*s;case"/":return t/s;case"^":return Math.pow(t,s);case"sym":return i(t,s);default:throw Error(`Unrecognized binary operator ${e.op}`)}}))}function nB(e,t){if(!eH(e))return null;let i=typeof e;if("number"===i||"string"===i)return e;let s=nB(e.left,t),r=nB(e.right,t);return t(e,s,r)}function nU(e){return nB(e,nz)}function nW(e){let t=new Set;return nB(e,(e,i,s)=>("sym"===e.op&&t.add(i),null)),Array.from(t)}function n$(e){let t=0,i=["+","-","*","/","^"];return nB(e,(e,s,r)=>(i.includes(e.op)&&t++,null)),t>0}function nG(e,t,i=!1,s=!1){let r=i?e:eG(e);return nB(r,(e,i,r)=>("sym"===e.op&&(e.left=t(i),s&&e.right&&(e.right=t(e.right))),null)),r}function nz(e,t,i){if(eH(e.right))switch(e.op){case"+":case"-":case"*":case"/":case"^":return`${t} ${e.op} ${i}`;case"sym":return`{${t}}.${i}`;default:throw Error(`Unrecognized binary operator ${e.op}`)}switch(e.op){case"-":return`${e.op}${t}`;case"grp":return`(${t})`;case"sym":return`{${t}}`;case"num":return t.toString();default:throw Error(`Unrecognized unary operator ${e.op}`)}}let nY="..plots{.main === true}";function nj(e){return sG(e,nY)[0]}function nK(e){let t=sG(e,`..panes{${nY}}`)[0],i=sG(t,`..axes{${nY}}`)[0];return{mainPane:t,mainAxis:i}}let nq="Symbol",nX="Expression",nZ="Forward",nJ="Seasonal",nQ=[nq,nX,nZ,nJ];function n0(e){let t=nF(e),i=nH(t),s=i?0:t.symbols.length,r=!i&&s>0?t.symbols[0]:null,n=i?void 0:t.clean,a=i?t.error:void 0;return{clean:n,hasErrors:i,symbolCount:s,firstSymbol:r,error:a}}function n1(e,t){let i=nj(e),s=e=>eH(t[e.toLowerCase()]),r=nQ.find(e=>s(e)),n=r.toLowerCase(),a=t[n],o=a===tG.PLACEHOLDER_SYMBOL_NAME,l=s(nX)||s(nZ)||s(nJ),u=nQ.some(e=>s(e)&&i.type!==e),h=y0().config.cachedAnnotationsCount||0,{mainAxis:c}=nK(e);u&&(c.comparison="None");let d=n0(a),p=e=>{throw Error(e)};!o&&(l?(d.hasErrors&&p(`[Main Plot] "${a}" is an invalid expression.
3
+ ${d.error}`),a=d.clean):d.hasErrors||p(`[Main Plot] "${a}" is an expression, unsupported for ${n}.`));let f=(e,t)=>e.findIndex(e=>e.symbol===t),m=(e,t)=>{if(e===tG.PLACEHOLDER_SYMBOL_NAME)return;let i=t.annotations||[],s=t.annCache||[],r=f(s,e);-1!==r&&s.splice(r,1),i.length>0&&(s.length+1>h&&s.splice(0,s.length+1-h),s.push({symbol:e,annotations:i})),t.annCache=s},g=(e,t)=>{let i=t.annCache||[],s=f(i,e);-1!==s&&(t.annotations=i[s].annotations)},y=e=>{if(i.type===nq)m(i.symbol,e);else if(i.type===nX)m(i.expression,e);else if(i.type===nJ){let t=n0(i.seasonal);1===t.symbolCount&&m(t.firstSymbol,e)}delete e.annotations,s(nq)?g(t.symbol,e):s(nX)?g(t.expression,e):s(nJ)&&1===d.symbolCount&&g(t.seasonal,e)};if(h>0)for(let t of sG(e,"..axes"))y(t);let T=s(nX)&&i.type===nq||s(nq)&&i.type===nX,A=sz(e,nY,e=>(u&&(delete e.expression,delete e.symbol,delete e.showPrevious,delete e.forward,delete e.offsets,delete e.seasonal,e.type=r,T||(e.curves=[{}]),(s(nZ)||s(nJ))&&(e.offsets=[0])),e[n]=a,e));if(u)if(s(nZ))A.data.aggregation={unit:"Month"},A.display.period="P10Y";else if(s(nJ)&&!A.data.aggregation.isEndOfDay)A.data.aggregation={unit:"Day"},A.display.period=s(nJ)?"P9M":"P1Y10D";else if(i.type===nZ||i.type===nJ){A.data.aggregation=y0().getDefaultAggregation(),A.data.maxDataPoints=tG.DEFAULT_MAX_RECORDS;let e=y0().getDefaultPeriod();eH(e)&&(A.display.period=e)}else s(nX)&&i.type===nq&&(nO.includes(i.curves[0].style)&&(A=sz(A,nY,e=>(delete e.inputs,e))),"PerRange"===A.data.aggregation.spec&&(A.data.aggregation={unit:"Day"}));for(let[e,t]of new Map([['..plots{.type === "Study"}',e=>{let t=sw(e.study);if(!eV(t))return tG.NULL_OBJECT;let i=sH(t);return s(nZ)||s(nJ)||s(nX)&&i?tG.NULL_OBJECT:e}],['..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}',e=>s(nq)?(e.symbol=a,e):tG.NULL_OBJECT],["..plots{..events}",e=>(s(nq)||delete e.events,e)]]))A=sz(A,e,t);return u&&!T&&(A=nI(A,{type:r,curves:[{}]})),A=at(A)}function n2(e){let t=y0().getDefaultDensity();eH(t)&&(e.display.density=t)}function n3(e,t){return sz(e,'..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}',e=>(e.fields=t?[aa.TradeSize.id]:[aa.Volume.id],e))}function n4(e,t){let i=ny(e.data.aggregation),s=i.isTick&&!i.hasSpec,r=ny(t),n=r.isTick&&!r.hasSpec,a=e=>e.isIntraday&&e.hasSpec&&e.spec===G.PerRange,o=a(i),l=a(r),u=sz(e,`${nY}.curves[0]`,e=>{let t=[aa.Open.id,aa.High.id,aa.Low.id,aa.Close.id,aa.Change.id].slice();if(!o&&l)return nx("Range",!0);if(o&&!l&&(e.style="OHLC"),!n&&s){let i=y0().getDefaultMultiFieldCurve();if(null!==i)return i;e.fields=t,"Candlestick"!==e.style&&"OHLC"!==e.style&&"HLC"!==e.style&&(e.style="Candlestick",e.colors=["#ff6961","#77dd77"],e.varyColorPerBar=!0),"HLC"===e.style&&e.fields.splice(0,1)}else n&&!s&&(e.fields=[aa.Last.id,aa.Change.id],e.style="Line",e.colors=["#0055cc"],e.varyColorPerBar=!1);return e});return ez((u=u=n3(u,n)).data.aggregation,t,!1),(i.unit!==r.unit||i.size!==r.size)&&(n_(u),nE(u),n2(u),nC(u)),u}function n5(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getTime()<s.getTime()}function n6(e,t){return te(2,arguments),ts(e,-e9(t))}function n7(e){return eH(e)&&e!==tG.AUTOFIT_PERIOD}var n8={};n8=R("2nrEA");let n9=null;function ae(t,i){null===n9&&((n9=e(n8)()).defaultOptions.useDefault=!0,[tG.CHART_SCHEMA,tG.STUDIES_SCHEMA,tG.FIELDS_SCHEMA,tG.ACCESSOR_SCHEMA].forEach(e=>{n9.addSchema(e,s_(e))}));let s=function(e,t){if(t===tG.CHART_SCHEMA){let s=sG(s_(t),".properties.version.minimum")[0],r=e.version;if(r<s){var i=r;let t=e;try{for(sx=!1;i<s;)t=(0,no[`_${i}to${i+1}`])(t),i+=1}finally{sx=!0}return t}}return e}(t,i);i===tG.CHART_SCHEMA&&(sG(s,`..plots{.type==="${X[X.Study]}"}`).forEach(e=>{let t=sw(e.study);eH(t)&&eY(e,t.defaults)}),s=function(e){let t=sG(e,"..axes{.annotations{.points{!.price || !.time}}}");t.length>0&&t.forEach(e=>{let t=e.annotations.map(e=>{let t=e.points.find(e=>eH(e.price)),i=e.points.find(e=>eH(e.time));return eH(t)&&eH(i)?(e.points.forEach(e=>{eH(e.price)||(e.price=t.price),eH(e.time)||(e.time=i.time)}),e):null}).filter(e=>eH(e));t.length>0?e.annotations=t:delete e.annotations});let i=sG(e,"..panes"),s=e=>eH(e.height)?e.height:1,r=Math.min(...i.map(e=>s(e))),n=r<.01?5/r:1;i.forEach(e=>e.height=eF(n*s(e),4));let a=y0().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=a;let o="wheel+shift",l=y0().config.scrollBehavior||o;Object.values(en).filter(e=>"string"==typeof e).includes(l)||(l=o),e.display.scrollBehavior=l;let u=sG(e,'..plots{.type === "Study" && .study === "RSI"}');u.length>0&&u.forEach(e=>{if(eH(e.bands)&&e.bands.length>0){let t=e.inputs&&1===e.inputs.length&&e.inputs[0].name===tG.INPUT_PERIOD?e.inputs[0].value:null,i=sw("RSI").defaults;e.curves=i.curves,e.inputs=i.inputs,eH(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=i.levels}}),e.display?.density?(n_(e),nE(e)):n7(e.display?.period)&&nE(e);let h=e$(e.display,null,"chart","bar");if(eH(h)){let[e,t]=eQ(h.width||0,h.spacing||0,tG.MINIMUM_BAR_WIDTH,tG.MAXIMUM_BAR_WIDTH);h.width=e,h.spacing=t}e.display?.period&&"YTD"===e.display.period&&delete e.display.period;let c=sG(e,"..annotations{.traits.fill.color === null}");c.length>0&&c.forEach(e=>{e.traits.fill.color="rgba(0, 0, 0, 0)"});let{from:d,to:p}=e.display?.xAxis?.visibleRange||{},f=null===d,m=null===p;f&&delete e.display.xAxis.visibleRange.from,m&&delete e.display.xAxis.visibleRange.to,f&&m&&delete e.display.xAxis.visibleRange;let g=sG(e,"..panes[0].axes[0].scale");if(1===g.length){let t=g[0],i=sG(e,"..panes[0]..axes");i.length>0&&i.forEach(e=>e.scale=t)}let[y]=sG(e,nY);eH(y)&&y.type===X[X.Symbol]&&!nO.includes(y.curves[0].style)&&eH(y.inputs)&&delete y.inputs;let[T]=sG(e,nY);eH(T)&&T.type===X[X.Symbol]&&T.curves[0].style===W[W.Renko]&&eH(T.inputs)&&T.inputs.map(e=>e.value).some(e=>void 0===e)&&(T.inputs=eG(tG.DEFAULT_RENKO_INPUTS)),function(e){let[t]=sG(e,nY);if(eH(t)&&t.type===X[X.Expression]){let i=t.curves[0].style,s=i===W[W.Range],r=i===W[W.Baseline],n=nO.includes(i);s&&e.data?.aggregation.spec===G[G.PerRange]&&(e.data.aggregation={unit:"Day"}),!r&&(n||s)&&(delete t.inputs,t.curves[0]=nx("Candlestick",!0))}}(e),sG(e,"..annotations").forEach(e=>{let{id:t,traits:i}=e;s8(t,i),s7(t,i)});try{sx=!1,sG(e,'..plots{.type === "Study" && .curves.zones}').forEach(e=>{let t=sw(e.study).defaults;for(let i=0;i<(e.curves?.length??0);i++){let s=e.curves[i];if(s.zones&&(s.colors?.length??0)<(t.curves[i].colors?.length??0)){let e=t.curves[i].colors.slice(s.colors?.length??0);s.colors?.length?s.colors.push(...e):s.colors=e}}})}finally{sx=!0}let[A]=sG(e,nY);if("Symbol"===A.type&&A.curves?.length===1){let e=A.curves[0];if("HLC"===e.style){let t=e.colors?.length;if(1===t){let t=e.colors[0];e.colors=[t,t],e.varyColorPerBar=!0,e.attributes=["OpenVsClose"]}else 2!==t||e.attributes||(e.attributes=["OpenVsClose"])}}let S=sG(e,"..annotations{.id === 'RewardRisk' || .id === 'ProfitLoss' }");S.length>0&&S.forEach(e=>{e.traits.prices=e.traits.prices.map(e=>"string"==typeof e?Number.parseFloat(e):e),"RewardRisk"===e.id&&(e.traits.ratio=Math.abs(e.traits.ratio),e.traits.textLines=e.traits.textLines.map(e=>e.match(/Ratio/)?e.replace("-",""):e))}),y0()?.config?.mode==="cmdtyView"&&(delete e.data?.extendedHours,delete e.data?.buildContinuation);let v=e.data?.aggregation,b=eV(e.data?.extendedHours);v&&"FormT"===v.spec&&(v.spec="None",b||(e.data.extendedHours=!0));let P=e.data?.buildContinuation,C=eV(P),E=e.data?.aggregation;C&&E&&("Continue"!==E.spec||P||(E.spec="None"),P&&(E.spec="Continue"));try{sx=!1,sG(e,'..plots{.type === "Study" && .curves.varyColorPerBar}').forEach(e=>{let t=sw(e.study).defaults;if(e?.curves?.length===t?.curves.length&&t?.curves.length>0)for(let i=0;i<e.curves.length;i++)e.curves[i].varyColorPerBar=t.curves[i].varyColorPerBar})}finally{sx=!0}try{sx=!1,sG(e,'..plots{.type === "Study"}').forEach(e=>{let t=sw(e.study).defaults;eV(e.inputs)&&e.inputs.forEach((e,i)=>{let s=t.inputs?.[i]?.value;!eV(e.value)&&eV(s)&&(e.value=s)}),eV(e.levels)&&e.levels.forEach((e,i)=>{let s=t.levels?.[i]?.value;!eV(e.value)&&eV(s)&&(e.value=s)}),eV(e.bands)&&e.bands.forEach((e,i)=>{let s=t.bands?.[i]?.range;!eV(e.range.from)&&eV(s?.from)&&(e.range.from=s.from),!eV(e.range.to)&&eV(s?.to)&&(e.range.to=s.to)})})}finally{sx=!0}let _=sz(e,"..annCache{!.annotations}",e=>tG.NULL_OBJECT);_=sz(_,"..annCache",e=>{let t=tL(e.symbol);return null===t?e:n5(t,n6(new Date,3))?tG.NULL_OBJECT:e});let M=(_=sz(_,"..annotations{.id === 'ComputedText' && !.traits.textLines}",e=>tG.NULL_OBJECT)).data.aggregation;return n3(_,"Tick"===M.unit&&"None"===M.spec)}(s));let r=n9.validate(i,s);if(r){let e=JSON.stringify(r,null,4);throw Error(`Document not valid according to schema ${i}; error is ${e}`)}return i===tG.ACCESSOR_SCHEMA&&function(e){let{id:t,context:i}=e,s=e=>eH(i[e]),r=(e,t)=>{if(!eH(i[e]))throw Error(`${t} plot accessor: you must provide '${e}'`)},n=e=>{if(s("placement")&&"clone"===i.placement&&!s("cloneIndex"))throw Error(`${e} plot accessor: when placement is 'clone', you must provide 'cloneIndex'.`)};if("Plot"===t)switch(i.id){case"Add":switch(r("type","Add"),i.type){case"Study":r("studyId","Add"),n("Add");break;case"IncomeStatement":case"BalanceSheet":r("fundamentalId","Add");break;case"Expression":r("expression","Add")}break;case"Get":if(!s("main")&&!s("type"))throw Error("Get plot accessor: you must provide either 'main' or 'type'");break;case"Delete":r("type","Delete"),r("index","Delete");break;case"Update":switch(r("type","Update"),!s("main")&&r("index","Update"),n("Update"),i.type){case"Forward":if(!eH(i.forward)){if(!eH(i.curves)||!eH(i.offsets))throw Error("Update forward plot accessor: you must provide either 'forward' or 'curves' and 'offsets'");if(i.curves.length!==i.offsets.length)throw Error("Update forward plot accessor: you must provide same number of elements for 'curves' and 'offsets'")}break;case"Seasonal":if(!eH(i.seasonal)){if(!eH(i.curves)||!eH(i.offsets))throw Error("Update seasonal plot accessor: you must provide either 'seasonal' or 'curves' and 'offsets'");if(i.curves.length!==i.offsets.length&&i.curves.length!==i.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":{r("studyId","Update"),n("Update");let e=e=>e.reduce((e,t)=>e.concat(t.fields),[]),t=sw(i.studyId);if(!eH(i.curves)||i.curves.length!==t.defaults.curves.length)throw Error("Update study plot accessor: you must provide same number of elements for 'curves' of the study as defined in the taxonomy");let s=e(i.curves);if(0!==eS(e(t.defaults.curves),s).length){let e;throw Error((e="fields",`Update study plot accessor: incoming list of ${e} is different from the ${e} as defined in the taxonomy`))}}}}}(s),s}function at(e){let t=sz(e,"..panes{.axes{!.plots}}",e=>(1===e.axes.length?e.axes=[]:0===e.axes[1].plots.length&&(e.axes.pop(),0===e.axes[0].plots.length&&(e.axes=[])),e));return sz(t,"..panes{!.axes}",e=>tG.NULL_OBJECT)}var ai={};ai=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":"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":"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":"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":"BOLLBW","category":"Study","name":"Bollinger-Width","shortName":"BOLLW"},{"id":"BOLLBP","category":"Study","name":"Bollinger-Percent","shortName":"%B"},{"id":"BOLLSQ","category":"Study","name":"Bollinger-Squeeze","shortName":"BOLL(S)"},{"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":"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":"REATRHI","category":"Study","name":"RetraceATRHigh","shortName":"REATRHI"},{"id":"REATRLO","category":"Study","name":"RetraceATRLow","shortName":"REATRLO"},{"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":"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":"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":"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"}]');class as{id;type;category;name;format;shortName;constructor(e,t=z.Number,i=j.Common,s,r=Y.FromMetaData,n){this.id=e,this.type=t,this.category=i,this.name=s,this.format=r,this.shortName=n;let a="_"===e.charAt(0);null==s&&(this.name=a?e:this.id.replace(/([A-Z])/g," $1").trim()),this.shortName=n??this.name}}let ar={};function an(e){ae(e,tG.FIELDS_SCHEMA).map(e=>{ar[e.id]=new as(e.id,z[e.type],j[e.category],e.name,Y[e.format],e.shortName)})}let aa=(an(e(ai)),ar),ao={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"},al=[aa.Open,aa.High,aa.Low,aa.Close,aa.Volume,aa.Change,aa.PercentChange,aa.PreviousClose].reduce((e,t,i)=>(e.set(t.id,1<<i),e),new Map);function au(...e){return e.reduce((e,t)=>al.has(t.id)?e|al.get(t.id):e,0)}class ah{symbol;storage;fields;_updated;isValid;constructor(e=""){this.symbol=e,this.fields=[],this._updated=0,this.isValid=!1,this.storage=new Map,this.isValid=!1,this.resetUpdated()}get updated(){return this._updated}resetUpdated(){this._updated=0}addFields(...e){this.fields=function(e,t){let i=e?e.slice():[];return t.forEach(e=>{i.includes(e)||i.push(e)}),i}(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 i=e.id,s=this.storage.get(i);this.storage.set(i,t);let r=s!==t;return r&&al.has(i)&&(this._updated=this._updated|al.get(i)),r}}computeWellKnown(){let e=this.getValue(aa.Close),t=this.getValue(aa.PreviousClose);eH(e,t)&&(this.hasField(aa.Change)&&this.update(aa.Change,e-t),this.hasField(aa.PercentChange)&&this.update(aa.PercentChange,(e-t)/t))}hasField(e){return eH(this.fields)&&this.fields.includes(e)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}}class ac extends ah{translated;constructor(e){super(),this.symbol=e,this.translated=tQ(this.symbol)}hasSymbol(e){return this.symbol===e}}class ad extends ah{actual;constructor(e){super(tG.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}}class ap extends ah{constructor(e){super(),this.symbol=e}hasSymbol(e){return this.symbol===e}async ready(){return!0}hasField(e){return!1}getValue(e){return null}}let af={previousOpen:aa.PreviousOpen,previousClose:aa.PreviousClose,previousHigh:aa.PreviousHigh,previousLow:aa.PreviousLow,weeklyPreviousClose:aa.WeekPreviousClose,weeklyPreviousHigh:aa.WeekPreviousHigh,weeklyPreviousLow:aa.WeekPreviousLow,monthlyPreviousClose:aa.MonthPreviousClose,monthlyPreviousHigh:aa.MonthPreviousHigh,monthlyPreviousLow:aa.MonthPreviousLow,fiftyTwoWkHigh:aa.YearHigh,fiftyTwoWkLow:aa.YearLow},am={open:aa.Open,high:aa.High,low:aa.Low,close:aa.Close,lastPrice:aa.Last,volume:aa.Volume,netChange:aa.Change,percentChange:aa.PercentChange},ag=Object.values(af),ay=Object.keys(af),aT=Object.keys(am);class aA extends ac{triedFetchingExtraValues=!1;includeBaseFields=!1;async ready(){return tU.call(this,async()=>{let e=y0().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid})}shutdown(){}getValue(e){return this.hasField(e)&&ag.includes(e)&&null===super.getValue(e)&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,yX("ondemand",`/getQuote.json?symbols=${this.translated}&fields=${ay.join(",")}`).then(e=>{try{let t=JSON.parse(e);if(200===t.status.code&&1===t.results.length){let e=t.results[0];ay.forEach(t=>this.update(af[t],e[t])),this.includeBaseFields&&aT.forEach(t=>this.update(am[t],e[t])),y0().getRecordSource().subject.next({topic:ao.RT_QUOTE,data:{symbol:this.symbol}})}}catch(e){yK(`Failed to fetch extra values for ${this.translated}`,"error")}})}}class aS extends aA{constructor(e){super(e),this.includeBaseFields=!0,this.supplementPreviousValues()}async ready(){return Promise.resolve(!0)}}class av extends ac{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){eH(t)&&(this.addFields(e),this.update(e,t))}async ready(){return tU.call(this,async()=>{let e=y0().config.environment===V[V.NodeJs]?null:tD(`#${tG.INLINE_DATA_ELEMENT_ID}`);if(eH(e)){let t=JSON.parse(e);if(this.translated in t){let e=t[this.translated].quote;this.update(aa.Open,e.open),this.update(aa.High,e.high),this.update(aa.Low,e.low),this.update(aa.Close,e.close),this.update(aa.PreviousClose,e.previousClose),this.update(aa.Volume,e.volume),ay.filter(e=>"previousClose"!==e).forEach(t=>{this.addOptionalField(af[t],e[t])}),this.isValid=!0}else this.isValid=!1}else this.isValid=!1;return this.isValid})}}let ab=[aa.Open,aa.High,aa.Low,aa.Close,aa.PreviousClose];class aP extends ah{mapping;resolved;model;constructor(e,t){super(),this.resolved=e.map(([e,t])=>t),this.mapping=new Map(e.map(([e,t])=>[e,y0().getRecordSource().getRecord(t)])),this.model=t;let i=ab.concat(aa.Change,aa.PercentChange);this.addFields(...i.filter(e=>e!==aa.Volume))}async ready(){return tU.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(){ab.forEach(e=>{let t=nk(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)}),this.computeWellKnown()}}function aC(e,t){return i=>i.topic===e&&i.data.symbol===t}var aE=function(e,t){return(aE=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function a_(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}aE(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function aM(e,t){var i,s,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function o(o){return function(l){var u=[o,l];if(i)throw TypeError("Generator is already executing.");for(;n&&(n=0,u[0]&&(a=0)),a;)try{if(i=1,s&&(r=2&u[0]?s.return:u[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,u[1])).done)return r;switch(s=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,s=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){a.label=u[1];break}if(6===u[0]&&a.label<r[1]){a.label=r[1],r=u;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(u);break}r[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],s=0}finally{i=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function aL(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],s=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ax(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return a}function aO(e,t,i){if(i||2==arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}function aI(e){return this instanceof aI?(this.v=e,this):new aI(e)}function aD(e){return"function"==typeof e}function aw(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 aR=aw(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function aN(e,t){if(e){var i=e.indexOf(t);0<=i&&e.splice(i,1)}}var aV=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e,t,i,s,r,n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=aL(n),o=a.next();!o.done;o=a.next())o.value.remove(this)}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else n.remove(this);var l=this.initialTeardown;if(aD(l))try{l()}catch(e){r=e instanceof aR?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=aL(u),c=h.next();!c.done;c=h.next()){var d=c.value;try{ak(d)}catch(e){r=null!=r?r:[],e instanceof aR?r=aO(aO([],ax(r)),ax(e.errors)):r.push(e)}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}}if(r)throw new aR(r)}},t.prototype.add=function(e){var i;if(e&&e!==this)if(this.closed)ak(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!=(i=this._finalizers)?i:[]).push(e)}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&aN(t,e)},t.prototype.remove=function(e){var i=this._finalizers;i&&aN(i,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),aH=aV.EMPTY;function aF(e){return e instanceof aV||e&&"closed"in e&&aD(e.remove)&&aD(e.add)&&aD(e.unsubscribe)}function ak(e){aD(e)?e():e.unsubscribe()}var aB=function(e){function t(t,i){return e.call(this)||this}return a_(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(aV),aU={setInterval:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=aU.delegate;return(null==r?void 0:r.setInterval)?r.setInterval.apply(r,aO([e,t],ax(i))):setInterval.apply(void 0,aO([e,t],ax(i)))},clearInterval:function(e){var t=aU.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},aW=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.scheduler=t,s.work=i,s.pending=!1,s}return a_(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var i,s=this.id,r=this.scheduler;return null!=s&&(this.id=this.recycleAsyncId(r,s,t)),this.pending=!0,this.delay=t,this.id=null!=(i=this.id)?i:this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,i){return void 0===i&&(i=0),aU.setInterval(e.flush.bind(e,this),i)},t.prototype.recycleAsyncId=function(e,t,i){if(void 0===i&&(i=0),null!=i&&this.delay===i&&!1===this.pending)return t;null!=t&&aU.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var i=this._execute(e,t);if(i)return i;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var i,s=!1;try{this.work(e)}catch(e){s=!0,i=e||Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,i=this.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,aN(s,this),null!=t&&(this.id=this.recycleAsyncId(i,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(aB),a$={now:function(){return(a$.delegate||Date).now()},delegate:void 0},aG=function(){function e(t,i){void 0===i&&(i=e.now),this.schedulerActionCtor=t,this.now=i}return e.prototype.schedule=function(e,t,i){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(i,t)},e.now=a$.now,e}(),az=new(function(e){function t(t,i){void 0===i&&(i=aG.now);var s=e.call(this,t,i)||this;return s.actions=[],s._active=!1,s}return a_(t,e),t.prototype.flush=function(e){var t,i=this.actions;if(this._active)return void i.push(e);this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=i.shift())if(this._active=!1,t){for(;e=i.shift();)e.unsubscribe();throw t}},t}(aG))(aW),aY=void 0,aj={setTimeout:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=aj.delegate;return(null==r?void 0:r.setTimeout)?r.setTimeout.apply(r,aO([e,t],ax(i))):setTimeout.apply(void 0,aO([e,t],ax(i)))},clearTimeout:function(e){var t=aj.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function aK(e){aj.setTimeout(function(){!1;throw e})}function aq(){}var aX=aZ("C",void 0,void 0);function aZ(e,t,i){return{kind:e,value:t,error:i}}var aJ=null;function aQ(e){var t,i,s,r;1;e()}var a0=function(e){function t(t){var i=e.call(this)||this;return i.isStopped=!1,t?(i.destination=t,aF(t)&&t.add(i)):i.destination=a7,i}return a_(t,e),t.create=function(e,t,i){return new a4(e,t,i)},t.prototype.next=function(e){this.isStopped?a6(aZ("N",e,void 0),this):this._next(e)},t.prototype.error=function(e){this.isStopped?a6(aZ("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?a6(aX,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}(aV),a1=Function.prototype.bind;function a2(e,t){return a1.call(e,t)}var a3=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){a5(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){a5(e)}else a5(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){a5(e)}},e}(),a4=function(e){function t(t,i,s){var r,n,a=e.call(this)||this;return aD(t)||!t?r={next:null!=t?t:void 0,error:null!=i?i:void 0,complete:null!=s?s:void 0}:r=t,a.destination=new a3(r),a}return a_(t,e),t}(a0);function a5(e){1;aK(e)}function a6(e,t){}var a7={closed:!0,next:aq,error:function(e){throw e},complete:aq},a8="function"==typeof Symbol&&Symbol.observable||"@@observable",a9=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var i=new e;return i.source=this,i.operator=t,i},e.prototype.subscribe=function(e,t,i){var s=this,r=!function(e){return e&&e instanceof a0||e&&aD(e.next)&&aD(e.error)&&aD(e.complete)&&aF(e)}(e)?new a4(e,t,i):e;return aQ(function(){var e=s.operator,t=s.source;r.add(e?e.call(r,t):t?s._subscribe(r):s._trySubscribe(r))}),r},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var i=this;return new(t=oe(t))(function(t,s){var r=new a4({next:function(t){try{e(t)}catch(e){s(e),r.unsubscribe()}},error:s,complete:t});i.subscribe(r)})},e.prototype._subscribe=function(e){var t;return null==(t=this.source)?void 0:t.subscribe(e)},e.prototype[a8]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===e.length?function(e){return e}:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=oe(e))(function(e,i){var s;t.subscribe(function(e){return s=e},function(e){return i(e)},function(){return e(s)})})},e.create=function(t){return new e(t)},e}();function oe(e){var t;return null!=(t=null!=e?e:aY)?t:Promise}function ot(e){return e&&aD(e.schedule)}function oi(e,t){var i,s,r,n;return void 0===e&&(e=0),void 0===t&&(t=az),e<0&&(e=0),i=e,s=e,void 0===i&&(i=0),void 0===(r=t)&&(r=az),n=-1,null!=s&&(ot(s)?r=s:n=s),new a9(function(e){var t,s=(t=i)instanceof Date&&!isNaN(t)?i-r.now():i;s<0&&(s=0);var a=0;return r.schedule(function(){e.closed||(e.next(a++),0<=n?this.schedule(void 0,n):e.complete())},s)})}var os=aw(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),or=function(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 a_(t,e),t.prototype.lift=function(e){var t=new on(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new os},t.prototype.next=function(e){var t=this;aQ(function(){var i,s;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var r=aL(t.currentObservers),n=r.next();!n.done;n=r.next())n.value.next(e)}catch(e){i={error:e}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(i)throw i.error}}}})},t.prototype.error=function(e){var t=this;aQ(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var i=t.observers;i.length;)i.shift().error(e)}})},t.prototype.complete=function(){var e=this;aQ(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(){var e;return(null==(e=this.observers)?void 0:e.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,i=this.hasError,s=this.isStopped,r=this.observers;return i||s?aH:(this.currentObservers=null,r.push(e),new aV(function(){t.currentObservers=null,aN(r,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,i=this.thrownError,s=this.isStopped;t?e.error(i):s&&e.complete()},t.prototype.asObservable=function(){var e=new a9;return e.source=this,e},t.create=function(e,t){return new on(e,t)},t}(a9),on=function(e){function t(t,i){var s=e.call(this)||this;return s.destination=t,s.source=i,s}return a_(t,e),t.prototype.next=function(e){var t,i;null==(i=null==(t=this.destination)?void 0:t.next)||i.call(t,e)},t.prototype.error=function(e){var t,i;null==(i=null==(t=this.destination)?void 0:t.error)||i.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=null==(e=this.destination)?void 0:e.complete)||t.call(e)},t.prototype._subscribe=function(e){var t,i;return null!=(i=null==(t=this.source)?void 0:t.subscribe(e))?i:aH},t}(or);function oa(e){return function(t){if(aD(null==t?void 0:t.lift))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}function oo(e,t,i,s,r){return new ol(e,t,i,s,r)}var ol=function(e){function t(t,i,s,r,n,a){var o=e.call(this,t)||this;return o.onFinalize=n,o.shouldUnsubscribe=a,o._next=i?function(e){try{i(e)}catch(e){t.error(e)}}:e.prototype._next,o._error=r?function(e){try{r(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,o._complete=s?function(){try{s()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,o}return a_(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;e.prototype.unsubscribe.call(this),i||null==(t=this.onFinalize)||t.call(this)}},t}(a0),ou="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function oh(e){return new a9(function(t){(function(e,t){var i,s,r,n,a,o,l,u;return a=this,o=void 0,l=void 0,u=function(){var a;return aM(this,function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),i=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=aL(e),t={},s("next"),s("throw"),s("return"),t[Symbol.asyncIterator]=function(){return this},t);function s(i){t[i]=e[i]&&function(t){return new Promise(function(s,r){var n,a,o;n=s,a=r,o=(t=e[i](t)).done,Promise.resolve(t.value).then(function(e){n({value:e,done:o})},a)})}}}(e),o.label=1;case 1:return[4,i.next()];case 2:if((s=o.sent()).done)return[3,4];if(a=s.value,t.next(a),t.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return r={error:o.sent()},[3,11];case 6:if(o.trys.push([6,,9,10]),!(s&&!s.done&&(n=i.return)))return[3,8];return[4,n.call(i)];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(r)throw r.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})},new(l||(l=Promise))(function(e,t){function i(e){try{r(u.next(e))}catch(e){t(e)}}function s(e){try{r(u.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):((r=t.value)instanceof l?r:new l(function(e){e(r)})).then(i,s)}r((u=u.apply(a,o||[])).next())})})(e,t).catch(function(e){return t.error(e)})})}function oc(e,t){return oa(function(i,s){var r=0;i.subscribe(oo(s,function(i){return e.call(t,i,r++)&&s.next(i)}))})}function od(e){return(od="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function op(e){return te(1,arguments),(!!function(e){return te(1,arguments),e instanceof Date||"object"===od(e)&&"[object Date]"===Object.prototype.toString.call(e)}(e)||"number"==typeof e)&&!isNaN(Number(ti(e)))}function of(e,t){return te(2,arguments),new Date(ti(e).getTime()+e9(t))}function om(e,t){return te(2,arguments),of(e,-e9(t))}function og(e){te(1,arguments);var t=ti(e),i=t.getUTCDay();return t.setUTCDate(t.getUTCDate()-(7*(i<1)+i-1)),t.setUTCHours(0,0,0,0),t}function oy(e){te(1,arguments);var t=ti(e),i=t.getUTCFullYear(),s=new Date(0);s.setUTCFullYear(i+1,0,4),s.setUTCHours(0,0,0,0);var r=og(s),n=new Date(0);n.setUTCFullYear(i,0,4),n.setUTCHours(0,0,0,0);var a=og(n);return t.getTime()>=r.getTime()?i+1:t.getTime()>=a.getTime()?i:i-1}function oT(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.weekStartsOn)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.weekStartsOn)?r:nd.weekStartsOn)?s:null==(l=nd.locale)||null==(u=l.options)?void 0:u.weekStartsOn)?i:0);if(!(h>=0&&h<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=ti(e),d=c.getUTCDay();return c.setUTCDate(c.getUTCDate()-(7*(d<h)+d-h)),c.setUTCHours(0,0,0,0),c}function oA(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=ti(e),c=h.getUTCFullYear(),d=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.firstWeekContainsDate)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.firstWeekContainsDate)?r:nd.firstWeekContainsDate)?s:null==(l=nd.locale)||null==(u=l.options)?void 0:u.firstWeekContainsDate)?i:1);if(!(d>=1&&d<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(c+1,0,d),p.setUTCHours(0,0,0,0);var f=oT(p,t),m=new Date(0);m.setUTCFullYear(c,0,d),m.setUTCHours(0,0,0,0);var g=oT(m,t);return h.getTime()>=f.getTime()?c+1:h.getTime()>=g.getTime()?c:c-1}function oS(e,t){for(var i=Math.abs(e).toString();i.length<t;)i="0"+i;return(e<0?"-":"")+i}var ov=function(e,t){var i=e.getUTCFullYear(),s=i>0?i:1-i;return oS("yy"===t?s%100:s,t.length)},ob=function(e,t){var i=e.getUTCMonth();return"M"===t?String(i+1):oS(i+1,2)},oP=function(e,t){var i=t.length;return oS(Math.floor(e.getUTCMilliseconds()*Math.pow(10,i-3)),t.length)};function oC(e,t){var i=e>0?"-":"+",s=Math.abs(e),r=Math.floor(s/60),n=s%60;return 0===n?i+String(r):i+String(r)+(t||"")+oS(n,2)}function oE(e,t){return e%60==0?(e>0?"-":"+")+oS(Math.abs(e)/60,2):o_(e,t)}function o_(e,t){var i=Math.abs(e);return(e>0?"-":"+")+oS(Math.floor(i/60),2)+(t||"")+oS(i%60,2)}var oM={G:function(e,t,i){var s=+(e.getUTCFullYear()>0);switch(t){case"G":case"GG":case"GGG":return i.era(s,{width:"abbreviated"});case"GGGGG":return i.era(s,{width:"narrow"});default:return i.era(s,{width:"wide"})}},y:function(e,t,i){if("yo"===t){var s=e.getUTCFullYear();return i.ordinalNumber(s>0?s:1-s,{unit:"year"})}return ov(e,t)},Y:function(e,t,i,s){var r=oA(e,s),n=r>0?r:1-r;return"YY"===t?oS(n%100,2):"Yo"===t?i.ordinalNumber(n,{unit:"year"}):oS(n,t.length)},R:function(e,t){return oS(oy(e),t.length)},u:function(e,t){return oS(e.getUTCFullYear(),t.length)},Q:function(e,t,i){var s=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return oS(s,2);case"Qo":return i.ordinalNumber(s,{unit:"quarter"});case"QQQ":return i.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return i.quarter(s,{width:"narrow",context:"formatting"});default:return i.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,i){var s=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return oS(s,2);case"qo":return i.ordinalNumber(s,{unit:"quarter"});case"qqq":return i.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return i.quarter(s,{width:"narrow",context:"standalone"});default:return i.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,i){var s=e.getUTCMonth();switch(t){case"M":case"MM":return ob(e,t);case"Mo":return i.ordinalNumber(s+1,{unit:"month"});case"MMM":return i.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return i.month(s,{width:"narrow",context:"formatting"});default:return i.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,i){var s=e.getUTCMonth();switch(t){case"L":return String(s+1);case"LL":return oS(s+1,2);case"Lo":return i.ordinalNumber(s+1,{unit:"month"});case"LLL":return i.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return i.month(s,{width:"narrow",context:"standalone"});default:return i.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,i,s){var r=function(e,t){te(1,arguments);var i=ti(e);return Math.round((oT(i,t).getTime()-(function(e,t){te(1,arguments);var i,s,r,n,a,o,l,u,h=e9(null!=(i=null!=(s=null!=(r=null!=(n=null==t?void 0:t.firstWeekContainsDate)?n:null==t||null==(a=t.locale)||null==(o=a.options)?void 0:o.firstWeekContainsDate)?r:nd.firstWeekContainsDate)?s:null==(l=nd.locale)||null==(u=l.options)?void 0:u.firstWeekContainsDate)?i:1),c=oA(e,t),d=new Date(0);return d.setUTCFullYear(c,0,h),d.setUTCHours(0,0,0,0),oT(d,t)})(i,t).getTime())/6048e5)+1}(e,s);return"wo"===t?i.ordinalNumber(r,{unit:"week"}):oS(r,t.length)},I:function(e,t,i){var s=function(e){te(1,arguments);var t=ti(e);return Math.round((og(t).getTime()-(function(e){te(1,arguments);var t=oy(e),i=new Date(0);return i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0),og(i)})(t).getTime())/6048e5)+1}(e);return"Io"===t?i.ordinalNumber(s,{unit:"week"}):oS(s,t.length)},d:function(e,t,i){var s,r;return"do"===t?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):(s=e,r=t,oS(s.getUTCDate(),r.length))},D:function(e,t,i){var s=function(e){te(1,arguments);var t=ti(e),i=t.getTime();return t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),Math.floor((i-t.getTime())/864e5)+1}(e);return"Do"===t?i.ordinalNumber(s,{unit:"dayOfYear"}):oS(s,t.length)},E:function(e,t,i){var s=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return i.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return i.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(s,{width:"short",context:"formatting"});default:return i.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,i,s){var r=e.getUTCDay(),n=(r-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(n);case"ee":return oS(n,2);case"eo":return i.ordinalNumber(n,{unit:"day"});case"eee":return i.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(r,{width:"short",context:"formatting"});default:return i.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,i,s){var r=e.getUTCDay(),n=(r-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(n);case"cc":return oS(n,t.length);case"co":return i.ordinalNumber(n,{unit:"day"});case"ccc":return i.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(r,{width:"narrow",context:"standalone"});case"cccccc":return i.day(r,{width:"short",context:"standalone"});default:return i.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,i){var s=e.getUTCDay(),r=0===s?7:s;switch(t){case"i":return String(r);case"ii":return oS(r,t.length);case"io":return i.ordinalNumber(r,{unit:"day"});case"iii":return i.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return i.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return i.day(s,{width:"short",context:"formatting"});default:return i.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,i){var s=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return i.dayPeriod(s,{width:"narrow",context:"formatting"});default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,i){var s,r=e.getUTCHours();switch(s=12===r?"noon":0===r?"midnight":r/12>=1?"pm":"am",t){case"b":case"bb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return i.dayPeriod(s,{width:"narrow",context:"formatting"});default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,i){var s,r=e.getUTCHours();switch(s=r>=17?"evening":r>=12?"afternoon":r>=4?"morning":"night",t){case"B":case"BB":case"BBB":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return i.dayPeriod(s,{width:"narrow",context:"formatting"});default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,i){if("ho"===t){var s,r,n=e.getUTCHours()%12;return 0===n&&(n=12),i.ordinalNumber(n,{unit:"hour"})}return s=e,r=t,oS(s.getUTCHours()%12||12,r.length)},H:function(e,t,i){var s,r;return"Ho"===t?i.ordinalNumber(e.getUTCHours(),{unit:"hour"}):(s=e,r=t,oS(s.getUTCHours(),r.length))},K:function(e,t,i){var s=e.getUTCHours()%12;return"Ko"===t?i.ordinalNumber(s,{unit:"hour"}):oS(s,t.length)},k:function(e,t,i){var s=e.getUTCHours();return(0===s&&(s=24),"ko"===t)?i.ordinalNumber(s,{unit:"hour"}):oS(s,t.length)},m:function(e,t,i){var s,r;return"mo"===t?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):(s=e,r=t,oS(s.getUTCMinutes(),r.length))},s:function(e,t,i){var s,r;return"so"===t?i.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):(s=e,r=t,oS(s.getUTCSeconds(),r.length))},S:function(e,t){return oP(e,t)},X:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return oE(r);case"XXXX":case"XX":return o_(r);default:return o_(r,":")}},x:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"x":return oE(r);case"xxxx":case"xx":return o_(r);default:return o_(r,":")}},O:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+oC(r,":");default:return"GMT"+o_(r,":")}},z:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+oC(r,":");default:return"GMT"+o_(r,":")}},t:function(e,t,i,s){return oS(Math.floor((s._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,i,s){return oS((s._originalDate||e).getTime(),t.length)}},oL=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"})}},ox=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"})}},oO={p:ox,P:function(e,t){var i,s=e.match(/(P+)(p+)?/)||[],r=s[1],n=s[2];if(!n)return oL(e,t);switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"})}return i.replace("{{date}}",oL(r,t)).replace("{{time}}",ox(n,t))}},oI=["D","DD"],oD=["YY","YYYY"];function ow(e,t,i){if("YYYY"===e)throw RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(i,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var oR={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"}};function oN(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.width?String(t.width):e.defaultWidth;return e.formats[i]||e.formats[e.defaultWidth]}}var oV={date:oN({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:oN({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:oN({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},oH={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function oF(e){return function(t,i){var s;if("formatting"===(null!=i&&i.context?String(i.context):"standalone")&&e.formattingValues){var r=e.defaultFormattingWidth||e.defaultWidth,n=null!=i&&i.width?String(i.width):r;s=e.formattingValues[n]||e.formattingValues[r]}else{var a=e.defaultWidth,o=null!=i&&i.width?String(i.width):e.defaultWidth;s=e.values[o]||e.values[a]}return s[e.argumentCallback?e.argumentCallback(t):t]}}function ok(e){return function(t){var i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=s.width,n=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(n);if(!a)return null;var o=a[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(l)?function(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i}(l,function(e){return e.test(o)}):function(e,t){for(var i in e)if(e.hasOwnProperty(i)&&t(e[i]))return i}(l,function(e){return e.test(o)});return i=e.valueCallback?e.valueCallback(u):u,{value:i=s.valueCallback?s.valueCallback(i):i,rest:t.slice(o.length)}}}function oB(e){return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=t.match(e.matchPattern);if(!s)return null;var r=s[0],n=t.match(e.parsePattern);if(!n)return null;var a=e.valueCallback?e.valueCallback(n[0]):n[0];return{value:a=i.valueCallback?i.valueCallback(a):a,rest:t.slice(r.length)}}}var oU={code:"en-US",formatDistance:function(e,t,i){var s,r=oR[e];if(s="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",t.toString()),null!=i&&i.addSuffix)if(i.comparison&&i.comparison>0)return"in "+s;else return s+" ago";return s},formatLong:oV,formatRelative:function(e,t,i,s){return oH[e]},localize:{ordinalNumber:function(e,t){var i=Number(e),s=i%100;if(s>20||s<10)switch(s%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},era:oF({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:oF({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:oF({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:oF({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:oF({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"})},match:{ordinalNumber:oB({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:ok({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:ok({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:ok({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:ok({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:ok({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}},oW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,o$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,oG=/^'([^]*?)'?$/,oz=/''/g,oY=/[a-zA-Z]/;function oj(e,t,i){te(2,arguments);var s,r,n,a,o,l,u,h,c,d,p,f,m,g,y,T,A,S,v=String(t),b=null!=(s=null!=(r=null==i?void 0:i.locale)?r:nd.locale)?s:oU,P=e9(null!=(n=null!=(a=null!=(o=null!=(l=null==i?void 0:i.firstWeekContainsDate)?l:null==i||null==(u=i.locale)||null==(h=u.options)?void 0:h.firstWeekContainsDate)?o:nd.firstWeekContainsDate)?a:null==(c=nd.locale)||null==(d=c.options)?void 0:d.firstWeekContainsDate)?n:1);if(!(P>=1&&P<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=e9(null!=(p=null!=(f=null!=(m=null!=(g=null==i?void 0:i.weekStartsOn)?g:null==i||null==(y=i.locale)||null==(T=y.options)?void 0:T.weekStartsOn)?m:nd.weekStartsOn)?f:null==(A=nd.locale)||null==(S=A.options)?void 0:S.weekStartsOn)?p:0);if(!(C>=0&&C<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!b.localize)throw RangeError("locale must contain localize property");if(!b.formatLong)throw RangeError("locale must contain formatLong property");var E=ti(e);if(!op(E))throw RangeError("Invalid time value");var _=ta(E),M=om(E,_),L={firstWeekContainsDate:P,weekStartsOn:C,locale:b,_originalDate:E};return v.match(o$).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,oO[t])(e,b.formatLong):e}).join("").match(oW).map(function(s){if("''"===s)return"'";var r,n,a=s[0];if("'"===a){return(n=(r=s).match(oG))?n[1].replace(oz,"'"):r}var o=oM[a];if(o)return null!=i&&i.useAdditionalWeekYearTokens||-1===oD.indexOf(s)||ow(s,t,String(e)),null!=i&&i.useAdditionalDayOfYearTokens||-1===oI.indexOf(s)||ow(s,t,String(e)),o(M,s,b.localize,L);if(a.match(oY))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join("")}var oK={year:0,month:1,day:2,hour:3,minute:4,second:5},oq={};function oX(e,t,i,s,r,n,a){var o=new Date(0);return o.setUTCFullYear(e,t,i),o.setUTCHours(s,r,n,a),o}var oZ=/^(Z)$/,oJ=/^([+-]\d{2})$/,oQ=/^([+-]\d{2}):?(\d{2})$/;function o0(e,t,i){if(!e||(s=oZ.exec(e)))return 0;if(s=oJ.exec(e))return o2(n=parseInt(s[1],10))?-(36e5*n):NaN;if(s=oQ.exec(e)){var s,r,n=parseInt(s[1],10),a=parseInt(s[2],10);return o2(n,a)?(r=36e5*Math.abs(n)+6e4*a,n>0?-r:r):NaN}if(function(e){if(o3[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),o3[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var o,l=o1(i?t:oX((o=t).getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds()),e);return-(i?l:function(e,t,i){var s=e.getTime()-t,r=o1(new Date(s),i);if(t===r)return t;var n=o1(new Date(s-=r-t),i);return r===n?r:Math.max(r,n)}(t,l,e))}return NaN}function o1(e,t){var i,s,r,n,a,o=(a=function(e){if(!oq[e]){var t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));oq[e]="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t?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"}):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"})}return oq[e]}(t)).formatToParts?function(e,t){try{for(var i=e.formatToParts(t),s=[],r=0;r<i.length;r++){var n=oK[i[r].type];n>=0&&(s[n]=parseInt(i[r].value,10))}return s}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(a,e):(i=a,s=e,r=i.format(s).replace(/\u200E/g,""),[(n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(r))[3],n[1],n[2],n[4],n[5],n[6]]),l=oX(o[0],o[1]-1,o[2],o[3]%24,o[4],o[5],0).getTime(),u=e.getTime(),h=u%1e3;return l-(u-=h>=0?h:1e3+h)}function o2(e,t){return -23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var o3={},o4=R("9J8r2"),o5=R("6ejce"),o6=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,o7=/^([0-9W+-]+)(T| )(.*)/,o8=/^([0-9W+-]+)(.*)/,o9=/^(\d{2})$/,le=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],lt=/^(\d{4})/,li=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],ls=/^-(\d{2})$/,lr=/^-?(\d{3})$/,ln=/^-?(\d{2})-?(\d{2})$/,la=/^-?W(\d{2})$/,lo=/^-?W(\d{2})-?(\d{1})$/,ll=/^(\d{2}([.,]\d*)?)$/,lu=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,lh=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/;function lc(t,i){if(arguments.length<1)throw TypeError("1 argument required, but only "+arguments.length+" present");if(null===t)return new Date(NaN);var s=i||{},r=null==s.additionalDigits?2:e(o4)(s.additionalDigits);if(2!==r&&1!==r&&0!==r)throw RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))return new Date(t.getTime());if("number"==typeof t||"[object Number]"===Object.prototype.toString.call(t))return new Date(t);if("string"!=typeof t&&"[object String]"!==Object.prototype.toString.call(t))return new Date(NaN);var n=function(e){var t,i={},s=o7.exec(e);if(s?(i.date=s[1],t=s[3]):(s=o8.exec(e))?(i.date=s[1],t=s[2]):(i.date=null,t=e),t){var r=o6.exec(t);r?(i.time=t.replace(r[1],""),i.timeZone=r[1].trim()):i.time=t}return i}(t),a=function(e,t){var i,s=le[t],r=li[t];if(i=lt.exec(e)||r.exec(e)){var n=i[1];return{year:parseInt(n,10),restDateString:e.slice(n.length)}}if(i=o9.exec(e)||s.exec(e)){var a=i[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(n.date,r),o=a.year,l=function(e,t){if(null===t)return null;if(0===e.length)return(n=new Date(0)).setUTCFullYear(t),n;if(i=ls.exec(e))return(n=new Date(0),lg(t,s=parseInt(i[1],10)-1))?(n.setUTCFullYear(t,s),n):new Date(NaN);if(i=lr.exec(e)){var i,s,r,n=new Date(0),a=parseInt(i[1],10);return!function(e,t){if(t<1)return!1;var i=lm(e);return(!i||!(t>366))&&(!!i||!(t>365))}(t,a)?new Date(NaN):(n.setUTCFullYear(t,0,a),n)}if(i=ln.exec(e)){n=new Date(0),s=parseInt(i[1],10)-1;var o=parseInt(i[2],10);return lg(t,s,o)?(n.setUTCFullYear(t,s,o),n):new Date(NaN)}if(i=la.exec(e))return ly(t,r=parseInt(i[1],10)-1)?ld(t,r):new Date(NaN);if(i=lo.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return ly(t,r,l)?ld(t,r,l):new Date(NaN)}return null}(a.restDateString,o);if(isNaN(l)||!l)return new Date(NaN);var u,h=l.getTime(),c=0;if(n.time&&isNaN(c=function(e){if(t=ll.exec(e))return lT(i=parseFloat(t[1].replace(",",".")))?i%24*36e5:NaN;if(t=lu.exec(e))return lT(i=parseInt(t[1],10),s=parseFloat(t[2].replace(",",".")))?i%24*36e5+6e4*s:NaN;if(t=lh.exec(e)){var t,i=parseInt(t[1],10),s=parseInt(t[2],10),r=parseFloat(t[3].replace(",","."));return lT(i,s,r)?i%24*36e5+6e4*s+1e3*r:NaN}return null}(n.time)))return new Date(NaN);if(n.timeZone||s.timeZone){if(isNaN(u=o0(n.timeZone||s.timeZone,new Date(h+c))))return new Date(NaN)}else u=e(o5)(new Date(h+c)),u=e(o5)(new Date(h+c+u));return new Date(h+c+u)}function ld(e,t,i){t=t||0,i=i||0;var s=new Date(0);s.setUTCFullYear(e,0,4);var r=7*t+i+1-(s.getUTCDay()||7);return s.setUTCDate(s.getUTCDate()+r),s}var lp=[31,28,31,30,31,30,31,31,30,31,30,31],lf=[31,29,31,30,31,30,31,31,30,31,30,31];function lm(e){return e%400==0||e%4==0&&e%100!=0}function lg(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var s=lm(e);if(s&&i>lf[t]||!s&&i>lp[t])return!1}return!0}function ly(e,t,i){return!(t<0)&&!(t>52)&&(null==i||!(i<0)&&!(i>6))}function lT(e,t,i){return(null==e||!(e<0)&&!(e>=25))&&(null==t||!(t<0)&&!(t>=60))&&(null==i||!(i<0)&&!(i>=60))}var lA={};Object.defineProperty(lA,"__esModule",{value:!0}),lA.default=function(e){return(0,lS.default)({},e)};var lS=(t=R("eG07G"))&&t.__esModule?t:{default:t};lA=lA.default;let lv=[aa.Open,aa.High,aa.Low,aa.Last,aa.Close,aa.TradingDay,aa.PreviousClose,aa.PreviousHigh,aa.PreviousLow,aa.PreviousOpen,aa.Volume,aa.Change,aa.PercentChange,aa.YearHigh,aa.YearLow,aa.WeekPreviousClose,aa.WeekPreviousHigh,aa.WeekPreviousLow,aa.MonthPreviousClose,aa.MonthPreviousHigh,aa.MonthPreviousLow];class lb{recordCache;translateSymbolBack;_subject;constructor(){this.recordCache=new Map,this.translateSymbolBack=new Map}get subject(){if(!eH(this._subject)){var e;let t=oi(Math.max(tG.MINIMUM_THROTTLE,y0().config.throttleMillis||0)),i=oi(tG.BACKGROUND_TAB_THROTTLE);this._subject=new or().pipe((e=()=>globalThis.document?.hidden?i:t,oa(function(t,i){var s=null,r=null,n=function(){null==r||r.unsubscribe();var t=s;s=[],t&&i.next(t),(function(e){if(e instanceof a9)return e;if(null!=e){var t,i,s,r;if(aD(e[a8])){return t=e,new a9(function(e){var i=t[a8]();if(aD(i.subscribe))return i.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")})}if(e&&"number"==typeof e.length&&"function"!=typeof e){return i=e,new a9(function(e){for(var t=0;t<i.length&&!e.closed;t++)e.next(i[t]);e.complete()})}if(aD(null==e?void 0:e.then)){return s=e,new a9(function(e){s.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,aK)})}if(Symbol.asyncIterator&&aD(null==e?void 0:e[Symbol.asyncIterator]))return oh(e);if(aD(null==e?void 0:e[ou])){return r=e,new a9(function(e){var t,i;try{for(var s=aL(r),n=s.next();!n.done;n=s.next()){var a=n.value;if(e.next(a),e.closed)return}}catch(e){t={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}e.complete()})}if(aD(null==e?void 0:e.getReader))return oh(function(e){return function(e,t,i){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var s,r=i.apply(e,t||[]),n=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(e){r[e]&&(s[e]=function(t){return new Promise(function(i,s){n.push([e,t,i,s])>1||o(e,t)})})}function o(e,t){try{var i;(i=r[e](t)).value instanceof aI?Promise.resolve(i.value.v).then(l,u):h(n[0][2],i)}catch(e){h(n[0][3],e)}}function l(e){o("next",e)}function u(e){o("throw",e)}function h(e,t){e(t),n.shift(),n.length&&o(n[0][0],n[0][1])}}(this,arguments,function(){var t,i,s;return aM(this,function(r){switch(r.label){case 0:t=e.getReader(),r.label=1;case 1:r.trys.push([1,,9,10]),r.label=2;case 2:return[4,aI(t.read())];case 3:if(s=(i=r.sent()).value,!i.done)return[3,5];return[4,aI(void 0)];case 4:return[2,r.sent()];case 5:return[4,aI(s)];case 6:return[4,r.sent()];case 7:return r.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}(e))}throw TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")})(e()).subscribe(r=oo(i,n,aq))};n(),t.subscribe(oo(i,function(e){return null==s?void 0:s.push(e)},function(){s&&i.next(s),i.complete()},void 0,function(){return s=r=null}))})),oc(e=>e.length>0))}return this._subject}addRecordForSymbol(e,t){let i=tQ(e);i!==e&&this.translateSymbolBack.set(i,e),this.recordCache.set(e,t)}removeRecordForSymbol(e){this.recordCache.delete(e);let t=tQ(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 lv}makeAndCacheRecord(e,t){if(e===tG.PLACEHOLDER_SYMBOL_NAME)return new ad(tG.PLACEHOLDER_SYMBOL_NAME);if(this.recordCache.has(e))return this.recordCache.get(e);let i=t(e),s=this.getSupportedFields();return i.addFields(...s),this.addRecordForSymbol(e,i),i.ready().then(e=>{this.postInit(e,i)}),i}evictUnused(e,t){for(let[i,s]of this.recordCache)e.has(s)||(t(s),this.removeRecordForSymbol(i))}postInit(e,t){}}class lP extends lb{getRecord(e){return this.makeAndCacheRecord(e,()=>new av(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class lC extends lb{getRecord(e){return this.makeAndCacheRecord(e,()=>new aS(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class lE extends lb{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),y0().connection.off("marketUpdate",this.onMarketUpdate,e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new aA(e))}postInit(e,t){e&&y0().connection.on("marketUpdate",this.onMarketUpdate,t.translated)}onMarketUpdate(e){if(e.type===tG.REALTIME_INITIAL_QUOTE){let t=this.updateFromQuote(e,!0);this.subject.next({topic:ao.RT_QUOTE,data:e,updated:t})}else if(e.type===tG.REALTIME_TRADE){let t=y0().connection.getMarketState().getQuote(e.symbol),i=this.updateFromQuote(t);this.subject.next({topic:ao.RT_TRADE,data:e,updated:i}),e.symbol===tG.DEBUG_SYMBOL&&console.log(`Trade
4
+ Symbol: ${e.symbol} %cPrice: ${e.tradePrice} %cSize: ${e.tradeSize} %cTime: ${oj(e.time,tG.DEBUG_TIME_FORMAT)} %cSession: ${e.session}`,"color:#0f0","color:#a7a","color:#f96","color:#bee")}else if(e.type===tG.REALTIME_VOLUME){let t=this.updateFromVolume(e);0!==t&&(this.subject.next({topic:ao.RT_VOLUME,data:e,updated:t}),e.symbol===tG.DEBUG_SYMBOL&&console.log(`Volume
5
+ Symbol: ${e.symbol} %cValue: ${e.value} %cSession: ${e.session}`,"color:#a7a","color:#bee"))}}updateFromQuote(e,t=!1){let i=this.findRecordForSymbol(e.symbol);i.resetUpdated(),i.update(aa.Open,e.openPrice),i.update(aa.High,e.highPrice),i.update(aa.Low,e.lowPrice),i.update(aa.Last,e.lastPrice),i.update(aa.Close,e.lastPrice);let s=(e,t)=>{eH(t)&&i.update(e,t)};return s(aa.Volume,e.volume),i.update(aa.PreviousClose,e.previousPrice),t&&(s(aa.PreviousOpen,e.previousOpenPrice),s(aa.PreviousHigh,e.previousHighPrice),s(aa.PreviousLow,e.previousLowPrice)),i.computeWellKnown(),i.updated}updateFromVolume(e){let t=this.findRecordForSymbol(e.symbol);return t.resetUpdated(),t.update(aa.Volume,e.value),t.updated}}class l_ extends lb{localTimeZone;constructor(){super(),this.localTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone}get feed(){return y0()}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),this.feed.unsubscribe(e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new aA(e))}postInit(e,t){e&&this.feed.subscribe(t.translated)}onSnapshot(e,t){let i=this.findRecordForSymbol(t),s=y0().metaDataSource.getMetaData(t);if(!s.isReady)return;let r=(e,t)=>{if(eV(t)){let r=s.asPrice(t);return i.update(e,r),r}};i.resetUpdated();let n=r(aa.Open,e.open?.price),a=r(aa.High,e.high?.price),o=r(aa.Low,e.low?.price),l=r(aa.Last,e.last?.price);if(eV(r(aa.Close,e.close?.price))||r(aa.Close,e.settlement?.price),eV(e.instrumentStatus?.tradeDate)){let t=e.instrumentStatus.tradeDate%100;i.update(aa.TradingDay,t)}e.volume?.volume&&i.update(aa.Volume,s.asQuantity(e.volume.volume));let u=this.toExchangeTime(e.transactionTime,s.timeZone);eV(r(aa.PreviousClose,e.prevClose?.price))||r(aa.PreviousClose,e.previousSession?.settlement?.price),r(aa.PreviousOpen,e.previousSession?.open?.price),r(aa.PreviousHigh,e.previousSession?.high?.price),r(aa.PreviousLow,e.previousSession?.low?.price),r(aa.YearHigh,e.yearHigh?.price),r(aa.YearLow,e.yearLow?.price),i.computeWellKnown();let h={topic:"rt.quote",data:{symbol:t,openPrice:n,highPrice:a,lowPrice:o,lastPrice:l,tradeTime:u},updated:i.updated};this.subject.next(h)}skip(e){return void 0===e||e.blockTrade||e.doesNotUpdateLast||e.doesNotUpdateVolume}asDate(e){return!eV(e)||e.isZero()?null:new Date(e.div(1e6).toNumber())}toExchangeTime(t,i){var s,r,n,a;let o=this.asDate(t);if(null===o)return null;let l=function(t,i,s){if("string"==typeof t&&!t.match(o6)){var r=e(lA)(void 0);return r.timeZone=i,lc(t,r)}var n=lc(t,void 0),a=oX(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()).getTime(),o=o0(i,new Date(a));return new Date(a+o)}(o,this.localTimeZone);return r=o0(i,s=lc(l,void 0),!0),n=new Date(s.getTime()-r),(a=new Date(0)).setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),a.setHours(n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()),a}onUpdate(e,t){if(!this.recordCache.has(t))return void yK(`[OpenFeed] update for unsubscribed symbol: ${t}`,"warn");let i=y0().metaDataSource.getMetaData(t);if(!i.isReady)return;let s=this.toExchangeTime(e.transactionTime,i.timeZone);if(e.trades?.trades)for(let{trade:r}of e.trades.trades){if(this.skip(r))continue;let e=i.asPrice(r.price),n=i.asQuantity(r.quantity);if(null===e||0===n)continue;let a=this.toExchangeTime(r.transactionTime,i.timeZone),o=this.findRecordForSymbol(t),[l,u,h,c]=["High","Low","Volume","TradingDay"].map(e=>aa[e]).map(e=>o.getValue(e));(!eV(u)||e<u)&&o.update(aa.Low,e),(!eV(l)||e>l)&&o.update(aa.High,e),o.update(aa.Last,e),o.update(aa.Close,e),o.update(aa.Volume,(eV(h)?h:0)+n),o.computeWellKnown();let d={data:{symbol:t,tradePrice:e,tradeSize:n,session:r.session,time:a??s,tradingDay:c},topic:"rt.trade",updated:o.updated};this.subject.next(d)}}}function lM(e,t){var i=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 i<0?-1:i>0?1:i}function lL(e,t){te(2,arguments);var i=ti(e),s=ti(t),r=lM(i,s),n=Math.abs(tl(i,s));i.setDate(i.getDate()-r*n);var a=Number(lM(i,s)===-r),o=r*(n-a);return 0===o?0:o}function lx(e){te(1,arguments);var t=ti(e);return t.setHours(23,59,59,999),t}function lO(e,t){te(2,arguments);var i=ti(e),s=e9(t);return isNaN(s)?new Date(NaN):(s&&i.setDate(i.getDate()+s),i)}function lI(e,t){return te(2,arguments),lO(e,-e9(t))}function lD(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return i.length>=t?e.apply(null,i.slice(0,t).reverse()):function(){for(var s=arguments.length,r=Array(s),n=0;n<s;n++)r[n]=arguments[n];return lD(e,t,i.concat(r))}}var lw=lD(oj,2),lR=lD(lO,2);function lN(e,t){return te(2,arguments),of(e,6e4*e9(t))}var lV=lD(lN,2),lH=lD(ts,2),lF=lD(function(e,t){return te(2,arguments),ts(e,3*e9(t))},2);function lk(e,t){return te(2,arguments),of(e,1e3*e9(t))}var lB=lD(lk,2),lU=lD(function(e,t){return te(2,arguments),lO(e,7*e9(t))},2),lW=lD(tr,2);function l$(e,t){switch(e){case $.Tick:return lB(t);case $.Intraday:return lV(t);case $.Day:return lR(t);case $.Week:return lU(t);case $.Month:return lH(t);case $.Quarter:return lF(t);case $.Year:return lW(t);default:throw Error(`Unexpected aggregation unit ${$[e]}`)}}function lG(e,t){return t.getFullYear()-1-(t.getFullYear()-1)%e}function lz(e){return new Date(e*tG.OPTIONS_DATA_INCREMENT+tG.OPTIONS_DATA_BASE)}function lY(e,t=tG.ZERO_DATE){let i=new Date(`${e}T00:00:00`);return op(i)?i:t}function lj(e){return e.size-1}class lK{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(aa.DateTime)}prepend(e){this.base.prepend(e),this.processRetrieved()}append(e){this.base.append(e),this.processRetrieved()}}class lq extends lK{constructor(e){super(),this.container=e,this.retryCountForChunk=tG.FETCH_TICK_CHUNK_RETRY_COUNT}getFirstDate(e){let t=super.getFirstDate(0);return e>0&&e<this.retryCountForChunk?lx(lI(t,e)):t}process(e){let t=this.container,i=t.size>0?t.getLastDataPoint(aa.Last):null,s=t.getLastDataPoint(aa.DateTime),r=e.time;return void 0!==s&&r<=s&&(r=of(s,1)),t.addDataPoint(aa.DateTime,r),t.addDataPoint(aa.Last,e.tradePrice),t.addDataPoint(aa.TradeSize,e.tradeSize),t.addDataPoint(aa.Change,eH(i)?e.tradePrice-i:null),t.hasField(aa.TradingDay)&&t.addDataPoint(aa.TradingDay,e.tradingDay),{isUpdate:!1,time:r.getTime(),index:lj(t)}}}class lX extends lK{agg;durationAdd;constructor(e,t){super(),this.agg=t,this.container=e,this.durationAdd=function(e){switch(e.unit){case $.Tick:case $.Intraday:case $.Day:return l$(e.unit,e.size);case $.Week:case $.Month:case $.Quarter:case $.Year:return l$(e.unit,1);default:throw Error(`Unexpected aggregation unit ${$[e.unit]}`)}}(t)}isSameBar(e,t){switch(this.agg.unit){case $.Tick:case $.Intraday:case $.Day:return n5(t,this.durationAdd(e));case $.Week:return nf(e,t);case $.Month:return nu(e,t);case $.Quarter:return nc(e,t);case $.Year:return nm(e,t);default:throw Error(`Unexpected aggregation unit ${$[this.agg.unit]}`)}}fixupTimeBasedAggregationTimestamp(e){return e}isCorrection(e,t){let i=n5(t,e);return i&&yK("Currently not handling data corrections (updates of the past historical data)","error"),i}computeNextStamp(e,t){if(this.isCorrection(e,t))return null;let i=e;for(;!this.isSameBar(i,t);)i=this.durationAdd(i);return i}isUpdate(e,t,i,s){return function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getTime()===s.getTime()}(i,e)}getPosition(e){if(0===this.container.size){let t=this.fixupTimeBasedAggregationTimestamp(e.time);return{lastTimestamp:null,newTimestamp:t,nextTimestamp:t,isUpdate:!1}}let t=this.container.getLastDataPoint(aa.DateTime),i=e.time,s=this.computeNextStamp(t,i);if(null===s)return null;let r=this.isUpdate(t,i,s,e);return null===r?null:{lastTimestamp:t,newTimestamp:i,nextTimestamp:s,isUpdate:r}}createBar(e,t,i,s,r,n,a){let o=this.container,l=o.size>0?o.getLastDataPoint(aa.Close):null;o.addDataPoint(aa.DateTime,n),o.addDataPoint(aa.Open,e),o.addDataPoint(aa.High,t),o.addDataPoint(aa.Low,i),o.addDataPoint(aa.Close,s),o.addDataPoint(aa.Change,eH(l)?s-l:null),o.addDataPoint(aa.Volume,r),o.hasField(aa.OpenInterest)&&o.addDataPoint(aa.OpenInterest,null),o.hasField(aa.TradingDay)&&o.addDataPoint(aa.TradingDay,a??null)}addBar(e,t){let{nextTimestamp:i}=t,{tradePrice:s,tradingDay:r}=e;return this.createBar(s,s,s,s,e.tradeSize,i,r),{isUpdate:!1,time:i.getTime(),index:lj(this.container)}}updateLastBar(e,t,i,s){let r=this.container,n=e=>r.getLastDataPoint(e);if(eH(e)&&e>n(aa.High)&&r.setLastDataPoint(aa.High,e),eH(t)&&t<n(aa.Low)&&r.setLastDataPoint(aa.Low,t),eH(i)){r.setLastDataPoint(aa.Close,i);let e=r.getData(aa.Close)[r.size-2];r.setLastDataPoint(aa.Change,i-e)}if(eH(s)){let e=r.getLastDataPoint(aa.Volume)+s;r.setLastDataPoint(aa.Volume,e)}}changeLastBar(e,t){let{lastTimestamp:i}=t,s=e.tradePrice;return this.updateLastBar(s,s,s,e.tradeSize),{isUpdate:!0,time:i.getTime(),index:lj(this.container)}}process(e){let t=this.getPosition(e);if(null===t)return null;let i=lw(tG.DEBUG_TIME_FORMAT);return t.isUpdate?(e.symbol===tG.DEBUG_SYMBOL&&console.log(`Adding ${this.agg.describe()} Bar
6
6
  Bars %cnot same %c${i(t.lastTimestamp)} < ${i(t.newTimestamp)} %cnext is %c${i(t.nextTimestamp)}`,"color:#f00","color:#f96","","color:#fff"),this.changeLastBar(e,t)):eH(e.tradePrice)?(e.symbol===tG.DEBUG_SYMBOL&&console.log(`Updating ${this.agg.describe()} Bar
7
- Bars %csame %c${i(t.lastTimestamp)} == ${i(t.newTimestamp)}`,"color:#0f0","color:#f96"),this.addBar(e,t)):null}alignToQuote(e){if(eH(e.lastPrice,e.time))return this.updateLastBar(e.highPrice,e.lowPrice,e.lastPrice,void 0),{isUpdate:!0,time:e.time.getTime(),index:lY(this.container)}}}class lX extends lq{innerBuilder;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.processRetrieved()}get base(){return this.innerBuilder.container}fixupTimeBasedAggregationTimestamp(e){let t=lM(e,tG.START_OF_LAST_CENTURY);return lO(e,t%this.agg.size)}processRetrieved(){this.container.clear();for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.base.getData(an.DateTime)[e],tradeSize:0,tradePrice:0,tradingDay:0};[an.Open,an.High,an.Low].forEach(i=>{t.tradePrice=this.base.getData(i)[e],super.process(t)}),t.tradePrice=this.base.getData(an.Close)[e],t.tradeSize=this.base.getData(an.Volume)[e],super.process(t)}}process(e){return this.innerBuilder.process(e),super.process(e)}}class lZ{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!==an.Change||!this.hasField(an.Close)||t<1)return;let i=this.storage[e.id],s=this.storage[an.Close.id];i[t]=s[t]-s[t-1]}concat(e,t,i){this.storage[e.id]=t.concat(i),this.fixupTransition(e,t.length)}prependData(e,t){this.checkField(e),this.concat(e,t,this.getData(e))}prepend(e){let t=e.getLastDataPoint(an.DateTime).getTime()===this.getTimeData()[0].getTime(),i=e.size;e.fields.forEach(s=>{t&&e.getData(s).splice(i-1,1),this.prependData(s,e.getData(s))})}appendData(e,t){this.checkField(e),this.concat(e,this.getData(e),t)}append(e){let t=e.getTimeData()[0].getTime()===this.getLastDataPoint(an.DateTime).getTime(),i=this.size;return e.fields.forEach(s=>{t&&this.getData(s).splice(i-1,1),this.appendData(s,e.getData(s))}),e.size-!!t}getTimeData(){return this.getData(an.DateTime)}getData(e){return this.storage[e.id]}setData(e,t){this.checkField(e),this.storage[e.id]=t}hasField(e){return -1!==this.fields.findIndex(t=>t.id===e.id)}get size(){return 0===this.fields.length?0:this.getData(this.fields[0]).length}get isEmpty(){return 0===this.size}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),eb(this.getData(e))}setLastDataPoint(e,t){this.checkField(e);let i=this.getData(e);i[i.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))}}class lJ extends lZ{constructor(){super([])}get size(){return 0}}class lQ extends lZ{wrapper;constructor(e,t){super(e),this.wrapper=t}isWrapped(e){return eW(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)}}let l0=tG.RENKO_KAGI_NAMES;function l1(e){let{Method:t,Period:i,Source:s,BrickSize:r}=ej(e),n=eU(t,[l0.ATR,l0.TRD,l0.PCT],l0.ATR),a=Number.isFinite(i)?i:14;return{method:n,period:a,source:eU(s,[l0.CLS,l0.HL],l0.CLS),brickSize:Number.isFinite(r)?r:10}}function l2(e,t,i){return e.getData(t)[i]}function l3(e,t){let[i,s]=[an.High,an.Low].map(i=>l2(e,i,t)),r=l2(e,an.Close,t-1);return Math.max(i-s,Math.abs(i-r),Math.abs(s-r))}function l4(e,t){if(e.size<t)return null;let i=t-1,s=[];s.push(l2(e,an.High,0)-l2(e,an.Low,0));for(let i=1;i<t;++i)s.push(l3(e,i));let r=em(s);for(let s=t;s<e.size;++s)r=(r*i+l3(e,s))/t;return r}let l5=e=>an[e],l6=["DateTime","Open","High","Low","Close","Volume"].map(l5),l7=l6.concat(["Change","Projection","BarIndex"].map(l5));class l8 extends lj{innerBuilder;inputs;brickSize;lastFinalBrick;projectionCount;refPrices;constructor(e,t){super(),this.supportsChunks=!1,this.innerBuilder=e,this.inputs=eG(t.inputs),this.brickSize=null,this.container=new lZ(l7),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[i,s,r,n,a,o]=l6.map(i=>t.getData(i)[e]);return{date:i,open:s,high:r,low:n,close:a,volume:o}}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,i){let[s,r]=this.refPrices(t.close,t.high,t.low),n=s-e.high,a=e.low-r;return{climbing:(i&&n>0||n>=this.brickSize)&&n>=a,falling:(i&&a>0||a>=this.brickSize)&&a>n,moveUp:n,moveDown:a}}initFirstBrick(e,t){e.open=e.high=e.low=e.close=Math.max(this.brickSize,eF(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,i=2*tG.RENKO_MAX_BARS;for(;t>0&&e<i;)e+=Math.floor(l3(this.base,t)/this.brickSize),t--;return t}processRetrieved(){let e=l1(this.inputs),{method:t,period:i,source:s}=e;if(this.brickSize=e.brickSize,t===l0.ATR)this.brickSize=l4(this.base,i);else if(t===l0.PCT)if((this.base?.size??0)>0){let e=this.base.getLastDataPoint(an.Close);this.brickSize=e*this.brickSize/100}else this.brickSize=null;if(!eH(this.brickSize))return;this.refPrices=s===l0.HL?(e,t,i)=>[t,i]:(e,t,i)=>[e,e];let r={},n=this.findSafeStartIndex();for(let e=n;e<this.base.size;e++){let t=this.getBarAt(e);if(e===n){this.initFirstBrick(r,t);continue}let i=this.isLastBase(e),{climbing:s,falling:a,moveUp:o,moveDown:l}=this.getMove(r,t,i);if(!s&&!a){r.volume+=t.volume;continue}r.proj=Number(i),r.barIndex=e;let u=t.date.getTime();if(s){let e=this.getBricksCount(o);for(let t=0;t<e;++t)this.constructClimbing(r,u,t,this.brickSize);i&&(this.constructClimbing(r,u,e,o%this.brickSize),this.projectionCount=e+1)}else if(a){let e=this.getBricksCount(l);for(let t=0;t<e;++t)this.constructFalling(r,u,t,this.brickSize);i&&(this.constructFalling(r,u,e,l%this.brickSize),this.projectionCount=e+1)}i||(this.lastFinalBrick=this.container.size-1,r.volume=0)}this.container.keepOnlyLast(tG.RENKO_MAX_BARS)}constructClimbing(e,t,i,s,r=!0){let n=e.high,a=e.close;e.open=e.low=n,e.high=e.close=n+s,e.date=new Date(t+i),e.change=e.close-a,r?this.addToContainer(e):this.updateLastDataPoint(e)}constructFalling(e,t,i,s,r=!0){let n=e.low,a=e.close;e.open=e.high=n,e.low=e.close=n-s,e.date=new Date(t+i),e.change=e.close-a,r?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,i=this.getBarAt(t),s=this.getBrickAt(this.lastFinalBrick),{climbing:r,falling:n,moveUp:a,moveDown:o}=this.getMove(s,i,!0),l=1===this.container.getLastDataPoint(an.Projection);if(!r&&!n)return l?this.rebuild():null;let u=this.getBricksCount(r?a:o)+1;if(!l||this.projectionCount!==u)return this.rebuild();{let e=this.getBrickAt(this.container.size-1),s=this.getBrickAt(Math.min(this.container.size-2,0));return e.proj=1,e.barIndex=t,e.open===e.high?e.low=e.close=i.close:e.open===e.low&&(e.high=e.close=i.close),e.change=e.close-s.close,this.updateLastDataPoint(e),{isUpdate:!0,time:e.date.getTime(),index:this.container.size-1}}}addToContainer(e){let t=this.container;t.addDataPoint(an.DateTime,e.date),t.addDataPoint(an.Open,e.open),t.addDataPoint(an.Close,e.close),t.addDataPoint(an.High,e.high),t.addDataPoint(an.Low,e.low),t.addDataPoint(an.Change,e.change),t.addDataPoint(an.Volume,e.volume),t.addDataPoint(an.Projection,e.proj),t.addDataPoint(an.BarIndex,e.barIndex)}updateLastDataPoint(e){let t=this.container;t.setLastDataPoint(an.DateTime,e.date),t.setLastDataPoint(an.Open,e.open),t.setLastDataPoint(an.Close,e.close),t.setLastDataPoint(an.High,e.high),t.setLastDataPoint(an.Low,e.low),t.setLastDataPoint(an.Change,e.change),t.setLastDataPoint(an.Volume,e.volume),t.setLastDataPoint(an.Projection,e.proj),t.setLastDataPoint(an.BarIndex,e.barIndex)}}let l9=[an.DateTime,an.TradingDay,an.Last,an.TradeSize,an.Change],ue=[an.DateTime,an.Open,an.High,an.Low,an.Close,an.Volume,an.Change],ut=[...ue,an.OpenInterest],ui=[...ut,an.Symbol],us=[an.Open,an.High,an.Low,an.Close,an.Change];function ur(e,t){let i=tE(e);if(t.isTick)return l9;{let e=ue;return t.isMultiContract?e=ui:(i||t.isEndOfDay)&&(e=ut),t.isIntraday?[...e,an.TradingDay]:e}}class un{symbol;aggregation;offset;container;previousTime;timeZone;isFuture;needsResolution;hasOpenInterest;padded;constructor(e,t,i=0,s=!1){this.symbol=e,this.aggregation=t,this.offset=i||0,this.previousTime=new Date(0),this.timeZone=this.getTimeZone(),this.isFuture=tg(e),this.padded=s,this.needsResolution=tC(e),this.hasOpenInterest=tE(e)}makeContainer(){return new lZ(ur(this.symbol,this.aggregation))}parse(e){this.container=this.makeContainer();let t=e.split("\n"),i=this.getParseFunc();if(null!==i){let e=i.bind(this);t.forEach(t=>{let i=t.trim();i&&e(i.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;(0===t||1===t)&&(this.container.addDataPoint(an.DateTime,this.parseDate(e[0+t])),this.container.addDataPoint(an.TradingDay,parseInt(e[1+t])),this.container.addDataPoint(an.Last,parseFloat(e[3+t])),this.container.addDataPoint(an.TradeSize,parseInt(e[4+t])),this.container.addDataPoint(an.Change,this.calculateChange(an.Last)))}nullify(e){return null==e||0===e?null:e}parseMinutes(e){let t=this.aggregation.isMultiContract&&this.isFuture||this.needsResolution,i=+!!t;e.length===7+i&&(this.container.hasField(an.Symbol)&&this.container.addDataPoint(an.Symbol,t?e[0]:this.symbol),this.container.addDataPoint(an.DateTime,this.parseDate(e[0+i])),this.container.addDataPoint(an.TradingDay,parseInt(e[1+i])),this.container.addDataPoint(an.Open,parseFloat(e[2+i])),this.container.addDataPoint(an.High,parseFloat(e[3+i])),this.container.addDataPoint(an.Low,parseFloat(e[4+i])),this.container.addDataPoint(an.Close,parseFloat(e[5+i])),this.container.addDataPoint(an.Volume,this.nullify(parseInt(e[6+i]))),this.container.addDataPoint(an.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,i=7+ +!!this.hasOpenInterest;e.length===i&&(t&&this.container.addDataPoint(an.Symbol,e[0]),this.container.addDataPoint(an.DateTime,this.parseDate(e[1])),this.container.addDataPoint(an.Open,this.parseFloatOrNull(e[2])),this.container.addDataPoint(an.High,parseFloat(e[3])),this.container.addDataPoint(an.Low,parseFloat(e[4])),this.container.addDataPoint(an.Close,parseFloat(e[5])),this.container.addDataPoint(an.Volume,this.nullify(this.parseIntOrNull(e[6]))),this.hasOpenInterest&&this.container.addDataPoint(an.OpenInterest,this.nullify(this.parseIntOrNull(e[7]))),this.container.addDataPoint(an.Change,this.calculateChange()))}calculateChange(e=an.Close){let t=this.container.size;if(!(t>1))return 0;{let i=this.container.getData(e);return i[t-1]-i[t-2]}}parseTimestamp(e){switch(this.aggregation.unit){case $.Tick:case $.Intraday:return function(e,t=tG.ZERO_DATE){let i=new Date(e.replace(" ","T"));return od(i)?i:t}(e);default:return lz(e)}}parseDate(e){let t=this.parseTimestamp(e);return this.aggregation.isEndOfDay?tr(t,this.offset):(!function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getTime()>s.getTime()}(t,this.previousTime)?this.previousTime=op(this.previousTime,1):this.previousTime=t,this.previousTime)}getTimeZone(){return t_(this.symbol)}}let{BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:ua,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:uo}=tG;class ul{supportsChunks;constructor(){this.supportsChunks=!0}getPageNameFor(e,t){switch(e.unit){case $.Tick:return tG.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case $.Intraday:return t&&e.spec===G.Nearest?ua:uo;case $.Day:case $.Week:case $.Month:case $.Quarter:case $.Year:return tG.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return""}}addExtraParams(e){}makeUrl(e){let t={},i=tQ(e.symbol);t.symbol=i;let s=e.aggregation,r=this.getDataParam(s);r.length>0&&(t.data=r),s.size>1&&s.unit===$.Intraday&&(t.interval=(s.spec===G.PerRange?1:s.size).toString());let[n,a]=e.range,o=null!==n,l=null!==a;if(o&&(t.start=this.toHistoricalFeedDate(n,s)),!o||e.alwaysUseBarsToFetch){let i=e.barsToFetch||tG.DEFAULT_MAX_RECORDS;s.unit===$.Tick&&s.spec!==G.None&&(i*=tG.TICK_CUSTOM_AGG_MULTIPLIER),t.maxrecords=i.toString()}l&&(t.end=this.toHistoricalFeedDate(a,s)),t.volume=s.isContractVolume?"contract":"total",t.order="asc",t.dividends=s.dividendsAdjust.toString(),t.backadjust=s.backAdjust.toString(),t.daystoexpiration=s.daysToExpiration.toString(),t.contractroll=s.contractRoll,s.isTick&&(t.type="T",t.skipOldEmulation="true"),!0===e.extendedHours&&(t.formt="true"),t.splits=(e?.splits??!0).toString(),t.padded=(e.padded??!1).toString(),this.addExtraParams(t);let u=eq(t),h=tg(i),c=this.getPageNameFor(s,h);return`/${c}?${u}`}toHistoricalFeedDate(e,t){return oY(e,t.isTick||t.isIntraday?tG.FMT_HIST_FEED_PARAM_DATE_TIME:tG.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(e){let t="",i=this.getSpecPart(e);switch(e.unit){case $.Tick:case $.Intraday:break;case $.Day:t=`daily${i}`;break;case $.Week:t=`weekly${i}`;break;case $.Month:t=`monthly${i}`;break;case $.Quarter:t=`quarterly${i}`;break;case $.Year:t=`yearly${i}`}return t}getSpecPart(e){return e.isMultiContract?e.spec===G.Continue?"continue":"nearest":""}getParser(e){return new un(tQ(e.symbol),e.aggregation,e.offset,e.padded)}async retrieve(e){let t=this.makeUrl(e),i=e.aggregation.unit===$.Tick?"timeseriesNew":"timeseries",s=await yq(i,t);return this.getParser(e).parse(s)}}class uu{supportsChunks;constructor(){this.supportsChunks=!1}addExtraParams(e){}async retrieve(e){let t=tQ(e.symbol),i=this.emptyContainer(t,e.aggregation);if(e.aggregation.unit!==$.Day)return i;let s={symbol:t};this.addExtraParams(s);let r=`/${this.getPageName()}.json?${eq(s)}`,n=await yq("ondemand",r);try{let e=JSON.parse(n);if(200===e.status.code){let t=e.results;if(this.iterateForward)for(let e=0;e<t.length;e++)this.processRow(t[e],e,i);else for(let e=t.length-1;e>=0;e--)this.processRow(t[e],e,i)}}catch(e){yj(`Failed parsing the JSON result from OnDemand, error is ${e.message}`)}return i}}class uh extends uu{emptyContainer(e,t){return new lZ(ur(e,t))}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){let s=i.hasField(an.Symbol),r=t>0?i.getLastDataPoint(an.Close):null;i.addDataPoint(an.DateTime,lz(e.date)),s&&i.addDataPoint(an.Symbol,e.symbol),i.addDataPoint(an.Open,e.open),i.addDataPoint(an.High,e.high),i.addDataPoint(an.Low,e.low),i.addDataPoint(an.Close,e.close),i.addDataPoint(an.Volume,e.volume),i.addDataPoint(an.OpenInterest,e.openInterest);let n=null===r?null:eF(e.close-r,2);i.addDataPoint(an.Change,n)}}let uc={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"};class ud{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){let t=tQ(e.symbol).replace(/\.bz$/i,""),i=e.fields.concat(an.DateTime),s=()=>new lZ(i);if(e.aggregation.unit!==$.Day)return s();let r={symbol:t,apiKey:"default",fields:i.map(e=>uc[e.id]).join(",")},n=`/get?${eq(r)}`,a=await yq("options",n);try{let e=JSON.parse(a).data,t=s();return e.forEach(e=>{i.forEach(i=>{if(i===an.DateTime)t.addDataPoint(an.DateTime,lz(e.date));else{let s;t.addDataPoint(i,(s=e[uc[i.id]],Number.parseFloat(s.replace(/,/g,""))))}})}),t}catch(e){yj(`Failed parsing options JSON historical data result, error is ${e.message}`)}return s()}}function up(e,t){return on(function(i,s){var r=0;i.subscribe(oa(s,function(i){s.next(e.call(t,i,r++))}))})}var uf=lI(lO,2);function um(e,t){return te(2,arguments),ti(e).getTime()-ti(t).getTime()}var ug={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function uy(e){return e?ug[e]:ug.trunc}function uT(e,t,i){te(2,arguments);var s=um(e,t)/1e3;return uy(null==i?void 0:i.roundingMethod)(s)}class uA extends lq{innerBuilder;isBuildingBars;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.isBuildingBars=!1,this.retryCountForChunk=tG.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,i,s]=[an.DateTime,an.TradeSize,an.Last,an.TradingDay].map(e=>this.base.getData(e));for(let r=this.startFromIndex;r<this.base.size;r++){let n={isTrade:!0,time:e[r],tradeSize:t[r],tradePrice:i[r],tradingDay:s[r]};super.process(n)}this.isBuildingBars=!1}process(e){let t=this.innerBuilder.process(e);return e.time=new Date(t.time),super.process(e)}}class uS extends uA{constructor(e,t,i){super(e,t,i)}fixupTimeBasedAggregationTimestamp(e){let t=uT(e,th(n5(e,1)));return function(e,t){return te(2,arguments),lF(e,-e9(t))}(e,t%this.agg.size)}}class uv extends uA{series;constructor(e,t,i,s){super(e,i,s),this.series=t}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}}let ub=new ai("_TICK_COUNT");class uP extends uv{anchorTimestamp=null;constructor(e,t,i,s){super(e,t,i,s)}get startFromIndex(){let e=0,t=this.base.getTimeData();if(eH(this.anchorTimestamp))e=eC(t,e=>e===this.anchorTimestamp);else{let i=this.base.size;if(i>2)for(let s=i-2;s>2;--s){let i=t[s].valueOf();if(i-t[s-1].valueOf()>1&&t[s+1].valueOf()-i>1){e=s;break}}this.anchorTimestamp=t[e]}return e>this.agg.size&&(e%=this.agg.size),Math.max(e,0)}addBar(e,t){let i=super.addBar(e,t);return this.container.addDataPoint(ub,1),i}changeLastBar(e,t){let i=super.changeLastBar(e,t),s=this.container.getLastDataPoint(ub);return this.container.setLastDataPoint(ub,s+1),i}isUpdate(e,t,i,s){return this.container.getLastDataPoint(ub)<this.agg.size}}let uC=new ai("_VOLUME_TALLY");class uE extends uv{constructor(e,t,i,s){super(e,t,i,s)}addBar(e,t){let i=this.container,s=(i.getLastDataPoint(uC)||0)+e.tradeSize,r=Math.floor(s/this.agg.size),n=s%this.agg.size,a=s<this.agg.size;i.size>0&&(i.setLastDataPoint(an.Volume,a?1:r),i.setLastDataPoint(uC,s));let o=super.addBar(e,t);return i.setLastDataPoint(an.Volume,1),i.addDataPoint(uC,a?0:n),o}changeLastBar(e,t){let i=this.container,s=super.changeLastBar(e,t);i.setLastDataPoint(an.Volume,1);let r=i.getLastDataPoint(uC)??0;return i.setLastDataPoint(uC,r+e.tradeSize),s}isUpdate(e,t,i,s){if(!no(e,t))return!1;let r=this.container.getLastDataPoint(uC)??0;return s.tradeSize+r<this.agg.size}}class u_ extends lq{innerBuilder;metadata;range;step;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.range=i.size,this.step=1;let r=yQ().getMetaDataSource();this.metadata=r.getMetaData(s)}get priceRange(){return this.step*this.range}get base(){return this.innerBuilder.container}ready(){return tU.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(an.Volume)[e],i=this.useHighOrLow(e);if(!eH(i)){this.updateLastBar(void 0,void 0,void 0,t);continue}let s={isTrade:!0,time:this.base.getData(an.DateTime)[e],tradeSize:t,tradePrice:i,tradingDay:0};super.process(s)}}useHighOrLow(e){let t=this.base.getData(an.Close)[e];if(0==this.container.size)return t;let i=this.container.getLastDataPoint(an.High),s=this.container.getLastDataPoint(an.High),r=this.base.getData(an.High)[e],n=this.base.getData(an.Low)[e],a=r>i,o=n<s;return a&&o?r-t<t-n?r:n:a?r:o?n:void 0}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}isUpdate(e,t,i,s){return!0}process(e){return this.innerBuilder.process(e),super.process(e)}changeLastBar(e,t){let i=e.tradePrice,s=this.container.getLastDataPoint(an.Low)+this.priceRange;if(i>s)return this.changeAndAddBar(s,e,t);let r=this.container.getLastDataPoint(an.High)-this.priceRange;return i<r?this.changeAndAddBar(r,e,t):super.changeLastBar(e,t)}changeAndAddBar(e,t,i){return this.updateLastBar(e,e,e,0),this.container.setLastDataPoint(an.Projection,0),this.addBar(t,i)}addBar(e,t){return this.container.addDataPoint(an.Projection,1),super.addBar(e,t)}}let uM=[an.Open,an.High,an.Low,an.Close],uL=[an.BARCOLIX,an.High,an.Low],ux=tG.RENKO_KAGI_NAMES;function uO(e){let{BoxSizeMethod:t,Period:i,ReversalAmount:s}=ej(e),r=eU(t,[ux.ATR,ux.TRD],ux.ATR);return{method:r,period:Number.isFinite(i)?i:14,reversal:Number.isFinite(s)?s:30}}class uI extends lq{innerBuilder;inputs;reversal;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=eG(i.inputs),this.reversal=null,this.processRetrieved()}get base(){return this.innerBuilder.container}_at(e,t,i){return e.getData(t)[i]}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(an.BARCOLIX,null),this.container.size>1){let e=this.dataAt(an.Close,this.container.size-2);this.setLast(an.Open,e),this.updateLastBar(e,e)}return null}isUpdate(e,t,i,s){let r=s.tradePrice,n=r-this.getLast(an.Close),a=n>=0,o=Math.abs(n)>=this.reversal,[l,u,h,c]=uM.map(e=>this.getLast(e)),d=c-l,p=d>=0!==a||0===d;return p&&!o||!p&&(a?r<u:r>h)?null:Math.abs(d)<this.reversal||!p||!o}computeBarColor(){let e=e=>this.dataAt(an.Close,e)>this.dataAt(an.Open,e),t=this.container.size;if(t>1){let i=e(t-1),[s,r,n]=uL.map(e=>this.dataAt(e,t-2)),[,a,o]=uL.map(e=>this.dataAt(e,t-1)),l=s;0===s&&i&&a>r?l=1:1===s&&!i&&o<n&&(l=0),this.setLast(an.BARCOLIX,l)}else this.setLast(an.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:i}=uO(this.inputs);if(this.reversal=i,e===ux.ATR&&(this.reversal=l4(this.base,t)),eH(this.reversal)){this.container.clear(),this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.baseAt(an.DateTime,e),tradePrice:this.baseAt(an.Close,e),tradeSize:this.baseAt(an.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}function uD(e){let{LineCount:t}=ej(e);return{lineBreak:Number.isFinite(t)?t:3}}class uw extends lq{innerBuilder;lineBreak;currentVolume;inputs;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.inputs=eG(s.inputs);let r=uD(this.inputs);this.lineBreak=r.lineBreak,this.currentVolume=0,this.processRetrieved()}get base(){return this.innerBuilder.container}readTrade(e){return{isTrade:!0,time:this.base.getData(an.DateTime)[e],tradeSize:this.base.getData(an.Volume)[e],tradePrice:this.base.getData(an.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,i,s){let r=this.findOpen(i,0,1);this.currentVolume+=s,null!==r?(super.updateLastBar(void 0,void 0,i,void 0),this.container.setLastDataPoint(an.Open,r),this.container.setLastDataPoint(an.Low,Math.min(r,i)),this.container.setLastDataPoint(an.High,Math.max(r,i))):this.resetProjection()}resetProjection(){let e=this.container;e.setLastDataPoint(an.High,null),e.setLastDataPoint(an.Low,null),e.setLastDataPoint(an.Open,null),e.setLastDataPoint(an.Close,null),e.setLastDataPoint(an.Change,null)}isProjection(e){return this.agg.isIntraday||this.durationAdd(e).getTime()>Date.now()}updateProjection(e,t){this.container.setLastDataPoint(an.DateTime,t.nextTimestamp);let i=this.changeLastBar(e,t);return i.timeCorrection={from:t.lastTimestamp,to:t.nextTimestamp},i}addBar(e,t){let i=this.container,{nextTimestamp:s}=t;if(1===i.getLastDataPoint(an.Projection)){let s=i.getLastDataPoint(an.Close);if(null===this.findOpen(s,this.lineBreak,1))return this.updateProjection(e,t);i.setLastDataPoint(an.Projection,0),i.setLastDataPoint(an.Volume,this.currentVolume),this.currentVolume=0}return!this.isProjection(s)&&this.insertBar(e,s)||this.addProjection(e,s)?{isUpdate:!1,time:s.getTime(),index:this.container.size-1}:null}insertBar(e,t){this.currentVolume+=e.tradeSize;let i=e.tradePrice,s=this.findOpen(i,this.lineBreak);return null!==s&&(this.createBar(s,Math.max(s,i),Math.min(s,i),i,this.currentVolume,t),this.container.addDataPoint(an.Projection,0),this.currentVolume=0,!0)}addProjection(e,t){this.currentVolume+=e.tradeSize;let i=e.tradePrice,s=this.findOpen(i,0);return null!==s&&(this.createBar(s,Math.max(s,i),Math.min(s,i),i,0,t),this.container.addDataPoint(an.Projection,1),!0)}findOpen(e,t,i=0){if(!eH(e))return null;let s=this.container,r=s.size-1-i,n=s.getData(an.Close)[r],a=s.getData(an.Open)[r];if(n>a){if(e<=n){if(e>=a)return null;for(let i=0;i<Math.min(s.size,t);i++)if(e>=s.getData(an.Low)[r-i])return null;return a}return n}if(e>=n){if(e<=a)return null;for(let i=0;i<Math.min(s.size,t);i++)if(e<=s.getData(an.High)[r-i])return null;return a}return n}startLine(e){this.container.addDataPoint(an.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)}}let uR=tG.RENKO_KAGI_NAMES;function uN(e){switch(e){case tG.BARKIND_O:case tG.BARKIND_XO:return!0;default:return!1}}function uV(e){switch(e){case tG.BARKIND_X:case tG.BARKIND_OX:return!0;default:return!1}}function uH(e){let t=ej(e),{Source:i,BoxSizeMethod:s,Period:r}=t,{ReversalAmount:n,BoxSize:a,OneStepBack:o}=t,l=eU(i,[uR.CLS,uR.HL],uR.CLS),u=eU(s,[uR.ATR,uR.TRD],uR.ATR),h=Number.isFinite(r)?a:14,c=Number.isFinite(n)?n:3;return{method:u,period:h,source:l,boxSize:Number.isFinite(a)?a:20,reversal:c,oneStepBack:"Yes"===o}}class uF extends lq{innerBuilder;inputs;boxSize;reversal;source;firstTrend;oneStepBack;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=eG(i.inputs),this.boxSize=this.reversal=this.source=this.firstTrend=this.oneStepBack=null,this.processRetrieved()}get base(){return this.innerBuilder.container}_at(e,t,i){return e.getData(t)[i]}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,i){let s=Math.abs(t-e);return e+i*this.roundToBox(s)}get closeBased(){return this.source===uR.CLS}get currentKind(){return this.getLast(an.BARKIND)}getTrendField(e){return this.closeBased?an.Close:e?an.Low:an.High}getTrendPrice(e,t){return this.closeBased?e.tradePrice:t?e._lowPrice:e._highPrice}changeLastBar(e,t){let i=uN(this.currentKind),s=i?-1:1,r=this.getLast(this.getTrendField(i)),n=this.getTrendPrice(e,i);return e.tradePrice=this.roundedDiff(r,n,s),super.changeLastBar(e,t),null}addBar(e,t){let i=0===this.container.size,s=uN(this.currentKind),r=s?1:-1,n=i?null:this.getLast(an.Close),a=this.getTrendPrice(e,!s);if(e.tradePrice=(i?this.roundToBox(this.baseAt(an.Open,0)):n)+r*(i?0:this.boxSize),super.addBar(e,t),!i){let e=this.roundedDiff(n,a,r);this.updateLastBar(e,e,e)}return this.container.addDataPoint(an.BARKIND,null),this.computeBarColor(),null}inplaceReverse(){let e=uN(this.currentKind)?tG.BARKIND_OX:tG.BARKIND_XO;this.setLast(an.BARKIND,e)}canInplaceReverse(){return!function(e){switch(e){case tG.BARKIND_OX:case tG.BARKIND_XO:return!0;default:return!1}}(this.currentKind)&&this.getLast(an.High)===this.getLast(an.Low)}isUpdate(e,t,i,s){let r=uN(this.currentKind),n=this.getTrendPrice(s,r),a=this.getTrendPrice(s,!r),o=n-this.getLast(an.Close),l=o>=0,u=Math.abs(o)>=this.boxSize,h=a-this.getLast(an.Close),c=h>=0,d=Math.abs(h)>=this.reversal*this.boxSize;if(r){if(!l&&u)return!0;if(c&&d)if(!this.oneStepBack||!this.canInplaceReverse())return!1;else return this.inplaceReverse(),!0;return null}if(l&&u)return!0;if(!c&&d)if(!this.oneStepBack||!this.canInplaceReverse())return!1;else return this.inplaceReverse(),!0;return null}findFirstDiffLargerThanBox(e,t){let i=this.baseAt(an.Open,0),s=this.innerBuilder.container.size;for(let r=1;r<s;++r){let s=this.baseAt(e,r)-i;if(Math.abs(s)>this.boxSize){if(1===t&&s>0)return[r,tG.BARKIND_X];if(2===t&&s<0)return[r,tG.BARKIND_O];if(3===t)return[r,s>0?tG.BARKIND_X:tG.BARKIND_O]}}return[null,null]}findFirstBarTrend(){if(this.innerBuilder.container.size<2)return null;if(this.closeBased){let[,e]=this.findFirstDiffLargerThanBox(an.Close,3);return e}{let[e,t]=this.findFirstDiffLargerThanBox(an.High,1),[i,s]=this.findFirstDiffLargerThanBox(an.Low,2);return null===t&&null===s?null:null===s?t:null===t?s:e<i?t:s}}computeBarColor(){let e=this.container.size,t=this.firstTrend;e>1&&(t=uN(this.dataAt(an.BARKIND,e-2))?tG.BARKIND_X:tG.BARKIND_O),this.setLast(an.BARKIND,t)}process(e){return(this.isProcessingRetrieved||this.innerBuilder.process(e),null===this.firstTrend)?null:super.process(e)}processRetrieved(){let{method:e,period:t,reversal:i,source:s,boxSize:r,oneStepBack:n}=uH(this.inputs);if((this.reversal=i,this.source=s,e===uR.ATR?this.boxSize=l4(this.base,t):this.boxSize=r,eH(this.reversal,this.boxSize))&&(this.oneStepBack=n&&1===this.reversal,this.container.clear(),this.firstTrend=this.findFirstBarTrend(),null!==this.firstTrend)){this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.baseAt(an.DateTime,e),tradePrice:this.baseAt(an.Close,e),_highPrice:this.baseAt(an.High,e),_lowPrice:this.baseAt(an.Low,e),tradeSize:this.baseAt(an.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}let uk=new nb($.Intraday,0);class uB{query;container;canLoadMoreData;alignToQuote;record;isLoading;serverComputedSeries;builder;retriever;streamingSubscription;constructor(e){this.query=e,this.canLoadMoreData=!0,this.alignToQuote=!1,this.isLoading=!1,this.container=null,this.canLoadMoreData=!0,this.alignToQuote=!1,this.record=new ac(e.symbol)}getHasVisible(e){return null!=this.query.visibleRange&&null!=this.query.visibleRange[e]}get hasVisibleFrom(){return this.getHasVisible("from")}get hasVisibleTo(){return this.getHasVisible("to")}refresh(){this.query.aggregation.isEndOfDay?this.alignToQuote=!0:this.loadMoreData(!1)}makeInnerBuilder(e){let t=this.query.aggregation;if(!t.isTick)return new lq(e,t);switch(t.spec){case G.None:case G.PerSeconds:case G.PerCount:case G.PerVolume:return new lK(e);default:throw Error(`Custom tick aggregation ${t.describe()} has not been implemented yet`)}}makeBuilder(e){let t=this.makeInnerBuilder(e),i=this.query.aggregation,s=(e,t=[])=>new lZ(ur(this.query.symbol,e).concat(t));switch(this.query.curveStyle){case W.Renko:return new l8(t,this.query);case W.Kagi:return new uI(t,s(uk,[an.BARCOLIX]),this.query);case W.PointAndFigure:return new uF(t,s(uk,[an.BARKIND]),this.query);case W.LineBreak:return new uw(t,s(i,[an.Projection]),i,this.query)}if(i.isIntraday&&i.spec===G.PerRange)return new u_(t,s(uk,[an.Projection]),i,this.query.symbol);if(i.isTick)switch(i.spec){case G.PerSeconds:return new uS(t,s(uk),i);case G.PerCount:return new uP(t,this,s(uk,[ub]),i);case G.PerVolume:return new uE(t,this,s(uk,[uC]),i)}return i.unit===$.Day&&i.size>1?new lX(t,s(i),i):t}onStreamingUpdates(e){this.isLoading||e.map(e=>{if("isTrade"in e)return this.builder.process(e);if("isQuote"in e&&(eR(aa.TS_QUOTEMARKER,{series:this}),this.alignToQuote)){let t=this.builder.alignToQuote(e);return this.alignToQuote=!1,t}return null}).filter(e=>eH(e)).filter((e,t,i)=>{if(0===t)return!0;let s=i[t-1];return s.isUpdate!==e.isUpdate||s.time!==e.time||e.timeCorrection}).forEach(e=>{if(-1===e.index)eR(aa.TS_MANYCHANGED,{series:this,part:er.Unspecified});else{let t={series:this,index:e.index};eR(e.isUpdate?aa.TS_DATAPOINTCHANGED:aa.TS_DATAPOINTADDED,t)}e.timeCorrection&&eR(aa.TS_TIMELINECORRECTION,{...e.timeCorrection,series:this})})}get hasData(){return null!==this.container}getRetriever(){return tv(this.query.symbol)&&this.query.aggregation.isEndOfDay?new uh:new ul}getStreamingSubscription(){return yQ().getRecordSource().subject.pipe(up(e=>{let t=this.query.aggregation.isEndOfDay,i=aP(aa.RT_TRADE,this.record.symbol),s=e=>"T"!==e.data.session||this.query.extendedHours&&!t,r=e.filter(i).filter(e=>eH(e.data.time)).filter(s).map(e=>({isTrade:!0,tradePrice:e.data.tradePrice,tradeSize:e.data.tradeSize,time:e.data.time,tradingDay:e.data.tradingDay})).reduce((e,t)=>{let i=eb(e);return eH(i)&&eH(i.tradePrice)&&eH(t.tradePrice)&&i.tradePrice===t.tradePrice&&i.time.getTime()===t.time.getTime()&&i.tradingDay===t.tradingDay?i.tradeSize+=t.tradeSize:e.push(Object.assign({},t)),e},[]),n=aP(aa.RT_QUOTE,this.record.symbol);return r.concat(e.filter(n).map(e=>({isQuote:!0,openPrice:e.data.openPrice,highPrice:e.data.highPrice,lowPrice:e.data.lowPrice,lastPrice:e.data.lastPrice,time:e.data.tradeTime})))}),oh(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async loadMoreData(e=!0){if(this.isLoading||!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();eH(e.offset)&&0!==e.offset&&(t=tr(t,-e.offset)),e.range=[t,null];let i=await this.retriever.retrieve(e),s=this.container.size;this.builder.append(i);let r=this.container.size-s;eR(aa.TS_MANYCHANGED,{series:this,part:er.Tail,count:r,index:s})}async loadHeadChunk(){let e=!1,t=null;for(let i=0;i<this.builder.retryCountForChunk&&!e;++i){let s=this.query.duplicate(),r=this.builder.getFirstDate(i);eH(s.offset)&&0!==s.offset&&(r=tr(r,-s.offset)),s.range=[null,r],e=(t=await this.retriever.retrieve(s)).size>1}this.canLoadMoreData=e,e&&null!==t&&(this.builder.prepend(t),eR(aa.TS_MANYCHANGED,{series:this,part:er.Head}))}async applyNearbyFixup(e){let t=this.query.aggregation,i=t.spec===G.Nearest,s=this.query.symbol,r=tg(s);return r&&t.isMultiContract&&i&&!(e.size<1)&&!this.serverComputedSeries?e.getLastDataPoint(an.Symbol):r&&tC(s)?await tf(s):s}async ready(){return tU.call(this,async()=>{this.retriever=this.getRetriever();let e=await this.retriever.retrieve(this.query),t=await this.applyNearbyFixup(e);return this.hasVisibleTo||(this.record=yQ().getRecordSource().getRecord(t)),this.canLoadMoreData=!this.hasVisibleFrom&&e.size>0,this.builder=this.makeBuilder(e),await this.builder.ready(),this.container=this.builder.container,this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0})}getCacheableEntities(e){e.add(this)}shutdown(){eH(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class uU{query;container;_pretendEmpty;constructor(e,t=!1){this._pretendEmpty=t,this.query=e,this.container=new lJ}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(){}}class uW{query;container;canLoadMoreData=!1;isLoading=!1;constructor(e,t){this.query=e,this.container=t}get hasData(){return null!==this.container}loadMoreData(e){throw Error("Should not be called.")}refresh(){}async ready(){return!0}getCacheableEntities(e){}shutdown(){}}class u${query;container;supplyCustomDemoData;canLoadMoreData;isLoading;constructor(e){this.query=e,this.canLoadMoreData=!0,this.isLoading=!0,this.container=null,this.supplyCustomDemoData="DemoSite"===yQ().config.mode}refresh(){}loadMoreData(e){throw Error("Should not be called.")}get hasData(){return null!==this.container}shutdown(){}parseEvents(e){let t=new lZ([an.DateTime,an.Dividends,an.Earnings,an.Splits,an.Custom]),i=e.split("\n"),s=(e,i,s,r)=>{t.addDataPoint(e,i===s?r:null)};return i.forEach(e=>{if(""===e.trim())return;let i=e.split(",");if(4!==i.length)return;let r=lz(i[1]);t.addDataPoint(an.DateTime,r),s(an.Dividends,"Dividend",i[2],i[3]),s(an.Earnings,"Earnings",i[2],i[3]),s(an.Splits,"Split",i[2],i[3]),this.supplyCustomDemoData?s(an.Custom,"Custom","Custom",tG.FAKE_CUSTOM_EVENT):s(an.Custom,"Custom",i[2],i[3])}),t}makeUrl(){let e={};e.symbols=this.query.symbol,e.start="19700102",e.end="20501230",tG.EVENTS_BUILT_IN.forEach(t=>e[t]=this.query[t]);let t=eq(e);return`/queryevents.ashx?${t}`}async retrieve(){let e=this.makeUrl(),t=await yq("timeseries",e);return this.parseEvents(t)}async ready(){return tU.call(this,async()=>(this.container=await this.retrieve(),this.isLoading=this.canLoadMoreData=!1,!0))}getCacheableEntities(e){e.add(this)}}class uG{query;container;canLoadMoreData;isLoading;constructor(e){this.query=e,this.canLoadMoreData=!1,this.isLoading=!0,this.query=e,this.container=null}get hasData(){return null!==this.container}refresh(){}loadMoreData(e){throw Error("Should not be called.")}shutdown(){}parseFundamental(e){let t=JSON.parse(e),i=t.status.code,s=204===i;if(200!==i&&!s)return null;let r=new lZ(this.query.fields.concat(an.DateTime));if(s)return r;let n=this.query.fields[0],a=n.id.substring(0,1).toLowerCase()+n.id.substring(1);return t.results.reverse().forEach(e=>{r.addDataPoint(an.DateTime,lz(e.date)),r.addDataPoint(n,parseFloat(e[a]))}),this.isLoading=!1,r}makeUrl(){let e={count:0,rawData:1};e.symbols=this.query.symbol,e.frequency=this.query.aggregation.unit===$.Quarter?"Quarter":"Annual";let t=eq(e),i=this.query.seriesKind===Z.BalanceSheet?"getBalanceSheets":"getIncomeStatements";return`/${i}.json?${t}`}async retrieve(){let e=this.makeUrl(),t=await yq("ondemand",e);return this.parseFundamental(t)}async ready(){return tU.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}function uz(e,t){let i=e.findIndex(e=>e>t);return Math.max(i<0?e.length:i,0)}class uY{records;streamingSubscription;setSymbols(e){let t=yQ().getRecordSource();this.records=e.reduce((e,i)=>{let s=t.getRecord(i);return this.addFieldsToRecord(s,i),e[i]=s,e},{})}getStreamingSubscription(){return yQ().getRecordSource().subject.pipe(oh(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}onStreamingUpdates(e){e.forEach(e=>{let t=e.data,i=this.records[t.symbol];eH(i)&&this.process(i)}),this.notifyAboutUpdates()}async retrieve(){let e=Object.values(this.records);return(await Promise.all(e.map(e=>e.ready()))).every(ed)&&(this.onRecordsReady(),e.forEach(e=>this.process(e)),this.streamingSubscription=this.getStreamingSubscription()),this.hasData}async ready(){return tU.call(this,async()=>await this.retrieve())}shutdown(){eH(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class uj extends uY{symbols=[];constructor(e){super(),this.symbols=e,this.setSymbols(e)}addFieldsToRecord(e,t){e.addFields(an.Symbol),e.update(an.Symbol,t)}notifyAboutUpdates(){eR(aa.RT_QUOTEGROUP,{source:this})}process(e){}onRecordsReady(){}get hasData(){return!0}getValue(e){let t=this.records[e];return void 0===t?null:t.getValue(an.Close)}}class uK extends uY{query;dataPoints;container;fields;canLoadMoreData=!1;isLoading=!1;constructor(e){super(),this.query=e,this.setSymbols(e.symbols),this.dataPoints=e.symbols.length,this.container=null,this.fields=[an.DateTime,an.Close,an.Symbol]}addFieldsToRecord(e,t){e.addFields(an.DateTime,an.Symbol),e.update(an.DateTime,tL(t)),e.update(an.Symbol,t)}refresh(){}loadMoreData(e){throw Error("Should not be called.")}get hasData(){return null!==this.container&&this.container.size===this.dataPoints}notifyAboutUpdates(){eR(aa.TS_MANYCHANGED,{series:this,part:er.Unspecified})}onRecordsReady(){this.container=new lZ(this.fields)}findOrAddIndex(e){let t=this.container.getData(an.Symbol).indexOf(e.symbol);return t<0&&(t=uz(this.container.getData(an.DateTime),tL(e.symbol)),this.fields.forEach(e=>this.container.getData(e).splice(t,0,null))),t}process(e){let t=this.fields.map(t=>{let i=e.getValue(t);return"Close"!==t.id?i:e.getValue(an.Last)??i});if(!eg(t))return;let i=this.findOrAddIndex(e);this.fields.forEach((e,s)=>this.container.getData(e)[i]=t[s])}getCacheableEntities(e){e.add(this)}}class uq{query;container;fields;canLoadMoreData=!1;isLoading=!1;constructor(e){this.query=e,this.fields=[an.DateTime,an.Close,an.Symbol],this.container=null}get hasData(){return null!==this.container}refresh(){}loadMoreData(e){throw Error("Should not be called.")}shutdown(){}insertValues(e,t,i){let s=(t,i,s)=>e.getData(i).splice(t,0,s),r=e.getData(an.DateTime),n=tL(t),a=uz(r,n);s(a,an.DateTime,n),s(a,an.Close,i),s(a,an.Symbol,t)}parseHistoricalForward(e){let t=new lZ(this.fields);return e.split("\n").filter(e=>e.trim().length>0).forEach(e=>{let i=e.split(","),s=i[0];this.insertValues(t,s,parseFloat(i[5]))}),t}makeUrl(){let e={};e.symbols=this.query.symbols.join(","),e.maxrecords=1,e.data="daily",e.end=ec(uf(this.query.offset),lD(tG.FMT_HIST_FEED_PARAM_DATE_ONLY))(new Date);let t=eq(e);return`/querylatesteod.ashx?${t}`}async retrieve(){let e=this.makeUrl(),t=await yq("timeseries",e);return this.parseHistoricalForward(t)}async ready(){return tU.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}class uX extends uB{constructor(e){super(e)}getRetriever(){return new ud}onStreamingUpdates(e){}}class uZ{cacheSeries;seriesCache;constructor(e=!1){this.cacheSeries=e,this.seriesCache=new Map}getTimeSeries(e){return eH(e.symbol)&&e.symbol===tG.PLACEHOLDER_SYMBOL_NAME?new uU(e):this.getSeries(e)}evictUnused(e){for(let[t,i]of this.seriesCache)!e.has(i)&&i.isCached&&(i.isCached=!1,i.shutdown(),this.seriesCache.delete(t))}refresh(){for(let e of this.seriesCache.values())"function"==typeof e.refresh&&e.refresh()}getSeries(e){let t=(e.cacheMe||this.cacheSeries)&&!e?.alwaysUseBarsToFetch,i=e.getHashKey();if(t&&this.seriesCache.has(i))return this.seriesCache.get(i);{let s=this.makeSeries(e);return s.isCached=t,t&&this.seriesCache.set(i,s),s}}makeSeries(e){switch(e.seriesKind){case Z.Normal:return new uB(e);case Z.BalanceSheet:case Z.IncomeStatement:return new uG(e);case Z.Events:return new u$(e);case Z.Forward:return new uK(e);case Z.HistoricalForward:return new uq(e);default:case Z.Options:return new uX(e);case Z.Study:throw Error(`The series kind '${Z[e.seriesKind]}' is not supported yet.`)}}}var uJ={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},uQ={date:oR({formats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:oR({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:oR({formats:{full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},u0={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},u1={code:"fr",formatDistance:function(e,t,i){var s,r=uJ[e];if(s="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",String(t)),null!=i&&i.addSuffix)if(i.comparison&&i.comparison>0)return"dans "+s;else return"il y a "+s;return s},formatLong:uQ,formatRelative:function(e,t,i,s){return u0[e]},localize:{ordinalNumber:function(e,t){var i,s=Number(e),r=null==t?void 0:t.unit;return 0===s?"0":(i=1===s?r&&["year","week","hour","minute","second"].includes(r)?"ère":"er":"ème",s+i)},era:oH({values:{narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},defaultWidth:"wide"}),quarter:oH({values:{narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:oH({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},defaultWidth:"wide"}),day:oH({values:{narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},defaultWidth:"wide"}),dayPeriod:oH({values:{narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},defaultWidth:"wide"})},match:{ordinalNumber:ok({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e)}}),era:oF({matchPatterns:{narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^av/i,/^ap/i]},defaultParseWidth:"any"}),quarter:oF({matchPatterns:{narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:oF({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/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,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:oF({matchPatterns:{narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:oF({matchPatterns:{narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:4}};function u2(e){return te(1,arguments),ti(e).getDay()}function u3(e){te(1,arguments);var t=ti(e);return t.setMinutes(0,0,0),t}function u4(e,t){te(2,arguments);var i=u3(e),s=u3(t);return i.getTime()===s.getTime()}function u5(e){te(1,arguments);var t=ti(e);return t.setSeconds(0,0),t}let u6=/{value:([^}]+)}/,u7=/%([aAdewbBmyYHkIlMpPSL])+/g;var u8=((O=u8||{})[O.Second=0]="Second",O[O.Minute=1]="Minute",O[O.Hour=2]="Hour",O[O.Day=3]="Day",O[O.Week=4]="Week",O[O.Month=5]="Month",O[O.Year=6]="Year",O);let u9={Second:{Period:"PT1S",Multipliers:[.01,.02,.05,.1,.2,.5,1,2,5,10,15,30]},Minute:{Period:"PT1M",Multipliers:[1,2,5,10,15,30]},Hour:{Period:"PT1H",Multipliers:[1,2,3,4,6,8,12]},Day:{Period:"P1D",Multipliers:[1,2]},Week:{Period:"P1W",Multipliers:[1,2]},Month:{Period:"P1M",Multipliers:[1,2,3,4,6]},Year:{Period:"P1Y",Multipliers:[1,2,5,10,25,50,100,250]}},he=new Map;function ht(e){if(!eH(e))return null;if(!he.has(e)){var t;let i=eH(t=e)?t.replace(u6,(e,t)=>t.replace(u7,(e,t)=>tG.PHP_TO_UNICODE_TS_35_MAP[t])):t;he.set(e,i)}return he.get(e)}class hi{barWidth;unitWidth;minTickInterval;duration;format;prevDate;size;constructor({barWidth:e,unitWidth:t,formatString:i,minTickInterval:s,duration:r},n){this.size=n,this.barWidth=e,this.unitWidth=t,this.minTickInterval=s,this.duration=r,this.format=ht(i),this.prevDate=null}get noPrevDate(){return!eH(this.prevDate)}formatDate(e,t){return hA(e,this.format||t)}asTick(e,t,i){return this.prevDate=e,{date:e,priority:t,text:this.formatDate(e,i)}}checkPrev(e){return!!this.noPrevDate&&(this.prevDate=e,!0)}}let hs="yyyy",hr="LLL ''yy",hn=()=>"fr"===hT()?"d LLL":"LLL d",ha="HH:mm";class ho extends hi{repeatEach;repeatCounter;constructor(e){super(e),this.repeatEach=tG.TIME_SCALE_MAX_SPACE_NO_TICKS/this.barWidth,this.repeatCounter=0}asTick(e,t,i){return this.repeatCounter=0,super.asTick(e,t,i)}getTick(e){if(!no(this.prevDate,e))return this.asTick(e,1,"EEE");if(!u4(this.prevDate,e))return this.asTick(e,2,ha);this.repeatCounter++;let t=this.repeatCounter===this.repeatEach;return!function(e,t){te(2,arguments);var i=u5(e),s=u5(t);return i.getTime()===s.getTime()}(this.prevDate,e)||t?this.asTick(e,t?4:3,ha):null}}class hl extends hi{getTick(e){let t=this.checkPrev(e),i=0===this.minTickInterval||0==(e=>{let t=to(e);return uT(e,t)})(e)%(this.minTickInterval/1e3),s=!no(this.prevDate,e),r=function(e){return te(1,arguments),ti(e).getMinutes()}(e),n=!u4(this.prevDate,e)||t&&0===r;if(i){if(s)return this.asTick(e,1,hn());if(n)return this.asTick(e,2,ha);if(0==r%30&&this.size<15)return this.asTick(e,3,ha);if(0==r%15&&this.size<=5)return this.asTick(e,4,ha)}return null}}class hu extends hi{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<22*u9.Day.One,this.monthYear=this.duration>22*u9.Day.One&&this.duration<7*u9.Month.One,this.year=this.duration>7*u9.Month.One}useTuesday(e){return!!this.noPrevDate||2===u2(e)&&um(e,this.prevDate)>1728e5}getTick(e){this.checkPrev(e);let t=!nl(e,this.prevDate),i=!nf(e,this.prevDate);return this.monthDay?1===u2(e)||this.useTuesday(e)?this.asTick(e,1,hn()):null:this.monthYear?t?this.asTick(e,1,hr):null:this.year&&i?this.asTick(e,1,hs):null}}class hh extends hi{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<4*u9.Week.One,this.monthYear=this.duration>4*u9.Week.One&&this.duration<6*u9.Month.One,this.year=this.duration>6*u9.Month.One}getTick(e){this.checkPrev(e);let t=!nl(e,this.prevDate),i=!nf(e,this.prevDate);return this.monthDay?this.asTick(e,1,hn()):this.monthYear?t?this.asTick(e,1,hr):null:this.year&&i?this.asTick(e,1,hs):null}}class hc extends hi{showMonths;constructor(e){super(e),this.showMonths=this.duration<7*u9.Month.One}getTick(e){this.checkPrev(e);let t=!nf(e,this.prevDate);return this.showMonths?this.asTick(e,1,hr):t?this.asTick(e,1,hs):null}}class hd extends hi{constructor(e){super(e)}getTick(e){return this.checkPrev(e),nf(e,this.prevDate)?null:this.asTick(e,1,hs)}}function hp(e){return((e.valueOf()-tG.OPTIONS_DATA_BASE)/tG.OPTIONS_DATA_INCREMENT).toString()}function hf(e){return eH(e)?`${e.toFixed(2)}%`:""}function hm(e,t,i=!1){let s=e.plots[0],r=s.curves[0],n=eH(r)&&r.fields.length>0?r.fields[0]:null;if(!eH(n))return"";let a={range:e.fullDomain,allDigits:!1,forceTrailingZeros:i};return hF(s,e.pane.presenter,a),s.metaData.format(t,n,a)}function hg(e,t,i=!1){return e.comparison===K.Percent?hf(t):hm(e,t,i)}function hy(e,t,i){let s=e.view?.xAxis?.overrideFormatter;if(s)return s(t);if(eH(e.display.xAxis.isOrdinal))return hp(t);let r=i||e.display.xAxis.format;if(eH(r))return hA(t,ht(r));let n=e.data.aggregation,a=e.display?.xAxis?.nonEodLabelWithDate??!1;return n.isEndOfDay?hS(n,t):hv(n,t,a)}function hT(){let e=e$(yQ().config,null,"overrides","xAxis","getLocaleName");if(eH(e)&&"function"==typeof e)try{return e()}catch(e){yj(`Failed retrieving the locale name, error is ${e.message}`,"warn")}}function hA(e,t){return oY(e,t,"fr"===hT()?{locale:u1}:void 0)}function hS(e,t){if(!od(t))return"";switch(e.unit){case $.Tick:case $.Intraday:case $.Day:case $.Week:default:return hA(t,"P");case $.Month:return hA(t,"LLL yyyy");case $.Quarter:return hA(t,"qqq yyyy");case $.Year:return hA(t,"yyyy")}}function hv(e,t,i){return od(t)?hA(t,`${i?"P ":""} ${e.isTick?"pp":"p"}`):""}let hb=(e,t)=>e.at(t);class hP{presenter;_dates;pendingRebuild;constructor(e){this.presenter=e,this._dates=[],this.pendingRebuild=!1,this._dates=[],this.invalidate()}checkRebuild(){this.pendingRebuild&&this.rebuild()}get withPrologLength(){return this.checkRebuild(),this._dates.length+tG.TIMELINE_PROLOG_PADDING_BARS}get withPrologEpilogLength(){return this.withPrologLength+tG.TIMELINE_EPILOG_PADDING_BARS}get firstSeriesIndex(){return tG.TIMELINE_PROLOG_PADDING_BARS}get lastSeriesIndex(){return this.checkRebuild(),0===this._dates.length?0:this.withPrologLength-1}get withoutPrologEpilogLength(){return this.checkRebuild(),this._dates.length}at(e){if(this.checkRebuild(),e<0||e>=this.withPrologEpilogLength)return null;if(e<tG.TIMELINE_PROLOG_PADDING_BARS){let t=eP(this._dates),i=e-tG.TIMELINE_PROLOG_PADDING_BARS;return this.applyDateShift(t,i)}if(e>=this.withPrologLength){let t=eb(this._dates),i=e-this.withPrologLength+1;return this.applyDateShift(t,i)}return this._dates[e-tG.TIMELINE_PROLOG_PADDING_BARS]}get length(){return this.checkRebuild(),this._dates.length>0?this.withPrologEpilogLength:0}slice(e,t){this.checkRebuild();let i=[];for(let s=e;s<t;++s)i.push(this.at(s));return i}tryToCorrectLastBar(e,t,i=!0){i&&this.checkRebuild();let s=+e,r=e_(this._dates,s,Number),n=+this._dates[r];return r===this._dates.length-1&&n===s&&(this._dates[r]=t,!0)}mergeDateIntoTimeline(e,t=!0){t&&this.checkRebuild();let i=+e,s=e_(this._dates,i,Number),r=+this._dates[s];if(r!==i){let t=s+ +(i>r);return this._dates.splice(t,0,e),t+this.firstSeriesIndex}return -1}invalidate(){this._dates.length=0,this.pendingRebuild=!0}rebuild(){if(this.presenter.isEmpty)return;let e=this.presenter.mainPlot.timeSeries;if(!e.hasData)return;let t=e.container.getTimeData();for(let e=t.length-1;e>=0;e--)this._dates[e]=t[e];this.presenter.allPlots.forEach(t=>{t.timeSeries!==e&&t.timeSeries.hasData&&t.timeSeries.container.getTimeData().forEach(e=>this.mergeDateIntoTimeline(e,!1))}),this.pendingRebuild=!1}applyDateShift(e,t){let{unit:i,size:s}=this.presenter.data.aggregation;switch(i){case $.Year:return ts(e,12*t);case $.Quarter:return ts(e,3*t);case $.Month:return ts(e,t);case $.Week:return lx(e,7*t);case $.Day:return lx(e,t);case $.Intraday:return op(e,s*t*tG.ONE_MINUTE_MILLIS);case $.Tick:return op(e,1e3*t)}}}let hC={delete:'<path d="M225.8 286.2l225.8 225.8-225.8 225.8c-16.7 16.7-16.7 43.7 0.0 60.3s43.7 16.7 60.3 0.0l225.8-225.8 225.8 225.8c16.7 16.7 43.7 16.7 60.3 0.0s16.7-43.7 0.0-60.3l-225.8-225.8 225.8-225.8c16.7-16.7 16.7-43.7 0.0-60.3s-43.7-16.7-60.3 0.0l-225.8 225.8-225.8-225.8c-16.7-16.7-43.7-16.7-60.3 0.0s-16.7 43.7 0.0 60.3z"></path>',circle:'<circle cx="512" cy="512" r="512"/>',rectangle:'<rect width="1024" height="1024"/>',chevronUp:'<path d="M798.2 609.8l-256.0-256.0c-16.7-16.7-43.7-16.7-60.3 0.0l-256.0 256.0c-16.7 16.7-16.7 43.7 0.0 60.3s43.7 16.7 60.3 0.0l225.8-225.8 225.8 225.8c16.7 16.7 43.7 16.7 60.3 0.0s16.7-43.7 0.0-60.3z"></path>',chevronDown:'<path d="M225.8 414.2l256.0 256.0c16.7 16.7 43.7 16.7 60.3 0.0l256.0-256.0c16.7-16.7 16.7-43.7 0.0-60.3s-43.7-16.7-60.3 0.0l-225.8 225.8-225.8-225.8c-16.7-16.7-43.7-16.7-60.3 0.0s-16.7 43.7 0.0 60.3z"></path>',eye:'<path d="M950.9 411.4q-86.9 134.9-217.7 201.7 34.9-59.4 34.9-128.6 0.0-105.7-75.1-180.9t-180.9-75.1-180.9 75.1-75.1 180.9q0.0 69.1 34.9 128.6-130.9-66.9-217.7-201.7 76.0-117.1 190.6-186.6t248.3-69.4 248.3 69.4 190.6 186.6zM539.4 630.9q0.0 11.4-8.0 19.4t-19.4 8.0q-71.4 0.0-122.6-51.1t-51.1-122.6q0.0-11.4 8.0-19.4t19.4-8.0 19.4 8.0 8.0 19.4q0.0 49.1 34.9 84.0t84.0 34.9q11.4 0.0 19.4 8.0t8.0 19.4zM1024.0 411.4q0.0-19.4-11.4-39.4-80.0-131.4-215.1-210.6t-285.4-79.1-285.4 79.4-215.1 210.3q-11.4 20.0-11.4 39.4t11.4 39.4q80.0 130.9 215.1 210.3t285.4 79.4 285.4-79.4 215.1-210.3q11.4-20.0 11.4-39.4z"></path>',eyeSlash:'<path d="M317.1 197.1l44.6 80.6q-49.7 36.0-77.7 90.9t-28.0 116.0q0.0 69.1 34.9 128.6-130.9-66.9-217.7-201.7 95.4-147.4 244.0-214.3zM539.4 630.9q0.0 11.4-8.0 19.4t-19.4 8.0q-71.4 0.0-122.6-51.1t-51.1-122.6q0.0-11.4 8.0-19.4t19.4-8.0 19.4 8.0 8.0 19.4q0.0 49.1 34.9 84.0t84.0 34.9q11.4 0.0 19.4 8.0t8.0 19.4zM746.9 740.0q0.0-4.0-0.6-5.1-60.0-107.4-180.0-323.4t-180.6-324.0l-28.0-50.9q-5.7-9.1-16.0-9.1-6.9 0.0-76.6 40.0-9.1 5.7-9.1 16.0 0.0 6.9 25.1 49.7-81.7 37.1-150.6 98.9t-119.1 140.0q-11.4 17.7-11.4 39.4t11.4 39.4q87.4 134.3 217.1 212.0t283.4 77.7q50.9 0.0 102.9-9.7l30.9 55.4q5.7 9.1 16.0 9.1 2.9 0.0 10.3-3.4t17.7-8.9 18.9-10.6 18.0-10.6 11.1-6.6q9.1-5.7 9.1-15.4zM768.0 484.6q0.0-79.4-45.1-144.9t-119.4-94.0l160.0 286.9q4.6-25.7 4.6-48.0zM1024.0 411.4q0.0-20.0-11.4-39.4-22.3-36.6-62.3-82.9-85.7-98.3-198.6-152.6t-239.7-54.3l42.3 75.4q121.1 10.3 224.3 78.3t172.3 175.4q-65.7 102.3-161.1 168.0l36.0 64.0q54.3-36.6 104.3-87.4t82.6-105.1q11.4-19.4 11.4-39.4z"></path>',moreActions:'<path d="M597.3 512a85.3 85.3 0 1 0-170.6 0 85.3 85.3 0 0 0 170.6 0zm298.7 0a85.3 85.3 0 1 0-170.7 0 85.3 85.3 0 0 0 170.7 0zm-597.3 0a85.3 85.3 0 1 0-170.7 0 85.3 85.3 0 0 0 170.7 0z"></path>'};function hE(e){return!0===yQ().config.useAllFieldsForComparison&&e.mainPlot.mainCurve.isOhlc&&e.mainAxis.comparison===K.None&&e.mainPane.axes.map(e=>e.plots).flat().reduce((e,t)=>e+ +!!t.isSymbol,0)>1}let h_=new nb;function hM({plots:e,isMultiSymbol:t,isMultiContract:i,date:s,time:r,dateFieldName:n,hideSymbols:a,revealingClose:o}){let l=a&&o,u=[hI(n,s,null,"heading"),r?hI("Time",r,null,"heading"):""].concat(e.map(e=>{if(0===e.values.length)return null;let s=(e=>{let s=e.name.startsWith(tG.FAKE_SYMBOL_PREFIX);switch(e.type){case X.Expression:return!0;case X.Symbol:if((t||i)&&!s)return!0;return!a;default:return!1}})(e)?hD(X[e.type],e.name,e.values[0].color):"",r=e.values.map(t=>hI(t.id===an.Close.id&&l?e.description:t.longName,t.value,t.color));if(e.events&&e.events.length){let t=e.events.map(e=>hD(`${e.field.name} (${hS(h_,e.date)})`,e.value,e.color));r.push(...t)}return r.unshift(s),eH(e.unalignedDate)&&r.unshift(hI("Date",e.unalignedDate,e.values[0].color,"heading")),r}).filter(e=>null!=e).flat()).filter(e=>""!==e).join("");return`<table class="values-table">${u}</table>`}function hL(e){return`bchart-icon-${e}`}function hx(e,t=null,i=10){let s=eH(t)?`style="fill:${t}"`:"",r=hL(e);return`<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="${i}px" height="${i}px" ${s}><use xlink:href="#${r}"></use></svg>`}function hO(e,t){let i=e?"Up":"Down",s=hx(`chevron${i}`);return`<span data-pane="${t}" data-dir="${i}" title="Move ${i}" class="move-pane">${s}</span>`}function hI(e,t,i=null,s=[]){"string"==typeof s&&(s=s.split(" "));let r=["value-row",...s],n="string"==typeof i?` style="color: ${i}"`:"";return`
7
+ Bars %csame %c${i(t.lastTimestamp)} == ${i(t.newTimestamp)}`,"color:#0f0","color:#f96"),this.addBar(e,t)):null}alignToQuote(e){if(eH(e.lastPrice,e.time))return this.updateLastBar(e.highPrice,e.lowPrice,e.lastPrice,void 0),{isUpdate:!0,time:e.time.getTime(),index:lj(this.container)}}}class lZ extends lX{innerBuilder;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.processRetrieved()}get base(){return this.innerBuilder.container}fixupTimeBasedAggregationTimestamp(e){let t=lL(e,tG.START_OF_LAST_CENTURY);return lI(e,t%this.agg.size)}processRetrieved(){this.container.clear();for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.base.getData(aa.DateTime)[e],tradeSize:0,tradePrice:0,tradingDay:0};[aa.Open,aa.High,aa.Low].forEach(i=>{t.tradePrice=this.base.getData(i)[e],super.process(t)}),t.tradePrice=this.base.getData(aa.Close)[e],t.tradeSize=this.base.getData(aa.Volume)[e],super.process(t)}}process(e){return this.innerBuilder.process(e),super.process(e)}}class lJ{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!==aa.Change||!this.hasField(aa.Close)||t<1)return;let i=this.storage[e.id],s=this.storage[aa.Close.id];i[t]=s[t]-s[t-1]}concat(e,t,i){this.storage[e.id]=t.concat(i),this.fixupTransition(e,t.length)}prependData(e,t){this.checkField(e),this.concat(e,t,this.getData(e))}prepend(e){let t=e.getLastDataPoint(aa.DateTime).getTime()===this.getTimeData()[0].getTime(),i=e.size;e.fields.forEach(s=>{t&&e.getData(s).splice(i-1,1),this.prependData(s,e.getData(s))})}appendData(e,t){this.checkField(e),this.concat(e,this.getData(e),t)}append(e){let t=e.getTimeData()[0].getTime()===this.getLastDataPoint(aa.DateTime).getTime(),i=this.size;return e.fields.forEach(s=>{t&&this.getData(s).splice(i-1,1),this.appendData(s,e.getData(s))}),e.size-!!t}getTimeData(){return this.getData(aa.DateTime)}getData(e){return this.storage[e.id]}setData(e,t){this.checkField(e),this.storage[e.id]=t}hasField(e){return -1!==this.fields.findIndex(t=>t.id===e.id)}get size(){return 0===this.fields.length?0:this.getData(this.fields[0]).length}get isEmpty(){return 0===this.size}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),eb(this.getData(e))}setLastDataPoint(e,t){this.checkField(e);let i=this.getData(e);i[i.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))}}class lQ extends lJ{constructor(){super([])}get size(){return 0}}class l0 extends lJ{wrapper;constructor(e,t){super(e),this.wrapper=t}isWrapped(e){return eW(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)}}let l1=tG.RENKO_KAGI_NAMES;function l2(e){let{Method:t,Period:i,Source:s,BrickSize:r}=ej(e),n=eU(t,[l1.ATR,l1.TRD,l1.PCT],l1.ATR),a=Number.isFinite(i)?i:14;return{method:n,period:a,source:eU(s,[l1.CLS,l1.HL],l1.CLS),brickSize:Number.isFinite(r)?r:10}}function l3(e,t,i){return e.getData(t)[i]}function l4(e,t){let[i,s]=[aa.High,aa.Low].map(i=>l3(e,i,t)),r=l3(e,aa.Close,t-1);return Math.max(i-s,Math.abs(i-r),Math.abs(s-r))}function l5(e,t){if(e.size<t)return null;let i=t-1,s=[];s.push(l3(e,aa.High,0)-l3(e,aa.Low,0));for(let i=1;i<t;++i)s.push(l4(e,i));let r=em(s);for(let s=t;s<e.size;++s)r=(r*i+l4(e,s))/t;return r}let l6=e=>aa[e],l7=["DateTime","Open","High","Low","Close","Volume"].map(l6),l8=l7.concat(["Change","Projection","BarIndex"].map(l6));class l9 extends lK{innerBuilder;inputs;brickSize;lastFinalBrick;projectionCount;refPrices;constructor(e,t){super(),this.supportsChunks=!1,this.innerBuilder=e,this.inputs=eG(t.inputs),this.brickSize=null,this.container=new lJ(l8),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[i,s,r,n,a,o]=l7.map(i=>t.getData(i)[e]);return{date:i,open:s,high:r,low:n,close:a,volume:o}}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,i){let[s,r]=this.refPrices(t.close,t.high,t.low),n=s-e.high,a=e.low-r;return{climbing:(i&&n>0||n>=this.brickSize)&&n>=a,falling:(i&&a>0||a>=this.brickSize)&&a>n,moveUp:n,moveDown:a}}initFirstBrick(e,t){e.open=e.high=e.low=e.close=Math.max(this.brickSize,eF(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,i=2*tG.RENKO_MAX_BARS;for(;t>0&&e<i;)e+=Math.floor(l4(this.base,t)/this.brickSize),t--;return t}processRetrieved(){let e=l2(this.inputs),{method:t,period:i,source:s}=e;if(this.brickSize=e.brickSize,t===l1.ATR)this.brickSize=l5(this.base,i);else if(t===l1.PCT)if((this.base?.size??0)>0){let e=this.base.getLastDataPoint(aa.Close);this.brickSize=e*this.brickSize/100}else this.brickSize=null;if(!eH(this.brickSize))return;this.refPrices=s===l1.HL?(e,t,i)=>[t,i]:(e,t,i)=>[e,e];let r={},n=this.findSafeStartIndex();for(let e=n;e<this.base.size;e++){let t=this.getBarAt(e);if(e===n){this.initFirstBrick(r,t);continue}let i=this.isLastBase(e),{climbing:s,falling:a,moveUp:o,moveDown:l}=this.getMove(r,t,i);if(!s&&!a){r.volume+=t.volume;continue}r.proj=Number(i),r.barIndex=e;let u=t.date.getTime();if(s){let e=this.getBricksCount(o);for(let t=0;t<e;++t)this.constructClimbing(r,u,t,this.brickSize);i&&(this.constructClimbing(r,u,e,o%this.brickSize),this.projectionCount=e+1)}else if(a){let e=this.getBricksCount(l);for(let t=0;t<e;++t)this.constructFalling(r,u,t,this.brickSize);i&&(this.constructFalling(r,u,e,l%this.brickSize),this.projectionCount=e+1)}i||(this.lastFinalBrick=this.container.size-1,r.volume=0)}this.container.keepOnlyLast(tG.RENKO_MAX_BARS)}constructClimbing(e,t,i,s,r=!0){let n=e.high,a=e.close;e.open=e.low=n,e.high=e.close=n+s,e.date=new Date(t+i),e.change=e.close-a,r?this.addToContainer(e):this.updateLastDataPoint(e)}constructFalling(e,t,i,s,r=!0){let n=e.low,a=e.close;e.open=e.high=n,e.low=e.close=n-s,e.date=new Date(t+i),e.change=e.close-a,r?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,i=this.getBarAt(t),s=this.getBrickAt(this.lastFinalBrick),{climbing:r,falling:n,moveUp:a,moveDown:o}=this.getMove(s,i,!0),l=1===this.container.getLastDataPoint(aa.Projection);if(!r&&!n)return l?this.rebuild():null;let u=this.getBricksCount(r?a:o)+1;if(!l||this.projectionCount!==u)return this.rebuild();{let e=this.getBrickAt(this.container.size-1),s=this.getBrickAt(Math.min(this.container.size-2,0));return e.proj=1,e.barIndex=t,e.open===e.high?e.low=e.close=i.close:e.open===e.low&&(e.high=e.close=i.close),e.change=e.close-s.close,this.updateLastDataPoint(e),{isUpdate:!0,time:e.date.getTime(),index:this.container.size-1}}}addToContainer(e){let t=this.container;t.addDataPoint(aa.DateTime,e.date),t.addDataPoint(aa.Open,e.open),t.addDataPoint(aa.Close,e.close),t.addDataPoint(aa.High,e.high),t.addDataPoint(aa.Low,e.low),t.addDataPoint(aa.Change,e.change),t.addDataPoint(aa.Volume,e.volume),t.addDataPoint(aa.Projection,e.proj),t.addDataPoint(aa.BarIndex,e.barIndex)}updateLastDataPoint(e){let t=this.container;t.setLastDataPoint(aa.DateTime,e.date),t.setLastDataPoint(aa.Open,e.open),t.setLastDataPoint(aa.Close,e.close),t.setLastDataPoint(aa.High,e.high),t.setLastDataPoint(aa.Low,e.low),t.setLastDataPoint(aa.Change,e.change),t.setLastDataPoint(aa.Volume,e.volume),t.setLastDataPoint(aa.Projection,e.proj),t.setLastDataPoint(aa.BarIndex,e.barIndex)}}let ue=[aa.DateTime,aa.TradingDay,aa.Last,aa.TradeSize,aa.Change],ut=[aa.DateTime,aa.Open,aa.High,aa.Low,aa.Close,aa.Volume,aa.Change],ui=[...ut,aa.OpenInterest],us=[...ui,aa.Symbol],ur=[aa.Open,aa.High,aa.Low,aa.Close,aa.Change];function un(e,t){let i=tE(e);if(t.isTick)return ue;{let e=ut;return t.isMultiContract?e=us:(i||t.isEndOfDay)&&(e=ui),t.isIntraday?[...e,aa.TradingDay]:e}}class ua{symbol;aggregation;offset;container;previousTime;timeZone;isFuture;needsResolution;hasOpenInterest;padded;constructor(e,t,i=0,s=!1){this.symbol=e,this.aggregation=t,this.offset=i||0,this.previousTime=new Date(0),this.timeZone=this.getTimeZone(),this.isFuture=tg(e),this.padded=s,this.needsResolution=tC(e),this.hasOpenInterest=tE(e)}makeContainer(){return new lJ(un(this.symbol,this.aggregation))}parse(e){this.container=this.makeContainer();let t=e.split("\n"),i=this.getParseFunc();if(null!==i){let e=i.bind(this);t.forEach(t=>{let i=t.trim();i&&e(i.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;(0===t||1===t)&&(this.container.addDataPoint(aa.DateTime,this.parseDate(e[0+t])),this.container.addDataPoint(aa.TradingDay,parseInt(e[1+t])),this.container.addDataPoint(aa.Last,parseFloat(e[3+t])),this.container.addDataPoint(aa.TradeSize,parseInt(e[4+t])),this.container.addDataPoint(aa.Change,this.calculateChange(aa.Last)))}nullify(e){return null==e||0===e?null:e}parseMinutes(e){let t=this.aggregation.isMultiContract&&this.isFuture||this.needsResolution,i=+!!t;e.length===7+i&&(this.container.hasField(aa.Symbol)&&this.container.addDataPoint(aa.Symbol,t?e[0]:this.symbol),this.container.addDataPoint(aa.DateTime,this.parseDate(e[0+i])),this.container.addDataPoint(aa.TradingDay,parseInt(e[1+i])),this.container.addDataPoint(aa.Open,parseFloat(e[2+i])),this.container.addDataPoint(aa.High,parseFloat(e[3+i])),this.container.addDataPoint(aa.Low,parseFloat(e[4+i])),this.container.addDataPoint(aa.Close,parseFloat(e[5+i])),this.container.addDataPoint(aa.Volume,this.nullify(parseInt(e[6+i]))),this.container.addDataPoint(aa.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,i=7+ +!!this.hasOpenInterest;e.length===i&&(t&&this.container.addDataPoint(aa.Symbol,e[0]),this.container.addDataPoint(aa.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aa.Open,this.parseFloatOrNull(e[2])),this.container.addDataPoint(aa.High,parseFloat(e[3])),this.container.addDataPoint(aa.Low,parseFloat(e[4])),this.container.addDataPoint(aa.Close,parseFloat(e[5])),this.container.addDataPoint(aa.Volume,this.nullify(this.parseIntOrNull(e[6]))),this.hasOpenInterest&&this.container.addDataPoint(aa.OpenInterest,this.nullify(this.parseIntOrNull(e[7]))),this.container.addDataPoint(aa.Change,this.calculateChange()))}calculateChange(e=aa.Close){let t=this.container.size;if(!(t>1))return 0;{let i=this.container.getData(e);return i[t-1]-i[t-2]}}parseTimestamp(e){switch(this.aggregation.unit){case $.Tick:case $.Intraday:return function(e,t=tG.ZERO_DATE){let i=new Date(e.replace(" ","T"));return op(i)?i:t}(e);default:return lY(e)}}parseDate(e){let t=this.parseTimestamp(e);return this.aggregation.isEndOfDay?tr(t,this.offset):(!function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getTime()>s.getTime()}(t,this.previousTime)?this.previousTime=of(this.previousTime,1):this.previousTime=t,this.previousTime)}getTimeZone(){return t_(this.symbol)}}let{BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:uo,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:ul}=tG;class uu{supportsChunks;constructor(){this.supportsChunks=!0}getPageNameFor(e,t){switch(e.unit){case $.Tick:return tG.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case $.Intraday:return t&&e.spec===G.Nearest?uo:ul;case $.Day:case $.Week:case $.Month:case $.Quarter:case $.Year:return tG.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return""}}addExtraParams(e){}makeUrl(e){let t={},i=tQ(e.symbol);t.symbol=i;let s=e.aggregation,r=this.getDataParam(s);r.length>0&&(t.data=r),s.size>1&&s.unit===$.Intraday&&(t.interval=(s.spec===G.PerRange?1:s.size).toString());let[n,a]=e.range,o=null!==n,l=null!==a;if(o&&(t.start=this.toHistoricalFeedDate(n,s)),!o||e.alwaysUseBarsToFetch){let i=e.barsToFetch||tG.DEFAULT_MAX_RECORDS;s.unit===$.Tick&&s.spec!==G.None&&(i*=tG.TICK_CUSTOM_AGG_MULTIPLIER),t.maxrecords=i.toString()}l&&(t.end=this.toHistoricalFeedDate(a,s)),t.volume=s.isContractVolume?"contract":"total",t.order="asc",t.dividends=s.dividendsAdjust.toString(),t.backadjust=s.backAdjust.toString(),t.daystoexpiration=s.daysToExpiration.toString(),t.contractroll=s.contractRoll,s.isTick&&(t.type="T",t.skipOldEmulation="true"),!0===e.extendedHours&&(t.formt="true"),t.splits=(e?.splits??!0).toString(),t.padded=(e.padded??!1).toString(),this.addExtraParams(t);let u=eq(t),h=tg(i),c=this.getPageNameFor(s,h);return`/${c}?${u}`}toHistoricalFeedDate(e,t){return oj(e,t.isTick||t.isIntraday?tG.FMT_HIST_FEED_PARAM_DATE_TIME:tG.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(e){let t="",i=this.getSpecPart(e);switch(e.unit){case $.Tick:case $.Intraday:break;case $.Day:t=`daily${i}`;break;case $.Week:t=`weekly${i}`;break;case $.Month:t=`monthly${i}`;break;case $.Quarter:t=`quarterly${i}`;break;case $.Year:t=`yearly${i}`}return t}getSpecPart(e){return e.isMultiContract?e.spec===G.Continue?"continue":"nearest":""}getParser(e){return new ua(tQ(e.symbol),e.aggregation,e.offset,e.padded)}async retrieve(e){let t=this.makeUrl(e),i=e.aggregation.unit===$.Tick?"timeseriesNew":"timeseries",s=await yX(i,t);return this.getParser(e).parse(s)}}class uh{supportsChunks;constructor(){this.supportsChunks=!1}addExtraParams(e){}async retrieve(e){let t=tQ(e.symbol),i=this.emptyContainer(t,e.aggregation);if(e.aggregation.unit!==$.Day)return i;let s={symbol:t};this.addExtraParams(s);let r=`/${this.getPageName()}.json?${eq(s)}`,n=await yX("ondemand",r);try{let e=JSON.parse(n);if(200===e.status.code){let t=e.results;if(this.iterateForward)for(let e=0;e<t.length;e++)this.processRow(t[e],e,i);else for(let e=t.length-1;e>=0;e--)this.processRow(t[e],e,i)}}catch(e){yK(`Failed parsing the JSON result from OnDemand, error is ${e.message}`)}return i}}class uc extends uh{emptyContainer(e,t){return new lJ(un(e,t))}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){let s=i.hasField(aa.Symbol),r=t>0?i.getLastDataPoint(aa.Close):null;i.addDataPoint(aa.DateTime,lY(e.date)),s&&i.addDataPoint(aa.Symbol,e.symbol),i.addDataPoint(aa.Open,e.open),i.addDataPoint(aa.High,e.high),i.addDataPoint(aa.Low,e.low),i.addDataPoint(aa.Close,e.close),i.addDataPoint(aa.Volume,e.volume),i.addDataPoint(aa.OpenInterest,e.openInterest);let n=null===r?null:eF(e.close-r,2);i.addDataPoint(aa.Change,n)}}let ud={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"};class up{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){let t=tQ(e.symbol).replace(/\.bz$/i,""),i=e.fields.concat(aa.DateTime),s=()=>new lJ(i);if(e.aggregation.unit!==$.Day)return s();let r={symbol:t,apiKey:"default",fields:i.map(e=>ud[e.id]).join(",")},n=`/get?${eq(r)}`,a=await yX("options",n);try{let e=JSON.parse(a).data,t=s();return e.forEach(e=>{i.forEach(i=>{if(i===aa.DateTime)t.addDataPoint(aa.DateTime,lY(e.date));else{let s;t.addDataPoint(i,(s=e[ud[i.id]],Number.parseFloat(s.replace(/,/g,""))))}})}),t}catch(e){yK(`Failed parsing options JSON historical data result, error is ${e.message}`)}return s()}}function uf(e,t){return oa(function(i,s){var r=0;i.subscribe(oo(s,function(i){s.next(e.call(t,i,r++))}))})}var um=lD(lI,2);function ug(e,t){return te(2,arguments),ti(e).getTime()-ti(t).getTime()}var uy={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function uT(e){return e?uy[e]:uy.trunc}function uA(e,t,i){te(2,arguments);var s=ug(e,t)/1e3;return uT(null==i?void 0:i.roundingMethod)(s)}class uS extends lX{innerBuilder;isBuildingBars;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.isBuildingBars=!1,this.retryCountForChunk=tG.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,i,s]=[aa.DateTime,aa.TradeSize,aa.Last,aa.TradingDay].map(e=>this.base.getData(e));for(let r=this.startFromIndex;r<this.base.size;r++){let n={isTrade:!0,time:e[r],tradeSize:t[r],tradePrice:i[r],tradingDay:s[r]};super.process(n)}this.isBuildingBars=!1}process(e){let t=this.innerBuilder.process(e);return e.time=new Date(t.time),super.process(e)}}class uv extends uS{constructor(e,t,i){super(e,t,i)}fixupTimeBasedAggregationTimestamp(e){let t=uA(e,th(n6(e,1)));return function(e,t){return te(2,arguments),lk(e,-e9(t))}(e,t%this.agg.size)}}class ub extends uS{series;constructor(e,t,i,s){super(e,i,s),this.series=t}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}}let uP=new as("_TICK_COUNT");class uC extends ub{anchorTimestamp=null;constructor(e,t,i,s){super(e,t,i,s)}get startFromIndex(){let e=0,t=this.base.getTimeData();if(eH(this.anchorTimestamp))e=eC(t,e=>e===this.anchorTimestamp);else{let i=this.base.size;if(i>2)for(let s=i-2;s>2;--s){let i=t[s].valueOf();if(i-t[s-1].valueOf()>1&&t[s+1].valueOf()-i>1){e=s;break}}this.anchorTimestamp=t[e]}return e>this.agg.size&&(e%=this.agg.size),Math.max(e,0)}addBar(e,t){let i=super.addBar(e,t);return this.container.addDataPoint(uP,1),i}changeLastBar(e,t){let i=super.changeLastBar(e,t),s=this.container.getLastDataPoint(uP);return this.container.setLastDataPoint(uP,s+1),i}isUpdate(e,t,i,s){return this.container.getLastDataPoint(uP)<this.agg.size}}let uE=new as("_VOLUME_TALLY");class u_ extends ub{constructor(e,t,i,s){super(e,t,i,s)}addBar(e,t){let i=this.container,s=(i.getLastDataPoint(uE)||0)+e.tradeSize,r=Math.floor(s/this.agg.size),n=s%this.agg.size,a=s<this.agg.size;i.size>0&&(i.setLastDataPoint(aa.Volume,a?1:r),i.setLastDataPoint(uE,s));let o=super.addBar(e,t);return i.setLastDataPoint(aa.Volume,1),i.addDataPoint(uE,a?0:n),o}changeLastBar(e,t){let i=this.container,s=super.changeLastBar(e,t);i.setLastDataPoint(aa.Volume,1);let r=i.getLastDataPoint(uE)??0;return i.setLastDataPoint(uE,r+e.tradeSize),s}isUpdate(e,t,i,s){if(!nl(e,t))return!1;let r=this.container.getLastDataPoint(uE)??0;return s.tradeSize+r<this.agg.size}}class uM extends lX{innerBuilder;metadata;range;step;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.range=i.size,this.step=1;let r=y0().getMetaDataSource();this.metadata=r.getMetaData(s)}get priceRange(){return this.step*this.range}get base(){return this.innerBuilder.container}ready(){return tU.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(aa.Volume)[e],i=this.useHighOrLow(e);if(!eH(i)){this.updateLastBar(void 0,void 0,void 0,t);continue}let s={isTrade:!0,time:this.base.getData(aa.DateTime)[e],tradeSize:t,tradePrice:i,tradingDay:0};super.process(s)}}useHighOrLow(e){let t=this.base.getData(aa.Close)[e];if(0==this.container.size)return t;let i=this.container.getLastDataPoint(aa.High),s=this.container.getLastDataPoint(aa.High),r=this.base.getData(aa.High)[e],n=this.base.getData(aa.Low)[e],a=r>i,o=n<s;return a&&o?r-t<t-n?r:n:a?r:o?n:void 0}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}isUpdate(e,t,i,s){return!0}process(e){return this.innerBuilder.process(e),super.process(e)}changeLastBar(e,t){let i=e.tradePrice,s=this.container.getLastDataPoint(aa.Low)+this.priceRange;if(i>s)return this.changeAndAddBar(s,e,t);let r=this.container.getLastDataPoint(aa.High)-this.priceRange;return i<r?this.changeAndAddBar(r,e,t):super.changeLastBar(e,t)}changeAndAddBar(e,t,i){return this.updateLastBar(e,e,e,0),this.container.setLastDataPoint(aa.Projection,0),this.addBar(t,i)}addBar(e,t){return this.container.addDataPoint(aa.Projection,1),super.addBar(e,t)}}let uL=[aa.Open,aa.High,aa.Low,aa.Close],ux=[aa.BARCOLIX,aa.High,aa.Low],uO=tG.RENKO_KAGI_NAMES;function uI(e){let{BoxSizeMethod:t,Period:i,ReversalAmount:s}=ej(e),r=eU(t,[uO.ATR,uO.TRD],uO.ATR);return{method:r,period:Number.isFinite(i)?i:14,reversal:Number.isFinite(s)?s:30}}class uD extends lX{innerBuilder;inputs;reversal;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=eG(i.inputs),this.reversal=null,this.processRetrieved()}get base(){return this.innerBuilder.container}_at(e,t,i){return e.getData(t)[i]}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(aa.BARCOLIX,null),this.container.size>1){let e=this.dataAt(aa.Close,this.container.size-2);this.setLast(aa.Open,e),this.updateLastBar(e,e)}return null}isUpdate(e,t,i,s){let r=s.tradePrice,n=r-this.getLast(aa.Close),a=n>=0,o=Math.abs(n)>=this.reversal,[l,u,h,c]=uL.map(e=>this.getLast(e)),d=c-l,p=d>=0!==a||0===d;return p&&!o||!p&&(a?r<u:r>h)?null:Math.abs(d)<this.reversal||!p||!o}computeBarColor(){let e=e=>this.dataAt(aa.Close,e)>this.dataAt(aa.Open,e),t=this.container.size;if(t>1){let i=e(t-1),[s,r,n]=ux.map(e=>this.dataAt(e,t-2)),[,a,o]=ux.map(e=>this.dataAt(e,t-1)),l=s;0===s&&i&&a>r?l=1:1===s&&!i&&o<n&&(l=0),this.setLast(aa.BARCOLIX,l)}else this.setLast(aa.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:i}=uI(this.inputs);if(this.reversal=i,e===uO.ATR&&(this.reversal=l5(this.base,t)),eH(this.reversal)){this.container.clear(),this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.baseAt(aa.DateTime,e),tradePrice:this.baseAt(aa.Close,e),tradeSize:this.baseAt(aa.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}function uw(e){let{LineCount:t}=ej(e);return{lineBreak:Number.isFinite(t)?t:3}}class uR extends lX{innerBuilder;lineBreak;currentVolume;inputs;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.inputs=eG(s.inputs);let r=uw(this.inputs);this.lineBreak=r.lineBreak,this.currentVolume=0,this.processRetrieved()}get base(){return this.innerBuilder.container}readTrade(e){return{isTrade:!0,time:this.base.getData(aa.DateTime)[e],tradeSize:this.base.getData(aa.Volume)[e],tradePrice:this.base.getData(aa.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,i,s){let r=this.findOpen(i,0,1);this.currentVolume+=s,null!==r?(super.updateLastBar(void 0,void 0,i,void 0),this.container.setLastDataPoint(aa.Open,r),this.container.setLastDataPoint(aa.Low,Math.min(r,i)),this.container.setLastDataPoint(aa.High,Math.max(r,i))):this.resetProjection()}resetProjection(){let e=this.container;e.setLastDataPoint(aa.High,null),e.setLastDataPoint(aa.Low,null),e.setLastDataPoint(aa.Open,null),e.setLastDataPoint(aa.Close,null),e.setLastDataPoint(aa.Change,null)}isProjection(e){return this.agg.isIntraday||this.durationAdd(e).getTime()>Date.now()}updateProjection(e,t){this.container.setLastDataPoint(aa.DateTime,t.nextTimestamp);let i=this.changeLastBar(e,t);return i.timeCorrection={from:t.lastTimestamp,to:t.nextTimestamp},i}addBar(e,t){let i=this.container,{nextTimestamp:s}=t;if(1===i.getLastDataPoint(aa.Projection)){let s=i.getLastDataPoint(aa.Close);if(null===this.findOpen(s,this.lineBreak,1))return this.updateProjection(e,t);i.setLastDataPoint(aa.Projection,0),i.setLastDataPoint(aa.Volume,this.currentVolume),this.currentVolume=0}return!this.isProjection(s)&&this.insertBar(e,s)||this.addProjection(e,s)?{isUpdate:!1,time:s.getTime(),index:this.container.size-1}:null}insertBar(e,t){this.currentVolume+=e.tradeSize;let i=e.tradePrice,s=this.findOpen(i,this.lineBreak);return null!==s&&(this.createBar(s,Math.max(s,i),Math.min(s,i),i,this.currentVolume,t),this.container.addDataPoint(aa.Projection,0),this.currentVolume=0,!0)}addProjection(e,t){this.currentVolume+=e.tradeSize;let i=e.tradePrice,s=this.findOpen(i,0);return null!==s&&(this.createBar(s,Math.max(s,i),Math.min(s,i),i,0,t),this.container.addDataPoint(aa.Projection,1),!0)}findOpen(e,t,i=0){if(!eH(e))return null;let s=this.container,r=s.size-1-i,n=s.getData(aa.Close)[r],a=s.getData(aa.Open)[r];if(n>a){if(e<=n){if(e>=a)return null;for(let i=0;i<Math.min(s.size,t);i++)if(e>=s.getData(aa.Low)[r-i])return null;return a}return n}if(e>=n){if(e<=a)return null;for(let i=0;i<Math.min(s.size,t);i++)if(e<=s.getData(aa.High)[r-i])return null;return a}return n}startLine(e){this.container.addDataPoint(aa.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)}}let uN=tG.RENKO_KAGI_NAMES;function uV(e){switch(e){case tG.BARKIND_O:case tG.BARKIND_XO:return!0;default:return!1}}function uH(e){switch(e){case tG.BARKIND_X:case tG.BARKIND_OX:return!0;default:return!1}}function uF(e){let t=ej(e),{Source:i,BoxSizeMethod:s,Period:r}=t,{ReversalAmount:n,BoxSize:a,OneStepBack:o}=t,l=eU(i,[uN.CLS,uN.HL],uN.CLS),u=eU(s,[uN.ATR,uN.TRD],uN.ATR),h=Number.isFinite(r)?a:14,c=Number.isFinite(n)?n:3;return{method:u,period:h,source:l,boxSize:Number.isFinite(a)?a:20,reversal:c,oneStepBack:"Yes"===o}}class uk extends lX{innerBuilder;inputs;boxSize;reversal;source;firstTrend;oneStepBack;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=eG(i.inputs),this.boxSize=this.reversal=this.source=this.firstTrend=this.oneStepBack=null,this.processRetrieved()}get base(){return this.innerBuilder.container}_at(e,t,i){return e.getData(t)[i]}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,i){let s=Math.abs(t-e);return e+i*this.roundToBox(s)}get closeBased(){return this.source===uN.CLS}get currentKind(){return this.getLast(aa.BARKIND)}getTrendField(e){return this.closeBased?aa.Close:e?aa.Low:aa.High}getTrendPrice(e,t){return this.closeBased?e.tradePrice:t?e._lowPrice:e._highPrice}changeLastBar(e,t){let i=uV(this.currentKind),s=i?-1:1,r=this.getLast(this.getTrendField(i)),n=this.getTrendPrice(e,i);return e.tradePrice=this.roundedDiff(r,n,s),super.changeLastBar(e,t),null}addBar(e,t){let i=0===this.container.size,s=uV(this.currentKind),r=s?1:-1,n=i?null:this.getLast(aa.Close),a=this.getTrendPrice(e,!s);if(e.tradePrice=(i?this.roundToBox(this.baseAt(aa.Open,0)):n)+r*(i?0:this.boxSize),super.addBar(e,t),!i){let e=this.roundedDiff(n,a,r);this.updateLastBar(e,e,e)}return this.container.addDataPoint(aa.BARKIND,null),this.computeBarColor(),null}inplaceReverse(){let e=uV(this.currentKind)?tG.BARKIND_OX:tG.BARKIND_XO;this.setLast(aa.BARKIND,e)}canInplaceReverse(){return!function(e){switch(e){case tG.BARKIND_OX:case tG.BARKIND_XO:return!0;default:return!1}}(this.currentKind)&&this.getLast(aa.High)===this.getLast(aa.Low)}isUpdate(e,t,i,s){let r=uV(this.currentKind),n=this.getTrendPrice(s,r),a=this.getTrendPrice(s,!r),o=n-this.getLast(aa.Close),l=o>=0,u=Math.abs(o)>=this.boxSize,h=a-this.getLast(aa.Close),c=h>=0,d=Math.abs(h)>=this.reversal*this.boxSize;if(r){if(!l&&u)return!0;if(c&&d)if(!this.oneStepBack||!this.canInplaceReverse())return!1;else return this.inplaceReverse(),!0;return null}if(l&&u)return!0;if(!c&&d)if(!this.oneStepBack||!this.canInplaceReverse())return!1;else return this.inplaceReverse(),!0;return null}findFirstDiffLargerThanBox(e,t){let i=this.baseAt(aa.Open,0),s=this.innerBuilder.container.size;for(let r=1;r<s;++r){let s=this.baseAt(e,r)-i;if(Math.abs(s)>this.boxSize){if(1===t&&s>0)return[r,tG.BARKIND_X];if(2===t&&s<0)return[r,tG.BARKIND_O];if(3===t)return[r,s>0?tG.BARKIND_X:tG.BARKIND_O]}}return[null,null]}findFirstBarTrend(){if(this.innerBuilder.container.size<2)return null;if(this.closeBased){let[,e]=this.findFirstDiffLargerThanBox(aa.Close,3);return e}{let[e,t]=this.findFirstDiffLargerThanBox(aa.High,1),[i,s]=this.findFirstDiffLargerThanBox(aa.Low,2);return null===t&&null===s?null:null===s?t:null===t?s:e<i?t:s}}computeBarColor(){let e=this.container.size,t=this.firstTrend;e>1&&(t=uV(this.dataAt(aa.BARKIND,e-2))?tG.BARKIND_X:tG.BARKIND_O),this.setLast(aa.BARKIND,t)}process(e){return(this.isProcessingRetrieved||this.innerBuilder.process(e),null===this.firstTrend)?null:super.process(e)}processRetrieved(){let{method:e,period:t,reversal:i,source:s,boxSize:r,oneStepBack:n}=uF(this.inputs);if((this.reversal=i,this.source=s,e===uN.ATR?this.boxSize=l5(this.base,t):this.boxSize=r,eH(this.reversal,this.boxSize))&&(this.oneStepBack=n&&1===this.reversal,this.container.clear(),this.firstTrend=this.findFirstBarTrend(),null!==this.firstTrend)){this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.baseAt(aa.DateTime,e),tradePrice:this.baseAt(aa.Close,e),_highPrice:this.baseAt(aa.High,e),_lowPrice:this.baseAt(aa.Low,e),tradeSize:this.baseAt(aa.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}let uB=new nP($.Intraday,0);class uU{query;container;canLoadMoreData;alignToQuote;record;isLoading;serverComputedSeries;builder;retriever;streamingSubscription;constructor(e){this.query=e,this.canLoadMoreData=!0,this.alignToQuote=!1,this.isLoading=!1,this.container=null,this.canLoadMoreData=!0,this.alignToQuote=!1,this.record=new ad(e.symbol)}getHasVisible(e){return null!=this.query.visibleRange&&null!=this.query.visibleRange[e]}get hasVisibleFrom(){return this.getHasVisible("from")}get hasVisibleTo(){return this.getHasVisible("to")}refresh(){this.query.aggregation.isEndOfDay?this.alignToQuote=!0:this.loadMoreData(!1)}makeInnerBuilder(e){let t=this.query.aggregation;if(!t.isTick)return new lX(e,t);switch(t.spec){case G.None:case G.PerSeconds:case G.PerCount:case G.PerVolume:return new lq(e);default:throw Error(`Custom tick aggregation ${t.describe()} has not been implemented yet`)}}makeBuilder(e){let t=this.makeInnerBuilder(e),i=this.query.aggregation,s=(e,t=[])=>new lJ(un(this.query.symbol,e).concat(t));switch(this.query.curveStyle){case W.Renko:return new l9(t,this.query);case W.Kagi:return new uD(t,s(uB,[aa.BARCOLIX]),this.query);case W.PointAndFigure:return new uk(t,s(uB,[aa.BARKIND]),this.query);case W.LineBreak:return new uR(t,s(i,[aa.Projection]),i,this.query)}if(i.isIntraday&&i.spec===G.PerRange)return new uM(t,s(uB,[aa.Projection]),i,this.query.symbol);if(i.isTick)switch(i.spec){case G.PerSeconds:return new uv(t,s(uB),i);case G.PerCount:return new uC(t,this,s(uB,[uP]),i);case G.PerVolume:return new u_(t,this,s(uB,[uE]),i)}return i.unit===$.Day&&i.size>1?new lZ(t,s(i),i):t}onStreamingUpdates(e){this.isLoading||e.map(e=>{if("isTrade"in e)return this.builder.process(e);if("isQuote"in e&&(eR(ao.TS_QUOTEMARKER,{series:this}),this.alignToQuote)){let t=this.builder.alignToQuote(e);return this.alignToQuote=!1,t}return null}).filter(e=>eH(e)).filter((e,t,i)=>{if(0===t)return!0;let s=i[t-1];return s.isUpdate!==e.isUpdate||s.time!==e.time||e.timeCorrection}).forEach(e=>{if(-1===e.index)eR(ao.TS_MANYCHANGED,{series:this,part:er.Unspecified});else{let t={series:this,index:e.index};eR(e.isUpdate?ao.TS_DATAPOINTCHANGED:ao.TS_DATAPOINTADDED,t)}e.timeCorrection&&eR(ao.TS_TIMELINECORRECTION,{...e.timeCorrection,series:this})})}get hasData(){return null!==this.container}getRetriever(){return tv(this.query.symbol)&&this.query.aggregation.isEndOfDay?new uc:new uu}getStreamingSubscription(){return y0().getRecordSource().subject.pipe(uf(e=>{let t=this.query.aggregation.isEndOfDay,i=aC(ao.RT_TRADE,this.record.symbol),s=e=>"T"!==e.data.session||this.query.extendedHours&&!t,r=e.filter(i).filter(e=>eH(e.data.time)).filter(s).map(e=>({isTrade:!0,tradePrice:e.data.tradePrice,tradeSize:e.data.tradeSize,time:e.data.time,tradingDay:e.data.tradingDay})).reduce((e,t)=>{let i=eb(e);return eH(i)&&eH(i.tradePrice)&&eH(t.tradePrice)&&i.tradePrice===t.tradePrice&&i.time.getTime()===t.time.getTime()&&i.tradingDay===t.tradingDay?i.tradeSize+=t.tradeSize:e.push(Object.assign({},t)),e},[]),n=aC(ao.RT_QUOTE,this.record.symbol);return r.concat(e.filter(n).map(e=>({isQuote:!0,openPrice:e.data.openPrice,highPrice:e.data.highPrice,lowPrice:e.data.lowPrice,lastPrice:e.data.lastPrice,time:e.data.tradeTime})))}),oc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async loadMoreData(e=!0){if(this.isLoading||!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();eH(e.offset)&&0!==e.offset&&(t=tr(t,-e.offset)),e.range=[t,null];let i=await this.retriever.retrieve(e),s=this.container.size;this.builder.append(i);let r=this.container.size-s;eR(ao.TS_MANYCHANGED,{series:this,part:er.Tail,count:r,index:s})}async loadHeadChunk(){let e=!1,t=null;for(let i=0;i<this.builder.retryCountForChunk&&!e;++i){let s=this.query.duplicate(),r=this.builder.getFirstDate(i);eH(s.offset)&&0!==s.offset&&(r=tr(r,-s.offset)),s.range=[null,r],e=(t=await this.retriever.retrieve(s)).size>1}this.canLoadMoreData=e,e&&null!==t&&(this.builder.prepend(t),eR(ao.TS_MANYCHANGED,{series:this,part:er.Head}))}async applyNearbyFixup(e){let t=this.query.aggregation,i=t.spec===G.Nearest,s=this.query.symbol,r=tg(s);return r&&t.isMultiContract&&i&&!(e.size<1)&&!this.serverComputedSeries?e.getLastDataPoint(aa.Symbol):r&&tC(s)?await tf(s):s}async ready(){return tU.call(this,async()=>{this.retriever=this.getRetriever();let e=await this.retriever.retrieve(this.query),t=await this.applyNearbyFixup(e);return this.hasVisibleTo||(this.record=y0().getRecordSource().getRecord(t)),this.canLoadMoreData=!this.hasVisibleFrom&&e.size>0,this.builder=this.makeBuilder(e),await this.builder.ready(),this.container=this.builder.container,this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0})}getCacheableEntities(e){e.add(this)}shutdown(){eH(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class uW{query;container;_pretendEmpty;constructor(e,t=!1){this._pretendEmpty=t,this.query=e,this.container=new lQ}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(){}}class u${query;container;canLoadMoreData=!1;isLoading=!1;constructor(e,t){this.query=e,this.container=t}get hasData(){return null!==this.container}loadMoreData(e){throw Error("Should not be called.")}refresh(){}async ready(){return!0}getCacheableEntities(e){}shutdown(){}}class uG{query;container;supplyCustomDemoData;canLoadMoreData;isLoading;constructor(e){this.query=e,this.canLoadMoreData=!0,this.isLoading=!0,this.container=null,this.supplyCustomDemoData="DemoSite"===y0().config.mode}refresh(){}loadMoreData(e){throw Error("Should not be called.")}get hasData(){return null!==this.container}shutdown(){}parseEvents(e){let t=new lJ([aa.DateTime,aa.Dividends,aa.Earnings,aa.Splits,aa.Custom]),i=e.split("\n"),s=(e,i,s,r)=>{t.addDataPoint(e,i===s?r:null)};return i.forEach(e=>{if(""===e.trim())return;let i=e.split(",");if(4!==i.length)return;let r=lY(i[1]);t.addDataPoint(aa.DateTime,r),s(aa.Dividends,"Dividend",i[2],i[3]),s(aa.Earnings,"Earnings",i[2],i[3]),s(aa.Splits,"Split",i[2],i[3]),this.supplyCustomDemoData?s(aa.Custom,"Custom","Custom",tG.FAKE_CUSTOM_EVENT):s(aa.Custom,"Custom",i[2],i[3])}),t}makeUrl(){let e={};e.symbols=this.query.symbol,e.start="19700102",e.end="20501230",tG.EVENTS_BUILT_IN.forEach(t=>e[t]=this.query[t]);let t=eq(e);return`/queryevents.ashx?${t}`}async retrieve(){let e=this.makeUrl(),t=await yX("timeseries",e);return this.parseEvents(t)}async ready(){return tU.call(this,async()=>(this.container=await this.retrieve(),this.isLoading=this.canLoadMoreData=!1,!0))}getCacheableEntities(e){e.add(this)}}class uz{query;container;canLoadMoreData;isLoading;constructor(e){this.query=e,this.canLoadMoreData=!1,this.isLoading=!0,this.query=e,this.container=null}get hasData(){return null!==this.container}refresh(){}loadMoreData(e){throw Error("Should not be called.")}shutdown(){}parseFundamental(e){let t=JSON.parse(e),i=t.status.code,s=204===i;if(200!==i&&!s)return null;let r=new lJ(this.query.fields.concat(aa.DateTime));if(s)return r;let n=this.query.fields[0],a=n.id.substring(0,1).toLowerCase()+n.id.substring(1);return t.results.reverse().forEach(e=>{r.addDataPoint(aa.DateTime,lY(e.date)),r.addDataPoint(n,parseFloat(e[a]))}),this.isLoading=!1,r}makeUrl(){let e={count:0,rawData:1};e.symbols=this.query.symbol,e.frequency=this.query.aggregation.unit===$.Quarter?"Quarter":"Annual";let t=eq(e),i=this.query.seriesKind===Z.BalanceSheet?"getBalanceSheets":"getIncomeStatements";return`/${i}.json?${t}`}async retrieve(){let e=this.makeUrl(),t=await yX("ondemand",e);return this.parseFundamental(t)}async ready(){return tU.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}function uY(e,t){let i=e.findIndex(e=>e>t);return Math.max(i<0?e.length:i,0)}class uj{records;streamingSubscription;setSymbols(e){let t=y0().getRecordSource();this.records=e.reduce((e,i)=>{let s=t.getRecord(i);return this.addFieldsToRecord(s,i),e[i]=s,e},{})}getStreamingSubscription(){return y0().getRecordSource().subject.pipe(oc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}onStreamingUpdates(e){e.forEach(e=>{let t=e.data,i=this.records[t.symbol];eH(i)&&this.process(i)}),this.notifyAboutUpdates()}async retrieve(){let e=Object.values(this.records);return(await Promise.all(e.map(e=>e.ready()))).every(ed)&&(this.onRecordsReady(),e.forEach(e=>this.process(e)),this.streamingSubscription=this.getStreamingSubscription()),this.hasData}async ready(){return tU.call(this,async()=>await this.retrieve())}shutdown(){eH(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class uK extends uj{symbols=[];constructor(e){super(),this.symbols=e,this.setSymbols(e)}addFieldsToRecord(e,t){e.addFields(aa.Symbol),e.update(aa.Symbol,t)}notifyAboutUpdates(){eR(ao.RT_QUOTEGROUP,{source:this})}process(e){}onRecordsReady(){}get hasData(){return!0}getValue(e){let t=this.records[e];return void 0===t?null:t.getValue(aa.Close)}}class uq extends uj{query;dataPoints;container;fields;canLoadMoreData=!1;isLoading=!1;constructor(e){super(),this.query=e,this.setSymbols(e.symbols),this.dataPoints=e.symbols.length,this.container=null,this.fields=[aa.DateTime,aa.Close,aa.Symbol]}addFieldsToRecord(e,t){e.addFields(aa.DateTime,aa.Symbol),e.update(aa.DateTime,tL(t)),e.update(aa.Symbol,t)}refresh(){}loadMoreData(e){throw Error("Should not be called.")}get hasData(){return null!==this.container&&this.container.size===this.dataPoints}notifyAboutUpdates(){eR(ao.TS_MANYCHANGED,{series:this,part:er.Unspecified})}onRecordsReady(){this.container=new lJ(this.fields)}findOrAddIndex(e){let t=this.container.getData(aa.Symbol).indexOf(e.symbol);return t<0&&(t=uY(this.container.getData(aa.DateTime),tL(e.symbol)),this.fields.forEach(e=>this.container.getData(e).splice(t,0,null))),t}process(e){let t=this.fields.map(t=>{let i=e.getValue(t);return"Close"!==t.id?i:e.getValue(aa.Last)??i});if(!eg(t))return;let i=this.findOrAddIndex(e);this.fields.forEach((e,s)=>this.container.getData(e)[i]=t[s])}getCacheableEntities(e){e.add(this)}}class uX{query;container;fields;canLoadMoreData=!1;isLoading=!1;constructor(e){this.query=e,this.fields=[aa.DateTime,aa.Close,aa.Symbol],this.container=null}get hasData(){return null!==this.container}refresh(){}loadMoreData(e){throw Error("Should not be called.")}shutdown(){}insertValues(e,t,i){let s=(t,i,s)=>e.getData(i).splice(t,0,s),r=e.getData(aa.DateTime),n=tL(t),a=uY(r,n);s(a,aa.DateTime,n),s(a,aa.Close,i),s(a,aa.Symbol,t)}parseHistoricalForward(e){let t=new lJ(this.fields);return e.split("\n").filter(e=>e.trim().length>0).forEach(e=>{let i=e.split(","),s=i[0];this.insertValues(t,s,parseFloat(i[5]))}),t}makeUrl(){let e={};e.symbols=this.query.symbols.join(","),e.maxrecords=1,e.data="daily",e.end=ec(um(this.query.offset),lw(tG.FMT_HIST_FEED_PARAM_DATE_ONLY))(new Date);let t=eq(e);return`/querylatesteod.ashx?${t}`}async retrieve(){let e=this.makeUrl(),t=await yX("timeseries",e);return this.parseHistoricalForward(t)}async ready(){return tU.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}class uZ extends uU{constructor(e){super(e)}getRetriever(){return new up}onStreamingUpdates(e){}}class uJ{cacheSeries;seriesCache;constructor(e=!1){this.cacheSeries=e,this.seriesCache=new Map}getTimeSeries(e){return eH(e.symbol)&&e.symbol===tG.PLACEHOLDER_SYMBOL_NAME?new uW(e):this.getSeries(e)}evictUnused(e){for(let[t,i]of this.seriesCache)!e.has(i)&&i.isCached&&(i.isCached=!1,i.shutdown(),this.seriesCache.delete(t))}refresh(){for(let e of this.seriesCache.values())"function"==typeof e.refresh&&e.refresh()}getSeries(e){let t=(e.cacheMe||this.cacheSeries)&&!e?.alwaysUseBarsToFetch,i=e.getHashKey();if(t&&this.seriesCache.has(i))return this.seriesCache.get(i);{let s=this.makeSeries(e);return s.isCached=t,t&&this.seriesCache.set(i,s),s}}makeSeries(e){switch(e.seriesKind){case Z.Normal:return new uU(e);case Z.BalanceSheet:case Z.IncomeStatement:return new uz(e);case Z.Events:return new uG(e);case Z.Forward:return new uq(e);case Z.HistoricalForward:return new uX(e);default:case Z.Options:return new uZ(e);case Z.Study:throw Error(`The series kind '${Z[e.seriesKind]}' is not supported yet.`)}}}var uQ={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},u0={date:oN({formats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:oN({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:oN({formats:{full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},u1={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},u2={code:"fr",formatDistance:function(e,t,i){var s,r=uQ[e];if(s="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",String(t)),null!=i&&i.addSuffix)if(i.comparison&&i.comparison>0)return"dans "+s;else return"il y a "+s;return s},formatLong:u0,formatRelative:function(e,t,i,s){return u1[e]},localize:{ordinalNumber:function(e,t){var i,s=Number(e),r=null==t?void 0:t.unit;return 0===s?"0":(i=1===s?r&&["year","week","hour","minute","second"].includes(r)?"ère":"er":"ème",s+i)},era:oF({values:{narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},defaultWidth:"wide"}),quarter:oF({values:{narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:oF({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},defaultWidth:"wide"}),day:oF({values:{narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},defaultWidth:"wide"}),dayPeriod:oF({values:{narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},defaultWidth:"wide"})},match:{ordinalNumber:oB({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e)}}),era:ok({matchPatterns:{narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^av/i,/^ap/i]},defaultParseWidth:"any"}),quarter:ok({matchPatterns:{narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:ok({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/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,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:ok({matchPatterns:{narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ok({matchPatterns:{narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:4}};function u3(e){return te(1,arguments),ti(e).getDay()}function u4(e){te(1,arguments);var t=ti(e);return t.setMinutes(0,0,0),t}function u5(e,t){te(2,arguments);var i=u4(e),s=u4(t);return i.getTime()===s.getTime()}function u6(e){te(1,arguments);var t=ti(e);return t.setSeconds(0,0),t}let u7=/{value:([^}]+)}/,u8=/%([aAdewbBmyYHkIlMpPSL])+/g;var u9=((O=u9||{})[O.Second=0]="Second",O[O.Minute=1]="Minute",O[O.Hour=2]="Hour",O[O.Day=3]="Day",O[O.Week=4]="Week",O[O.Month=5]="Month",O[O.Year=6]="Year",O);let he={Second:{Period:"PT1S",Multipliers:[.01,.02,.05,.1,.2,.5,1,2,5,10,15,30]},Minute:{Period:"PT1M",Multipliers:[1,2,5,10,15,30]},Hour:{Period:"PT1H",Multipliers:[1,2,3,4,6,8,12]},Day:{Period:"P1D",Multipliers:[1,2]},Week:{Period:"P1W",Multipliers:[1,2]},Month:{Period:"P1M",Multipliers:[1,2,3,4,6]},Year:{Period:"P1Y",Multipliers:[1,2,5,10,25,50,100,250]}},ht=new Map;function hi(e){if(!eH(e))return null;if(!ht.has(e)){var t;let i=eH(t=e)?t.replace(u7,(e,t)=>t.replace(u8,(e,t)=>tG.PHP_TO_UNICODE_TS_35_MAP[t])):t;ht.set(e,i)}return ht.get(e)}class hs{barWidth;unitWidth;minTickInterval;duration;format;prevDate;size;constructor({barWidth:e,unitWidth:t,formatString:i,minTickInterval:s,duration:r},n){this.size=n,this.barWidth=e,this.unitWidth=t,this.minTickInterval=s,this.duration=r,this.format=hi(i),this.prevDate=null}get noPrevDate(){return!eH(this.prevDate)}formatDate(e,t){return hS(e,this.format||t)}asTick(e,t,i){return this.prevDate=e,{date:e,priority:t,text:this.formatDate(e,i)}}checkPrev(e){return!!this.noPrevDate&&(this.prevDate=e,!0)}}let hr="yyyy",hn="LLL ''yy",ha=()=>"fr"===hA()?"d LLL":"LLL d",ho="HH:mm";class hl extends hs{repeatEach;repeatCounter;constructor(e){super(e),this.repeatEach=tG.TIME_SCALE_MAX_SPACE_NO_TICKS/this.barWidth,this.repeatCounter=0}asTick(e,t,i){return this.repeatCounter=0,super.asTick(e,t,i)}getTick(e){if(!nl(this.prevDate,e))return this.asTick(e,1,"EEE");if(!u5(this.prevDate,e))return this.asTick(e,2,ho);this.repeatCounter++;let t=this.repeatCounter===this.repeatEach;return!function(e,t){te(2,arguments);var i=u6(e),s=u6(t);return i.getTime()===s.getTime()}(this.prevDate,e)||t?this.asTick(e,t?4:3,ho):null}}class hu extends hs{getTick(e){let t=this.checkPrev(e),i=0===this.minTickInterval||0==(e=>{let t=to(e);return uA(e,t)})(e)%(this.minTickInterval/1e3),s=!nl(this.prevDate,e),r=function(e){return te(1,arguments),ti(e).getMinutes()}(e),n=!u5(this.prevDate,e)||t&&0===r;if(i){if(s)return this.asTick(e,1,ha());if(n)return this.asTick(e,2,ho);if(0==r%30&&this.size<15)return this.asTick(e,3,ho);if(0==r%15&&this.size<=5)return this.asTick(e,4,ho)}return null}}class hh extends hs{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<22*he.Day.One,this.monthYear=this.duration>22*he.Day.One&&this.duration<7*he.Month.One,this.year=this.duration>7*he.Month.One}useTuesday(e){return!!this.noPrevDate||2===u3(e)&&ug(e,this.prevDate)>1728e5}getTick(e){this.checkPrev(e);let t=!nu(e,this.prevDate),i=!nm(e,this.prevDate);return this.monthDay?1===u3(e)||this.useTuesday(e)?this.asTick(e,1,ha()):null:this.monthYear?t?this.asTick(e,1,hn):null:this.year&&i?this.asTick(e,1,hr):null}}class hc extends hs{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<4*he.Week.One,this.monthYear=this.duration>4*he.Week.One&&this.duration<6*he.Month.One,this.year=this.duration>6*he.Month.One}getTick(e){this.checkPrev(e);let t=!nu(e,this.prevDate),i=!nm(e,this.prevDate);return this.monthDay?this.asTick(e,1,ha()):this.monthYear?t?this.asTick(e,1,hn):null:this.year&&i?this.asTick(e,1,hr):null}}class hd extends hs{showMonths;constructor(e){super(e),this.showMonths=this.duration<7*he.Month.One}getTick(e){this.checkPrev(e);let t=!nm(e,this.prevDate);return this.showMonths?this.asTick(e,1,hn):t?this.asTick(e,1,hr):null}}class hp extends hs{constructor(e){super(e)}getTick(e){return this.checkPrev(e),nm(e,this.prevDate)?null:this.asTick(e,1,hr)}}function hf(e){return((e.valueOf()-tG.OPTIONS_DATA_BASE)/tG.OPTIONS_DATA_INCREMENT).toString()}function hm(e){return eH(e)?`${e.toFixed(2)}%`:""}function hg(e,t,i=!1){let s=e.plots[0],r=s.curves[0],n=eH(r)&&r.fields.length>0?r.fields[0]:null;if(!eH(n))return"";let a={range:e.fullDomain,allDigits:!1,forceTrailingZeros:i};return hk(s,e.pane.presenter,a),s.metaData.format(t,n,a)}function hy(e,t,i=!1){return e.comparison===K.Percent?hm(t):hg(e,t,i)}function hT(e,t,i){let s=e.view?.xAxis?.overrideFormatter;if(s)return s(t);if(eH(e.display.xAxis.isOrdinal))return hf(t);let r=i||e.display.xAxis.format;if(eH(r))return hS(t,hi(r));let n=e.data.aggregation,a=e.display?.xAxis?.nonEodLabelWithDate??!1;return n.isEndOfDay?hv(n,t):hb(n,t,a)}function hA(){let e=e$(y0().config,null,"overrides","xAxis","getLocaleName");if(eH(e)&&"function"==typeof e)try{return e()}catch(e){yK(`Failed retrieving the locale name, error is ${e.message}`,"warn")}}function hS(e,t){return oj(e,t,"fr"===hA()?{locale:u2}:void 0)}function hv(e,t){if(!op(t))return"";switch(e.unit){case $.Tick:case $.Intraday:case $.Day:case $.Week:default:return hS(t,"P");case $.Month:return hS(t,"LLL yyyy");case $.Quarter:return hS(t,"qqq yyyy");case $.Year:return hS(t,"yyyy")}}function hb(e,t,i){return op(t)?hS(t,`${i?"P ":""} ${e.isTick?"pp":"p"}`):""}let hP=(e,t)=>e.at(t);class hC{presenter;_dates;pendingRebuild;constructor(e){this.presenter=e,this._dates=[],this.pendingRebuild=!1,this._dates=[],this.invalidate()}checkRebuild(){this.pendingRebuild&&this.rebuild()}get withPrologLength(){return this.checkRebuild(),this._dates.length+tG.TIMELINE_PROLOG_PADDING_BARS}get withPrologEpilogLength(){return this.withPrologLength+tG.TIMELINE_EPILOG_PADDING_BARS}get firstSeriesIndex(){return tG.TIMELINE_PROLOG_PADDING_BARS}get lastSeriesIndex(){return this.checkRebuild(),0===this._dates.length?0:this.withPrologLength-1}get withoutPrologEpilogLength(){return this.checkRebuild(),this._dates.length}at(e){if(this.checkRebuild(),e<0||e>=this.withPrologEpilogLength)return null;if(e<tG.TIMELINE_PROLOG_PADDING_BARS){let t=eP(this._dates),i=e-tG.TIMELINE_PROLOG_PADDING_BARS;return this.applyDateShift(t,i)}if(e>=this.withPrologLength){let t=eb(this._dates),i=e-this.withPrologLength+1;return this.applyDateShift(t,i)}return this._dates[e-tG.TIMELINE_PROLOG_PADDING_BARS]}get length(){return this.checkRebuild(),this._dates.length>0?this.withPrologEpilogLength:0}slice(e,t){this.checkRebuild();let i=[];for(let s=e;s<t;++s)i.push(this.at(s));return i}tryToCorrectLastBar(e,t,i=!0){i&&this.checkRebuild();let s=+e,r=e_(this._dates,s,Number),n=+this._dates[r];return r===this._dates.length-1&&n===s&&(this._dates[r]=t,!0)}mergeDateIntoTimeline(e,t=!0){t&&this.checkRebuild();let i=+e,s=e_(this._dates,i,Number),r=+this._dates[s];if(r!==i){let t=s+ +(i>r);return this._dates.splice(t,0,e),t+this.firstSeriesIndex}return -1}invalidate(){this._dates.length=0,this.pendingRebuild=!0}rebuild(){if(this.presenter.isEmpty)return;let e=this.presenter.mainPlot.timeSeries;if(!e.hasData)return;let t=e.container.getTimeData();for(let e=t.length-1;e>=0;e--)this._dates[e]=t[e];this.presenter.allPlots.forEach(t=>{t.timeSeries!==e&&t.timeSeries.hasData&&t.timeSeries.container.getTimeData().forEach(e=>this.mergeDateIntoTimeline(e,!1))}),this.pendingRebuild=!1}applyDateShift(e,t){let{unit:i,size:s}=this.presenter.data.aggregation;switch(i){case $.Year:return ts(e,12*t);case $.Quarter:return ts(e,3*t);case $.Month:return ts(e,t);case $.Week:return lO(e,7*t);case $.Day:return lO(e,t);case $.Intraday:return of(e,s*t*tG.ONE_MINUTE_MILLIS);case $.Tick:return of(e,1e3*t)}}}let hE={delete:'<path d="M225.8 286.2l225.8 225.8-225.8 225.8c-16.7 16.7-16.7 43.7 0.0 60.3s43.7 16.7 60.3 0.0l225.8-225.8 225.8 225.8c16.7 16.7 43.7 16.7 60.3 0.0s16.7-43.7 0.0-60.3l-225.8-225.8 225.8-225.8c16.7-16.7 16.7-43.7 0.0-60.3s-43.7-16.7-60.3 0.0l-225.8 225.8-225.8-225.8c-16.7-16.7-43.7-16.7-60.3 0.0s-16.7 43.7 0.0 60.3z"></path>',circle:'<circle cx="512" cy="512" r="512"/>',rectangle:'<rect width="1024" height="1024"/>',chevronUp:'<path d="M798.2 609.8l-256.0-256.0c-16.7-16.7-43.7-16.7-60.3 0.0l-256.0 256.0c-16.7 16.7-16.7 43.7 0.0 60.3s43.7 16.7 60.3 0.0l225.8-225.8 225.8 225.8c16.7 16.7 43.7 16.7 60.3 0.0s16.7-43.7 0.0-60.3z"></path>',chevronDown:'<path d="M225.8 414.2l256.0 256.0c16.7 16.7 43.7 16.7 60.3 0.0l256.0-256.0c16.7-16.7 16.7-43.7 0.0-60.3s-43.7-16.7-60.3 0.0l-225.8 225.8-225.8-225.8c-16.7-16.7-43.7-16.7-60.3 0.0s-16.7 43.7 0.0 60.3z"></path>',eye:'<path d="M950.9 411.4q-86.9 134.9-217.7 201.7 34.9-59.4 34.9-128.6 0.0-105.7-75.1-180.9t-180.9-75.1-180.9 75.1-75.1 180.9q0.0 69.1 34.9 128.6-130.9-66.9-217.7-201.7 76.0-117.1 190.6-186.6t248.3-69.4 248.3 69.4 190.6 186.6zM539.4 630.9q0.0 11.4-8.0 19.4t-19.4 8.0q-71.4 0.0-122.6-51.1t-51.1-122.6q0.0-11.4 8.0-19.4t19.4-8.0 19.4 8.0 8.0 19.4q0.0 49.1 34.9 84.0t84.0 34.9q11.4 0.0 19.4 8.0t8.0 19.4zM1024.0 411.4q0.0-19.4-11.4-39.4-80.0-131.4-215.1-210.6t-285.4-79.1-285.4 79.4-215.1 210.3q-11.4 20.0-11.4 39.4t11.4 39.4q80.0 130.9 215.1 210.3t285.4 79.4 285.4-79.4 215.1-210.3q11.4-20.0 11.4-39.4z"></path>',eyeSlash:'<path d="M317.1 197.1l44.6 80.6q-49.7 36.0-77.7 90.9t-28.0 116.0q0.0 69.1 34.9 128.6-130.9-66.9-217.7-201.7 95.4-147.4 244.0-214.3zM539.4 630.9q0.0 11.4-8.0 19.4t-19.4 8.0q-71.4 0.0-122.6-51.1t-51.1-122.6q0.0-11.4 8.0-19.4t19.4-8.0 19.4 8.0 8.0 19.4q0.0 49.1 34.9 84.0t84.0 34.9q11.4 0.0 19.4 8.0t8.0 19.4zM746.9 740.0q0.0-4.0-0.6-5.1-60.0-107.4-180.0-323.4t-180.6-324.0l-28.0-50.9q-5.7-9.1-16.0-9.1-6.9 0.0-76.6 40.0-9.1 5.7-9.1 16.0 0.0 6.9 25.1 49.7-81.7 37.1-150.6 98.9t-119.1 140.0q-11.4 17.7-11.4 39.4t11.4 39.4q87.4 134.3 217.1 212.0t283.4 77.7q50.9 0.0 102.9-9.7l30.9 55.4q5.7 9.1 16.0 9.1 2.9 0.0 10.3-3.4t17.7-8.9 18.9-10.6 18.0-10.6 11.1-6.6q9.1-5.7 9.1-15.4zM768.0 484.6q0.0-79.4-45.1-144.9t-119.4-94.0l160.0 286.9q4.6-25.7 4.6-48.0zM1024.0 411.4q0.0-20.0-11.4-39.4-22.3-36.6-62.3-82.9-85.7-98.3-198.6-152.6t-239.7-54.3l42.3 75.4q121.1 10.3 224.3 78.3t172.3 175.4q-65.7 102.3-161.1 168.0l36.0 64.0q54.3-36.6 104.3-87.4t82.6-105.1q11.4-19.4 11.4-39.4z"></path>',moreActions:'<path d="M597.3 512a85.3 85.3 0 1 0-170.6 0 85.3 85.3 0 0 0 170.6 0zm298.7 0a85.3 85.3 0 1 0-170.7 0 85.3 85.3 0 0 0 170.7 0zm-597.3 0a85.3 85.3 0 1 0-170.7 0 85.3 85.3 0 0 0 170.7 0z"></path>'};function h_(e){return!0===y0().config.useAllFieldsForComparison&&e.mainPlot.mainCurve.isOhlc&&e.mainAxis.comparison===K.None&&e.mainPane.axes.map(e=>e.plots).flat().reduce((e,t)=>e+ +!!t.isSymbol,0)>1}let hM=new nP;function hL({plots:e,isMultiSymbol:t,isMultiContract:i,date:s,time:r,dateFieldName:n,hideSymbols:a,revealingClose:o}){let l=a&&o,u=[hD(n,s,null,"heading"),r?hD("Time",r,null,"heading"):""].concat(e.map(e=>{if(0===e.values.length)return null;let s=(e=>{let s=e.name.startsWith(tG.FAKE_SYMBOL_PREFIX);switch(e.type){case X.Expression:return!0;case X.Symbol:if((t||i)&&!s)return!0;return!a;default:return!1}})(e)?hw(X[e.type],e.name,e.values[0].color):"",r=e.values.map(t=>hD(t.id===aa.Close.id&&l?e.description:t.longName,t.value,t.color));if(e.events&&e.events.length){let t=e.events.map(e=>hw(`${e.field.name} (${hv(hM,e.date)})`,e.value,e.color));r.push(...t)}return r.unshift(s),eH(e.unalignedDate)&&r.unshift(hD("Date",e.unalignedDate,e.values[0].color,"heading")),r}).filter(e=>null!=e).flat()).filter(e=>""!==e).join("");return`<table class="values-table">${u}</table>`}function hx(e){return`bchart-icon-${e}`}function hO(e,t=null,i=10){let s=eH(t)?`style="fill:${t}"`:"",r=hx(e);return`<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="${i}px" height="${i}px" ${s}><use xlink:href="#${r}"></use></svg>`}function hI(e,t){let i=e?"Up":"Down",s=hO(`chevron${i}`);return`<span data-pane="${t}" data-dir="${i}" title="Move ${i}" class="move-pane">${s}</span>`}function hD(e,t,i=null,s=[]){"string"==typeof s&&(s=s.split(" "));let r=["value-row",...s],n="string"==typeof i?` style="color: ${i}"`:"";return`
8
8
  <tr class="${r.join(" ")}">
9
9
  <td class="field-name">${e}</td>
10
10
  <td${n} class="field-value">${t}</td>
11
11
  </tr>
12
- `}function hD(e,t,i=null){return hI(e,t,i,"value-title")}function hw(e,t,i){let s="string"==typeof i?` style="color: ${i}"`:"",r=eH(e)?`<span class="field-name">${e}</span>`:"";return`${r}<span${s} class="field-value">${t}</span>`}function hR(e){return`<a class="delete-plot" data-plot-id="${e}" title="Delete plot">${hx("delete")}</a>`}function hN(e,t,i,s,r,n){let a=function(e,t){let i=e.data.aggregation,s=e.display.xAxis,r=s.isOrdinal,n=eV(r)&&r,a=n?s.ordinalName??"Value":"Date";return{date:n?hp(t):hS(i,t),time:i.isEndOfDay||n?null:hv(i,t,!1),isMultiSymbol:function(e){let t=e.mainPlot.symbol;return e.allPlots.some(e=>e.type===X.Symbol&&e.symbol!==t)}(e),isMultiContract:i.isMultiContract,dateFieldName:a}}(e,t);return a.offset=i,a.lastBarRefresh=!!s,a.chartId=e.elementId,a.panes=e.panes.map(i=>({bounds:hV(i),id:i.id,plots:i.axes.map(e=>e.plots).flat().filter(t=>!r||t===e.mainPlot).map(i=>(function(e,t,i,{isMultiContract:s},r){let n=r.isStudy;if(!r.timeSeries.hasData)return null;let a=r.timeSeries.container;r.type,X.Expression;let o=r.axis.comparison!==K.None,l=r.axis.comparison===K.Percent,u=(e,s)=>r.customPlotValues&&s!==an.DateTime?[r.getValueAt(s,t,i),0]:hH(e,s,t,o),h=n?`${sN(r.model.study).meta.title} ${r.fullParams}`:r.metaData.name||"",c={isMain:r.main,type:r.type,typeName:X[r.type],name:r.title,description:h,exchange:r.metaData.exchange||"",error:r.errorText,id:r.id,visible:r.visible};eH(r.yearOffset)&&0!=r.yearOffset&&(c.unalignedDate=hS(e.data.aggregation,function(e,t){return te(2,arguments),tr(e,-e9(t))}(t,r.yearOffset)));let d=r.curves[0];s&&r.type===X.Symbol&&a.hasField(an.Symbol)&&(t.valueOf()===tG.ZERO_DATE.valueOf()?c.name=r.timeSeries.container?.getLastDataPoint(an.Symbol):c.name=u(d,an.Symbol)[0]);let p={},f={range:r.axis.yScale.domain(),allDigits:!0};hF(r,e,f);let m=(e,t)=>{let i=(t===an.Change||t===an.PercentChange)&&e>0?"+":"";return l?i+hf(e):i+r.metaData.format(e,t,f)},g=hE(e),y=new Set;return c.values=r.curves.filter(e=>e.visible).map(e=>(!r.main&&r.isSymbol&&g?us:e.fields).map(t=>{if(y.has(t))return null;y.add(t);let[i,s]=u(e,t),a=r.axis.yScale.priceToY(i);p[t.id]=!0;let o=r.customPlotValues?r.getColorOf(t):e.getColor(s,e.style!==W.HollowCandles,t),l=m(i,t).trim();if(eH(i)&&t===an.Change){let[t]=u(e,an.PercentChange);eH(t)&&(l+=` (${m(t,an.PercentChange)})`)}return{abbreviation:hk(t),shortName:t.shortName,id:t.id,name:t.name,longName:`${t.shortName} ${n?r.params:""}`.trim(),color:ib(o),val:i,y:a,value:l}}).filter(e=>null!==e)).flat(),c.events=r.findEvents(u(d,an.DateTime)).filter(e=>e.field!==an.Custom),c})(e,t,n,a,i)).filter(e=>null!==e)})),a}function hV(e){let t=e.getBounds();if(!eH(t))return;let{x:i,y:s,width:r,height:n}=t,{leftOffset:a,rightOffset:o}=e.presenter.view;return{top:s,left:i+a,right:o,bottom:s+n,width:r,height:n}}function hH(e,t,i,s=!1){let r=e.plot,n=r.timeSeries.container,a=r.axis.pane.presenter.timeline,o=e_(a,+i,Number,hb),l=a.at(o-e.shift);if(null===l)return[null,0];let u=n.getTimeData(),h=e_(u,+l,Number);return[u[h]&&u[h].getTime()===l.getTime()?e.dataAt(t,h,!s):null,h]}function hF(e,t,i){eH(e.precision)?i.overridePrecision=e.precision:e.isStudy&&eH(t.mainPlot?.precision)&&!eH(sN(e.model.study).meta.decimals)&&(i.overridePrecision=t.mainPlot.precision)}function hk(e){return e.id===an.Change.id?"Δ":e.id.substring(0,1)}class hB{plot;id;fields=[];colors=[];style=W.Line;attributes=[];zones;_shift=0;lineWidth=1;lineMarker;lineSmoothing;dashStyle="Solid";varyColorPerBar=!1;visible=!0;_zoneColors;constructor(){this.id=e0(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=eH(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(an.Close)}get name(){return this.isOhlc?"":this.fields[0].name}get isHeikinAshiStyle(){return this.style===W.HeikinAshi}get isCandle(){return this.style===W.Candlestick||this.style===W.HollowCandles||this.style===W.HeikinAshi}get isHollowCandles(){return this.style===W.HollowCandles}get isElderImpulseSystemStyle(){return this.style===W.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===W.PercentChange}get isOhlcStyle(){return this.style===W.OHLC}get isHlcStyle(){return this.style===W.HLC}get isRangeStyle(){return this.style===W.Range}get isRenko(){return this.style===W.Renko}get isKagi(){return this.style===W.Kagi}get isPointAndFigure(){return this.style===W.PointAndFigure}get isLineBreak(){return this.style===W.LineBreak}get isBaseline(){return this.style===W.Baseline}get isLineLike(){return[W.Line,W.Area,W.Baseline,W.PercentChange].includes(this.style)}get isColumn(){return this.style===W.Column}get isMultiColumn(){return this.style===W.MultiColumn}get isStackedColumn(){return this.style===W.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=>U[e])),this.colors=e.colors,this.fields=e.fields.map(e=>an[e]),this.style=W[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,i=!0){let s=!this.plot.isComparison(K.None),r=e===an.PercentChange,n=e===an.Change,a=r||(!i||s)&&n,o=this.timeSeries.container.hasField(an.Last)?an.Last:an.Close,l=a?o:e,u=(e,t)=>{let i=this.timeSeries.container.getData(e)[t];return e.type!==z.Number?i:this.plot.priceMapper(i,t,e)},h=u(l,t);if(!a)return h;if(t<=1)return 0;let c=u(l,t-1),d=h-c;return r?0===c?0:d/c:d}timeSeriesAt(e){let t=this.timeSeries.container.getTimeData(),i=t.length;return e<0||e>i-1?null:t[e]}timelineAt(e){return this.presenter.timeline.at(e)}get shiftedTimeDomain(){let e=this.view.xAxis.xScale;return eH(e.extent())?0!==this.shift?e.extent().map(t=>e.timeline.at(t-this.shift)):e.domain():null}get yScale(){return this.plot?.yScale??this.axis.yScale}getCore(){let e=this.timeSeries;if(!e.hasData||!this.visible)return null;let t=this.view.xAxis.xScale.extent();if(!eH(t))return null;let i=this.yScale.domain();return eH(i)?{ts:e,extent:t,domain:i,range:this.yScale.range()}:null}drawHover(e,t,i){if(!this.isLineLike||null===this.getCore())return;let[s,r]=hH(this,this.pickMainField(),t);if(eH(s))e.save(),iI(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=ib(this.getColor(r)),e.beginPath(),h1(e,i,this.priceToY(s),this.lineMarker??"Circle",1.3333),e.fill(),e.restore()}draw(e){let t=this.getCore();if(null===t)return;let{ts:i,extent:s,domain:r,range:n}=t;e.save(),e.setLineDash([]);let a=i.container.getTimeData(),o=this.shiftedTimeDomain[0],l={bar:this.view.xAxis.xScale.bar,domain:r,range:n,slice:s,start:e_(a,+o,Number)||0},u=eH(this.zones);this.isOhlc?hQ.call(this,e,l):this.isRenko||this.isLineBreak?hj.call(this,e,l):this.style===W.Ribbon?this.varyColorPerBar?h9.call(this,e,l):h8.call(this,e,l,this.colors[0]):this.style===W.Area?u?hG.call(this,e,l,hW,!0):hW.call(this,e,l,this.colors,!0):this.isColumn||this.isMultiColumn?u?hG.call(this,e,l,hq,!0):hq.call(this,e,{...l,range:[null,null]}):this.isStackedColumn?hK.call(this,e,l):this.isBaseline?hY.call(this,e,l):this.style===W.Step?u?hG.call(this,e,l,hZ):hZ.call(this,e,l,this.colors[0]):this.isKagi?h6.call(this,e,l):this.isPointAndFigure?h7.call(this,e,l):this.style===W.Dots?hX.call(this,e,l):this.style===W.Line||this.isPercentChangeStyle?u?hG.call(this,e,l,h2):this.varyColorPerBar?h4.call(this,e,l):h2.call(this,e,l):yj(`Drawing of the curve style '${this.style}' is not implemented yet`,"error"),e.restore()}pickMainField(){return 1===this.fields.length?this.fields[0]:this.fields.includes(an.Last)?an.Last:this.fields.includes(an.Close)?an.Close:this.fields[0]}get zoneColors(){if(!eH(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 -1===t&&(t=this.zones.length-1),this.zoneColors[t]}pickAreaStroke(e){return e.length<2?ib(e[0]):e[1]}getComputedColor(e){if(!this.timeSeries.container.hasField(an.BARCOLIX))return null;let t=this.dataAt(an.BARCOLIX,e);return t>=0&&t<this.colors.length?this.colors[t]:null}getColor(e,t=!0,i=null){if(this.varyColorPerBar){let i,s={};if(this.isOhlc||this.isRenko||this.isLineBreak){let t=this.dataAt(an.Open,e),i=this.dataAt(an.High,e),r=this.dataAt(an.Low,e),n=this.dataAt(an.Close,e),a=this.dataAt(an.Change,e);s.open=t,s.high=i,s.low=r,s.close=n,s.change=a}else if(this.plot.isStudy&&!["VOL","MAVOL"].includes(this.plot.model.study)){let t=this.pickMainField(),i=this.dataAt(t,e-1),r=this.dataAt(t,e),n=eH(i),a=eH(r);n?s.change=a?r-i:-1:s.change=+!!a}else{let t=this.plot.axis.pane.presenter.data.aggregation;t.isTick&&t.spec===G.None||(s.open=this.dataAt(an.Open,e),s.close=this.dataAt(an.Close,e)),s.change=this.dataAt(an.Change,e)}let r=function(e,{open:t,close:i,change:s},r){let n=r.length>2&&e!==W.HLC,a=eH(t,i),o=a&&i>t,l=a&&i===t,u=s>0,h=0===s;return{useSame:n,isUp:o,isSame:l,isUpPrev:u,isSamePrev:h,isDown:!o&&!l,isDownPrev:!u&&!h}}(this.style,s,this.colors),n=this.getComputedColor(e);switch(this.style){case W.Candlestick:case W.Renko:case W.LineBreak:case W.Range:case W.HeikinAshi:case W.OHLC:case W.HLC:case W.Column:{if(eH(n)){i=n;break}let t=r.useSame?r.isUp:r.isUp||r.isSame,s=r.isSame,a=this.attributes||[],o=this.plot.isStudy&&!["HASMO","VOL","MAVOL"].includes(this.plot.model.study);(a.includes(U.ChangeBased)||o)&&(t=r.useSame?r.isUpPrev:r.isUpPrev||r.isSamePrev,s=r.isSamePrev),i=this.colors[+!!t],r.useSame&&s&&(i=this.colors[2]),(this.isRenko||this.isLineBreak||this.isRangeStyle)&&1===this.dataAt(an.Projection,e)&&(i=iE(.5,!0)(i));break}case W.ElderImpulseSystem:i=this.colors[this.dataAt(an.BREL,e)];break;case W.HollowCandles:{let e=this.colors[r.isUpPrev||r.isSamePrev?1:0];i=t&&(r.isUp||r.isSame)?tG.COLOR_TRANSPARENT:e;break}case W.Line:case W.PercentChange:case W.Ribbon:case W.Kagi:if(eH(n)){i=n;break}i=this.colors[0];break;case W.PointAndFigure:{let t=+!!uV(this.dataAt(an.BARKIND,e));i=this.colors[t];break}default:throw Error(`Unexpected style ${W[this.style]} for a curve with varying colors`)}return eH(i)||(i=this.colors[0]),i}if(this.zones){let t=this.pickMainField(),i=this.dataAt(t,e),s=this.getColorsFromZone(i);return this.style===W.Area?this.pickAreaStroke(s):s.length>0?s[0]:this.colors[0]}if((this.isMultiColumn||this.isStackedColumn)&&eH(i)){var s;return this.colors[s=this.colors,Math.min(Math.max(this.fields.findIndex(e=>e===i),0),s.length-1)]}return this.colors[0]}}function hU([e,t],i,s){let r=i,n=this.timeSeries.container.size;for(let i=e;i<=t;i++){for(;this.timeSeriesAt(r)<this.timelineAt(i-this.shift)&&r<n;)++r;if(r===n)break;let e=this.timeSeriesAt(r)>this.timelineAt(i-this.shift);s.call(this,r,e)}}function hW(e,t,i,s=!1){h2.call(this,e,t,this.pickAreaStroke(i)),ce.call(this,e,t,i[0],s)}function h$(e,t){let i,s,r=eH(e),n=eH(t),a=this.pane.getBounds();if(r)if(n){let r=this.priceToY(e),n=this.priceToY(t);i=(r+n)/2,s=new iD(a.x,n,a.width,r-n)}else i=this.priceToY(e),s=new iD(a.x,a.y,a.width,i-a.y);else i=this.priceToY(t),s=new iD(a.x,i,a.width,a.y+a.height-i);return[i,s]}function hG(e,t,i,s=!1,r){let n;this.zones.forEach((a,o)=>{let l=a.value,[u,h]=h$.call(this,n,l);e.save(),iI(e,h),s&&(t.range=[null,u]);let c=this.zoneColors[o];if(a.gradient){let t=((e,t)=>{let i=iE(.6)(e),s=i_(.6)(e),r="linLighten"===t;return[r?s:i,e,r?i:s]})(c,a.gradient),i=e.createLinearGradient(0,h.y,0,h.y+h.height);i.addColorStop(0,t[0]),i.addColorStop(.5,t[1]),i.addColorStop(1,t[2]),c=i}else eH(r)&&(c=r(o,c));i.call(this,e,t,c),e.restore(),n=l})}function hz(e,t){let{x:i,width:s}=this.pane.getBoundsWithoutScales();e.save(),e.lineWidth=1,e.strokeStyle="#888",e.setLineDash(iv("dot")),iY(e,t,i,i+s),e.restore()}function hY(e,t){let[i,s]=t.range,{baseLevel:r}=function(e){let{BaseLevel:t}=ej(e);return{baseLevel:Number.isFinite(t)?e1(0,100,t):50}}(this.plot.inputs),n=(i-s)*r/100+s;this.zones[0].value=this.yToPrice(n),hz.call(this,e,n),hG.call(this,e,t,hW,!0,(t,r)=>{let a=iP(r,0),o=e.createLinearGradient(0,1===t?i:s,0,n);return o.addColorStop(0,r),o.addColorStop(1,a),[o,iP(r,1)]})}function hj(e,{bar:t,slice:i,start:s}){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;hU.call(this,i,s,(i,s)=>{if(!s){let[s,n]=[an.Open,an.Close].map(e=>this.dataAt(e,i)).map(this.priceToY,this),a=Math.floor(t.totalWidth/2);e.fillStyle=this.getColor(i),e.beginPath(),e.rect(r-a,s,t.totalWidth,n-s),e.fill()}r+=t.totalWidth})}function hK(e,{bar:t,slice:i,start:s}){if(!this.isFirstVisibleOfStyle())return!1;let r=this.view.xAxis.xScale.range()[0]+t.offset,n=iX();n.prolog(e);let a=this.plot.curves.filter(e=>e.isStackedColumn);hU.call(this,i,s,(i,s)=>{if(!s){let s=this.priceToY(0),o=0;a.forEach(a=>{if(!a.visible)return;let l=a.fields[0];if(eH(o+=this.dataAt(l,i))){let u=this.priceToY(o);e.fillStyle=a.getColor(i,!1,l),e.beginPath(),e.rect(n.adjust(r),n.adjust(u),n.adjust(t.width),n.adjust(s-u)),e.fill(),s=u}})}r+=t.totalWidth}),n.epilog(e)}function hq(e,{bar:t,slice:i,start:s,range:[r,n]}){let a=this.view.xAxis.xScale.range()[0]+t.offset,o=this.isMultiColumn,l=o?this.fields:[this.pickMainField()],u=t.width/(o?l.length:1),h=iX();h.prolog(e),hU.call(this,i,s,(i,s)=>{s||l.forEach((t,s)=>{let r=this.dataAt(t,i);if(eH(r)){eH(n)||(n=this.priceToY(0));let o=this.priceToY(r);e.fillStyle=this.getColor(i,!1,t),e.beginPath(),e.rect(h.adjust(a+s*u),h.adjust(o),h.adjust(u),h.adjust(n-o)),e.fill()}}),a+=t.totalWidth}),h.epilog(e)}function hX(e,{bar:t,slice:i,start:s}){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;e.fillStyle=this.getColor(0);let n=Math.max(1,this.lineWidth||tG.CURVE_STYLE_DOTS_RADIUS),a=2*Math.PI;e.beginPath(),hU.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eH(s)){let t=this.priceToY(s);e.moveTo(r+n,t),e.arc(r,t,n,0,a)}}r+=t.totalWidth}),e.fill()}function hZ(e,{bar:t,slice:i,start:s},r){let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,a=iX();a.prolog(e),e.strokeStyle=r,e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(iv(this.dashStyle)),e.beginPath();let o=!1,l=null;hU.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eH(s)){let r=this.priceToY(s);if(o)e.lineTo(n,l),e.lineTo(n,r);else{let s=this.dataAt(t,i-1);if(eH(s)){let t=this.priceToY(s);e.moveTo(-1,t),e.lineTo(n,t),e.lineTo(n,r)}else e.moveTo(n,r);o=!0}l=r}}n+=t.totalWidth}),e.stroke(),a.epilog(e)}let hJ=[an.Open,an.High,an.Low,an.Close];function hQ(e,{bar:t,slice:i,start:s}){let r=this.presenter.display.chart.showMinMaxArc,n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,a=iX();a.prolog(e);let o=null,l=null,u=null,h=null,c=t=>{this.isCandle?(this.isHollowCandles?t.outlineColor=this.getColor(t.ix,!1):(this.colors.length>3&&(t.outlineColor=this.colors[3]),this.colors.length>4&&(t.wickColor=this.colors[4])),function(e,{x:t,adjust:i,width:s,y:[r,n,a,o],color:l,outlineColor:u,wickColor:h,isMin:c,isMax:d},p){let f=s/2;e.lineWidth=p,e.fillStyle=l,e.strokeStyle=u||l,e.beginPath(),e.rect(i(t-f),r,s,i(o-r)),e.fill(),e.stroke(),e.strokeStyle=h||u||l,e.beginPath(),e.moveTo(t,Math.min(o,r)),e.lineTo(t,n),e.moveTo(t,Math.max(o,r)),e.lineTo(t,a),e.stroke(),e.strokeStyle=0===iM(l).a?u:l,h0(e,c,d,t,a,n,f)}(e,t,this.lineWidth)):(this.isOhlcStyle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&function(e,{x:t,adjust:i,width:s,y:[r,n,a,o],color:l,isMin:u,isMax:h},c,d){let p=s/2;e.lineWidth=c,e.strokeStyle=l,e.beginPath(),e.moveTo(t,a),e.lineTo(t,n),d&&(e.moveTo(i(t-p),r),e.lineTo(t,r)),e.moveTo(i(t+p),o),e.lineTo(t,o),e.stroke(),h0(e,u,h,t,a,n,p)}(e,t,this.lineWidth,!this.isHlcStyle)};hU.call(this,i,s,(e,i)=>{if(!i){let i=hJ.map(t=>this.dataAt(t,e)),[s,r,d,p]=i;if(eH(s,r,d,p)){let f={x:a.adjust(n),adjust:a.adjust,width:t.width,y:[s,r,d,p].map(this.priceToY,this).map(a.adjust),isMin:!1,isMax:!1,ix:e,color:this.getColor(e)},m=Math.min(...i),g=Math.max(...i);(!eH(o)||m<o)&&(o=m,u=f),(!eH(l)||g>l)&&(l=g,h=f),c(f)}}n+=t.totalWidth}),r&&(eH(u)&&(u.isMin=!0,c(u)),eH(h)&&(h.isMax=!0,c(h))),a.epilog(e)}function h0(e,t,i,s,r,n,a,o=3){t&&i$(e,{x:s,y:r+o},a,0,Math.PI),i&&i$(e,{x:s,y:n-o},a,0,Math.PI,!0)}function h1(e,t,i,s,r=1){let n=tG.MARKER_SIZE*r,a=1.25*n;switch(s){case"Circle":e.moveTo(t+n,i),e.arc(t,i,n,0,2*Math.PI);break;case"Square":e.rect(t-n,i-n,2*n,2*n);break;case"TriangleUp":e.moveTo(t-a,i+a),e.lineTo(t+a,i+a),e.lineTo(t,i-a),e.lineTo(t-a,i+a);break;case"TriangleDown":e.moveTo(t-a,i-a),e.lineTo(t+a,i-a),e.lineTo(t,i+a),e.lineTo(t-a,i-a);break;case"Diamond":e.moveTo(t,i-a),e.lineTo(t+a,i),e.lineTo(t,i+a),e.lineTo(t-a,i),e.lineTo(t,i-a)}}function h2(e,{bar:t,slice:i,start:s},r=null){let n=r||this.getColor(0),a=eV(this.lineMarker);a&&(e.fillStyle=n,e.beginPath());let o=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,l=[],u=this.pickMainField();hU.call(this,i,s,(i,s)=>{if(!s){let t=this.dataAt(u,i);if(eH(t)){let i=this.priceToY(t);a&&h1(e,o,i,this.lineMarker),l.push({x:o,y:i})}}o+=t.totalWidth}),a&&e.fill(),e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(iv(this.dashStyle)),eV(this.lineSmoothing)?function(e,t,i,s){if(t.length<2)return;let r=function(e,t){let i=[];for(let s=0;s<e.length-1;s++){let r=e[s-1]||e[s],n=e[s],a=e[s+1],o=e[s+2]||a,l=n.x+(a.x-r.x)/t,u=n.y+(a.y-r.y)/t,h=a.x-(o.x-n.x)/t,c=a.y-(o.y-n.y)/t;i.push({cp1x:l,cp1y:u,cp2x:h,cp2y:c,x:a.x,y:a.y})}return i}(t,s);for(let s of(e.beginPath(),e.strokeStyle=i,e.moveTo(t[0].x,t[0].y),r))e.bezierCurveTo(s.cp1x,s.cp1y,s.cp2x,s.cp2y,s.x,s.y);e.stroke()}(e,l,n,this.lineSmoothing):h3(e,l,n)}function h3(e,t,i){if(t.length>1){e.beginPath(),e.strokeStyle=i;let s=t[0];e.moveTo(s.x,s.y);for(let i=1;i<t.length;i++){let s=t[i];e.lineTo(s.x,s.y)}e.stroke()}}function h4(e,{bar:t,slice:i,start:s}){e.lineWidth=this.lineWidth,e.lineCap="square",this.dashStyle&&e.setLineDash(iv(this.dashStyle));let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,n=null,a=null,o=[];hU.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eH(s)){let t=this.priceToY(s);a=this.getColor(i),n!==a&&(h3(e,o,n),o.length>0&&(o=[o.pop()]),n=a),o.push({x:r,y:t})}}r+=t.totalWidth}),h3(e,o,a)}let h5=[null,null,null,null];function h6(e,{bar:t,slice:i,start:s}){e.lineWidth=Math.max(1,.5*t.width),e.lineJoin="miter",e.miterLimit=1.5;let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,n=iX();n.prolog(e);let a=null,o=null,l=[];hU.call(this,i,s,(i,s)=>{if(!s){let s=e=>hJ.map(t=>this.dataAt(t,e)),[u,h,c,d]=s(i),[,p,f]=i<0?h5:s(i-1);if(eH(u,h,c,d)){let s=n.adjust(r),m=n.adjust(r-t.totalWidth),g=[u,h,c,d].map(this.priceToY,this).map(n.adjust),y=n.adjust(this.priceToY(h>p?p:f));o=this.getColor(i);let T=eH(a)&&a!==o,A=u===h?1:2,S=u===h?2:1;l.push({x:m,y:g[0]}),l.push({x:s,y:g[A]}),T&&(l.push({x:s,y:y}),h3(e,l,a),l=[]),T&&l.push({x:s,y:y}),l.push({x:s,y:g[S]}),a=o}}r+=t.totalWidth}),h3(e,l,o),n.epilog(e)}function h7(e,{bar:t,slice:i,start:s}){let r=this.view.xAxis.xScale.range()[0],n=t.totalWidth/2,a=r+t.offset+t.width/2,o=iX();o.prolog(e);let l=this.plot.timeSeries.builder.boxSize,u=l/2;hU.call(this,i,s,(i,s)=>{if(!s){let[t,s]=[an.High,an.Low].map(e=>this.dataAt(e,i)),r=this.colors[0],h=this.colors[1],c=this.dataAt(an.BARKIND,i),d=uV(c),p=c===tG.BARKIND_XO,f=c===tG.BARKIND_OX;if(eH(t,s))for(let i=t;i>=s;i-=l){let l=o.adjust(a),[c,m]=[l-n,l+n],[g,y,T]=[i,i-u,i+u].map(e=>this.priceToY(e)),A=i===t&&p||i===s&&f?!d:d;e.beginPath(),A?(e.strokeStyle=h,e.moveTo(c,y),e.lineTo(m,T),e.moveTo(c,T),e.lineTo(m,y)):(e.strokeStyle=r,e.ellipse(l,g,n,y-g,0,0,2*Math.PI)),e.stroke()}}a+=t.totalWidth}),o.epilog(e)}function h8(e,{bar:t,slice:i,start:s},r){e.fillStyle=r;let[n,a]=this.fields,o=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,l=[];if(hU.call(this,i,s,(e,i)=>{if(!i){let t=this.dataAt(n,e),i=this.dataAt(a,e);eH(t,i)&&l.push({x:o,upY:this.priceToY(t),downY:this.priceToY(i)})}o+=t.totalWidth}),l.length>0){e.beginPath(),e.moveTo(l[0].x,l[0].upY);for(let t=1;t<l.length;++t)e.lineTo(l[t].x,l[t].upY);let t=l.length-1;e.lineTo(l[t].x,l[t].downY);for(let i=t-1;i>=0;--i)e.lineTo(l[i].x,l[i].downY);e.closePath(),e.fill()}}function h9(e,{bar:t,slice:i,start:s}){let[r,n]=this.fields,a=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,o=[],l=t=>{if(o.length>1){e.beginPath(),e.fillStyle=t,e.moveTo(o[0].x,o[0].upY);for(let t=1;t<o.length;++t)e.lineTo(o[t].x,o[t].upY);let i=o.length-1;e.lineTo(o[i].x,o[i].downY);for(let t=i-1;t>=0;--t)e.lineTo(o[t].x,o[t].downY);e.closePath(),e.fill()}},u=null,h=null;hU.call(this,i,s,(e,i)=>{if(!i){let t=this.dataAt(r,e),i=this.dataAt(n,e);if(eH(t,i)){let s=this.priceToY(t),r=this.priceToY(i);h=this.getColor(e),u!==h&&(l(u),o.length>0&&(o=[o.pop()]),u=h),o.push({x:a,upY:s,downY:r})}}a+=t.totalWidth}),l(h)}function ce(e,{bar:t,slice:i,start:s,range:[r,n]},a,o){if(o){let t=e.createLinearGradient(0,r,0,n);t.addColorStop(0,a),t.addColorStop(1,iP(a,0)),e.fillStyle=t}else e.fillStyle=a;e.beginPath();let l=null,u=this.pickMainField(),h=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,c=!1,d=null;hU.call(this,i,s,(i,s)=>{if(!s){let t=this.dataAt(u,i);if(eH(t)){let i=this.priceToY(t);c?e.lineTo(h,i):(e.moveTo(l=h,i),c=!0),d=h}}h+=t.totalWidth}),e.lineTo(d,n),e.lineTo(l,n),e.closePath(),e.fill()}class ct{symbol;aggregation;range;seriesKind;cacheMe;barsToFetch;offset;chartId;curveStyle;extendedHours;fields=[];alwaysUseBarsToFetch;inputs=[];splits;padded;constructor(e,t,i=Z.Normal,s=[null,null]){this.symbol=e,this.aggregation=t,this.range=s,this.seriesKind=i,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(!eH(this.curveStyle)||!tG.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return"Standard";switch(this.curveStyle){case W.Renko:{let{method:e,period:t,source:i,brickSize:s}=l1(this.inputs),r="ATR"===e?`ATR;${t}`:`${e};${s}`;return`Renko;${r};${i}`}case W.Kagi:{let{method:e,period:t,reversal:i}=uO(this.inputs),s="ATR"===e?`ATR;${t}`:`User;${i}`;return`Kagi;${s}`}case W.PointAndFigure:{let{method:e,period:t,reversal:i,boxSize:s,source:r,oneStepBack:n}=uH(this.inputs),a="ATR"===e?`ATR;${t}`:`User;${s}`;return`PointAndFigure;${a};${r};${i};${n}`}case W.LineBreak:{let{lineBreak:e}=uD(this.inputs);return`LineBreak;${e}`}default:return W[this.curveStyle]}}get needsExtraKey(){return[Z.Options,Z.BalanceSheet,Z.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(),i=this.getExtraKey(),s=this.extendedHours??!1;return`${this.symbol}|${e}|${s}|${this.range}|${this.seriesKind}|${this.offset}|${t}|${this.splits}|${this.padded}|${i}`}duplicate(){let e=new ct(this.symbol,this.aggregation.duplicate(),this.seriesKind,this.range);return e.cacheMe=this.cacheMe,e.barsToFetch=this.barsToFetch,e.alwaysUseBarsToFetch=this.alwaysUseBarsToFetch,e.offset=this.offset,e.chartId=this.chartId,e.curveStyle=this.curveStyle,e.extendedHours=this.extendedHours,e.fields=eG(this.fields),e.splits=this.splits,e.padded=this.padded,e}}var ci=R("c15IW");function cs(e,t){let i=e.query?.duplicate();if(!eH(i)||i.symbol===tG.PLACEHOLDER_SYMBOL_NAME||"Standard"!==i.getBuilderKey())return new uU;{0!==i.barsToFetch&&(i.barsToFetch=i.barsToFetch*tG.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);let e=t(i);return e.serverComputedSeries=!0,e}}function cr(e){return new ai(e,z.Number,j.Study,e)}class cn{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=e0(),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){eY(this,e);let t=e.outFields??[e.target];this.studyFields=this.helpers.concat(t).reduce((e,t)=>(e[t.id]=t,e),{})}get helpers(){return tG.EMPTY_ARRAY}get hasData(){return null!==this.container}get source(){if(eH(this._source))return this._source;let e=eH(this.inputs)?this.inputs[tG.INPUT_SOURCE]:null;return eH(e)?an[e]:null}set source(e){this._source=e}async ready(){return tU.call(this,async()=>{this.basisChangedToken=this.useNotifications?e(ci).subscribe(aa.TS_ALL,this.onBasisChanged.bind(this)):null;let t={tag:e0(),src:null},i=(await Promise.all(this.innerSeries.map(e=>e.ready()))).every(ed);return i&&this.calculate(t),i})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===aa.TS_EVENTSCHANGED||e===aa.TS_LOADING||this.innerSeries.some(e=>!e.hasData)||!this.shouldTriggerOurRecalc(t.series)||null===this.base||this===t.series)return;let i={tag:e0(),src:t.series};switch(e){case aa.TS_MANYCHANGED:this.calculate(i);break;case aa.TS_DATAPOINTCHANGED:case aa.TS_DATAPOINTADDED:{let s=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(i,s,e===aa.TS_DATAPOINTADDED);break}case aa.TS_TIMELINECORRECTION:case aa.TS_QUOTEMARKER:break;default:throw Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.useNotifications&&this.basisChangedToken&&e(ci).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 i=this.calculateAt(e);null!==i&&Object.keys(i).forEach(e=>{let s=i[e],r=this.studyFields[e];t?this.container.addDataPoint(r,s):this.container.setLastDataPoint(r,s)})}notify(e,t){eR(e,{series:this,index:t})}calculateCommon(e,t=null,i=-1,s=!0){let r=-1===i,n=r?t=>{(eH(e.src)||!eH(t.calcCtx))&&t.calculate(e)}:t=>t.recalculateAt(e,i,s);if(null===this.base||this.calcCtx&&this.calcCtx.tag===e.tag||this===e.src)return;this.calcCtx=e;let a=e=>this.isCalculable(e)&&!e.usedAsStyle;if(this.innerSeries.filter(a).forEach(e=>n(e)),r&&(this.container=this.makeContainer()),void 0!==this.calculateAt)if(r){let e=this.base.size;for(let t=0;t<e;++t)this.calculateDataPoint(t,!0)}else this.calculateDataPoint(i,s);t&&(eH(e.src)||this.initialNotification)&&this.notify(t,i)}calculate(e){this.calculateCommon(e,aa.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,i){this.computedServerSide||(!i&&eV(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,i?aa.TS_DATAPOINTADDED:aa.TS_DATAPOINTCHANGED,t,i))}baseVal(e,t){return this.base.getData(e)[t]}innCont(e){return this.innerSeries[e].container}innVal(e,t,i){let s=this.innCont(e),r=s.size;return i<0||i>r-1?null:s.getData(t)[i]}innHasData(e){let t=this.innCont(e);return eH(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(an.DateTime,an.Symbol)}makeContainer(){let e=this.defaultWrappers.concat(this.getWrappers());return new lQ(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,i,s=this.base){return s.getData(i).slice(e-t+1,e+1)}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}}class ca extends cn{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}}class co extends ca{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){let[t,i,s,r]=[an.Open,an.High,an.Low,an.Close].map(t=>this.baseVal(t,e),this),n=null,a=null,o=null,l=null,u=em([t,i,s,r]);if(e<1)n=em([t,r]),a=i,o=s,l=0;else{let[t,r]=[an.Open,an.Close].map(t=>this.container.getData(t)[e-1],this);a=Math.max(i,n=em([t,r]),u),o=Math.min(s,n,u),l=u-r}return{[an.Open.id]:n,[an.High.id]:a,[an.Low.id]:o,[an.Close.id]:u,[an.Change.id]:l}}getWrappers(){return this.wrapBaseFields(an.Volume,an.OpenInterest,an.TradingDay)}}class cl extends cn{constructor(e,t){super(e,t),fC(this)}calculateAt(e){let t=null,i=this.period,[,s]=fE(this);if(this.atLeast(e,i)&&s.hasField(this.source)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=em(r.filter(ep)):eg(r)&&(t=em(r))}return{[this.target.id]:t}}getWrappers(){return this.source===an.Volume?this.wrapBaseFields(an.Volume,an.TradeSize,an.Change,an.Open,an.Close):[]}}class cu extends cn{multiplier;constructor(e,t,i){super(e,t),this.multiplier=i(this.period),fC(this)}calculateAt(e){let t=null,[i,s]=fE(this);if(this.atLeast(e,2)&&s.hasField(this.source)){let r=this.container.getData(this.target)[e-1];if(null!==r)t=(this.innVal(i,this.source,e)-r)*this.multiplier+r;else{let i=this.period;if(this.atLeast(e,i)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=em(r.filter(ep)):eg(r)&&(t=em(r))}}}return{[this.target.id]:t}}}class ch extends cn{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=an.OpenInterest;return this.base.hasField(i)&&(t=this.baseVal(i,e)),{[i.id]:t}}}let cc={inField:an.MA,outFields:[an.ENVU,an.ENVD],func:fr},cd={inField:an.EMA,outFields:[an.ENVEXPU,an.ENVEXPD],func:fn},cp={inField:an.SMA,outFields:[an.ENVSMOU,an.ENVSMOD],func:fa};class cf extends cn{kind;perc;constructor(e,t,i){super(e,i),this.kind=t,this.perc=this.inputs.Percent/100;let s=t.func(i,this.inputs.Period,e.source);this.addInner(s)}calculateAt(e){let t=null,i=null,s=this.innVal(1,this.kind.inField,e);if(null!==s){let e=s*this.perc;t=s+e,i=s-e}return{[this.kind.outFields[0].id]:t,[this.kind.outFields[1].id]:i}}}class cm extends cn{constructor(e,t){super(e,t);let i=fr(t,this.inputs.Period1,this.source),s=fr(t,this.inputs.Period2,this.source),r=fv(this.target,(e,t,i)=>t-i,i,s);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}}let cg={fields:[an.MACD,an.MACDS,an.MACDH],avgFunc:fr,mapFunc:fb,histogramVaryColor:!0},cy={fields:[an.MACD,an.MACDS,an.MACDH],avgFunc:fn,mapFunc:fb,histogramVaryColor:!0},cT={fields:[an.MACD,an.CTLTM,an.CTM],avgFunc:fn,mapFunc:fb,histogramVaryColor:!1},cA={fields:[an.MACD,an.CTLTMF,an.CPMI],avgFunc:fn,mapFunc:fb,histogramVaryColor:!1},cS={fields:[an.PPO,an.PPOS,an.PPOH],avgFunc:fn,mapFunc:fP,histogramVaryColor:!0},cv={fields:[an.PVO,an.PVOS,an.PVOH],avgFunc:fn,mapFunc:fP,histogramVaryColor:!1};class cb extends cn{histogramVaryColor=!1;histogramField;get helpers(){return[an.BARCOLIX]}calculateAt(e){let t=-1;if(this.histogramVaryColor&&e>0){let i=this.container.getData(this.histogramField)[e],s=this.container.getData(this.histogramField)[e-1];if(eH(i,s)){let r=i<=0;t=r?1:3,e>0&&(r&&i>s&&(t=0),!r&&i<s&&(t=2))}}return{[an.BARCOLIX.id]:t}}}class cP extends cb{fields;constructor(e,t,i){super(e,i),this.fields=t.fields,this.histogramVaryColor=t.histogramVaryColor,this.histogramField=this.fields[2];let s=t.avgFunc(i,e.inputs.Period1,e.source,void 0),r=t.avgFunc(i,e.inputs.Period2,e.source,void 0),n=fv(this.fields[0],t.mapFunc,s,r),a=t.avgFunc(n,e.inputs.Period3,n.target,this.fields[1]),o=fv(this.fields[2],fb,n,a);this.addInner(n,a,o)}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}}let cC=cr("_AVG_GAIN"),cE=cr("_AVG_LOSS");class c_ extends cn{constructor(e,t,i){super(e,i);let s=fg(i,this.inputs.Period,this.source,an.RSI,t),r=fx(e,"MA","Average")(s,this.inputs.PeriodAvg,an.RSI,an.RSIAVG);this.addInner(s,r)}getWrappers(){return[this.wrapInner(an.RSI,1),this.wrapInner(an.RSIAVG,2)]}}class cM extends cn{highest;index;constructor(e,t,i,s){super(e,s),this.highest=t,this.index=i}calculateAt(e){let t=null,i=this.inputs.Period;if(this.atLeast(e,i)){let s=this.past(e,i,this.source);eg(s)&&(t=this.highest?Math.max(...s):Math.min(...s),this.index&&(t=i-s.indexOf(t)-1))}return{[this.target.id]:t}}}class cL extends cn{toHighest;field;highField;lowField;constructor(e,t,i){super(e,i),this.toHighest=t;let s=eH(e.source),r=e.source,n=s?r:an.Close;this.field=n;let a=s?r:an.High;this.highField=a;let o=s?r:an.Low;this.lowField=o;let l=fu(i,e.inputs.Period,this.highField,an.HH,!0),u=fu(i,e.inputs.Period,this.lowField,an.LL,!1);this.addInner(l,u)}calculateAt(e){let t=null,i=this.baseVal(this.field,e),s=this.innVal(1,an.HH,e),r=this.innVal(2,an.LL,e);if(eg([i,s,r])){let e=this.toHighest?s:r,n=s-r;0!==n&&(t=(i-e)/n*100)}return{[this.target.id]:t}}}let cx=cr("RawPercK");class cO extends cn{kField;constructor(e,t,i,s){super(e,s);let r=fh(s,this.inputs.Period1,t?cx:i,!1),n=fx(e,"MA"),a=n(r,this.inputs.Period2,r.target,t?i:an.PercD),o=t?n(a,this.inputs.Period3,a.target,an.PercD):a;this.kField=i,t?this.addInner(a,o):this.addInner(r,a)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(an.PercD,2)]}}class cI extends cn{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=this.inputs.Period,r=this.source,n=fr(i,s,r),a="Modified"===t,o=fT(a?function(e,t,i=an.PCTCHG){return ft("PCTCHG",{source:t,target:i,inputs:fc},e)}(i,r):i,s,a?an.PCTCHG:r);this.addInner(n,o)}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=this.innVal(2,an.MSD,e),l=null!==o;if(l){n=this.innVal(1,an.MA,e);let l=this.inputs.Width*o;t=n+l,i=n-l,a=(s=2*l)/n*100,r=(this.baseVal(an.Close,e)-i)/(t-i)}switch(this.kind){case"Regular":return{[an.BOLLBU.id]:t,[an.BOLLBL.id]:i,[an.BOLLBM.id]:n};case"Width":return{[an.BOLLBW.id]:s};case"Percent":return{[an.BOLLBP.id]:r};case"Squeeze":return{[an.BOLLSQ.id]:a};case"Modified":{let e=null,t=null,i=null,s=null;if(l){let r=this.inputs.MultInside,a=this.inputs.MultOutside;e=n+r*o,i=n-r*o,t=n+a*o,s=n-a*o}return{[an.MBBUI.id]:e,[an.MBBLI.id]:i,[an.MBBUO.id]:t,[an.MBBLO.id]:s,[an.MBBM.id]:n}}default:return null}}}let cD=cr("_ABS_CHG"),cw=cr("_MA_ABS_CHG"),cR=cr("_CHG"),cN=cr("_PDM"),cV=cr("_MDM"),cH=cr("_TRS"),cF=cr("_PDS"),ck=cr("_MDS"),cB=cr("_DX");class cU extends cn{useEma;adxField;multiplier;constructor(e,t,i,s){super(e,s),this.useEma=t,this.adxField=i,this.multiplier=2/(this.inputs.AdxSmoothing+1);let r=fd(s,an.TR);this.addInner(r)}get helpers(){return[cN,cV,cH,cF,ck,cB]}sum(e,t,i,s){let r=null;if(this.atLeast(e-1,s-1)){let n=this.past(e-1,s-1,t,this.container);n.push(i),eg(n)&&(r=n.reduce((e,t,i)=>e+t,0))}return r}smooth1(e,t,i,s){let r=this.inputs.DiLength,n=this.container.getData(i)[e-1];return null!==n?n-n/r+s:this.sum(e,t,s,r)}smooth2(e,t,i,s){let r=this.container.getData(i)[e-1],n=this.inputs.AdxSmoothing;if(null!==r)if(this.useEma)return(s-r)*this.multiplier+r;else return(r*(n-1)+s)/n;{let i=this.sum(e,t,s,n);if(null!==i)return i/n}return null}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=null,l=null,u=null;if(e>0){let h=this.past(e,2,an.High),c=this.past(e,2,an.Low),d=Math.max(h[1]-h[0],0),p=Math.max(c[0]-c[1],0);t=d>p?d:0,i=p>d?p:0;let f=this.container.getData(an.TR)[e];r=this.smooth1(e,cN,cF,t),n=this.smooth1(e,cV,ck,i),s=this.smooth1(e,an.TR,cH,f),(r>0||n>0)&&0!==s&&(l=100*Math.abs((a=r/s*100)-(o=n/s*100))/(a+o),u=this.smooth2(e,cB,this.adxField,l))}return{[cN.id]:t,[cV.id]:i,[cH.id]:s,[cF.id]:r,[ck.id]:n,[an.PDI.id]:a,[an.MDI.id]:o,[cB.id]:l,[this.adxField.id]:u}}getWrappers(){return[this.wrapInner(an.TR,1)]}}class cW extends cn{calculateAtFunc;constructor(e,t,...i){super(e,...i),this.calculateAtFunc=t}calculateAt(e){let t=this.innerSeries.map((t,i)=>{let s=t.target;return eH(s)||(s=t.container.hasField(an.Close)?an.Close:t.container.fields[0]),this.innVal(i,s,e)}),i=null;return eg(t)&&(i=this.calculateAtFunc(e,...t)),{[this.target.id]:i}}}function c$(e,t){let i=this.baseVal(an.High,t),s=this.baseVal(an.Low,t);return{[e.id]:(i+s)/2}}function cG(e,t){let i=this.baseVal(an.High,t),s=this.baseVal(an.Low,t);return{[e.id]:i-s}}class cz extends cn{calculateAtFunc;constructor(e,t,i){super(e,i),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}}let cY=cr("_RANGE"),cj=cr("_MOV_RANGE"),cK={fields:[an.KCUP,an.KCLOW,an.KCMID],midSeries:e=>ff(e,an.TP),midTarget:an.TP,rangeSeries:e=>fS(cY,eu(cG,cY),e),rangeTarget:cY,func:"MA",useMultiplier:!1},cq={fields:[an.KBUP,an.KBLOW,an.KBMID],midSeries:e=>e,midTarget:an.Close,rangeSeries:e=>fd(e,an.TR),rangeTarget:an.TR,func:"EMA",useMultiplier:!0};class cX extends cn{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=t.midSeries(i),r=fx(e,t.func,"Average"),n=r(s,this.inputs.Period,t.midTarget,t.fields[2]),a=r(t.rangeSeries(i),this.inputs.Period,t.rangeTarget,cj);this.addInner(n,a)}calculateAt(e){let t=this.innVal(1,this.kind.fields[2],e),i=this.innVal(2,cj,e),s=null!==t&&null!==i,r=this.kind.useMultiplier?this.inputs.Multiplier:1;return{[this.kind.fields[0].id]:s?t+i*r:null,[this.kind.fields[1].id]:s?t-i*r:null}}getWrappers(){return[this.wrapInner(this.kind.fields[2],1)]}}class cZ extends cn{isWidth;constructor(e,t,i){super(e,i),this.isWidth=t;let s=fu(i,this.inputs.Period,an.High,an.DONUP,!0),r=fu(i,this.inputs.Period,an.Low,an.DONLOW,!1);this.addInner(s,r)}calculateAt(e){let t=this.innVal(1,an.DONUP,e),i=this.innVal(2,an.DONLOW,e),s=null===t&&null===i;return this.isWidth?{[an.DONW.id]:s?null:t-i}:{[an.DONMID.id]:s?null:(t+i)/2}}getWrappers(){return[this.wrapInner(an.DONUP,1),this.wrapInner(an.DONLOW,2)]}}let cJ=cr("_HIND"),cQ=cr("_LIND");class c0 extends cn{justWidth;constructor(e,t,i){super(e,i),this.justWidth=t,this.justWidth=t;let s=this.inputs.Period,r=fu(i,s,an.High,cJ,!0,!0),n=fu(i,s,an.Low,cQ,!1,!0);this.addInner(r,n)}calculateAt(e){let t=null,i=null,s=null,r=this.innVal(1,cJ,e),n=this.innVal(2,cQ,e);if(null!==r&&null!==n){let e=this.period;s=(t=(e-r)/e*100)-(i=(e-n)/e*100)}return this.justWidth?{[an.ARNOSC.id]:s}:{[an.ARNUP.id]:t,[an.ARNLOW.id]:i}}}let c1=cr("_MIDPOINT"),c2=cr("_MIDPOINT");class c3 extends cn{multiplyVol;constructor(e,t,i){super(e,i),this.multiplyVol=t}calculateAt(e){let[t,i,s,r]=[an.High,an.Low,an.Close,an.Volume].map(t=>this.baseVal(t,e)),n=t===i?0:(s-i-(t-s))/(t-i);return this.multiplyVol&&(n*=r),{[this.target.id]:n}}}let c4=cr("_RANGE"),c5=cr("_MATP");class c6 extends cn{isBull;constructor(e,t,i){super(e,i),this.isBull=t;let s=fn(i,this.inputs.Period,this.source);this.addInner(s)}calculateAt(e){let t=null,i=this.innVal(1,an.EMA,e);return null!==i&&(t=this.isBull?this.baseVal(an.High,e)-i:this.baseVal(an.Low,e)-i),{[this.isBull?an.ERBLPOW.id:an.ERBRPOW.id]:t}}}let c7=cr("_FORCE"),c8=cr("_RANGE"),c9=cr("_EMA1"),de=cr("_EMA2"),dt=cr("_RATIO"),di={isNegative:!1,fields:[an.PVI,an.PVIEMA]},ds={isNegative:!0,fields:[an.NVI,an.NVIEMA]};class dr extends cn{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=fS(this.kind.fields[0],eu(function(e,t){let i=1e3;if(t>0){let s=[an.Close,an.Volume],[r,n]=s.map(e=>this.baseVal(e,t)),[a,o]=s.map(e=>this.baseVal(e,t-1)),l=this.container.getData(this.target)[t-1];i=(e?n<o:n>o)?l*((r-a)/a+1):l}return{[this.target.id]:i}},this.kind.isNegative),i),r=fn(s,this.inputs.Period,this.kind.fields[0],this.kind.fields[1]);this.addInner(s,r)}getWrappers(){return[this.wrapInner(this.kind.fields[0],1),this.wrapInner(this.kind.fields[1],2)]}}let dn=cr("_LOGPC"),da=cr("_SWING_INDEX"),dl=cr("_MIN_CLOSE"),du=cr("_MAX_CLOSE"),dh=cr("_EP"),dc=cr("_AF"),dd=cr("_POS"),dp=cr("_IDY"),df=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],dm=e=>Array(e).fill(0);function dg(e,t,i){let s=e[i-1];return 0===t&&(s=e[i]),t<0&&(s=e[i+1]),s}function dy(e,t,i){let s=0,r=-1,n=0,a=1;for(let o=0;o<i;++o){if(t[o]=0,null==e[o]||(21==++s&&(a=2),31==s&&(a=3),n+=e[o]*a,s<40))continue;t[o]=n/70;let l=0,u=r+1;for(let t=u;t<i&&(null==e[t]||(1==++l&&(r=t),(1==l||21==l||31==l)&&(n-=e[t]),31!=l));++t);}}let dT={1:{param:"cot",func:"parseCotLineChart",fields:[an.DateTime,an.COTLCCMSP,an.COTLCLGSP,an.COTLCSMSP]},2:{param:"cotadv",func:"parseDisaggregated",fields:[an.DateTime,an.COTDAGPRO,an.COTDAGSPD,an.COTDAGMNM,an.COTDAGOTH]},3:{param:"cotfin",func:"parseFinancialTradersReport",fields:[an.DateTime,an.COTFTRDLI,an.COTFTRASM,an.COTFTRLVF,an.COTFTROTH]}};class dA extends cn{wrappers;constructor(e,t,i){super(e,cs(i,e=>new dS(t,e))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=dT[t].fields.slice(1).map(e=>this.wrapInner(e,0))}getWrappers(){return this.wrappers}}class dS extends uB{kind;constructor(e,t){super(t),this.kind=e}getRetriever(){return new dv(this.kind)}onStreamingUpdates(e){}}class dv extends ul{kind;constructor(e){super(),this.kind=e}addExtraParams(e){e[dT[this.kind].param]="y"}getParser(e){return new db(e.symbol,e.aggregation,this.kind)}}class db extends un{kind;constructor(e,t,i){super(e,t,0),this.kind=i}makeContainer(){return new lZ(dT[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[dT[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(an.DateTime,this.parseDate(e[1])),this.container.addDataPoint(an.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(an.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(an.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(an.DateTime,this.parseDate(e[1])),this.container.addDataPoint(an.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(an.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(an.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(an.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(an.DateTime,this.parseDate(e[1])),this.container.addDataPoint(an.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(an.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(an.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(an.COTFTROTH,parseInt(e[5]))}}class dP extends dA{constructor(e,t){super(e,1,t)}}let dC={Day:[an.PreviousHigh,an.PreviousLow,an.PreviousClose],Week:[an.WeekPreviousHigh,an.WeekPreviousLow,an.WeekPreviousClose],Month:[an.MonthPreviousHigh,an.MonthPreviousLow,an.MonthPreviousClose]};class dE extends cn{disabled;record;streamingSubscription;constructor(e,t,i){if(super(e,i),this.disabled=!eH(i.query)||!eH(i.query.symbol),!this.disabled){let e=i.query.symbol;e.endsWith(".BZ")&&(e=e.slice(0,-3)),this.record=yQ().getRecordSource().getRecord(e),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()}this.initialNotification=!0}getStreamingSubscription(){return yQ().getRecordSource().subject.pipe(up(e=>{let t=aP(aa.RT_QUOTE,this.record.symbol);return e.filter(t)}),oh(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return tU.call(this,async()=>eH(this.record)?await this.record.ready()&&await super.ready():await super.ready(),"asyncReadyWork2")}onStreamingUpdates(e){if(this.record){let e={tag:e0(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return dC[e].map(e=>this.record.getValue(e))}}class d_ extends uB{constructor(e){super(e)}getRetriever(){return tm(this.query.symbol)?new dO:new dM}onStreamingUpdates(e){}}class dM extends ul{addExtraParams(e){e.impl="y"}getParser(e){return new dx(e.symbol,e.aggregation)}}function dL(){return new lZ([an.DateTime,an.IMPVOL])}class dx extends un{constructor(e,t){super(e,t)}makeContainer(){return dL()}getParseFunc(){return this.parseImpVol}parseImpVol(e){this.aggregation.isEndOfDay&&!(e.length<9)&&(this.container.addDataPoint(an.DateTime,this.parseDate(e[1])),this.container.addDataPoint(an.IMPVOL,parseFloat(e[8])))}}class dO extends uu{emptyContainer(e,t){return dL()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(an.DateTime,lz(e.date.substring(0,10)));let s=eV(e.impliedVolatility);i.addDataPoint(an.IMPVOL,s?100*e.impliedVolatility:null)}}let dI=cr("_ABS_CHG"),dD=cr("_DS1_EMA1"),dw=cr("_DS1_EMA2"),dR=cr("_DS2_EMA1"),dN=cr("_DS2_EMA2"),dV=cr("_DIFF"),dH=cr("_SUM"),dF=cr("_ABS_CHG"),dk=cr("_HH_LL"),dB=cr("_MULMA");class dU extends cn{constructor(e,t,i){super(e,i);let s="Close"===e.inputs.TurtleChnField,r=fD(i);if(!s&&r){let e=fS(this.target,(e,t)=>null,i);this.addInner(e)}else{let e=(e,t)=>({[dF.id]:t>0?e*Math.abs(this.baseVal(an.Change,t)):null}),r=fr(fS(dF,eu(e,this.inputs.FactorATR),i),this.inputs.PeriodAdjATR,dF,an.MA),n=t?an.High:an.Low,a=fu(i,this.inputs.PeriodTurtleChn,s?an.Close:n,dk,t),o=fv(dB,(e,t)=>this.inputs.FactorAdjATR*t,r),l=t?-1:1,u=fv(this.target,(e,t,i)=>t+l*i,a,o);this.addInner(u)}}getWrappers(){return[this.wrapInner(this.target,1)]}}let dW=cr("_DIFF");class d$ extends ca{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 i=(e,t)=>this.baseVal(e,t),s=[an.Open,an.High,an.Low,an.Close],r=s.map(t=>i(t,e));if(eg(r)){let n=s.map(t=>i(t,e-1));if(eg(n)){let[i,s]=eM(t=r.map((e,t)=>100*(e-n[t])/n[t]));if(t[1]=s,t[2]=i,e>1){let i=this.container.getData(an.Close)[e-1];t[4]=t[3]-i}}}}return{[an.Open.id]:t[0],[an.High.id]:t[1],[an.Low.id]:t[2],[an.Close.id]:t[3],[an.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(an.Volume,an.OpenInterest,an.TradingDay)}}let dG=cr("_DIST"),dz=cr("_EMA_DIST1"),dY=cr("_EMA_DIST2"),dj=cr("_DIFF"),dK=cr("_EMA_DIFF1"),dq=cr("_EMA_DIFF2"),dX=cr("_CHG"),dZ=cr("_M1"),dJ=cr("_M2");class dQ extends cn{constructor(e,t){super(e,t);let i=fS(dX,function(e){let t=an.Close,i=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[dX.id]:i}},t),s=fv(dZ,(e,t)=>t>=0?t:0,i),r=fv(dJ,(e,t)=>t>=0?0:-t,i);this.addInner(s,r)}perc(e,t){return 100*e/t}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i+1)){let s=this.past(e,i,dZ,this.innCont(1)),r=this.past(e,i,dJ,this.innCont(2));if(eg(s)&&eg(r)){let e=ef(s),i=ef(r);t=this.perc(e-i,e+i)}}return{[an.CHDMOMOSC.id]:t}}}let d0=cr("_MAX"),d1=cr("_MIN"),d2=cr("_ISUPTREND"),d3=cr("_TRENDUP"),d4=cr("_TRENDDOWN"),d5=cr("_TREND"),d6=cr("_CUM_PRICE"),d7=cr("_CUM_VOL"),d8=cr("_PER_CHG");class d9 extends cn{constructor(e,t){super(e,t);let i=this.source,s=fS(i,eu(f_,i),t);this.addInner(s)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}}let pe=cr("_DIFF"),pt=[pe,an.Buy,an.Sell];function pi(e,t,i,s){let r=null,n=null,a=null;eH(i,s)&&(a=i-s);let o=t>0?e.getData(pe)[t-1]:null;return eH(a,o)&&(r=a>0&&o<=0?1:null,n=a<0&&o>=0?-1:null),{[pe.id]:a,[an.Buy.id]:r,[an.Sell.id]:n}}let ps=cr("_PVM"),pr=cr("_NVM");var ci=R("c15IW");function pn(e,t,i){return new pa(e,t,i)}class pa{exprModel;innerSeries;calculable;container;innerLookup;policy;exprSymbols;valueSymbols;onlyForTimeline;recalcTriggers;crashedComputationReported;isLoading;_sourceFields;_targetFields;basisChangedToken;quoteGroupToken;constructor(e,t,i){this.exprModel=e,this.innerSeries=t,this.calculable=!0,this.valueSymbols=[],this.crashedComputationReported=!1,this.isLoading=!1,this.basisChangedToken=null,this.quoteGroupToken=null,this.container=null,this.innerLookup=t.reduce((e,t)=>(e[i.mapper(t)]=t,e),{}),this.policy=i,this.exprSymbols=nU(e),this.valueSymbols=this.exprSymbols.filter(e=>void 0===this.innerLookup[e]),this.onlyForTimeline=eS(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!eH(this.exprModel)}get hasData(){return null!==this.container}get sourceFields(){return this._sourceFields||(this._sourceFields=Array.from(this.policy.fieldMap.keys())),this._sourceFields}get targetFields(){return this._targetFields||(this._targetFields=Array.from(this.policy.fieldMap.values())),this._targetFields}async ready(){return tU.call(this,async()=>{this.basisChangedToken=e(ci).subscribe(aa.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=e(ci).subscribe(aa.RT_QUOTEGROUP,this.onQuoteGroup.bind(this));let t=this.innerSeries.map(e=>e.ready());void 0!==this.policy.valueProvider&&t.push(this.policy.valueProvider.ready());let i=(await Promise.all(t)).every(ed);return i&&this.calculate(),i})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every(e=>eH(e.container))&&this.calculateCommon(aa.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===F.Manual||e===aa.TS_EVENTSCHANGED||e===aa.TS_LOADING||!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some(e=>!eH(e.container)))return;let i=this.policy.mapper(t.series);if(!(e===aa.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(i)))switch(this.policy.recompute===F.Everything?aa.TS_MANYCHANGED:e){case aa.TS_MANYCHANGED:this.calculate();break;case aa.TS_DATAPOINTCHANGED:case aa.TS_DATAPOINTADDED:this.recalculate(e===aa.TS_DATAPOINTADDED);break;case aa.TS_TIMELINECORRECTION:case aa.TS_QUOTEMARKER:break;default:throw Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.basisChangedToken&&e(ci).unsubscribe(this.basisChangedToken),this.quoteGroupToken&&(e(ci).unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map((t,i)=>t===an.Volume?ef(this.exprSymbols.map(t=>e.inn[t].values[i]??0)):nF(this.exprModel,t=>e.oneValue[t]??e.inn[t]?.values[i]??null))}pickMainField(){let e=null;for(let t of this.policy.fieldMap.values())if(null==e)e=t;else if(t===an.Close){e=t;break}return e}calculateLastChange(){let e=this.container,t=e.size;if(t<=1)return;let i=this.pickMainField(),s=e.getData(i)[t-2],r=e.getData(i)[t-1];eH(s,r)&&e.setLastDataPoint(an.Change,r-s)}calculateDataPoint(e,t){let i=this.calculateAt(e);if(null===i)return;e.atLeastOne=!0;let[s,r]=eM(i,0,3);i[1]=r,i[2]=s,this.targetFields.forEach((e,s)=>{let r=i[s];t?this.container.addDataPoint(e,r):this.container.setLastDataPoint(e,r)}),t&&(this.container.addDataPoint(an.Change,null),this.container.addDataPoint(an.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){eR(e,{series:this,index:this.container.size-1})}fieldValueAt(e,t,i){let s=this.innerLookup[e].container.getData(i);return t<0||t>=s.length?null:s[t]}timeStampAt(e,t){return this.fieldValueAt(e,t,an.DateTime)}timeline(e){return e.container.getData(an.DateTime)}getRangeHelper(){switch(this.policy.missing){case H.UseNext:case H.UseNone:return Math.min;case H.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=>eP(this.timeline(this.innerLookup[e]))))),end:new Date(e(...this.symbols.map(e=>eb(this.timeline(this.innerLookup[e])))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(e,t){let i=this.timeline(this.innerLookup[e]);switch(this.policy.missing){case H.UseNext:case H.UseNone:return i.findIndex(e=>e.valueOf()>=t.valueOf());case H.UsePrevious:return eC(i,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=>!eH(e.timeStamp)&&(!this.policy.stretch(e.symbol)||1===t))}fillPosSymbolAt(e,t,i){e.index=t,e.timeStamp=this.timeStampAt(e.symbol,t);let s=(this.policy.missing===H.UseNone||this.policy.skipLeadingEmpty&&!i.atLeastOne)&&e.timeStamp&&e.timeStamp.valueOf()!==i.timeStamp.valueOf();return e.values=this.sourceFields.map(i=>s?null:this.fieldValueAt(e.symbol,t,i)),e}skippable(e){return!!this.innerLookup[e].container.isEmpty&&(this.policy.noDataApproach===k.IgnoreTimelineOnly&&this.onlyForTimeline.includes(e)||this.policy.noDataApproach===k.ModelTransformRequired)}get symbols(){let e=Object.keys(this.innerLookup);return eH(this.onlyForTimeline)?e.filter(e=>!this.skippable(e)):e}getPos(e){let t={isNull:!0,inn:{},timeStamp:e,atLeastOne:!1,oneValue:{}};return 0===this.symbols.length||(this.symbols.forEach(i=>{let s=this.findIndex(i,e),r={symbol:i,index:-1,timeStamp:new Date(0),values:[]};t.inn[i]=this.fillPosSymbolAt(r,s,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(;eH(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=>null!==e.timeStamp).map(e=>e.timeStamp.valueOf()))),this.policy.missing===H.UsePrevious?this.getInner(e).forEach(t=>{let i=eH(t.timeStamp);(i&&t.timeStamp.valueOf()>e.timeStamp.valueOf()||!i&&this.policy.stretch(t.symbol))&&this.fillPosSymbolAt(t,t.index-1,e)}):this.policy.missing===H.UseNone&&this.getInner(e).forEach(t=>this.fillPosSymbolAt(t,t.index,e))))}shouldAdd(e){return this.container.getLastDataPoint(an.DateTime).valueOf()<e.timeStamp.valueOf()}calculateCommon(e=null,t=null,i=!0){try{if(t)this.calculateDataPoint(t,i);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||(yj(e,"error"),this.crashedComputationReported=!0)}}calculate(){let{yes:e,no:t}=eT(this.innerSeries,e=>!e.container.isEmpty);if(t.length>0&&this.policy.noDataApproach===k.ModelTransformRequired){let i=e=>e.map(this.policy.mapper),s=this.policy.modelTransform(i(e),i(t));null!==s&&(this.exprModel=s)}this.calculateCommon(aa.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;let t=this.getLastPos(),i=this.shouldAdd(t);this.calculateCommon(i?aa.TS_DATAPOINTADDED:aa.TS_DATAPOINTCHANGED,t,i)}recalculateAt(e,t,i){return this.recalculate(i)}makeContainer(){return new lZ([an.DateTime,an.Change].concat(this.targetFields))}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}}let po=cr("_AVG"),pl=cr("_HAO"),pu=cr("_HAH"),ph=cr("_HAL"),pc=cr("_HAC"),pd=cr("_DELTA"),pp=cr("_DIFF"),pf=cr("_RANK"),pm=cr("_CHG"),pg=cr("_AVG"),py=cr("_HBRAKE_CHG"),pT=cr("_HEIGHT_DELTA"),pA=cr("_ACTION"),pS=cr("_REVERSAL"),pv=e=>[e>0,e<0],pb=[null,null,null];function pP([e,t],i){let s=null;if(i>0){let t=this.baseVal(e,i-1);eH(t)&&(s=this.baseVal(e,i)-t)}return{[t.id]:s}}class pC extends cn{useHandbrake;constructor(e,t){super(e,t);let i=fx(e,"MA","Average"),s=i(t,e1(1,999,this.inputs.FastPeriod),an.Close),r=e1(0,999,this.inputs.SlowPeriod),n=r>0,a=n?i(t,r,an.Close):t,o=fv(pp,n?(e,t,i)=>t-i:(e,t,i)=>i-t,s,a),l=fS(pm,eu(pP,[an.Close,pm]),t),u=fS(pf,function(e){let t=Math.abs(this.baseVal(pp,e)),i=null,s=0,r=0;for(let i=e-1;i>=0&&s<200;--i){let e=Math.abs(this.baseVal(pp,i));s++,e<t&&r++}return s>0&&(i=Math.floor(r/s*10)),10===i&&i--,{[pf.id]:i}},o),h=e1(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=h>0;let c=i(t,h,an.Close,pg),d=fS(py,eu(pP,[pg,py]),c);this.addInner(l,o,u,d)}get helpers(){return[pT,an.BARCOLIX,pA,pS]}getStateAt(e){let t=this.innVal(2,pp,e);return eH(t)?pv(t):pb}findPreviousKnownState(e){for(let t=e-1;t>0;t--){let e=this.getStateAt(t);if(e===pb)break;let[i,s]=e;if(i||s)return e}return pb}getBuySell(e){let t=this.getStateAt(e);if(t===pb)return pb;let[i,s]=t,r=this.findPreviousKnownState(e),[n,a]=r;if(!i&&!s)return r===pb?pb:[n,a,!1];let o=i!==n||s!==a;return o?[n,a,o]:[i,s,o]}getPrev(e,t){return t>0?this.container.getData(e)[t-1]:null}calculateAt(e){let t=null,i=null,s=0,r=-1,n=0,[a,o,l]=this.getBuySell(e),[u,h]=[pS,pA].map(t=>this.getPrev(t,e)),[c,d]=[0,-1].map(t=>this.innVal(4,py,e+t));if(r=l?10:this.innVal(3,pf,e),this.useHandbrake&&eH(c,d)){let t=a&&d>0||o&&d<0,i=!a&&c>0||!o&&c<0;l?(r=i?10:12,n=h):(!0===u||1===h)&&(t?(r=this.innVal(3,pf,e),n=2):(r=i?11:13,n=1))}if(eH(this.innVal(2,pp,e))){let t=this.innVal(1,pm,e),[i,r]=pv(t),n=Math.abs(t);(a&&i||o&&r)&&(s=n),(a&&r||o&&i)&&(s=-n)}return a?t=1:o&&(i=1),{[an.JPIB.id]:t,[an.JPIS.id]:i,[an.BARCOLIX.id]:r,[pT.id]:s,[pA.id]:n,[pS.id]:l}}}let pE={FastPeriod:8,SlowPeriod:21,HandbrakePeriod:13,Average:"EMA",Height:"Fixed"},p_=cr("_SMTH_ROC"),pM=cr("_TEN_SMTH_ROC");function pL(e,t,i,s,r){return new cu({source:s,target:r,outFields:[r],aggregation:i,inputs:p9(t)},e,e=>2/e)}let px=cr("_VOL_AVG"),pO=131,pI=(()=>{let e=eF(.9865008210958766,6),t=eL(52,t=>Math.pow(e,t)),i=52/ef(t);return t.map(e=>e*i)})(),pD=["Renko","Kagi","PointAndFigure","LineBreak"];function pw(e){return e===G.Continue||e===G.Nearest}class pR extends cn{additionalChunksCounter=1;noData=!1;isPeriodic=!1;constructor(e,t,i){super(e,i,cs(i,e=>{if(!sF(es[yQ()?.config.mode??"Unspecified"]))return i;let t=e.duplicate(),s=e.aggregation;if(s.hasSpec)if(pw(s.spec))return i;else return new uU(t,!0);let r=s.unit===$.Intraday&&s.size<=5,n=function(e,t){switch(e){case $.Intraday:if(t>=240)return 3;if(t>=120)return 2;return 1;case $.Day:default:return 5;case $.Week:return 15;case $.Month:return 60;case $.Quarter:case $.Year:return 240}}(s.unit,s.size);return t.aggregation=r?new nb($.Tick,s.size,G.PerSeconds):new nb($.Intraday,n),t.barsToFetch=Math.min(tG.MAX_INTRADAY_BARS,(r?1:3)*e.barsToFetch),new uB(t)})),this.isPeriodic=t,this.noData=this.innerSeries[1]instanceof uU,this.computedServerSide=!0,this.initialNotification=!0}get canLoadMoreData(){return!1}loadMoreData(){let e=this.innerSeries[1];return!this.noData&&this.additionalChunksCounter<20&&e.canLoadMoreData&&!e.isLoading?(this.additionalChunksCounter+=1,e.loadMoreData()):Promise.resolve()}recalculateAt(e,t,i){if(e.src!==this.innerSeries[0])return;let s=i?aa.TS_DATAPOINTADDED:aa.TS_DATAPOINTCHANGED;this.notify(s,this.innerSeries[0].container.size-1)}getWrappers(){return[this.wrapInner(an.Change,1),this.wrapInner(an.Open,1),this.wrapInner(an.Close,1)]}}let pN=cr("_EMA1"),pV=cr("_EMA2"),pH=cr("_MACD"),pF=cr("_PCTK"),pk=cr("_PCTD"),pB=cr("_PCTK2"),pU=cr("_EMA1"),pW=cr("_EMA2"),p$=cr("_CORE");class pG extends cn{constructor(e,t){if(super(e,t),fw(t)){let i=["$ADVT","$DECT"];switch(this.inputs.Source){case"TotalStocks":default:break;case"NYSEStocks":i=["$ADVN","$DECN"];break;case"NasdaqStocks":i=["$AVDQ","$DECQ"]}let s=this.getSeries(t.query,i[0]),r=this.getSeries(t.query,i[1]),n=this.getTargetSeries(e,s,r);this.addInner(s,r,n),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=fS(an.Close,(e,t)=>null,t),i=fS(an.Close,(e,t)=>null,t),s=fS(this.target,(e,t)=>null,t);this.addInner(e,i,s),this.canLoadMoreData=!1}}get baseIndex(){return 1}getSeries(e,t){let i=e.duplicate();return i.symbol=t,yQ().getTimeSeriesDataSource().getTimeSeries(i)}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e!==this.innerSeries[0]&&(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)]}}let pz=cr("_INN_HL_ACC_IX"),pY=new nb;class pj extends cn{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof uU)this.canLoadMoreData=!1;else{let s="PriceIndex"===this.inputs.Source?"$MADX":"$FADX",r=this.getSeries(t.query,s);if(this.addInner(r),this.isWeekly=e.aggregation.unit===$.Week,this.isWeekly){var i;let e=(i=this.getSeries(t.query,s,pY),new pj({aggregation:pY,source:null,target:pz,outFields:[pz],inputs:{...this.inputs}},i));this.addInner(e)}this.canLoadMoreData=!0,this.initialNotification=!0}}getSeries(e,t,i){let s=e.duplicate();return s.symbol=t,i&&(s.aggregation=i,s.barsToFetch=15*tG.US_TRADING_DAYS_PER_YEAR),yQ().getTimeSeriesDataSource().getTimeSeries(s)}get baseIndex(){return 1}calculateAt(e){if(this.isWeekly)return this.calculateAtWeekly(e);let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,an.Close);eg(s)&&(t=ef(s))}return{[this.target.id]:t}}calculateAtWeekly(e){let t=this.container?.size??-1,i=null,s=this.innCont(2);if(t>0&&e===t-1)i=s.getLastDataPoint(pz);else{let t=this.container.getTimeData()[e],r=s.getTimeData(),n=e_(r,t),a=r[n],o=null;for(;n<s.size&&np(t,a);)o=n,n+=1,a=r[n];null!==o&&(i=s.getData(pz)[o])}return{[this.target.id]:i}}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e!==this.innerSeries[0]&&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}}let pK=cr("_RSI1"),pq=cr("_RSI1_MOM"),pX=cr("_RSI2"),pZ=cr("_RSI2_MA"),pJ=cr("_MUL_ATR");class pQ extends cn{constructor(e,t){super(e,cs(t,t=>{let i=yQ().getTimeSeriesDataSource();return t.seriesKind=Z.Options,t.fields=e.outFields,i.getTimeSeries(t)})),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return this.outFields.map(e=>this.wrapInner(e,0))}}let p0=cr("_CORE");class p1 extends uB{constructor(e){super(e)}getRetriever(){return tm(this.query.symbol)?new p4:tv(this.query.symbol)?new p5:new p3}}function p2(){return new lZ([an.DateTime,an.Delta,an.Gamma,an.Theta,an.Vega])}class p3{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){return p2()}}class p4 extends uu{emptyContainer(e,t){return p2()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(an.DateTime,lz(e.date.substring(0,10))),i.addDataPoint(an.Delta,e.delta),i.addDataPoint(an.Gamma,e.gamma),i.addDataPoint(an.Theta,e.theta),i.addDataPoint(an.Vega,e.vega)}}class p5 extends uu{emptyContainer(e,t){return p2()}addExtraParams(e){e.fields="delta,gamma,theta,vega"}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){i.addDataPoint(an.DateTime,lz(e.date)),i.addDataPoint(an.Delta,e.delta),i.addDataPoint(an.Gamma,e.gamma),i.addDataPoint(an.Theta,e.theta),i.addDataPoint(an.Vega,e.vega)}}let p6=cr("_RSI1"),p7=cr("_RSI2"),p8={_TR:class extends cn{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=this.baseVal(an.High,e),s=this.baseVal(an.Low,e);if(e>0){let r=this.baseVal(an.Close,e-1);t=Math.max(i-s,Math.abs(i-r),Math.abs(s-r))}else t=i-s;return{[this.target.id]:t}}},_RSI:class extends cn{isModified;constructor(e,t){super(e,t);let i=e.inputs.Modified;this.isModified=i}get helpers(){return[cC,cE]}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,i=null,s=null,r=this.period;if(this.atLeast(e,r+1)){if(null===this.container.getData(this.target)[e-1]||this.isModified){let t=this.past(e,r+1,this.source);if(eg(t)){let e=ey(1,r),n=e.map(e=>this.gain(e,t)),a=e.map(e=>this.loss(e,t));i=em(n),s=em(a)}}else{let t=this.container.getData(cC)[e-1],n=this.container.getData(cE)[e-1],a=this.past(e,2,this.source),o=this.gain(1,a),l=this.loss(1,a);i=(t*(r-1)+o)/r,s=(n*(r-1)+l)/r}null!==i&&null!==s&&(t=100-100/(1+i/s))}return{[cC.id]:i,[cE.id]:s,[this.target.id]:t}}},MA:cl,MAEXP:class extends cu{constructor(e,t){super(e,t,e=>2/(e+1))}},MAHLC:class extends cn{constructor(e,t){super(e,t);let i=fr(t,this.inputs.Period1,an.High,an.MAHI),s=fr(t,this.inputs.Period2,an.Low,an.MALO);this.addInner(i,s)}getWrappers(){return[this.wrapInner(an.MAHI,1),this.wrapInner(an.MALO,2)]}},VOL:class extends ch{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(an.Volume,an.TradeSize,an.Change,an.Open,an.Close)}},MAENV:class extends cf{constructor(e,t){super(e,cc,t)}},MAENVEXP:class extends cf{constructor(e,t){super(e,cd,t)}},MAENVSMO:class extends cf{constructor(e,t){super(e,cp,t)}},MATRI:class extends cn{constructor(e,t){super(e,t);let i=fr(t,this.inputs.Period,this.source),s=fr(i,this.inputs.Period,an.MA,an.TMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(an.TMA,2)]}},MAWEI:class extends cn{triangle;constructor(e,t){super(e,t);let i=this.period;this.triangle=i*(i+1)/2,fC(this)}weightedAverage(e){let t=e.length;if(0===t)return null;let i=t===this.period?this.triangle:t*(t+1)/2;return e.reduce((e,t,i)=>e+t*(i+1),0)/i}calculateAt(e){let t=null,i=this.period,[,s]=fE(this);if(this.atLeast(e,i)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=this.weightedAverage(r.filter(ep)):eg(r)&&(t=this.weightedAverage(r))}return{[this.target.id]:t}}},MAVOL:cl,MASMO:class extends cu{constructor(e,t){super(e,t,e=>1/e)}},MACD:class extends cP{constructor(e,t){super(e,cg,t)}},MACDEXP:class extends cP{constructor(e,t){super(e,cy,t)}},MACDV:class extends cb{constructor(e,t){super(e,t),this.histogramVaryColor=!0,this.histogramField=an.MACDVH;let i=fx(e,"EMA","Average"),s=i(t,e.inputs.Period1,e.source,void 0),r=i(t,e.inputs.Period2,e.source,void 0),n=fp(t,e.inputs.Period2,e.inputs.Average),a=fv(an.MACDV,(e,t,i,s)=>(t-i)/s*100,s,r,n),o=i(a,e.inputs.Period3,a.target,an.MACDVS),l=fv(an.MACDVH,fb,a,o);this.addInner(a,o,l)}getWrappers(){return[this.wrapInner(an.MACDV,1),this.wrapInner(an.MACDVS,2),this.wrapInner(an.MACDVH,3)]}},GMMA:class extends cn{constructor(e,t){super(e,t);for(let r=1;r<=12;++r){var i,s;let n=(i=e.inputs,s=r,i[`Period${s}`]);this.addInner(fn(t,n,an.Close,e.outFields[r-1]))}}getWrappers(){return ey(1,12).map(e=>this.wrapInner(this.outFields[e-1],e))}},OSCI:cm,OSCIVOL:cm,RSI:class extends c_{constructor(e,t){super(e,!1,t)}},RSIMOD:class extends c_{constructor(e,t){super(e,!0,t)}},RSISTO:class extends cn{constructor(e,t){super(e,t);let i=fg(t,this.inputs.Period,this.source),s=this.inputs.Range,r=fS(an.STORSI,function(e){let t=null;if(this.atLeast(e,s)){let i=this.past(e,s,an.RSI,this.base),r=eM(i),n=r[0],a=r[1];t=(eb(i)-n)/(a-n)}return{[an.STORSI.id]:t}},i),n=fx(e,"MA","Average")(r,this.inputs.PeriodAvg,an.STORSI,an.STORSIAVG);this.addInner(r,n)}getWrappers(){return[this.wrapInner(an.STORSI,1),this.wrapInner(an.STORSIAVG,2)]}},RSA:class extends cn{constructor(e,t){super(e,t);let i=fg(t,this.inputs.Period1,this.source,p6),s=fg(t,this.inputs.Period2,this.source,p7),r=fv(an.RSA,(e,t,i)=>(t+i)/2,i,s),n=fx(e,"MA","Average")(r,this.inputs.PeriodAvg,an.RSA,an.RSAAVG);this.addInner(r,n)}getWrappers(){return[this.wrapInner(an.RSA,1),this.wrapInner(an.RSAAVG,2)]}},WPERCR:class extends cL{constructor(e,t){super(e,!0,t)}},HHLL:class extends cn{constructor(e,t){super(e,t);let i=fu(t,this.inputs.Period1,an.High,an.HH,!0),s=fu(t,this.inputs.Period2,an.Low,an.LL,!1);this.addInner(i,s)}getWrappers(){return[this.wrapInner(an.HH,1),this.wrapInner(an.LL,2)]}},WGCL:class extends cn{constructor(e,t){super(e,t)}calculateAt(e){let t=null,[i,s,r]=[an.Close,an.High,an.Low].map(t=>this.baseVal(t,e));return t=(2*i+s+r)/4,{[this.target.id]:t}}},STOCHF:class extends cO{constructor(e,t){super(e,!1,an.PercK,t)}},STOCHS:class extends cO{constructor(e,t){super(e,!0,an.PercK,t)}},BBANDS:class extends cI{constructor(e,t){super(e,"Regular",t)}},BWIDTH:class extends cI{constructor(e,t){super(e,"Width",t)}},BPERC:class extends cI{constructor(e,t){super(e,"Percent",t)}},OBVOL:class extends cn{constructor(e,t){super(e,t);let i=fS(an.OBVOL,function(e){let t=null;if(e>0){let i=this.baseVal(an.Close,e),s=this.baseVal(an.Volume,e),r=this.baseVal(an.Close,e-1),n=this.container.getData(this.target)[e-1];eH(n)||(n=0),t=i>r?n+s:i<r?n-s:n}return{[this.target.id]:t}},t),s=fx(e,"MA","Average")(i,this.period,an.OBVOL,an.OBVOLAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(an.OBVOL,1),this.wrapInner(an.OBVOLAVG,2)]}},ATR:class extends cn{constructor(e,t){super(e,t);let i=fd(t,an.TR),s=fx(e,"SMA")(i,this.inputs.Period,an.TR,this.target),r=fr(s,this.inputs.Period2,an.ATR,an.ATRMA);this.addInner(s,r)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(an.ATRMA,2)]}},ATRP:class extends cn{constructor(e,t){super(e,t);let i=fp(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(1,an.ATR,e),s=this.baseVal(an.Close,e);return eH(i,s)&&s>0&&(t=i/s*100),{[an.ATRP.id]:t}}},ADX:class extends cU{constructor(e,t){super(e,!1,an.ADX,t)}},ADXMOD:class extends cU{constructor(e,t){super(e,!0,an.ADXM,t)}},ADL:class extends cn{constructor(e,t){super(e,t);let i=fy(t);this.addInner(i)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,an.MFMUL,e),{[this.target.id]:t}}},ADWM:class extends cn{constructor(e,t){super(e,t);let i=fS(an.ADWM,function(e){let t=null,i=null;if(e>0){let s=this.baseVal(an.Close,e-1),r=Math.max(s,this.baseVal(an.High,e)),n=Math.min(s,this.baseVal(an.Low,e)),a=this.baseVal(an.Close,e);t=a>s?a-n:a<s?a-r:0,e>1&&(i=(e>2?this.container.getData(an.ADWM)[e-1]:0)+t)}return{[an.ADWM.id]:i}},t),s=fr(i,this.inputs.Period,an.ADWM,an.ADWMMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(an.ADWM,1),this.wrapInner(an.ADWMMA,2)]}},CHAOSC:class extends cn{constructor(e,t){super(e,t);let i=an.ADL,s=function(e,t=an.ADL){return ft("ADL",fe(t),e)}(t,i),r=fn(s,3,i),n=fn(s,10,i),a=fv(e.target,(e,t,i)=>t-i,r,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},TP:class extends cn{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=em([an.Close,an.High,an.Low].map(t=>this.baseVal(t,e))),{[this.target.id]:t}}},KELCHN:class extends cX{constructor(e,t){super(e,cK,t)}},KELBND:class extends cX{constructor(e,t){super(e,cq,t)}},DONCHN:class extends cZ{constructor(e,t){super(e,!1,t)}},DONWIDTH:class extends cZ{constructor(e,t){super(e,!0,t)}},PVT:class extends cn{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){let i=this.baseVal(an.Close,e),s=this.baseVal(an.Volume,e),r=this.baseVal(an.Close,e-1),n=this.container.getData(this.target)[e-1];eH(n)||(n=0),t=n+(i-r)/r*s}return{[this.target.id]:t}}},ROC:class extends cn{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i+1)){let s=this.baseVal(this.source,e-i);null!==s&&0!==s&&(t=(this.baseVal(this.source,e)-s)/s*100)}return{[this.target.id]:t}}},TRIX:class extends cn{constructor(e,t){super(e,t);let i=fn(t,this.inputs.Period,this.source),s=fn(i,this.inputs.Period,i.target),r=fn(s,this.inputs.Period,s.target),n=fm(r,1,r.target,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},PPMOV:class extends cn{constructor(e,t){super(e,t);let i=ff(t,an.PVPT);this.addInner(i)}calculateAt(e){let t=this.innVal(1,an.PVPT,e),i=this.baseVal(an.High,e),s=this.baseVal(an.Low,e);return{[an.PVPTR.id]:t+i-s,[an.PVPTS.id]:t-i+s}}getWrappers(){return[this.wrapInner(an.PVPT,1)]}},PIVPTS:class extends dE{constructor(e,t){super(e,dC[e.inputs.Previous],t)}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=null;if(!this.disabled){let e=this.getValues(this.inputs.Previous);if(eg(e)){let[l,u,h]=e,c=2*(t=(l+u+h)/3);i=c-u,s=c-l;let d=l-u;r=t+d,n=t-d,a=l+2*(t-u),o=u-2*(l-t)}}return{[an.PPTPIV.id]:t,[an.PPTR1.id]:i,[an.PPTR2.id]:r,[an.PPTR3.id]:a,[an.PPTS1.id]:s,[an.PPTS2.id]:n,[an.PPTS3.id]:o}}},CPP:class extends dE{constructor(e,t){super(e,dC.Day,t)}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=null,l=null;if(!this.disabled){let e=this.getValues("Day");if(eg(e)){let[u,h,c]=e,d=u-h,[p,f,m,g]=[2,4,6,12].map(e=>1.1/e*d);o=c+p,n=c+f,s=c+m,t=c+g,i=c-g,r=c-m,a=c-f,l=c-p}}return{[an.CPPH4.id]:o,[an.CPPH3.id]:n,[an.CPPH2.id]:s,[an.CPPH1.id]:t,[an.CPPL1.id]:i,[an.CPPL2.id]:r,[an.CPPL3.id]:a,[an.CPPL4.id]:l}}},ARNUPDW:class extends c0{constructor(e,t){super(e,!1,t)}},ARNOSC:class extends c0{constructor(e,t){super(e,!0,t)}},TCHN:class extends cn{constructor(e,t){super(e,t);let i="Close"===e.inputs.Range,s=fD(t);if(!i&&s){let e=fS(an.TCHNUP,(e,t)=>null,t),i=fS(an.TCHNLOW,(e,t)=>null,t);this.addInner(e,i)}else{let s=fu(t,e.inputs.PeriodUpper,i?an.Close:an.High,an.TCHNUP,!0),r=fu(t,e.inputs.PeriodLower,i?an.Close:an.Low,an.TCHNLOW,!1);this.addInner(s,r)}}getWrappers(){return[this.wrapInner(an.TCHNUP,1),this.wrapInner(an.TCHNLOW,2)]}},TCHRE:class extends cn{constructor(e,t){super(e,t);let i=function(e,t,i){let s="TCHN",r=fi(s);return ft(s,{inputs:{PeriodUpper:t,PeriodLower:t,Range:i},outFields:r,source:null},e)}(t,e.inputs.Period,e.inputs.Range);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(1,an.TCHNUP,e),s=this.innVal(1,an.TCHNLOW,e),r=this.inputs.Adjustment,n=this.inputs.Retracement;return"Long"===n?t=eH(i)?i-r:null:"Short"===n&&(t=eH(s)?s+r:null),{[this.target.id]:t}}},ALLG:class extends cn{constructor(e,t){super(e,t);let i=fS(c1,eu(c$,c1),t),s=fa(i,e.inputs.Period1,c1,an.ALJAW),r=fa(i,e.inputs.Period2,c1,an.ALTEETH),n=fa(i,e.inputs.Period3,c1,an.ALLIPS);this.addInner(s,r,n)}calculateAt(e){return{[an.ALJAW.id]:this.innVal(1,an.ALJAW,e),[an.ALTEETH.id]:this.innVal(2,an.ALTEETH,e),[an.ALLIPS.id]:this.innVal(3,an.ALLIPS,e)}}},PLTLN:class extends cn{constructor(e,t){super(e,t)}calculateAt(e){return{[an.PLTLN.id]:this.inputs.Position}}},AWEOSC:class extends cn{constructor(e,t){super(e,t);let i=fS(c2,eu(c$,c2),t),s=fr(i,this.inputs.Period1,c2),r=fr(i,this.inputs.Period2,c2),n=fv(an.AWOS,(e,t,i)=>t-i,s,r),a=fr(n,this.inputs.Period3,n.target,an.AWOSMA);this.addInner(n,a)}getWrappers(){return[this.wrapInner(an.AWOS,1),this.wrapInner(an.AWOSMA,2)]}},MFV:class extends c3{constructor(e,t){super(e,!0,t)}},CLV:class extends c3{constructor(e,t){super(e,!1,t)}},CHAMF:class extends cn{constructor(e,t){super(e,t);let i=fy(t);this.addInner(i)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,an.Volume),r=this.past(e,i,an.MFMUL,this.innCont(1));if(eg(s)&&eg(r)){let e=ef(s);0!==e&&(t=ef(r)/e)}}return{[this.target.id]:t}}},CHAVOL:class extends cn{constructor(e,t){super(e,t);let i=fm(fn(fS(c4,eu(cG,c4),t),this.inputs.Period1,c4),this.inputs.Period2,an.EMA,this.target);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},DPO:class extends cn{shift;constructor(e,t){super(e,t);let i=this.inputs.Period;this.shift=Math.floor(i/2)+1;let s=fr(t,i,e.source);this.addInner(s)}calculateAt(e){let t=null,i=this.shift,s=this.innVal(1,an.MA,e-i);return null!==s&&(t=this.baseVal(this.source,e)-s),{[this.target.id]:t}}},CCI:class extends cn{constructor(e,t){super(e,t);let i=ff(t),s=fr(i,this.inputs.Period,i.target,c5);this.addInner(i,s)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,an.TP,this.innCont(1));if(eg(s)){let i=this.innVal(2,c5,e);if(null!==i){let r=s.reduce((e,t,s)=>e+Math.abs(i-t),0)/this.period;t=(this.innVal(1,an.TP,e)-i)/(.015*r)}}}return{[this.target.id]:t}}},EMV:class extends cn{constructor(e,t){super(e,t);let i=fS(an.EMV,function(e){let t=null;if(e>0){let[i,s,r]=[an.High,an.Low,an.Volume].map(t=>this.baseVal(t,e)),[n,a]=[an.High,an.Low].map(t=>this.baseVal(t,e-1));t=((i+s)/2-(n+a)/2)/(r/1e6/(i-s))}return{[this.target.id]:t}},t),s=fr(i,this.inputs.Period,an.EMV,an.EMVMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(an.EMV,1),this.wrapInner(an.EMVMA,2)]}},ERBRPOW:class extends c6{constructor(e,t){super(e,!1,t)}},ERBLPOW:class extends c6{constructor(e,t){super(e,!0,t)}},FI:class extends cn{constructor(e,t){super(e,t);let i=fn(fS(c7,function(e){let t=null;if(e>0){let i=this.baseVal(an.Close,e),s=this.baseVal(an.Volume,e);t=(i-this.baseVal(an.Close,e-1))*s}return{[this.target.id]:t}},t),this.inputs.Period,c7,an.FI);this.addInner(i)}getWrappers(){return[this.wrapInner(an.FI,1)]}},MI:class extends cn{constructor(e,t){super(e,t);let i=fn(fS(c8,eu(cG,c8),t),9,c8,c9),s=fn(i,9,c9,de),r=fv(dt,(e,t,i)=>t/i,i,s);this.addInner(r)}calculateAt(e){let t=null;if(this.atLeast(e,25)){let i=this.past(e,25,dt,this.innCont(1));eg(i)&&(t=ef(i))}return{[this.target.id]:t}}},MOM:class extends cn{constructor(e,t){super(e,t);let i=this.inputs.Period,s=fS(an.MOM,eh(fM,i,an.Close),t),r=fr(s,this.inputs.Movement,an.MOM,an.MOMMA);this.addInner(s,r)}getWrappers(){return[this.wrapInner(an.MOM,1),this.wrapInner(an.MOMMA,2)]}},MFI:class extends cn{constructor(e,t){super(e,t);let i=ff(t);this.addInner(i)}calculateAt(e){let t=null,i=this.period+1;if(this.atLeast(e,i)){let s=this.past(e,i,an.TP,this.innCont(1)),r=this.past(e,i,an.Volume).map(e=>null!=e?e:0);if(eg(s)&&eg(r)){let e=0,n=0;for(let t=1;t<i;++t){let i=s[t]*r[t];s[t]>s[t-1]?e+=i:n+=i}t=100-100/(1+e/n)}}return{[this.target.id]:t}}},MSD:class extends cn{constructor(e,t){super(e,t),fC(this);let i=fr(t,this.inputs.Period,this.source);this.addInner(i)}calculateAt(e){let t=null,[i,s]=fE(this),r=this.innVal(i+1,an.MA,e);if(null!==r){let i=this.inputs.Period,n=this.past(e,i,this.source,s);t=Math.sqrt(em(n=n.map(e=>(e-r)*(e-r))))}return{[this.target.id]:t}}getWrappers(){let[e]=fE(this);return[this.wrapInner(an.MA,e+1)]}},NVI:class extends dr{constructor(e,t){super(e,ds,t)}},PVI:class extends dr{constructor(e,t){super(e,di,t)}},PPO:class extends cP{constructor(e,t){super(e,cS,t)}},PVO:class extends cP{constructor(e,t){super(e,cv,t)}},HV:class extends cn{constructor(e,t){super(e,t);let i=Math.sqrt(fI(e.aggregation));if(0===i){let e=fS(this.target,(e,t)=>null,t);this.addInner(e)}else{let s=fT(fS(dn,eu(function(e,t){let i=null;if(t>0){let s=this.baseVal(e,t),r=this.baseVal(e,t-1);null!==s&&null!==r&&(i=Math.log(s/r))}return{[dn.id]:i}},an.Close),t),e.inputs.Period,dn,an.MSD),r=fS(an.HV,eu(function(e,t){let i=null,s=this.baseVal(an.MSD,t);return null!==s&&(i=100*s*e),{[an.HV.id]:i}},i),s);this.addInner(r)}}getWrappers(){return[this.wrapInner(this.target,1)]}},PERF:class extends cn{noOp;constructor(e,t){super(e,t);let i="VisibleStart"===this.inputs.Anchor;this.noOp=i}calculateAt(e){let t=null,i=this.baseVal(this.source,0),s=this.baseVal(this.source,e);return this.noOp?t=s:null!==i&&null!==s&&(t=(s-i)/i*100),{[this.target.id]:t}}},WASI:class extends cn{constructor(e,t){super(e,t)}get helpers(){return[da]}ohlcVals(e){return[an.Open,an.High,an.Low,an.Close].map(t=>this.baseVal(t,e))}obtainR(e,t,i,s){let r=Math.abs(e-s),n=Math.abs(t-s),a=Math.abs(e-t),o=Math.max(r,n,a),l=.25*Math.abs(s-i);return o===r?r-.5*n+l:o===n?n-.5*r+l:a+l}calculateAt(e){let t=null,i=null;if(e>0){let s=this.container.getData(da)[e-1];eH(s)||(s=0);let[r,n,a,o]=this.ohlcVals(e),[l,u,h,c]=this.ohlcVals(e-1);if(eg([r,n,a,o,l,c])){let e=Math.max(Math.abs(n-c),Math.abs(a-c)),u=this.inputs.Limit,h=this.obtainR(n,a,l,c);i=s+(t=(o-c+.5*(o-r)+.25*(c-l))/h*50*(e/u))}}return{[da.id]:t,[this.target.id]:i}}},WWVOL:class extends cn{constructor(e,t){super(e,t);let i=fp(t,e.inputs.Period);this.addInner(i)}get helpers(){return[du,dl]}calculateAt(e){let t=null,i=null,s=null,r=null,n=this.innVal(1,an.ATR,e);if(null!==n){let a=this.baseVal(an.Close,e),o=this.baseVal(an.Close,e-1),l=this.period;s=Math.max(...this.past(e,l,an.Close)),r=Math.min(...this.past(e,l,an.Close));let u=n*this.inputs.Constant;if(null===this.innVal(1,an.ATR,e-1))a>o?t=s-u:i=r+u;else{let[n,o,l,h]=[an.WWVSARU,an.WWVSARD,du,dl].map(t=>this.container.getData(t)[e-1]);s=l,r=h,null!==n?a<n?(r=a,i=a+u):t=(s=Math.max(a,s))-u:a>o?(s=a,t=a-u):i=(r=Math.min(a,r))+u}}return{[du.id]:s,[dl.id]:r,[an.WWVSARU.id]:t,[an.WWVSARD.id]:i}}},PARTP:class extends cn{constructor(e,t){super(e,t)}get helpers(){return[dh,dc,dd]}hlcVals(e){return[an.High,an.Low,an.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,i=null,s=null,r=null,n=null,a=null;if(e>0){let[o,l,u]=this.hlcVals(e),[h,c,d]=this.hlcVals(e-1),p=this.reciprocal(this.inputs.Acceleration),f=this.reciprocal(this.inputs.Limit);if(1===e){let e=1==(n=u>d?1:-1);a=e?c:h,s=e?Math.max(o,h):Math.min(l,c),r=p,e?t=a:i=a}else{let[u,d,m,g,y]=[dd,an.PARSARS,an.PARSARL,dh,dc].map(t=>this.me(t,e-1)),T=1===u,A=T?m:d,S=y*Math.abs(g-A),v=u===(n=T?A+S>l?-1:1:A-S<o?1:-1);a=v?T?Math.min(A+S,c,this.baseVal(an.Low,e-2)):Math.max(A-S,h,this.baseVal(an.High,e-2)):g,s=v?T?Math.max(o,g):Math.min(l,g):1===n?o:l,r=y,v?(T?s>g:s<g)&&y<f&&(r=y+p):r=p,1===n?t=a:i=a}}return{[dh.id]:s,[dc.id]:r,[dd.id]:n,[an.PARSARS.id]:i,[an.PARSARL.id]:t}}},MOVLR:class extends cn{xSum;xSum2;x2Sum;constructor(e,t){super(e,t);let i=this.period;this.xSum=i*(i+1)/2,this.xSum2=this.xSum*this.xSum,this.x2Sum=i*(i+1)*(2*i+1)/6}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,this.source);if(eg(s)){let e=ef(s),r=(i*ef(s.map((e,t)=>e*(t+1)))-this.xSum*e)/(i*this.x2Sum-this.xSum2);t=(e-r*this.xSum)/i+r*i}}return{[this.target.id]:t}}},TRSP:class extends cn{haveEnoughData=!1;firstUsefulIndex=0;s3;itr;constructor(e,t){super(e,t),this.s3=this.itr=[];let i=["VelocityUpTrend","VelocitySideTrend","VelocityDownTrend"].map(t=>e.inputs[t]||"3").map(Number);df.splice(6,3,...i)}get helpers(){return[dp]}prepareComputation(){let e=this.base.getData(an.Close),t=0,i=0,s=e.length;for(;i<72&&t<s;)null!=e[t]&&i++,t++;this.haveEnoughData=t<s,this.firstUsefulIndex=t,this.s3=dm(s),this.itr=dm(s),this.haveEnoughData&&dy(e,this.s3,s)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,i){let s=this.base.getData(an.Close),r=s.length;this.haveEnoughData&&dy(s,this.s3,r),super.recalculateAt(e,t,i)}calculateAt(e){let t=null,i=null,s=null,r=t=>this.us(t,e-1);if(0===e)this.prepareComputation();else if(this.haveEnoughData&&e>=this.firstUsefulIndex&&null!==this.baseVal(an.Close,e)){let n=r(an.TRSP1),a=r(an.TRSP2);s=r(dp),null===n&&null===a&&(n=a=this.baseVal(an.Close,this.firstUsefulIndex)),null===s&&(s=1);let o=this.base.getData(an.Close);s=function(e,t,i,s,r,n){let a=i;do a--;while(e[a]<=0)return t[i]=t[a],e[i]>r&&t[a]<=0&&(t[i]=t[a]+1),e[i]<s&&t[a]>=0&&(t[i]=t[a]-1),n++,t[i]!==t[a]&&(n=1),n}(o,this.itr,e,n,a,s);let l=function(e,t,i,s,r){let n=s,a=dg(r,i[s],7),o=0;do e[--n]>0&&o++;while(o<a&&n>0)return t[s]-t[n]}(o,this.s3,this.itr,e,df),u=function(e,t,i,s,r){let n=r[18],a=s+1,o=0;for(let i=0;i<n;++i){let i=0,s=0;for(let r=1;r<6;++r){if(e[--a]<=0)continue;let n=e[a]-t[a];1==r&&(i=s=n),n>i&&(i=n),n<s&&(s=n)}o=o+i-s}return o/n*dg(r,i[s],4)}(o,this.s3,this.itr,e,df);[n,a]=function(e,t,i,s,r,n,a,o,l,u){let h=dg(r,i[s],10),c=dg(r,i[s],13),d=dg(r,i[s],16),p=l+u+t[s]-e[s],f=100;r[20]>0&&(f=r[20]);let m=h*o/f;o>c&&(m=h*c/f);let g=2*u,y=e[s]+(p-g)-(p-g)*m,T=e[s]+(p-p*m),A=[n,a];return(1===o||1!==d||y>n)&&(A[0]=y),(1===o||1!==d||T<a)&&(A[1]=T),A}(o,this.s3,this.itr,e,df,n,a,s,l,u),this.itr[e]>=0&&(t=n),this.itr[e]<=0&&(i=a)}return{[dp.id]:s,[an.TRSP1.id]:t,[an.TRSP2.id]:i}}},COTLC:dP,COTDAG:class extends dA{constructor(e,t){super(e,2,t)}},COTFTR:class extends dA{constructor(e,t){super(e,3,t)}},IMPVOL:class extends cn{constructor(e,t){super(e,cs(t,e=>new d_(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(an.IMPVOL,0)]}},CTM:class extends cP{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,cT,t)}},CPMI:class extends cP{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,cA,t)}},DEMA:class extends cn{constructor(e,t){super(e,t);let i=fn(t,this.inputs.Period,this.source),s=fn(i,this.inputs.Period,i.target),r=fv(an.DEMA,(e,t,i)=>2*t-i,i,s);this.addInner(r)}getWrappers(){return[this.wrapInner(an.DEMA,1)]}},TEMA:class extends cn{constructor(e,t){super(e,t);let i=fn(t,this.inputs.Period,this.source),s=fn(i,this.inputs.Period,i.target),r=fn(s,this.inputs.Period,s.target),n=fv(an.TEMA,(e,t,i,s)=>3*(t-i)+s,i,s,r);this.addInner(n)}getWrappers(){return[this.wrapInner(an.TEMA,1)]}},TSI:class extends cn{constructor(e,t){super(e,t);let i=(e,t,i,s,r,n)=>{let a=fn(e,t,i,s);return fn(a,r,s,n)},s=fS(dI,eu((e,t)=>({[e.id]:Math.abs(this.baseVal(an.Change,t))}),dI),t),r=i(t,e.inputs.Period1,an.Change,dD,e.inputs.Period2,dw),n=i(s,e.inputs.Period1,dI,dR,e.inputs.Period2,dN),a=fv(an.TSI,(e,t,i)=>100*t/i,r,n),o=fn(a,e.inputs.Period3,an.TSI,an.TSISIG);this.addInner(a,o)}getWrappers(){return[this.wrapInner(an.TSI,1),this.wrapInner(an.TSISIG,2)]}},ADJATR:class extends cn{constructor(e,t){super(e,t);let i=(e,t)=>{let i=0;return t>0&&(i=this.baseVal(e,t)-this.baseVal(e,t-1)),{[cD.id]:Math.abs(i)}},s=fS(cD,eu(i,this.source),t),r=fx(e,"MA")(s,this.inputs.Period,cD,cw),n=fv(an.ADJATR,(e,t)=>2*t,r);this.addInner(n)}getWrappers(){return[this.wrapInner(an.ADJATR,1)]}},COTR:class extends cn{constructor(e,t){super(e,t);let i=e=>{let t=0;return e>0&&(t=this.baseVal(an.Close,e)-this.baseVal(an.Close,e-1)),{[cR.id]:t}},s=fS(cR,i,t),r=fO[e.inputs.TypeOfATR.toLowerCase()],n=r(t,this.inputs.Period,this.inputs.Smoothing),a=fv(this.target,(e,t,i)=>eH(t)&&eH(i)?t/i:null,s,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCGD:class extends cn{constructor(e,t){super(e,t);let i=fn(t,this.inputs.Period,an.Close);this.addInner(i)}calculateAt(e){let t=null,i=e>0?this.container.getData(this.target)[e-1]:null,s=this.innVal(1,an.EMA,e);if(eV(i)){let r=this.baseVal(this.source,e),n=Math.pow(r/i,4);t=i+(r-i)/(.6*this.period*n);let a=e=>Math.log10(Math.abs(e-t))>1,o=a(i)||a(s);(!Number.isFinite(t)||o)&&(t=null)}else t=s;return{[this.target.id]:t}}},HMA:class extends cn{constructor(e,t){super(e,t);let i=this.inputs.Period,s=Math.floor(i/2),r=this.allowEmptyValues,n=fo(t,s,this.source,an.WMA,r),a=fv(dV,(e,t,i)=>2*t-i,n,fo(t,i,this.source,an.WMA,r)),o=fo(a,Math.floor(Math.sqrt(i)),dV,this.target,r);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},COPP:class extends cn{constructor(e,t){super(e,t);let i=fm(t,this.inputs.PeriodRocLong),s=fo(fv(dH,(e,t,i)=>t+i,i,fm(t,this.inputs.PeriodRocShort)),this.inputs.PeriodWma,dH,this.target);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}},REATRHI:class extends dU{constructor(e,t){super(e,!0,t)}},REATRLO:class extends dU{constructor(e,t){super(e,!1,t)}},LINRCHN:class extends cn{constructor(e,t){super(e,t);let i=this.inputs.Period,s=fS(an.LINRMID,eu(function(e,t){let i=null;if(t>=this.base.size-e){let s=e*(e+1)/2,r=0,n=0,a=1;for(let t=e-1;t>=0;--t){let e=this.baseVal(an.Close,this.base.size-1-t);r+=e,n+=a*e,a+=1}let o=(e*n-s*r)/(e*(e+1)*(2*e+1)/6*e-s*s);i=r/e-o*s/e+o*(t-this.base.size+e+1)}return{[an.LINRMID.id]:i}},i),t),r=fT(fv(dW,(e,t,i)=>t-i,fS(this.source,function(e){return{[this.target.id]:this.baseVal(this.target,e)}},t),s),i,dW);this.addInner(s,r)}calculateAt(e){let t=this.innVal(1,an.LINRMID,e),i=eb(this.innCont(2).getData(an.MSD)),s=null,r=null;if(eH(t,i)){let e=this.inputs.Width;s=t+e*i,r=t-e*i}return{[an.LINRUP.id]:s,[an.LINRLOW.id]:r}}getWrappers(){return[this.wrapInner(an.LINRMID,1)]}},CSHO:class extends cn{computeDone;constructor(e,t){super(e,t,cs(t,e=>{var t,i;let s=eG(e);return s.symbol=tg(t=e.symbol)?`${tg(i=t)?tc(i).root:null}Y00`:null,eH(s.symbol)?new uB(s):new uU(s,!0)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){let e=this.innCont(0);if(!eH(e)||0===e.size)return;let t=this.innCont(1),i=e.getTimeData(),s=t.getTimeData(),r=t.getData(an.Close),n=Array(i.length).fill(null);if(!(this.innerSeries[1]instanceof uU)){let a=0,o=e.size,l=t.size;for(let e=0;e<o;++e){for(;a<l&&s[a].getTime()<i[e].getTime();)a++;a<l&&s[a].getTime()===i[e].getTime()&&(n[e]=r[a])}}this.container.setData(this.target,n)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignCashTimelineWithUnderlying(),this.computeDone=!0,this.notify(aa.TS_MANYCHANGED,-1))}},CSHB:class extends cn{constructor(e,t){super(e,t,function(e,t=an.CSHO){return ft("CSHO",fe(t),e)}(t))}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e===this.innerSeries[1]&&this.innHasData(0)&&this.innHasData(1)}calculateAt(e){let t=(t,i)=>eH(this.innCont(t))?this.innVal(t,i,e):null,i=t(0,an.Close),s=t(1,an.CSHO);return{[this.target.id]:eH(s)&&eH(i)?s-i:null}}},CTPI:class extends cO{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,an.CTPI,t)}},PCTCHG:class extends cn{constructor(e,t){super(e,t),fC(this)}calculateAt(e){let t=null,[i]=fE(this);if(e>0){let s=this.innVal(i,this.source,e-1);null!==s&&(t=100*(this.innVal(i,this.source,e)-s)/s)}return{[this.target.id]:t}}},OPINT:class extends ch{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(an.TradeSize,an.Change)}},STOMOMIX:class extends cn{constructor(e,t){super(e,t);let i=fu(t,e.inputs.Period1,an.High,an.HH,!0),s=fu(t,e.inputs.Period1,an.Low,an.LL,!1),r=fn(fv(dG,(e,t,i)=>this.baseVal(an.Close,e)-(t+i)/2,i,s),e.inputs.Period2,dG,dz),n=fn(r,e.inputs.Period2,dz,dY),a=fn(fv(dj,(e,t,i)=>t-i,i,s),e.inputs.Period2,dj,dK),o=fn(a,e.inputs.Period2,dK,dq),l=fv(an.STOMOMIX,(e,t,i)=>100*t/i,n,o);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},CHDMOMOSC:class extends cn{constructor(e,t){super(e,t);let i=new dQ(e,t),s=fx(e,"MA","Average")(i,this.inputs.PeriodAvg,an.CHDMOMOSC,an.CHDMOMOSCAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(an.CHDMOMOSC,1),this.wrapInner(an.CHDMOMOSCAVG,2)]}},VSTOP:class extends cn{constructor(e,t){super(e,t);let i=fp(t,e.inputs.Period);this.addInner(i)}get helpers(){return[d0,d1,d2]}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=1,l=this.baseVal(an.Close,e),u=e=>eH(e)?e:0,h=(e,t)=>this.container.getData(e)[t];e>0&&(s=Math.max(u(h(d0,e-1)),l),n=Math.min(u(h(d1,e-1)),l),o=h(d2,e-1));let c=this.inputs.Multiplier,d=this.innVal(1,an.ATR,e);if(eH(d)){let u=1===o,p=u?s-c*d:n+c*d,f=h(u?an.VSTOPUP:an.VSTOPLOW,e-1);eH(f)||(f=0);let m=u?Math.max(f,p):Math.min(f,p),g=(a=+(l-m>=0))!=o;i=g?l:s,r=g?l:n,t=g?1===a?i-c*d:r+c*d:m}return{[an.VSTOPUP.id]:1===a?t:null,[an.VSTOPLOW.id]:1===a?null:t,[d0.id]:i,[d1.id]:r,[d2.id]:a}}},SUPTR:class extends cn{constructor(e,t){super(e,t);let i=fp(t,e.inputs.Period);this.addInner(i)}get helpers(){return[d3,d4,d5,an.BARCOLIX]}calculateAt(e){let t=0,i=0,s=0,r=null,n=0,a=this.innVal(1,an.ATR,e);if(eH(a)){let[o,l,u]=[an.Close,an.High,an.Low].map(t=>this.baseVal(t,e)),h=(l+u)/2,c=this.baseVal(an.Close,e-1),d=this.inputs.Multiplier,p=h-d*a,f=h+d*a,[m,g,y]=[d3,d4,d5].map(t=>this.container.getData(t)[e-1]);t=c>m?Math.max(p,m):p,i=c<g?Math.min(f,g):f;let T=1===(s=o>g?1:o<m?-1:eH(y)?y:1);r=T?t:i,n=+!!T}return{[d3.id]:t,[d4.id]:i,[d5.id]:s,[an.SUPTR.id]:r,[an.BARCOLIX.id]:n}}},ICHCLD:class extends cn{constructor(e,t){super(e,t);let i=(e,t,i)=>fv(i,(e,t,i)=>(t+i)/2,e,t),s=(e,s)=>i(fu(t,e,an.Low,an.LL,!1),fu(t,e,an.High,an.HH,!0),s),r=s(e.inputs.PeriodConversionLine,an.CONVLN),n=s(e.inputs.PeriodBaseLine,an.BASELN),a=i(r,n,an.LEADSP1),o=s(e.inputs.PeriodLaggingSpan2,an.LEADSP2);this.addInner(r,n,a,o)}get helpers(){return[an.BARCOLIX]}calculateAt(e){let t=+(this.innVal(3,an.LEADSP1,e)>this.innVal(4,an.LEADSP2,e));return{[an.LAGGSP.id]:this.baseVal(an.Close,e),[an.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(an.CONVLN,1),this.wrapInner(an.BASELN,2),this.wrapInner(an.LEADSP1,3),this.wrapInner(an.LEADSP2,4)]}},VWAP:class extends d9{constructor(e,t){super(e,t)}get helpers(){return[d6,d7,d8]}isSame(e,t){switch(this.inputs.AnchorPeriod){case"Session":default:return no(e,t);case"Week":return np(e,t);case"Month":return nl(e,t);case"Quarter":return nh(e,t);case"Year":return nf(e,t);case"Decade":return l$(10,e)===l$(10,t);case"Century":return l$(100,e)===l$(10,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(1===this.valueAt(d8,t))return t;return 0}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=e>0,o=a?this.dateAt(e-1):tG.ZERO_DATE,l=this.dateAt(e),u=a&&this.isSame(o,l),h=u?this.valueAt(d6,e-1):0,c=u?this.valueAt(d7,e-1):0,d=this.innVal(0,an.Volume,e),p=h+this.innVal(1,this.source,e)*d,f=c+d;if(t=p/f,u){let a=this.findPrevPeriodChange(e-1),o=this.container.getData(an.VWAP).slice(a,e);o.push(t);let l=em(o),u=Math.sqrt(em(o.map(e=>(e-l)*(e-l)))),h=this.inputs.Stdev1stMultiplier*u;i=t+h,s=t-h;let c=this.inputs.Stdev2ndMultiplier*u;r=t+c,n=t-c}else i=t,s=t,r=t,n=t;return{[d6.id]:p,[d7.id]:f,[d8.id]:+!u,[an.VWAP.id]:t,[an.VWAPSD1U.id]:i,[an.VWAPSD1L.id]:s,[an.VWAPSD2U.id]:r,[an.VWAPSD2L.id]:n}}},MACROSS:class extends cn{constructor(e,t){super(e,t);let i=fx(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,an.MAS),r=i(t,e.inputs.Period2,this.source,an.MAL);this.addInner(s,r)}get helpers(){return pt}calculateAt(e){let t=this.innVal(1,an.MAS,e),i=this.innVal(2,an.MAL,e);return pi(this.container,e,t,i)}getWrappers(){return[this.wrapInner(an.MAS,1),this.wrapInner(an.MAL,2)]}},PACROSS:class extends cn{_maIndex;_maTarget;constructor(e,t){super(e,t),fC(this);let i=fx(e,"MA","Average")(t,e.inputs.Period,this.source);this.addInner(i);let[s]=fE(this);this._maIndex=s+1,this._maTarget=i.target}get helpers(){return pt}calculateAt(e){let t=this.innVal(this._maIndex,this._maTarget,e),[,i]=fE(this),s=i.getData(this.source)[e],r=pi(this.container,e,s,t);return r[this.target.id]=t,r}},VOIN:class extends cn{constructor(e,t){super(e,t);let i=fS(ps,function(e){return{[ps.id]:e>0?Math.abs(this.baseVal(an.High,e)-this.baseVal(an.Low,e-1)):null}},t),s=fS(pr,function(e){return{[pr.id]:e>0?Math.abs(this.baseVal(an.Low,e)-this.baseVal(an.High,e-1)):null}},t),r=fd(t,an.TR);this.addInner(i,s,r)}calculateAt(e){let t=null,i=null,s=this.period;if(this.atLeast(e,s)){let r=this.past(e,s,ps,this.innCont(1)),n=this.past(e,s,pr,this.innCont(2)),a=this.past(e,s,an.TR,this.innCont(3));if(eg(r)&&eg(n)&&eg(a)){let e=ef(r),s=ef(n),o=ef(a);t=e/o,i=s/o}}return{[an.PLVI.id]:t,[an.MNVI.id]:i}}},DIFA:class extends cn{isPercent;constructor(e,t){super(e,t);let i=fx(e,"MA","Average")(t,this.period,this.source,po);this.isPercent="Percentage"===e.inputs.Distance,this.addInner(i)}get helpers(){return[an.BARCOLIX]}calculateAt(e){let t=null,i=null,s=this.innVal(1,po,e),r=this.baseVal(this.source,e);if(null!=s&&0!==s){t=r-s,this.isPercent&&(t=100*t/s);let n=t<=0;if(i=n?1:3,e>0){let s=this.container.getData(this.target)[e-1];null!==s&&(n&&t>s&&(i=0),!n&&t<s&&(i=2))}}return{[this.target.id]:t,[an.BARCOLIX.id]:i}}},DOSC:class extends cn{constructor(e,t){super(e,t);let i=fn(fg(t,this.inputs.PeriodRsi,this.source,an.RSI),this.inputs.PeriodEma1,an.RSI,an.EMA),s=fn(i,this.inputs.PeriodEma2,an.EMA,an.EMA),r=fr(s,this.inputs.PeriodMa,an.EMA,an.MA),n=fv(an.DOSCH,(e,t,i)=>t-i,s,r),a=fr(n,this.inputs.PeriodSig,an.DOSCH,an.DOSCS);this.addInner(n,a)}getWrappers(){return[this.wrapInner(an.DOSCH,1),this.wrapInner(an.DOSCS,2)]}},BSQUEEZE:class extends cI{constructor(e,t){super(e,"Squeeze",t)}},MARIB:class extends cn{constructor(e,t){super(e,t);let i=this.inputs.Period,s=this.inputs.Increment,r=Math.min(Math.max(0,this.inputs.Count),10);for(let e=0;e<r;++e){let r=fr(t,i+e*s,this.source,this.outFields[e]);this.addInner(r)}}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)}},HASMO:class extends cn{constructor(e,t){super(e,t);let i=fx(e,"EMA","Smoothing1"),s=e.inputs.Period1,r=i(t,s,an.Open),n=i(t,s,an.High),a=i(t,s,an.Low),o=i(t,s,an.Close),l=fv(pc,(e,t,i,s,r)=>(t+i+s+r)/4,r,n,a,o),u=fv(pl,function(e,t,i,s){let r=null;if(e>0){let s=this.container.getData(pl)[e-1],n=this.innVal(2,pc,e-1);eH(s,n)?r=(s+n)/2:eH(t,i)&&(r=(t+i)/2)}return r},r,o,l),h=fv(pu,(e,t,i,s)=>eH(t,i,s)?Math.max(t,Math.max(i,s)):null,n,u,l),c=fv(ph,(e,t,i,s)=>eH(t,i,s)?Math.min(t,Math.min(i,s)):null,a,u,l),d=fx(e,"EMA","Smoothing2"),p=e.inputs.Period2,f=d(u,p,pl,an.Open),m=d(h,p,pu,an.High),g=d(c,p,ph,an.Low),y=d(l,p,pc,an.Close),T=fS(an.Change,function(e){let t=null;if(e>0){let i=this.baseVal(an.Close,e),s=this.baseVal(an.Close,e-1);eH(i,s)?t=i-s:eH(i)&&!eH(s)&&(t=0)}return{[an.Change.id]:t}},y);this.addInner(f,m,g,y,T)}getWrappers(){return[this.wrapInner(an.Open,1),this.wrapInner(an.High,2),this.wrapInner(an.Low,3),this.wrapInner(an.Close,4),this.wrapInner(an.Change,5)]}},TTMSQZ:class extends cn{constructor(e,t){super(e,t);let i=e.inputs,s=fn(t,i.PeriodEmaKeltner,an.Close),r=fp(t,i.PeriodAtrKeltner);function n(e,t,i,s){return eH(i,s)?i+e*s:null}let a=i.MultiplierKeltner,o=fv(an.KCUP,eu(n,a),s,r),l=fv(an.KCLOW,eu(n,-a),s,r),u=function(e,t,i,s=an.Close){let r="BBANDS",n=fi(r);return ft(r,{source:s,inputs:{[tG.INPUT_PERIOD]:t,[tG.INPUT_WIDTH]:i},outFields:n},e)}(t,i.PeriodBollinger,i.WidthBollinger),h=function(e,t){let i="DONCHN",s=fi(i);return ft(i,{inputs:p9(t),outFields:s,source:null},e)}(t,i.PeriodMomentum),c=fr(t,i.PeriodMomentum,an.Close),d=fA(fv(pd,function(e,t,i,s){let r=null,n=this.innVal(1,an.DONMID,e);return eH(n,s)&&(r=t-(n+s)/2),r},t,h,c),i.PeriodMomentum,pd,an.TTMSQZOSC);this.addInner(o,l,u,d)}get helpers(){return[an.BARCOLIX]}calculateAt(e){let t=null,i=null,s=-1,r=this.innVal(1,an.KCUP,e),n=this.innVal(2,an.KCLOW,e),[a,o]=[an.BOLLBU,an.BOLLBL].map(t=>this.innVal(3,t,e));a<r&&o>n?t=0:i=0;let l=this.innVal(4,an.TTMSQZOSC,e),u=e>0?this.innVal(4,an.TTMSQZOSC,e-1):null;if(eH(l))if(eH(u)){let e=l>=0,t=u<l;s=e?t?3:2:+!!t}else s=2;return{[an.TTMSQZON.id]:t,[an.TTMSQZOFF.id]:i,[an.BARCOLIX.id]:s}}getWrappers(){return[this.wrapInner(an.TTMSQZOSC,4)]}},CRS:class extends cn{constructor(e,t){if(super(e,t),fw(t)){let i=yQ().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.inputs.Symbol.toUpperCase();let r=i.getTimeSeries(s),n=e=>e.query?.symbol,{model:a}=nH(`{${n(t)}} / {${n(r)}}`,!1),o=new pa(a,[t,r],(e=>{let t=e.unit===$.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:F.Manual,missing:t?H.UseNext:H.UsePrevious,stretch:e=>!1,fieldMap:new Map([[an.Close,an.CRS]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation)),l=fx(e,"MA","Average")(o,this.period,an.CRS,an.CRSAVG);this.addInner(r,o,l),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=fS(an.Close,(e,t)=>null,t),i=fS(an.CRS,(e,t)=>null,t),s=fS(an.CRSAVG,(e,t)=>null,t);this.addInner(e,i,s),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(an.CRS,2),this.wrapInner(an.CRSAVG,3)]}},JPI:pC,CTTP:class extends pC{constructor(e,t){e.inputs=ej(sw("JPI").defaults.inputs.filter(e=>"HandbrakePeriod"!==e.name)),super(e,t)}},CTTI:class extends pC{constructor(e,t){e.inputs=structuredClone(pE),super(e,t)}},DRS:class extends cn{get indexSymbol(){return this.inputs[tG.INPUT_SYMBOL]}constructor(e,t){if(super(e,t),fw(t)){let i=yQ().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.indexSymbol;let r=i.getTimeSeries(s),{model:n}=nH(`{${t.query.symbol}} / {${r.query.symbol}} * 100`,!1),a=new pa(n,[t,r],(e=>{let t=e.unit===$.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:F.Manual,missing:t?H.UseNext:H.UsePrevious,stretch:e=>!1,fieldMap:new Map([[an.Close,an.DRS]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation));this.addInner(r,a),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=fS(an.Close,(e,t)=>null,t),i=fS(an.DRS,(e,t)=>null,t);this.addInner(e,i),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(an.DRS,2)]}},MRS:class extends cn{get indexSymbol(){return this.inputs[tG.INPUT_SYMBOL]}constructor(e,t){super(e,t);let i=function(e,t,i,s=an.DRS){return ft("DRS",{target:s,inputs:{[tG.INPUT_SYMBOL]:t},aggregation:i,source:null},e)}(t,this.indexSymbol,e.aggregation),s=fr(i,this.period,an.DRS);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){let t=this.innVal(1,an.DRS,e),i=this.innVal(2,an.MA,e),s=null;return eH(t,i)&&0!==i&&(s=(t/i-1)*100),{[an.MRS.id]:s}}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}},PMO:class extends cn{constructor(e,t){super(e,t);let i=fm(t,1),s=e.aggregation,r=fv(pM,(e,t)=>10*t,pL(i,this.inputs.Period1,s,an.ROC,p_)),n=pL(r,this.inputs.Period2,s,pM,an.PMO),a=fn(n,this.inputs.Period3,an.PMO,an.PMOS);this.addInner(n,a)}getWrappers(){return[this.wrapInner(an.PMO,1),this.wrapInner(an.PMOS,2)]}},RVOL:class extends cn{constructor(e,t){super(e,t);let i=fx(e,"MA")(t,this.period,an.Volume,px,!0);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(0,an.Volume,e),s=this.innVal(1,px,e);return eH(i,s)&&0!==s&&(t=i/s),{[this.target.id]:t}}},WGALPH:class extends cn{isDaily;isFeasible=!0;constructor(e,t){super(e,t),this.isFeasible=!(t instanceof uU)&&!pD.includes(W[t.query.curveStyle]),this.isDaily=e.aggregation.unit===$.Day}acceptable(e,t,i,s){return this.isDaily?0===s||!np(this.baseVal(an.DateTime,t),this.baseVal(an.DateTime,i)):e>0&&i-t>=5}pluckValues(e){let t=0,i=[],s=e+5;for(let r=0;t<53&&e-r>0;r++){let n=e-r,a=this.baseVal(this.source,n);this.acceptable(a,n,s,t)&&(i.push(a),s=n,t++)}return i}calculateAt(e){let t=null;if(this.isFeasible&&e>=pO){let i=1,s=this.pluckValues(e),r=s.length;if(r>=27)for(let e=0;e<r-1;e++){let t=s[e]/s[e+1]-1;t<0?t=Math.max(t,-.2):t>=0&&(t=Math.min(t,.2)),i*=t=t*pI[e]+1}t=100*(i-1)}return{[this.target.id]:t}}},VOLAP:class extends pR{constructor(e,t){super(e,!1,t)}},AVWAP:class extends d9{constructor(e,t){super(e,t)}get helpers(){return[d6,d7]}isSameOhlcBar(e,t){let{unit:i,size:s}=this.aggregation;switch(i){case $.Tick:return e===t;case $.Intraday:return n4(t,lR(e,s));case $.Day:return n4(t,lx(e,s));case $.Week:return np(e,t);case $.Month:return nl(e,t);case $.Quarter:return nh(e,t);case $.Year:return nf(e,t);default:throw Error(`Unexpected aggregation unit ${$[i]}`)}}calculateAt(e){let t=null,i=null,s=null,r=this.inputs.Anchor,n=this.dateAt(e);if(n4(r,n)||this.isSameOhlcBar(n,r)){let r=e>0,n=r?this.valueAt(d6,e-1):0,a=r?this.valueAt(d7,e-1):0,o=this.innVal(0,an.Volume,e);t=(i=n+this.innVal(1,this.source,e)*o)/(s=a+o)}return{[d6.id]:i,[d7.id]:s,[an.AVWAP.id]:t}}},KST:class extends cn{constructor(e,t){super(e,t);let i=this.source,s=fS(i,eu(f_,i),t),r=fm(s,this.inputs.PeriodRoc1,i),n=fm(s,this.inputs.PeriodRoc2,i),a=fm(s,this.inputs.PeriodRoc3,i),o=fm(s,this.inputs.PeriodRoc4,i),l=fr(r,this.inputs.PeriodMa1,an.ROC,an.MA1),u=fr(n,this.inputs.PeriodMa2,an.ROC,an.MA2),h=fr(a,this.inputs.PeriodMa3,an.ROC,an.MA3),c=fr(o,this.inputs.PeriodMa4,an.ROC,an.MA4),d=fv(an.KST,(e,t,i,s,r)=>t+2*i+3*s+4*r,l,u,h,c),p=fr(d,this.inputs.PeriodSig,an.KST,an.KSTSIG);this.addInner(d,p)}getWrappers(){return[this.wrapInner(an.KST,1),this.wrapInner(an.KSTSIG,2)]}},STC:class extends cn{constructor(e,t){super(e,t);let i=fn(t,this.inputs.PeriodShort,an.Close,pN),s=fv(pH,(e,t,i)=>t-i,i,fn(t,this.inputs.PeriodLong,an.Close,pV)),r=this.inputs.PeriodStoch1,n=this.inputs.PeriodStoch2,a=fx(e,"EMA"),o=a(fh(s,r,pF,!1,pH),n,pF,pk),l=a(fh(o,r,pB,!1,pk),n,pB,this.target);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCCLO:class extends pG{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){let s=(e,t,i)=>t-i,r=fv(p$,"Yes"===this.inputs.RatioAdjusted?(e,t,i)=>(t-i)/(t+i)*1e3:s,t,i),n=fn(r,this.inputs.Period1,p$,pU),a=fn(r,this.inputs.Period2,p$,pW);return fv(this.target,s,n,a)}},NHLAI:pj,CMBCI:class extends cn{constructor(e,t){super(e,t);let i=fg(t,this.inputs.Period1Rsi,an.Close,pK),s=fS(pq,eh(fM,this.inputs.Period1Mom,pK),i),r=fr(fg(t,this.inputs.Period2Rsi,an.Close,pX),this.inputs.Period2Ma,pX,pZ),n=fv(an.CMBCI,(e,t,i)=>t+i,s,r),a=fr(n,this.inputs.PeriodFastMa,an.CMBCI,an.CMBCIF),o=fr(n,this.inputs.PeriodSlowMa,an.CMBCI,an.CMBCIS);this.addInner(n,a,o)}getWrappers(){return[this.wrapInner(an.CMBCI,1),this.wrapInner(an.CMBCIF,2),this.wrapInner(an.CMBCIS,3)]}},COTI:class extends cn{constructor(e,t){super(e,new dP({source:an.Close,inputs:{},outFields:fi("COTLC")},t));let i=Number.parseInt(this.inputs.History),s=fh(this.innerSeries[0],6===i?26:52*i,an.COTI,!1,an.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(s)}getWrappers(){return[this.wrapInner(an.COTI,1)]}},CHEXI:class extends cn{isLong;constructor(e,t){super(e,t),this.isLong="Long"===this.inputs.Direction;let i=this.period,s=fp(t,i),r=this.inputs.Multiplier,n=fv(pJ,(e,t)=>null===t?null:r*t,s),a=fu(t,i,an.High,an.HH,!0),o=fu(t,i,an.Low,an.LL,!1);this.addInner(n,a,o)}calculateAt(e){let t=null,i=null,s=this.innVal(1,pJ,e);return null!==s&&(this.isLong?t=this.innVal(2,an.HH,e)-s:i=this.innVal(3,an.LL,e)+s),{[an.CHEXL.id]:t,[an.CHEXS.id]:i}}},MBBANDS:class extends cI{constructor(e,t){super(e,"Modified",t)}},OPTIV:class extends pQ{},IVRANK:class extends pQ{},IVPCTL:class extends pQ{},OPTVOLPC:class extends pQ{},OPTOIPC:class extends pQ{},OPTVOL:class extends pQ{},OPTOI:class extends pQ{},CHOP:class extends cn{constructor(e,t){super(e,t);let i=fp(t,1),s=this.inputs.Period,r=fu(t,s,an.High,an.HH,!0),n=fu(t,s,an.Low,an.LL,!1);this.addInner(i,r,n)}calculateAt(e){let t=null,i=this.period;if(e>i){let s=this.past(e,i,an.ATR,this.innCont(1));if(eg(s)){let r=ef(s),n=this.innVal(2,an.HH,e);t=100*Math.log10(r/(n-this.innVal(3,an.LL,e)))/Math.log10(i)}}return{[this.target.id]:t}}},MACLD:class extends cn{constructor(e,t){super(e,t);let i=fx(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,an.MACLD1),r=i(t,e.inputs.Period2,this.source,an.MACLD2);this.addInner(s,r)}get helpers(){return[an.BARCOLIX]}calculateAt(e){let t=this.innVal(1,an.MACLD1,e),i=this.innVal(2,an.MACLD2,e);return{[an.BARCOLIX.id]:+(t>i)}}getWrappers(){return[this.wrapInner(an.MACLD1,1),this.wrapInner(an.MACLD2,2)]}},BTI:class extends pG{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){let s=fv(p0,(e,t,i)=>t/(t+i),t,i);return fx(e,"MA","Average")(s,this.inputs.Period,p0,this.target)}},PC:class extends cn{stdDevs;periodForecast;unitsPerYear;constructor(e,t){super(e,t),this.unitsPerYear=fI(e.aggregation),this.stdDevs=this.toInt("StandardDeviations"),this.periodForecast=this.toInt("PeriodForecast");let i=this.getHistVolPeriod();if(null!==i){let s=function(e,t,i,s=an.Close,r=an.HV){return ft("HV",{source:s,target:r,aggregation:i,inputs:p9(t)},e)}(t,i,e.aggregation);this.addInner(s)}}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"Custom"===this.volatilityParam}get haveVolatility(){return this.isCustomVolatility||this.innHasData(1)}getVolatilityPercent(){return(this.isCustomVolatility?this.inputs.VolatilityPercent:this.innCont(1).getLastDataPoint(an.HV))/100}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null;if(this.haveVolatility){let o=this.base.size-this.periodForecast;if(e>=o){let l=this.base.getLastDataPoint(an.Close),u=l*this.getVolatilityPercent()*Math.sqrt((e-o+1)/this.unitsPerYear);if(t=l+u,i=l-u,this.stdDevs>1){let e=2*u;if(s=l+e,r=l-e,this.stdDevs>2){let e=3*u;n=l+e,a=l-e}}}}return{[an.PCUP1.id]:t,[an.PCDN1.id]:i,[an.PCUP2.id]:s,[an.PCDN2.id]:r,[an.PCUP3.id]:n,[an.PCDN3.id]:a}}recalculateAt(e,t,i){let s={tag:e0(),src:this.innerSeries[0]};i&&this.calculate(s)}},GREEKS:class extends cn{constructor(e,t){super(e,cs(t,e=>new p1(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(an.Delta,0),this.wrapInner(an.Gamma,0),this.wrapInner(an.Theta,0),this.wrapInner(an.Vega,0)]}},PVACP:class extends pR{constructor(e,t){super(e,!0,t)}}};function p9(e){return{[tG.INPUT_PERIOD]:e}}function fe(e){return{target:e,source:null,inputs:fc}}function ft(e,t,i){if(eW(p8,e))return new p8[e](t,i);let s=yQ()?.config.extensions?.studyProvider;if(s){let r=s.factory(e,t,i);if(r)return r}throw Error(`Study ${e} has not been implemented yet.`)}function fi(e){return sw(e).defaults.curves.reduce((e,t)=>e.concat(t.fields.filter(t=>!e.includes(t))),[]).map(e=>an[e])}function fs(e,t,i,s){return{source:t,target:i,inputs:p9(e),allowEmptyValues:s}}function fr(e,t,i,s=an.MA,r=!1){return ft("MA",fs(t,i,s,r),e)}function fn(e,t,i,s=an.EMA,r=!1){return ft("MAEXP",fs(t,i,s,r),e)}function fa(e,t,i,s=an.SMA,r=!1){return ft("MASMO",fs(t,i,s,r),e)}function fo(e,t,i,s=an.WMA,r=!1){return ft("MAWEI",fs(t,i,s,r),e)}function fl(e,t,i,s=an.HMA,r=!1){return ft("HMA",fs(t,i,s,r),e)}function fu(e,t,i,s,r,n=!1){return new cM({source:i,target:s,inputs:p9(t)},r,n,e)}function fh(e,t,i,s,r=null){return new cL({source:r,target:i,inputs:p9(t)},s,e)}let fc={};function fd(e,t=an.TR){return ft("_TR",fe(t),e)}function fp(e,t,i="SMA",s=an.ATR){return ft("ATR",{target:s,inputs:{[tG.INPUT_PERIOD]:t,[tG.INPUT_SMOOTHING]:i},source:null},e)}function ff(e,t=an.TP){return ft("TP",fe(t),e)}function fm(e,t,i=an.Close,s=an.ROC){return ft("ROC",{source:i,target:s,inputs:p9(t)},e)}function fg(e,t,i,s=an.RSI,r=!1){return ft("_RSI",{source:i,target:s,inputs:{...p9(t),Modified:r}},e)}function fy(e,t=an.MFMUL){return ft("MFV",fe(t),e)}function fT(e,t,i,s=an.MSD){return ft("MSD",{source:i,target:s,inputs:p9(t)},e)}function fA(e,t,i,s=an.MOVLR){return ft("MOVLR",{source:i,inputs:p9(t),target:s},e)}function fS(e,t,i){return new cz(fe(e),t,i)}function fv(e,t,...i){return new cW(fe(e),t,...i)}function fb(e,t,i){return t-i}function fP(e,t,i){return(t-i)/i*100}function fC(e){let t=e.source;if(e.sourceNeedsCompute=function(e){switch(e.id){case"HL/2":case"OC/2":case"HLC/3":case"OHLC/4":case"HLCC/4":return!0;default:return!1}}(t),e.sourceNeedsCompute){let i=fS(t,eu(f_,t),e.innerSeries[0]);e.addInner(i)}}function fE(e){let t=+!!e.sourceNeedsCompute;return[t,e.innCont(t)]}let f_=function(e,t){let[i,s,r,n]=[an.Open,an.High,an.Low,an.Close].map(e=>this.baseVal(e,t)),a=null,o=e.id;switch(o){case"Open":a=i;break;case"High":a=s;break;case"Low":a=r;break;case"Close":a=n;break;case"HL/2":a=(s+r)/2;break;case"OC/2":a=(i+n)/2;break;case"HLC/3":a=(s+r+n)/3;break;case"OHLC/4":a=(i+s+r+n)/4;break;case"HLCC/4":a=(s+r+n+n)/4}return{[o]:a}},fM=function(e,t,i){let s=null;if(this.atLeast(i,e+1)){let r=this.baseVal(t,i-e);null!==r&&(s=this.baseVal(t,i)-r)}return{[this.target.id]:s}},fL={sma:fa,ma:fr,ema:fn,wma:fo,hma:fl};function fx(e,t,i="Smoothing"){return fL[(e.inputs[i]??t).toLowerCase()]}let fO={atr:fp,adjatr:function(e,t,i="MA",s=an.Close,r=an.ADJATR){return ft("ADJATR",{source:s,target:r,inputs:{[tG.INPUT_PERIOD]:t,[tG.INPUT_SMOOTHING]:i}},e)}};function fI(e){switch(e.unit){case $.Day:return 252;case $.Week:return 52;case $.Month:return 12;default:return 0}}function fD(e){let t=[an.High,an.Low];return e instanceof pa&&2!==ev(e.targetFields,t).length}function fw(e){return!(e instanceof uU)&&e.query instanceof ct}class fR extends ca{constructor(e,t){super(e,t,fn(t,13,an.Close),function(e,t,i,s,r=an.Close){return ft("MACDEXP",{source:r,inputs:{Period1:12,Period2:26,Period3:9},outFields:[an.MACD,an.MACDS,an.MACDH]},e)}(t,0,0,0,an.Close)),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=B.Same,i=this.innVal(1,an.EMA,e),s=this.innVal(1,an.EMA,e-1),r=this.innVal(2,an.MACDH,e),n=this.innVal(2,an.MACDH,e-1);return eH(i,s,r,n)&&(i>s&&r>n?t=B.Up:i<s&&r<n&&(t=B.Down)),{[an.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(an.Open,an.High,an.Low,an.Close,an.Change,an.Volume,an.OpenInterest,an.TradingDay)}}function fN(e,t){return eH(t)?(this[e]=t,null):this[e]}class fV{_domain;_range;_extent;_padding;constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return fN.call(this,"_domain",e)}range(e){return fN.call(this,"_range",e)}padding(e){return fN.call(this,"_padding",e)}get ready(){return eH(this._domain,this._range)}}let fH=1/Math.log2(10);function fF(e,t){let i,s,r,n,a=(i=e[0],(s=e[1]-i)>0?e=>(e-i)/s:e=>ed(isNaN(s)?NaN:.5)),o=(r=t[0],n=t[1],e=>r*(1-e)+n*e);return e=>o(a(e))}function fk(e){return Math.sign(e)*Math.log10(1+Math.abs(e/fH))}function fB(e){return Math.sign(e)*fH*(-1+Math.pow(10,Math.abs(e)))}let fU=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]];class fW extends fV{scaleType;axis;constructor(e,t){super(),this.scaleType=e,this.axis=t}domain(e){return this.axis&&e&&!function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e===t)return!0;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(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 i=ed,s=ed;switch(this.scaleType){case q.Linear:break;case q.Logarithmic:i=fk,s=fB;break;default:throw Error("Unexpected scale type (neither linear nor log)")}let r=this._domain.map(i),n=this.rangeWithPadding(),a=t?fF(n,r):fF(r,n),o=e=>n[1]-e+n[0],l=t?o:i;return(t?s:o)(a(l(e)))}priceToY(e){return this.mapValue(e,!1)}getTicks(e){if(!this.ready)return[];let[t,i]=this._range.map(e=>this.mapValue(e,!0));if(t===i&&e>0)return[t];let[s,r]=this._domain;if(this.scaleType===q.Linear||s<0||r>1e5)return f$(t,i,e);let n=this.findLogBand(s),a=this.findLogBand(r),o=2*e;return a-n==0?f$(t,i,o):this.getLogTicks(n,a,o,i<t)}findLogBand(e){return fU.findIndex(([t,i])=>e>=t&&e<i)}getLogTicks(e,t,i,s){let r=[...this._domain],n=[];try{for(let a=e;a<=t;a++){let[o,l]=fU[a];a===e?o=r[0]:a===t&&(l=r[1]),this.domain([o,l]);let[u,h]=this._range.map(e=>this.mapValue(e,!0)),c=f$(u,h,i);n=s?c.concat(n):n.concat(c)}}finally{this.domain(r)}return!function(e,t){let i=e.length;for(let s=1;s<i;++s){let i=e[s],r=s-1;for(;r>=0&&t(e[r],i);)e[r+1]=e[r],r-=1;e[r+1]=i}}(n,s?(e,t)=>e>t:(e,t)=>e<t),n}checkTicks(){return this.scaleType===q.Logarithmic}}function f$(e,t,i){let s,r=-1,n,a,o;if(i*=1,(e*=1)==(t*=1)&&i>0)return[e];if((s=t<e)&&(n=e,e=t,t=n),0===(o=function(e,t,i){let s=Math.sqrt(50),r=Math.sqrt(10),n=Math.sqrt(2),a=(t-e)/Math.max(0,i),o=Math.floor(Math.log(a)/Math.LN10),l=a/Math.pow(10,o);return o>=0?(l>=s?10:l>=r?5:l>=n?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(l>=s?10:l>=r?5:l>=n?2:1)}(e,t,i))||!isFinite(o))return[];if(o>0)for(e=Math.ceil(e/o),a=Array(n=Math.ceil((t=Math.floor(t/o))-e+1));++r<n;)a[r]=(e+r)*o;else for(a=Array(n=Math.ceil((e=Math.floor(e*o))-(t=Math.ceil(t*o))+1));++r<n;)a[r]=(e-r)/o;return s&&a.reverse(),a}let fG={color:tG.COLOR_TRANSPARENT},fz={color:tG.COLOR_TRANSPARENT,width:0,dashStyle:"Solid"},fY=new Set([an.Open,an.High,an.Low,an.Close].map(e=>e.id)),fj=new iD(0,0,0,0);class fK{axis;id;record;metaData;timeSeries;notifyAboutPriceDomains=!1;customPlotValues=!1;_priceMapFirstIndex;priceMapper;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=X.Symbol;isShutDown=!1;targetFields=[];detachedScale;yScale=null;levels;bands;annotations;visFromIndex;visToIndex;_eventsData;precision;visible=!0;constructor(){this.axis=null,this.id=e0(),this.record=new ac(""),this.metaData=new ii,this.timeSeries=new uU,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&&eH(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(X.Symbol)}get isExpression(){return this.is(X.Expression)}get isStudy(){return this.is(X.Study)}get isForward(){return this.is(X.Forward)}get isSeasonal(){return this.is(X.Seasonal)}getValueAt(e,t,i){return null}wrapIfAdvancedStyle(e){let t=e,i=e=>({outFields:e,inputs:{},source:null});return this.mainCurve.isHeikinAshiStyle?t=new co(i(us.slice()),e):this.mainCurve.isElderImpulseSystemStyle?t=new fR(i(us.slice().concat(an.BREL)),e):this.mainCurve.isPercentChangeStyle&&(t=new d$(i(us.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=X[e.type],this.main=e.main,e.levels&&(this.levels=e.levels),e.bands&&(this.bands=e.bands),eH(e.precision)&&(this.precision=e.precision),this.curves=e.curves.map(e=>{let t=new hB;return t.plot=this,t.fromModel(e),t}),e.detachedScale&&(this.detachedScale=e.detachedScale,this.yScale=new fW(q.Linear,null)),this.visible=e.visible??!0}initialize(){}shutdown(){eH(this.timeSeries)&&eH(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){let e=this.axis.pane.presenter,t=new ct(null,e.data.aggregation,Z.Normal,[eK(e$(e.data,null,"range","from")),eK(e$(e.data,null,"range","to"))]);return t.barsToFetch=e.data.maxDataPoints||tG.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=e$(e.display,null,"xAxis","visibleRange"),t.extendedHours=e.data.extendedHours,t}priceToY(e){return(this.hasDetachedScale?this.yScale:this.axis.yScale).priceToY(e)}get hasDetachedScale(){return eH(this.detachedScale,this.yScale)&&this.detachedScale}getDetachedScaleMargins(){return tG.DEFAULT_DETACHED_SCALE_MARGINS}setViewBox(e){if(!this.hasDetachedScale)return;let{y:t,height:i}=e,{top:s,bottom:r}=this.getDetachedScaleMargins();this.yScale.range([Math.floor(t+s*i),Math.floor(t+i-r*i)])}drawLevels(e){e.save();let t=tG.OUT_OF_SCREEN;for(let i of this.levels.filter(e=>e.visible)){let s=this.priceToY(i.value);i6(e,i7({line:i.line,fill:fG})),iG(e,{x:-1,y:s},{x:t,y:s})}e.restore()}drawBands(e){e.save();let t=tG.OUT_OF_SCREEN;for(let i of this.bands){let s=this.priceToY(i.range.to),r=this.priceToY(i.range.from);i6(e,i7({fill:i.fill,line:fz})),iW(e,new iD(-1,s,t,r-s),!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!==an.DateTime):[]}getEventsAt(e){let t=this.eventsSeries.container,i=i=>t.getData(i)[e];return this.getEventFields().map(t=>{let s=i(t);if(!eH(s))return null;let r=this.getEventFor(t);if(!eH(r))return null;let n={field:t,value:s,date:i(an.DateTime),text:r.title,color:r.color};if(t!==an.Custom||s!==tG.FAKE_CUSTOM_EVENT)return n;{let t=e%2==0;return{...n,value:t?"___news":"___video",text:t?"N":"V"}}}).filter(e=>null!=e)}getRefEventField(e,t,i){return t?e.isOhlc?an.High:i.isTick?an.Last:an.Close:e.fields[0]}getRefPlot(e){return this.axis.pane.isMain?e.mainPlot:this}drawEvents(e,t){let i=this.axis.pane.presenter,s=i.view.xAxis.xScale,r=s.domain();if(!eH(r)||!eH(r[0],r[1]))return;let n=(e,t=an.DateTime)=>e.container.getData(t),a=n(this.eventsSeries),o=this.getRefPlot(i),l=o.timeSeries,u=n(l),h=i.data.aggregation,c=o===i.mainPlot,d=n(l,this.getRefEventField(o.mainCurve,c,h)),{chart:{fontFamily:p}}=this.axis.pane.presenter.display,f=a.map((e,n)=>e.valueOf()>=r[0].valueOf()&&e.valueOf()<=r[1].valueOf()?this.getEventsAt(n).map(e=>{let r=function(e,t){let{unit:i}=e;if(i===$.Year)return tn(t);if(i===$.Quarter)return nu(t);if(i===$.Month)return th(t);if(i===$.Week)return nd(t);if(i===$.Day)return to(t);return t}(h,e.date),n=e_(u,+r,Number),a=d[n];t.has(n)||t.set(n,-1);let o=t.get(n);t.set(n,++o);let l=s.timeToX(r),c=i.view.getEventRadius(),p=this.axis.yScale.priceToY(a)-o*(c+c+c);return{visible:!0,...e,x:l,y:p,r:c,rect:fj}}):[]).flat();e.save();let m=!0;f.forEach(t=>{t.rect=function(e,{x:t,y:i,r:s,color:r,text:n},a){e.fillStyle=r,e.beginPath();let o=s+s,l=new iD(t-s,i-s-o,o,o);e.fillRect(l.x,l.y,l.width,l.height);let u=(1.6*s).toFixed(0);return e.font=`700 ${u}px "${a}"`,e.fillStyle="#fff",e.textAlign="center",e.textBaseline="middle",e.beginPath(),e.fillText(n,t,i-.9*o),l}(e,t,p),this.customEventPopup?.visible&&t.date===this.customEventPopup.date&&(this.showCustomEventPopup(t),m=!1)}),e.restore(),this._eventsData=f,this.customEventPopup?.visible&&m&&this.hideCustomEventPopup()}get customEventPopup(){return this.axis.pane.presenter.view.customEventPopup}hideCustomEventPopup(){this.customEventPopup?.hide()}showCustomEventPopup(e){let{x:t,y:i,r:s,date:r,value:n}=e;this.customEventPopup?.show({x:t+2*s,y:i-2*s},r,n)}getCustomEventDataAt(e){if(!this._eventsData)return null;let t=this._eventsData.find(t=>t.rect.contains(e));return t?.field===an.Custom?t:null}hitTestCustomEvent(e){return null!==this.getCustomEventDataAt(e)}tryHandleCustomEventClick(e){let t=this.getCustomEventDataAt(e);return!!eH(t)&&(this.showCustomEventPopup(t),!0)}isEmpty(){let e=this.timeSeries;return eH(e)&&e.hasData&&e.container.isEmpty}draw(e){if(this.visible)for(let t of(eH(this.levels)&&this.drawLevels(e),eH(this.bands)&&this.drawBands(e),this.curves))t.draw(e)}drawTopmost(e,t){this.hasEventsData&&this.drawEvents(e,t)}isComparison(e){return this.axis.comparison===e}invalidatePriceMappingCache(){this._firstVisibleDate=null}_priceMapper(e,t,i,s){if(!eH(e)||!this.timeSeries.hasData||!this.shouldPriceMap(i,s))return e;let[r,n]=this.axis.pane.presenter.view.xAxis.xScale.domain()||[];if(!eH(r)||!od(r))return e;if(this._firstVisibleDate!==r){this._firstVisibleDate=r;let e=this.timeSeries.container.getTimeData(),t=t=>e_(e,+t,Number);this.visFromIndex=t(r),this.visToIndex=t(n),this._priceMapFirstIndex.clear()}return this._priceMapFirstIndex.has(i)||this.canPriceMap(t,i),this.priceMap(e,t,i,!1,s)}isOhlcMapping(e){return this.mainCurve.isOhlc&&fY.has(e.id)}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===an.PreviousClose?an.Close:e}dataOf(e){return this.timeSeries.container.getData(e)}canPriceMap(e,t){let i=this.getRefPriceMapField(t),s=this.dataOf(i),r=null,n=this.visFromIndex;for(;null===r&&n<=this.visToIndex;)r=s[n++];this._priceMapFirstIndex.set(i,null!==r?n-1:NaN)}priceMap(e,t,i,s=!1,r=K.None){let n=this.getRefPriceMapField(i),a=this._priceMapFirstIndex.get(n);if(!Number.isFinite(a))return e;let o=this.dataOf(n)[a];return this.isComparison(K.Percent)||r===K.Percent?s?o+o*e/100:100*Math.abs(e-o)*(e>=o?1:-1)/Math.abs(o):s?o+e:e-o}shouldPriceMap(e,t){return eH(t)?t!==K.None:this.isComparison(K.Percent)||this.isComparison(K.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}}class fq extends fK{_symbol;_showPrevious;yearOffset;resolved=null;events;inputs=[];_eventsSeries;compare;get symbol(){return this._symbol}get title(){return this.symbol}get showPrevious(){return this._showPrevious}getPreviousValue(){if(!eH(this.timeSeries)||!eH(this.timeSeries.record))return null;let e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(an[e])}getTimeSeries(){let e=yQ().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.resolved,this.mainCurve.style){case W.Renko:case W.Kagi:case W.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case W.Range:t.barsToFetch=4e3;break;case W.LineBreak:t.inputs=this.inputs}let i=this.axis.pane;if(eH(i.alignedToYear)){let e=tL(t.symbol);null!==e&&(this.yearOffset=i.alignedToYear-e.getFullYear(),t.offset=this.yearOffset)}let s=e.getTimeSeries(t);this.timeSeries=this.wrapIfAdvancedStyle(s),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:er.Unspecified};this.presenter?.notifyHost(aa.TS_MANYCHANGED,e),this.getEvents()}})}getMetaData(){let e=yQ().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(aa.MD_CHANGED,{plot:this})})}getEvents(){if(!this.hasEvents)return;let e=yQ().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:Z.Events,getHashKey:function(){return Object.values(this).filter(e=>"function"!=typeof e).join("|")}};tG.EVENTS.forEach(e=>{t[e]=e$(this.events,!1,e,"show")}),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then(e=>{e&&this.presenter?.notifyHost(aa.TS_EVENTSCHANGED,{series:this.eventsSeries})})}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return!!eH(this.events)&&tG.EVENTS.some(e=>e$(this.events,!1,e,"show"))}findEvents(e){if(!this.hasEventsData||null===e[0]||null===e[1])return[];let t=e[0],i=e[1];if(i>0&&this.axis?.pane?.presenter?.data?.aggregation?.isIntraday){let e=this.timeSeries.container.getTimeData()[i-1];if(this.compare(e,t))return[]}return this.eventsSeries.container.getTimeData().map((e,i)=>this.compare(e,t)?this.getEventsAt(i):[]).flat()}fromModel(e){super.fromModel(e),this._showPrevious=e.showPrevious,this.events=e.events,this.inputs=e.inputs||[],this.compare=function(e){switch(e.unit){case $.Tick:return nv;case $.Intraday:case $.Day:return ny;case $.Week:return nT;case $.Month:return nA;case $.Quarter:return nS;case $.Year:return nf;default:return nv}}(this.axis.pane.presenter.data.aggregation),this._symbol=e.symbol}getEventFor(e){let t=this.events[e.id.toLowerCase()];return eH(t)&&t.show?t:null}async initialize(){return tU.call(this,async()=>(this.resolved=await tf(this.symbol),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class fX extends fq{seriesKind;fundamental;constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${$[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=$[e.fundamental],super.fromModel(e)}makeQuery(){let e=new ct(this.symbol,new nb(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}}class fZ{longPressTimeout;constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){let e=yQ().config.touchCrosshairDelayMillis;return eH(e)&&Number.isFinite(e)?e:tG.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,i){eI()&&(this.longPressTimeout=setTimeout(()=>this.longPressTriggered(e,t,i),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,i){this.cancelLongPress(),this.performLongPress(e,t,i)}cancelLongPress(){eI()&&eH(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,i){}}function fJ(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}class fQ extends fZ{annotation;previous;cursorSet;moved;snapToSupported;constructor(e,t,i){super(),this.annotation=e,this.previous=t,this.cursorSet=!1,this.moved=!1,this.snapToSupported=!1,this.startLongPress(null,t,i)}performLongPress(e,t,i){mw(this.annotation,i)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),fJ(this.annotation))return;let{point:t,view:i,offset:s}=e;if(!eV(t)||t.axis!==this.annotation.axis)return;i.drawCrosshair({ap:t,offset:s}),this.cursorSet||(this.previous.axis.pane.presenter.view.setCursor(Q.Move),this.cursorSet=!0);let r=iy(t.point,this.previous.point);this.annotation.offset(r),this.annotation.wasModifiedByTool(),this.annotation.requestRedraw(),this.previous=t,this.moved=!0}onMouseUp(e){this.cancelLongPress(),gE(this.annotation,this.moved,eo.Moved)}}class f0{annotation;pointIndex;snapToSupported;moved;alignPointsMode;constructor(e,t){this.annotation=e,this.snapToSupported=!0,this.moved=!1,this.alignPointsMode=!1,this.pointIndex=e.points.indexOf(t)}onMouseMove(e){if(this.alignPointsMode=e.getModifier(et.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),fJ(this.annotation))return;let{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),eH(t)){let e=this.annotation.points[this.pointIndex],i=iy(t.point,e.point);switch(e.moveDirection){case ei.Both:e.update(t.price,t.time);break;case ei.Horizontal:e.update(e.price,t.time);break;case ei.Vertical:e.update(t.price,e.time)}this.moved=e.moveDirection!==ei.None,this.moved&&this.annotation.wasPointMovedByTool(e,i)}this.annotation.requestRedraw()}onMouseUp(e){gE(this.annotation,this.moved,eo.PointMoved)}}class f1{anchor;isVertical;axis;constructor(e,t,i){this.anchor=e,this.isVertical=t,this.axis=i}hitTest(e){return!!eH(this.anchor)&&(this.isVertical?Math.abs(e.x-this.anchor.x)<=tG.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=tG.HIT_TEST_TOLERANCE)}draw(e){let t=tG.OUT_OF_SCREEN;this.isVertical?iz(e,this.anchor.x,-t,t):iY(e,this.anchor.y,-t,t)}}class f2{id;axis;_price;_time;passive=!1;moveDirection=ei.Both;visible=!0;point;constructor(e,t,i){this.id=e0(),this.axis=e,void 0!==t&&void 0!==i&&(this.price=t,this.time=i,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!==ei.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){let e=this.axis.toPoint(this);eH(e)&&ek(e.x)&&ek(e.y)&&(this.point=e)}update(e,t){this.price=e,this.time="number"==typeof t?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)<=tG.HIT_TEST_TOLERANCE}distance(e){let t=e.x-this.point.x,i=e.y-this.point.y;return Math.abs(Math.sqrt(t*t+i*i)-tG.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(eH(this.point)){let i=tG.HALF_ANN_POINT_DIMENSION;eH(t)&&t.locked&&(i*=.6),e.beginPath(),e.ellipse(this.point.x,this.point.y,i,i,0,0,2*Math.PI),e.stroke()}}}function f3(e){return 0===iM(e.fill.color).a?e.line.color:e.fill.color}function f4(e,t){return{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 f5(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}}class f6{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=e0()}requestRedraw(){this.axis.pane.presenter.view?.redraw()}prepareDraw(e,t){return this.drawPoints(e,t),this.readyToDraw()}readyToDraw(){return this.activePoints.every(e=>void 0!==e.point)}getPriceScaleAdornments(){return tG.EMPTY_ARRAY}getTimeScaleAdornments(){return tG.EMPTY_ARRAY}extractTraits(e=!0){let t=eG(this.traits),i=sS(this.name);return Object.keys(t).forEach(s=>{let r=i.includes(s);(e&&!r||!e&&r)&&delete t[s]}),e||["line","fill","zIndex"].forEach(e=>delete t[e]),t}extractPoints(){return this.activePoints.map(e=>({price:e.price,time:eF(+e.time,4)}))}offset(e){this.points.filter(e=>e.movable).forEach(t=>{t.updateFromPoint(iT(t.point,e))})}get traits(){return this._traits||(this._traits=eG(this.defaultTraits)),this.adjustFill&&(this._traits.fill.color=f3(this._traits),this.adjustFill=!1),this._traits}set traits(e){void 0!==e&&ez(this.traits,e,!1)}get activePoints(){return this.points.filter(e=>!e.passive)}get style(){return i7(this.traits)}get defaultTraits(){return i5(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return i7(this.defaultTraits)}get adornStyle(){let e=eG(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=tG.COLOR_TRANSPARENT,i7(e)}get pointsStyle(){let e=eG(this.defaultTraits);return e.line.dashStyle="Solid",i7(e)}get allowPricesChangeUI(){return this.traits?.allowPricesChangeUI}wasModifiedByTool(){}wasPointMovedByTool(e,t){}isPointDrawn(e){return void 0!==e.price}drawPoints(e,t){this.points.forEach(i=>{let s=this.isPointDrawn(i),r=eH(e);t&&(s||!r)&&i.toPoint(),r&&s&&(this.isSelected||this.drawn)&&(i6(e,this.pointsStyle),i.draw(e,this))})}addPoints(e){for(let t=0;t<e;t++)this.points.push(new f2(this.axis))}toModel(){let e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:eG(this.traits)}}canMove(e){return!0}updatePoints(e){}updateActivePoints(e){let t=this.activePoints;t.length===e.length&&t.forEach((t,i)=>{let s=e[i];t.update(s.price,s.time)})}updateFrom(e,t,i,s,r){"boolean"==typeof s&&(this.visible=s),"boolean"==typeof r&&(this.locked=r);let n=eH(e)?eG(e):{};eH(t)&&ez(n,t,!1),this.traits=n,eH(i)&&this.updatePoints(i)}priceMap(e){return this.axis.priceMap(e)}flip(e){let t=this.getFlipAnchorIndices();if(!eV(t))return;let i=this.points[t[0]],s=this.points[t[1]];if(e){let e=s.time;s.update(s.price,i.time),i.update(i.price,e)}else{let e=s.price;s.update(i.price,s.time),i.update(e,i.time)}this.wasModifiedByTool()}getFlipAnchorIndices(){return null}}function f7(e,t,i,s){return function(r,n=!0){let a=new t(r,e,i);return n?r.appendAnnotation(a):a.drawn=!1,eH(s)&&(a.traits=s),a}}class f8{axis;angle;extent;anchor1;anchor2;p1;p2;style;extended;_data;isTrend;constructor(e,t,i,s,r){this.axis=r,eH(e,t)&&(this.angle=iA(e,t),this.extent=this.getExtent(e,t),this.anchor1=e,this.anchor2=t,this.p1=i?this.extendPoint(t,-1):e,this.p2=s?this.extendPoint(e,1):t),this.extended=i||s}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 i=Math.max(Math.abs(e.x),Math.abs(t.x)),s=Math.max(Math.abs(e.y),Math.abs(t.y));return Math.sqrt(i*i+s*s)+tG.OUT_OF_SCREEN}hitTest(e){return!!eH(this.p1,this.p2)&&iS([this.p1,this.p2],e,tG.HIT_TEST_TOLERANCE)}draw(e){eH(this.p1,this.p2)&&(iG(e,this.p1,this.p2),this.extended)}getAdornOffset(e){var t,i;let s=ik(e),r=iH(e,1);return t=this.p1,i=this.p2,-(t.y-i.y)/(t.x-i.x)<0&&(s.y=r+5),s}}class f9{style;axis;rect;constructor(e,t,i,s){this.axis=s,this.rect=new iD(e.x,e.y,t,i)}hitTest(e){return this.rect.contains(e)}draw(e,t){iW(e,this.rect)}}class me extends f6{countCache;constructor(e,t){super(e,t)}draw(e,t){if(this.prepareDraw(e,t)&&!this.drawn){let t=this.getElements();i6(e,this.style),t.forEach((t,i)=>{i6(e,this.getStyleForElement(t,i)),t.draw(e)}),i6(e,this.adornStyle),this.adornElements(t,e);let i=this.getMarkers();i6(e,this.style),i.forEach(t=>{t.draw(e)})}}getBarCount(e,t){if(void 0===this.countCache||this.countCache.time1!==e||this.countCache.time2!==t){let i=this.axis.pane.presenter.view,s=Math.abs(i.toIndex(e)-i.toIndex(t));this.countCache={time1:e,time2:t,barCount:s}}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.visible){let t=this.getElements(),i=this.getMarkers();return!!(t.some(t=>t.hitTest(e))||i.some(t=>t.hitTest(e)))||this.hitTestAdornments(t,e)}return!1}updatePointsFrom(e,t=0){e.forEach((e,i)=>this.points[t+i].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(){var e;return e=this.traits?.singleStyle,!eH(e)||e}get showBackground(){var e;return e=this.traits?.showBackground,!!eH(e)&&e}get backgroundOpacity(){var e;return eH(e=this.traits?.backgroundOpacity)?e:0}fillOnlyStyle(e){return i7({line:{color:tG.COLOR_TRANSPARENT,dashStyle:"Solid",width:0},fill:this.traits[e]})}lineOnlyStyle(e){return i7({fill:{color:tG.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new f8(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return iP(ib(e),this.backgroundOpacity)}getTraitsFor(e){let t={fill:{color:tG.COLOR_TRANSPARENT},line:{...e.line}};return this.showBackground&&(t.fill.color=this.applyBackgroundOpacity(t.line.color)),t}getFlipAnchorIndices(){return 2===this.points.length?[0,1]:null}}class mt extends me{_factors;constructor(e,t){super(e,t)}get factorsPropName(){return tG.AT_FACTORS}get factors(){return i0(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[tG.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[tG.AT_LEVELS_KIND]}get labels(){return this.traits[tG.AT_LABELS]}get isExtended(){return 3===this.points.length}isBefore(e,t){return this.points[e].time<this.points[t].time}comparePoints(e,t,i){let s=this.isBefore(e,t);return i||(s=!s),this.points[s?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[tG.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){let i=this.levelsKind===tG.AT_LEVELS_PERCENTS,s="";if(this.showLevels&&(s=i?`${(100*e).toFixed(1)}%`:e.toString()),this.showPrices){let e=this.priceMap(this.axis.toPrice(t));s=(s+` (${hg(this.axis,e)})`).trim()}return s}getAdornPointAndAlign(e,t){let i=this.labels,s=e instanceof f8,r=(e,t,i)=>({pt:e,align:t,offset:i});switch(i){case tG.AT_LABELS_LEFT:return r(s?e.anchor1:e,J.Right,-t);default:case tG.AT_LABELS_RIGHT:return r(s?e.anchor2:e,J.Left,t);case tG.AT_LABELS_CENTER:return r(s?im(e.anchor1,e.anchor2):e,J.Center,0)}}getColoredElements(e){let t=this.singleStyle;return this.factors.map(i=>{let s=e(i);return null===s?null:(t||(s.style=i7(this.getTraitsFor(i))),s._data={factor:i.value},s)}).filter(e=>null!==e)}hitTestAdornments(e,t){let i=this.showLevels,s=this.getTextRef();if(!i||null===s)return!1;let r=this.axis.pane.presenter,n=r.view?.mainContext;if(!n)return!1;let a=null,o=!1;n.save();let{chart:{fontFamily:l},yAxis:{fontSize:u}}=r.display;for(let i of(n.font=`${u??12}px ${l}`,e)){if(!eH(i._data))continue;let{factor:e}=i._data,{ref:r,spacing:l,offsetY:u,text:h}=s(a,i,e),{pt:c,align:d,offset:p}=this.getAdornPointAndAlign(r,l),f=this.getAdornTextPoint(n,u,c,p);if(iB(n,h,f,d).contains(t)){o=!0;break}a=i}return n.restore(),o}adornElementsForColoredFactors(e,t,i,s){let r=this.singleStyle,n=this.showBackground,a=this.showLevels,o=this.applyBackgroundOpacity(this.traits.line.color),l=s.fillStyle,u=null;e.forEach(e=>{if(!eH(e._data))return;let{factor:h}=e._data;if(n){let i=t(u,e);s.fillStyle=r?o:e.style.fillStyle,s.fill(i)}if(a){let{ref:t,spacing:n,offsetY:a,text:o}=i(u,e,h),{pt:c,align:d,offset:p}=this.getAdornPointAndAlign(t,n),f=this.getAdornTextPoint(s,a,c,p);iU(s,o,f,d,r?l:e.style.strokeStyle)}u=e})}getAdornTextPoint(e,t,i,s){let r=iH(e,.75);return iT(i,{x:s,y:!0===t?r/2:t})}}class mi extends me{lines;constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(tG.AT_FILL)}get rect(){let[e,t,,]=this.getScreenPoints(),i=new f9({x:e.x,y:Math.min(e.y,t.y)},t.x-e.x,Math.abs(e.y-t.y),this.axis);return i.style=this.rectStyle,i}get reverse(){return!1}getLinesDataAtLevels(e,t){let[i,s]=this.points;if(this.reverse&&([i,s]=[s,i]),null==this.lines){let r=(e,t=!1)=>i=>({level:i.value,domain:e(i.value),traits:this.getTraitsFor(i),isPrice:t}),n=s.price-i.price,a=r(e=>i.price+e*n,!0),o=e?.map(a)??[],l=this.axis.pane.presenter.timeline,u=e_(l,+i.time,Number,hb),h=e_(l,+s.time,Number,hb)-u,c=r(e=>+l.at(u+Math.floor(e*h))),d=t?.map(c)||[];this.lines={prices:o,times:d,barsDiff:h,priceDiff:n}}return this.lines}makeColoredLine(e,t,i){let s=this.makeLine(e,t);return this.singleStyle||(s.style=i7(i.traits)),s._data={level:i.level,isPrice:i.isPrice},s}getLineElements(e){let[t,i]=this.getScreenPoints();return{priceLines:e.prices.map(e=>{let s=this.axis.toY(e.domain);return this.makeColoredLine({x:t.x,y:s},{x:i.x,y:s},e)}),timeLines:e.times.map(e=>{let s=this.presenter.view.toX(e.domain);return this.makeColoredLine({x:s,y:t.y},{x:s,y:i.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()}}class ms extends f2{priceRef;timeRef;constructor(e,t,i){super(e),this.priceRef=t,this.timeRef=i,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}}class mr{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 eH(this.points[0].point,this.points[1].point)?new iD(this.left,this.top,this.width,this.height):null}}function mn(e){let t=new f2(e),i=new f2(e),s=new ms(e,t,i),r=new ms(e,i,t);return[t,i,s,r]}class ma extends f6{helper;constructor(e,t){super(e,t),this.points=mn(e),this.helper=new mr(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.prepareDraw(e,t)&&(i6(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&2===e.length&&e.forEach((e,t)=>this.points[t].update(e.price,e.time))}}class mo{points;lines;axis;helper;_actualWidth;_fontSizeForWidth;constructor(e,t,i){this.points=e,this.lines=t,this.axis=i,this._actualWidth=0,this._fontSizeForWidth=0,this.helper=new mr(this.points)}hitTest(e){let t=this.getRect();return!!eV(t)&&(t.width=this._actualWidth,t.contains(e))}getRect(){return this.helper.getRect()}get fontSize(){if(0===this.lines.length)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(0===this.lines.length)return;e.save();let{x:t,y:i}=this.getRect(),{chart:{fontFamily:s}}=this.axis.pane.presenter.display,r=this.fontSize;e.textAlign="left",e.textBaseline="top",e.font=`${r}px ${s}`,this.lines.forEach((s,n)=>{let a=r*n;e.fillText(s,t,i+a)}),this.computeActualWidth(e),e.restore()}}class ml extends me{textEditable;_textAnnElement;constructor(e,t){super(e,t),this.textEditable=!0,this.points=mn(e),this.adjustFill=!0}get textLines(){return this.traits[tG.AT_TEXT_LINES]}set textLines(e){this.traits[tG.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!eH(this._textAnnElement)&&this.visible&&(this._textAnnElement=new mo(this.points,this.textLines,this.axis)),this._textAnnElement}updateFrom(e,t,i,s,r){super.updateFrom(e,t,i,s,r),this._textAnnElement=void 0}getElements(){return this.visible?[this.textElement]:[]}}class mu extends ml{constructor(e,t){super(e,t),this.textEditable=!1}canMove(e){return!!this.visible&&this.textElement.hitTest(e)}get prices(){return this.traits.prices}get pricesPoints(){let e=this.points[0].time;return this.prices.map(t=>new f2(this.axis,t,e))}updateFrom(e,t,i,s,r){super.updateFrom(e,t,i,s,r),eH(e?.textLines)&&(this.textLines=e.textLines)}getElements(){let e=super.getElements(),t=this.pricesPoints.map(e=>new f1(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,i]=this.defaultFont;e.save(),e.font=`${t}px ${i}`;let s=Math.max(...this.textLines.map(t=>e.measureText(t).width)),{x:r,y:n}=this.points[0].point;this.points[1].updateFromPoint({x:r+s,y:n+this.textLines.length*t}),e.restore()}}class mh{annId;annotation;constructor(e){this.annId=e}onKeyDown(e){if(null==this.annId)return;let{key:t,code:i,presenter:s}=e;eD(t,i)&&(eH(this.annotation)&&(this.annotation.axis.deleteAnnotation(this.annotation,!1),s.view.redraw()),gC(s,{toolChange:eo.Cancelled,annId:this.annId}))}}class mc extends mh{factory;thirdPoint;dragged;snapToSupported;isDrawingAnnotation;forceAlignPoints;indices;alignPointsMode;constructor(e,t=!1){super(e.annName),this.factory=e,this.thirdPoint=t,this.dragged=!1,this.snapToSupported=!0,this.isDrawingAnnotation=!0,this.forceAlignPoints=!1,this.alignPointsMode=!1,this.indices=t?[0,1,2]:[0,1]}signalChange(){this.annotation.wasModifiedByTool(),this.annotation.requestRedraw()}onMouseDown(e){let{point:t,button:i}=e;if(void 0===t)return;let s=eV(this.annotation);if(i===ee.Left)if(s){let e=!this.thirdPoint||this.dragged?1:2;this.annotation.points[e].update(t.price,t.time),this.dragged=!1,this.signalChange(),this.thirdPoint&&2!==e||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:i,offset:s}=e;return i.drawCrosshair({ap:t,offset:s}),eH(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(et.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(){gE(this.annotation,!0,eo.Created)}isAccidentalMouseUp(e){let{point:t}=e,i=this.annotation.points[0].point;return ig(t.point,i)<tG.HIT_TEST_TOLERANCE}onMouseUp(e){if(void 0===this.annotation)return void gM(e);if(this.isAccidentalMouseUp(e)){this.dragged=!0;return}this.dragged=!1,this.thirdPoint||this.finish()}}class md extends mc{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}}class mp extends mc{constructor(e){super(e,!1),this.snapToSupported=!1}onMouseMove(e){let{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),eH(this.annotation)&&this.dragged){let[e,i]=this.annotation.points;i.update(t.price,t.time);let s=iy(i.point,e.point),r=e.point.y+s.x*Math.sign(s.y)*Math.sign(s.x),n=this.annotation.axis.toPrice(r);i.update(n,t.time),this.signalChange()}return!0}}class mf extends mh{factory;existing;isNew;anchor;clicks;snapToSupported;isDrawingAnnotation;textArea;constructor(e,t){super(e?e.annName:null),this.factory=e,this.existing=t,this.clicks=0,this.snapToSupported=!1,this.isNew=!eH(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:f3(i5(this.anchor.axis.pane.presenter.display,"Text"))};{let e=this.existing.textElement;return{height:1.05*e.getRect().height,fontSize:`${Math.round(e.fontSize)}px`,color:this.existing.traits[tG.AT_FILL].color}}}onMouseDown(e){let{point:t}=e;if(this.isNew)if(0===this.clicks){if(void 0===t)return void gM(e);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,i=this.anchor.axis.pane.getBounds(),s=i.x+i.width-this.anchor.point.x,{height:r,fontSize:n,color:a}=this.styleProps();tR(this.textArea,{position:"absolute",top:`${t}px`,left:`${e}px`,border:"none",outline:"none",overflow:"hidden",height:`${r}px`,width:`${s}px`,resize:"none",backgroundColor:"rgba(255, 255, 255, 0.05)",zIndex:"5",fontSize:n,color:a}),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("\n"),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,i=this.textArea.value.split("\n");if(this.isNew){let{actualWidth:s,actualHeight:r}=this.getTextDimensions(i);t.points[0].update(e.price,e.time);let{x:n,y:a}=t.points[0].point;t.points[1].updateFromPoint({x:n+s,y:a+r}),t.drawn=!1}t.textLines=i,this.textArea.onblur=null,this.getChartParent().removeChild(this.textArea),t.requestRedraw(),this.isNew||t.requestRedraw(),gE(t,!0,this.isNew?eo.Created:eo.TextChanged)}getTextDimensions(e){let t=globalThis.getComputedStyle(this.textArea).getPropertyValue("font-size"),i=parseFloat(t)*e.length,s=0,r=this.anchor.axis.pane.presenter,n=r.view.mainContext;n.save();let{chart:{fontFamily:a}}=r.display;n.font=`${t} ${a}`;for(let t=0;t<e.length;t++){let i=n.measureText(e[t]).width;i>s&&(s=i)}return n.restore(),{actualWidth:s,actualHeight:i}}}function mm(e){return yQ().config.tooltipMovement===e}function mg(){return mm("Draggable")}let my=tG.TOOLTIP_STD_LEGACY_CLASS,mT=tG.TOOLTIP_STD_CLASS,mA=tG.TOOLTIP_BUBBLE_CLASS;class mS{view;tooltipElem;leftSide;mode;isDrag;canDrag;isToggling;constructor(e){this.view=e,this.isDrag=!1,this.tooltipElem=tF(e.el,"div"),tN(this.tooltipElem,{id:`${e.presenter.elementId}-global-tooltip`,class:`${mT} ${my}`}),this.leftSide=!0,tR(this.tooltipElem,{visibility:"hidden",position:"absolute",cursor:mg()?"move":"default",zIndex:20,top:`${tG.TOOLTIP_Y_OFFSET}px`,left:`${tG.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===tG.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition="none",this.tooltipElem.classList.remove(mT,my),this.tooltipElem.classList.add(mA),tR(this.tooltipElem,{pointerEvents:"none"});else if(e===tG.TOOLTIP_STD){this.canDrag=mg(),this.tooltipElem.classList.remove(mA),this.tooltipElem.classList.add(mT,my);let e=tG.TOOLTIP_TOGGLE_SIDE_ANIM_MS;tR(this.tooltipElem,{pointerEvents:"all",top:`${tG.TOOLTIP_Y_OFFSET}px`,left:`${tG.TOOLTIP_X_OFFSET}px`,transition:mm("Auto")?`left ${e}ms ease-out`:null})}}}show(e,t){let i=this.tooltipElem;if(t){let{width:e,height:s,leftOffset:r,rightOffset:n}=this.view,a=i.getBoundingClientRect(),o=a.width/2,l=i.style,u=s*tG.TOOLTIP_BUBBLE_OFFSET,h=t.yMin-a.height-u,c=t.x-o,d=t.yMax+u,p=d+a.height,f=c,m=e-n;f<r?f=r:f+a.width>m&&(f=m-a.width),l.top=`${h<0?p<s?d:0:h}px`,l.left=`${f}px`}"hidden"===i.style.visibility&&(i.style.visibility="visible"),tB(i,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),this.tooltipElem.remove()}reposition(e,t){tR(this.tooltipElem,{left:`${e}px`,top:`${t}px`})}isAutoMove(){return this.mode===tG.TOOLTIP_STD&&mm("Auto")}handleMouseMove(e){if(this.isDrag&&this.canDrag){let{movementX:t,movementY:i}=e,{top:s,left:r}=this.tooltipElem.style,n=parseInt(s)+i,a=parseInt(r)+t;this.reposition(a,n)}else if(this.isAutoMove()){let t=this.tooltipElem.getBoundingClientRect(),i=this.view.el.getBoundingClientRect(),s=e.pageX,r=tG.TOOLTIP_TOGGLE_DISTANCE_TOLERANCE,n=i.width>2*t.width,a=s>t.x&&s<=t.right+r,o=s<t.x&&s>=t.x-r;n&&(a||o)&&this.toggleSide()}}repositionAuto(){if(this.isAutoMove()){let e=this.view.presenter.mainPane.getBoundsWithoutScales(),t=this.tooltipElem.offsetY,i=e.x+(this.leftSide?tG.TOOLTIP_X_OFFSET:e.width-this.tooltipElem.offsetWidth-tG.TOOLTIP_X_OFFSET);this.reposition(i,t)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout(()=>this.isToggling=!1,tG.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}}function mv(e){e.showTooltip&&mb(e,{time:tG.ZERO_DATE,offset:tG.OFFSCREEN_OFFSET,price:0,lastBarRefresh:void 0,justMain:void 0})}function mb(e,{time:t,lastBarRefresh:i,justMain:s,offset:r,price:n}){let a=hN(e,t,r,i,s,n),{mode:o,showMainPlot:l,hideSymbols:u,revealingClose:h}=e.display.tooltip,{includeTimestamp:c,showMainPlot:d,showPlotActions:p}=yQ().config.tooltipHeaders||{},f=eH(d)?d:l,m=!!eH(c)&&c,g=!!eH(u)&&u,y=!!eH(h)&&h,T=!!eH(p)&&p,A=t.valueOf()===tG.ZERO_DATE.valueOf();switch(o){case tG.TOOLTIP_CARDS:s||mC(e,a,f,!A,m&&!A,!1,g,y,T,e.hasLegend?e.view?.legend?.getLegendElem().clientHeight:0);break;case tG.TOOLTIP_BUBBLE:if(!A){let t=a.panes.find(e=>{let{top:t,left:i,width:s,height:n}=e.bounds;return new iD(i,t,s,n).contains(r)}),i=t.plots.find(e=>e.isMain)||t.plots[0],s=i.values.find(e=>["Close","Last"].includes(e.id)),n=s?s.y:i.values[0].y,o=t.plots.map(e=>e.values.filter(e=>"Change"!==e.id&&e.y>0).map(e=>e.y)).flat(),l=hM({...a,hideSymbols:g,revealingClose:y,plots:t.plots}),u=`<div class="bubble-box">${l}</div>`;e.view.tooltip.show(u,{x:r.x,y:n,yMin:Math.min(...o),yMax:Math.max(...o)})}mC(e,a,f,!1,!1,e.hasLegend,g,y,T);break;case tG.TOOLTIP_STD:if(!A){let t=hM({...a,hideSymbols:g,revealingClose:y,plots:a.panes.map(e=>e.plots).flat()});e.view.tooltip.show(t)}mC(e,a,f,!1,!1,e.hasLegend,g,y,T);break;case tG.TOOLTIP_EXTERNAL:e.notifyHost(aa.CH_TOOLTIPCHANGED,a);break;default:console.warn(`Unknown tooltip mode requested: ${o}`)}}function mP(e,t,i,s,r,n){tR(e,{position:"absolute",display:"flex","flex-direction":t,"flex-wrap":"wrap",left:`${i+tG.CARDS_X_OFFSET}px`,top:`${r+tG.CARDS_Y_OFFSET}px`,maxWidth:`${n-s-2*tG.CARDS_X_OFFSET}px`})}function mC(e,t,i=!1,s=!1,r=!1,n=!1,a=!1,o=!1,l=!1,u=0){let h=e.view.el,c=function(e,{panes:t,date:i,time:s,isMultiSymbol:r},n=!1,a=!1,o=!1,l=!1,u=!1,h=!1){return t.map((c,d)=>{let p=n?c.plots:c.plots.filter(e=>!e.isMain),f=e.mainPlot.axis.pane.id===c.id,m=o&&f?`<span class="field-name" style="padding-right:5px">${i} ${s||""}</span>`:"",g=p.map(t=>(function(e,t,i,s,r,n,a,o){let{id:l,name:u,type:h,error:c,description:d,values:p,events:f,isMain:m}=e,g=o.display.tooltip,y=c||d,T=`value-title${m?" value-main":""}`,A=X[h],S=!(["Study","BalanceSheet","IncomeStatement"].includes(A)||"Expression"===A&&!i)||o.hasLegend&&i?"":hR(l),v=function(e,t){let i=hx(t?"eye":"eyeSlash"),s=t?"Hide":"Show",r=`${s} plot`;return`<a class="show-hide-plot" data-plot-id="${e}" data-act="${s}" title="${r}">${i}</a>`}(l,e.visible),b=a?function(e){let t=hx("moreActions");return`<a class="more-actions" data-plot-id="${e}" data-act="Menu" title="Actions">${t}</a>`}(l):"",P=hE(o)&&e.type===X.Symbol,C=(m||P)&&(!s||e.values.length>1),E=t?p.map(e=>hw(C?e.abbreviation:"Close"===e.id&&n?d+" ":null,e.value,e.color)).join(" ")+function(e){if(e&&e.length){let t=e.map(e=>hw(`${e.field.name} (${hS(h_,e.date)})`,e.value,e.color)).join(" ");return`Event ${t}`}return""}(f):"",_=!m&&"Expression"!==A,M=p.slice(0,_?p.length:1).map(e=>`<div class="box" style="background-color:${e.color}"></div>`).join(""),L="Name"===g.mainTitle?u:d,x=r?e.visible&&t?"":`${d}`:`${L}`,O=s&&P?`${d} (${x})`:x;g.showMainTitle||(O="");let I=e.isMain?(()=>{let e=o.data?.aggregation.toShortString(),t=o.data?.aggregation.describe();return`<span class="value-main" title="${t}">&centerdot;${e}&centerdot;</span>`})():"";return`
12
+ `}function hw(e,t,i=null){return hD(e,t,i,"value-title")}function hR(e,t,i){let s="string"==typeof i?` style="color: ${i}"`:"",r=eH(e)?`<span class="field-name">${e}</span>`:"";return`${r}<span${s} class="field-value">${t}</span>`}function hN(e){return`<a class="delete-plot" data-plot-id="${e}" title="Delete plot">${hO("delete")}</a>`}function hV(e,t,i,s,r,n){let a=function(e,t){let i=e.data.aggregation,s=e.display.xAxis,r=s.isOrdinal,n=eV(r)&&r,a=n?s.ordinalName??"Value":"Date";return{date:n?hf(t):hv(i,t),time:i.isEndOfDay||n?null:hb(i,t,!1),isMultiSymbol:function(e){let t=e.mainPlot.symbol;return e.allPlots.some(e=>e.type===X.Symbol&&e.symbol!==t)}(e),isMultiContract:i.isMultiContract,dateFieldName:a}}(e,t);return a.offset=i,a.lastBarRefresh=!!s,a.chartId=e.elementId,a.panes=e.panes.map(i=>({bounds:hH(i),id:i.id,plots:i.axes.map(e=>e.plots).flat().filter(t=>!r||t===e.mainPlot).map(i=>(function(e,t,i,{isMultiContract:s},r){let n=r.isStudy;if(!r.timeSeries.hasData)return null;let a=r.timeSeries.container;r.type,X.Expression;let o=r.axis.comparison!==K.None,l=r.axis.comparison===K.Percent,u=(e,s)=>r.customPlotValues&&s!==aa.DateTime?[r.getValueAt(s,t,i),0]:hF(e,s,t,o),h=n?`${sN(r.model.study).meta.title} ${r.fullParams}`:r.metaData.name||"",c={isMain:r.main,type:r.type,typeName:X[r.type],name:r.title,description:h,exchange:r.metaData.exchange||"",error:r.errorText,id:r.id,visible:r.visible};eH(r.yearOffset)&&0!=r.yearOffset&&(c.unalignedDate=hv(e.data.aggregation,function(e,t){return te(2,arguments),tr(e,-e9(t))}(t,r.yearOffset)));let d=r.curves[0];s&&r.type===X.Symbol&&a.hasField(aa.Symbol)&&(t.valueOf()===tG.ZERO_DATE.valueOf()?c.name=r.timeSeries.container?.getLastDataPoint(aa.Symbol):c.name=u(d,aa.Symbol)[0]);let p={},f={range:r.axis.yScale.domain(),allDigits:!0};hk(r,e,f);let m=(e,t)=>{let i=(t===aa.Change||t===aa.PercentChange)&&e>0?"+":"";return l?i+hm(e):i+r.metaData.format(e,t,f)},g=h_(e),y=new Set;return c.values=r.curves.filter(e=>e.visible).map(e=>(!r.main&&r.isSymbol&&g?ur:e.fields).map(t=>{if(y.has(t))return null;y.add(t);let[i,s]=u(e,t),a=r.axis.yScale.priceToY(i);p[t.id]=!0;let o=r.customPlotValues?r.getColorOf(t):e.getColor(s,e.style!==W.HollowCandles,t),l=m(i,t).trim();if(eH(i)&&t===aa.Change){let[t]=u(e,aa.PercentChange);eH(t)&&(l+=` (${m(t,aa.PercentChange)})`)}return{abbreviation:hB(t),shortName:t.shortName,id:t.id,name:t.name,longName:`${t.shortName} ${n?r.params:""}`.trim(),color:ib(o),val:i,y:a,value:l}}).filter(e=>null!==e)).flat(),c.events=r.findEvents(u(d,aa.DateTime)).filter(e=>e.field!==aa.Custom),c})(e,t,n,a,i)).filter(e=>null!==e)})),a}function hH(e){let t=e.getBounds();if(!eH(t))return;let{x:i,y:s,width:r,height:n}=t,{leftOffset:a,rightOffset:o}=e.presenter.view;return{top:s,left:i+a,right:o,bottom:s+n,width:r,height:n}}function hF(e,t,i,s=!1){let r=e.plot,n=r.timeSeries.container,a=r.axis.pane.presenter.timeline,o=e_(a,+i,Number,hP),l=a.at(o-e.shift);if(null===l)return[null,0];let u=n.getTimeData(),h=e_(u,+l,Number);return[u[h]&&u[h].getTime()===l.getTime()?e.dataAt(t,h,!s):null,h]}function hk(e,t,i){eH(e.precision)?i.overridePrecision=e.precision:e.isStudy&&eH(t.mainPlot?.precision)&&!eH(sN(e.model.study).meta.decimals)&&(i.overridePrecision=t.mainPlot.precision)}function hB(e){return e.id===aa.Change.id?"Δ":e.id.substring(0,1)}class hU{plot;id;fields=[];colors=[];style=W.Line;attributes=[];zones;_shift=0;lineWidth=1;lineMarker;lineSmoothing;dashStyle="Solid";varyColorPerBar=!1;visible=!0;_zoneColors;constructor(){this.id=e0(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=eH(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(aa.Close)}get name(){return this.isOhlc?"":this.fields[0].name}get isHeikinAshiStyle(){return this.style===W.HeikinAshi}get isCandle(){return this.style===W.Candlestick||this.style===W.HollowCandles||this.style===W.HeikinAshi}get isHollowCandles(){return this.style===W.HollowCandles}get isElderImpulseSystemStyle(){return this.style===W.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===W.PercentChange}get isOhlcStyle(){return this.style===W.OHLC}get isHlcStyle(){return this.style===W.HLC}get isRangeStyle(){return this.style===W.Range}get isRenko(){return this.style===W.Renko}get isKagi(){return this.style===W.Kagi}get isPointAndFigure(){return this.style===W.PointAndFigure}get isLineBreak(){return this.style===W.LineBreak}get isBaseline(){return this.style===W.Baseline}get isLineLike(){return[W.Line,W.Area,W.Baseline,W.PercentChange].includes(this.style)}get isColumn(){return this.style===W.Column}get isMultiColumn(){return this.style===W.MultiColumn}get isStackedColumn(){return this.style===W.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=>U[e])),this.colors=e.colors,this.fields=e.fields.map(e=>aa[e]),this.style=W[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,i=!0){let s=!this.plot.isComparison(K.None),r=e===aa.PercentChange,n=e===aa.Change,a=r||(!i||s)&&n,o=this.timeSeries.container.hasField(aa.Last)?aa.Last:aa.Close,l=a?o:e,u=(e,t)=>{let i=this.timeSeries.container.getData(e)[t];return e.type!==z.Number?i:this.plot.priceMapper(i,t,e)},h=u(l,t);if(!a)return h;if(t<=1)return 0;let c=u(l,t-1),d=h-c;return r?0===c?0:d/c:d}timeSeriesAt(e){let t=this.timeSeries.container.getTimeData(),i=t.length;return e<0||e>i-1?null:t[e]}timelineAt(e){return this.presenter.timeline.at(e)}get shiftedTimeDomain(){let e=this.view.xAxis.xScale;return eH(e.extent())?0!==this.shift?e.extent().map(t=>e.timeline.at(t-this.shift)):e.domain():null}get yScale(){return this.plot?.yScale??this.axis.yScale}getCore(){let e=this.timeSeries;if(!e.hasData||!this.visible)return null;let t=this.view.xAxis.xScale.extent();if(!eH(t))return null;let i=this.yScale.domain();return eH(i)?{ts:e,extent:t,domain:i,range:this.yScale.range()}:null}drawHover(e,t,i){if(!this.isLineLike||null===this.getCore())return;let[s,r]=hF(this,this.pickMainField(),t);if(eH(s))e.save(),iI(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=ib(this.getColor(r)),e.beginPath(),h2(e,i,this.priceToY(s),this.lineMarker??"Circle",1.3333),e.fill(),e.restore()}draw(e){let t=this.getCore();if(null===t)return;let{ts:i,extent:s,domain:r,range:n}=t;e.save(),e.setLineDash([]);let a=i.container.getTimeData(),o=this.shiftedTimeDomain[0],l={bar:this.view.xAxis.xScale.bar,domain:r,range:n,slice:s,start:e_(a,+o,Number)||0},u=eH(this.zones);this.isOhlc?h0.call(this,e,l):this.isRenko||this.isLineBreak?hK.call(this,e,l):this.style===W.Ribbon?this.varyColorPerBar?ce.call(this,e,l):h9.call(this,e,l,this.colors[0]):this.style===W.Area?u?hz.call(this,e,l,h$,!0):h$.call(this,e,l,this.colors,!0):this.isColumn||this.isMultiColumn?u?hz.call(this,e,l,hX,!0):hX.call(this,e,{...l,range:[null,null]}):this.isStackedColumn?hq.call(this,e,l):this.isBaseline?hj.call(this,e,l):this.style===W.Step?u?hz.call(this,e,l,hJ):hJ.call(this,e,l,this.colors[0]):this.isKagi?h7.call(this,e,l):this.isPointAndFigure?h8.call(this,e,l):this.style===W.Dots?hZ.call(this,e,l):this.style===W.Line||this.isPercentChangeStyle?u?hz.call(this,e,l,h3):this.varyColorPerBar?h5.call(this,e,l):h3.call(this,e,l):yK(`Drawing of the curve style '${this.style}' is not implemented yet`,"error"),e.restore()}pickMainField(){return 1===this.fields.length?this.fields[0]:this.fields.includes(aa.Last)?aa.Last:this.fields.includes(aa.Close)?aa.Close:this.fields[0]}get zoneColors(){if(!eH(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 -1===t&&(t=this.zones.length-1),this.zoneColors[t]}pickAreaStroke(e){return e.length<2?ib(e[0]):e[1]}getComputedColor(e){if(!this.timeSeries.container.hasField(aa.BARCOLIX))return null;let t=this.dataAt(aa.BARCOLIX,e);return t>=0&&t<this.colors.length?this.colors[t]:null}getColor(e,t=!0,i=null){if(this.varyColorPerBar){let i,s={};if(this.isOhlc||this.isRenko||this.isLineBreak){let t=this.dataAt(aa.Open,e),i=this.dataAt(aa.High,e),r=this.dataAt(aa.Low,e),n=this.dataAt(aa.Close,e),a=this.dataAt(aa.Change,e);s.open=t,s.high=i,s.low=r,s.close=n,s.change=a}else if(this.plot.isStudy&&!["VOL","MAVOL"].includes(this.plot.model.study)){let t=this.pickMainField(),i=this.dataAt(t,e-1),r=this.dataAt(t,e),n=eH(i),a=eH(r);n?s.change=a?r-i:-1:s.change=+!!a}else{let t=this.plot.axis.pane.presenter.data.aggregation;t.isTick&&t.spec===G.None||(s.open=this.dataAt(aa.Open,e),s.close=this.dataAt(aa.Close,e)),s.change=this.dataAt(aa.Change,e)}let r=function(e,{open:t,close:i,change:s},r){let n=r.length>2&&e!==W.HLC,a=eH(t,i),o=a&&i>t,l=a&&i===t,u=s>0,h=0===s;return{useSame:n,isUp:o,isSame:l,isUpPrev:u,isSamePrev:h,isDown:!o&&!l,isDownPrev:!u&&!h}}(this.style,s,this.colors),n=this.getComputedColor(e);switch(this.style){case W.Candlestick:case W.Renko:case W.LineBreak:case W.Range:case W.HeikinAshi:case W.OHLC:case W.HLC:case W.Column:{if(eH(n)){i=n;break}let t=r.useSame?r.isUp:r.isUp||r.isSame,s=r.isSame,a=this.attributes||[],o=this.plot.isStudy&&!["HASMO","VOL","MAVOL"].includes(this.plot.model.study);(a.includes(U.ChangeBased)||o)&&(t=r.useSame?r.isUpPrev:r.isUpPrev||r.isSamePrev,s=r.isSamePrev),i=this.colors[+!!t],r.useSame&&s&&(i=this.colors[2]),(this.isRenko||this.isLineBreak||this.isRangeStyle)&&1===this.dataAt(aa.Projection,e)&&(i=iE(.5,!0)(i));break}case W.ElderImpulseSystem:i=this.colors[this.dataAt(aa.BREL,e)];break;case W.HollowCandles:{let e=this.colors[r.isUpPrev||r.isSamePrev?1:0];i=t&&(r.isUp||r.isSame)?tG.COLOR_TRANSPARENT:e;break}case W.Line:case W.PercentChange:case W.Ribbon:case W.Kagi:if(eH(n)){i=n;break}i=this.colors[0];break;case W.PointAndFigure:{let t=+!!uH(this.dataAt(aa.BARKIND,e));i=this.colors[t];break}default:throw Error(`Unexpected style ${W[this.style]} for a curve with varying colors`)}return eH(i)||(i=this.colors[0]),i}if(this.zones){let t=this.pickMainField(),i=this.dataAt(t,e),s=this.getColorsFromZone(i);return this.style===W.Area?this.pickAreaStroke(s):s.length>0?s[0]:this.colors[0]}if((this.isMultiColumn||this.isStackedColumn)&&eH(i)){var s;return this.colors[s=this.colors,Math.min(Math.max(this.fields.findIndex(e=>e===i),0),s.length-1)]}return this.colors[0]}}function hW([e,t],i,s){let r=i,n=this.timeSeries.container.size;for(let i=e;i<=t;i++){for(;this.timeSeriesAt(r)<this.timelineAt(i-this.shift)&&r<n;)++r;if(r===n)break;let e=this.timeSeriesAt(r)>this.timelineAt(i-this.shift);s.call(this,r,e)}}function h$(e,t,i,s=!1){h3.call(this,e,t,this.pickAreaStroke(i)),ct.call(this,e,t,i[0],s)}function hG(e,t){let i,s,r=eH(e),n=eH(t),a=this.pane.getBounds();if(r)if(n){let r=this.priceToY(e),n=this.priceToY(t);i=(r+n)/2,s=new iD(a.x,n,a.width,r-n)}else i=this.priceToY(e),s=new iD(a.x,a.y,a.width,i-a.y);else i=this.priceToY(t),s=new iD(a.x,i,a.width,a.y+a.height-i);return[i,s]}function hz(e,t,i,s=!1,r){let n;this.zones.forEach((a,o)=>{let l=a.value,[u,h]=hG.call(this,n,l);e.save(),iI(e,h),s&&(t.range=[null,u]);let c=this.zoneColors[o];if(a.gradient){let t=((e,t)=>{let i=iE(.6)(e),s=i_(.6)(e),r="linLighten"===t;return[r?s:i,e,r?i:s]})(c,a.gradient),i=e.createLinearGradient(0,h.y,0,h.y+h.height);i.addColorStop(0,t[0]),i.addColorStop(.5,t[1]),i.addColorStop(1,t[2]),c=i}else eH(r)&&(c=r(o,c));i.call(this,e,t,c),e.restore(),n=l})}function hY(e,t){let{x:i,width:s}=this.pane.getBoundsWithoutScales();e.save(),e.lineWidth=1,e.strokeStyle="#888",e.setLineDash(iv("dot")),iY(e,t,i,i+s),e.restore()}function hj(e,t){let[i,s]=t.range,{baseLevel:r}=function(e){let{BaseLevel:t}=ej(e);return{baseLevel:Number.isFinite(t)?e1(0,100,t):50}}(this.plot.inputs),n=(i-s)*r/100+s;this.zones[0].value=this.yToPrice(n),hY.call(this,e,n),hz.call(this,e,t,h$,!0,(t,r)=>{let a=iP(r,0),o=e.createLinearGradient(0,1===t?i:s,0,n);return o.addColorStop(0,r),o.addColorStop(1,a),[o,iP(r,1)]})}function hK(e,{bar:t,slice:i,start:s}){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;hW.call(this,i,s,(i,s)=>{if(!s){let[s,n]=[aa.Open,aa.Close].map(e=>this.dataAt(e,i)).map(this.priceToY,this),a=Math.floor(t.totalWidth/2);e.fillStyle=this.getColor(i),e.beginPath(),e.rect(r-a,s,t.totalWidth,n-s),e.fill()}r+=t.totalWidth})}function hq(e,{bar:t,slice:i,start:s}){if(!this.isFirstVisibleOfStyle())return!1;let r=this.view.xAxis.xScale.range()[0]+t.offset,n=iX();n.prolog(e);let a=this.plot.curves.filter(e=>e.isStackedColumn);hW.call(this,i,s,(i,s)=>{if(!s){let s=this.priceToY(0),o=0;a.forEach(a=>{if(!a.visible)return;let l=a.fields[0];if(eH(o+=this.dataAt(l,i))){let u=this.priceToY(o);e.fillStyle=a.getColor(i,!1,l),e.beginPath(),e.rect(n.adjust(r),n.adjust(u),n.adjust(t.width),n.adjust(s-u)),e.fill(),s=u}})}r+=t.totalWidth}),n.epilog(e)}function hX(e,{bar:t,slice:i,start:s,range:[r,n]}){let a=this.view.xAxis.xScale.range()[0]+t.offset,o=this.isMultiColumn,l=o?this.fields:[this.pickMainField()],u=t.width/(o?l.length:1),h=iX();h.prolog(e),hW.call(this,i,s,(i,s)=>{s||l.forEach((t,s)=>{let r=this.dataAt(t,i);if(eH(r)){eH(n)||(n=this.priceToY(0));let o=this.priceToY(r);e.fillStyle=this.getColor(i,!1,t),e.beginPath(),e.rect(h.adjust(a+s*u),h.adjust(o),h.adjust(u),h.adjust(n-o)),e.fill()}}),a+=t.totalWidth}),h.epilog(e)}function hZ(e,{bar:t,slice:i,start:s}){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;e.fillStyle=this.getColor(0);let n=Math.max(1,this.lineWidth||tG.CURVE_STYLE_DOTS_RADIUS),a=2*Math.PI;e.beginPath(),hW.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eH(s)){let t=this.priceToY(s);e.moveTo(r+n,t),e.arc(r,t,n,0,a)}}r+=t.totalWidth}),e.fill()}function hJ(e,{bar:t,slice:i,start:s},r){let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,a=iX();a.prolog(e),e.strokeStyle=r,e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(iv(this.dashStyle)),e.beginPath();let o=!1,l=null;hW.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eH(s)){let r=this.priceToY(s);if(o)e.lineTo(n,l),e.lineTo(n,r);else{let s=this.dataAt(t,i-1);if(eH(s)){let t=this.priceToY(s);e.moveTo(-1,t),e.lineTo(n,t),e.lineTo(n,r)}else e.moveTo(n,r);o=!0}l=r}}n+=t.totalWidth}),e.stroke(),a.epilog(e)}let hQ=[aa.Open,aa.High,aa.Low,aa.Close];function h0(e,{bar:t,slice:i,start:s}){let r=this.presenter.display.chart.showMinMaxArc,n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,a=iX();a.prolog(e);let o=null,l=null,u=null,h=null,c=t=>{this.isCandle?(this.isHollowCandles?t.outlineColor=this.getColor(t.ix,!1):(this.colors.length>3&&(t.outlineColor=this.colors[3]),this.colors.length>4&&(t.wickColor=this.colors[4])),function(e,{x:t,adjust:i,width:s,y:[r,n,a,o],color:l,outlineColor:u,wickColor:h,isMin:c,isMax:d},p){let f=s/2;e.lineWidth=p,e.fillStyle=l,e.strokeStyle=u||l,e.beginPath(),e.rect(i(t-f),r,s,i(o-r)),e.fill(),e.stroke(),e.strokeStyle=h||u||l,e.beginPath(),e.moveTo(t,Math.min(o,r)),e.lineTo(t,n),e.moveTo(t,Math.max(o,r)),e.lineTo(t,a),e.stroke(),e.strokeStyle=0===iM(l).a?u:l,h1(e,c,d,t,a,n,f)}(e,t,this.lineWidth)):(this.isOhlcStyle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&function(e,{x:t,adjust:i,width:s,y:[r,n,a,o],color:l,isMin:u,isMax:h},c,d){let p=s/2;e.lineWidth=c,e.strokeStyle=l,e.beginPath(),e.moveTo(t,a),e.lineTo(t,n),d&&(e.moveTo(i(t-p),r),e.lineTo(t,r)),e.moveTo(i(t+p),o),e.lineTo(t,o),e.stroke(),h1(e,u,h,t,a,n,p)}(e,t,this.lineWidth,!this.isHlcStyle)};hW.call(this,i,s,(e,i)=>{if(!i){let i=hQ.map(t=>this.dataAt(t,e)),[s,r,d,p]=i;if(eH(s,r,d,p)){let f={x:a.adjust(n),adjust:a.adjust,width:t.width,y:[s,r,d,p].map(this.priceToY,this).map(a.adjust),isMin:!1,isMax:!1,ix:e,color:this.getColor(e)},m=Math.min(...i),g=Math.max(...i);(!eH(o)||m<o)&&(o=m,u=f),(!eH(l)||g>l)&&(l=g,h=f),c(f)}}n+=t.totalWidth}),r&&(eH(u)&&(u.isMin=!0,c(u)),eH(h)&&(h.isMax=!0,c(h))),a.epilog(e)}function h1(e,t,i,s,r,n,a,o=3){t&&i$(e,{x:s,y:r+o},a,0,Math.PI),i&&i$(e,{x:s,y:n-o},a,0,Math.PI,!0)}function h2(e,t,i,s,r=1){let n=tG.MARKER_SIZE*r,a=1.25*n;switch(s){case"Circle":e.moveTo(t+n,i),e.arc(t,i,n,0,2*Math.PI);break;case"Square":e.rect(t-n,i-n,2*n,2*n);break;case"TriangleUp":e.moveTo(t-a,i+a),e.lineTo(t+a,i+a),e.lineTo(t,i-a),e.lineTo(t-a,i+a);break;case"TriangleDown":e.moveTo(t-a,i-a),e.lineTo(t+a,i-a),e.lineTo(t,i+a),e.lineTo(t-a,i-a);break;case"Diamond":e.moveTo(t,i-a),e.lineTo(t+a,i),e.lineTo(t,i+a),e.lineTo(t-a,i),e.lineTo(t,i-a)}}function h3(e,{bar:t,slice:i,start:s},r=null){let n=r||this.getColor(0),a=eV(this.lineMarker);a&&(e.fillStyle=n,e.beginPath());let o=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,l=[],u=this.pickMainField();hW.call(this,i,s,(i,s)=>{if(!s){let t=this.dataAt(u,i);if(eH(t)){let i=this.priceToY(t);a&&h2(e,o,i,this.lineMarker),l.push({x:o,y:i})}}o+=t.totalWidth}),a&&e.fill(),e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(iv(this.dashStyle)),eV(this.lineSmoothing)?function(e,t,i,s){if(t.length<2)return;let r=function(e,t){let i=[];for(let s=0;s<e.length-1;s++){let r=e[s-1]||e[s],n=e[s],a=e[s+1],o=e[s+2]||a,l=n.x+(a.x-r.x)/t,u=n.y+(a.y-r.y)/t,h=a.x-(o.x-n.x)/t,c=a.y-(o.y-n.y)/t;i.push({cp1x:l,cp1y:u,cp2x:h,cp2y:c,x:a.x,y:a.y})}return i}(t,s);for(let s of(e.beginPath(),e.strokeStyle=i,e.moveTo(t[0].x,t[0].y),r))e.bezierCurveTo(s.cp1x,s.cp1y,s.cp2x,s.cp2y,s.x,s.y);e.stroke()}(e,l,n,this.lineSmoothing):h4(e,l,n)}function h4(e,t,i){if(t.length>1){e.beginPath(),e.strokeStyle=i;let s=t[0];e.moveTo(s.x,s.y);for(let i=1;i<t.length;i++){let s=t[i];e.lineTo(s.x,s.y)}e.stroke()}}function h5(e,{bar:t,slice:i,start:s}){e.lineWidth=this.lineWidth,e.lineCap="square",this.dashStyle&&e.setLineDash(iv(this.dashStyle));let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,n=null,a=null,o=[];hW.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eH(s)){let t=this.priceToY(s);a=this.getColor(i),n!==a&&(h4(e,o,n),o.length>0&&(o=[o.pop()]),n=a),o.push({x:r,y:t})}}r+=t.totalWidth}),h4(e,o,a)}let h6=[null,null,null,null];function h7(e,{bar:t,slice:i,start:s}){e.lineWidth=Math.max(1,.5*t.width),e.lineJoin="miter",e.miterLimit=1.5;let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,n=iX();n.prolog(e);let a=null,o=null,l=[];hW.call(this,i,s,(i,s)=>{if(!s){let s=e=>hQ.map(t=>this.dataAt(t,e)),[u,h,c,d]=s(i),[,p,f]=i<0?h6:s(i-1);if(eH(u,h,c,d)){let s=n.adjust(r),m=n.adjust(r-t.totalWidth),g=[u,h,c,d].map(this.priceToY,this).map(n.adjust),y=n.adjust(this.priceToY(h>p?p:f));o=this.getColor(i);let T=eH(a)&&a!==o,A=u===h?1:2,S=u===h?2:1;l.push({x:m,y:g[0]}),l.push({x:s,y:g[A]}),T&&(l.push({x:s,y:y}),h4(e,l,a),l=[]),T&&l.push({x:s,y:y}),l.push({x:s,y:g[S]}),a=o}}r+=t.totalWidth}),h4(e,l,o),n.epilog(e)}function h8(e,{bar:t,slice:i,start:s}){let r=this.view.xAxis.xScale.range()[0],n=t.totalWidth/2,a=r+t.offset+t.width/2,o=iX();o.prolog(e);let l=this.plot.timeSeries.builder.boxSize,u=l/2;hW.call(this,i,s,(i,s)=>{if(!s){let[t,s]=[aa.High,aa.Low].map(e=>this.dataAt(e,i)),r=this.colors[0],h=this.colors[1],c=this.dataAt(aa.BARKIND,i),d=uH(c),p=c===tG.BARKIND_XO,f=c===tG.BARKIND_OX;if(eH(t,s))for(let i=t;i>=s;i-=l){let l=o.adjust(a),[c,m]=[l-n,l+n],[g,y,T]=[i,i-u,i+u].map(e=>this.priceToY(e)),A=i===t&&p||i===s&&f?!d:d;e.beginPath(),A?(e.strokeStyle=h,e.moveTo(c,y),e.lineTo(m,T),e.moveTo(c,T),e.lineTo(m,y)):(e.strokeStyle=r,e.ellipse(l,g,n,y-g,0,0,2*Math.PI)),e.stroke()}}a+=t.totalWidth}),o.epilog(e)}function h9(e,{bar:t,slice:i,start:s},r){e.fillStyle=r;let[n,a]=this.fields,o=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,l=[];if(hW.call(this,i,s,(e,i)=>{if(!i){let t=this.dataAt(n,e),i=this.dataAt(a,e);eH(t,i)&&l.push({x:o,upY:this.priceToY(t),downY:this.priceToY(i)})}o+=t.totalWidth}),l.length>0){e.beginPath(),e.moveTo(l[0].x,l[0].upY);for(let t=1;t<l.length;++t)e.lineTo(l[t].x,l[t].upY);let t=l.length-1;e.lineTo(l[t].x,l[t].downY);for(let i=t-1;i>=0;--i)e.lineTo(l[i].x,l[i].downY);e.closePath(),e.fill()}}function ce(e,{bar:t,slice:i,start:s}){let[r,n]=this.fields,a=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,o=[],l=t=>{if(o.length>1){e.beginPath(),e.fillStyle=t,e.moveTo(o[0].x,o[0].upY);for(let t=1;t<o.length;++t)e.lineTo(o[t].x,o[t].upY);let i=o.length-1;e.lineTo(o[i].x,o[i].downY);for(let t=i-1;t>=0;--t)e.lineTo(o[t].x,o[t].downY);e.closePath(),e.fill()}},u=null,h=null;hW.call(this,i,s,(e,i)=>{if(!i){let t=this.dataAt(r,e),i=this.dataAt(n,e);if(eH(t,i)){let s=this.priceToY(t),r=this.priceToY(i);h=this.getColor(e),u!==h&&(l(u),o.length>0&&(o=[o.pop()]),u=h),o.push({x:a,upY:s,downY:r})}}a+=t.totalWidth}),l(h)}function ct(e,{bar:t,slice:i,start:s,range:[r,n]},a,o){if(o){let t=e.createLinearGradient(0,r,0,n);t.addColorStop(0,a),t.addColorStop(1,iP(a,0)),e.fillStyle=t}else e.fillStyle=a;e.beginPath();let l=null,u=this.pickMainField(),h=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,c=!1,d=null;hW.call(this,i,s,(i,s)=>{if(!s){let t=this.dataAt(u,i);if(eH(t)){let i=this.priceToY(t);c?e.lineTo(h,i):(e.moveTo(l=h,i),c=!0),d=h}}h+=t.totalWidth}),e.lineTo(d,n),e.lineTo(l,n),e.closePath(),e.fill()}class ci{symbol;aggregation;range;seriesKind;cacheMe;barsToFetch;offset;chartId;curveStyle;extendedHours;fields=[];alwaysUseBarsToFetch;inputs=[];splits;padded;constructor(e,t,i=Z.Normal,s=[null,null]){this.symbol=e,this.aggregation=t,this.range=s,this.seriesKind=i,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(!eH(this.curveStyle)||!tG.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return"Standard";switch(this.curveStyle){case W.Renko:{let{method:e,period:t,source:i,brickSize:s}=l2(this.inputs),r="ATR"===e?`ATR;${t}`:`${e};${s}`;return`Renko;${r};${i}`}case W.Kagi:{let{method:e,period:t,reversal:i}=uI(this.inputs),s="ATR"===e?`ATR;${t}`:`User;${i}`;return`Kagi;${s}`}case W.PointAndFigure:{let{method:e,period:t,reversal:i,boxSize:s,source:r,oneStepBack:n}=uF(this.inputs),a="ATR"===e?`ATR;${t}`:`User;${s}`;return`PointAndFigure;${a};${r};${i};${n}`}case W.LineBreak:{let{lineBreak:e}=uw(this.inputs);return`LineBreak;${e}`}default:return W[this.curveStyle]}}get needsExtraKey(){return[Z.Options,Z.BalanceSheet,Z.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(),i=this.getExtraKey(),s=this.extendedHours??!1;return`${this.symbol}|${e}|${s}|${this.range}|${this.seriesKind}|${this.offset}|${t}|${this.splits}|${this.padded}|${i}`}duplicate(){let e=new ci(this.symbol,this.aggregation.duplicate(),this.seriesKind,this.range);return e.cacheMe=this.cacheMe,e.barsToFetch=this.barsToFetch,e.alwaysUseBarsToFetch=this.alwaysUseBarsToFetch,e.offset=this.offset,e.chartId=this.chartId,e.curveStyle=this.curveStyle,e.extendedHours=this.extendedHours,e.fields=eG(this.fields),e.splits=this.splits,e.padded=this.padded,e}}var cs=R("c15IW");function cr(e,t){let i=e.query?.duplicate();if(!eH(i)||i.symbol===tG.PLACEHOLDER_SYMBOL_NAME||"Standard"!==i.getBuilderKey())return new uW;{0!==i.barsToFetch&&(i.barsToFetch=i.barsToFetch*tG.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);let e=t(i);return e.serverComputedSeries=!0,e}}function cn(e){return new as(e,z.Number,j.Study,e)}class ca{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=e0(),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){eY(this,e);let t=e.outFields??[e.target];this.studyFields=this.helpers.concat(t).reduce((e,t)=>(e[t.id]=t,e),{})}get helpers(){return tG.EMPTY_ARRAY}get hasData(){return null!==this.container}get source(){if(eH(this._source))return this._source;let e=eH(this.inputs)?this.inputs[tG.INPUT_SOURCE]:null;return eH(e)?aa[e]:null}set source(e){this._source=e}async ready(){return tU.call(this,async()=>{this.basisChangedToken=this.useNotifications?e(cs).subscribe(ao.TS_ALL,this.onBasisChanged.bind(this)):null;let t={tag:e0(),src:null},i=(await Promise.all(this.innerSeries.map(e=>e.ready()))).every(ed);return i&&this.calculate(t),i})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===ao.TS_EVENTSCHANGED||e===ao.TS_LOADING||this.innerSeries.some(e=>!e.hasData)||!this.shouldTriggerOurRecalc(t.series)||null===this.base||this===t.series)return;let i={tag:e0(),src:t.series};switch(e){case ao.TS_MANYCHANGED:this.calculate(i);break;case ao.TS_DATAPOINTCHANGED:case ao.TS_DATAPOINTADDED:{let s=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(i,s,e===ao.TS_DATAPOINTADDED);break}case ao.TS_TIMELINECORRECTION:case ao.TS_QUOTEMARKER:break;default:throw Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.useNotifications&&this.basisChangedToken&&e(cs).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 i=this.calculateAt(e);null!==i&&Object.keys(i).forEach(e=>{let s=i[e],r=this.studyFields[e];t?this.container.addDataPoint(r,s):this.container.setLastDataPoint(r,s)})}notify(e,t){eR(e,{series:this,index:t})}calculateCommon(e,t=null,i=-1,s=!0){let r=-1===i,n=r?t=>{(eH(e.src)||!eH(t.calcCtx))&&t.calculate(e)}:t=>t.recalculateAt(e,i,s);if(null===this.base||this.calcCtx&&this.calcCtx.tag===e.tag||this===e.src)return;this.calcCtx=e;let a=e=>this.isCalculable(e)&&!e.usedAsStyle;if(this.innerSeries.filter(a).forEach(e=>n(e)),r&&(this.container=this.makeContainer()),void 0!==this.calculateAt)if(r){let e=this.base.size;for(let t=0;t<e;++t)this.calculateDataPoint(t,!0)}else this.calculateDataPoint(i,s);t&&(eH(e.src)||this.initialNotification)&&this.notify(t,i)}calculate(e){this.calculateCommon(e,ao.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,i){this.computedServerSide||(!i&&eV(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,i?ao.TS_DATAPOINTADDED:ao.TS_DATAPOINTCHANGED,t,i))}baseVal(e,t){return this.base.getData(e)[t]}innCont(e){return this.innerSeries[e].container}innVal(e,t,i){let s=this.innCont(e),r=s.size;return i<0||i>r-1?null:s.getData(t)[i]}innHasData(e){let t=this.innCont(e);return eH(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(aa.DateTime,aa.Symbol)}makeContainer(){let e=this.defaultWrappers.concat(this.getWrappers());return new l0(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,i,s=this.base){return s.getData(i).slice(e-t+1,e+1)}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}}class co extends ca{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}}class cl extends co{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){let[t,i,s,r]=[aa.Open,aa.High,aa.Low,aa.Close].map(t=>this.baseVal(t,e),this),n=null,a=null,o=null,l=null,u=em([t,i,s,r]);if(e<1)n=em([t,r]),a=i,o=s,l=0;else{let[t,r]=[aa.Open,aa.Close].map(t=>this.container.getData(t)[e-1],this);a=Math.max(i,n=em([t,r]),u),o=Math.min(s,n,u),l=u-r}return{[aa.Open.id]:n,[aa.High.id]:a,[aa.Low.id]:o,[aa.Close.id]:u,[aa.Change.id]:l}}getWrappers(){return this.wrapBaseFields(aa.Volume,aa.OpenInterest,aa.TradingDay)}}class cu extends ca{constructor(e,t){super(e,t),fE(this)}calculateAt(e){let t=null,i=this.period,[,s]=f_(this);if(this.atLeast(e,i)&&s.hasField(this.source)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=em(r.filter(ep)):eg(r)&&(t=em(r))}return{[this.target.id]:t}}getWrappers(){return this.source===aa.Volume?this.wrapBaseFields(aa.Volume,aa.TradeSize,aa.Change,aa.Open,aa.Close):[]}}class ch extends ca{multiplier;constructor(e,t,i){super(e,t),this.multiplier=i(this.period),fE(this)}calculateAt(e){let t=null,[i,s]=f_(this);if(this.atLeast(e,2)&&s.hasField(this.source)){let r=this.container.getData(this.target)[e-1];if(null!==r)t=(this.innVal(i,this.source,e)-r)*this.multiplier+r;else{let i=this.period;if(this.atLeast(e,i)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=em(r.filter(ep)):eg(r)&&(t=em(r))}}}return{[this.target.id]:t}}}class cc extends ca{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=aa.OpenInterest;return this.base.hasField(i)&&(t=this.baseVal(i,e)),{[i.id]:t}}}let cd={inField:aa.MA,outFields:[aa.ENVU,aa.ENVD],func:fn},cp={inField:aa.EMA,outFields:[aa.ENVEXPU,aa.ENVEXPD],func:fa},cf={inField:aa.SMA,outFields:[aa.ENVSMOU,aa.ENVSMOD],func:fo};class cm extends ca{kind;perc;constructor(e,t,i){super(e,i),this.kind=t,this.perc=this.inputs.Percent/100;let s=t.func(i,this.inputs.Period,e.source);this.addInner(s)}calculateAt(e){let t=null,i=null,s=this.innVal(1,this.kind.inField,e);if(null!==s){let e=s*this.perc;t=s+e,i=s-e}return{[this.kind.outFields[0].id]:t,[this.kind.outFields[1].id]:i}}}class cg extends ca{constructor(e,t){super(e,t);let i=fn(t,this.inputs.Period1,this.source),s=fn(t,this.inputs.Period2,this.source),r=fb(this.target,(e,t,i)=>t-i,i,s);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}}let cy={fields:[aa.MACD,aa.MACDS,aa.MACDH],avgFunc:fn,mapFunc:fP,histogramVaryColor:!0},cT={fields:[aa.MACD,aa.MACDS,aa.MACDH],avgFunc:fa,mapFunc:fP,histogramVaryColor:!0},cA={fields:[aa.MACD,aa.CTLTM,aa.CTM],avgFunc:fa,mapFunc:fP,histogramVaryColor:!1},cS={fields:[aa.MACD,aa.CTLTMF,aa.CPMI],avgFunc:fa,mapFunc:fP,histogramVaryColor:!1},cv={fields:[aa.PPO,aa.PPOS,aa.PPOH],avgFunc:fa,mapFunc:fC,histogramVaryColor:!0},cb={fields:[aa.PVO,aa.PVOS,aa.PVOH],avgFunc:fa,mapFunc:fC,histogramVaryColor:!1};class cP extends ca{histogramVaryColor=!1;histogramField;get helpers(){return[aa.BARCOLIX]}calculateAt(e){let t=-1;if(this.histogramVaryColor&&e>0){let i=this.container.getData(this.histogramField)[e],s=this.container.getData(this.histogramField)[e-1];if(eH(i,s)){let r=i<=0;t=r?1:3,e>0&&(r&&i>s&&(t=0),!r&&i<s&&(t=2))}}return{[aa.BARCOLIX.id]:t}}}class cC extends cP{fields;constructor(e,t,i){super(e,i),this.fields=t.fields,this.histogramVaryColor=t.histogramVaryColor,this.histogramField=this.fields[2];let s=t.avgFunc(i,e.inputs.Period1,e.source,void 0),r=t.avgFunc(i,e.inputs.Period2,e.source,void 0),n=fb(this.fields[0],t.mapFunc,s,r),a=t.avgFunc(n,e.inputs.Period3,n.target,this.fields[1]),o=fb(this.fields[2],fP,n,a);this.addInner(n,a,o)}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}}let cE=cn("_AVG_GAIN"),c_=cn("_AVG_LOSS");class cM extends ca{constructor(e,t,i){super(e,i);let s=fy(i,this.inputs.Period,this.source,aa.RSI,t),r=fO(e,"MA","Average")(s,this.inputs.PeriodAvg,aa.RSI,aa.RSIAVG);this.addInner(s,r)}getWrappers(){return[this.wrapInner(aa.RSI,1),this.wrapInner(aa.RSIAVG,2)]}}class cL extends ca{highest;index;constructor(e,t,i,s){super(e,s),this.highest=t,this.index=i}calculateAt(e){let t=null,i=this.inputs.Period;if(this.atLeast(e,i)){let s=this.past(e,i,this.source);eg(s)&&(t=this.highest?Math.max(...s):Math.min(...s),this.index&&(t=i-s.indexOf(t)-1))}return{[this.target.id]:t}}}class cx extends ca{toHighest;field;highField;lowField;constructor(e,t,i){super(e,i),this.toHighest=t;let s=eH(e.source),r=e.source,n=s?r:aa.Close;this.field=n;let a=s?r:aa.High;this.highField=a;let o=s?r:aa.Low;this.lowField=o;let l=fh(i,e.inputs.Period,this.highField,aa.HH,!0),u=fh(i,e.inputs.Period,this.lowField,aa.LL,!1);this.addInner(l,u)}calculateAt(e){let t=null,i=this.baseVal(this.field,e),s=this.innVal(1,aa.HH,e),r=this.innVal(2,aa.LL,e);if(eg([i,s,r])){let e=this.toHighest?s:r,n=s-r;0!==n&&(t=(i-e)/n*100)}return{[this.target.id]:t}}}let cO=cn("RawPercK");class cI extends ca{kField;constructor(e,t,i,s){super(e,s);let r=fc(s,this.inputs.Period1,t?cO:i,!1),n=fO(e,"MA"),a=n(r,this.inputs.Period2,r.target,t?i:aa.PercD),o=t?n(a,this.inputs.Period3,a.target,aa.PercD):a;this.kField=i,t?this.addInner(a,o):this.addInner(r,a)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(aa.PercD,2)]}}class cD extends ca{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=this.inputs.Period,r=this.source,n=fn(i,s,r),a="Modified"===t,o=fA(a?function(e,t,i=aa.PCTCHG){return fi("PCTCHG",{source:t,target:i,inputs:fd},e)}(i,r):i,s,a?aa.PCTCHG:r);this.addInner(n,o)}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=this.innVal(2,aa.MSD,e),l=null!==o;if(l){n=this.innVal(1,aa.MA,e);let l=this.inputs.Width*o;t=n+l,i=n-l,a=(s=2*l)/n*100,r=(this.baseVal(aa.Close,e)-i)/(t-i)}switch(this.kind){case"Regular":return{[aa.BOLLBU.id]:t,[aa.BOLLBL.id]:i,[aa.BOLLBM.id]:n};case"Width":return{[aa.BOLLBW.id]:s};case"Percent":return{[aa.BOLLBP.id]:r};case"Squeeze":return{[aa.BOLLSQ.id]:a};case"Modified":{let e=null,t=null,i=null,s=null;if(l){let r=this.inputs.MultInside,a=this.inputs.MultOutside;e=n+r*o,i=n-r*o,t=n+a*o,s=n-a*o}return{[aa.MBBUI.id]:e,[aa.MBBLI.id]:i,[aa.MBBUO.id]:t,[aa.MBBLO.id]:s,[aa.MBBM.id]:n}}default:return null}}}let cw=cn("_ABS_CHG"),cR=cn("_MA_ABS_CHG"),cN=cn("_CHG"),cV=cn("_PDM"),cH=cn("_MDM"),cF=cn("_TRS"),ck=cn("_PDS"),cB=cn("_MDS"),cU=cn("_DX");class cW extends ca{useEma;adxField;multiplier;constructor(e,t,i,s){super(e,s),this.useEma=t,this.adxField=i,this.multiplier=2/(this.inputs.AdxSmoothing+1);let r=fp(s,aa.TR);this.addInner(r)}get helpers(){return[cV,cH,cF,ck,cB,cU]}sum(e,t,i,s){let r=null;if(this.atLeast(e-1,s-1)){let n=this.past(e-1,s-1,t,this.container);n.push(i),eg(n)&&(r=n.reduce((e,t,i)=>e+t,0))}return r}smooth1(e,t,i,s){let r=this.inputs.DiLength,n=this.container.getData(i)[e-1];return null!==n?n-n/r+s:this.sum(e,t,s,r)}smooth2(e,t,i,s){let r=this.container.getData(i)[e-1],n=this.inputs.AdxSmoothing;if(null!==r)if(this.useEma)return(s-r)*this.multiplier+r;else return(r*(n-1)+s)/n;{let i=this.sum(e,t,s,n);if(null!==i)return i/n}return null}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=null,l=null,u=null;if(e>0){let h=this.past(e,2,aa.High),c=this.past(e,2,aa.Low),d=Math.max(h[1]-h[0],0),p=Math.max(c[0]-c[1],0);t=d>p?d:0,i=p>d?p:0;let f=this.container.getData(aa.TR)[e];r=this.smooth1(e,cV,ck,t),n=this.smooth1(e,cH,cB,i),s=this.smooth1(e,aa.TR,cF,f),(r>0||n>0)&&0!==s&&(l=100*Math.abs((a=r/s*100)-(o=n/s*100))/(a+o),u=this.smooth2(e,cU,this.adxField,l))}return{[cV.id]:t,[cH.id]:i,[cF.id]:s,[ck.id]:r,[cB.id]:n,[aa.PDI.id]:a,[aa.MDI.id]:o,[cU.id]:l,[this.adxField.id]:u}}getWrappers(){return[this.wrapInner(aa.TR,1)]}}class c$ extends ca{calculateAtFunc;constructor(e,t,...i){super(e,...i),this.calculateAtFunc=t}calculateAt(e){let t=this.innerSeries.map((t,i)=>{let s=t.target;return eH(s)||(s=t.container.hasField(aa.Close)?aa.Close:t.container.fields[0]),this.innVal(i,s,e)}),i=null;return eg(t)&&(i=this.calculateAtFunc(e,...t)),{[this.target.id]:i}}}function cG(e,t){let i=this.baseVal(aa.High,t),s=this.baseVal(aa.Low,t);return{[e.id]:(i+s)/2}}function cz(e,t){let i=this.baseVal(aa.High,t),s=this.baseVal(aa.Low,t);return{[e.id]:i-s}}class cY extends ca{calculateAtFunc;constructor(e,t,i){super(e,i),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}}let cj=cn("_RANGE"),cK=cn("_MOV_RANGE"),cq={fields:[aa.KCUP,aa.KCLOW,aa.KCMID],midSeries:e=>fm(e,aa.TP),midTarget:aa.TP,rangeSeries:e=>fv(cj,eu(cz,cj),e),rangeTarget:cj,func:"MA",useMultiplier:!1},cX={fields:[aa.KBUP,aa.KBLOW,aa.KBMID],midSeries:e=>e,midTarget:aa.Close,rangeSeries:e=>fp(e,aa.TR),rangeTarget:aa.TR,func:"EMA",useMultiplier:!0};class cZ extends ca{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=t.midSeries(i),r=fO(e,t.func,"Average"),n=r(s,this.inputs.Period,t.midTarget,t.fields[2]),a=r(t.rangeSeries(i),this.inputs.Period,t.rangeTarget,cK);this.addInner(n,a)}calculateAt(e){let t=this.innVal(1,this.kind.fields[2],e),i=this.innVal(2,cK,e),s=null!==t&&null!==i,r=this.kind.useMultiplier?this.inputs.Multiplier:1;return{[this.kind.fields[0].id]:s?t+i*r:null,[this.kind.fields[1].id]:s?t-i*r:null}}getWrappers(){return[this.wrapInner(this.kind.fields[2],1)]}}class cJ extends ca{isWidth;constructor(e,t,i){super(e,i),this.isWidth=t;let s=fh(i,this.inputs.Period,aa.High,aa.DONUP,!0),r=fh(i,this.inputs.Period,aa.Low,aa.DONLOW,!1);this.addInner(s,r)}calculateAt(e){let t=this.innVal(1,aa.DONUP,e),i=this.innVal(2,aa.DONLOW,e),s=null===t&&null===i;return this.isWidth?{[aa.DONW.id]:s?null:t-i}:{[aa.DONMID.id]:s?null:(t+i)/2}}getWrappers(){return[this.wrapInner(aa.DONUP,1),this.wrapInner(aa.DONLOW,2)]}}let cQ=cn("_HIND"),c0=cn("_LIND");class c1 extends ca{justWidth;constructor(e,t,i){super(e,i),this.justWidth=t,this.justWidth=t;let s=this.inputs.Period,r=fh(i,s,aa.High,cQ,!0,!0),n=fh(i,s,aa.Low,c0,!1,!0);this.addInner(r,n)}calculateAt(e){let t=null,i=null,s=null,r=this.innVal(1,cQ,e),n=this.innVal(2,c0,e);if(null!==r&&null!==n){let e=this.period;s=(t=(e-r)/e*100)-(i=(e-n)/e*100)}return this.justWidth?{[aa.ARNOSC.id]:s}:{[aa.ARNUP.id]:t,[aa.ARNLOW.id]:i}}}let c2=cn("_MIDPOINT"),c3=cn("_MIDPOINT");class c4 extends ca{multiplyVol;constructor(e,t,i){super(e,i),this.multiplyVol=t}calculateAt(e){let[t,i,s,r]=[aa.High,aa.Low,aa.Close,aa.Volume].map(t=>this.baseVal(t,e)),n=t===i?0:(s-i-(t-s))/(t-i);return this.multiplyVol&&(n*=r),{[this.target.id]:n}}}let c5=cn("_RANGE"),c6=cn("_MATP");class c7 extends ca{isBull;constructor(e,t,i){super(e,i),this.isBull=t;let s=fa(i,this.inputs.Period,this.source);this.addInner(s)}calculateAt(e){let t=null,i=this.innVal(1,aa.EMA,e);return null!==i&&(t=this.isBull?this.baseVal(aa.High,e)-i:this.baseVal(aa.Low,e)-i),{[this.isBull?aa.ERBLPOW.id:aa.ERBRPOW.id]:t}}}let c8=cn("_FORCE"),c9=cn("_RANGE"),de=cn("_EMA1"),dt=cn("_EMA2"),di=cn("_RATIO"),ds={isNegative:!1,fields:[aa.PVI,aa.PVIEMA]},dr={isNegative:!0,fields:[aa.NVI,aa.NVIEMA]};class dn extends ca{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=fv(this.kind.fields[0],eu(function(e,t){let i=1e3;if(t>0){let s=[aa.Close,aa.Volume],[r,n]=s.map(e=>this.baseVal(e,t)),[a,o]=s.map(e=>this.baseVal(e,t-1)),l=this.container.getData(this.target)[t-1];i=(e?n<o:n>o)?l*((r-a)/a+1):l}return{[this.target.id]:i}},this.kind.isNegative),i),r=fa(s,this.inputs.Period,this.kind.fields[0],this.kind.fields[1]);this.addInner(s,r)}getWrappers(){return[this.wrapInner(this.kind.fields[0],1),this.wrapInner(this.kind.fields[1],2)]}}let da=cn("_LOGPC"),dl=cn("_SWING_INDEX"),du=cn("_MIN_CLOSE"),dh=cn("_MAX_CLOSE"),dc=cn("_EP"),dd=cn("_AF"),dp=cn("_POS"),df=cn("_IDY"),dm=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],dg=e=>Array(e).fill(0);function dy(e,t,i){let s=e[i-1];return 0===t&&(s=e[i]),t<0&&(s=e[i+1]),s}function dT(e,t,i){let s=0,r=-1,n=0,a=1;for(let o=0;o<i;++o){if(t[o]=0,null==e[o]||(21==++s&&(a=2),31==s&&(a=3),n+=e[o]*a,s<40))continue;t[o]=n/70;let l=0,u=r+1;for(let t=u;t<i&&(null==e[t]||(1==++l&&(r=t),(1==l||21==l||31==l)&&(n-=e[t]),31!=l));++t);}}let dA={1:{param:"cot",func:"parseCotLineChart",fields:[aa.DateTime,aa.COTLCCMSP,aa.COTLCLGSP,aa.COTLCSMSP]},2:{param:"cotadv",func:"parseDisaggregated",fields:[aa.DateTime,aa.COTDAGPRO,aa.COTDAGSPD,aa.COTDAGMNM,aa.COTDAGOTH]},3:{param:"cotfin",func:"parseFinancialTradersReport",fields:[aa.DateTime,aa.COTFTRDLI,aa.COTFTRASM,aa.COTFTRLVF,aa.COTFTROTH]}};class dS extends ca{wrappers;constructor(e,t,i){super(e,cr(i,e=>new dv(t,e))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=dA[t].fields.slice(1).map(e=>this.wrapInner(e,0))}getWrappers(){return this.wrappers}}class dv extends uU{kind;constructor(e,t){super(t),this.kind=e}getRetriever(){return new db(this.kind)}onStreamingUpdates(e){}}class db extends uu{kind;constructor(e){super(),this.kind=e}addExtraParams(e){e[dA[this.kind].param]="y"}getParser(e){return new dP(e.symbol,e.aggregation,this.kind)}}class dP extends ua{kind;constructor(e,t,i){super(e,t,0),this.kind=i}makeContainer(){return new lJ(dA[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[dA[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(aa.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aa.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(aa.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(aa.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(aa.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aa.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(aa.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(aa.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(aa.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(aa.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aa.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(aa.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(aa.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(aa.COTFTROTH,parseInt(e[5]))}}class dC extends dS{constructor(e,t){super(e,1,t)}}let dE={Day:[aa.PreviousHigh,aa.PreviousLow,aa.PreviousClose],Week:[aa.WeekPreviousHigh,aa.WeekPreviousLow,aa.WeekPreviousClose],Month:[aa.MonthPreviousHigh,aa.MonthPreviousLow,aa.MonthPreviousClose]};class d_ extends ca{disabled;record;streamingSubscription;constructor(e,t,i){if(super(e,i),this.disabled=!eH(i.query)||!eH(i.query.symbol),!this.disabled){let e=i.query.symbol;e.endsWith(".BZ")&&(e=e.slice(0,-3)),this.record=y0().getRecordSource().getRecord(e),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()}this.initialNotification=!0}getStreamingSubscription(){return y0().getRecordSource().subject.pipe(uf(e=>{let t=aC(ao.RT_QUOTE,this.record.symbol);return e.filter(t)}),oc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return tU.call(this,async()=>eH(this.record)?await this.record.ready()&&await super.ready():await super.ready(),"asyncReadyWork2")}onStreamingUpdates(e){if(this.record){let e={tag:e0(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return dE[e].map(e=>this.record.getValue(e))}}class dM extends uU{constructor(e){super(e)}getRetriever(){return tm(this.query.symbol)?new dI:new dL}onStreamingUpdates(e){}}class dL extends uu{addExtraParams(e){e.impl="y"}getParser(e){return new dO(e.symbol,e.aggregation)}}function dx(){return new lJ([aa.DateTime,aa.IMPVOL])}class dO extends ua{constructor(e,t){super(e,t)}makeContainer(){return dx()}getParseFunc(){return this.parseImpVol}parseImpVol(e){this.aggregation.isEndOfDay&&!(e.length<9)&&(this.container.addDataPoint(aa.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aa.IMPVOL,parseFloat(e[8])))}}class dI extends uh{emptyContainer(e,t){return dx()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(aa.DateTime,lY(e.date.substring(0,10)));let s=eV(e.impliedVolatility);i.addDataPoint(aa.IMPVOL,s?100*e.impliedVolatility:null)}}let dD=cn("_ABS_CHG"),dw=cn("_DS1_EMA1"),dR=cn("_DS1_EMA2"),dN=cn("_DS2_EMA1"),dV=cn("_DS2_EMA2"),dH=cn("_DIFF"),dF=cn("_SUM"),dk=cn("_ABS_CHG"),dB=cn("_HH_LL"),dU=cn("_MULMA");class dW extends ca{constructor(e,t,i){super(e,i);let s="Close"===e.inputs.TurtleChnField,r=fw(i);if(!s&&r){let e=fv(this.target,(e,t)=>null,i);this.addInner(e)}else{let e=(e,t)=>({[dk.id]:t>0?e*Math.abs(this.baseVal(aa.Change,t)):null}),r=fn(fv(dk,eu(e,this.inputs.FactorATR),i),this.inputs.PeriodAdjATR,dk,aa.MA),n=t?aa.High:aa.Low,a=fh(i,this.inputs.PeriodTurtleChn,s?aa.Close:n,dB,t),o=fb(dU,(e,t)=>this.inputs.FactorAdjATR*t,r),l=t?-1:1,u=fb(this.target,(e,t,i)=>t+l*i,a,o);this.addInner(u)}}getWrappers(){return[this.wrapInner(this.target,1)]}}let d$=cn("_DIFF");class dG extends co{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 i=(e,t)=>this.baseVal(e,t),s=[aa.Open,aa.High,aa.Low,aa.Close],r=s.map(t=>i(t,e));if(eg(r)){let n=s.map(t=>i(t,e-1));if(eg(n)){let[i,s]=eM(t=r.map((e,t)=>100*(e-n[t])/n[t]));if(t[1]=s,t[2]=i,e>1){let i=this.container.getData(aa.Close)[e-1];t[4]=t[3]-i}}}}return{[aa.Open.id]:t[0],[aa.High.id]:t[1],[aa.Low.id]:t[2],[aa.Close.id]:t[3],[aa.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(aa.Volume,aa.OpenInterest,aa.TradingDay)}}let dz=cn("_DIST"),dY=cn("_EMA_DIST1"),dj=cn("_EMA_DIST2"),dK=cn("_DIFF"),dq=cn("_EMA_DIFF1"),dX=cn("_EMA_DIFF2"),dZ=cn("_CHG"),dJ=cn("_M1"),dQ=cn("_M2");class d0 extends ca{constructor(e,t){super(e,t);let i=fv(dZ,function(e){let t=aa.Close,i=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[dZ.id]:i}},t),s=fb(dJ,(e,t)=>t>=0?t:0,i),r=fb(dQ,(e,t)=>t>=0?0:-t,i);this.addInner(s,r)}perc(e,t){return 100*e/t}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i+1)){let s=this.past(e,i,dJ,this.innCont(1)),r=this.past(e,i,dQ,this.innCont(2));if(eg(s)&&eg(r)){let e=ef(s),i=ef(r);t=this.perc(e-i,e+i)}}return{[aa.CHDMOMOSC.id]:t}}}let d1=cn("_MAX"),d2=cn("_MIN"),d3=cn("_ISUPTREND"),d4=cn("_TRENDUP"),d5=cn("_TRENDDOWN"),d6=cn("_TREND"),d7=cn("_CUM_PRICE"),d8=cn("_CUM_VOL"),d9=cn("_PER_CHG");class pe extends ca{constructor(e,t){super(e,t);let i=this.source,s=fv(i,eu(fM,i),t);this.addInner(s)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}}let pt=cn("_DIFF"),pi=[pt,aa.Buy,aa.Sell];function ps(e,t,i,s){let r=null,n=null,a=null;eH(i,s)&&(a=i-s);let o=t>0?e.getData(pt)[t-1]:null;return eH(a,o)&&(r=a>0&&o<=0?1:null,n=a<0&&o>=0?-1:null),{[pt.id]:a,[aa.Buy.id]:r,[aa.Sell.id]:n}}let pr=cn("_PVM"),pn=cn("_NVM");var cs=R("c15IW");function pa(e,t,i){return new po(e,t,i)}class po{exprModel;innerSeries;calculable;container;innerLookup;policy;exprSymbols;valueSymbols;onlyForTimeline;recalcTriggers;crashedComputationReported;isLoading;_sourceFields;_targetFields;basisChangedToken;quoteGroupToken;constructor(e,t,i){this.exprModel=e,this.innerSeries=t,this.calculable=!0,this.valueSymbols=[],this.crashedComputationReported=!1,this.isLoading=!1,this.basisChangedToken=null,this.quoteGroupToken=null,this.container=null,this.innerLookup=t.reduce((e,t)=>(e[i.mapper(t)]=t,e),{}),this.policy=i,this.exprSymbols=nW(e),this.valueSymbols=this.exprSymbols.filter(e=>void 0===this.innerLookup[e]),this.onlyForTimeline=eS(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!eH(this.exprModel)}get hasData(){return null!==this.container}get sourceFields(){return this._sourceFields||(this._sourceFields=Array.from(this.policy.fieldMap.keys())),this._sourceFields}get targetFields(){return this._targetFields||(this._targetFields=Array.from(this.policy.fieldMap.values())),this._targetFields}async ready(){return tU.call(this,async()=>{this.basisChangedToken=e(cs).subscribe(ao.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=e(cs).subscribe(ao.RT_QUOTEGROUP,this.onQuoteGroup.bind(this));let t=this.innerSeries.map(e=>e.ready());void 0!==this.policy.valueProvider&&t.push(this.policy.valueProvider.ready());let i=(await Promise.all(t)).every(ed);return i&&this.calculate(),i})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every(e=>eH(e.container))&&this.calculateCommon(ao.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===F.Manual||e===ao.TS_EVENTSCHANGED||e===ao.TS_LOADING||!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some(e=>!eH(e.container)))return;let i=this.policy.mapper(t.series);if(!(e===ao.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(i)))switch(this.policy.recompute===F.Everything?ao.TS_MANYCHANGED:e){case ao.TS_MANYCHANGED:this.calculate();break;case ao.TS_DATAPOINTCHANGED:case ao.TS_DATAPOINTADDED:this.recalculate(e===ao.TS_DATAPOINTADDED);break;case ao.TS_TIMELINECORRECTION:case ao.TS_QUOTEMARKER:break;default:throw Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.basisChangedToken&&e(cs).unsubscribe(this.basisChangedToken),this.quoteGroupToken&&(e(cs).unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map((t,i)=>t===aa.Volume?ef(this.exprSymbols.map(t=>e.inn[t].values[i]??0)):nk(this.exprModel,t=>e.oneValue[t]??e.inn[t]?.values[i]??null))}pickMainField(){let e=null;for(let t of this.policy.fieldMap.values())if(null==e)e=t;else if(t===aa.Close){e=t;break}return e}calculateLastChange(){let e=this.container,t=e.size;if(t<=1)return;let i=this.pickMainField(),s=e.getData(i)[t-2],r=e.getData(i)[t-1];eH(s,r)&&e.setLastDataPoint(aa.Change,r-s)}calculateDataPoint(e,t){let i=this.calculateAt(e);if(null===i)return;e.atLeastOne=!0;let[s,r]=eM(i,0,3);i[1]=r,i[2]=s,this.targetFields.forEach((e,s)=>{let r=i[s];t?this.container.addDataPoint(e,r):this.container.setLastDataPoint(e,r)}),t&&(this.container.addDataPoint(aa.Change,null),this.container.addDataPoint(aa.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){eR(e,{series:this,index:this.container.size-1})}fieldValueAt(e,t,i){let s=this.innerLookup[e].container.getData(i);return t<0||t>=s.length?null:s[t]}timeStampAt(e,t){return this.fieldValueAt(e,t,aa.DateTime)}timeline(e){return e.container.getData(aa.DateTime)}getRangeHelper(){switch(this.policy.missing){case H.UseNext:case H.UseNone:return Math.min;case H.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=>eP(this.timeline(this.innerLookup[e]))))),end:new Date(e(...this.symbols.map(e=>eb(this.timeline(this.innerLookup[e])))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(e,t){let i=this.timeline(this.innerLookup[e]);switch(this.policy.missing){case H.UseNext:case H.UseNone:return i.findIndex(e=>e.valueOf()>=t.valueOf());case H.UsePrevious:return eC(i,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=>!eH(e.timeStamp)&&(!this.policy.stretch(e.symbol)||1===t))}fillPosSymbolAt(e,t,i){e.index=t,e.timeStamp=this.timeStampAt(e.symbol,t);let s=(this.policy.missing===H.UseNone||this.policy.skipLeadingEmpty&&!i.atLeastOne)&&e.timeStamp&&e.timeStamp.valueOf()!==i.timeStamp.valueOf();return e.values=this.sourceFields.map(i=>s?null:this.fieldValueAt(e.symbol,t,i)),e}skippable(e){return!!this.innerLookup[e].container.isEmpty&&(this.policy.noDataApproach===k.IgnoreTimelineOnly&&this.onlyForTimeline.includes(e)||this.policy.noDataApproach===k.ModelTransformRequired)}get symbols(){let e=Object.keys(this.innerLookup);return eH(this.onlyForTimeline)?e.filter(e=>!this.skippable(e)):e}getPos(e){let t={isNull:!0,inn:{},timeStamp:e,atLeastOne:!1,oneValue:{}};return 0===this.symbols.length||(this.symbols.forEach(i=>{let s=this.findIndex(i,e),r={symbol:i,index:-1,timeStamp:new Date(0),values:[]};t.inn[i]=this.fillPosSymbolAt(r,s,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(;eH(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=>null!==e.timeStamp).map(e=>e.timeStamp.valueOf()))),this.policy.missing===H.UsePrevious?this.getInner(e).forEach(t=>{let i=eH(t.timeStamp);(i&&t.timeStamp.valueOf()>e.timeStamp.valueOf()||!i&&this.policy.stretch(t.symbol))&&this.fillPosSymbolAt(t,t.index-1,e)}):this.policy.missing===H.UseNone&&this.getInner(e).forEach(t=>this.fillPosSymbolAt(t,t.index,e))))}shouldAdd(e){return this.container.getLastDataPoint(aa.DateTime).valueOf()<e.timeStamp.valueOf()}calculateCommon(e=null,t=null,i=!0){try{if(t)this.calculateDataPoint(t,i);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||(yK(e,"error"),this.crashedComputationReported=!0)}}calculate(){let{yes:e,no:t}=eT(this.innerSeries,e=>!e.container.isEmpty);if(t.length>0&&this.policy.noDataApproach===k.ModelTransformRequired){let i=e=>e.map(this.policy.mapper),s=this.policy.modelTransform(i(e),i(t));null!==s&&(this.exprModel=s)}this.calculateCommon(ao.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;let t=this.getLastPos(),i=this.shouldAdd(t);this.calculateCommon(i?ao.TS_DATAPOINTADDED:ao.TS_DATAPOINTCHANGED,t,i)}recalculateAt(e,t,i){return this.recalculate(i)}makeContainer(){return new lJ([aa.DateTime,aa.Change].concat(this.targetFields))}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}}let pl=cn("_AVG"),pu=cn("_HAO"),ph=cn("_HAH"),pc=cn("_HAL"),pd=cn("_HAC"),pp=cn("_DELTA"),pf=cn("_DIFF"),pm=cn("_RANK"),pg=cn("_CHG"),py=cn("_AVG"),pT=cn("_HBRAKE_CHG"),pA=cn("_HEIGHT_DELTA"),pS=cn("_ACTION"),pv=cn("_REVERSAL"),pb=e=>[e>0,e<0],pP=[null,null,null];function pC([e,t],i){let s=null;if(i>0){let t=this.baseVal(e,i-1);eH(t)&&(s=this.baseVal(e,i)-t)}return{[t.id]:s}}class pE extends ca{useHandbrake;constructor(e,t){super(e,t);let i=fO(e,"MA","Average"),s=i(t,e1(1,999,this.inputs.FastPeriod),aa.Close),r=e1(0,999,this.inputs.SlowPeriod),n=r>0,a=n?i(t,r,aa.Close):t,o=fb(pf,n?(e,t,i)=>t-i:(e,t,i)=>i-t,s,a),l=fv(pg,eu(pC,[aa.Close,pg]),t),u=fv(pm,function(e){let t=Math.abs(this.baseVal(pf,e)),i=null,s=0,r=0;for(let i=e-1;i>=0&&s<200;--i){let e=Math.abs(this.baseVal(pf,i));s++,e<t&&r++}return s>0&&(i=Math.floor(r/s*10)),10===i&&i--,{[pm.id]:i}},o),h=e1(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=h>0;let c=i(t,h,aa.Close,py),d=fv(pT,eu(pC,[py,pT]),c);this.addInner(l,o,u,d)}get helpers(){return[pA,aa.BARCOLIX,pS,pv]}getStateAt(e){let t=this.innVal(2,pf,e);return eH(t)?pb(t):pP}findPreviousKnownState(e){for(let t=e-1;t>0;t--){let e=this.getStateAt(t);if(e===pP)break;let[i,s]=e;if(i||s)return e}return pP}getBuySell(e){let t=this.getStateAt(e);if(t===pP)return pP;let[i,s]=t,r=this.findPreviousKnownState(e),[n,a]=r;if(!i&&!s)return r===pP?pP:[n,a,!1];let o=i!==n||s!==a;return o?[n,a,o]:[i,s,o]}getPrev(e,t){return t>0?this.container.getData(e)[t-1]:null}calculateAt(e){let t=null,i=null,s=0,r=-1,n=0,[a,o,l]=this.getBuySell(e),[u,h]=[pv,pS].map(t=>this.getPrev(t,e)),[c,d]=[0,-1].map(t=>this.innVal(4,pT,e+t));if(r=l?10:this.innVal(3,pm,e),this.useHandbrake&&eH(c,d)){let t=a&&d>0||o&&d<0,i=!a&&c>0||!o&&c<0;l?(r=i?10:12,n=h):(!0===u||1===h)&&(t?(r=this.innVal(3,pm,e),n=2):(r=i?11:13,n=1))}if(eH(this.innVal(2,pf,e))){let t=this.innVal(1,pg,e),[i,r]=pb(t),n=Math.abs(t);(a&&i||o&&r)&&(s=n),(a&&r||o&&i)&&(s=-n)}return a?t=1:o&&(i=1),{[aa.JPIB.id]:t,[aa.JPIS.id]:i,[aa.BARCOLIX.id]:r,[pA.id]:s,[pS.id]:n,[pv.id]:l}}}let p_={FastPeriod:8,SlowPeriod:21,HandbrakePeriod:13,Average:"EMA",Height:"Fixed"},pM=cn("_SMTH_ROC"),pL=cn("_TEN_SMTH_ROC");function px(e,t,i,s,r){return new ch({source:s,target:r,outFields:[r],aggregation:i,inputs:fe(t)},e,e=>2/e)}let pO=cn("_VOL_AVG"),pI=131,pD=(()=>{let e=eF(.9865008210958766,6),t=eL(52,t=>Math.pow(e,t)),i=52/ef(t);return t.map(e=>e*i)})(),pw=["Renko","Kagi","PointAndFigure","LineBreak"];function pR(e){return e===G.Continue||e===G.Nearest}class pN extends ca{additionalChunksCounter=1;noData=!1;isPeriodic=!1;constructor(e,t,i){super(e,i,cr(i,e=>{if(!sF(es[y0()?.config.mode??"Unspecified"]))return i;let t=e.duplicate(),s=e.aggregation;if(s.hasSpec)if(pR(s.spec))return i;else return new uW(t,!0);let r=s.unit===$.Intraday&&s.size<=5,n=function(e,t){switch(e){case $.Intraday:if(t>=240)return 3;if(t>=120)return 2;return 1;case $.Day:default:return 5;case $.Week:return 15;case $.Month:return 60;case $.Quarter:case $.Year:return 240}}(s.unit,s.size);return t.aggregation=r?new nP($.Tick,s.size,G.PerSeconds):new nP($.Intraday,n),t.barsToFetch=Math.min(tG.MAX_INTRADAY_BARS,(r?1:3)*e.barsToFetch),new uU(t)})),this.isPeriodic=t,this.noData=this.innerSeries[1]instanceof uW,this.computedServerSide=!0,this.initialNotification=!0}get canLoadMoreData(){return!1}loadMoreData(){let e=this.innerSeries[1];return!this.noData&&this.additionalChunksCounter<20&&e.canLoadMoreData&&!e.isLoading?(this.additionalChunksCounter+=1,e.loadMoreData()):Promise.resolve()}recalculateAt(e,t,i){if(e.src!==this.innerSeries[0])return;let s=i?ao.TS_DATAPOINTADDED:ao.TS_DATAPOINTCHANGED;this.notify(s,this.innerSeries[0].container.size-1)}getWrappers(){return[this.wrapInner(aa.Change,1),this.wrapInner(aa.Open,1),this.wrapInner(aa.Close,1)]}}let pV=cn("_EMA1"),pH=cn("_EMA2"),pF=cn("_MACD"),pk=cn("_PCTK"),pB=cn("_PCTD"),pU=cn("_PCTK2"),pW=cn("_EMA1"),p$=cn("_EMA2"),pG=cn("_CORE");class pz extends ca{constructor(e,t){if(super(e,t),fR(t)){let i=["$ADVT","$DECT"];switch(this.inputs.Source){case"TotalStocks":default:break;case"NYSEStocks":i=["$ADVN","$DECN"];break;case"NasdaqStocks":i=["$AVDQ","$DECQ"]}let s=this.getSeries(t.query,i[0]),r=this.getSeries(t.query,i[1]),n=this.getTargetSeries(e,s,r);this.addInner(s,r,n),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=fv(aa.Close,(e,t)=>null,t),i=fv(aa.Close,(e,t)=>null,t),s=fv(this.target,(e,t)=>null,t);this.addInner(e,i,s),this.canLoadMoreData=!1}}get baseIndex(){return 1}getSeries(e,t){let i=e.duplicate();return i.symbol=t,y0().getTimeSeriesDataSource().getTimeSeries(i)}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e!==this.innerSeries[0]&&(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)]}}let pY=cn("_INN_HL_ACC_IX"),pj=new nP;class pK extends ca{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof uW)this.canLoadMoreData=!1;else{let s="PriceIndex"===this.inputs.Source?"$MADX":"$FADX",r=this.getSeries(t.query,s);if(this.addInner(r),this.isWeekly=e.aggregation.unit===$.Week,this.isWeekly){var i;let e=(i=this.getSeries(t.query,s,pj),new pK({aggregation:pj,source:null,target:pY,outFields:[pY],inputs:{...this.inputs}},i));this.addInner(e)}this.canLoadMoreData=!0,this.initialNotification=!0}}getSeries(e,t,i){let s=e.duplicate();return s.symbol=t,i&&(s.aggregation=i,s.barsToFetch=15*tG.US_TRADING_DAYS_PER_YEAR),y0().getTimeSeriesDataSource().getTimeSeries(s)}get baseIndex(){return 1}calculateAt(e){if(this.isWeekly)return this.calculateAtWeekly(e);let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,aa.Close);eg(s)&&(t=ef(s))}return{[this.target.id]:t}}calculateAtWeekly(e){let t=this.container?.size??-1,i=null,s=this.innCont(2);if(t>0&&e===t-1)i=s.getLastDataPoint(pY);else{let t=this.container.getTimeData()[e],r=s.getTimeData(),n=e_(r,t),a=r[n],o=null;for(;n<s.size&&nf(t,a);)o=n,n+=1,a=r[n];null!==o&&(i=s.getData(pY)[o])}return{[this.target.id]:i}}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e!==this.innerSeries[0]&&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}}let pq=cn("_RSI1"),pX=cn("_RSI1_MOM"),pZ=cn("_RSI2"),pJ=cn("_RSI2_MA"),pQ=cn("_MUL_ATR");class p0 extends ca{constructor(e,t){super(e,cr(t,t=>{let i=y0().getTimeSeriesDataSource();return t.seriesKind=Z.Options,t.fields=e.outFields,i.getTimeSeries(t)})),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return this.outFields.map(e=>this.wrapInner(e,0))}}let p1=cn("_CORE");class p2 extends uU{constructor(e){super(e)}getRetriever(){return tm(this.query.symbol)?new p5:tv(this.query.symbol)?new p6:new p4}}function p3(){return new lJ([aa.DateTime,aa.Delta,aa.Gamma,aa.Theta,aa.Vega])}class p4{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){return p3()}}class p5 extends uh{emptyContainer(e,t){return p3()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(aa.DateTime,lY(e.date.substring(0,10))),i.addDataPoint(aa.Delta,e.delta),i.addDataPoint(aa.Gamma,e.gamma),i.addDataPoint(aa.Theta,e.theta),i.addDataPoint(aa.Vega,e.vega)}}class p6 extends uh{emptyContainer(e,t){return p3()}addExtraParams(e){e.fields="delta,gamma,theta,vega"}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){i.addDataPoint(aa.DateTime,lY(e.date)),i.addDataPoint(aa.Delta,e.delta),i.addDataPoint(aa.Gamma,e.gamma),i.addDataPoint(aa.Theta,e.theta),i.addDataPoint(aa.Vega,e.vega)}}let p7=cn("_RSI1"),p8=cn("_RSI2"),p9={_TR:class extends ca{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=this.baseVal(aa.High,e),s=this.baseVal(aa.Low,e);if(e>0){let r=this.baseVal(aa.Close,e-1);t=Math.max(i-s,Math.abs(i-r),Math.abs(s-r))}else t=i-s;return{[this.target.id]:t}}},_RSI:class extends ca{isModified;constructor(e,t){super(e,t);let i=e.inputs.Modified;this.isModified=i}get helpers(){return[cE,c_]}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,i=null,s=null,r=this.period;if(this.atLeast(e,r+1)){if(null===this.container.getData(this.target)[e-1]||this.isModified){let t=this.past(e,r+1,this.source);if(eg(t)){let e=ey(1,r),n=e.map(e=>this.gain(e,t)),a=e.map(e=>this.loss(e,t));i=em(n),s=em(a)}}else{let t=this.container.getData(cE)[e-1],n=this.container.getData(c_)[e-1],a=this.past(e,2,this.source),o=this.gain(1,a),l=this.loss(1,a);i=(t*(r-1)+o)/r,s=(n*(r-1)+l)/r}null!==i&&null!==s&&(t=100-100/(1+i/s))}return{[cE.id]:i,[c_.id]:s,[this.target.id]:t}}},MA:cu,MAEXP:class extends ch{constructor(e,t){super(e,t,e=>2/(e+1))}},MAHLC:class extends ca{constructor(e,t){super(e,t);let i=fn(t,this.inputs.Period1,aa.High,aa.MAHI),s=fn(t,this.inputs.Period2,aa.Low,aa.MALO);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aa.MAHI,1),this.wrapInner(aa.MALO,2)]}},VOL:class extends cc{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(aa.Volume,aa.TradeSize,aa.Change,aa.Open,aa.Close)}},MAENV:class extends cm{constructor(e,t){super(e,cd,t)}},MAENVEXP:class extends cm{constructor(e,t){super(e,cp,t)}},MAENVSMO:class extends cm{constructor(e,t){super(e,cf,t)}},MATRI:class extends ca{constructor(e,t){super(e,t);let i=fn(t,this.inputs.Period,this.source),s=fn(i,this.inputs.Period,aa.MA,aa.TMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aa.TMA,2)]}},MAWEI:class extends ca{triangle;constructor(e,t){super(e,t);let i=this.period;this.triangle=i*(i+1)/2,fE(this)}weightedAverage(e){let t=e.length;if(0===t)return null;let i=t===this.period?this.triangle:t*(t+1)/2;return e.reduce((e,t,i)=>e+t*(i+1),0)/i}calculateAt(e){let t=null,i=this.period,[,s]=f_(this);if(this.atLeast(e,i)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=this.weightedAverage(r.filter(ep)):eg(r)&&(t=this.weightedAverage(r))}return{[this.target.id]:t}}},MAVOL:cu,MASMO:class extends ch{constructor(e,t){super(e,t,e=>1/e)}},MACD:class extends cC{constructor(e,t){super(e,cy,t)}},MACDEXP:class extends cC{constructor(e,t){super(e,cT,t)}},MACDV:class extends cP{constructor(e,t){super(e,t),this.histogramVaryColor=!0,this.histogramField=aa.MACDVH;let i=fO(e,"EMA","Average"),s=i(t,e.inputs.Period1,e.source,void 0),r=i(t,e.inputs.Period2,e.source,void 0),n=ff(t,e.inputs.Period2,e.inputs.Average),a=fb(aa.MACDV,(e,t,i,s)=>(t-i)/s*100,s,r,n),o=i(a,e.inputs.Period3,a.target,aa.MACDVS),l=fb(aa.MACDVH,fP,a,o);this.addInner(a,o,l)}getWrappers(){return[this.wrapInner(aa.MACDV,1),this.wrapInner(aa.MACDVS,2),this.wrapInner(aa.MACDVH,3)]}},GMMA:class extends ca{constructor(e,t){super(e,t);for(let r=1;r<=12;++r){var i,s;let n=(i=e.inputs,s=r,i[`Period${s}`]);this.addInner(fa(t,n,aa.Close,e.outFields[r-1]))}}getWrappers(){return ey(1,12).map(e=>this.wrapInner(this.outFields[e-1],e))}},OSCI:cg,OSCIVOL:cg,RSI:class extends cM{constructor(e,t){super(e,!1,t)}},RSIMOD:class extends cM{constructor(e,t){super(e,!0,t)}},RSISTO:class extends ca{constructor(e,t){super(e,t);let i=fy(t,this.inputs.Period,this.source),s=this.inputs.Range,r=fv(aa.STORSI,function(e){let t=null;if(this.atLeast(e,s)){let i=this.past(e,s,aa.RSI,this.base),r=eM(i),n=r[0],a=r[1];t=(eb(i)-n)/(a-n)}return{[aa.STORSI.id]:t}},i),n=fO(e,"MA","Average")(r,this.inputs.PeriodAvg,aa.STORSI,aa.STORSIAVG);this.addInner(r,n)}getWrappers(){return[this.wrapInner(aa.STORSI,1),this.wrapInner(aa.STORSIAVG,2)]}},RSA:class extends ca{constructor(e,t){super(e,t);let i=fy(t,this.inputs.Period1,this.source,p7),s=fy(t,this.inputs.Period2,this.source,p8),r=fb(aa.RSA,(e,t,i)=>(t+i)/2,i,s),n=fO(e,"MA","Average")(r,this.inputs.PeriodAvg,aa.RSA,aa.RSAAVG);this.addInner(r,n)}getWrappers(){return[this.wrapInner(aa.RSA,1),this.wrapInner(aa.RSAAVG,2)]}},WPERCR:class extends cx{constructor(e,t){super(e,!0,t)}},HHLL:class extends ca{constructor(e,t){super(e,t);let i=fh(t,this.inputs.Period1,aa.High,aa.HH,!0),s=fh(t,this.inputs.Period2,aa.Low,aa.LL,!1);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aa.HH,1),this.wrapInner(aa.LL,2)]}},WGCL:class extends ca{constructor(e,t){super(e,t)}calculateAt(e){let t=null,[i,s,r]=[aa.Close,aa.High,aa.Low].map(t=>this.baseVal(t,e));return t=(2*i+s+r)/4,{[this.target.id]:t}}},STOCHF:class extends cI{constructor(e,t){super(e,!1,aa.PercK,t)}},STOCHS:class extends cI{constructor(e,t){super(e,!0,aa.PercK,t)}},BBANDS:class extends cD{constructor(e,t){super(e,"Regular",t)}},BWIDTH:class extends cD{constructor(e,t){super(e,"Width",t)}},BPERC:class extends cD{constructor(e,t){super(e,"Percent",t)}},OBVOL:class extends ca{constructor(e,t){super(e,t);let i=fv(aa.OBVOL,function(e){let t=null;if(e>0){let i=this.baseVal(aa.Close,e),s=this.baseVal(aa.Volume,e),r=this.baseVal(aa.Close,e-1),n=this.container.getData(this.target)[e-1];eH(n)||(n=0),t=i>r?n+s:i<r?n-s:n}return{[this.target.id]:t}},t),s=fO(e,"MA","Average")(i,this.period,aa.OBVOL,aa.OBVOLAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aa.OBVOL,1),this.wrapInner(aa.OBVOLAVG,2)]}},ATR:class extends ca{constructor(e,t){super(e,t);let i=fp(t,aa.TR),s=fO(e,"SMA")(i,this.inputs.Period,aa.TR,this.target),r=fn(s,this.inputs.Period2,aa.ATR,aa.ATRMA);this.addInner(s,r)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(aa.ATRMA,2)]}},ATRP:class extends ca{constructor(e,t){super(e,t);let i=ff(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(1,aa.ATR,e),s=this.baseVal(aa.Close,e);return eH(i,s)&&s>0&&(t=i/s*100),{[aa.ATRP.id]:t}}},ADX:class extends cW{constructor(e,t){super(e,!1,aa.ADX,t)}},ADXMOD:class extends cW{constructor(e,t){super(e,!0,aa.ADXM,t)}},ADL:class extends ca{constructor(e,t){super(e,t);let i=fT(t);this.addInner(i)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,aa.MFMUL,e),{[this.target.id]:t}}},ADWM:class extends ca{constructor(e,t){super(e,t);let i=fv(aa.ADWM,function(e){let t=null,i=null;if(e>0){let s=this.baseVal(aa.Close,e-1),r=Math.max(s,this.baseVal(aa.High,e)),n=Math.min(s,this.baseVal(aa.Low,e)),a=this.baseVal(aa.Close,e);t=a>s?a-n:a<s?a-r:0,e>1&&(i=(e>2?this.container.getData(aa.ADWM)[e-1]:0)+t)}return{[aa.ADWM.id]:i}},t),s=fn(i,this.inputs.Period,aa.ADWM,aa.ADWMMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aa.ADWM,1),this.wrapInner(aa.ADWMMA,2)]}},CHAOSC:class extends ca{constructor(e,t){super(e,t);let i=aa.ADL,s=function(e,t=aa.ADL){return fi("ADL",ft(t),e)}(t,i),r=fa(s,3,i),n=fa(s,10,i),a=fb(e.target,(e,t,i)=>t-i,r,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},TP:class extends ca{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=em([aa.Close,aa.High,aa.Low].map(t=>this.baseVal(t,e))),{[this.target.id]:t}}},KELCHN:class extends cZ{constructor(e,t){super(e,cq,t)}},KELBND:class extends cZ{constructor(e,t){super(e,cX,t)}},DONCHN:class extends cJ{constructor(e,t){super(e,!1,t)}},DONWIDTH:class extends cJ{constructor(e,t){super(e,!0,t)}},PVT:class extends ca{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){let i=this.baseVal(aa.Close,e),s=this.baseVal(aa.Volume,e),r=this.baseVal(aa.Close,e-1),n=this.container.getData(this.target)[e-1];eH(n)||(n=0),t=n+(i-r)/r*s}return{[this.target.id]:t}}},ROC:class extends ca{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i+1)){let s=this.baseVal(this.source,e-i);null!==s&&0!==s&&(t=(this.baseVal(this.source,e)-s)/s*100)}return{[this.target.id]:t}}},TRIX:class extends ca{constructor(e,t){super(e,t);let i=fa(t,this.inputs.Period,this.source),s=fa(i,this.inputs.Period,i.target),r=fa(s,this.inputs.Period,s.target),n=fg(r,1,r.target,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},PPMOV:class extends ca{constructor(e,t){super(e,t);let i=fm(t,aa.PVPT);this.addInner(i)}calculateAt(e){let t=this.innVal(1,aa.PVPT,e),i=this.baseVal(aa.High,e),s=this.baseVal(aa.Low,e);return{[aa.PVPTR.id]:t+i-s,[aa.PVPTS.id]:t-i+s}}getWrappers(){return[this.wrapInner(aa.PVPT,1)]}},PIVPTS:class extends d_{constructor(e,t){super(e,dE[e.inputs.Previous],t)}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=null;if(!this.disabled){let e=this.getValues(this.inputs.Previous);if(eg(e)){let[l,u,h]=e,c=2*(t=(l+u+h)/3);i=c-u,s=c-l;let d=l-u;r=t+d,n=t-d,a=l+2*(t-u),o=u-2*(l-t)}}return{[aa.PPTPIV.id]:t,[aa.PPTR1.id]:i,[aa.PPTR2.id]:r,[aa.PPTR3.id]:a,[aa.PPTS1.id]:s,[aa.PPTS2.id]:n,[aa.PPTS3.id]:o}}},CPP:class extends d_{constructor(e,t){super(e,dE.Day,t)}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=null,l=null;if(!this.disabled){let e=this.getValues("Day");if(eg(e)){let[u,h,c]=e,d=u-h,[p,f,m,g]=[2,4,6,12].map(e=>1.1/e*d);o=c+p,n=c+f,s=c+m,t=c+g,i=c-g,r=c-m,a=c-f,l=c-p}}return{[aa.CPPH4.id]:o,[aa.CPPH3.id]:n,[aa.CPPH2.id]:s,[aa.CPPH1.id]:t,[aa.CPPL1.id]:i,[aa.CPPL2.id]:r,[aa.CPPL3.id]:a,[aa.CPPL4.id]:l}}},ARNUPDW:class extends c1{constructor(e,t){super(e,!1,t)}},ARNOSC:class extends c1{constructor(e,t){super(e,!0,t)}},TCHN:class extends ca{constructor(e,t){super(e,t);let i="Close"===e.inputs.Range,s=fw(t);if(!i&&s){let e=fv(aa.TCHNUP,(e,t)=>null,t),i=fv(aa.TCHNLOW,(e,t)=>null,t);this.addInner(e,i)}else{let s=fh(t,e.inputs.PeriodUpper,i?aa.Close:aa.High,aa.TCHNUP,!0),r=fh(t,e.inputs.PeriodLower,i?aa.Close:aa.Low,aa.TCHNLOW,!1);this.addInner(s,r)}}getWrappers(){return[this.wrapInner(aa.TCHNUP,1),this.wrapInner(aa.TCHNLOW,2)]}},TCHRE:class extends ca{constructor(e,t){super(e,t);let i=function(e,t,i){let s="TCHN",r=fs(s);return fi(s,{inputs:{PeriodUpper:t,PeriodLower:t,Range:i},outFields:r,source:null},e)}(t,e.inputs.Period,e.inputs.Range);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(1,aa.TCHNUP,e),s=this.innVal(1,aa.TCHNLOW,e),r=this.inputs.Adjustment,n=this.inputs.Retracement;return"Long"===n?t=eH(i)?i-r:null:"Short"===n&&(t=eH(s)?s+r:null),{[this.target.id]:t}}},ALLG:class extends ca{constructor(e,t){super(e,t);let i=fv(c2,eu(cG,c2),t),s=fo(i,e.inputs.Period1,c2,aa.ALJAW),r=fo(i,e.inputs.Period2,c2,aa.ALTEETH),n=fo(i,e.inputs.Period3,c2,aa.ALLIPS);this.addInner(s,r,n)}calculateAt(e){return{[aa.ALJAW.id]:this.innVal(1,aa.ALJAW,e),[aa.ALTEETH.id]:this.innVal(2,aa.ALTEETH,e),[aa.ALLIPS.id]:this.innVal(3,aa.ALLIPS,e)}}},PLTLN:class extends ca{constructor(e,t){super(e,t)}calculateAt(e){return{[aa.PLTLN.id]:this.inputs.Position}}},AWEOSC:class extends ca{constructor(e,t){super(e,t);let i=fv(c3,eu(cG,c3),t),s=fn(i,this.inputs.Period1,c3),r=fn(i,this.inputs.Period2,c3),n=fb(aa.AWOS,(e,t,i)=>t-i,s,r),a=fn(n,this.inputs.Period3,n.target,aa.AWOSMA);this.addInner(n,a)}getWrappers(){return[this.wrapInner(aa.AWOS,1),this.wrapInner(aa.AWOSMA,2)]}},MFV:class extends c4{constructor(e,t){super(e,!0,t)}},CLV:class extends c4{constructor(e,t){super(e,!1,t)}},CHAMF:class extends ca{constructor(e,t){super(e,t);let i=fT(t);this.addInner(i)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,aa.Volume),r=this.past(e,i,aa.MFMUL,this.innCont(1));if(eg(s)&&eg(r)){let e=ef(s);0!==e&&(t=ef(r)/e)}}return{[this.target.id]:t}}},CHAVOL:class extends ca{constructor(e,t){super(e,t);let i=fg(fa(fv(c5,eu(cz,c5),t),this.inputs.Period1,c5),this.inputs.Period2,aa.EMA,this.target);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},DPO:class extends ca{shift;constructor(e,t){super(e,t);let i=this.inputs.Period;this.shift=Math.floor(i/2)+1;let s=fn(t,i,e.source);this.addInner(s)}calculateAt(e){let t=null,i=this.shift,s=this.innVal(1,aa.MA,e-i);return null!==s&&(t=this.baseVal(this.source,e)-s),{[this.target.id]:t}}},CCI:class extends ca{constructor(e,t){super(e,t);let i=fm(t),s=fn(i,this.inputs.Period,i.target,c6);this.addInner(i,s)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,aa.TP,this.innCont(1));if(eg(s)){let i=this.innVal(2,c6,e);if(null!==i){let r=s.reduce((e,t,s)=>e+Math.abs(i-t),0)/this.period;t=(this.innVal(1,aa.TP,e)-i)/(.015*r)}}}return{[this.target.id]:t}}},EMV:class extends ca{constructor(e,t){super(e,t);let i=fv(aa.EMV,function(e){let t=null;if(e>0){let[i,s,r]=[aa.High,aa.Low,aa.Volume].map(t=>this.baseVal(t,e)),[n,a]=[aa.High,aa.Low].map(t=>this.baseVal(t,e-1));t=((i+s)/2-(n+a)/2)/(r/1e6/(i-s))}return{[this.target.id]:t}},t),s=fn(i,this.inputs.Period,aa.EMV,aa.EMVMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aa.EMV,1),this.wrapInner(aa.EMVMA,2)]}},ERBRPOW:class extends c7{constructor(e,t){super(e,!1,t)}},ERBLPOW:class extends c7{constructor(e,t){super(e,!0,t)}},FI:class extends ca{constructor(e,t){super(e,t);let i=fa(fv(c8,function(e){let t=null;if(e>0){let i=this.baseVal(aa.Close,e),s=this.baseVal(aa.Volume,e);t=(i-this.baseVal(aa.Close,e-1))*s}return{[this.target.id]:t}},t),this.inputs.Period,c8,aa.FI);this.addInner(i)}getWrappers(){return[this.wrapInner(aa.FI,1)]}},MI:class extends ca{constructor(e,t){super(e,t);let i=fa(fv(c9,eu(cz,c9),t),9,c9,de),s=fa(i,9,de,dt),r=fb(di,(e,t,i)=>t/i,i,s);this.addInner(r)}calculateAt(e){let t=null;if(this.atLeast(e,25)){let i=this.past(e,25,di,this.innCont(1));eg(i)&&(t=ef(i))}return{[this.target.id]:t}}},MOM:class extends ca{constructor(e,t){super(e,t);let i=this.inputs.Period,s=fv(aa.MOM,eh(fL,i,aa.Close),t),r=fn(s,this.inputs.Movement,aa.MOM,aa.MOMMA);this.addInner(s,r)}getWrappers(){return[this.wrapInner(aa.MOM,1),this.wrapInner(aa.MOMMA,2)]}},MFI:class extends ca{constructor(e,t){super(e,t);let i=fm(t);this.addInner(i)}calculateAt(e){let t=null,i=this.period+1;if(this.atLeast(e,i)){let s=this.past(e,i,aa.TP,this.innCont(1)),r=this.past(e,i,aa.Volume).map(e=>null!=e?e:0);if(eg(s)&&eg(r)){let e=0,n=0;for(let t=1;t<i;++t){let i=s[t]*r[t];s[t]>s[t-1]?e+=i:n+=i}t=100-100/(1+e/n)}}return{[this.target.id]:t}}},MSD:class extends ca{constructor(e,t){super(e,t),fE(this);let i=fn(t,this.inputs.Period,this.source);this.addInner(i)}calculateAt(e){let t=null,[i,s]=f_(this),r=this.innVal(i+1,aa.MA,e);if(null!==r){let i=this.inputs.Period,n=this.past(e,i,this.source,s);t=Math.sqrt(em(n=n.map(e=>(e-r)*(e-r))))}return{[this.target.id]:t}}getWrappers(){let[e]=f_(this);return[this.wrapInner(aa.MA,e+1)]}},NVI:class extends dn{constructor(e,t){super(e,dr,t)}},PVI:class extends dn{constructor(e,t){super(e,ds,t)}},PPO:class extends cC{constructor(e,t){super(e,cv,t)}},PVO:class extends cC{constructor(e,t){super(e,cb,t)}},HV:class extends ca{constructor(e,t){super(e,t);let i=Math.sqrt(fD(e.aggregation));if(0===i){let e=fv(this.target,(e,t)=>null,t);this.addInner(e)}else{let s=fA(fv(da,eu(function(e,t){let i=null;if(t>0){let s=this.baseVal(e,t),r=this.baseVal(e,t-1);null!==s&&null!==r&&(i=Math.log(s/r))}return{[da.id]:i}},aa.Close),t),e.inputs.Period,da,aa.MSD),r=fv(aa.HV,eu(function(e,t){let i=null,s=this.baseVal(aa.MSD,t);return null!==s&&(i=100*s*e),{[aa.HV.id]:i}},i),s);this.addInner(r)}}getWrappers(){return[this.wrapInner(this.target,1)]}},PERF:class extends ca{noOp;constructor(e,t){super(e,t);let i="VisibleStart"===this.inputs.Anchor;this.noOp=i}calculateAt(e){let t=null,i=this.baseVal(this.source,0),s=this.baseVal(this.source,e);return this.noOp?t=s:null!==i&&null!==s&&(t=(s-i)/i*100),{[this.target.id]:t}}},WASI:class extends ca{constructor(e,t){super(e,t)}get helpers(){return[dl]}ohlcVals(e){return[aa.Open,aa.High,aa.Low,aa.Close].map(t=>this.baseVal(t,e))}obtainR(e,t,i,s){let r=Math.abs(e-s),n=Math.abs(t-s),a=Math.abs(e-t),o=Math.max(r,n,a),l=.25*Math.abs(s-i);return o===r?r-.5*n+l:o===n?n-.5*r+l:a+l}calculateAt(e){let t=null,i=null;if(e>0){let s=this.container.getData(dl)[e-1];eH(s)||(s=0);let[r,n,a,o]=this.ohlcVals(e),[l,u,h,c]=this.ohlcVals(e-1);if(eg([r,n,a,o,l,c])){let e=Math.max(Math.abs(n-c),Math.abs(a-c)),u=this.inputs.Limit,h=this.obtainR(n,a,l,c);i=s+(t=(o-c+.5*(o-r)+.25*(c-l))/h*50*(e/u))}}return{[dl.id]:t,[this.target.id]:i}}},WWVOL:class extends ca{constructor(e,t){super(e,t);let i=ff(t,e.inputs.Period);this.addInner(i)}get helpers(){return[dh,du]}calculateAt(e){let t=null,i=null,s=null,r=null,n=this.innVal(1,aa.ATR,e);if(null!==n){let a=this.baseVal(aa.Close,e),o=this.baseVal(aa.Close,e-1),l=this.period;s=Math.max(...this.past(e,l,aa.Close)),r=Math.min(...this.past(e,l,aa.Close));let u=n*this.inputs.Constant;if(null===this.innVal(1,aa.ATR,e-1))a>o?t=s-u:i=r+u;else{let[n,o,l,h]=[aa.WWVSARU,aa.WWVSARD,dh,du].map(t=>this.container.getData(t)[e-1]);s=l,r=h,null!==n?a<n?(r=a,i=a+u):t=(s=Math.max(a,s))-u:a>o?(s=a,t=a-u):i=(r=Math.min(a,r))+u}}return{[dh.id]:s,[du.id]:r,[aa.WWVSARU.id]:t,[aa.WWVSARD.id]:i}}},PARTP:class extends ca{constructor(e,t){super(e,t)}get helpers(){return[dc,dd,dp]}hlcVals(e){return[aa.High,aa.Low,aa.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,i=null,s=null,r=null,n=null,a=null;if(e>0){let[o,l,u]=this.hlcVals(e),[h,c,d]=this.hlcVals(e-1),p=this.reciprocal(this.inputs.Acceleration),f=this.reciprocal(this.inputs.Limit);if(1===e){let e=1==(n=u>d?1:-1);a=e?c:h,s=e?Math.max(o,h):Math.min(l,c),r=p,e?t=a:i=a}else{let[u,d,m,g,y]=[dp,aa.PARSARS,aa.PARSARL,dc,dd].map(t=>this.me(t,e-1)),T=1===u,A=T?m:d,S=y*Math.abs(g-A),v=u===(n=T?A+S>l?-1:1:A-S<o?1:-1);a=v?T?Math.min(A+S,c,this.baseVal(aa.Low,e-2)):Math.max(A-S,h,this.baseVal(aa.High,e-2)):g,s=v?T?Math.max(o,g):Math.min(l,g):1===n?o:l,r=y,v?(T?s>g:s<g)&&y<f&&(r=y+p):r=p,1===n?t=a:i=a}}return{[dc.id]:s,[dd.id]:r,[dp.id]:n,[aa.PARSARS.id]:i,[aa.PARSARL.id]:t}}},MOVLR:class extends ca{xSum;xSum2;x2Sum;constructor(e,t){super(e,t);let i=this.period;this.xSum=i*(i+1)/2,this.xSum2=this.xSum*this.xSum,this.x2Sum=i*(i+1)*(2*i+1)/6}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,this.source);if(eg(s)){let e=ef(s),r=(i*ef(s.map((e,t)=>e*(t+1)))-this.xSum*e)/(i*this.x2Sum-this.xSum2);t=(e-r*this.xSum)/i+r*i}}return{[this.target.id]:t}}},TRSP:class extends ca{haveEnoughData=!1;firstUsefulIndex=0;s3;itr;constructor(e,t){super(e,t),this.s3=this.itr=[];let i=["VelocityUpTrend","VelocitySideTrend","VelocityDownTrend"].map(t=>e.inputs[t]||"3").map(Number);dm.splice(6,3,...i)}get helpers(){return[df]}prepareComputation(){let e=this.base.getData(aa.Close),t=0,i=0,s=e.length;for(;i<72&&t<s;)null!=e[t]&&i++,t++;this.haveEnoughData=t<s,this.firstUsefulIndex=t,this.s3=dg(s),this.itr=dg(s),this.haveEnoughData&&dT(e,this.s3,s)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,i){let s=this.base.getData(aa.Close),r=s.length;this.haveEnoughData&&dT(s,this.s3,r),super.recalculateAt(e,t,i)}calculateAt(e){let t=null,i=null,s=null,r=t=>this.us(t,e-1);if(0===e)this.prepareComputation();else if(this.haveEnoughData&&e>=this.firstUsefulIndex&&null!==this.baseVal(aa.Close,e)){let n=r(aa.TRSP1),a=r(aa.TRSP2);s=r(df),null===n&&null===a&&(n=a=this.baseVal(aa.Close,this.firstUsefulIndex)),null===s&&(s=1);let o=this.base.getData(aa.Close);s=function(e,t,i,s,r,n){let a=i;do a--;while(e[a]<=0)return t[i]=t[a],e[i]>r&&t[a]<=0&&(t[i]=t[a]+1),e[i]<s&&t[a]>=0&&(t[i]=t[a]-1),n++,t[i]!==t[a]&&(n=1),n}(o,this.itr,e,n,a,s);let l=function(e,t,i,s,r){let n=s,a=dy(r,i[s],7),o=0;do e[--n]>0&&o++;while(o<a&&n>0)return t[s]-t[n]}(o,this.s3,this.itr,e,dm),u=function(e,t,i,s,r){let n=r[18],a=s+1,o=0;for(let i=0;i<n;++i){let i=0,s=0;for(let r=1;r<6;++r){if(e[--a]<=0)continue;let n=e[a]-t[a];1==r&&(i=s=n),n>i&&(i=n),n<s&&(s=n)}o=o+i-s}return o/n*dy(r,i[s],4)}(o,this.s3,this.itr,e,dm);[n,a]=function(e,t,i,s,r,n,a,o,l,u){let h=dy(r,i[s],10),c=dy(r,i[s],13),d=dy(r,i[s],16),p=l+u+t[s]-e[s],f=100;r[20]>0&&(f=r[20]);let m=h*o/f;o>c&&(m=h*c/f);let g=2*u,y=e[s]+(p-g)-(p-g)*m,T=e[s]+(p-p*m),A=[n,a];return(1===o||1!==d||y>n)&&(A[0]=y),(1===o||1!==d||T<a)&&(A[1]=T),A}(o,this.s3,this.itr,e,dm,n,a,s,l,u),this.itr[e]>=0&&(t=n),this.itr[e]<=0&&(i=a)}return{[df.id]:s,[aa.TRSP1.id]:t,[aa.TRSP2.id]:i}}},COTLC:dC,COTDAG:class extends dS{constructor(e,t){super(e,2,t)}},COTFTR:class extends dS{constructor(e,t){super(e,3,t)}},IMPVOL:class extends ca{constructor(e,t){super(e,cr(t,e=>new dM(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(aa.IMPVOL,0)]}},CTM:class extends cC{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,cA,t)}},CPMI:class extends cC{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,cS,t)}},DEMA:class extends ca{constructor(e,t){super(e,t);let i=fa(t,this.inputs.Period,this.source),s=fa(i,this.inputs.Period,i.target),r=fb(aa.DEMA,(e,t,i)=>2*t-i,i,s);this.addInner(r)}getWrappers(){return[this.wrapInner(aa.DEMA,1)]}},TEMA:class extends ca{constructor(e,t){super(e,t);let i=fa(t,this.inputs.Period,this.source),s=fa(i,this.inputs.Period,i.target),r=fa(s,this.inputs.Period,s.target),n=fb(aa.TEMA,(e,t,i,s)=>3*(t-i)+s,i,s,r);this.addInner(n)}getWrappers(){return[this.wrapInner(aa.TEMA,1)]}},TSI:class extends ca{constructor(e,t){super(e,t);let i=(e,t,i,s,r,n)=>{let a=fa(e,t,i,s);return fa(a,r,s,n)},s=fv(dD,eu((e,t)=>({[e.id]:Math.abs(this.baseVal(aa.Change,t))}),dD),t),r=i(t,e.inputs.Period1,aa.Change,dw,e.inputs.Period2,dR),n=i(s,e.inputs.Period1,dD,dN,e.inputs.Period2,dV),a=fb(aa.TSI,(e,t,i)=>100*t/i,r,n),o=fa(a,e.inputs.Period3,aa.TSI,aa.TSISIG);this.addInner(a,o)}getWrappers(){return[this.wrapInner(aa.TSI,1),this.wrapInner(aa.TSISIG,2)]}},ADJATR:class extends ca{constructor(e,t){super(e,t);let i=(e,t)=>{let i=0;return t>0&&(i=this.baseVal(e,t)-this.baseVal(e,t-1)),{[cw.id]:Math.abs(i)}},s=fv(cw,eu(i,this.source),t),r=fO(e,"MA")(s,this.inputs.Period,cw,cR),n=fb(aa.ADJATR,(e,t)=>2*t,r);this.addInner(n)}getWrappers(){return[this.wrapInner(aa.ADJATR,1)]}},COTR:class extends ca{constructor(e,t){super(e,t);let i=e=>{let t=0;return e>0&&(t=this.baseVal(aa.Close,e)-this.baseVal(aa.Close,e-1)),{[cN.id]:t}},s=fv(cN,i,t),r=fI[e.inputs.TypeOfATR.toLowerCase()],n=r(t,this.inputs.Period,this.inputs.Smoothing),a=fb(this.target,(e,t,i)=>eH(t)&&eH(i)?t/i:null,s,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCGD:class extends ca{constructor(e,t){super(e,t);let i=fa(t,this.inputs.Period,aa.Close);this.addInner(i)}calculateAt(e){let t=null,i=e>0?this.container.getData(this.target)[e-1]:null,s=this.innVal(1,aa.EMA,e);if(eV(i)){let r=this.baseVal(this.source,e),n=Math.pow(r/i,4);t=i+(r-i)/(.6*this.period*n);let a=e=>Math.log10(Math.abs(e-t))>1,o=a(i)||a(s);(!Number.isFinite(t)||o)&&(t=null)}else t=s;return{[this.target.id]:t}}},HMA:class extends ca{constructor(e,t){super(e,t);let i=this.inputs.Period,s=Math.floor(i/2),r=this.allowEmptyValues,n=fl(t,s,this.source,aa.WMA,r),a=fb(dH,(e,t,i)=>2*t-i,n,fl(t,i,this.source,aa.WMA,r)),o=fl(a,Math.floor(Math.sqrt(i)),dH,this.target,r);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},COPP:class extends ca{constructor(e,t){super(e,t);let i=fg(t,this.inputs.PeriodRocLong),s=fl(fb(dF,(e,t,i)=>t+i,i,fg(t,this.inputs.PeriodRocShort)),this.inputs.PeriodWma,dF,this.target);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}},REATRHI:class extends dW{constructor(e,t){super(e,!0,t)}},REATRLO:class extends dW{constructor(e,t){super(e,!1,t)}},LINRCHN:class extends ca{constructor(e,t){super(e,t);let i=this.inputs.Period,s=fv(aa.LINRMID,eu(function(e,t){let i=null;if(t>=this.base.size-e){let s=e*(e+1)/2,r=0,n=0,a=1;for(let t=e-1;t>=0;--t){let e=this.baseVal(aa.Close,this.base.size-1-t);r+=e,n+=a*e,a+=1}let o=(e*n-s*r)/(e*(e+1)*(2*e+1)/6*e-s*s);i=r/e-o*s/e+o*(t-this.base.size+e+1)}return{[aa.LINRMID.id]:i}},i),t),r=fA(fb(d$,(e,t,i)=>t-i,fv(this.source,function(e){return{[this.target.id]:this.baseVal(this.target,e)}},t),s),i,d$);this.addInner(s,r)}calculateAt(e){let t=this.innVal(1,aa.LINRMID,e),i=eb(this.innCont(2).getData(aa.MSD)),s=null,r=null;if(eH(t,i)){let e=this.inputs.Width;s=t+e*i,r=t-e*i}return{[aa.LINRUP.id]:s,[aa.LINRLOW.id]:r}}getWrappers(){return[this.wrapInner(aa.LINRMID,1)]}},CSHO:class extends ca{computeDone;constructor(e,t){super(e,t,cr(t,e=>{var t,i;let s=eG(e);return s.symbol=tg(t=e.symbol)?`${tg(i=t)?tc(i).root:null}Y00`:null,eH(s.symbol)?new uU(s):new uW(s,!0)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){let e=this.innCont(0);if(!eH(e)||0===e.size)return;let t=this.innCont(1),i=e.getTimeData(),s=t.getTimeData(),r=t.getData(aa.Close),n=Array(i.length).fill(null);if(!(this.innerSeries[1]instanceof uW)){let a=0,o=e.size,l=t.size;for(let e=0;e<o;++e){for(;a<l&&s[a].getTime()<i[e].getTime();)a++;a<l&&s[a].getTime()===i[e].getTime()&&(n[e]=r[a])}}this.container.setData(this.target,n)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignCashTimelineWithUnderlying(),this.computeDone=!0,this.notify(ao.TS_MANYCHANGED,-1))}},CSHB:class extends ca{constructor(e,t){super(e,t,function(e,t=aa.CSHO){return fi("CSHO",ft(t),e)}(t))}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e===this.innerSeries[1]&&this.innHasData(0)&&this.innHasData(1)}calculateAt(e){let t=(t,i)=>eH(this.innCont(t))?this.innVal(t,i,e):null,i=t(0,aa.Close),s=t(1,aa.CSHO);return{[this.target.id]:eH(s)&&eH(i)?s-i:null}}},CTPI:class extends cI{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,aa.CTPI,t)}},PCTCHG:class extends ca{constructor(e,t){super(e,t),fE(this)}calculateAt(e){let t=null,[i]=f_(this);if(e>0){let s=this.innVal(i,this.source,e-1);null!==s&&(t=100*(this.innVal(i,this.source,e)-s)/s)}return{[this.target.id]:t}}},OPINT:class extends cc{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(aa.TradeSize,aa.Change)}},STOMOMIX:class extends ca{constructor(e,t){super(e,t);let i=fh(t,e.inputs.Period1,aa.High,aa.HH,!0),s=fh(t,e.inputs.Period1,aa.Low,aa.LL,!1),r=fa(fb(dz,(e,t,i)=>this.baseVal(aa.Close,e)-(t+i)/2,i,s),e.inputs.Period2,dz,dY),n=fa(r,e.inputs.Period2,dY,dj),a=fa(fb(dK,(e,t,i)=>t-i,i,s),e.inputs.Period2,dK,dq),o=fa(a,e.inputs.Period2,dq,dX),l=fb(aa.STOMOMIX,(e,t,i)=>100*t/i,n,o);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},CHDMOMOSC:class extends ca{constructor(e,t){super(e,t);let i=new d0(e,t),s=fO(e,"MA","Average")(i,this.inputs.PeriodAvg,aa.CHDMOMOSC,aa.CHDMOMOSCAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aa.CHDMOMOSC,1),this.wrapInner(aa.CHDMOMOSCAVG,2)]}},VSTOP:class extends ca{constructor(e,t){super(e,t);let i=ff(t,e.inputs.Period);this.addInner(i)}get helpers(){return[d1,d2,d3]}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=1,l=this.baseVal(aa.Close,e),u=e=>eH(e)?e:0,h=(e,t)=>this.container.getData(e)[t];e>0&&(s=Math.max(u(h(d1,e-1)),l),n=Math.min(u(h(d2,e-1)),l),o=h(d3,e-1));let c=this.inputs.Multiplier,d=this.innVal(1,aa.ATR,e);if(eH(d)){let u=1===o,p=u?s-c*d:n+c*d,f=h(u?aa.VSTOPUP:aa.VSTOPLOW,e-1);eH(f)||(f=0);let m=u?Math.max(f,p):Math.min(f,p),g=(a=+(l-m>=0))!=o;i=g?l:s,r=g?l:n,t=g?1===a?i-c*d:r+c*d:m}return{[aa.VSTOPUP.id]:1===a?t:null,[aa.VSTOPLOW.id]:1===a?null:t,[d1.id]:i,[d2.id]:r,[d3.id]:a}}},SUPTR:class extends ca{constructor(e,t){super(e,t);let i=ff(t,e.inputs.Period);this.addInner(i)}get helpers(){return[d4,d5,d6,aa.BARCOLIX]}calculateAt(e){let t=0,i=0,s=0,r=null,n=0,a=this.innVal(1,aa.ATR,e);if(eH(a)){let[o,l,u]=[aa.Close,aa.High,aa.Low].map(t=>this.baseVal(t,e)),h=(l+u)/2,c=this.baseVal(aa.Close,e-1),d=this.inputs.Multiplier,p=h-d*a,f=h+d*a,[m,g,y]=[d4,d5,d6].map(t=>this.container.getData(t)[e-1]);t=c>m?Math.max(p,m):p,i=c<g?Math.min(f,g):f;let T=1===(s=o>g?1:o<m?-1:eH(y)?y:1);r=T?t:i,n=+!!T}return{[d4.id]:t,[d5.id]:i,[d6.id]:s,[aa.SUPTR.id]:r,[aa.BARCOLIX.id]:n}}},ICHCLD:class extends ca{constructor(e,t){super(e,t);let i=(e,t,i)=>fb(i,(e,t,i)=>(t+i)/2,e,t),s=(e,s)=>i(fh(t,e,aa.Low,aa.LL,!1),fh(t,e,aa.High,aa.HH,!0),s),r=s(e.inputs.PeriodConversionLine,aa.CONVLN),n=s(e.inputs.PeriodBaseLine,aa.BASELN),a=i(r,n,aa.LEADSP1),o=s(e.inputs.PeriodLaggingSpan2,aa.LEADSP2);this.addInner(r,n,a,o)}get helpers(){return[aa.BARCOLIX]}calculateAt(e){let t=+(this.innVal(3,aa.LEADSP1,e)>this.innVal(4,aa.LEADSP2,e));return{[aa.LAGGSP.id]:this.baseVal(aa.Close,e),[aa.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(aa.CONVLN,1),this.wrapInner(aa.BASELN,2),this.wrapInner(aa.LEADSP1,3),this.wrapInner(aa.LEADSP2,4)]}},VWAP:class extends pe{constructor(e,t){super(e,t)}get helpers(){return[d7,d8,d9]}isSame(e,t){switch(this.inputs.AnchorPeriod){case"Session":default:return nl(e,t);case"Week":return nf(e,t);case"Month":return nu(e,t);case"Quarter":return nc(e,t);case"Year":return nm(e,t);case"Decade":return lG(10,e)===lG(10,t);case"Century":return lG(100,e)===lG(10,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(1===this.valueAt(d9,t))return t;return 0}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=e>0,o=a?this.dateAt(e-1):tG.ZERO_DATE,l=this.dateAt(e),u=a&&this.isSame(o,l),h=u?this.valueAt(d7,e-1):0,c=u?this.valueAt(d8,e-1):0,d=this.innVal(0,aa.Volume,e),p=h+this.innVal(1,this.source,e)*d,f=c+d;if(t=p/f,u){let a=this.findPrevPeriodChange(e-1),o=this.container.getData(aa.VWAP).slice(a,e);o.push(t);let l=em(o),u=Math.sqrt(em(o.map(e=>(e-l)*(e-l)))),h=this.inputs.Stdev1stMultiplier*u;i=t+h,s=t-h;let c=this.inputs.Stdev2ndMultiplier*u;r=t+c,n=t-c}else i=t,s=t,r=t,n=t;return{[d7.id]:p,[d8.id]:f,[d9.id]:+!u,[aa.VWAP.id]:t,[aa.VWAPSD1U.id]:i,[aa.VWAPSD1L.id]:s,[aa.VWAPSD2U.id]:r,[aa.VWAPSD2L.id]:n}}},MACROSS:class extends ca{constructor(e,t){super(e,t);let i=fO(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,aa.MAS),r=i(t,e.inputs.Period2,this.source,aa.MAL);this.addInner(s,r)}get helpers(){return pi}calculateAt(e){let t=this.innVal(1,aa.MAS,e),i=this.innVal(2,aa.MAL,e);return ps(this.container,e,t,i)}getWrappers(){return[this.wrapInner(aa.MAS,1),this.wrapInner(aa.MAL,2)]}},PACROSS:class extends ca{_maIndex;_maTarget;constructor(e,t){super(e,t),fE(this);let i=fO(e,"MA","Average")(t,e.inputs.Period,this.source);this.addInner(i);let[s]=f_(this);this._maIndex=s+1,this._maTarget=i.target}get helpers(){return pi}calculateAt(e){let t=this.innVal(this._maIndex,this._maTarget,e),[,i]=f_(this),s=i.getData(this.source)[e],r=ps(this.container,e,s,t);return r[this.target.id]=t,r}},VOIN:class extends ca{constructor(e,t){super(e,t);let i=fv(pr,function(e){return{[pr.id]:e>0?Math.abs(this.baseVal(aa.High,e)-this.baseVal(aa.Low,e-1)):null}},t),s=fv(pn,function(e){return{[pn.id]:e>0?Math.abs(this.baseVal(aa.Low,e)-this.baseVal(aa.High,e-1)):null}},t),r=fp(t,aa.TR);this.addInner(i,s,r)}calculateAt(e){let t=null,i=null,s=this.period;if(this.atLeast(e,s)){let r=this.past(e,s,pr,this.innCont(1)),n=this.past(e,s,pn,this.innCont(2)),a=this.past(e,s,aa.TR,this.innCont(3));if(eg(r)&&eg(n)&&eg(a)){let e=ef(r),s=ef(n),o=ef(a);t=e/o,i=s/o}}return{[aa.PLVI.id]:t,[aa.MNVI.id]:i}}},DIFA:class extends ca{isPercent;constructor(e,t){super(e,t);let i=fO(e,"MA","Average")(t,this.period,this.source,pl);this.isPercent="Percentage"===e.inputs.Distance,this.addInner(i)}get helpers(){return[aa.BARCOLIX]}calculateAt(e){let t=null,i=null,s=this.innVal(1,pl,e),r=this.baseVal(this.source,e);if(null!=s&&0!==s){t=r-s,this.isPercent&&(t=100*t/s);let n=t<=0;if(i=n?1:3,e>0){let s=this.container.getData(this.target)[e-1];null!==s&&(n&&t>s&&(i=0),!n&&t<s&&(i=2))}}return{[this.target.id]:t,[aa.BARCOLIX.id]:i}}},DOSC:class extends ca{constructor(e,t){super(e,t);let i=fa(fy(t,this.inputs.PeriodRsi,this.source,aa.RSI),this.inputs.PeriodEma1,aa.RSI,aa.EMA),s=fa(i,this.inputs.PeriodEma2,aa.EMA,aa.EMA),r=fn(s,this.inputs.PeriodMa,aa.EMA,aa.MA),n=fb(aa.DOSCH,(e,t,i)=>t-i,s,r),a=fn(n,this.inputs.PeriodSig,aa.DOSCH,aa.DOSCS);this.addInner(n,a)}getWrappers(){return[this.wrapInner(aa.DOSCH,1),this.wrapInner(aa.DOSCS,2)]}},BSQUEEZE:class extends cD{constructor(e,t){super(e,"Squeeze",t)}},MARIB:class extends ca{constructor(e,t){super(e,t);let i=this.inputs.Period,s=this.inputs.Increment,r=Math.min(Math.max(0,this.inputs.Count),10);for(let e=0;e<r;++e){let r=fn(t,i+e*s,this.source,this.outFields[e]);this.addInner(r)}}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)}},HASMO:class extends ca{constructor(e,t){super(e,t);let i=fO(e,"EMA","Smoothing1"),s=e.inputs.Period1,r=i(t,s,aa.Open),n=i(t,s,aa.High),a=i(t,s,aa.Low),o=i(t,s,aa.Close),l=fb(pd,(e,t,i,s,r)=>(t+i+s+r)/4,r,n,a,o),u=fb(pu,function(e,t,i,s){let r=null;if(e>0){let s=this.container.getData(pu)[e-1],n=this.innVal(2,pd,e-1);eH(s,n)?r=(s+n)/2:eH(t,i)&&(r=(t+i)/2)}return r},r,o,l),h=fb(ph,(e,t,i,s)=>eH(t,i,s)?Math.max(t,Math.max(i,s)):null,n,u,l),c=fb(pc,(e,t,i,s)=>eH(t,i,s)?Math.min(t,Math.min(i,s)):null,a,u,l),d=fO(e,"EMA","Smoothing2"),p=e.inputs.Period2,f=d(u,p,pu,aa.Open),m=d(h,p,ph,aa.High),g=d(c,p,pc,aa.Low),y=d(l,p,pd,aa.Close),T=fv(aa.Change,function(e){let t=null;if(e>0){let i=this.baseVal(aa.Close,e),s=this.baseVal(aa.Close,e-1);eH(i,s)?t=i-s:eH(i)&&!eH(s)&&(t=0)}return{[aa.Change.id]:t}},y);this.addInner(f,m,g,y,T)}getWrappers(){return[this.wrapInner(aa.Open,1),this.wrapInner(aa.High,2),this.wrapInner(aa.Low,3),this.wrapInner(aa.Close,4),this.wrapInner(aa.Change,5)]}},TTMSQZ:class extends ca{constructor(e,t){super(e,t);let i=e.inputs,s=fa(t,i.PeriodEmaKeltner,aa.Close),r=ff(t,i.PeriodAtrKeltner);function n(e,t,i,s){return eH(i,s)?i+e*s:null}let a=i.MultiplierKeltner,o=fb(aa.KCUP,eu(n,a),s,r),l=fb(aa.KCLOW,eu(n,-a),s,r),u=function(e,t,i,s=aa.Close){let r="BBANDS",n=fs(r);return fi(r,{source:s,inputs:{[tG.INPUT_PERIOD]:t,[tG.INPUT_WIDTH]:i},outFields:n},e)}(t,i.PeriodBollinger,i.WidthBollinger),h=function(e,t){let i="DONCHN",s=fs(i);return fi(i,{inputs:fe(t),outFields:s,source:null},e)}(t,i.PeriodMomentum),c=fn(t,i.PeriodMomentum,aa.Close),d=fS(fb(pp,function(e,t,i,s){let r=null,n=this.innVal(1,aa.DONMID,e);return eH(n,s)&&(r=t-(n+s)/2),r},t,h,c),i.PeriodMomentum,pp,aa.TTMSQZOSC);this.addInner(o,l,u,d)}get helpers(){return[aa.BARCOLIX]}calculateAt(e){let t=null,i=null,s=-1,r=this.innVal(1,aa.KCUP,e),n=this.innVal(2,aa.KCLOW,e),[a,o]=[aa.BOLLBU,aa.BOLLBL].map(t=>this.innVal(3,t,e));a<r&&o>n?t=0:i=0;let l=this.innVal(4,aa.TTMSQZOSC,e),u=e>0?this.innVal(4,aa.TTMSQZOSC,e-1):null;if(eH(l))if(eH(u)){let e=l>=0,t=u<l;s=e?t?3:2:+!!t}else s=2;return{[aa.TTMSQZON.id]:t,[aa.TTMSQZOFF.id]:i,[aa.BARCOLIX.id]:s}}getWrappers(){return[this.wrapInner(aa.TTMSQZOSC,4)]}},CRS:class extends ca{constructor(e,t){if(super(e,t),fR(t)){let i=y0().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.inputs.Symbol.toUpperCase();let r=i.getTimeSeries(s),n=e=>e.query?.symbol,{model:a}=nF(`{${n(t)}} / {${n(r)}}`,!1),o=new po(a,[t,r],(e=>{let t=e.unit===$.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:F.Manual,missing:t?H.UseNext:H.UsePrevious,stretch:e=>!1,fieldMap:new Map([[aa.Close,aa.CRS]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation)),l=fO(e,"MA","Average")(o,this.period,aa.CRS,aa.CRSAVG);this.addInner(r,o,l),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=fv(aa.Close,(e,t)=>null,t),i=fv(aa.CRS,(e,t)=>null,t),s=fv(aa.CRSAVG,(e,t)=>null,t);this.addInner(e,i,s),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(aa.CRS,2),this.wrapInner(aa.CRSAVG,3)]}},JPI:pE,CTTP:class extends pE{constructor(e,t){e.inputs=ej(sw("JPI").defaults.inputs.filter(e=>"HandbrakePeriod"!==e.name)),super(e,t)}},CTTI:class extends pE{constructor(e,t){e.inputs=structuredClone(p_),super(e,t)}},DRS:class extends ca{get indexSymbol(){return this.inputs[tG.INPUT_SYMBOL]}constructor(e,t){if(super(e,t),fR(t)){let i=y0().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.indexSymbol;let r=i.getTimeSeries(s),{model:n}=nF(`{${t.query.symbol}} / {${r.query.symbol}} * 100`,!1),a=new po(n,[t,r],(e=>{let t=e.unit===$.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:F.Manual,missing:t?H.UseNext:H.UsePrevious,stretch:e=>!1,fieldMap:new Map([[aa.Close,aa.DRS]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation));this.addInner(r,a),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=fv(aa.Close,(e,t)=>null,t),i=fv(aa.DRS,(e,t)=>null,t);this.addInner(e,i),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(aa.DRS,2)]}},MRS:class extends ca{get indexSymbol(){return this.inputs[tG.INPUT_SYMBOL]}constructor(e,t){super(e,t);let i=function(e,t,i,s=aa.DRS){return fi("DRS",{target:s,inputs:{[tG.INPUT_SYMBOL]:t},aggregation:i,source:null},e)}(t,this.indexSymbol,e.aggregation),s=fn(i,this.period,aa.DRS);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){let t=this.innVal(1,aa.DRS,e),i=this.innVal(2,aa.MA,e),s=null;return eH(t,i)&&0!==i&&(s=(t/i-1)*100),{[aa.MRS.id]:s}}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}},PMO:class extends ca{constructor(e,t){super(e,t);let i=fg(t,1),s=e.aggregation,r=fb(pL,(e,t)=>10*t,px(i,this.inputs.Period1,s,aa.ROC,pM)),n=px(r,this.inputs.Period2,s,pL,aa.PMO),a=fa(n,this.inputs.Period3,aa.PMO,aa.PMOS);this.addInner(n,a)}getWrappers(){return[this.wrapInner(aa.PMO,1),this.wrapInner(aa.PMOS,2)]}},RVOL:class extends ca{constructor(e,t){super(e,t);let i=fO(e,"MA")(t,this.period,aa.Volume,pO,!0);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(0,aa.Volume,e),s=this.innVal(1,pO,e);return eH(i,s)&&0!==s&&(t=i/s),{[this.target.id]:t}}},WGALPH:class extends ca{isDaily;isFeasible=!0;constructor(e,t){super(e,t),this.isFeasible=!(t instanceof uW)&&!pw.includes(W[t.query.curveStyle]),this.isDaily=e.aggregation.unit===$.Day}acceptable(e,t,i,s){return this.isDaily?0===s||!nf(this.baseVal(aa.DateTime,t),this.baseVal(aa.DateTime,i)):e>0&&i-t>=5}pluckValues(e){let t=0,i=[],s=e+5;for(let r=0;t<53&&e-r>0;r++){let n=e-r,a=this.baseVal(this.source,n);this.acceptable(a,n,s,t)&&(i.push(a),s=n,t++)}return i}calculateAt(e){let t=null;if(this.isFeasible&&e>=pI){let i=1,s=this.pluckValues(e),r=s.length;if(r>=27)for(let e=0;e<r-1;e++){let t=s[e]/s[e+1]-1;t<0?t=Math.max(t,-.2):t>=0&&(t=Math.min(t,.2)),i*=t=t*pD[e]+1}t=100*(i-1)}return{[this.target.id]:t}}},VOLAP:class extends pN{constructor(e,t){super(e,!1,t)}},AVWAP:class extends pe{constructor(e,t){super(e,t)}get helpers(){return[d7,d8]}isSameOhlcBar(e,t){let{unit:i,size:s}=this.aggregation;switch(i){case $.Tick:return e===t;case $.Intraday:return n5(t,lN(e,s));case $.Day:return n5(t,lO(e,s));case $.Week:return nf(e,t);case $.Month:return nu(e,t);case $.Quarter:return nc(e,t);case $.Year:return nm(e,t);default:throw Error(`Unexpected aggregation unit ${$[i]}`)}}calculateAt(e){let t=null,i=null,s=null,r=this.inputs.Anchor,n=this.dateAt(e);if(n5(r,n)||this.isSameOhlcBar(n,r)){let r=e>0,n=r?this.valueAt(d7,e-1):0,a=r?this.valueAt(d8,e-1):0,o=this.innVal(0,aa.Volume,e);t=(i=n+this.innVal(1,this.source,e)*o)/(s=a+o)}return{[d7.id]:i,[d8.id]:s,[aa.AVWAP.id]:t}}},KST:class extends ca{constructor(e,t){super(e,t);let i=this.source,s=fv(i,eu(fM,i),t),r=fg(s,this.inputs.PeriodRoc1,i),n=fg(s,this.inputs.PeriodRoc2,i),a=fg(s,this.inputs.PeriodRoc3,i),o=fg(s,this.inputs.PeriodRoc4,i),l=fn(r,this.inputs.PeriodMa1,aa.ROC,aa.MA1),u=fn(n,this.inputs.PeriodMa2,aa.ROC,aa.MA2),h=fn(a,this.inputs.PeriodMa3,aa.ROC,aa.MA3),c=fn(o,this.inputs.PeriodMa4,aa.ROC,aa.MA4),d=fb(aa.KST,(e,t,i,s,r)=>t+2*i+3*s+4*r,l,u,h,c),p=fn(d,this.inputs.PeriodSig,aa.KST,aa.KSTSIG);this.addInner(d,p)}getWrappers(){return[this.wrapInner(aa.KST,1),this.wrapInner(aa.KSTSIG,2)]}},STC:class extends ca{constructor(e,t){super(e,t);let i=fa(t,this.inputs.PeriodShort,aa.Close,pV),s=fb(pF,(e,t,i)=>t-i,i,fa(t,this.inputs.PeriodLong,aa.Close,pH)),r=this.inputs.PeriodStoch1,n=this.inputs.PeriodStoch2,a=fO(e,"EMA"),o=a(fc(s,r,pk,!1,pF),n,pk,pB),l=a(fc(o,r,pU,!1,pB),n,pU,this.target);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCCLO:class extends pz{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){let s=(e,t,i)=>t-i,r=fb(pG,"Yes"===this.inputs.RatioAdjusted?(e,t,i)=>(t-i)/(t+i)*1e3:s,t,i),n=fa(r,this.inputs.Period1,pG,pW),a=fa(r,this.inputs.Period2,pG,p$);return fb(this.target,s,n,a)}},NHLAI:pK,CMBCI:class extends ca{constructor(e,t){super(e,t);let i=fy(t,this.inputs.Period1Rsi,aa.Close,pq),s=fv(pX,eh(fL,this.inputs.Period1Mom,pq),i),r=fn(fy(t,this.inputs.Period2Rsi,aa.Close,pZ),this.inputs.Period2Ma,pZ,pJ),n=fb(aa.CMBCI,(e,t,i)=>t+i,s,r),a=fn(n,this.inputs.PeriodFastMa,aa.CMBCI,aa.CMBCIF),o=fn(n,this.inputs.PeriodSlowMa,aa.CMBCI,aa.CMBCIS);this.addInner(n,a,o)}getWrappers(){return[this.wrapInner(aa.CMBCI,1),this.wrapInner(aa.CMBCIF,2),this.wrapInner(aa.CMBCIS,3)]}},COTI:class extends ca{constructor(e,t){super(e,new dC({source:aa.Close,inputs:{},outFields:fs("COTLC")},t));let i=Number.parseInt(this.inputs.History),s=fc(this.innerSeries[0],6===i?26:52*i,aa.COTI,!1,aa.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(s)}getWrappers(){return[this.wrapInner(aa.COTI,1)]}},CHEXI:class extends ca{isLong;constructor(e,t){super(e,t),this.isLong="Long"===this.inputs.Direction;let i=this.period,s=ff(t,i),r=this.inputs.Multiplier,n=fb(pQ,(e,t)=>null===t?null:r*t,s),a=fh(t,i,aa.High,aa.HH,!0),o=fh(t,i,aa.Low,aa.LL,!1);this.addInner(n,a,o)}calculateAt(e){let t=null,i=null,s=this.innVal(1,pQ,e);return null!==s&&(this.isLong?t=this.innVal(2,aa.HH,e)-s:i=this.innVal(3,aa.LL,e)+s),{[aa.CHEXL.id]:t,[aa.CHEXS.id]:i}}},MBBANDS:class extends cD{constructor(e,t){super(e,"Modified",t)}},OPTIV:class extends p0{},IVRANK:class extends p0{},IVPCTL:class extends p0{},OPTVOLPC:class extends p0{},OPTOIPC:class extends p0{},OPTVOL:class extends p0{},OPTOI:class extends p0{},CHOP:class extends ca{constructor(e,t){super(e,t);let i=ff(t,1),s=this.inputs.Period,r=fh(t,s,aa.High,aa.HH,!0),n=fh(t,s,aa.Low,aa.LL,!1);this.addInner(i,r,n)}calculateAt(e){let t=null,i=this.period;if(e>i){let s=this.past(e,i,aa.ATR,this.innCont(1));if(eg(s)){let r=ef(s),n=this.innVal(2,aa.HH,e);t=100*Math.log10(r/(n-this.innVal(3,aa.LL,e)))/Math.log10(i)}}return{[this.target.id]:t}}},MACLD:class extends ca{constructor(e,t){super(e,t);let i=fO(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,aa.MACLD1),r=i(t,e.inputs.Period2,this.source,aa.MACLD2);this.addInner(s,r)}get helpers(){return[aa.BARCOLIX]}calculateAt(e){let t=this.innVal(1,aa.MACLD1,e),i=this.innVal(2,aa.MACLD2,e);return{[aa.BARCOLIX.id]:+(t>i)}}getWrappers(){return[this.wrapInner(aa.MACLD1,1),this.wrapInner(aa.MACLD2,2)]}},BTI:class extends pz{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){let s=fb(p1,(e,t,i)=>t/(t+i),t,i);return fO(e,"MA","Average")(s,this.inputs.Period,p1,this.target)}},PC:class extends ca{stdDevs;periodForecast;unitsPerYear;constructor(e,t){super(e,t),this.unitsPerYear=fD(e.aggregation),this.stdDevs=this.toInt("StandardDeviations"),this.periodForecast=this.toInt("PeriodForecast");let i=this.getHistVolPeriod();if(null!==i){let s=function(e,t,i,s=aa.Close,r=aa.HV){return fi("HV",{source:s,target:r,aggregation:i,inputs:fe(t)},e)}(t,i,e.aggregation);this.addInner(s)}}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"Custom"===this.volatilityParam}get haveVolatility(){return this.isCustomVolatility||this.innHasData(1)}getVolatilityPercent(){return(this.isCustomVolatility?this.inputs.VolatilityPercent:this.innCont(1).getLastDataPoint(aa.HV))/100}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null;if(this.haveVolatility){let o=this.base.size-this.periodForecast;if(e>=o){let l=this.base.getLastDataPoint(aa.Close),u=l*this.getVolatilityPercent()*Math.sqrt((e-o+1)/this.unitsPerYear);if(t=l+u,i=l-u,this.stdDevs>1){let e=2*u;if(s=l+e,r=l-e,this.stdDevs>2){let e=3*u;n=l+e,a=l-e}}}}return{[aa.PCUP1.id]:t,[aa.PCDN1.id]:i,[aa.PCUP2.id]:s,[aa.PCDN2.id]:r,[aa.PCUP3.id]:n,[aa.PCDN3.id]:a}}recalculateAt(e,t,i){let s={tag:e0(),src:this.innerSeries[0]};i&&this.calculate(s)}},GREEKS:class extends ca{constructor(e,t){super(e,cr(t,e=>new p2(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(aa.Delta,0),this.wrapInner(aa.Gamma,0),this.wrapInner(aa.Theta,0),this.wrapInner(aa.Vega,0)]}},PVACP:class extends pN{constructor(e,t){super(e,!0,t)}}};function fe(e){return{[tG.INPUT_PERIOD]:e}}function ft(e){return{target:e,source:null,inputs:fd}}function fi(e,t,i){if(eW(p9,e))return new p9[e](t,i);let s=y0()?.config.extensions?.studyProvider;if(s){let r=s.factory(e,t,i);if(r)return r}throw Error(`Study ${e} has not been implemented yet.`)}function fs(e){return sw(e).defaults.curves.reduce((e,t)=>e.concat(t.fields.filter(t=>!e.includes(t))),[]).map(e=>aa[e])}function fr(e,t,i,s){return{source:t,target:i,inputs:fe(e),allowEmptyValues:s}}function fn(e,t,i,s=aa.MA,r=!1){return fi("MA",fr(t,i,s,r),e)}function fa(e,t,i,s=aa.EMA,r=!1){return fi("MAEXP",fr(t,i,s,r),e)}function fo(e,t,i,s=aa.SMA,r=!1){return fi("MASMO",fr(t,i,s,r),e)}function fl(e,t,i,s=aa.WMA,r=!1){return fi("MAWEI",fr(t,i,s,r),e)}function fu(e,t,i,s=aa.HMA,r=!1){return fi("HMA",fr(t,i,s,r),e)}function fh(e,t,i,s,r,n=!1){return new cL({source:i,target:s,inputs:fe(t)},r,n,e)}function fc(e,t,i,s,r=null){return new cx({source:r,target:i,inputs:fe(t)},s,e)}let fd={};function fp(e,t=aa.TR){return fi("_TR",ft(t),e)}function ff(e,t,i="SMA",s=aa.ATR){return fi("ATR",{target:s,inputs:{[tG.INPUT_PERIOD]:t,[tG.INPUT_SMOOTHING]:i},source:null},e)}function fm(e,t=aa.TP){return fi("TP",ft(t),e)}function fg(e,t,i=aa.Close,s=aa.ROC){return fi("ROC",{source:i,target:s,inputs:fe(t)},e)}function fy(e,t,i,s=aa.RSI,r=!1){return fi("_RSI",{source:i,target:s,inputs:{...fe(t),Modified:r}},e)}function fT(e,t=aa.MFMUL){return fi("MFV",ft(t),e)}function fA(e,t,i,s=aa.MSD){return fi("MSD",{source:i,target:s,inputs:fe(t)},e)}function fS(e,t,i,s=aa.MOVLR){return fi("MOVLR",{source:i,inputs:fe(t),target:s},e)}function fv(e,t,i){return new cY(ft(e),t,i)}function fb(e,t,...i){return new c$(ft(e),t,...i)}function fP(e,t,i){return t-i}function fC(e,t,i){return(t-i)/i*100}function fE(e){let t=e.source;if(e.sourceNeedsCompute=function(e){switch(e.id){case"HL/2":case"OC/2":case"HLC/3":case"OHLC/4":case"HLCC/4":return!0;default:return!1}}(t),e.sourceNeedsCompute){let i=fv(t,eu(fM,t),e.innerSeries[0]);e.addInner(i)}}function f_(e){let t=+!!e.sourceNeedsCompute;return[t,e.innCont(t)]}let fM=function(e,t){let[i,s,r,n]=[aa.Open,aa.High,aa.Low,aa.Close].map(e=>this.baseVal(e,t)),a=null,o=e.id;switch(o){case"Open":a=i;break;case"High":a=s;break;case"Low":a=r;break;case"Close":a=n;break;case"HL/2":a=(s+r)/2;break;case"OC/2":a=(i+n)/2;break;case"HLC/3":a=(s+r+n)/3;break;case"OHLC/4":a=(i+s+r+n)/4;break;case"HLCC/4":a=(s+r+n+n)/4}return{[o]:a}},fL=function(e,t,i){let s=null;if(this.atLeast(i,e+1)){let r=this.baseVal(t,i-e);null!==r&&(s=this.baseVal(t,i)-r)}return{[this.target.id]:s}},fx={sma:fo,ma:fn,ema:fa,wma:fl,hma:fu};function fO(e,t,i="Smoothing"){return fx[(e.inputs[i]??t).toLowerCase()]}let fI={atr:ff,adjatr:function(e,t,i="MA",s=aa.Close,r=aa.ADJATR){return fi("ADJATR",{source:s,target:r,inputs:{[tG.INPUT_PERIOD]:t,[tG.INPUT_SMOOTHING]:i}},e)}};function fD(e){switch(e.unit){case $.Day:return 252;case $.Week:return 52;case $.Month:return 12;default:return 0}}function fw(e){let t=[aa.High,aa.Low];return e instanceof po&&2!==ev(e.targetFields,t).length}function fR(e){return!(e instanceof uW)&&e.query instanceof ci}class fN extends co{constructor(e,t){super(e,t,fa(t,13,aa.Close),function(e,t,i,s,r=aa.Close){return fi("MACDEXP",{source:r,inputs:{Period1:12,Period2:26,Period3:9},outFields:[aa.MACD,aa.MACDS,aa.MACDH]},e)}(t,0,0,0,aa.Close)),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=B.Same,i=this.innVal(1,aa.EMA,e),s=this.innVal(1,aa.EMA,e-1),r=this.innVal(2,aa.MACDH,e),n=this.innVal(2,aa.MACDH,e-1);return eH(i,s,r,n)&&(i>s&&r>n?t=B.Up:i<s&&r<n&&(t=B.Down)),{[aa.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(aa.Open,aa.High,aa.Low,aa.Close,aa.Change,aa.Volume,aa.OpenInterest,aa.TradingDay)}}function fV(e,t){return eH(t)?(this[e]=t,null):this[e]}class fH{_domain;_range;_extent;_padding;constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return fV.call(this,"_domain",e)}range(e){return fV.call(this,"_range",e)}padding(e){return fV.call(this,"_padding",e)}get ready(){return eH(this._domain,this._range)}}let fF=1/Math.log2(10);function fk(e,t){let i,s,r,n,a=(i=e[0],(s=e[1]-i)>0?e=>(e-i)/s:e=>ed(isNaN(s)?NaN:.5)),o=(r=t[0],n=t[1],e=>r*(1-e)+n*e);return e=>o(a(e))}function fB(e){return Math.sign(e)*Math.log10(1+Math.abs(e/fF))}function fU(e){return Math.sign(e)*fF*(-1+Math.pow(10,Math.abs(e)))}let fW=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]];class f$ extends fH{scaleType;axis;constructor(e,t){super(),this.scaleType=e,this.axis=t}domain(e){return this.axis&&e&&!function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e===t)return!0;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(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 i=ed,s=ed;switch(this.scaleType){case q.Linear:break;case q.Logarithmic:i=fB,s=fU;break;default:throw Error("Unexpected scale type (neither linear nor log)")}let r=this._domain.map(i),n=this.rangeWithPadding(),a=t?fk(n,r):fk(r,n),o=e=>n[1]-e+n[0],l=t?o:i;return(t?s:o)(a(l(e)))}priceToY(e){return this.mapValue(e,!1)}getTicks(e){if(!this.ready)return[];let[t,i]=this._range.map(e=>this.mapValue(e,!0));if(t===i&&e>0)return[t];let[s,r]=this._domain;if(this.scaleType===q.Linear||s<0||r>1e5)return fG(t,i,e);let n=this.findLogBand(s),a=this.findLogBand(r),o=2*e;return a-n==0?fG(t,i,o):this.getLogTicks(n,a,o,i<t)}findLogBand(e){return fW.findIndex(([t,i])=>e>=t&&e<i)}getLogTicks(e,t,i,s){let r=[...this._domain],n=[];try{for(let a=e;a<=t;a++){let[o,l]=fW[a];a===e?o=r[0]:a===t&&(l=r[1]),this.domain([o,l]);let[u,h]=this._range.map(e=>this.mapValue(e,!0)),c=fG(u,h,i);n=s?c.concat(n):n.concat(c)}}finally{this.domain(r)}return!function(e,t){let i=e.length;for(let s=1;s<i;++s){let i=e[s],r=s-1;for(;r>=0&&t(e[r],i);)e[r+1]=e[r],r-=1;e[r+1]=i}}(n,s?(e,t)=>e>t:(e,t)=>e<t),n}checkTicks(){return this.scaleType===q.Logarithmic}}function fG(e,t,i){let s,r=-1,n,a,o;if(i*=1,(e*=1)==(t*=1)&&i>0)return[e];if((s=t<e)&&(n=e,e=t,t=n),0===(o=function(e,t,i){let s=Math.sqrt(50),r=Math.sqrt(10),n=Math.sqrt(2),a=(t-e)/Math.max(0,i),o=Math.floor(Math.log(a)/Math.LN10),l=a/Math.pow(10,o);return o>=0?(l>=s?10:l>=r?5:l>=n?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(l>=s?10:l>=r?5:l>=n?2:1)}(e,t,i))||!isFinite(o))return[];if(o>0)for(e=Math.ceil(e/o),a=Array(n=Math.ceil((t=Math.floor(t/o))-e+1));++r<n;)a[r]=(e+r)*o;else for(a=Array(n=Math.ceil((e=Math.floor(e*o))-(t=Math.ceil(t*o))+1));++r<n;)a[r]=(e-r)/o;return s&&a.reverse(),a}let fz={color:tG.COLOR_TRANSPARENT},fY={color:tG.COLOR_TRANSPARENT,width:0,dashStyle:"Solid"},fj=new Set([aa.Open,aa.High,aa.Low,aa.Close].map(e=>e.id)),fK=new iD(0,0,0,0);class fq{axis;id;record;metaData;timeSeries;notifyAboutPriceDomains=!1;customPlotValues=!1;_priceMapFirstIndex;priceMapper;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=X.Symbol;isShutDown=!1;targetFields=[];detachedScale;yScale=null;levels;bands;annotations;visFromIndex;visToIndex;_eventsData;precision;visible=!0;constructor(){this.axis=null,this.id=e0(),this.record=new ad(""),this.metaData=new ii,this.timeSeries=new uW,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&&eH(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(X.Symbol)}get isExpression(){return this.is(X.Expression)}get isStudy(){return this.is(X.Study)}get isForward(){return this.is(X.Forward)}get isSeasonal(){return this.is(X.Seasonal)}getValueAt(e,t,i){return null}wrapIfAdvancedStyle(e){let t=e,i=e=>({outFields:e,inputs:{},source:null});return this.mainCurve.isHeikinAshiStyle?t=new cl(i(ur.slice()),e):this.mainCurve.isElderImpulseSystemStyle?t=new fN(i(ur.slice().concat(aa.BREL)),e):this.mainCurve.isPercentChangeStyle&&(t=new dG(i(ur.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=X[e.type],this.main=e.main,e.levels&&(this.levels=e.levels),e.bands&&(this.bands=e.bands),eH(e.precision)&&(this.precision=e.precision),this.curves=e.curves.map(e=>{let t=new hU;return t.plot=this,t.fromModel(e),t}),e.detachedScale&&(this.detachedScale=e.detachedScale,this.yScale=new f$(q.Linear,null)),this.visible=e.visible??!0}initialize(){}shutdown(){eH(this.timeSeries)&&eH(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){let e=this.axis.pane.presenter,t=new ci(null,e.data.aggregation,Z.Normal,[eK(e$(e.data,null,"range","from")),eK(e$(e.data,null,"range","to"))]);return t.barsToFetch=e.data.maxDataPoints||tG.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=e$(e.display,null,"xAxis","visibleRange"),t.extendedHours=e.data.extendedHours,t}priceToY(e){return(this.hasDetachedScale?this.yScale:this.axis.yScale).priceToY(e)}get hasDetachedScale(){return eH(this.detachedScale,this.yScale)&&this.detachedScale}getDetachedScaleMargins(){return tG.DEFAULT_DETACHED_SCALE_MARGINS}setViewBox(e){if(!this.hasDetachedScale)return;let{y:t,height:i}=e,{top:s,bottom:r}=this.getDetachedScaleMargins();this.yScale.range([Math.floor(t+s*i),Math.floor(t+i-r*i)])}drawLevels(e){e.save();let t=tG.OUT_OF_SCREEN;for(let i of this.levels.filter(e=>e.visible)){let s=this.priceToY(i.value);i6(e,i7({line:i.line,fill:fz})),iG(e,{x:-1,y:s},{x:t,y:s})}e.restore()}drawBands(e){e.save();let t=tG.OUT_OF_SCREEN;for(let i of this.bands){let s=this.priceToY(i.range.to),r=this.priceToY(i.range.from);i6(e,i7({fill:i.fill,line:fY})),iW(e,new iD(-1,s,t,r-s),!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!==aa.DateTime):[]}getEventsAt(e){let t=this.eventsSeries.container,i=i=>t.getData(i)[e];return this.getEventFields().map(t=>{let s=i(t);if(!eH(s))return null;let r=this.getEventFor(t);if(!eH(r))return null;let n={field:t,value:s,date:i(aa.DateTime),text:r.title,color:r.color};if(t!==aa.Custom||s!==tG.FAKE_CUSTOM_EVENT)return n;{let t=e%2==0;return{...n,value:t?"___news":"___video",text:t?"N":"V"}}}).filter(e=>null!=e)}getRefEventField(e,t,i){return t?e.isOhlc?aa.High:i.isTick?aa.Last:aa.Close:e.fields[0]}getRefPlot(e){return this.axis.pane.isMain?e.mainPlot:this}drawEvents(e,t){let i=this.axis.pane.presenter,s=i.view.xAxis.xScale,r=s.domain();if(!eH(r)||!eH(r[0],r[1]))return;let n=(e,t=aa.DateTime)=>e.container.getData(t),a=n(this.eventsSeries),o=this.getRefPlot(i),l=o.timeSeries,u=n(l),h=i.data.aggregation,c=o===i.mainPlot,d=n(l,this.getRefEventField(o.mainCurve,c,h)),{chart:{fontFamily:p}}=this.axis.pane.presenter.display,f=a.map((e,n)=>e.valueOf()>=r[0].valueOf()&&e.valueOf()<=r[1].valueOf()?this.getEventsAt(n).map(e=>{let r=function(e,t){let{unit:i}=e;if(i===$.Year)return tn(t);if(i===$.Quarter)return nh(t);if(i===$.Month)return th(t);if(i===$.Week)return np(t);if(i===$.Day)return to(t);return t}(h,e.date),n=e_(u,+r,Number),a=d[n];t.has(n)||t.set(n,-1);let o=t.get(n);t.set(n,++o);let l=s.timeToX(r),c=i.view.getEventRadius(),p=this.axis.yScale.priceToY(a)-o*(c+c+c);return{visible:!0,...e,x:l,y:p,r:c,rect:fK}}):[]).flat();e.save();let m=!0;f.forEach(t=>{t.rect=function(e,{x:t,y:i,r:s,color:r,text:n},a){e.fillStyle=r,e.beginPath();let o=s+s,l=new iD(t-s,i-s-o,o,o);e.fillRect(l.x,l.y,l.width,l.height);let u=(1.6*s).toFixed(0);return e.font=`700 ${u}px "${a}"`,e.fillStyle="#fff",e.textAlign="center",e.textBaseline="middle",e.beginPath(),e.fillText(n,t,i-.9*o),l}(e,t,p),this.customEventPopup?.visible&&t.date===this.customEventPopup.date&&(this.showCustomEventPopup(t),m=!1)}),e.restore(),this._eventsData=f,this.customEventPopup?.visible&&m&&this.hideCustomEventPopup()}get customEventPopup(){return this.axis.pane.presenter.view.customEventPopup}hideCustomEventPopup(){this.customEventPopup?.hide()}showCustomEventPopup(e){let{x:t,y:i,r:s,date:r,value:n}=e;this.customEventPopup?.show({x:t+2*s,y:i-2*s},r,n)}getCustomEventDataAt(e){if(!this._eventsData)return null;let t=this._eventsData.find(t=>t.rect.contains(e));return t?.field===aa.Custom?t:null}hitTestCustomEvent(e){return null!==this.getCustomEventDataAt(e)}tryHandleCustomEventClick(e){let t=this.getCustomEventDataAt(e);return!!eH(t)&&(this.showCustomEventPopup(t),!0)}isEmpty(){let e=this.timeSeries;return eH(e)&&e.hasData&&e.container.isEmpty}draw(e){if(this.visible)for(let t of(eH(this.levels)&&this.drawLevels(e),eH(this.bands)&&this.drawBands(e),this.curves))t.draw(e)}drawTopmost(e,t){this.hasEventsData&&this.drawEvents(e,t)}isComparison(e){return this.axis.comparison===e}invalidatePriceMappingCache(){this._firstVisibleDate=null}_priceMapper(e,t,i,s){if(!eH(e)||!this.timeSeries.hasData||!this.shouldPriceMap(i,s))return e;let[r,n]=this.axis.pane.presenter.view.xAxis.xScale.domain()||[];if(!eH(r)||!op(r))return e;if(this._firstVisibleDate!==r){this._firstVisibleDate=r;let e=this.timeSeries.container.getTimeData(),t=t=>e_(e,+t,Number);this.visFromIndex=t(r),this.visToIndex=t(n),this._priceMapFirstIndex.clear()}return this._priceMapFirstIndex.has(i)||this.canPriceMap(t,i),this.priceMap(e,t,i,!1,s)}isOhlcMapping(e){return this.mainCurve.isOhlc&&fj.has(e.id)}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===aa.PreviousClose?aa.Close:e}dataOf(e){return this.timeSeries.container.getData(e)}canPriceMap(e,t){let i=this.getRefPriceMapField(t),s=this.dataOf(i),r=null,n=this.visFromIndex;for(;null===r&&n<=this.visToIndex;)r=s[n++];this._priceMapFirstIndex.set(i,null!==r?n-1:NaN)}priceMap(e,t,i,s=!1,r=K.None){let n=this.getRefPriceMapField(i),a=this._priceMapFirstIndex.get(n);if(!Number.isFinite(a))return e;let o=this.dataOf(n)[a];return this.isComparison(K.Percent)||r===K.Percent?s?o+o*e/100:100*Math.abs(e-o)*(e>=o?1:-1)/Math.abs(o):s?o+e:e-o}shouldPriceMap(e,t){return eH(t)?t!==K.None:this.isComparison(K.Percent)||this.isComparison(K.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}}class fX extends fq{_symbol;_showPrevious;yearOffset;resolved=null;events;inputs=[];_eventsSeries;compare;get symbol(){return this._symbol}get title(){return this.symbol}get showPrevious(){return this._showPrevious}getPreviousValue(){if(!eH(this.timeSeries)||!eH(this.timeSeries.record))return null;let e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(aa[e])}getTimeSeries(){let e=y0().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.resolved,this.mainCurve.style){case W.Renko:case W.Kagi:case W.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case W.Range:t.barsToFetch=4e3;break;case W.LineBreak:t.inputs=this.inputs}let i=this.axis.pane;if(eH(i.alignedToYear)){let e=tL(t.symbol);null!==e&&(this.yearOffset=i.alignedToYear-e.getFullYear(),t.offset=this.yearOffset)}let s=e.getTimeSeries(t);this.timeSeries=this.wrapIfAdvancedStyle(s),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:er.Unspecified};this.presenter?.notifyHost(ao.TS_MANYCHANGED,e),this.getEvents()}})}getMetaData(){let e=y0().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(ao.MD_CHANGED,{plot:this})})}getEvents(){if(!this.hasEvents)return;let e=y0().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:Z.Events,getHashKey:function(){return Object.values(this).filter(e=>"function"!=typeof e).join("|")}};tG.EVENTS.forEach(e=>{t[e]=e$(this.events,!1,e,"show")}),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then(e=>{e&&this.presenter?.notifyHost(ao.TS_EVENTSCHANGED,{series:this.eventsSeries})})}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return!!eH(this.events)&&tG.EVENTS.some(e=>e$(this.events,!1,e,"show"))}findEvents(e){if(!this.hasEventsData||null===e[0]||null===e[1])return[];let t=e[0],i=e[1];if(i>0&&this.axis?.pane?.presenter?.data?.aggregation?.isIntraday){let e=this.timeSeries.container.getTimeData()[i-1];if(this.compare(e,t))return[]}return this.eventsSeries.container.getTimeData().map((e,i)=>this.compare(e,t)?this.getEventsAt(i):[]).flat()}fromModel(e){super.fromModel(e),this._showPrevious=e.showPrevious,this.events=e.events,this.inputs=e.inputs||[],this.compare=function(e){switch(e.unit){case $.Tick:return nb;case $.Intraday:case $.Day:return nT;case $.Week:return nA;case $.Month:return nS;case $.Quarter:return nv;case $.Year:return nm;default:return nb}}(this.axis.pane.presenter.data.aggregation),this._symbol=e.symbol}getEventFor(e){let t=this.events[e.id.toLowerCase()];return eH(t)&&t.show?t:null}async initialize(){return tU.call(this,async()=>(this.resolved=await tf(this.symbol),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class fZ extends fX{seriesKind;fundamental;constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${$[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=$[e.fundamental],super.fromModel(e)}makeQuery(){let e=new ci(this.symbol,new nP(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}}class fJ{longPressTimeout;constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){let e=y0().config.touchCrosshairDelayMillis;return eH(e)&&Number.isFinite(e)?e:tG.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,i){eI()&&(this.longPressTimeout=setTimeout(()=>this.longPressTriggered(e,t,i),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,i){this.cancelLongPress(),this.performLongPress(e,t,i)}cancelLongPress(){eI()&&eH(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,i){}}function fQ(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}class f0 extends fJ{annotation;previous;cursorSet;moved;snapToSupported;constructor(e,t,i){super(),this.annotation=e,this.previous=t,this.cursorSet=!1,this.moved=!1,this.snapToSupported=!1,this.startLongPress(null,t,i)}performLongPress(e,t,i){mR(this.annotation,i)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),fQ(this.annotation))return;let{point:t,view:i,offset:s}=e;if(!eV(t)||t.axis!==this.annotation.axis)return;i.drawCrosshair({ap:t,offset:s}),this.cursorSet||(this.previous.axis.pane.presenter.view.setCursor(Q.Move),this.cursorSet=!0);let r=iy(t.point,this.previous.point);this.annotation.offset(r),this.annotation.wasModifiedByTool(),this.annotation.requestRedraw(),this.previous=t,this.moved=!0}onMouseUp(e){this.cancelLongPress(),g_(this.annotation,this.moved,eo.Moved)}}class f1{annotation;pointIndex;snapToSupported;moved;alignPointsMode;constructor(e,t){this.annotation=e,this.snapToSupported=!0,this.moved=!1,this.alignPointsMode=!1,this.pointIndex=e.points.indexOf(t)}onMouseMove(e){if(this.alignPointsMode=e.getModifier(et.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),fQ(this.annotation))return;let{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),eH(t)){let e=this.annotation.points[this.pointIndex],i=iy(t.point,e.point);switch(e.moveDirection){case ei.Both:e.update(t.price,t.time);break;case ei.Horizontal:e.update(e.price,t.time);break;case ei.Vertical:e.update(t.price,e.time)}this.moved=e.moveDirection!==ei.None,this.moved&&this.annotation.wasPointMovedByTool(e,i)}this.annotation.requestRedraw()}onMouseUp(e){g_(this.annotation,this.moved,eo.PointMoved)}}class f2{anchor;isVertical;axis;constructor(e,t,i){this.anchor=e,this.isVertical=t,this.axis=i}hitTest(e){return!!eH(this.anchor)&&(this.isVertical?Math.abs(e.x-this.anchor.x)<=tG.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=tG.HIT_TEST_TOLERANCE)}draw(e){let t=tG.OUT_OF_SCREEN;this.isVertical?iz(e,this.anchor.x,-t,t):iY(e,this.anchor.y,-t,t)}}class f3{id;axis;_price;_time;passive=!1;moveDirection=ei.Both;visible=!0;point;constructor(e,t,i){this.id=e0(),this.axis=e,void 0!==t&&void 0!==i&&(this.price=t,this.time=i,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!==ei.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){let e=this.axis.toPoint(this);eH(e)&&ek(e.x)&&ek(e.y)&&(this.point=e)}update(e,t){this.price=e,this.time="number"==typeof t?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)<=tG.HIT_TEST_TOLERANCE}distance(e){let t=e.x-this.point.x,i=e.y-this.point.y;return Math.abs(Math.sqrt(t*t+i*i)-tG.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(eH(this.point)){let i=tG.HALF_ANN_POINT_DIMENSION;eH(t)&&t.locked&&(i*=.6),e.beginPath(),e.ellipse(this.point.x,this.point.y,i,i,0,0,2*Math.PI),e.stroke()}}}function f4(e){return 0===iM(e.fill.color).a?e.line.color:e.fill.color}function f5(e,t){return{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 f6(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}}class f7{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=e0()}requestRedraw(){this.axis.pane.presenter.view?.redraw()}prepareDraw(e,t){return this.drawPoints(e,t),this.readyToDraw()}readyToDraw(){return this.activePoints.every(e=>void 0!==e.point)}getPriceScaleAdornments(){return tG.EMPTY_ARRAY}getTimeScaleAdornments(){return tG.EMPTY_ARRAY}extractTraits(e=!0){let t=eG(this.traits),i=sS(this.name);return Object.keys(t).forEach(s=>{let r=i.includes(s);(e&&!r||!e&&r)&&delete t[s]}),e||["line","fill","zIndex"].forEach(e=>delete t[e]),t}extractPoints(){return this.activePoints.map(e=>({price:e.price,time:eF(+e.time,4)}))}offset(e){this.points.filter(e=>e.movable).forEach(t=>{t.updateFromPoint(iT(t.point,e))})}get traits(){return this._traits||(this._traits=eG(this.defaultTraits)),this.adjustFill&&(this._traits.fill.color=f4(this._traits),this.adjustFill=!1),this._traits}set traits(e){void 0!==e&&ez(this.traits,e,!1)}get activePoints(){return this.points.filter(e=>!e.passive)}get style(){return i7(this.traits)}get defaultTraits(){return i5(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return i7(this.defaultTraits)}get adornStyle(){let e=eG(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=tG.COLOR_TRANSPARENT,i7(e)}get pointsStyle(){let e=eG(this.defaultTraits);return e.line.dashStyle="Solid",i7(e)}get allowPricesChangeUI(){return this.traits?.allowPricesChangeUI}wasModifiedByTool(){}wasPointMovedByTool(e,t){}isPointDrawn(e){return void 0!==e.price}drawPoints(e,t){this.points.forEach(i=>{let s=this.isPointDrawn(i),r=eH(e);t&&(s||!r)&&i.toPoint(),r&&s&&(this.isSelected||this.drawn)&&(i6(e,this.pointsStyle),i.draw(e,this))})}addPoints(e){for(let t=0;t<e;t++)this.points.push(new f3(this.axis))}toModel(){let e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:eG(this.traits)}}canMove(e){return!0}updatePoints(e){}updateActivePoints(e){let t=this.activePoints;t.length===e.length&&t.forEach((t,i)=>{let s=e[i];t.update(s.price,s.time)})}updateFrom(e,t,i,s,r){"boolean"==typeof s&&(this.visible=s),"boolean"==typeof r&&(this.locked=r);let n=eH(e)?eG(e):{};eH(t)&&ez(n,t,!1),this.traits=n,eH(i)&&this.updatePoints(i)}priceMap(e){return this.axis.priceMap(e)}flip(e){let t=this.getFlipAnchorIndices();if(!eV(t))return;let i=this.points[t[0]],s=this.points[t[1]];if(e){let e=s.time;s.update(s.price,i.time),i.update(i.price,e)}else{let e=s.price;s.update(i.price,s.time),i.update(e,i.time)}this.wasModifiedByTool()}getFlipAnchorIndices(){return null}}function f8(e,t,i,s){return function(r,n=!0){let a=new t(r,e,i);return n?r.appendAnnotation(a):a.drawn=!1,eH(s)&&(a.traits=s),a}}class f9{axis;angle;extent;anchor1;anchor2;p1;p2;style;extended;_data;isTrend;constructor(e,t,i,s,r){this.axis=r,eH(e,t)&&(this.angle=iA(e,t),this.extent=this.getExtent(e,t),this.anchor1=e,this.anchor2=t,this.p1=i?this.extendPoint(t,-1):e,this.p2=s?this.extendPoint(e,1):t),this.extended=i||s}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 i=Math.max(Math.abs(e.x),Math.abs(t.x)),s=Math.max(Math.abs(e.y),Math.abs(t.y));return Math.sqrt(i*i+s*s)+tG.OUT_OF_SCREEN}hitTest(e){return!!eH(this.p1,this.p2)&&iS([this.p1,this.p2],e,tG.HIT_TEST_TOLERANCE)}draw(e){eH(this.p1,this.p2)&&(iG(e,this.p1,this.p2),this.extended)}getAdornOffset(e){var t,i;let s=ik(e),r=iH(e,1);return t=this.p1,i=this.p2,-(t.y-i.y)/(t.x-i.x)<0&&(s.y=r+5),s}}class me{style;axis;rect;constructor(e,t,i,s){this.axis=s,this.rect=new iD(e.x,e.y,t,i)}hitTest(e){return this.rect.contains(e)}draw(e,t){iW(e,this.rect)}}class mt extends f7{countCache;constructor(e,t){super(e,t)}draw(e,t){if(this.prepareDraw(e,t)&&!this.drawn){let t=this.getElements();i6(e,this.style),t.forEach((t,i)=>{i6(e,this.getStyleForElement(t,i)),t.draw(e)}),i6(e,this.adornStyle),this.adornElements(t,e);let i=this.getMarkers();i6(e,this.style),i.forEach(t=>{t.draw(e)})}}getBarCount(e,t){if(void 0===this.countCache||this.countCache.time1!==e||this.countCache.time2!==t){let i=this.axis.pane.presenter.view,s=Math.abs(i.toIndex(e)-i.toIndex(t));this.countCache={time1:e,time2:t,barCount:s}}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.visible){let t=this.getElements(),i=this.getMarkers();return!!(t.some(t=>t.hitTest(e))||i.some(t=>t.hitTest(e)))||this.hitTestAdornments(t,e)}return!1}updatePointsFrom(e,t=0){e.forEach((e,i)=>this.points[t+i].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(){var e;return e=this.traits?.singleStyle,!eH(e)||e}get showBackground(){var e;return e=this.traits?.showBackground,!!eH(e)&&e}get backgroundOpacity(){var e;return eH(e=this.traits?.backgroundOpacity)?e:0}fillOnlyStyle(e){return i7({line:{color:tG.COLOR_TRANSPARENT,dashStyle:"Solid",width:0},fill:this.traits[e]})}lineOnlyStyle(e){return i7({fill:{color:tG.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new f9(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return iP(ib(e),this.backgroundOpacity)}getTraitsFor(e){let t={fill:{color:tG.COLOR_TRANSPARENT},line:{...e.line}};return this.showBackground&&(t.fill.color=this.applyBackgroundOpacity(t.line.color)),t}getFlipAnchorIndices(){return 2===this.points.length?[0,1]:null}}class mi extends mt{_factors;constructor(e,t){super(e,t)}get factorsPropName(){return tG.AT_FACTORS}get factors(){return i0(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[tG.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[tG.AT_LEVELS_KIND]}get labels(){return this.traits[tG.AT_LABELS]}get isExtended(){return 3===this.points.length}isBefore(e,t){return this.points[e].time<this.points[t].time}comparePoints(e,t,i){let s=this.isBefore(e,t);return i||(s=!s),this.points[s?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[tG.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){let i=this.levelsKind===tG.AT_LEVELS_PERCENTS,s="";if(this.showLevels&&(s=i?`${(100*e).toFixed(1)}%`:e.toString()),this.showPrices){let e=this.priceMap(this.axis.toPrice(t));s=(s+` (${hy(this.axis,e)})`).trim()}return s}getAdornPointAndAlign(e,t){let i=this.labels,s=e instanceof f9,r=(e,t,i)=>({pt:e,align:t,offset:i});switch(i){case tG.AT_LABELS_LEFT:return r(s?e.anchor1:e,J.Right,-t);default:case tG.AT_LABELS_RIGHT:return r(s?e.anchor2:e,J.Left,t);case tG.AT_LABELS_CENTER:return r(s?im(e.anchor1,e.anchor2):e,J.Center,0)}}getColoredElements(e){let t=this.singleStyle;return this.factors.map(i=>{let s=e(i);return null===s?null:(t||(s.style=i7(this.getTraitsFor(i))),s._data={factor:i.value},s)}).filter(e=>null!==e)}hitTestAdornments(e,t){let i=this.showLevels,s=this.getTextRef();if(!i||null===s)return!1;let r=this.axis.pane.presenter,n=r.view?.mainContext;if(!n)return!1;let a=null,o=!1;n.save();let{chart:{fontFamily:l},yAxis:{fontSize:u}}=r.display;for(let i of(n.font=`${u??12}px ${l}`,e)){if(!eH(i._data))continue;let{factor:e}=i._data,{ref:r,spacing:l,offsetY:u,text:h}=s(a,i,e),{pt:c,align:d,offset:p}=this.getAdornPointAndAlign(r,l),f=this.getAdornTextPoint(n,u,c,p);if(iB(n,h,f,d).contains(t)){o=!0;break}a=i}return n.restore(),o}adornElementsForColoredFactors(e,t,i,s){let r=this.singleStyle,n=this.showBackground,a=this.showLevels,o=this.applyBackgroundOpacity(this.traits.line.color),l=s.fillStyle,u=null;e.forEach(e=>{if(!eH(e._data))return;let{factor:h}=e._data;if(n){let i=t(u,e);s.fillStyle=r?o:e.style.fillStyle,s.fill(i)}if(a){let{ref:t,spacing:n,offsetY:a,text:o}=i(u,e,h),{pt:c,align:d,offset:p}=this.getAdornPointAndAlign(t,n),f=this.getAdornTextPoint(s,a,c,p);iU(s,o,f,d,r?l:e.style.strokeStyle)}u=e})}getAdornTextPoint(e,t,i,s){let r=iH(e,.75);return iT(i,{x:s,y:!0===t?r/2:t})}}class ms extends mt{lines;constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(tG.AT_FILL)}get rect(){let[e,t,,]=this.getScreenPoints(),i=new me({x:e.x,y:Math.min(e.y,t.y)},t.x-e.x,Math.abs(e.y-t.y),this.axis);return i.style=this.rectStyle,i}get reverse(){return!1}getLinesDataAtLevels(e,t){let[i,s]=this.points;if(this.reverse&&([i,s]=[s,i]),null==this.lines){let r=(e,t=!1)=>i=>({level:i.value,domain:e(i.value),traits:this.getTraitsFor(i),isPrice:t}),n=s.price-i.price,a=r(e=>i.price+e*n,!0),o=e?.map(a)??[],l=this.axis.pane.presenter.timeline,u=e_(l,+i.time,Number,hP),h=e_(l,+s.time,Number,hP)-u,c=r(e=>+l.at(u+Math.floor(e*h))),d=t?.map(c)||[];this.lines={prices:o,times:d,barsDiff:h,priceDiff:n}}return this.lines}makeColoredLine(e,t,i){let s=this.makeLine(e,t);return this.singleStyle||(s.style=i7(i.traits)),s._data={level:i.level,isPrice:i.isPrice},s}getLineElements(e){let[t,i]=this.getScreenPoints();return{priceLines:e.prices.map(e=>{let s=this.axis.toY(e.domain);return this.makeColoredLine({x:t.x,y:s},{x:i.x,y:s},e)}),timeLines:e.times.map(e=>{let s=this.presenter.view.toX(e.domain);return this.makeColoredLine({x:s,y:t.y},{x:s,y:i.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()}}class mr extends f3{priceRef;timeRef;constructor(e,t,i){super(e),this.priceRef=t,this.timeRef=i,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}}class mn{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 eH(this.points[0].point,this.points[1].point)?new iD(this.left,this.top,this.width,this.height):null}}function ma(e){let t=new f3(e),i=new f3(e),s=new mr(e,t,i),r=new mr(e,i,t);return[t,i,s,r]}class mo extends f7{helper;constructor(e,t){super(e,t),this.points=ma(e),this.helper=new mn(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.prepareDraw(e,t)&&(i6(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&2===e.length&&e.forEach((e,t)=>this.points[t].update(e.price,e.time))}}class ml{points;lines;axis;helper;_actualWidth;_fontSizeForWidth;constructor(e,t,i){this.points=e,this.lines=t,this.axis=i,this._actualWidth=0,this._fontSizeForWidth=0,this.helper=new mn(this.points)}hitTest(e){let t=this.getRect();return!!eV(t)&&(t.width=this._actualWidth,t.contains(e))}getRect(){return this.helper.getRect()}get fontSize(){if(0===this.lines.length)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(0===this.lines.length)return;e.save();let{x:t,y:i}=this.getRect(),{chart:{fontFamily:s}}=this.axis.pane.presenter.display,r=this.fontSize;e.textAlign="left",e.textBaseline="top",e.font=`${r}px ${s}`,this.lines.forEach((s,n)=>{let a=r*n;e.fillText(s,t,i+a)}),this.computeActualWidth(e),e.restore()}}class mu extends mt{textEditable;_textAnnElement;constructor(e,t){super(e,t),this.textEditable=!0,this.points=ma(e),this.adjustFill=!0}get textLines(){return this.traits[tG.AT_TEXT_LINES]}set textLines(e){this.traits[tG.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!eH(this._textAnnElement)&&this.visible&&(this._textAnnElement=new ml(this.points,this.textLines,this.axis)),this._textAnnElement}updateFrom(e,t,i,s,r){super.updateFrom(e,t,i,s,r),this._textAnnElement=void 0}getElements(){return this.visible?[this.textElement]:[]}}class mh extends mu{constructor(e,t){super(e,t),this.textEditable=!1}canMove(e){return!!this.visible&&this.textElement.hitTest(e)}get prices(){return this.traits.prices}get pricesPoints(){let e=this.points[0].time;return this.prices.map(t=>new f3(this.axis,t,e))}updateFrom(e,t,i,s,r){super.updateFrom(e,t,i,s,r),eH(e?.textLines)&&(this.textLines=e.textLines)}getElements(){let e=super.getElements(),t=this.pricesPoints.map(e=>new f2(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,i]=this.defaultFont;e.save(),e.font=`${t}px ${i}`;let s=Math.max(...this.textLines.map(t=>e.measureText(t).width)),{x:r,y:n}=this.points[0].point;this.points[1].updateFromPoint({x:r+s,y:n+this.textLines.length*t}),e.restore()}}class mc{annId;annotation;constructor(e){this.annId=e}onKeyDown(e){if(null==this.annId)return;let{key:t,code:i,presenter:s}=e;eD(t,i)&&(eH(this.annotation)&&(this.annotation.axis.deleteAnnotation(this.annotation,!1),s.view.redraw()),gE(s,{toolChange:eo.Cancelled,annId:this.annId}))}}class md extends mc{factory;thirdPoint;dragged;snapToSupported;isDrawingAnnotation;forceAlignPoints;indices;alignPointsMode;constructor(e,t=!1){super(e.annName),this.factory=e,this.thirdPoint=t,this.dragged=!1,this.snapToSupported=!0,this.isDrawingAnnotation=!0,this.forceAlignPoints=!1,this.alignPointsMode=!1,this.indices=t?[0,1,2]:[0,1]}signalChange(){this.annotation.wasModifiedByTool(),this.annotation.requestRedraw()}onMouseDown(e){let{point:t,button:i}=e;if(void 0===t)return;let s=eV(this.annotation);if(i===ee.Left)if(s){let e=!this.thirdPoint||this.dragged?1:2;this.annotation.points[e].update(t.price,t.time),this.dragged=!1,this.signalChange(),this.thirdPoint&&2!==e||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:i,offset:s}=e;return i.drawCrosshair({ap:t,offset:s}),eH(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(et.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(){g_(this.annotation,!0,eo.Created)}isAccidentalMouseUp(e){let{point:t}=e,i=this.annotation.points[0].point;return ig(t.point,i)<tG.HIT_TEST_TOLERANCE}onMouseUp(e){if(void 0===this.annotation)return void gL(e);if(this.isAccidentalMouseUp(e)){this.dragged=!0;return}this.dragged=!1,this.thirdPoint||this.finish()}}class mp extends md{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}}class mf extends md{constructor(e){super(e,!1),this.snapToSupported=!1}onMouseMove(e){let{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),eH(this.annotation)&&this.dragged){let[e,i]=this.annotation.points;i.update(t.price,t.time);let s=iy(i.point,e.point),r=e.point.y+s.x*Math.sign(s.y)*Math.sign(s.x),n=this.annotation.axis.toPrice(r);i.update(n,t.time),this.signalChange()}return!0}}class mm extends mc{factory;existing;isNew;anchor;clicks;snapToSupported;isDrawingAnnotation;textArea;constructor(e,t){super(e?e.annName:null),this.factory=e,this.existing=t,this.clicks=0,this.snapToSupported=!1,this.isNew=!eH(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:f4(i5(this.anchor.axis.pane.presenter.display,"Text"))};{let e=this.existing.textElement;return{height:1.05*e.getRect().height,fontSize:`${Math.round(e.fontSize)}px`,color:this.existing.traits[tG.AT_FILL].color}}}onMouseDown(e){let{point:t}=e;if(this.isNew)if(0===this.clicks){if(void 0===t)return void gL(e);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,i=this.anchor.axis.pane.getBounds(),s=i.x+i.width-this.anchor.point.x,{height:r,fontSize:n,color:a}=this.styleProps();tR(this.textArea,{position:"absolute",top:`${t}px`,left:`${e}px`,border:"none",outline:"none",overflow:"hidden",height:`${r}px`,width:`${s}px`,resize:"none",backgroundColor:"rgba(255, 255, 255, 0.05)",zIndex:"5",fontSize:n,color:a}),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("\n"),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,i=this.textArea.value.split("\n");if(this.isNew){let{actualWidth:s,actualHeight:r}=this.getTextDimensions(i);t.points[0].update(e.price,e.time);let{x:n,y:a}=t.points[0].point;t.points[1].updateFromPoint({x:n+s,y:a+r}),t.drawn=!1}t.textLines=i,this.textArea.onblur=null,this.getChartParent().removeChild(this.textArea),t.requestRedraw(),this.isNew||t.requestRedraw(),g_(t,!0,this.isNew?eo.Created:eo.TextChanged)}getTextDimensions(e){let t=globalThis.getComputedStyle(this.textArea).getPropertyValue("font-size"),i=parseFloat(t)*e.length,s=0,r=this.anchor.axis.pane.presenter,n=r.view.mainContext;n.save();let{chart:{fontFamily:a}}=r.display;n.font=`${t} ${a}`;for(let t=0;t<e.length;t++){let i=n.measureText(e[t]).width;i>s&&(s=i)}return n.restore(),{actualWidth:s,actualHeight:i}}}function mg(e){return y0().config.tooltipMovement===e}function my(){return mg("Draggable")}let mT=tG.TOOLTIP_STD_LEGACY_CLASS,mA=tG.TOOLTIP_STD_CLASS,mS=tG.TOOLTIP_BUBBLE_CLASS;class mv{view;tooltipElem;leftSide;mode;isDrag;canDrag;isToggling;constructor(e){this.view=e,this.isDrag=!1,this.tooltipElem=tF(e.el,"div"),tN(this.tooltipElem,{id:`${e.presenter.elementId}-global-tooltip`,class:`${mA} ${mT}`}),this.leftSide=!0,tR(this.tooltipElem,{visibility:"hidden",position:"absolute",cursor:my()?"move":"default",zIndex:20,top:`${tG.TOOLTIP_Y_OFFSET}px`,left:`${tG.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===tG.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition="none",this.tooltipElem.classList.remove(mA,mT),this.tooltipElem.classList.add(mS),tR(this.tooltipElem,{pointerEvents:"none"});else if(e===tG.TOOLTIP_STD){this.canDrag=my(),this.tooltipElem.classList.remove(mS),this.tooltipElem.classList.add(mA,mT);let e=tG.TOOLTIP_TOGGLE_SIDE_ANIM_MS;tR(this.tooltipElem,{pointerEvents:"all",top:`${tG.TOOLTIP_Y_OFFSET}px`,left:`${tG.TOOLTIP_X_OFFSET}px`,transition:mg("Auto")?`left ${e}ms ease-out`:null})}}}show(e,t){let i=this.tooltipElem;if(t){let{width:e,height:s,leftOffset:r,rightOffset:n}=this.view,a=i.getBoundingClientRect(),o=a.width/2,l=i.style,u=s*tG.TOOLTIP_BUBBLE_OFFSET,h=t.yMin-a.height-u,c=t.x-o,d=t.yMax+u,p=d+a.height,f=c,m=e-n;f<r?f=r:f+a.width>m&&(f=m-a.width),l.top=`${h<0?p<s?d:0:h}px`,l.left=`${f}px`}"hidden"===i.style.visibility&&(i.style.visibility="visible"),tB(i,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),this.tooltipElem.remove()}reposition(e,t){tR(this.tooltipElem,{left:`${e}px`,top:`${t}px`})}isAutoMove(){return this.mode===tG.TOOLTIP_STD&&mg("Auto")}handleMouseMove(e){if(this.isDrag&&this.canDrag){let{movementX:t,movementY:i}=e,{top:s,left:r}=this.tooltipElem.style,n=parseInt(s)+i,a=parseInt(r)+t;this.reposition(a,n)}else if(this.isAutoMove()){let t=this.tooltipElem.getBoundingClientRect(),i=this.view.el.getBoundingClientRect(),s=e.pageX,r=tG.TOOLTIP_TOGGLE_DISTANCE_TOLERANCE,n=i.width>2*t.width,a=s>t.x&&s<=t.right+r,o=s<t.x&&s>=t.x-r;n&&(a||o)&&this.toggleSide()}}repositionAuto(){if(this.isAutoMove()){let e=this.view.presenter.mainPane.getBoundsWithoutScales(),t=this.tooltipElem.offsetY,i=e.x+(this.leftSide?tG.TOOLTIP_X_OFFSET:e.width-this.tooltipElem.offsetWidth-tG.TOOLTIP_X_OFFSET);this.reposition(i,t)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout(()=>this.isToggling=!1,tG.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}}function mb(e){e.showTooltip&&mP(e,{time:tG.ZERO_DATE,offset:tG.OFFSCREEN_OFFSET,price:0,lastBarRefresh:void 0,justMain:void 0})}function mP(e,{time:t,lastBarRefresh:i,justMain:s,offset:r,price:n}){let a=hV(e,t,r,i,s,n),{mode:o,showMainPlot:l,hideSymbols:u,revealingClose:h}=e.display.tooltip,{includeTimestamp:c,showMainPlot:d,showPlotActions:p}=y0().config.tooltipHeaders||{},f=eH(d)?d:l,m=!!eH(c)&&c,g=!!eH(u)&&u,y=!!eH(h)&&h,T=!!eH(p)&&p,A=t.valueOf()===tG.ZERO_DATE.valueOf();switch(o){case tG.TOOLTIP_CARDS:s||mE(e,a,f,!A,m&&!A,!1,g,y,T,e.hasLegend?e.view?.legend?.getLegendElem().clientHeight:0);break;case tG.TOOLTIP_BUBBLE:if(!A){let t=a.panes.find(e=>{let{top:t,left:i,width:s,height:n}=e.bounds;return new iD(i,t,s,n).contains(r)}),i=t.plots.find(e=>e.isMain)||t.plots[0],s=i.values.find(e=>["Close","Last"].includes(e.id)),n=s?s.y:i.values[0].y,o=t.plots.map(e=>e.values.filter(e=>"Change"!==e.id&&e.y>0).map(e=>e.y)).flat(),l=hL({...a,hideSymbols:g,revealingClose:y,plots:t.plots}),u=`<div class="bubble-box">${l}</div>`;e.view.tooltip.show(u,{x:r.x,y:n,yMin:Math.min(...o),yMax:Math.max(...o)})}mE(e,a,f,!1,!1,e.hasLegend,g,y,T);break;case tG.TOOLTIP_STD:if(!A){let t=hL({...a,hideSymbols:g,revealingClose:y,plots:a.panes.map(e=>e.plots).flat()});e.view.tooltip.show(t)}mE(e,a,f,!1,!1,e.hasLegend,g,y,T);break;case tG.TOOLTIP_EXTERNAL:e.notifyHost(ao.CH_TOOLTIPCHANGED,a);break;default:console.warn(`Unknown tooltip mode requested: ${o}`)}}function mC(e,t,i,s,r,n){tR(e,{position:"absolute",display:"flex","flex-direction":t,"flex-wrap":"wrap",left:`${i+tG.CARDS_X_OFFSET}px`,top:`${r+tG.CARDS_Y_OFFSET}px`,maxWidth:`${n-s-2*tG.CARDS_X_OFFSET}px`})}function mE(e,t,i=!1,s=!1,r=!1,n=!1,a=!1,o=!1,l=!1,u=0){let h=e.view.el,c=function(e,{panes:t,date:i,time:s,isMultiSymbol:r},n=!1,a=!1,o=!1,l=!1,u=!1,h=!1){return t.map((c,d)=>{let p=n?c.plots:c.plots.filter(e=>!e.isMain),f=e.mainPlot.axis.pane.id===c.id,m=o&&f?`<span class="field-name" style="padding-right:5px">${i} ${s||""}</span>`:"",g=p.map(t=>(function(e,t,i,s,r,n,a,o){let{id:l,name:u,type:h,error:c,description:d,values:p,events:f,isMain:m}=e,g=o.display.tooltip,y=c||d,T=`value-title${m?" value-main":""}`,A=X[h],S=!(["Study","BalanceSheet","IncomeStatement"].includes(A)||"Expression"===A&&!i)||o.hasLegend&&i?"":hN(l),v=function(e,t){let i=hO(t?"eye":"eyeSlash"),s=t?"Hide":"Show",r=`${s} plot`;return`<a class="show-hide-plot" data-plot-id="${e}" data-act="${s}" title="${r}">${i}</a>`}(l,e.visible),b=a?function(e){let t=hO("moreActions");return`<a class="more-actions" data-plot-id="${e}" data-act="Menu" title="Actions">${t}</a>`}(l):"",P=h_(o)&&e.type===X.Symbol,C=(m||P)&&(!s||e.values.length>1),E=t?p.map(e=>hR(C?e.abbreviation:"Close"===e.id&&n?d+" ":null,e.value,e.color)).join(" ")+function(e){if(e&&e.length){let t=e.map(e=>hR(`${e.field.name} (${hv(hM,e.date)})`,e.value,e.color)).join(" ");return`Event ${t}`}return""}(f):"",_=!m&&"Expression"!==A,M=p.slice(0,_?p.length:1).map(e=>`<div class="box" style="background-color:${e.color}"></div>`).join(""),L="Name"===g.mainTitle?u:d,x=r?e.visible&&t?"":`${d}`:`${L}`,O=s&&P?`${d} (${x})`:x;g.showMainTitle||(O="");let I=e.isMain?(()=>{let e=o.data?.aggregation.toShortString(),t=o.data?.aggregation.describe();return`<span class="value-main" title="${t}">&centerdot;${e}&centerdot;</span>`})():"";return`
13
13
  <div class="plot">
14
14
  ${S} ${v} ${b} ${t?"":M}
15
15
  <a class="${T}" ${y?`title="${y}" `:""}data-plot-id="${l}">${O}</a>
16
16
  ${I} ${E}
17
17
  </div>
18
- `.trim()})(t,a,f,r,l,u,h,e)),y=`${m}${g.join("")}`,T=function(e,t){let i=e>0,s=e<t-1;return`${i?hO(!0,e):""} ${s?hO(!1,e):""}`.trim()}(d,t.length);return{id:`bc-tip-${c.id.substring(0,8)}`,isMainPane:f,content:y,moveContent:T,bounds:c.bounds}})}(e,t,i,s,r,a,o,l);c.some(e=>!eH(e.bounds))||c.forEach(({id:t,isMainPane:i,content:s,moveContent:r,bounds:{left:a,right:o,top:l,width:c}},d)=>{if(""!==s&&(!n||!i)){let r=tV(t,h,"div");mP(r,i&&hE(e)?"column":"row",a,o,l+u,c),tH(r,{"bcharts-card":!0,"bcharts-card-main":i,"bcharts-card-first":0===d}),r.innerHTML=s}let p=tw(`#right-${t}`,h);eH(p)||((p=document.createElement("div")).id=`right-${t}`,h.appendChild(p),tH(p,"bcharts-card bcharts-card-move")),tR(p,{position:"absolute",display:"block",right:`${o+tG.CARDS_X_OFFSET}px`,top:`${l+u+tG.CARDS_Y_OFFSET}px`}),p.innerHTML=r})}let mE=null;function m_(){return null===mE&&(mE=yQ().config.hostingModel===ea[ea.Application]),mE}class mM extends fZ{ap;presenter;panY;snapToSupported;warmUp;preventDefault;lastOffset;lastPanningExtremes;constructor(e){super(),this.ap=e,this.snapToSupported=!1,this.warmUp=!0,this.preventDefault=!1,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)return void this.presenter.resetActiveTool();let{point:t,view:i,offset:s}=e;if(t&&t.axis!==this.ap.axis)return;let{x:r,y:n}=s,a=r-this.lastOffset.x,o=Math.abs(a),l=this.lastOffset.y,u=Math.abs(n-l);o>=1&&this.cancelLongPress();let h=m_();if(eI()&&!h&&this.warmUp)return(o>7||u>7)&&(this.warmUp=!1,this.preventDefault=o>u),!1;if(this.preventDefault||!eI()||h){if(i.xAxis.pan(a),this.panY&&t&&t.axis){u>=1&&this.cancelLongPress();let e=function(e,t,i,s){let r=(i-t)/e.viewBox.height,[n,a]=s,o=r*(a-n);return[n+o,a+o]}(t.axis,l,n,this.lastPanningExtremes);this.lastPanningExtremes=e,t.axis.yScale.domain(e)}this.lastOffset=s,i.redraw(),t&&t.presenter.view.setCursor(Q.Grabbing)}return h||this.preventDefault}finished(){gC(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:e,offset:t,originalEvent:i}){eI()&&mR(e,t,i)}performLongPress(e,t,i){e.enableTooltip(!0),e.resetActiveTool(),e.activeTool.startTouchCrosshairMode(e,t,i)}}let mL=null;class mx extends ma{constructor(e,t){super(e,t)}hitTest(e){if(!this.visible)return!1;let t=this.getRect();return null!==t&&t.contains(e)}draw(e,t){return!!super.draw(e,t)&&(iW(e,this.getRect()),!0)}}function mO(e,t){return e<t?[e,t]:[t,e]}let mI={line:{width:1,color:"rgba(127, 127, 127, 0.3)",dashStyle:"LongDash"},fill:{color:"rgba(127, 127, 127, 0.1)"}};class mD extends mc{snapToSupported=!1;preventDefault=!1;axis;presenter;constructor(){super(f7("Rectangle",mx,null,mI),!1)}activated(){}deactivated(){eH(this.axis,this.annotation)&&this.axis.deleteAnnotation(this.annotation,!1)}onMouseDown(e){let t=super.onMouseDown(e);if(!0===t){let{point:t}=e;this.axis=t.axis,this.presenter=t.presenter}return t}finish(){if(eH(this.axis,this.presenter)){gC(this.presenter,{toolChange:eo.Executed,annId:"ZoomIn"});let e=this.annotation.points,t=mO(e[0].price,e[1].price),i=mO(e[0].time,e[1].time),s=(e,t)=>Math.abs(t(e[0])-t(e[1])),r=s(i,e=>this.axis.toX(e)),n=s(t,e=>this.axis.toY(e)),a=this.presenter.view,o=tG.MINIMUM_ZOOM_DIMENSION;if(r>o&&n>o){let e=a.xAxis.xScale;this.axis.isCustomDomain=!0,this.axis.yScale.domain(t),e.wasZoomed=!0,e.scaleBarToFitRange(i,!1),e.domain(i)}a.redraw()}}}function mw(e,t){let i=f5(e);i.offset={x:t.x,y:t.y},i.canFlip=null!==e.getFlipAnchorIndices();let s=e.axis.pane.presenter;s.clearSelection(),s.notifyHost(aa.CH_ANNNEEDSCONTEXTMENU,i)}function mR(e,t,i){let s={offset:{x:t.x,y:t.y},chart:e.accessor,originalEvent:i};e.notifyHost(aa.CH_CHTNEEDSCONTEXTMENU,s)}class mN extends mh{factory;maxClicks;clicks;snapToSupported;isDrawingAnnotation;constructor(e,t){super(e.annName),this.factory=e,this.maxClicks=t,this.clicks=0,this.snapToSupported=!0,this.isDrawingAnnotation=!0}onMouseMove(e){let{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){let{point:t,view:i}=e;if(0===this.clicks){if(void 0===t)return gM(e),!1;t.axis.pane.presenter.clearSelection(),this.annotation=this.factory(t.axis)}this.applyToPoints(t),this.clicks++,this.clicks===this.maxClicks&&void 0!==this.annotation?(this.annotation.drawn=!1,this.annotation.requestRedraw(),"function"==typeof this.annotation.updateOtherPoints&&this.annotation.updateOtherPoints(i.mainContext),gE(this.annotation,!0,eo.Created)):this.annotation.requestRedraw()}applyToPoints(e){this.annotation.points[this.clicks].update(e.price,e.time)}}class mV{snapToSupported=!1;constructor(e,t){setTimeout(()=>this.finalize(e,t),10)}finalize(e,t){let i=e(t);t.pane.presenter.clearSelection(),i.drawn=!1,i.requestRedraw(),gE(i,!0,eo.None)}}let mH=tG.MARKER_ARROW_ANGLE*Math.PI/180/2;function mF(e,t,i=tG.MARKER_ARROW_LENGTH){return new mk(e,t,i)}class mk{vertex;arrowLen;p1;p2;constructor(e,t,i=tG.MARKER_ARROW_LENGTH){this.vertex=t,this.arrowLen=i,this.p1=e[0],this.p2=e[1]}hitTest(e){let{anchor:t,p1:i,p2:s}=this.getArrowPoints();return iS([t,i],e,tG.HIT_TEST_TOLERANCE)||iS([t,s],e,tG.HIT_TEST_TOLERANCE)}draw(e){let{anchor:t,p1:i,p2:s}=this.getArrowPoints();iG(e,t,i),iG(e,t,s)}getArrowPoints(){let e=iA(this.p1,this.p2),t="start"===this.vertex?0:Math.PI,i=e-mH+t,s=e+mH+t,r="start"===this.vertex?this.p1:this.p2,n=this.arrowLen*Math.cos(i)+r.x,a=this.arrowLen*Math.sin(i)+r.y,o=this.arrowLen*Math.cos(s)+r.x,l=this.arrowLen*Math.sin(s)+r.y;return{anchor:r,p1:{x:n,y:a},p2:{x:o,y:l}}}}class mB{hitTest(){return!1}draw(){}}class mU extends me{constructor(e,t){super(e,t),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[tG.AT_EXTEND_PT_1]}get extend2(){return this.traits[tG.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[tG.AT_SHOW_PERCENTDIFF]}get showBarCount(){return this.traits[tG.AT_SHOW_BARCOUNT]}get showRatio(){return this.traits[tG.AT_RATIO]}getElements(){let e=this.points[0].point,t=this.points[1].point,i=new f8(e,t,this.extend1,this.extend2,this.axis),s=[];return this.extend1&&s.push(new f8(i.p1,e,!0,!1,this.axis)),s.push(new f8(e,t,!1,!1,this.axis)),this.extend2&&s.push(new f8(t,i.p2,!1,!0,this.axis)),s}formatRatio(e,t){return` (${eF(e/t,3)})`}formatPercDiff(e,t){let i=(t-e)/e*100,s=i>0?"+":"";return` (${s}${eF(i,2)}%)`}formatPrice(e){return hg(this.axis,this.priceMap(e))}adornElements(e,t){if(!this.showBarCount&&!this.showPrices&&!this.showPercentDiff&&!this.showRatio)return;let[i,s]=this.points,r=e[+!!this.extend1].getAdornOffset(t);if(this.showBarCount){let e=iT(im(i.point,s.point),r);iU(t,this.getBarCount(i.time,s.time).toFixed(0),e,J.Right)}let n=this.showRatio?this.formatRatio(i.price,s.price):"",a=this.showPrices?this.formatPrice(i.price):"",o=`${a}${n}`.trim();""!==o&&iU(t,o,iT(i.point,r),J.Right);let l=this.showPercentDiff?this.formatPercDiff(i.price,s.price):"",u=this.showPrices?this.formatPrice(s.price):"",h=`${u}${l}`.trim();""!==h&&iU(t,h,iT(s.point,r),J.Right)}getMarkers(){let e=this.marker;if(!e||"none"===e.vertex)return[];let{vertex:t,kind:i}=e;return("both"===t?["start","end"]:[t]).map(e=>{if("arrow"===i){var t;return t=this.points,mF(t.map(e=>e.point),e)}return console.warn(`There is no marker of ${i} kind`),new mB})}}class mW extends me{constructor(e,t){super(e,t),this.addPoints(1)}get showTimestamps(){return this.traits[tG.AT_SHOW_TIMESTAMPS]}getElements(){return[new f1(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}}class m$ extends me{constructor(e,t){super(e,t),this.addPoints(1)}getElements(){return[new f1(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}}class mG extends me{constructor(e,t,i){super(e,t),this.addPoints(2),eH(i)&&eH(i.points)&&i.points.forEach((e,t)=>this.points[t].update(e.price,e.time))}allPoints(){let[e,t]=this.points;return eH(e,e.point,t,t.point)?[e,this.axis.toAnnotationPoint(im(e.point,t.point)),t]:tG.EMPTY_ARRAY}line2(){return this.traits[tG.AT_LINE_2]}use52WeekPrices(){return this.traits[tG.AT_USE_52WEEK_PRICES]}getElements(){let e=this.allPoints();return e===tG.EMPTY_ARRAY?tG.EMPTY_ARRAY:e.map(e=>new f8({x:-tG.OUT_OF_SCREEN,y:e.point.y},{x:tG.OUT_OF_SCREEN,y:e.point.y},!1,!1,this.axis))}wasPointMovedByTool(e,t){eH(this.use52WeekPrices())&&(this.traits[tG.AT_USE_52WEEK_PRICES]=!1)}getStyleForElement(e,t){let i=this.line2();if(1!==t||!eH(i))return super.getStyleForElement(e,t);let s=eG(this.traits);return s.line=i,i7(s)}getPriceScaleAdornments(){let e=this.allPoints();if(!this.showPrices||e===tG.EMPTY_ARRAY)return super.getPriceScaleAdornments();let t=this.traits.line,i=e.map(e=>({price:e.price,color:t.color})),s=this.line2();return eH(s)&&(i[1].color=s.color),i}getFlipAnchorIndices(){return null}}class mz extends mt{helper;constructor(e,t,i){super(e,t),this.addPoints(i),this.helper=new f2(e)}get showTrendLine(){return this.traits[tG.AT_SHOW_TRENDLINE]}get hasAllPoints(){return eH(...this.points.map(e=>e.point))}get line2(){return this.traits[tG.AT_LINE_2]}get extendLeft(){return this.traits[tG.AT_EXTEND_LEFT]}get extendRight(){return this.traits[tG.AT_EXTEND_RIGHT]}get reverse(){return this.traits[tG.AT_REVERSE]}get levelsRespectLogScale(){return this.traits[tG.AT_LEVELS_RESPECT_LOG_SCALE]}getStyleForElement(e,t){if(e.isTrend){let e=eG(this.traits);return e.line=this.line2,i7(e)}return super.getStyleForElement(e,t)}getKeyPoints(){let e=e=>e.map(e=>this.points[e]);return e(this.isExtended?this.reverse?[1,0,2]:[0,1,2]:this.reverse?[0,1,0]:[1,0,1])}getElements(){if(!this.hasAllPoints)return[];let[e,t,i]=this.getKeyPoints(),s=t.price-e.price,r=t.price/e.price,n=this.extendLeft,a=this.extendRight,o=this.leftPoint,l=this.rightPoint,u=(e,t,i=!1)=>{let s=new f8(e,t,!i&&n,!i&&a,this.axis);return s.isTrend=i,s},h=this.levelsRespectLogScale&&this.axis.scale===q.Logarithmic,c=({value:e})=>{let t=i.price+s*e,n=i.price*Math.pow(r,e);this.helper.update(h?n:t,i.time);let a=this.helper.point.y;return u({x:o.x,y:a},{x:l.x,y:a})},d=this.getColoredElements(c);return this.showTrendLine&&(d.push(u(e.point,t.point,!0)),this.isExtended&&d.push(u((this.reverse?e:t).point,i.point,!0))),d}getAdornPointAndAlign(e,t){let i=this.labels,s=(e,t,i)=>({pt:e,align:t,offset:i}),r=this.axis.pane.getBoundsWithoutScales();switch(i){case tG.AT_LABELS_LEFT:return this.extendLeft?s({x:r.x,y:e.anchor1.y},J.Left,t):super.getAdornPointAndAlign(e,t);default:case tG.AT_LABELS_RIGHT:return this.extendRight?s({x:r.x+r.width,y:e.anchor2.y},J.Right,-t):super.getAdornPointAndAlign(e,t);case tG.AT_LABELS_CENTER:return super.getAdornPointAndAlign(e,t)}}getTextRef(){return(e,t,i)=>{let s=this.formatLevelPrice(i,t.anchor1.y);return{ref:t,spacing:5,offsetY:-5,text:s}}}adornElements(e,t){this.adornElementsForColoredFactors(e,(e,t)=>{let i=new Path2D;return null===e||(iR(i,e.p1),i.lineTo(t.p2.x,e.p1.y),iN(i,t.p2),i.lineTo(e.p1.x,t.p2.y)),i},this.getTextRef(),t)}getPriceScaleAdornments(){if(!this.pricesOnScale)return super.getPriceScaleAdornments();let e=this.getElements();if(0===e.length)return super.getPriceScaleAdornments();let t=this.traits.line.color;return this.factors.map((i,s)=>{let r=e[s++].p1,n=this.singleStyle?t:i.line.color;return{price:this.axis.toPrice(r.y),color:n}})}}class mY extends mz{constructor(e,t){super(e,t,2)}}class mj extends mz{constructor(e,t){super(e,t,3)}}let mK=(e,t)=>{let i=new Path2D;return null===e||(iR(i,e.p1),iN(i,e.p2),iN(i,t.p2)),i};class mq extends mt{constructor(e,t){super(e,t),this.addPoints(2)}get reverse(){return this.traits[tG.AT_REVERSE]}getElements(){let[e,t]=this.getScreenPoints(),i=t.y-e.y,s=({value:s})=>{let r=this.reverse?e.y+s*i:t.y-s*i;return new f8(e,{x:t.x,y:r},!1,!0,this.axis)};return this.getColoredElements(s)}getTextRef(){let[e,t]=this.getScreenPoints(),i=t.y-e.y,[s,r]=[this.leftPoint,this.rightPoint];return(n,a,o)=>{let l=this.reverse?e.y+o*i:t.y-o*i;return{ref:new f8({x:s.x,y:l},{x:r.x,y:l},!1,!1,this.axis),spacing:5,offsetY:!0,text:o.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,mK,this.getTextRef(),t)}}class mX extends mq{constructor(e,t){super(e,t)}}class mZ{center;rim;radius;startAngle;endAngle;antiClockwise;axis;left;right;scale;clip;style;constructor(e,t,i,s,r,n,a){this.center=e,this.rim=t,this.radius=i,this.startAngle=s,this.endAngle=r,this.antiClockwise=n,this.axis=a,this.left=null,this.right=null,this.scale=null,this.clip=null,null!==t&&(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 null!==this.scale}get hasClip(){return null!==this.clip}get hasRim(){return null!==this.rim}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),i=this.axis.pane.presenter.view.mouseContext;i.save(),i.resetTransform(),this.applyScale(i);let s=i.getTransform().inverse();return i.restore(),s.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(ig(this.left,e),ig(this.right,e));else{let{x:i,y:s}=iy(this.hasScale?this.inverseScale(e):e,this.center);if(!this.hasRim){let{startAngle:e,endAngle:t,antiClockwise:r}=this,n=Math.PI/2;if(0===e&&t===n&&!r&&(i<0||s<0)||e===n&&t===Math.PI&&!r&&(i>0||s<0)||e===-n&&t===Math.PI&&r&&(i>0||s>0)||0===e&&t===-n&&r&&(i<0||s>0))return!1}t=Math.abs(Math.sqrt(i*i+s*s)-this.radius)}return t<=tG.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),i$(e,this.center,this.radius,this.startAngle,this.endAngle,this.isAntiClockwise??!1),e.restore()}}let mJ=(e,t)=>{let i=new Path2D,{center:s}=t;if(iR(i,s),i.arc(s.x,s.y,t.radius,t.startAngle,t.endAngle,t.isAntiClockwise??!1),null===e)return i;let r=new Path2D,{center:n}=e;return iR(r,n),r.arc(n.x,n.y,e.radius,e.endAngle,e.startAngle,!e.isAntiClockwise),i.addPath(r),i};class mQ extends mt{constructor(e,t){super(e,t),this.addPoints(2)}getElements(){let[e,t]=this.getScreenPoints();if(!eH(e,t))return[];let i=ig(e,t),s=iy(t,e),r=s.y/i,n=s.x/i,a=({value:t})=>{let s=i*t,a={x:e.x+n*s,y:e.y+r*s};var o=this.axis;let l=ig(e,a);return new mZ(e,a,l,0,Math.PI,null,o)},o=this.getColoredElements(a);if(this.showTrendLine){let i=new f8(e,t,!1,!1,this.axis);i.isTrend=!0,o.unshift(i)}return o}get showTrendLine(){return!0}getTextRef(){return(e,t,i)=>{let{center:s}=t,r=t.isAntiClockwise?-1:1;return{ref:{x:s.x,y:s.y+r*t.radius},spacing:0,offsetY:!0,text:i.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,mJ,this.getTextRef(),t)}}class m0 extends mQ{constructor(e,t){super(e,t)}getStyleForElement(e,t){if(e.isTrend){let e=eG(this.traits);return e.line=this.line2,i7(e)}return super.getStyleForElement(e,t)}get showTrendLine(){return this.traits[tG.AT_SHOW_TRENDLINE]}get line2(){return this.traits[tG.AT_LINE_2]}}class m1 extends mt{constructor(e,t){super(e,t),this.addPoints(2)}get factorsPropName(){return tG.AT_ANGLES}getElements(){let[e,t]=this.getScreenPoints(),{x:i,y:s}=iy(t,e),r=({value:r})=>{let n=(t,i)=>new f8(e,{x:t,y:i},!1,!0,this.axis),a="1"!==r.charAt(0),o=Number(a?r.charAt(0):r.charAt(2));return a?n(t.x,e.y+s/o):n(e.x+i/o,t.y)};return this.getColoredElements(r)}getTextRef(){return(e,t,i)=>({ref:t.anchor2,spacing:0,offsetY:!0,text:i.toString()})}adornElements(e,t){this.adornElementsForColoredFactors(e,mK,this.getTextRef(),t)}}class m2 extends mq{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 f8(e,t,!1,!1,this.axis)].concat(super.getElements())}}class m3 extends mQ{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}}class m4 extends me{constructor(e,t){super(e,t),this.addPoints(3)}getElements(){let e=this.points[0].point,t=this.points[1].point,i=this.points[2].point,s=(t.x+i.x)/2-e.x,r=(t.y+i.y)/2-e.y,n=[];return n.push(new f8(t,{x:t.x+s,y:t.y+r},!1,!0,this.axis)),n.push(new f8(e,{x:e.x+s,y:e.y+r},!1,!0,this.axis)),n.push(new f8(i,{x:i.x+s,y:i.y+r},!1,!0,this.axis)),n.push(new f8(t,i,!1,!1,this.axis)),n}}class m5 extends ma{constructor(e,t){super(e,t)}getEllipse(){let e=this.getRect();return null===e?null:new iw(e.centerX,e.centerY,e.width/2,e.height/2)}hitTest(e){if(!this.visible)return!1;let t=this.getEllipse();return null!==t&&t.contains(e)}draw(e,t){var i;return!!super.draw(e,t)&&(i=this.getEllipse(),e.beginPath(),e.ellipse(i.cx,i.cy,i.radiusX,i.radiusY,0,0,2*Math.PI),e.stroke(),e.fill(),!0)}}class m6 extends me{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[tG.AT_EXTEND_PT_1]}get extend2(){return this.traits[tG.AT_EXTEND_PT_2]}getLastPoint(){let[e,t,i]=this.points;var s=ig(e.point,t.point),r=iA(e.point,t.point);return{x:i.point.x+s*Math.cos(r),y:i.point.y+s*Math.sin(r)}}getElements(){let[e,t,i]=this.points;var s=[];if(s.push(new f8(e.point,t.point,this.extend1,this.extend2,this.axis)),eH(i?.price)){var r=this.getLastPoint();s.push(new f8(i.point,r,this.extend1,this.extend2,this.axis))}return s}}class m7 extends ma{kind;constructor(e,t,i){super(e,t),this.kind=i,this.adjustFill=!0}hitTest(e){if(!this.visible)return!1;let t=this.getRect();return null!==t&&t.contains(e)}get dimension(){let e="fish_hook"===this.kind?2:1;return tG.DEFAULT_SYMBOL_WIDTH_HEIGHT*e}updateOtherPoints(){this.points[1].price||this.setBottomRight()}setBottomRight(){let e=this.dimension,t=this.axis.pane.presenter.timeline,{price:i,time:s}=this.points[0],r=e_(t,s,Number,hb);if(-1!==r){let s=this.axis.pane.presenter.view.xAxis.xScale.bar.totalWidth,n=1;for(;(2*n+1)*s<e;)n++;this.points[0].update(i,t.at(r-n)),this.points[1].update(i,t.at(r+n));let a=iT(this.points[0].point,{x:0,y:-e/2}),o=iT(this.points[1].point,{x:0,y:e/2});this.points[0].updateFromPoint(a),this.points[1].updateFromPoint(o)}}draw(e,t){if(!super.draw(e,t))return!1;let i=this.getRect();switch(0===i.width&&(i.width=this.dimension),this.kind){case"zero":ij(e,i,"0");break;case"one":ij(e,i,"1");break;case"two":ij(e,i,"2");break;case"three":ij(e,i,"3");break;case"four":ij(e,i,"4");break;case"five":ij(e,i,"5");break;case"six":ij(e,i,"6");break;case"seven":ij(e,i,"7");break;case"eight":ij(e,i,"8");break;case"nine":ij(e,i,"9");break;case"question":ij(e,i,"?");break;case"fish_hook":var s=e,r=i;s.save(),s.translate(r.x,r.y);let n=Math.min(r.width,r.height)/560;s.scale(n,n),s.lineCap="butt",s.lineJoin="miter",s.miterLimit=4,s.save(),s.save(),s.miterLimit=10,s.beginPath(),s.moveTo(377.8,354.8),s.bezierCurveTo(377.8,354.8,401.8,517.8,290.6,507),s.bezierCurveTo(173.2,495.5,171.5,50.39,171.5,50.39),s.bezierCurveTo(171.5,50.39,191.7,252.59,212.3,351),s.bezierCurveTo(212.3,351,230.9,472.8,286.7,488.7),s.bezierCurveTo(350.4,507,369.5,452.7,377.8,354.79),s.closePath(),s.fill(),s.restore(),s.save(),s.miterLimit=10,s.beginPath(),s.moveTo(378.3,351.1),s.lineTo(341.1,446.6),s.lineTo(371.2,436.7),s.lineTo(378.3,351.1),s.closePath(),s.fill(),s.restore(),s.restore(),s.restore();break;case"arrow_up":var a=e,o=i;a.save();let{cx:l,cy:u,left:h,right:c,top:d,bottom:p,halfBaseSize:f}=iK(o);a.beginPath(),a.moveTo(c,u),a.lineTo(l,d),a.lineTo(h,u),a.lineTo(Math.floor(l-f),u),a.lineTo(Math.floor(l-f),p),a.lineTo(Math.floor(l+f),p),a.lineTo(Math.floor(l+f),u),a.closePath(),a.fill(),a.restore();break;case"arrow_down":var m=e,g=i;m.save();let{cx:y,cy:T,left:A,right:S,top:v,bottom:b,halfBaseSize:P}=iK(g);m.beginPath(),m.moveTo(S,T),m.lineTo(y,b),m.lineTo(A,T),m.lineTo(Math.floor(y-P),T),m.lineTo(Math.floor(y-P),v),m.lineTo(Math.floor(y+P),v),m.lineTo(Math.floor(y+P),T),m.closePath(),m.fill(),m.restore();break;case"arrow_right":var C=e,E=i;C.save();let{cx:_,cy:M,left:L,right:x,top:O,bottom:I,halfBaseSize:D}=iK(E);C.beginPath(),C.moveTo(_,O),C.lineTo(x,M),C.lineTo(_,I),C.lineTo(_,Math.floor(M+D)),C.lineTo(L,Math.floor(M+D)),C.lineTo(L,Math.floor(M-D)),C.lineTo(_,Math.floor(M-D)),C.closePath(),C.fill(),C.restore();break;case"arrow_left":var w=e,R=i;w.save();let{cx:N,cy:V,left:H,right:F,top:k,bottom:B,halfBaseSize:U}=iK(R);w.beginPath(),w.moveTo(N,k),w.lineTo(H,V),w.lineTo(N,B),w.lineTo(N,Math.floor(V+U)),w.lineTo(F,Math.floor(V+U)),w.lineTo(F,Math.floor(V-U)),w.lineTo(N,Math.floor(V-U)),w.closePath(),w.fill(),w.restore();break;case"arrow_horizontal":var W=e,$=i;W.save();let{cx:G,cy:z,left:Y,right:j,top:K,bottom:q,halfBaseSize:X}=iK($,1.5),Z=Math.floor(G-(G-Y)/3),J=Math.floor(G+(G-Y)/3);W.beginPath(),W.moveTo(Z,K),W.lineTo(Y,z),W.lineTo(Z,q),W.lineTo(Z,Math.floor(z+X)),W.lineTo(J,Math.floor(z+X)),W.lineTo(J,q),W.lineTo(j,z),W.lineTo(J,K),W.lineTo(J,Math.floor(z-X)),W.lineTo(Z,Math.floor(z-X)),W.lineTo(Z,K),W.closePath(),W.fill(),W.restore();break;case"arrow_vertical":var Q=e,ee=i;Q.save();let{cx:et,cy:ei,left:es,right:er,top:en,bottom:ea,halfBaseSize:eo}=iK(ee,2/3),el=Math.floor(ei-(ei-en)/3),eu=Math.floor(ei+(ei-en)/3);Q.beginPath(),Q.moveTo(er,el),Q.lineTo(et,en),Q.lineTo(es,el),Q.lineTo(Math.floor(et-eo),el),Q.lineTo(Math.floor(et-eo),eu),Q.lineTo(es,eu),Q.lineTo(et,ea),Q.lineTo(er,eu),Q.lineTo(Math.floor(et+eo),eu),Q.lineTo(Math.floor(et+eo),el),Q.lineTo(er,el),Q.closePath(),Q.fill(),Q.restore();break;case"arc_down":!function(e,t){let{cx:i,cy:s,left:r,right:n,deflection:a,arcWidth:o}=iq(t);e.save(),e.beginPath(),e.moveTo(n,s);let l=i+a,u=s+a,h=i-a,c=s+a;e.bezierCurveTo(l,u,h,c,r,s),e.lineTo(r,s+o),e.bezierCurveTo(h,c+o,l,u+o,n,s+o),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arc_up":!function(e,t){let{cx:i,cy:s,left:r,right:n,deflection:a,arcWidth:o}=iq(t);e.save(),e.beginPath(),e.moveTo(n,s);let l=i+a,u=s-a,h=i-a,c=s-a;e.bezierCurveTo(l,u,h,c,r,s),e.lineTo(r,s-o),e.bezierCurveTo(h,c-o,l,u-o,n,s-o),e.closePath(),e.fill(),e.restore()}(e,i);break;case"thumbs_up":var eh=e,ec=i;eh.save(),eh.translate(ec.x,ec.y),eh.lineWidth=.05;let ed=Math.min(ec.width,ec.height)/18;eh.scale(ed,ed),eh.lineCap="butt",eh.save(),eh.save(),eh.beginPath(),eh.moveTo(3.23,8.96),eh.lineTo(4.17,8.96),eh.bezierCurveTo(4.73,8.81,5.91,6.45,6.45,5.82),eh.bezierCurveTo(6.88,5.33,7.66,5.09,8.48,3.7),eh.bezierCurveTo(9.11,2.78,8.38,1.49,10.06,1.17),eh.bezierCurveTo(10.9,1.01,11.86,2.61,11.58,4.11),eh.bezierCurveTo(11.49,4.6,11.25,5.14,11.07,5.54),eh.bezierCurveTo(10.63,6.5,10.05,6.58,10.17,7.23),eh.bezierCurveTo(10.98,7.25,11.79,7.32,12.67,7.27),eh.bezierCurveTo(14.33,7.17,15.55,9.08,14.43,10.38),eh.bezierCurveTo(14.9,11.12,14.79,12.33,14.14,12.81),eh.bezierCurveTo(14.42,13.58,14.25,14.45,13.67,14.8),eh.bezierCurveTo(14.13,16.77,12.36,16.87,11.77,16.84),eh.lineTo(4.65,16.84),eh.bezierCurveTo(3.87,16.77,3.95,16.28,3.5,16.27),eh.bezierCurveTo(3.39,16.26,3.3,16.26,3.3,16.26),eh.bezierCurveTo(3.18,16.26,3.19,15.7,3.28,15.7),eh.bezierCurveTo(3.36,15.69,3.61,15.68,3.87,15.71),eh.bezierCurveTo(4.03,15.79,4.4,16.26,4.75,16.27),eh.lineTo(12.12,16.26),eh.bezierCurveTo(13.13,16.27,13.67,15.11,12.8,14.56),eh.bezierCurveTo(13.85,14.53,13.98,12.98,13.19,12.6),eh.bezierCurveTo(14.35,12.49,14.5,10.65,13.44,10.41),eh.bezierCurveTo(14.8,9.97,14.39,7.59,12.35,7.83),eh.bezierCurveTo(11.42,7.77,9.87,7.94,9.68,7.62),eh.bezierCurveTo(9.41,6.82,9.684,6.45,10.17,5.88),eh.bezierCurveTo(10.5,5.46,11.02,4.6,11.04,3.64),eh.bezierCurveTo(11.05,2.5,10.41,1.23,9.58,1.98),eh.bezierCurveTo(9.38,2.21,9.36,3.47,8.94,4.02),eh.bezierCurveTo(8.09,5.52,7.3,5.66,6.95,6.15),eh.bezierCurveTo(6.27,6.86,4.93,9.52,4.36,9.52),eh.bezierCurveTo(3.98,9.52,3.243,9.52,3.24,9.52),eh.bezierCurveTo(3.12,9.52,3.08,8.98,3.22,8.95),eh.closePath(),eh.fill(),eh.restore(),eh.restore(),eh.restore();break;case"thumbs_down":var ep=e,ef=i;ep.save(),ep.translate(ef.x,ef.y),ep.lineWidth=.05;let em=Math.min(ef.width,ef.height)/18;ep.scale(em,em),ep.lineCap="butt",ep.save(),ep.save(),ep.beginPath(),ep.moveTo(14.77,9.04),ep.lineTo(13.82,9.04),ep.bezierCurveTo(13.27,9.18,12.09,11.55,11.54,12.17),ep.bezierCurveTo(11.12,12.66,10.34,12.9,9.52,14.29),ep.bezierCurveTo(8.88,15.21,9.62,16.51,7.93,16.82),ep.bezierCurveTo(7.1,16.98,6.13,15.39,6.42,13.88),ep.bezierCurveTo(6.51,13.4,6.75,12.855,6.93,12.46),ep.bezierCurveTo(7.37,11.49,7.95,11.41,7.82,10.76),ep.bezierCurveTo(7.02,10.75,6.21,10.68,5.33,10.73),ep.bezierCurveTo(3.66,10.83,2.44,8.91,3.57,7.62),ep.bezierCurveTo(3.09,6.88,3.2,5.67,3.85,5.19),ep.bezierCurveTo(3.57,4.42,3.74,3.55,4.33,3.2),ep.bezierCurveTo(3.87,1.22,5.64,1.13,6.22,1.16),ep.lineTo(13.35,1.16),ep.bezierCurveTo(14.12,1.22,14.04,1.71,14.49,1.73),ep.bezierCurveTo(14.6,1.73,14.7,1.73,14.7,1.73),ep.bezierCurveTo(14.82,1.74,14.8,2.29,14.72,2.3),ep.bezierCurveTo(14.63,2.31,14.39,2.32,14.12,2.28),ep.bezierCurveTo(13.96,2.21,13.6,1.74,13.25,1.73),ep.lineTo(5.88,1.73),ep.bezierCurveTo(4.86,1.73,4.33,2.88,5.19,3.44),ep.bezierCurveTo(4.14,3.47,4.01,5.02,4.8,5.39),ep.bezierCurveTo(3.64,5.5,3.49,7.35,4.55,7.58),ep.bezierCurveTo(3.19,8.02,3.6,10.4,5.64,10.16),ep.bezierCurveTo(6.57,10.23,8.12,10.05,8.32,10.37),ep.bezierCurveTo(8.58,11.17,8.32,11.54,7.82,12.11),ep.bezierCurveTo(7.49,12.54,6.97,13.39,6.96,14.36),ep.bezierCurveTo(6.94,15.49,7.59,16.76,8.41,16.01),ep.bezierCurveTo(8.62,15.78,8.63,14.52,9.05,13.97),ep.bezierCurveTo(9.9,12.47,10.69,12.33,11.04,11.84),ep.bezierCurveTo(11.72,11.13,13.06,8.47,13.637,8.47),ep.bezierCurveTo(14.01,8.47,14.75,8.47,14.75,8.47),ep.bezierCurveTo(14.87,8.47,14.91,9.01,14.77,9.04),ep.closePath(),ep.fill(),ep.restore(),ep.restore(),ep.restore();break;case"buy":ij(e,i,"B");break;case"sell":ij(e,i,"S")}return!0}}class m8 extends mt{helper;constructor(e,t){super(e,t),this.addPoints(2),this.helper=new f2(e)}getElements(){let e=this.axis.pane.presenter.timeline,{price:t,time:i}=this.points[0],s=e_(e,i,Number,hb),r=e_(e,this.points[1].time,Number,hb),n=r-s;if(-1===s||-1===r)return[];let a=({value:i})=>{let r=e.at(s+i*n);return null===r?null:(this.helper.update(t,r),new f1(this.helper.point,!0,this.axis))};return this.getColoredElements(a)}getTextRef(){return(e,t,i)=>({ref:t.anchor,spacing:3,offsetY:!0,text:i.toString()})}adornElements(e,t){let i=this.axis.pane.getBoundsWithoutScales();this.adornElementsForColoredFactors(e,(e,t)=>{let s=new Path2D;if(null===e)return s;let r=t.anchor.x-e.anchor.x;return s.rect(e.anchor.x,i.y,r,i.height),s},this.getTextRef(),t)}getTimeScaleAdornments(){let e=e=>({time:this.points[e].time,color:this.traits.line.color});return[e(0),e(1)]}}class m9{snapToSupported=!0;isDrawingAnnotation=!0;constructor(){}onMouseMove(e){let{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){if(eI()&&e.originalEvent instanceof TouchEvent)return;let{point:t}=e,i=t.axis.pane.presenter,s={chart:i.accessor,axis:t.axis,point:{time:t.time.getTime(),price:t.price}};i.notifyHost(aa.CH_ANNPOINTPICKED,s),gC(i,void 0)}}let ge="Closed";class gt extends me{isLong;twoDecMeta;_dataWindow;_metaData;isHit;constructor(e,t,i){super(e,t),this.isLong=i,this.isHit=!1,this.addPoints(4);let s=(e,t)=>this.points[e].moveDirection=t;s(1,ei.Vertical),s(2,ei.Vertical),s(3,ei.Horizontal),this.twoDecMeta=new it(2)}data(e){return this.presenter.mainPlot.timeSeries.container.getData(e)}get presenter(){return this.axis.pane.presenter}getDataWindow(e,t,i=!0,s=!0){let r=this.data(an.DateTime),n=e_(r,+e,Number),a=e_(r,+t,Number),o={refIndex:-1,highestIndex:-1,lowestIndex:-1,highest:null,lowest:null,data:[]},[l,u,h]=[an.High,an.Low,an.Close].map(e=>this.data(e)),c=e=>e-n;for(let e=n;e<=a;e++)i&&-1===o.refIndex&&eH(this.entryPrice)&&this.entryPrice>=u[e]&&this.entryPrice<=l[e]&&(o.refIndex=c(e)),(!i||o.refIndex>=0&&c(e)>=o.refIndex)&&((!eH(o.highest)||l[e]>o.highest)&&(o.highest=l[e]),(!eH(o.lowest)||u[e]<o.lowest)&&(o.lowest=u[e])),i&&-1!==o.refIndex&&(-1===o.highestIndex&&l[e]>this.upperPrice&&(o.highestIndex=c(e)),-1===o.lowestIndex&&u[e]<this.lowerPrice&&(o.lowestIndex=c(e))),s&&o.data.push({high:l[e],low:u[e],close:h[e],time:r[e]});if(s&&o.data&&o.data.length>0){o.state=eH(o.highest,o.lowest)&&(this.upperPrice<o.highest||this.lowerPrice>o.lowest)?ge:"Open",o.special=-1===o.highestIndex&&-1===o.lowestIndex||o.highestIndex===o.lowestIndex;let e=eb(o.data);if(o.toPrice=e.close,o.toTime=e.time,o.state===ge)if(o.special){if(-1!==o.refIndex){let e=o.data[o.refIndex];o.toTime=e.time;let t=this.isLong?this.lowerPrice<o.lowest:this.upperPrice<o.highest;o.toPrice=t?this.upperPrice:this.lowerPrice}}else{let e=-1!==o.highestIndex&&-1!==o.lowestIndex;e&&o.highestIndex<o.lowestIndex||-1===o.lowestIndex?(o.toPrice=this.upperPrice,o.toTime=o.data[o.highestIndex].time):(e&&o.lowestIndex<o.highestIndex||-1===o.highestIndex)&&(o.toPrice=this.lowerPrice,o.toTime=o.data[o.lowestIndex].time)}let t=this.isLong?o.toPrice-this.entryPrice:this.entryPrice-o.toPrice;o.pAndL=eF(t,2)}return o}get dataWindow(){return eH(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=e_(e,+this.points[0].time,Number,hb),i=Math.min(e.length-1,t+50);return e.at(i).getTime()}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[tG.AT_ACCOUNT_SIZE]}get risk(){let e=this.traits[tG.AT_RISK_IS_PERCENT],t=this.traits[tG.AT_RISK];return eF(e?t/100*this.accountSize:t,2)}get pointValue(){return this._metaData||(this._metaData=this.presenter.mainPlot.metaData),this._metaData.pointValue}formatDollarValue(e){return Number.isFinite(e)?`${e<0?"-":""}$${this.twoDecMeta.format(Math.abs(e))}`:tG.NOT_APPLICABLE}get qty(){return Math.floor(this.risk/(this.isLong?this.entryPrice-this.lowerPrice:this.upperPrice-this.entryPrice))}get upperDiff(){return eF(this.upperPrice-this.entryPrice,2)}get amountMultiplier(){return this.isLong?1:-1}get upperAmount(){return eF(this.accountSize+this.amountMultiplier*this.qty*this.upperDiff,2)}get upperPandL(){return eF(this.amountMultiplier*this.upperDiff*this.pointValue,2)}get isCompact(){return this.traits[tG.AT_COMPACT]}get upper(){let e=hg(this.axis,this.priceMap(this.upperPrice)),t=`(${eF(this.upperDiff/this.entryPrice*100,2).toFixed(2)}%)`;return this.isCompact,`${e} ${t}`}get upperText(){let e=`${this.formatDollarValue(this.upperPandL)}`,t=`${this.formatDollarValue(this.upperAmount)}`,i=this.isLong?"Target":"Stop";return this.isCompact?`${this.upper} ${e}`:`${i}: ${this.upper}, P&L: ${e}, Amount: ${t}`}get lowerDiff(){return eF(this.entryPrice-this.lowerPrice,2)}get lowerAmount(){return eF(this.accountSize-this.amountMultiplier*this.qty*this.lowerDiff,2)}get lowerPandL(){return eF(-this.amountMultiplier*this.lowerDiff*this.pointValue,2)}get lower(){let e=hg(this.axis,this.priceMap(this.lowerPrice)),t=`(${eF(this.lowerDiff/this.entryPrice*100,2).toFixed(2)}%)`;return this.isCompact,`${e} ${t}`}get lowerText(){let e=`${this.formatDollarValue(this.lowerPandL)}`,t=`${this.formatDollarValue(this.lowerAmount)}`,i=this.isLong?"Stop":"Target";return this.isCompact?`${this.lower} ${e}`:`${i}: ${this.lower}, P&L: ${e}, Amount: ${t}`}get riskReward(){return eF(this.isLong?this.upperDiff/this.lowerDiff:this.lowerDiff/this.upperDiff,2)}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(tG.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(tG.AT_FILL)}get textStyle(){return this.fillOnlyStyle(tG.AT_FILL_TEXT)}get secondaryLineStyle(){return i7({line:{color:this.traits.line.color,dashStyle:"ShortDash"},fill:{color:tG.COLOR_TRANSPARENT}})}wasModifiedByTool(){eH(this.points[2].price)||this.positionPoints(),this._dataWindow=void 0}wasPointMovedByTool(e,t){let i=this.getVisiblePriceRange()/5e3;if(3>this.points.indexOf(e)){let t=t=>e.update(t,e.time);this.entryAnchor.price>this.upperAnchor.price&&t(e===this.entryAnchor?this.upperAnchor.price-i:this.entryAnchor.price+i),this.entryAnchor.price<this.lowerAnchor.price&&t(e===this.entryAnchor?this.lowerAnchor.price+i:this.entryAnchor.price-i)}if(e===this.entryAnchor){let t=(t,i,s)=>t.update(i?e.price:t.price,s?e.time:t.time);t(this.exitAnchor,!0,!1),t(this.upperAnchor,!1,!0),t(this.lowerAnchor,!1,!0)}this.wasModifiedByTool()}get isUpperPerPAndL(){let e=this.dataWindow;return this.isLong?e.pAndL>0:e.pAndL<=0}getStyleForElement(e,t){return e.style||this.defaultStyle}getElements(){let e=new f8(this.entryAnchor.point,this.exitAnchor.point,!1,!1,this.axis),t=this.exitAnchor.point.x<this.entryAnchor.point.x,i=Math.abs(this.exitAnchor.point.x-this.entryAnchor.point.x),s=(e,t)=>({x:e.x+t,y:e.y}),r=new f9(s(this.upperAnchor.point,t?-i:0),i,Math.abs(this.upperAnchor.point.y-this.entryAnchor.point.y),this.axis);r.style=this.upperStyle;let n=new f9(s(this.entryAnchor.point,t?-i:0),i,Math.abs(this.entryAnchor.point.y-this.lowerAnchor.point.y),this.axis);n.style=this.lowerStyle;let a=[e,r,n],o=this.dataWindow;if(-1!==o.refIndex){let e=o.data[o.refIndex],t=new f2(this.axis,this.entryPrice,e.time),i=new f2(this.axis,o.toPrice,o.toTime),s=new f8(t.point,i.point,!1,!1,this.axis);if(s.style=this.secondaryLineStyle,a.push(s),t.time!==i.time){let e=this.entryPrice<o.toPrice,s=new f9({x:t.point.x,y:Math.min(t.point.y,i.point.y)},i.point.x-t.point.x,Math.abs(i.point.y-t.point.y),this.axis);s.style=e?this.upperStyle:this.lowerStyle,a.push(s)}}return a}hitTest(e){if(!this.visible)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=>ib(this.traits[e].color);return[{price:this.upperPrice,color:e(tG.AT_FILL)},{price:this.entryPrice,color:e(tG.AT_LINE)},{price:this.lowerPrice,color:e(tG.AT_FILL2)}]}adornElements(e,t){let[i,s,r]=e;if(this.showTextAdornments){let[e,n]=[!0,!1].map(e=>iF(t,e)),{x:a,y:o,width:l}=s.rect,u=this.textStyle.fillStyle;iU(t,this.upperText,{x:a+l/2,y:o+e},J.Center,u,ib(this.upperStyle.fillStyle));let{x:h,y:c,width:d,height:p}=r.rect;iU(t,this.lowerText,{x:h+d/2,y:c+p+Math.abs(n)},J.Center,u,ib(this.lowerStyle.fillStyle));let{p1:f,p2:m}=i,{x:g,y:y}=f,{x:T}=m,A=this.state||tG.NOT_APPLICABLE,S=this.isCompact?`${this.formatDollarValue(this.pAndLValue)}`:`${A} P&L: ${this.formatDollarValue(this.pAndLValue)}, Qty: ${this.qty}`,v=this.isCompact?`${this.riskReward.toFixed(2)}`:`Risk/Reward Ratio: ${this.riskReward.toFixed(2)}`,b=e=>t.measureText(e).width,P=Math.abs(T-g)<1.25*Math.max(b(S),b(v))?y+Math.abs(n)+5:y+e+10,C=ib(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);iU(t,[S,v],{x:g+(T-g)/2,y:P},J.Center,u,C)}}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}}var gi=["years","months","weeks","days","hours","minutes","seconds"];function gs(e,t){te(2,arguments);var i=ti(e),s=ti(t),r=i.getTime()-s.getTime();return r<0?-1:r>0?1:r}function gr(e){return(gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gn(e,t){if(te(2,arguments),!t||"object"!==gr(t))return new Date(NaN);var i=t.years?e9(t.years):0,s=t.months?e9(t.months):0,r=t.weeks?e9(t.weeks):0,n=t.days?e9(t.days):0,a=t.hours?e9(t.hours):0,o=t.minutes?e9(t.minutes):0,l=t.seconds?e9(t.seconds):0,u=ti(e),h=s||i?ts(u,s+12*i):u;return new Date((n||r?lx(h,n+7*r):h).getTime()+1e3*(l+60*(o+60*a)))}function ga(e,t,i){te(2,arguments);var s=um(e,t)/6e4;return uy(null==i?void 0:i.roundingMethod)(s)}class go extends mi{markers;display=null;constructor(e,t){super(e,t),this.points=mn(e),this.points[2].visible=!1,this.points[3].visible=!1,this.markers=[new mB]}isPointDrawn(e){return!!super.isPointDrawn(e)&&e.visible}makeLineArrow(e,t,i,s){let r=[im(e,t),im(i,s)];return[this.makeLine(r[0],r[1]),mF(r,"end",10)]}get rectColor(){return this.traits[tG.AT_FILL].color}get textColor(){return this.traits[tG.AT_FILL_TEXT].color}getMarkers(){return this.markers}formatDateDifference(e,t){return this.presenter.data.aggregation.isEndOfDay?`${lM(t,e)}d`:(function(e,t){if(arguments.length<1)throw TypeError("1 argument required, but only ".concat(arguments.length," present"));var i,s,r,n,a,o=null!=(i=null!=(s=null==t?void 0:t.locale)?s:nc.locale)?i:oB,l=null!=(r=null==t?void 0:t.format)?r:gi,u=null!=(n=null==t?void 0:t.zero)&&n,h=null!=(a=null==t?void 0:t.delimiter)?a:" ";return o.formatDistance?l.reduce(function(t,i){var s="x".concat(i.replace(/(^.)/,function(e){return e.toUpperCase()})),r=e[i];return"number"==typeof r&&(u||e[i])?t.concat(o.formatDistance(s,r)):t},[]).join(h):""})(function(e){te(1,arguments);var t=ti(e.start),i=ti(e.end);if(isNaN(t.getTime()))throw RangeError("Start Date is invalid");if(isNaN(i.getTime()))throw RangeError("End Date is invalid");var s={};s.years=Math.abs(function(e,t){te(2,arguments);var i=ti(e),s=ti(t),r=gs(i,s),n=Math.abs(function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getFullYear()-s.getFullYear()}(i,s));i.setFullYear(1584),s.setFullYear(1584);var a=gs(i,s)===-r,o=r*(n-Number(a));return 0===o?0:o}(i,t));var r=gs(i,t),n=gn(t,{years:r*s.years});s.months=Math.abs(function(e,t){te(2,arguments);var i,s=ti(e),r=ti(t),n=gs(s,r),a=Math.abs(function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return 12*(i.getFullYear()-s.getFullYear())+(i.getMonth()-s.getMonth())}(s,r));if(a<1)i=0;else{1===s.getMonth()&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-n*a);var o=gs(s,r)===-n;(function(e){te(1,arguments);var t=ti(e);return lL(t).getTime()===(function(e){te(1,arguments);var t=ti(e),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t})(t).getTime()})(ti(e))&&1===a&&1===gs(e,r)&&(o=!1),i=n*(a-Number(o))}return 0===i?0:i}(i,n));var a=gn(n,{months:r*s.months});s.days=Math.abs(lM(i,a));var o=gn(a,{days:r*s.days});s.hours=Math.abs(function(e,t,i){te(2,arguments);var s=um(e,t)/36e5;return uy(null==i?void 0:i.roundingMethod)(s)}(i,o));var l=gn(o,{hours:r*s.hours});s.minutes=Math.abs(ga(i,l));var u=gn(l,{minutes:r*s.minutes});return s.seconds=Math.abs(uT(i,u)),s}({start:e,end:t}),{format:["days","hours","minutes","seconds"]}).replaceAll(/(days?)|(hours?)|(minutes?)|(seconds?)/g,e=>e[0])}computeState(){}get text(){return null===this.display&&this.computeState(),this.display}getTextCoord(e,t){let i=this.points[0].price<this.points[1].price,s=iF(t,i,this.text.length),{x:r,y:n,width:a,height:o}=e.rect;return{x:r+a/2,y:n+(i?0:o)+(i?s:Math.abs(s))}}adornElements(e,t){iU(t,this.text,this.getTextCoord(e[0],t),J.Center,this.textColor,ib(this.rectColor))}getDateDifference(){let[e,t]=this.points.slice(0,2).map(e=>e.time),i=Math.min(+e,+t),s=Math.max(+e,+t),r=this.data(an.DateTime),n=e_(r,+i,Number),a=e_(r,+s,Number),o=ef(this.data(an.Volume).slice(n,a+1)),l=this.formatter.format(o,an.Volume),u=a-n,h=0===u?"":this.formatDateDifference(i,s),c=e<t?"":"-";return[`${c}${u} bars, ${c}${h}`,`Vol ${l}`]}getPriceDifference(){let[e,t]=this.points.slice(0,2).map(e=>e.price),i=t-e,s=this.formatter.format(i,an.Close),r=this.formatter.format(i/e,an.PercentChange);return[`${s} (${r})`]}resetComputedState(){this.display=null}getFlipAnchorIndices(){return[0,1]}}class gl extends go{getElements(){this.points.slice(2).forEach(e=>e.toPoint());let[e,t,i,s]=this.getScreenPoints(),r=this.makeLine(e,s),n=this.makeLine(t,i),[a,o]=this.makeLineArrow(e,s,t,i);return this.markers[0]=o,[this.rect,r,n,a]}computeState(){this.display=this.getDateDifference()}}class gu extends go{getElements(){this.points.slice(2).forEach(e=>e.toPoint());let[e,t,i,s]=this.getScreenPoints(),r=this.makeLine(e,i),n=this.makeLine(t,s),[a,o]=this.makeLineArrow(e,i,t,s);return this.markers[0]=o,[this.rect,r,n,a]}computeState(){this.display=this.getPriceDifference()}}class gh extends go{get drawBorder(){return this.traits[tG.AT_DRAW_BORDER]}getBorderElements(){if(!this.drawBorder)return[];let[e,t,i,s]=this.getScreenPoints();return[this.makeLine(e,s),this.makeLine(t,i),this.makeLine(e,i),this.makeLine(t,s)]}getElements(){this.points.slice(2).forEach(e=>e.toPoint());let[e,t,i,s]=this.getScreenPoints(),[r,n]=this.makeLineArrow(e,s,t,i),[a,o]=this.makeLineArrow(e,i,t,s);this.markers=[n,o];let l=this.getBorderElements();return[this.rect,r,a].concat(l)}computeState(){this.display=this.getPriceDifference().concat(this.getDateDifference())}}class gc extends mi{constructor(e,t){super(e,t),this.points=mn(e)}get priceLevels(){return i0(this.traits[tG.AT_PRICE_LEVELS])}get timeLevels(){return i0(this.traits[tG.AT_TIME_LEVELS])}get showAngles(){return this.traits[tG.AT_SHOW_ANGLES]}get reverse(){return this.traits[tG.AT_REVERSE]}get showLeftLabels(){return this.traits[tG.AT_SHOW_LEFT_LABELS]}get showRightLabels(){return this.traits[tG.AT_SHOW_RIGHT_LABELS]}get showTopLabels(){return this.traits[tG.AT_SHOW_TOP_LABELS]}get showBottomLabels(){return this.traits[tG.AT_SHOW_BOTTOM_LABELS]}getAngles(e,t){let i=this.getScreenPoints(),s=this.lineOnlyStyle(tG.AT_LINE_2),r=[];e.concat(t).flatMap(e=>[e.p1,e.p2]).map(e=>{r.some(t=>e.x===t.x&&e.y===t.y)||r.push(e)});let n=i.map(e=>r.filter(t=>t.x!==e.x&&t.y!==e.y).map(t=>this.makeLine(e,t))).flat();return n.forEach(e=>e.style=s),n}getElements(){let e=this.getLinesDataAtLevels(this.priceLevels,this.timeLevels),{priceLines:t,timeLines:i}=this.getLineElements(e),s=this.showAngles?this.getAngles(t,i):[];return[...t,...i,...s]}adornElements(e,t){let i=this.singleStyle,s=this.showBackground,r=t.fillStyle,n=iH(t,1)/2,{x:a,y:o}=tG.DEFAULT_ADORN_OFFSET,l=(e,i,s,r,n)=>{let a=iT(e,i);iU(t,Number(s.toFixed(4)).toString(),a,r,n)},u=null;if(e.forEach(e=>{if(!e._data)return;let{level:h,isPrice:c}=e._data,d=i?r:e.style.strokeStyle,p=u&&s&&!i;c?(this.showLeftLabels&&l(e.p1,{x:a,y:n},h,J.Right,d),this.showRightLabels&&l(e.p2,{x:-a,y:n},h,J.Left,d)):(this.showTopLabels&&l(e.p1,{x:0,y:o},h,J.Center,d),this.showBottomLabels&&l(e.p2,{x:0,y:-(2*o)},h,J.Center,d)),p&&((e,i)=>{let s=new Path2D;iV(s,e.p1,i.p2),t.fillStyle=i.style.fillStyle,t.fill(s)})(u,e),u=e}),i&&s){let e=this.applyBackgroundOpacity(this.traits.line.color),i=new Path2D,[s,r]=this.getScreenPoints();iV(i,s,r),t.fillStyle=e,t.fill(i)}}resetComputedState(){this.lines=void 0}updateFrom(e,t,i,s,r){let n=e.reverse!==this.reverse;super.updateFrom(e,t,i,s,r),n&&this.resetComputedState()}getFlipAnchorIndices(){return[0,1]}}let gd=e=>e.map(e=>({...e,dimensions:e.value.split("x").map(Number)})),gp=(e,t)=>1e-7>Math.abs(e-t);class gf extends mi{_parsedFans=null;_parsedArcs=null;constructor(e,t){super(e,t),this.points=mn(e),this._parsedFans=this._parsedArcs=null}get levels(){return i0(this.traits[tG.AT_LEVELS])}setComputedAndTraits(e,t){let i={...e,computed:t,traits:this.getTraitsFor(e)};return delete i.line,i}get computedLevels(){return this.levels.map(e=>this.setComputedAndTraits(e,e.value/5))}get showRangesRatio(){return this.traits[tG.AT_SHOW_RANGES_RATIO]}get arcs(){return i0(this.traits[tG.AT_ARCS])}get fans(){return i0(this.traits[tG.AT_FANS])}get reverse(){return this.traits[tG.AT_REVERSE]}get parsedFans(){return null===this._parsedFans&&(this._parsedFans=gd(this.fans)),this._parsedFans}get computedFans(){let[,,e,t]=this.getReversedScreenPoints(),{dx:i,dy:s}=this.unit,{signX:r,signY:n}=this.getOrientation();return this.parsedFans.map(a=>{let[o,l]=a.dimensions;return this.setComputedAndTraits(a,o>=l?{x:e.x,y:e.y+l/o*n*5*s}:{x:t.x+o/l*5*r*i,y:t.y})})}get parsedArcs(){return null===this._parsedArcs&&(this._parsedArcs=gd(this.arcs)),this._parsedArcs}get computedArcs(){let{dx:e}=this.unit;return this.parsedArcs.map(t=>{let[i,s]=t.dimensions;return this.setComputedAndTraits(t,Math.sqrt(e**2*(i**2+s**2)))})}getReversedScreenPoints(){let[e,t,i,s]=this.getScreenPoints();return this.reverse?[t,e,s,i]:[e,t,i,s]}get unit(){let[e,t]=this.getReversedScreenPoints();return e.x!==t.x&&e.y!==t.y?{dx:Math.abs(t.x-e.x)/5,dy:Math.abs(t.y-e.y)/5}:null}get priceBarRatio(){return this.traits[tG.AT_PRICE_BAR_RATIO]}set priceBarRatio(e){this.traits[tG.AT_PRICE_BAR_RATIO]=e}makeStyledLine(e,t,i){let s=this.makeLine(e,t);return this.singleStyle||(s.style=i7(i)),s}getGridLines(e,t){let i=t.x-e.x,s=t.y-e.y;return this.computedLevels.map(({computed:r,traits:n})=>{let a=e.x+r*i,o=e.y+r*s;return[this.makeStyledLine({x:a,y:e.y},{x:a,y:t.y},n),this.makeStyledLine({x:e.x,y:o},{x:t.x,y:o},n)]}).flat()}getArcs(e){let{flipX:t,flipY:i,signY:s}=this.getOrientation(),{dx:r,dy:n}=this.unit,a=gp(r,n)?null:{x:1,y:n/r},o=this.getClipPath();return this.computedArcs.map(({computed:r,traits:n})=>{let l=new mZ(e,null,r,t?s*Math.PI/2:0,t?Math.PI:s*Math.PI/2,i,this.axis);return null!==a&&(l.scale=a),l.clip=o,this.singleStyle||(l.style=i7(n)),l})}getFans(e){return this.computedFans.map(({computed:t,traits:i})=>this.makeStyledLine(e,t,i))}getElements(){if(null===this.unit)return[];let[e,t]=this.getReversedScreenPoints(),i=this.getGridLines(e,t);return[...i,...this.getArcs(e),...this.getFans(e)]}getOrientation(){let[e,t]=this.getReversedScreenPoints(),i=t.x<e.x,s=t.y<e.y;return{flipX:i,signX:i?-1:1,flipY:s,signY:s?-1:1}}getClipPath(){let[e,t]=this.getReversedScreenPoints(),i=new Path2D;return iV(i,e,t),i}adornElements(e,t){if(0===e.length)return;let i=(e,i,s)=>{t.fillStyle=s;let r=i.hasScale;r&&(t.save(),i.applyScale(t)),t.fill(e),r&&t.restore()};if(this.showBackground){let s=e.filter(e=>e.radius),r=this.getClipPath();if(t.save(),t.clip(r),this.singleStyle){let e=eb(s);i(mJ(null,e),e,this.applyBackgroundOpacity(this.traits.line.color))}else{let e=null;s.forEach(t=>{let s=mJ(e,t),r=t.style.fillStyle;i(s,t,r),e=t})}t.restore()}if(this.showRangesRatio&&null!==this.unit){let e=eb(this.computedLevels),i=(this.singleStyle?this:e).traits.line.color,[,s,r,n]=this.getReversedScreenPoints(),{x:a,y:o}=tG.DEFAULT_ADORN_OFFSET,{flipX:l,signX:u,signY:h}=this.getOrientation(),c=iT(r,{x:-a*u,y:o*h}),{priceDiff:d,barsDiff:p}=this.getLinesDataAtLevels(null,null),f=l?J.Right:J.Left;iU(t,p.toFixed(0),c,f,i);let m=iT(n,{x:2*a*u,y:-o*h}),g=l?J.Left:J.Right;iU(t,this.formatter.format(d,an.Close),m,g,i);let y=iT(s,{x:-a*u,y:-o*h});iU(t,this.priceBarRatio.toFixed(6),y,f,i)}}resetComputedState(){if(this.lines=void 0,4===this.points.length&&null!==this.unit){let{priceDiff:e,barsDiff:t}=this.getLinesDataAtLevels(null,null);this.priceBarRatio=Math.abs(e/t)}}updateFrom(e,t,i,s,r){if(super.updateFrom(e,t,i,s,r),this._parsedFans=this._parsedArcs=null,!gp(e.priceBarRatio,this.priceBarRatio)){let[t,i,,]=this.points;this.reverse&&([t,i]=[i,t]);let{priceDiff:s,barsDiff:r}=this.getLinesDataAtLevels(null,null);i.update(t.price+Math.sign(s)*e.priceBarRatio*r,i.time),this.resetComputedState()}}getFlipAnchorIndices(){return[0,1]}}class gm extends mt{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[tG.AT_EXTEND_PT_1]}get extend2(){return this.traits[tG.AT_EXTEND_PT_2]}getElements(){let[e,t,i]=this.getScreenPoints(),{x:s,y:r}=iy(i,e),n=i=>{let[s,r]=[e,t].map(e=>iT(e,i));return new f8(s,r,this.extend1,this.extend2,this.axis)};return this.getColoredElements(({value:e})=>n({x:s*e,y:r*e}))}getTextRef(){return(e,t,i)=>{let s=this.formatLevelPrice(i,t.anchor1.y);return{ref:t,spacing:5,offsetY:!0,text:s}}}adornElements(e,t){this.adornElementsForColoredFactors(e,(e,t)=>{let i=new Path2D;return null===e||(iR(i,e.p1),iN(i,e.p2),iN(i,t.p2),iN(i,t.p1)),i},this.getTextRef(),t)}}class gg extends me{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,i){super(e,t),this.computed=!0,this.studyPlotId=i,this.gotData=!1}setOptions(e){switch(this.levelMode=e.LevelMode,this.levelSize=e1(1,1e3,e.LevelSize),this.alignLeft="Left"===e.Position,this.totalVolume="Total"===e.Volume,this.widthPercent=e1(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(U.ChangeBased)??!1}}eV(e.PeriodType)&&(this.periodType=e.PeriodType),this.period=e.Period,this.valueRangePercent=e.ValueRangePercent/100;let t=es[yQ()?.config.mode??"Unspecified"];this.usesFinerGrainedAgg=sF(t)}get isCountMode(){return"Count"===this.levelMode}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),t=e?.getTimeData();if(!eH(t))return;let i=t[t.length-1],s=this.boxes.length>0?this.boxes[this.boxes.length-1]:null;if(eV(s)&&i.valueOf()<s.lastDate.valueOf())this.updateLastBox();else{let e=this.getDataForRange(i,this.getBoxEndFromStart(i));e&&this.boxes.push(e)}break}case"DataPointChanged":this.updateLastBox();break;case"NewChunkArrived":this.gotData=!1}}}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,i=this.axis.toY(e.min),s=this.axis.toY(e.max),r=this.axis.pane.presenter.view.toX(e.firstDate)-t.width/2,n=0;if("Days"===this.periodType){let i=e.lastDate,s=this.axis.pane.presenter.view.xAxis.xScale.timeline,a=s.at(s.lastSeriesIndex),o=a.valueOf()<i.valueOf(),l=o?a:i,u=(o?1:-2)*t.width/2;n=this.axis.pane.presenter.view.toX(l)+u-r}else n=this.period*t.width+(this.period-1)*t.spacing;return new iD(r,s,n,i-s)}default:throw Error("Unexpected period type for Volume At Price annotation")}}getElementsForBox(e){let t=this.getBoxRect(e),i=[];if(this.isPeriodic){let e=new f9({x:t.x,y:t.y},t.width,t.height,this.axis);e.style=this.backgroundStyle,i.push(e)}let{x:s,width:r}=t,n=r*this.widthPercent,a=e.bars[e.maxVolumeIndex];return e.bars.forEach((t,o)=>{let{upVolume:l,downVolume:u,totalVolume:h,isValue:c}=t;if(0===l&&0===u)return null;let d=this.axis.toY(e.min+o*e.zone),p=this.axis.toY(e.min+(o+1)*e.zone),f=Math.abs(d-p),m=(e,t,i=0)=>{let n=new f9({x:this.alignLeft?s+i:s+r-e-i,y:p},e,f,this.axis);return n.style=t,n},g=(e,t,i)=>e/t.totalVolume*i,y=this.studyPlot.curves[2].visible,T=y&&c?this.upValueStyle:this.upStyle,A=y&&c?this.downValueStyle:this.downStyle,S=y&&c?this.totalValueStyle:this.totalStyle;if(this.totalVolume){let e=g(h,a,n);i.push(m(e,S))}else{let e=g(u,a,n),t=g(l,a,n);i.push(m(t,T),m(e,A,t))}if(this.studyPlot.curves[1].visible&&o===e.maxVolumeIndex){let e=i[i.length-1].rect,t=this.alignLeft?e.x+e.width:s,n=(p+d)/2,a=this.alignLeft?s+r:e.x;i.push(new f8({x:t,y:n},{x:a,y:n},!1,!1,this.axis))}}),i}get isVisible(){return this.studyPlot.visible&&this.studyPlot.mainCurve.visible}getElements(){if(this.gotData||this.getData(),!this.gotData||!this.isVisible||0===this.boxes.length)return[];switch(this.periodType){case"VisibleScreen":{let e=this.boxes[0];if(!e||0===e.bars.length)return[];return this.getElementsForBox(e)}case"Bars":case"Days":{let[e,t]=this.presenter.view.xAxis.xScale.domain()||[];if(!od(e)||!od(t))return[];let i=this.boxes.findIndex(t=>t.firstDate.getTime()<=e.getTime()&&t.lastDate.getTime()>=e.getTime());-1===i&&(i=0,this.studySeries.loadMoreData());let s=this.boxes.findIndex(e=>e.firstDate.getTime()<=t.getTime()&&e.lastDate.getTime()>=t.getTime());-1===s&&-1!==i&&(s=this.boxes.length-1);let r=[];for(let e=i;e<=s;e++)r.push(...this.getElementsForBox(this.boxes[e]));return r}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(tG.AT_FILL)}get upStyle(){return this.fillOnlyStyle(tG.AT_FILL2)}get totalStyle(){return this.fillOnlyStyle(tG.AT_FILL3)}get downValueStyle(){return this.fillOnlyStyle(tG.AT_FILL4)}get upValueStyle(){return this.fillOnlyStyle(tG.AT_FILL5)}get totalValueStyle(){return this.fillOnlyStyle(tG.AT_FILL6)}get backgroundStyle(){return this.fillOnlyStyle(tG.AT_FILL7)}get lineStyle(){return this.lineOnlyStyle(tG.AT_LINE)}getBoxEndFromStart(e){switch(this.periodType){case"VisibleScreen":default:return null;case"Days":return of(lW($.Day,this.period)(e),1);case"Bars":{let t=this.axis.pane.presenter.data.aggregation;return of(lW(t.unit,t.size*this.period)(e),1)}}}getData(){let e=this.axis.pane.presenter.data.aggregation;if(e.isTick||e.hasSpec&&!pw(e.spec))return;let[t,i]=this.presenter.view.xAxis.xScale.domain()||[];if(!od(t)||!od(i))return;let s=lW(e.unit,e.size);switch(this.periodType){case"VisibleScreen":{let e=this.boxes[0];if(e&&e.firstDate===t&&e.lastDate===i)this.gotData=!0;else{let e=this.getDataForRange(t,i);e&&(this.boxes[0]=e)}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 i=e.getTimeData(),r=0;for(this.boxes=[];r<i.length;){let e=i[r],t=r+this.period,n=of(t<i.length?i[t]:s(i[i.length-1]),1),a=this.getDataForRange(e,n);a&&this.boxes.push(a),r+=this.period}this.gotData=!0;break}case"Days":{if(e.isEndOfDay){this.boxes=[],this.gotData=!0;return}let[t,i]=[0,1].map(e=>this.studySeries.innCont(e));if((t?.size??0)<1||(i?.size??0)<1)return;let r=t.getTimeData(),n=t.getData(an.TradingDay),a=e=>{let t=0,i=r[e],s=n[e];for(let a=e;a<r.length;a++)if(tl(r[a],i)>0&&n[a]!==s&&(t+=1,i=r[a],s=n[a],t===this.period))return a;return -1},o=0,l=r[0],u=a(o)-1;for(;(u<0||u===o)&&o<r.length;)o+=1,u=a(o)-1;for(this.boxes=[];o<r.length&&u<r.length&&o<u;){let e=of(s(r[u]),1),t=this.getDataForRange(l,e);t&&this.boxes.push(t),l=r[o=u+1],u=a(o)-1}if(u<0&&o<r.length-1){let e=of(s(r[r.length-1]),1),t=this.getDataForRange(r[o],e);t&&this.boxes.push(t)}this.gotData=!0}}}getBoxAt(e){if(0===this.boxes.length)return null;switch(this.periodType){case"VisibleScreen":{let t=this.boxes[0];if(t.firstDate>e||t.lastDate<e)return null;return t}case"Bars":case"Days":{let t=e.getTime(),i=this.boxes.find(e=>e.firstDate.getTime()<=t&&e.lastDate.getTime()>=t);if(!i)return null;return i}}}getValueAt(e,t,i){if(!this.isVisible)return null;let s=this.getBoxAt(t);if(!s)return null;let r=this.getBarIndex(s,i);if(r<0||r>=s.bars.length)return null;let n=s.bars[r];switch(e){case an.UPVOL:return this.totalVolume?null:n.upVolume;case an.DNVOL:return this.totalVolume?null:n.downVolume;case an.TOTVOL:return this.totalVolume?n.totalVolume:null;case an.POC:case an.VAREA:case an.BARBACK:return null;default:throw Error("Unexpected Volume At Price field")}}getBarIndex(e,t,i=!1){if(0===e.bars.length||0===e.zone)return -1;let s=Math.floor((t-e.min)/e.zone);return i?Math.min(e.bars.length-1,s):s}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:5e-324,zone:0,bars:[],maxVolumeIndex:-1,firstDate:e,lastDate:t}}findExtremes(e,t,i,s,r,n){let a=eV(r)&&eV(n);for(let o=t;o<=i;o++)if(a){let t=r[o];t>e.max&&(e.max=t);let i=n[o];i<e.min&&(e.min=i)}else{let t=s[o];t<e.min&&(e.min=t),t>e.max&&(e.max=t)}}findValueArea(e){if(-1===e.maxVolumeIndex||0===e.bars.length)return;e.bars[e.maxVolumeIndex].isValue=!0;let t=ef(e.bars.map(e=>e.totalVolume))*this.valueRangePercent,i=e.bars[e.maxVolumeIndex].totalVolume,s=e.maxVolumeIndex,r=e.maxVolumeIndex;for(;i<t;){let n=[{dir:"lower",count:2,startIdx:s-2,endIdx:s-1},{dir:"lower",count:1,startIdx:s-1,endIdx:s-1},{dir:"upper",count:2,startIdx:r+1,endIdx:r+2},{dir:"upper",count:1,startIdx:r+1,endIdx:r+1}].filter(t=>t.startIdx>=0&&t.endIdx<e.bars.length).map(t=>{let s=ef(e.bars.slice(t.startIdx,t.endIdx+1).map(e=>e.totalVolume));return{...t,volume:s,newTotal:i+s}});if(0===n.length)break;let a=(e,t)=>t.newTotal<e.newTotal?t:e,o=(e,t)=>t.volume>e.volume?t:e,l=n.filter(e=>e.newTotal>=t),u=l.length>0?l.reduce(a):n.reduce(o);for(let t=u.startIdx;t<=u.endIdx;t++)e.bars[t].isValue=!0;if("lower"===u.dir?s=u.startIdx:r=u.endIdx,(i=u.newTotal)>=t)break}}tallyVolume(e,t,i,s,r,n,a){let o=5e-324,l=!1;for(let u=t;u<=i;u++){let t=r[u],i=this.getBarIndex(e,t,!0);if(-1===i){l=!0;break}let h=a[u],c=this.useChange?n[u]>=0:s[u]<=r[u],d=e.bars[i];c?d.upVolume+=h:d.downVolume+=h,d.totalVolume=d.downVolume+d.upVolume,d.totalVolume>o&&(o=d.totalVolume,e.maxVolumeIndex=i)}l||this.findValueArea(e)}get isPeriodic(){return"Bars"===this.periodType||"Days"===this.periodType}get isVisibleScreen(){return"VisibleScreen"===this.periodType}getDataForRange(e,t){let i=this.makeBox(e,t),s=this.studySeries.innCont(1),r=s?.getTimeData();if(!eH(r))return null;let n=e=>e_(r,+e,Number),a=n(e),o=n(t);if(r[o].getTime()>t.getTime()&&(o-=1),a>o)return null;if(this.axis.pane.presenter.data.aggregation.unit===$.Day&&"Bars"===this.periodType){let e=s.getData(an.TradingDay),t=e[a];for(;t===e[a]&&a>0;)a-=1;a+=1;let i=0;for(o=a;o<r.length&&i<this.period;)e[o]!==t&&(i+=1,t=e[o]),o+=1;o-=2}this.isVisibleScreen&&this.usesFinerGrainedAgg&&a<1e3&&this.studySeries.loadMoreData();let[l,u,h,c,d,p]=["Open","High","Low","Close","Change","Volume"].map(e=>{let t;return t=an[e],s.getData(t)});this.findExtremes(i,a,o,c,u,h);let f=i.max-i.min,m=e=>({upVolume:0,downVolume:0,isValue:!1,totalVolume:0});if(this.isCountMode)i.zone=f/this.levelSize,i.bars=eL(this.levelSize,m);else{let e=Math.max(1,Math.ceil(f/((this.presenter.mainPlot?.metaData.minMovement??1)*this.levelSize)));i.zone=f/e,i.bars=eL(e,m)}return this.tallyVolume(i,a,o,l,c,d,p),this.gotData=!0,i}}function gy(e){let t=Math.abs(e)/Math.SQRT2,i=1/(1+.3275911*t);return .5*(1+(e<0?-1:1)*(1-((((1.061405429*i+-1.453152027)*i+1.421413741)*i+-.284496736)*i+.254829592)*i*Math.exp(-t*t)))}class gT extends me{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,i){super(e,t),this.studyPlotId=i}makeStyles(){let e=this.lineOnlyStyle(tG.AT_LINE),t=this.lineOnlyStyle(tG.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 0!==this.targetPrice1?this.targetPrice1:this.targetPrice2}setOptions(e){if(this.periodTarget=e.PeriodTarget,this.targetPrice1=e.TargetPrice1,this.targetPrice2=e.TargetPrice2,this.pricesCount=+(0!==this.targetPrice1)+ +(0!==this.targetPrice2),this.pricesCount>1&&this.targetPrice1<this.targetPrice2){let e=this.targetPrice1;this.targetPrice1=this.targetPrice2,this.targetPrice2=e}}get haveInput(){return 0!==this.periodTarget&&(0!==this.targetPrice1||0!==this.targetPrice2)}get haveData(){return eV(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 f2(this.axis,this.targetPrice,this.targetDate)],this.pricesCount>1&&this.points.push(new f2(this.axis,this.targetPrice2,this.targetDate)),this.unitsPerYear=fI(this.presenter.data.aggregation),this.anchorPrice=this.mainCont.getLastDataPoint(an.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),i=gy(t(this.targetPrice));if(this.pricesCount>1){let e=gy(t(this.targetPrice2));this.probabilityAbove=1-i,this.probabilityBelow=e,this.probabilityBetween=i-e}else this.probabilityBelow=i,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.mainCurve.visible)return[];let e=[];return e.push(new f1(this.points[0].point,!0,this.axis)),e.push(new f1(this.points[0].point,!1,this.axis)),this.pricesCount>1&&e.push(new f1(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,i]=[!0,!1].map(e=>Math.abs(iF(t,e))),s=this.pricesCount>1,r=this.points[0].point,n=s?this.points[1].point:r,a=this.traits.line2.color,o=ix(a),l=iH(t),u=["Above","Below","Between"],h=(e,t)=>`${eF(100*e,2).toFixed(2)}% Probability ${u[t]}`,c=(e,i)=>iU(t,e,i,J.Right,o,a);if(c(h(this.probabilityAbove,0),{x:r.x-10,y:r.y-e}),s){let e=r.y+(n.y-r.y+l)/2;c(h(this.probabilityBetween,2),{x:r.x-10,y:e})}c(h(this.probabilityBelow,1),{x:n.x-10,y:n.y+i})}}}let gA=new 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=eN(aa.CH_ZOOMCHANGED,1e3)}startTouchCrosshairMode(e,t,i){this.touchCrosshairMode=!0,this.showCrosshairAndTooltips(e.view,t,i)}activated(){}deactivated(){}findHit(e){let t;if(!e.point)return[];if(e.axis.pane.axes.some(t=>t.plots.some(t=>t.hitTestCustomEvent(e.point))))return tG.EVENT_PIN_HIT;let i=e.presenter.selectedAnnotation;void 0!==i&&(t=i.points.find(t=>t.hitTest(e.point)));let s=eb(e.axis.annotations.filter(t=>t.computed?null:t.hitTest(e.point)));return void 0!==t&&null==s&&(s=i),[s,t]}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)}fireZoomChanged(e){this.notifyZoomChanged({chart:e.accessor})}onMouseDblClick({priceAxis:e,offset:t,presenter:i,view:s}){let r=s.xAxis.viewBox.contains(t),n=!1;if(eH(e))this.resetVerticalAxis(e),n=!0;else if(r)this.resetHorizontalAxis(i),n=!0;else if(eI()){let e=i.selectedAnnotation;null!=e?mw(e,t):mR(i,t)}n&&s.redraw()}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!eI())return null;let e=new Date().getTime(),t=eH(this.previousTouchTimestamp)?e-this.previousTouchTimestamp:null;return this.previousTouchTimestamp=e,t}onMouseDown(e){let{point:t,button:i,splitter:s,offset:r,priceAxis:n,presenter:a,originalEvent:o}=e,l=window.navigator.platform.toLowerCase().startsWith("mac"),u=l?et.Meta:et.Control,h=i===ee.Right||l&&i===ee.Left&&e.getModifier(et.Control);this.touchCrosshairMode&&eH(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);let c=this.computePreviousTouchStartDuration();if(eH(c)&&c<tG.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(e),!0;if(!h&&this.isLogoLink(r)&&a.notifyHost(aa.CH_LOGOCLICKED,{chart:a.accessor}),eH(t)&&a.allPlots.some(e=>e.tryHandleCustomEventClick(t.point)))return!0;if(eH(s))return this.resizingPanes=!0,this.lastResizingOffset=r,this.splitter=s,a.enableTooltip(!1),!0;if(eH(n))return eB(a.display.chart.zooming)[0]&&this.startAxisScaling(n,r),!0;if(null!=t){if(e.getModifier(u))return a.activeTool=new mD,a.activeTool.onMouseDown(e),!0;let[i,s]=this.findHit(t);if(a.clearSelection(),null!=i&&a.setSelection(i),null==i||i?.locked)return h?(null==i?mR(a,r,o):i?.locked&&mw(i,r),!0):!!this.touchCrosshairMode||(a.activeTool=new mM(t),a.activeTool.startPan(r),m_());let n=null!=s;return h?(mw(i,r),eI()):(!n||!!s.movable)&&(!!n||!!i.canMove(t.point))&&(a.activeTool=n&&-1!==i.points.indexOf(s)?new f0(i,s):new fQ(i,t,r),eI())}return this.prevZoomingOffset=r,!1}onContextMenu(e){return!0}isLogoLink(e){let t=eV(mL)&&mL.logoClickable?mL.rect:null;return eH(t)&&t.contains(e)}onMouseMove(e){let{point:t,splitter:i,priceAxis:s,view:r,presenter:n,offset:a}=e;if(eH(e.pinchZoom)&&e.pinchZoom&&eH(e.pinchDistance))return eH(this.prevPinchDistance)&&(e.delta=this.prevPinchDistance-e.pinchDistance,this.onWheel(e)),this.prevPinchDistance=e.pinchDistance,eI();if(null!=i||this.resizingPanes)r.setCursor(Q.ResizeVertical),this.resizingPanes&&this.resizePanes(r,a);else if(eH(t)){let[e,i]=this.findHit(t);eH(i)?t.presenter.view.setCursor(Q.Crosshair):eH(e)?e.isSelected?t.presenter.view.setCursor(Q.Move):t.presenter.view.setCursor(Q.Hand):t.presenter.view.setCursor(Q.Arrow)}else if(eH(s))eB(n.display.chart.zooming)[0]&&(r.setCursor(Q.ResizeVertical),this.performAxisScaling(r,s,a));else{if(this.prevZoomingOffset){let{x:e}=this.prevZoomingOffset,{x:t}=a;this.applyZoom(r.presenter,-(e-t)),this.prevZoomingOffset=a}r.setCursor(Q.ResizeHorizontal)}return!t||this.resizingPanes?this.hideCrosshairAndTooltips(r):(this.isLogoLink(a)&&r.setCursor(Q.Hand),this.showCrosshairAndTooltips(r,t,a)),eI()}showCrosshairAndTooltips(e,t,i){t.time&&(!eI()||this.touchCrosshairMode)&&e.drawCrosshair({ap:t,offset:i})&&e.presenter.showTooltip&&mb(e.presenter,{time:t.time,offset:i,price:t.price,lastBarRefresh:void 0,justMain:void 0})}hideCrosshairAndTooltips(e,t=!1){e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(t),t&&"cards"===e.tooltip.mode&&!e.presenter?.hasLegend&&mv(e.presenter)}onMouseLeave(e){let{view:t,offset:i}=e,s=t.presenter.accessor.getPaneBounds();s?.every(e=>!e.contains(i)||i.x===e.x||i.x===e.x+e.width||i.y===e.y||i.y===e.y+e.height)&&(this.hideCrosshairAndTooltips(t,!0),this.stopResizeZoom(t.presenter)),t.setCursor(Q.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),eI()){let t=function(){let e=yQ().config.touchCrosshairTimeoutMillis;return eH(e)&&Number.isFinite(e)?e:tG.LONG_PRESS_TIMEOUT_MILLIS}();this.touchCrosshairTimeout=window.setTimeout(()=>{this.hideCrosshairAndTooltips(e.view,!0),this.touchCrosshairMode=!1},t)}}applyZoom(e,t,i=!0){if(!eB(e.display.chart.zooming)[1])return;let s=Math.sign(t)*(eI()?2:10),r=e.view;r.xAxis.zoom(s)&&(r.setPriceAxesDomains(),r.redraw(),i&&this.fireZoomChanged(e))}onWheel({view:e,presenter:t,getModifier:i,delta:s}){let{scrollBehavior:r}=t.display;return!!(eI()?"none"!==r:"wheel"===r||"wheel+shift"===r&&i(et.Shift))&&0!==s&&(e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(),this.applyZoom(t,s),!0)}get useKeyboardShortcuts(){return yQ().config.hostingModel!==ea[ea.Application]}onKeyDown(e){let{key:t,code:i,presenter:s}=e;if(eH(s.selectedAnnotation)&&("Backspace"===t||"Delete"===t||8===i||46===i)){let e=s.selectedAnnotation;e.axis.deleteAnnotation(e),s.onAnnotationModifiedByTool(e,eo.Deleted)}if(eH(s.selectedAnnotation)&&(eD(t,i)?s.clearSelection():("F2"===t||113===i)&&s.selectedAnnotation instanceof ml&&s.selectedAnnotation.textEditable&&(s.activeTool=new mf(null,s.selectedAnnotation),s.activeTool.startEditing())),ew(t,i)||"ArrowRight"===t||39===i){let e=ew(t,i)?1:-1,r=s.view;r.xAxis.pan(e*r.xAxis.xScale.bar.totalWidth),r.redraw()}let r=window.navigator.platform.toLowerCase().startsWith("mac")?et.Meta:et.Control;if(e.getModifier(r)&&this.useKeyboardShortcuts){let e="z"===t||90===i,r="y"===t||89===i;return e&&s.undoRedoManager.undo(),r&&s.undoRedoManager.redo(),e||r}("r"===t||82===i)&&e.getModifier(et.Alt)&&this.resetView(s)}resetView(e){e.allAxes.forEach(e=>this.resetVerticalAxis(e,!1)),this.resetHorizontalAxis(e,!1),e.view.xAxis.goToLatest(!0)}resizePanes(e,t){let i=t.y-this.lastResizingOffset.y;if(0===i)return;let s=e.presenter.panes,[r,n]=this.splitter,a=s.map((e,t)=>{let s=e.getBounds().height;return t===r?s+i:t===n?s-i:s});if(a.some(e=>e<tG.MINIMUM_PANE_HEIGHT))return;let o=(e,t)=>e+t,l=a.reduce(o,0),u=s.map(e=>e.height).reduce(o,0);s.forEach((e,t)=>e.height=eF(a[t]/l*u,4)),this.lastResizingOffset=t,e.recalculateLayout(),e.redraw()}startAxisScaling(e,t){this.resizingScale=!0,this.resizingScaleId=e.id,this.lastScaleResizingOffset=t}performAxisScaling(e,t,i){if(this.resizingScale&&this.resizingScaleId===t.id){let s=eI()?4:5,r=function(e,t,i,s=1,r=-1){let n=(i.y-t.y)/10,a=e.yScale.rangeWithPadding().reverse();return[a[0]+n*s,a[1]+n*r].map(t=>e.yScale.yToPrice(t))}(t,this.lastScaleResizingOffset,i,s,-s);this.lastScaleResizingOffset=i,t.isCustomDomain=!0,t.yScale.domain(r),e.redraw()}}},gS=e=>g_(mN,m7,1,e),gv=e=>g_(mN,mu,1,e),gb={Default:()=>function(){return gA},Line:()=>g_(mc,mU,!1),DateRange:()=>g_(mc,gl,!1),PriceRange:()=>g_(mc,gu,!1),DatePriceRange:()=>g_(mc,gh,!1),GannBox:()=>g_(mc,gc,!1),GannSquare:()=>g_(mp,gf),Ray:()=>g_(mc,mU,!1),GannLine:()=>g_(md,mU,!1),VerticalLine:()=>g_(mN,mW,1),HorizontalLine:()=>g_(mN,m$,1),LongPosition:()=>g_(mN,gt,1,!0),ShortPosition:()=>g_(mN,gt,1,!1),FiftyPercentLine:function(e,t){return eH(e)?g_(mV,mG,e.axis||t.mainAxis,e):g_(mN,mG,2)},FibonacciRetracement:()=>g_(mc,mY,!1),TrendBasedFibExtension:()=>g_(mc,mj,!0),FibonacciFan:()=>g_(mc,mX,!1),FibonacciArcs:()=>g_(mc,m0,!1),FibonacciChannel:()=>g_(mc,gm,!0),GannFan:()=>g_(mc,m1,!1),SpeedResistanceFan:()=>g_(mc,m2,!1),SpeedResistanceArcs:()=>g_(mc,m3,!1),AndrewsPitchfork:()=>g_(mN,m4,3),Rectangle:()=>g_(mc,mx,!1),Ellipse:()=>g_(mc,m5,!1),TrendChannel:()=>g_(mc,m6,!0),SymbolArrowUp:()=>gS("arrow_up"),SymbolArrowDown:()=>gS("arrow_down"),SymbolArrowRight:()=>gS("arrow_right"),SymbolArrowLeft:()=>gS("arrow_left"),SymbolArrowHorizontal:()=>gS("arrow_horizontal"),SymbolArrowVertical:()=>gS("arrow_vertical"),SymbolArcDown:()=>gS("arc_down"),SymbolArcUp:()=>gS("arc_up"),SymbolThumbsUp:()=>gS("thumbs_up"),SymbolThumbsDown:()=>gS("thumbs_down"),SymbolZero:()=>gS("zero"),SymbolOne:()=>gS("one"),SymbolTwo:()=>gS("two"),SymbolThree:()=>gS("three"),SymbolFour:()=>gS("four"),SymbolFive:()=>gS("five"),SymbolSix:()=>gS("six"),SymbolSeven:()=>gS("seven"),SymbolEight:()=>gS("eight"),SymbolNine:()=>gS("nine"),SymbolQuestion:()=>gS("question"),SymbolFishHook:()=>gS("fish_hook"),SymbolBuy:()=>gS("buy"),SymbolSell:()=>gS("sell"),FibonacciTimeZones:()=>g_(mc,m8,!1),Text:()=>g_(mf,ml,null),PickPoint:()=>function(){return new m9},ZoomIn:()=>function(){return new mD},ProfitLoss:gv,RewardRisk:gv,VolumeAtPrice:function(e){return g_(mN,gg,2,e)},ProbabilityCones:function(e){return g_(mN,gT,2,e)}};function gP(e,t=!1,i=null,s=null,r=null){let n=gb[e];return(n=n(s,r))(e,t,i)}function gC(e,t={}){e.enableTooltip(!0),e.resetActiveTool();let{axis:i,annotation:s,toolChange:r,annId:n}=t;eH(i)&&e.onAnnotationsUpdated(i),eH(s)&&e.onAnnotationModifiedByTool(s,r),[eo.Cancelled,eo.Executed,eo.TextChanged].includes(r)&&e.onAnnotationDone(n,r)}function gE(e,t=!0,i=eo.None){e.wasModifiedByTool();let s=e.axis;gC(s.pane.presenter,t?{axis:s,annotation:e,toolChange:i}:void 0)}function g_(e,t,i,s){return function(r,n,a){let o=f7(r,t,s,a);return(o.annName=r,n)?o:new e(o,i)}}function gM(e){e.button===ee.Right&&gC(e.presenter)}function gL(e,t,i){let s={};s.source=an[e.source],s.inputs=ej(e.inputs);let r=void 0!==e.target,n=eH(i)?i:e.curves;return s.outFields=function(e){let t=[];for(let i of e)t.includes(i)||t.push(i);return t}(r?[an[e.target]]:n.map(e=>e.fields).flat()),s.target=r?an[e.target]:s.outFields[0],s.aggregation=t,s}class gx extends fK{model;basePlot;_hasEvents;_params;_shiftFmt;_title;range;shouldMaybePriceMap;annIndex;_canPriceMap;#e(e=3){let t=this.model.inputs||[],i=t.length;if(0===i)return"";let s="";i>e&&(t=t.slice(0,3),s=", ...");let r="AVWAP"===this.model.study;return 0===t.length?"":`(${t.map(e=>r&&"Anchor"===e.name?new Date(e.value).toLocaleString():e.value).join(", ")}${s})`}get params(){return eH(this._params)||(this._params=this.#e()),this._params}get fullParams(){return this.#e(Number.MAX_VALUE)}get shiftFmt(){if("PC"===this.model.study)return"";if(!eH(this._shiftFmt)){let e=this.curves.map(e=>Number(e.shift)).filter(e=>0!==e);this._shiftFmt=0===e.length?"":`[${e.join(", ")}]`}return this._shiftFmt}get title(){if(!eH(this._title)){let e=this.params,t=this.shiftFmt;this._title=`${this.model.study} ${e} ${t}`.trim()}return this._title}fromModel(e){this.model=e,super.fromModel(this.model)}getMetaData(){let e=sw(this.model.study),t=e.meta.decimals;this.metaData=void 0!==t?new it(t):this.basePlot.metaData,eH(e.meta.range)&&(this.range=e.meta.range)}getDetachedScaleMargins(){return"VOL"===this.model?.study&&this.axis?.pane.isMain?tG.VOLUME_DETACHED_SCALE_MARGINS:super.getDetachedScaleMargins()}applySpecifics(e){let t=this.model.study;!0===sw(t).meta.shiftable&&this.curves.forEach(t=>{Number.isFinite(e.inputs.Offset)&&(t.shift=e.inputs.Offset)});let i=(e,t,i)=>this.curves[e].zones[t].value=this.model.levels[i].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,i)=>e.visible=e.visible&&i<t);break}case"CRS":{let t="PercentChange"===e.inputs.Display;this.axis.comparison=t?K.Percent:K.None;break}case"PERF":{let t="VisibleStart"===e.inputs.Anchor;this.axis.comparison=t?K.Percent:K.None;break}case"JPI":case"CTTP":case"CTTI":{let t=eL(10,e=>(e+1)*.025),i=([e,i])=>[...t.map(t=>i_(t)(e)).reverse(),i,"#6a4a3a","#a000c8","#ffffff"];this.curves[0].colors=i(this.curves[0].colors),this.curves[1].colors=i(this.curves[1].colors);let s=this.curves[0].colors.length;this.curves[0].colors[s-1]=this.curves[1].colors[t.length],this.curves[1].colors[s-1]=this.curves[0].colors[t.length],this.shouldMaybePriceMap="Performance"===e.inputs.Height;break}case"RSI":case"RSIMOD":case"RSISTO":case"CCI":i(0,0,0),i(0,1,2);break;case"STC":i(0,0,0),i(0,1,1);break;case"RVOL":case"DPO":case"COPP":i(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,eH(this.annotations)||(this.annotations=[]);let t=this.curves[1],i=this.curves[2],s=gP("VolumeAtPrice",!0,{[tG.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[tG.AT_FILL]:{color:this.curves[0].colors[0]},[tG.AT_FILL2]:{color:this.curves[0].colors[1]},[tG.AT_FILL3]:{color:this.curves[0].colors[2]},[tG.AT_FILL4]:{color:i.colors[0]},[tG.AT_FILL5]:{color:i.colors[1]},[tG.AT_FILL6]:{color:i.colors[2]}},this.id)(this.axis,!1);s.setOptions(e.inputs),this.annIndex=this.annotations.push(s)-1;break}case"PVACP":{this.customPlotValues=!0,eH(this.annotations)||(this.annotations=[]);let t=this.curves[1],i=this.curves[2],s=this.curves[3],r=gP("VolumeAtPrice",!0,{[tG.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[tG.AT_FILL]:{color:this.curves[0].colors[0]},[tG.AT_FILL2]:{color:this.curves[0].colors[1]},[tG.AT_FILL3]:{color:this.curves[0].colors[2]},[tG.AT_FILL4]:{color:i.colors[0]},[tG.AT_FILL5]:{color:i.colors[1]},[tG.AT_FILL6]:{color:i.colors[2]},[tG.AT_FILL7]:{color:s.colors[0]}},this.id)(this.axis,!1);r.setOptions(e.inputs),this.annIndex=this.annotations.push(r)-1;break}case"IVRANK":{let t=an.ImplVolRank1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=an.ImplVolRank5D;break;case"1-Month":t=an.ImplVolRank1M;break;case"3-Month":t=an.ImplVolRank3M;break;case"6-Month":t=an.ImplVolRank6M;break;case"YTD":t=an.ImplVolRankYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"IVPCTL":{let t=an.ImplVolPerc1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=an.ImplVolPerc5D;break;case"1-Month":t=an.ImplVolPerc1M;break;case"3-Month":t=an.ImplVolPerc3M;break;case"6-Month":t=an.ImplVolPerc6M;break;case"YTD":t=an.ImplVolPercYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"OPTIV":{let t=[an.WeighImplVolHigh,an.WeighImplVol,an.WeighImplVolLow];switch(e.inputs.TimeFrame){case"1-Day":default:break;case"5-Day":t=[an.WeighImplVolHigh5D,an.WeighImplVol5D,an.WeighImplVolLow5D];break;case"1-Month":t=[an.WeighImplVolHigh1M,an.WeighImplVol1M,an.WeighImplVolLow1M];break;case"3-Month":t=[an.WeighImplVolHigh3M,an.WeighImplVol3M,an.WeighImplVolLow3M];break;case"6-Month":t=[an.WeighImplVolHigh6M,an.WeighImplVol6M,an.WeighImplVolLow6M];break;case"1-Year":t=[an.WeighImplVolHigh1Y,an.WeighImplVol1Y,an.WeighImplVolLow1Y];break;case"YTD":t=[an.WeighImplVolHighYTD,an.WeighImplVolYTD,an.WeighImplVolLowYTD]}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),eH(this.annotations)||(this.annotations=[]);let i=this.curves[11],s=this.curves[12],r=gP("ProbabilityCones",!0,{[tG.AT_LINE]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle},[tG.AT_LINE_2]:{color:s.colors[0],width:s.lineWidth,dashStyle:s.dashStyle}},this.id)(this.axis,!1);r.setOptions(e.inputs),this.annIndex=this.annotations.push(r)-1}}}getValueAt(e,t,i){return this.isVolAP?this.annotations[this.annIndex].getValueAt(e,t,i):super.getValueAt(e,t,i)}getColorOf(e){if(!this.isVolAP)return null;let t=this.curves[0].colors;switch(e){case an.UPVOL:return t[1];case an.DNVOL:return t[0];case an.TOTVOL:return t[2];case an.POC:case an.VAREA:case an.BARBACK:return tG.COLOR_TRANSPARENT;default:throw Error("Unexpected Volume At Price field")}}isEmpty(){return!this.isVolAP&&super.isEmpty()}setCurveAttributes(e,t){let i=t=>this.curves[e].attributes=[U[t]];switch(t){case"LikeMain":{let t=this.axis.pane.presenter.mainPlot.curves[0].attributes,s=yQ().config.defaultVolumeBarColoring;eH(t)?this.curves[e].attributes=[t[0]]:i(eH(s)?"OpenToClose"===s?"OpenVsClose":"ChangeBased":"OpenVsClose");break}case"OpenToClose":i("OpenVsClose");break;case"CloseToClose":i("ChangeBased");break;default:throw Error(`Unexpected bar coloring choice: ${t}`)}}get hasEvents(){return this._hasEvents}get eventsSeries(){return this.timeSeries}doesSeriesEmitEvents(){let e=this.timeSeries.helpers;return e.includes(an.Buy)||e.includes(an.Sell)}getEventFor(e){switch(e){case an.Buy:return{show:!0,title:"B",color:"#03c03c"};case an.Sell:return{show:!0,title:"S",color:"#c23b22"};default:return null}}getEventFields(){return this.hasEvents?[an.Buy,an.Sell]:[]}async initialize(){if(this.model.basis!==tG.BASIS_MAIN)throw Error("Studies can currently only be based on the main (symbol) plot");return tU.call(this,async()=>{this.basePlot=this.axis.pane.presenter.mainPlot,await this.basePlot.initialize(),this.getMetaData();let e=this.axis.pane.presenter.data.aggregation,t=gL(this.model,e,this.curves);this.applySpecifics(t);let i=this.basePlot.timeSeries;i instanceof co&&(i=i.actual),this.timeSeries=ft(this.model.study,t,i),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;let s=this.title,r=this.basePlot.timeSeries instanceof uU;return this.timeSeries.ready().then(e=>{e||r||this.timeSeries.computedServerSide||yj(`Unable to calculate study values for ${s}`,"error")}),!0})}get isJpi(){return["JPI","CTTP","CTTI"].includes(this.model.study)}get isVolAP(){return"VOLAP"===this.model.study||"PVACP"===this.model.study}invalidateAssociatedAnnotations(e){this.isVolAP&&this.annotations[this.annIndex].invalidate(e)}onPriceDomainsUpdated(){this.invalidateAssociatedAnnotations("PriceDomainsChanged")}shouldPriceMap(e){return this.isJpi?!!this.shouldMaybePriceMap&&(e.id===an.JPIB.id||e.id===an.JPIS.id):super.shouldPriceMap(e)}canPriceMap(e,t){if(!this.isJpi)return super.canPriceMap(e,t);this._canPriceMap=e>0}priceMap(e,t,i){if(!this.isJpi)return super.priceMap(e,t,i);if(t>this.visToIndex)return e;let s=(e,t)=>this.timeSeries.container.getData(e)[t],r=s(an.JPIB,t),n=s(an.JPIS,t);if(null===r&&i.id===an.JPIB.id||null===n&&i.id===an.JPIS.id)return null;let a=0,o=this.visFromIndex,l=this.timeSeries.helpers[0],u=this.timeSeries.helpers[2];for(;o<=t;)a+=1===s(u,o)?0:s(l,o),o++;return a}}let gO=[an.Open,an.High,an.Low,an.Close,an.Volume];class gI extends fK{_expression;exprModel=null;symbols=null;errorText;get title(){return this.expression}get expression(){return this._expression}async parseExpression(){let e=nH(this._expression);if(this.exprModel=null,this.symbols=null,nV(e))this.errorText=e.error;else{let{model:t,clean:i,symbols:s}=e;this.errorText=void 0,this.symbols=s,this.exprModel=t,this._expression=i}}get isValid(){return!eH(this.errorText)}#t(e){return{mapper:e=>e.query.symbol,loadMoreData:!0,recompute:F.Minimum,missing:H.UseNext,stretch:e=>!1,fieldMap:new Map(gO.map(e=>[e,e])),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:e}}getTimeSeries(){let e=this.getInnerSeries(),t=this.axis?.pane.presenter.data?.exprSkipLeadingEmpty??!1,i=new pa(this.exprModel,e,this.#t(t));this.timeSeries=this.wrapIfAdvancedStyle(i);let s=this.title;this.timeSeries.ready().then(e=>{e||yj(`Unable to calculate expression: ${s}`,"error")})}getInnerSeries(){let e=nU(this.exprModel),t=yQ().getTimeSeriesDataSource();return e.map(e=>{let i=this.makeQuery();return i.symbol=e,t.getTimeSeries(i)})}getRecord(){if(eH(this.errorText))return;let e=this.metaData.inner.map(e=>[e.symbol,e.resolved]);this.record=new ab(e,eG(this.exprModel)),this.record.ready().then(e=>e)}getMetaData(){this.isValid&&(this.metaData=new is(this.symbols),this.metaData.ready().then(e=>{e&&(this.getRecord(),this.presenter?.notifyHost(aa.MD_CHANGED,{plot:this}))}))}fromModel(e){super.fromModel(e),this._expression=e.expression}async initialize(){return tU.call(this,async()=>(await this.parseExpression(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class gD extends fK{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),this.offset=e.offset,this._forward=e.forward}async parseForward(){let e=nH(this.forward),t=nV(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=` (${ec(uf(this.offset),lD(tG.FMT_US_DATE_ONLY))(new Date)})`,this.outField=new ai(`Close_${this.offset}`,z.Number,j.Forward,`Close (${this.offset})`),this.curves[0].fields[0]=this.outField):(this.suffix="",this.outField=an.Close);let{yes:t,no:i}=eT(e.symbols,e=>tg(`${e}*1`)),s=(await Promise.all(t.map(e=>tM(e)))).map(e=>e.map(e=>e.name));this.roots=t.reduce((e,t,i)=>(e[t]=s[i],e),{}),this.symbols=i}}get isValid(){return!eH(this.errorText)}getMetaData(){if(this.isValid){let e=Object.values(this.roots).flat();this.metaData=new is(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(aa.MD_CHANGED,{plot:this})})}}getForwardPolicy(e){return{mapper:e=>e.query.root,loadMoreData:!1,recompute:F.Everything,missing:H.UseNext,stretch:e=>!1,fieldMap:new Map([[an.Close,this.outField]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1,valueProvider:e}}getTimeSeries(){let e=yQ().getTimeSeriesDataSource(),t=Object.keys(this.roots),i=0===this.offset?Z.Forward:Z.HistoricalForward,s=t.map(t=>{let s={seriesKind:i,root:t,offset:this.offset,symbols:this.roots[t],getHashKey:()=>`${i}|${t}|${this.offset}`};return e.getTimeSeries(s)}),r=this.symbols.length>0?new uj(this.symbols):void 0;this.timeSeries=new pa(this.fwdModel,s,this.getForwardPolicy(r)),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:er.Unspecified};this.presenter?.notifyHost(aa.TS_MANYCHANGED,e)}})}async initialize(){return tU.call(this,async()=>(await this.parseForward(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}let gw=e=>e.substr(0,e.lastIndexOf("::"));class gR extends fK{isAverage;hasComputation;offset;offsets;useInAverage;usesInAverage;_seasonal;symbolToOffset;errorText;seaModel=null;isPlain=!1;isFutures=!1;suffix="";outField;symbols;coreModel;coreHasComputation;get title(){return this.isAverage?"Average":!this.hasComputation&&(this.symbols?.length??0)>0?this.outField.name:`${this.seasonal}${this.suffix}`}get seasonal(){return this._seasonal}fromModel(e){super.fromModel(e),this.offset=e.offset,this.offsets=e.offsets,this.useInAverage=e.useInAverage,this.usesInAverage=e.usesInAverage,this.isAverage=!eH(e.offset),this._seasonal=e.seasonal}constructSeasonal(e,t){return nB(n$(e,e=>this.applyOffset(e,t)))}constructAverage(e,t=null){let i=null===t?null:t.map(e=>this.symbolToOffset[e]),s=null===i,r=this.offsets.filter((e,t)=>{let r=!!s||i.includes(e),n=this.usesInAverage[t];return r&&n}).map(t=>`(${this.constructSeasonal(e,t)})`);return`(${r.join("+")})/${r.length}`}prepareFields(){let e=this.isPlain?`${this.yearFromOffset(this.offset)}`:`${this.offset}Y`,t=this.isAverage?"Avg":e;this.suffix=0===this.offset?"":` (${t})`,this.outField=new ai(`Close_${t}`,z.Number,j.Seasonal,`Close${this.suffix}`),this.curves[0].fields[0]=this.outField}applyOffset(e,t){let i=this.isPlain?e:function(e,t){let i=tg(e),s=tS(e),r=tT(e);if(i)return tx(e,t);if(s){let i=tA.exec(e),s=Number.parseInt(i[2]),r=tu(tr(new Date(s+(s>79?1900:2e3),0,1),t));return`${i[1]}${tb(r)}${i[3]}`}if(!r)return null;{let i=e.match(ty),s=tx(i[1],t),r=tx(i[2],t);return`_S_SP_${s}_${r}`}}(e,-t);return`${i}::${t}`}createSymbolToOffsetMapping(e){this.symbolToOffset={},e.forEach(e=>{this.offsets.forEach(t=>{this.symbolToOffset[this.applyOffset(e,t)]=t})})}async parseSeasonal(){let e=nH(this.seasonal,!0),t=nV(e),i=e=>(this.errorText=e,this.seaModel=null,null);if(t)return i(e.error);let{model:s,symbols:r}=e;this.prepareFields();let n=new Map;for(let e of r){let t=tP(await tf(e));n.set(e,t)}s=n$(s,e=>n.get(e));let a=(r=Array.from(n.values())).every(e=>tg(e)||tT(e)),o=r.every(e=>tS(e)),l=r.every(e=>!tg(e)&&!tS(e)&&!tT(e));if(!a&&!o&&!l)return i("Mixed types of symbols aren't supported yet");this.isPlain=l,this.isFutures=a,this.createSymbolToOffsetMapping(r),this.coreModel=this.isAverage?s:null,this.coreHasComputation=nW(s);let{model:u,symbols:h}=nH(this.isAverage?this.constructAverage(s):this.constructSeasonal(s,this.offset),!0);this.seaModel=u,this.hasComputation=nW(u),this._seasonal=nB(n$(u,gw)),this.symbols=h,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!eH(this.errorText)}getActualSymbols(){return[...new Set(this.symbols.map(gw))]}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){let e=gw(this.symbols[0]);if(this.isPlain)return`${e} ${new Date().getFullYear()-this.offset}`;if(this.isFutures)return tP(e,!0)}return this.title}getMetaData(){if(this.isValid){let e=this.getActualSymbols(),t=1===e.length&&!this.hasComputation&&!this.isAverage,i=yQ().getMetaDataSource();this.metaData=t?i.getMetaData(e[0]):new is(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(aa.MD_CHANGED,{plot:this})})}}getNoDataApproach(){return this.isAverage&&!this.coreHasComputation?k.ModelTransformRequired:this.hasComputation?k.NoAction:k.IgnoreTimelineOnly}get seasonalPolicy(){return{mapper:e=>e.query.surrogate||e.query.symbol,loadMoreData:!1,recompute:F.Everything,missing:this.hasComputation||this.useInAverage?H.UsePrevious:H.UseNone,stretch:e=>this.shouldStretch(e),fieldMap:new Map([[an.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(e,t)=>0===t.length?this.seaModel:nH(this.constructAverage(this.coreModel,e)).model,skipLeadingEmpty:!1}}shouldStretch(e){return 0===this.symbolToOffset[e]&&(this.isAverage&&this.symbols.length>1||this.offset>0)}shiftYears(e){return tr(new Date,-e)}yearFromOffset(e){return tu(this.shiftYears(e))}getCmdtyRange(e){let t=this.shiftYears(e);return[tn(t),function(e){te(1,arguments);var t=ti(e),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}(t)]}getTimeSeries(){if(!this.isValid)return;let e=yQ().getTimeSeriesDataSource(),t=Object.keys(this.symbolToOffset).map(t=>{let i=this.makeQuery();return i.surrogate=t,i.symbol=gw(t),i.offset=this.symbolToOffset[t],i.cacheMe=!this.isPlain||0===i.offset,this.isPlain&&(i.range=this.getCmdtyRange(i.offset)),this.isFutures&&i.offset>0&&eH(...i.range)&&(i.range=i.range.map(e=>tr(e,-i.offset))),i.offset>0&&(i.disableStreamingUpdates=!0),e.getTimeSeries(i)});this.timeSeries=new pa(this.seaModel,t,this.seasonalPolicy),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:er.Unspecified};this.presenter?.notifyHost(aa.TS_MANYCHANGED,e)}})}async initialize(){return tU.call(this,async()=>(await this.parseSeasonal(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}let gN=["bottom","right","left"],gV={bottom:"center",right:"start",left:"end"};class gH{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,i,s,r,n){let a=eH(r);if(n=n||this.fontSize+this.padding+this.padding+(a?this.padding:0),!gN.includes(this.position.toLowerCase()))return void console.error(`Can not draw indicator in position [${this.position}]`);e.font=`bold ${this.fontSize}px ${this.fontFamily}`,e.textAlign=gV[this.position],e.strokeStyle=this.strokeColor,e.fillStyle=ib(this.backgroundColor),e.lineWidth=this.lineWidth;let o=Math.round(Math.max(...[s,r??""].map(t=>e.measureText(t).width))+("bottom"!==this.position?this.arrowLength:0)+this.padding+this.padding),l=Math.round(o/2),u=Math.round(n/2);e.setLineDash([]),e.beginPath(),e.moveTo(t,i);let h=i+u,c=i+2*u,d=i-u;if("right"===this.position){e.lineTo(t,h);let i=t+o;a&&(e.lineTo(t,c),e.lineTo(i,c)),e.lineTo(i,h),e.lineTo(i,d),e.lineTo(t,d)}else if("left"===this.position){e.lineTo(t,h);let s=t-o;a&&(e.lineTo(t,c),e.lineTo(s,c)),e.lineTo(s,h),e.lineTo(s,d),e.lineTo(t,i-u)}else if("bottom"===this.position){let s=t-l,r=t+l;e.lineTo(t,i),e.lineTo(r,i),e.lineTo(r,i+n),e.lineTo(s,i+n),e.lineTo(s,i),e.lineTo(t,i)}if(e.closePath(),e.stroke(),e.fill(),e.fillStyle=this.textColor,e.textBaseline="middle","bottom"===this.position)e.fillText(s,t,i+iH(e,1));else if("right"===this.position){let n=t+this.arrowLength+this.padding;e.fillText(s,n,i),a&&e.fillText(r,n,i+this.padding+u)}else if("left"===this.position){let n=t-this.arrowLength-this.padding;e.fillText(s,n,i),a&&e.fillText(r,n,i+this.padding+u)}}}let gF=(e,t)=>e-1-t-4,gk=(e,t)=>e+1+t+4,gB=Array.from(Array(6),(e,t)=>++t).reverse();function gU(e){return e.curves.filter(t=>t.visible&&(e.type!==X.Study||t.style!==W.Ribbon)).map(t=>{let i=t.pickMainField(),[s,r]=function(e,t){let i=e.timeSeries.container;if(null===i||i.size<1)return[null,-1];let s=i.getLastDataPoint(t),r=i.getData(t),n=r.length-1,a=e.type===X.Study&&["JPI","CTTP","CTTI"].includes(e.model.study);return null!=s||a||(s=-1!==(n=eA(r,e=>null!==e))?r[n]:null),[s,n]}(e,i);return{value:s,color:function(e){let t=e.plot.timeSeries.container;return null===t||t.size<1?null:e.getColor(t.size-1)}(t),field:i,index:r}})}class gW{pane;annotations;id;isCustomDomain;primary;onTheRight;viewBox;plots;comparison;scale;yScale;label;crosshairIndicator;ticks;lastUsedOptions;config;_fullDomain;constructor(e){this.pane=e,this.annotations=[],this.isCustomDomain=!1,this.primary=!1,this.onTheRight=!0,this.plots=[],this.label="",this.id=e0(),this.ticks=null,this.lastUsedOptions=null;let{chart:{fontSize:t},yAxis:{fontSize:i}}=this.pane.presenter.display;this.config={innerTickSize:7,tickPadding:5,indicatorPadding:4,fontWeight:400,fontSize:i||t||12},this.crosshairIndicator=new gH({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}makePlot(e){let t=null;switch(X[e.type]){case X.Symbol:t=new fq;break;case X.Expression:t=new gI;break;case X.Study:t=new gx;break;case X.IncomeStatement:t=new fX(Z.IncomeStatement);break;case X.BalanceSheet:t=new fX(Z.BalanceSheet);break;case X.Forward:t=new gD;break;case X.Seasonal:t=new gR;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===K.None?t:this.pane.presenter.mainPlot.priceMap(t,void 0,an.Close,!0)}toTime(e){return this.pane.presenter.view.toTime(e)}toAnnotationPoint(e){return new f2(this,this.toPrice(e.y),this.toTime(e.x)||void 0)}toX(e){return this.pane.presenter.view.toX(e)}priceMap(e){return this.comparison===K.None?e:this.pane.presenter.mainPlot.priceMap(e,void 0,an.Close)}toY(e){let t=this.priceMap(e);return this.yScale.priceToY(t)}get plotAnnotations(){let e=[];return this.plots.forEach(t=>{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)},i=this.pane.presenter,s=i.activeTool,r=s.annotation;return s.alignPointsMode&&r&&r.alignPointsSupported&&r.points.includes(e)?this.alignPoints(r,e,t):s.snapToSupported&&i.display.yAxis.snapAnnotationsToPrices&&!e.passive&&(e.moveDirection===ei.Both||e.moveDirection===ei.Vertical)&&this.snapToPrices(e,t),t}snapToPrices(e,t){let i=this.plots.find(e=>e.main);if(i&&i.timeSeries&&i.timeSeries.hasData){let s=i.timeSeries.container,r=e_(s.getTimeData(),+e.time,Number),n=[].concat(...i.curves.map(e=>e.fields)).filter(e=>s.hasField(e)).map(e=>{let i=s.getData(e)[r],n=this.toY(i),a=Math.abs(n-t.y);return{priceSnap:i,ySnap:n,dist:a}}).filter(e=>e.dist<=tG.SNAP_PROXIMITY_PIXELS).reduce((e,t)=>null===e||t.dist<e.dist?t:e,null);eH(n)&&(e.price=n.priceSnap,t.y=n.ySnap,e.time=s.getTimeData()[r],t.x=this.toX(e.time))}}alignPoints(e,t,i){let s=e.points.find(e=>e!==t);if(t!==s&&s&&s.point){let e=s.point,r=(360+-(180*iA(e,i))/Math.PI)%360;if(r>337.5||r<22.5||r>157.5&&r<202.5)i.y=e.y,t.price=this.toPrice(i.y);else if(r>67.5&&r<112.5||r>247.5&&r<292.5)i.x=e.x,t.time=this.toTime(i.x);else{let s=Math.abs(i.x-e.x),r=e.y>i.y?-1:1;i.y=e.y+s*r,t.price=this.toPrice(i.y)}}}toPoint(e){if(eH(this.pane.presenter.view))return this.snapTo(e)}makeAnnotation(e,t=!0){let i=gP(e.id,!0,e.traits)(this,!1);t&&e.uid&&(i.uid=e.uid);let s=i.activePoints,r=e.points.length-s.length;return r>0&&i.addPoints(r),i.activePoints.forEach((t,i)=>{let s=e.points[i];ek(s.price)&&ek(s.time)&&t.update(s.price,s.time)}),i.visible=e.visible,i.locked=e.locked,i}expand(e){let t=[];switch(e.type){case"Forward":{let i=e.curves,s=e.offsets;delete e.curves,delete e.offsets;for(let r=0;r<i.length;r++){let n=Object.assign({},e);n.curves=[i[r]],n.offset=s[r],t.push(n)}break}case"Seasonal":{let i=e.curves,s=e.offsets,r=e.usesInAverage??[],n=s.map((e,t)=>r[t]??!0);delete e.curves,delete e.offsets,delete e.usesInAverage;let a=s.length;for(let r=0;r<i.length;r++){let o=Object.assign({},e);o.curves=[i[r]],o.offsets=s,o.offset=r===a?null:s[r];let l=!eH(o.offset);o.useInAverage=!l&&(n[r]??!0),o.usesInAverage=n,(!l||a>1)&&t.push(o)}break}default:t.push(e)}return t}fromModel(e){this.comparison=K[e.comparison??"None"],this.scale=q[e.scale??"Linear"],this.yScale=new fW(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:i,backgroundColor:s},yAxis:{textColor:r,crosshair:{color:n},primaryOnTheLeft:a}}=this.pane.presenter.display,o=a??!1;this.onTheRight=this.primary&&!o||!this.primary&&o,this.crosshairIndicator.configure({position:this.onTheRight?"right":"left",fontFamily:i,strokeColor:n,textColor:r,backgroundColor:i_(.15)(s)})}findIndex(e){return this.annotations.findIndex(t=>t.uid===e.uid)}addAnnotation(e){let t=this.makeAnnotation(e,!0);this.appendAnnotation(t),t.requestRedraw(),this.fireAnnotationsChanged()}appendAnnotation(e){-1===this.findIndex(e)&&this.annotations.push(e)}fireAnnotationsChanged(e=!1){this.pane.presenter.onAnnotationsUpdated(this,e)}deleteAnnotation(e,t=!0){e.isSelected&&this.pane.presenter.clearSelection();let i=this.findIndex(e);-1!==i&&this.annotations.splice(i,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,i=this.makeAnnotation(e.toModel(),!1);i.drawPoints(null,!0),i.offset({x:tG.ANN_DUPLICATE_OFFSET,y:tG.ANN_DUPLICATE_OFFSET}),t.appendAnnotation(i),i.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(e,t){e.isSelected&&this.pane.presenter.clearSelection(),s7(e.name,t.traits),e.updateFrom(t.traits,t.extras,t.isUndoRedo?null:t.points,t.visible,t.locked),t.isUndoRedo&&eH(t.points)&&e.updateActivePoints(t.points),t.isUndoRedo||this.pane.presenter.undoRedoManager.done(f4(e,eo.Moved)),e.requestRedraw(),this.fireAnnotationsChanged()}setViewBox(e){this.viewBox=e;let{y:t,height:i}=this.viewBox;this.yScale.range([Math.floor(t),Math.floor(t+i)]),this.plots.forEach(t=>t.setViewBox(e))}get fullDomain(){return eH(this._fullDomain)||(this._fullDomain=this.getDataDomain().domain),this._fullDomain}updateFullDomain(e=null){if(null===e&&this.comparison!==K.None)return;let t=this.fullDomain;this._fullDomain=this.getDataDomain([e,e],t).domain}getPlotDataDomain(e,t,i){let s=e.timeSeries;if(!s.hasData)return{domain:null};let r=s.container,n=r.getTimeData(),a=e=>e_(n,+e,Number),o=eH(t),l=o?a(t):0,u=eH(i),h=u?a(i):n.length-1,c=e.curves.map(e=>e.fields).flat().filter(e=>e.id!==an.Change.id),d=eH(e.targetFields);d&&c.push(...e.targetFields);let p={},f=t=>{let[i,s]=(t=>{let i=d?e.curves[0]:e.curves.find(e=>e.fields.includes(t));if(!eH(i)||0===i.shift)return[l,h];if(!eH(p[i.id])){let e=i.shiftedTimeDomain;if(!eH(e))return[l,h];p[i.id]=[a(e[0]),a(e[1])]}return p[i.id]})(t),n=r.getData(t),o=Math.max(i,0),u=Math.min(n.length-1,s);return n.slice(o,u+1).map((i,s)=>e.priceMapper(i,s,t))},m=[null,null],g=e=>e.id,y=new Set(ev(r.fields,c,g).map(g));e.curves.filter(e=>e.visible).map(e=>{let t=e.fields.filter(e=>y.has(e.id));e.isStackedColumn?ex(eM(t.map(e=>f(e)).reduce((e,t)=>t.map((t,i)=>(e[i]||0)+(t||0)),[])),m):t.map(e=>{ex(eM(f(e)),m)})});let T=el.None,A=[W.Column,W.MultiColumn,W.StackedColumn];if(o&&u&&!e.main&&e.curves.some(e=>A.includes(e.style))){let e=m[0]>0,t=m[1]<0;e?(T=el.Min,m[0]=0):t&&(T=el.Max,m[1]=0)}return{domain:m,clamped:T}}getDataDomain([e,t]=[null,null],i=[null,null]){let s=eG(i),r=!1;for(let i of this.plots.filter(e=>!e.hasDetachedScale)){let{domain:n,clamped:a}=this.getPlotDataDomain(i,e,t);eH(n)&&(ex(n,s),r=r||a!==el.None)}if(!eH(s))return{domain:null};let[n,a]=s;if(!eH(n,a))return{domain:null};let o=[Number(n),Number(a)];o[0]===o[1]&&(o[0]-=1,o[1]+=1);let l=el.None;return r&&(0===o[0]?l=el.Min:0===o[1]&&(l=el.Max)),{domain:o,clamped:l}}setDomain(){let e=this.pane.presenter,t=e.view.xAxis.xScale.domain();if(!eH(t))return;for(let e of this.plots.filter(e=>e.hasDetachedScale)){let{domain:i}=this.getPlotDataDomain(e,t[0],t[1]);eH(i)&&e.yScale.domain(i)}if(this.isCustomDomain)return;let{domain:i,clamped:s}=this.getDataDomain(t);if(this===e.mainAxis&&e.mainPlot?.showPrevious){let t=e.mainPlot.getPreviousValue(),s=e$(e.display,!1,"chart","previous","forceVisible");eH(t,i)&&s&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],t))}if(this.yScale.domain(i),eH(i)){let e=this.getPadding(s);eH(e)&&this.yScale.padding(e)}}getInitialPadding(){let e=tI(this.pane.presenter.hostElement),t=tw(`#${tG.HEADER_SIZE_PLACEHOLDER_ID}`,e);if(!eH(t)){tR(t=tF(e,"div"),{display:"none"}),tN(t,{id:tG.HEADER_SIZE_PLACEHOLDER_ID,class:"bcharts-card bcharts-card-first"});let{lineHeight:i}=getComputedStyle(t);isNaN(Number.parseFloat(i))&&tR(t,{lineHeight:"120%"})}let{paddingTop:i,paddingBottom:s,marginTop:r,lineHeight:n}=getComputedStyle(t),a=this.pane.isMain?r:"0";return"cards"!==this.pane.presenter.display.tooltip.mode?Number.parseFloat(a):[i,s,a,n].map(Number.parseFloat).reduce((e,t)=>e+t,0)+tG.CARDS_Y_OFFSET}getPadding(e){let t=this.pane.presenter,i=t.display,s=e$(i,null,"yAxis","minPaddingPercent"),r=e$(i,null,"yAxis","maxPaddingPercent"),n=eH(s),a=eH(r),o=n||a?0:this.getInitialPadding(),l=n?s:tG.PANE_CAP_MIN_PADDING_PERCENT,u=a?r:tG.PANE_CAP_MAX_PADDING_PERCENT,h=l*this.viewBox.height,c=[a?u*this.viewBox.height:Math.max(h,Math.min(u*this.viewBox.height,o)),h];e===el.Max?c[0]=tG.PANE_TINY_PADDING_PIXELS:e===el.Min&&(c[1]=tG.PANE_TINY_PADDING_PIXELS);let d=t.mainPlot;return d&&d.hasEvents&&(c[0]+=3*t.view.getEventRadius()),c}clearTicks(){this.ticks=null}getTicks(e,t=0){let{height:i}=this.viewBox,s=iH(e,1.3),r={height:i,approxLineHeight:s,domain:this.yScale.domain()};if(eH(this.ticks)&&eH(r.domain)&&eH(this.lastUsedOptions)&&eH(this.lastUsedOptions.domain)&&r.height===this.lastUsedOptions.height&&r.approxLineHeight===this.lastUsedOptions.approxLineHeight&&r.domain[0]===this.lastUsedOptions.domain[0]&&r.domain[1]===this.lastUsedOptions.domain[1])return this.ticks;this.lastUsedOptions=r;let n=Math.floor((i+40)/(s+40)),a=this.yScale.getTicks(n),o=e$(yQ().config,null,"overrides","yAxis","tickProvider");if(eH(o)&&"function"==typeof o&&r.height>0&&eH(r.domain)){let e=eG(r);e.autoTicks=eG(a),a=o(e)}let{innerTickSize:l,tickPadding:u,fontSize:h}=this.config,c=null,d=this.yScale?.checkTicks(),p=d?30:40;return this.ticks=a.map(i=>{let s=Math.round(this.yScale.priceToY(i)),r=Math.abs(s-(c??s));if(d&&null!==c&&r<p)return null;c=s;let n=hg(this,i),a=e.measureText(n).width,o={x1:0,x2:0,y1:s,y2:s,dy:0,label:n,labelX:0,labelY:s+.32*h};return this.onTheRight?(o.x1=t,o.x2=o.x1+l,o.labelX=o.x2+a+u):(o.x1=t-l,o.x2=o.x1+l,o.labelX=o.x1-u),o}).filter(e=>null!==e),this.ticks}widthNeeded(e){if(!eH(this.fullDomain))return tG.DEFAULT_PRICE_AXIS_WIDTH;e.save();let{fontWeight:t,fontSize:i}=this.config,{chart:{fontFamily:s}}=this.pane.presenter.display;e.font=`${t} ${i}px ${s}`;let r=t=>e.measureText(hg(this,t,!0)).width,n=Math.max(...this.fullDomain.map(r)),{innerTickSize:a,tickPadding:o}=this.config,l=eH(this.label)?iH(e,1.6):0;return e.restore(),n+a+2*o+l}draw(e){let{chart:{fontFamily:t},yAxis:{gridLines:i,textColor:s,visible:r}}=this.pane.presenter.display;if(!r||!this.viewBox)return;e.save();let{x:n,y:a,width:o,height:l}=this.viewBox,{fontWeight:u,fontSize:h}=this.config;if(iI(e,this.viewBox),e.font=`${u} ${h}px ${t}`,e.lineWidth=2,e.strokeStyle=i.color,e.textAlign="end",eH(this.label)){e.save(),e.fillStyle=iE(.4)(s),e.translate(0,0);let t=this.onTheRight?1:-1;e.rotate(t*Math.PI/2),e.textAlign="center";let i=iH(e),r=t*(a+l/2);this.onTheRight?e.fillText(this.label,r,-(n+o-i)):e.fillText(this.label,r,n+i),e.restore()}let c=this.onTheRight?n:o;e.setLineDash([]),iz(e,c,a,a+l);let d=this.getTicks(e,c);this.drawTicks(e,d,s),this.drawPriceAdornments(e),e.restore()}drawTicks(e,t,i){t&&(e.fillStyle=i,t.forEach(t=>{e.fillText(t.label,t.labelX,t.labelY+t.dy)}))}drawCrosshairIndicator(e,t){if(0===this.plots.length||!this.pane.presenter.display.yAxis.crosshair.enabled)return;let i=this.onTheRight?this.viewBox.x:this.viewBox.width,s=hg(this,this.yScale.yToPrice(t));this.crosshairIndicator.draw(e,i,t,s)}get indicatorHeight(){return this.config.fontSize+this.config.indicatorPadding+this.config.indicatorPadding}drawPriceAdornments(e){var t;let i=this.pane.presenter,{chart:{fontFamily:s,previous:r},yAxis:{showLastValue:n,preventLabelOverlap:a,includePercentChangeWithLastValue:o}}=i.display,l=i.view,u=[],h=(e,t,i,s,r,n)=>{if(null!=t){let a,l=t;t=e.priceMapper(t,n,r);let h=e.is(X.Symbol)||e.is(X.Expression);if(o&&h){let t=e.axis.comparison===K.Percent?K.None:K.Percent;a=e.priceMapper(l,n,r,t)}let c=e.hasDetachedScale?e.metaData.format(t,r):void 0,d=eH(a)?1:2;u.push({y:e.priceToY(t),formattedValue:c,value:t,auxValue:a,color:i,halfHeight:Math.round(this.indicatorHeight/d),priority:s})}};this.plots.forEach(e=>{if(e.timeSeries&&e.timeSeries.hasData){if("All"===n||"Main"===n&&e.main){let t=e.main?1:3;gU(e).filter(e=>null!=e.value&&-1!==e.index).forEach(i=>h(e,i.value,i.color,t,i.field,i.index))}e.showPrevious&&h(e,e.getPreviousValue(),r.color,2,an.PreviousClose,void 0)}}),this.annotations.concat(this.plotAnnotations).forEach(e=>{u.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})))}),u.sort((e,t)=>e.y-t.y),a&&(t=this.viewBox,u.forEach((e,i,s)=>{if(0===i&&e.y-e.halfHeight<t.y)e.y=t.y+e.halfHeight+1;else if(i>0){let r=s[i-1],n=(({y:e,halfHeight:t})=>e-t)(e),a=(({y:e,halfHeight:t})=>e+t)(r);n<a&&(e.y=a+1+e.halfHeight),(({y:e,halfHeight:t})=>e+t)(e)>t.y+t.height&&(e.y=t.y+t.height-e.halfHeight-1)}}));let c=({y:t,value:i,formattedValue:r,color:n,auxValue:a})=>{let o,{leftOffset:u,rightOffset:h}=l,c=this.onTheRight?this.pane.viewBox.width-h:u,d=ix(n),p=new gH({position:this.onTheRight?"right":"left",fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:s,textColor:d,strokeColor:n,backgroundColor:n}),f=r||hg(this,i),m=this.comparison===K.Percent;eV(a)&&(o=m?hm(this,a):hf(a)),p.draw(e,c,t,f,o)};a?u.forEach(c):gB.forEach(e=>u.filter(t=>t.priority===e).forEach(c))}}let g$=Symbol.for("__dloacip__");class gG{presenter;id;axes;height;alignedToYear;viewBox;constructor(e){this.presenter=e,this.axes=[],this.height=0,this.alignedToYear=null,this.id=e0()}fromModel(e){this.height=e.height,!0===e.alignOnExpirations&&(this.alignedToYear=function(e){let t=e.map(e=>e.plots).flat().filter(e=>X[e.type]==X.Symbol).map(e=>e.symbol).map(e=>tL(e)).filter(e=>null!==e).map(e=>e.getFullYear());return 0!=t.length?Math.max(...t):null}(e.axes)),this.axes=e.axes.map((e,t)=>{let i=new gW(this);return i.primary=0===t,i.fromModel(e),i},this)}getBounds(){return this.viewBox}setViewBox(e){this.viewBox=e}drawBackground(e){eH(this.viewBox)&&(this.drawAxes(e),e.save(),this.clipToNoScales(e),this.drawGrid(e),e.restore())}draw(e){eH(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&&!1!==this.presenter[g$]&&function(e,{x:t,y:i,height:s,width:r}){if(!eV(mL))return;let{path:n,width:a,height:o,rect:l}=mL,u=Math.min(Math.max(50,r/8),a)/a;l.width=a*u,l.height=o*u,l.x=t+5,l.y=i+s-l.height-5,e.save();let h=getComputedStyle(e.canvas).getPropertyValue("--widget-logo-fill-color");e.fillStyle=0===h.length?"rgba(127, 127, 127, 0.6)":h,e.translate(l.x,l.y),e.scale(u,u),e.fill(n),e.restore()}(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 i=t.getPreviousValue();if(null!=(i=t.priceMapper(i,void 0,an.PreviousClose))){let{leftOffset:s,rightOffset:r}=this.presenter.view,n=this.viewBox.width-r,a=t.axis.yScale.priceToY(i),{color:o,dashStyle:l,lineWidth:u}=this.presenter.display.chart.previous,h=iv(l);e.save(),e.strokeStyle=o,e.lineWidth=u,e.setLineDash(h),iY(e,a,s,n),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){iI(e,this.getBoundsWithoutScales())}drawAnnotations(e){e.save();let{chart:{fontFamily:t},yAxis:{fontSize:i}}=this.presenter.display;e.font=`${i??12}px ${t}`;let s=t=>t.draw(e,!0);this.axes.forEach(e=>{e.annotations.forEach(s),e.plotAnnotations.forEach(s)}),e.restore()}drawGrid(e){let{chart:{fontFamily:t},yAxis:{gridLines:i,visible:s,minorGridLines:r}}=this.presenter.display;if(!s||!i.visible)return;let{lineWidth:n,color:a,dashStyle:o}=i;e.save();let l=this.axes[0].plots?.length===0&&this.axes.length>1,u=this.axes[+!!l],{fontWeight:h,fontSize:c}=u.config;e.font=`${h} ${c}px ${t}`;let d=u.getTicks(e),{leftOffset:p,rightOffset:f}=this.presenter.view,m=this.viewBox.width-f,g=(t,i,s)=>{e.lineWidth=t,e.strokeStyle=i,e.setLineDash(iv(s)),e.beginPath()};if(g(n,a,o),d.forEach(t=>{e.moveTo(p,t.y1),e.lineTo(m,t.y2)}),e.stroke(),r&&r.visible&&d.length>=2){let{lineWidth:t,color:i,dashStyle:s}=r,n=(d[0].y1-d[1].y1)/5;g(t,i,s),d.forEach(t=>{for(let i=1;i<5;i++){let s=Math.ceil(t.y1+i*n);e.moveTo(p,s),e.lineTo(m,s)}}),e.stroke()}e.restore()}drawYCrosshair(e,t){let{yAxis:{crosshair:{enabled:i,showValue:s,color:r,dashStyle:n}}}=this.presenter.display;if(!i)return;let a=iv(n);e.strokeStyle=r,e.setLineDash(a);let o=this.presenter.view.leftOffset,l=this.viewBox.width-this.presenter.view.rightOffset,u=iX();u.prolog(e),iY(e,u.adjust(t.y),u.adjust(o),u.adjust(l)),u.epilog(e),s&&this.axes.forEach(i=>{i.drawCrosshairIndicator(e,t.y)})}drawNoData(e){e.save(),e.font=`800 14px ${this.presenter.display.chart.fontFamily}`,e.fillStyle="#f00",iU(e,yQ().config.noDataText||tG.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},J.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,i=this.presenter.display.chart.showNoDataText,s=!eH(i)||i,r=new Map,n=!0,a=i=>{for(let e of this.axes){for(let s of e.plots){let e=s.isEmpty();n=n&&s.main&&e,s===t||e||i(s)}e.plots.includes(t)&&!t.isEmpty()&&i(t)}s&&n&&this.drawNoData(e)};a(t=>t.draw(e)),a(t=>t.drawTopmost(e,r)),e.restore()}}function gz(e,t){return{width:e,spacing:t,get totalWidth(){return this.width+this.spacing},offset:0}}class gY extends fV{timeline;aggregation;marginBars;bar;resetBar;wasZoomed;fitAllData;constructor(e,t){super(),this.timeline=e,this.aggregation=t;let i=e.presenter.display;this.marginBars=i.xAxis.marginBars||0,this.bar=gz(e$(i,tG.DEFAULT_BAR_WIDTH,"chart","bar","width"),e$(i,tG.DEFAULT_BAR_SPACING,"chart","bar","spacing")),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}extent(e){return fN.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(eH(e))return this.scaleBarToFitRange([e.from,e.to]);let t=this.display.density;if(Number.isFinite(t))return this.scaleBarToFitDensity(t);let i=this.display.period;if(Number.isFinite(i))return this.scaleBarToFitPeriod(i)}deriveExtentsFromBarWidth(e){if(!eH(this._range)||0===this.timeline.length)return null;let t=this._range[1]-this._range[0],i=Math.ceil(t/e.totalWidth);e.offset=t-i*e.totalWidth;let s=this.timeline.lastSeriesIndex+this.marginBars,r=this._domain&&this._domain[1];return r&&(s=e_(this.timeline,+r,Number,hb)),[s-i+1,s]}adjustDomain(){if(!eH(this._range))return;this.scaleBarToFit();let e=this.deriveExtentsFromBarWidth(this.bar);eH(e)&&(this.extent(e),this.setDomainFromExtent())}xToTime(e){if(!this.ready)return null;let t=Math.floor((e-this._range[0]-this.bar.offset)/this.bar.totalWidth),i=this._extent[0]+t;return this.timeline.at(i)}timeToIndex(e){return this.ready?(e="number"==typeof e?e:+e,e_(this.timeline,e,Number,hb)):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*this.bar.width/100,i=this.bar.width-t,s=this.bar.spacing-e*this.bar.spacing/100;if(i>tG.MAXIMUM_BAR_WIDTH||i<tG.MINIMUM_BAR_WIDTH)return!1;let r=gz(i,s),n=this.deriveExtentsFromBarWidth(r);return!!this.isUsableExtent(n)&&(this.setBar(i,s),this.adjustDomain(),this.wasZoomed=!0,!0)}scaleBarToFitRange(e,t=!0){let i=(e,t,i,s)=>eH(e)?e_(this.timeline,e,Number,hb,i,s):t,{from:s,to:r}=this.presenter.data.range||{},n=+e[0]===s&&+e[1]===r,{firstSeriesIndex:a,lastSeriesIndex:o}=this.timeline,l=n?a:void 0,u=n?o:void 0,h=[i(e[0],a,l,u),i(e[1],o,l,u)];this.timeline.at(h[1])>e[1]&&(h[1]=Math.max(0,h[1]-1)),this.extent(h),this.scaleBarToFitDensity(h[1]-h[0]+1,t)}scaleBarToFitDensity(e,t=!0){let i=Math.max(tG.MINIMUM_BARS_VISIBLE,e),s=t&&this.display.xAxis.marginBars||0,r=(this._range[1]-this._range[0])/(i+s);this.setBar(2/3*r,1/3*r,!1)}scaleBarToFitPeriod(e){let t=this.timeline.lastSeriesIndex,i=this.timeline.at(t),s=i,r=t,n=this.presenter.data.aggregation;if(n.isEndOfDay||n.isIntraday&&e>=tG.INTRA_THRESHOLD)for(;r>0&&um(i,s)<e;)r--,s=this.timeline.at(r);else if(!n.isTick){let t=Math.floor(e/tG.ONE_DAY_MILLIS),s=e=>ga(e,to(e)),n=s(i),a=i;for(;r>0;){let e=this.timeline.at(r),i=no(e,a);if(0===t){if(s(e)<=n||!i)break}else i||(t--,a=e);r--}}this.scaleBarToFitDensity(t-r+1)}setBar(e,t,i=!0){let[s,r]=eQ(e,t,tG.MINIMUM_BAR_WIDTH,tG.MAXIMUM_BAR_WIDTH);this.bar.width=s,this.bar.spacing=r,this.wasZoomed||(this.resetBar={width:s,spacing:r}),i&&(this.presenter.model.display.chart.bar={width:e,spacing:t})}resetZoom(){eH(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=tG.DEFAULT_BAR_WIDTH,this.bar.spacing=tG.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(e){return eH(e)&&eH(e[0],e[1])&&e[0]>=0&&e[1]<this.timeline.withPrologEpilogLength&&e[1]-e[0]>=tG.MINIMUM_BARS_VISIBLE}shiftBars(e,t=null){if(!this._extent)return;let i=this._extent.map(t=>t+e);this.isUsableExtent(i)&&(eH(t)&&(this.bar.offset=t),this.extent(i),this.setDomainFromExtent())}setDomainFromExtent(){this.domain(this.extent().map(e=>this.timeline.at(e)))}pan(e){if(!Number.isFinite(e)||0===e)return;let t=e%this.bar.totalWidth,i=this.bar.offset+t,s=Math.sign(e),r=-(e<0?Math.ceil:Math.floor)(e/this.bar.totalWidth);(i>this.bar.totalWidth||i<-this.bar.totalWidth)&&(r+=i>0?-1:1,i-=s*this.bar.totalWidth),this.shiftBars(r,i)}getSeriesThatCouldLoadMoreData(){let e=this.domain();if(!eH(e)||!eH(e[0]))return[];let t=e[0].getTime();return this.timeline.presenter.allPlots.map(e=>e.timeSeries).filter(e=>!!eH(e)&&!!e.hasData&&0!==e.container.size&&!0===e.canLoadMoreData&&t<=e.container.getTimeData()[0].getTime())}}function gj(e){return{date:e,priority:1,text:hp(e)}}class gK{view;xScale;ticks;lastUsedOptions;wasPanned;panningXAxisAllowed;config;isVisible;crosshairIndicator;viewBox;overrideTickGetter;overrideFormatter;constructor(e){this.view=e,this.xScale=new gY(e.presenter.timeline,e.presenter.data.aggregation),this.ticks=null,this.lastUsedOptions=null,this.wasPanned=!1,this.panningXAxisAllowed=e$(e.presenter.display,!0,"xAxis","panning"),this.updateConfigFromModel();let t=e.presenter.renderTo.id,i=e$(yQ().config,null,"overrides","xAxis","tickProvider");eH(i)&&"function"==typeof i&&(this.overrideTickGetter=eu(i,t));let s=e$(yQ().config,null,"overrides","xAxis","formatter");eH(s)&&"function"==typeof s&&(this.overrideFormatter=eu(s,t))}updateConfigFromModel(){let{chart:{fontFamily:e,backgroundColor:t,fontSize:i},xAxis:{textColor:s,visible:r,fontSize:n,crosshair:{color:a}}}=this.view.presenter.display;this.config={innerTickSize:5,tickPadding:5,indicatorPadding:5,fontWeight:400,fontSize:n||i||12},this.isVisible=r,this.crosshairIndicator=new gH({position:"bottom",fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:a,textColor:s,backgroundColor:i_(.15)(t),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();let e=this.view.presenter.display.period===tG.FIFTY_YEARS_MILLIS;eH(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!!eH(t)&&e-this.xScale.timeline.lastSeriesIndex>=0&&e-t[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(),i=t?t[1]:e;return e-i}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=0!==this.barsToLast?this.barsToLast+this.xScale.marginBars+1:0;this.xScale.shiftBars(e),this.view.setPriceAxesDomains(),this.view.redraw()}}setViewBox(e){this.viewBox=e;let{x:t,width:i}=this.viewBox;this.xScale.range([t,t+i])}heightNeeded(e){if(!this.isVisible)return 0;let t=this.view.presenter.display.chart.fontFamily,{fontWeight:i,fontSize:s}=this.config;e.save(),e.font=`${i} ${s}px ${t}`;let{innerTickSize:r,tickPadding:n,indicatorPadding:a}=this.config,o=iH(e,1)+r+n+a;return e.restore(),o}getTickGetter(e){if(this.overrideTickGetter)return this.overrideTickGetter;let t=this.view.presenter.display.xAxis.isOrdinal||!1,i=function(e){switch(e.agg.unit){case $.Tick:return new ho(e);case $.Intraday:return new hl(e,e.agg.size);case $.Day:return new hu(e);case $.Week:return new hh(e);case $.Month:case $.Quarter:return new hc(e);case $.Year:return new hd(e);default:throw Error(`Aggregation unit ${$[e.agg.unit]} not supported.`)}}(e);return t?gj:e=>i.getTick(e)}getTicks(e){let t,i;if(eH(this.lastUsedOptions)&&(t=e.agg,i=this.lastUsedOptions.agg,t.unit===i.unit&&t.size===i.size&&t.spec===i.spec)&&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&&eH(this.ticks))return this.ticks;this.lastUsedOptions=e;let s=this.getTickGetter(e),r=Math.max(0,e.extent[0]),n=Math.min(this.xScale.timeline.withPrologEpilogLength-1,e.extent[1]+1);return this.ticks=this.view.presenter.timeline.slice(r,n).map((e,t)=>{if(!eH(e)||Number.isNaN(e.getTime()))return null;let i=s(e);return eH(i)&&(i.index=r+t),i}).filter(e=>eH(e)),this.ticks}normalizeDuration(e){let t=function(){let e=Object.keys(u9);return 1===u9.Day.Multipliers[0]&&e.forEach(e=>{let t=u9[e],i=eJ(t.Period);t.One=+i,t.Multipliers=t.Multipliers.map(e=>e*i)}),u9}(),i=t.Year,s=Object.keys(t);for(let r=0;r<s.length-1;++r){let n=t[s[r]].Multipliers,a=t[s[r+1]].Multipliers;if(e<=(eb(n)+eP(a))/2){i=t[s[r]];break}}let r=i.Multipliers,n=r.findIndex(t=>e<t),a=-1===n?eb(r):r[n];return"P1M"===i.Period?a*=.9:"P1W"===i.Period&&(a*=.84),a}draw(e){if(!this.isVisible)return;let{xAxis:{gridLines:t,textColor:i,minTickInterval:s,tickPixelInterval:r,format:n,forceTicksVisible:a},chart:{fontFamily:o}}=this.view.presenter.display,{fontWeight:l,fontSize:u,innerTickSize:h,tickPadding:c}=this.config,{x:d,y:p,width:f}=this.viewBox,{lineWidth:m,color:g,dashStyle:y}=t,T=iv(y);e.textAlign="center",e.font=`${l} ${u}px ${o}`,e.lineWidth=1,e.strokeStyle=g,e.fillStyle=i,e.setLineDash([]),iY(e,p,d,d+f);let A=this.xScale.extent(),S=e=>!eH(e)||!eH(e[0],e[1]);if(S(A))return;let v=t=>e.measureText(t).width,b=r>0?r:120,P=this.xScale.domain();if(S(P))return;let C=(P[1].getTime()-P[0].getTime())*b*.6/f,E=this.normalizeDuration(C),_=this.view.presenter.data.aggregation.isEndOfDay,M=d+f,L=({text:i,x:s,date:r,forced:n})=>{eH(r)&&(n||iz(e,s,p,p+h),e.fillText(i,s,p+h+c+.71*u),t.visible&&!n&&(e.save(),e.lineWidth=m,e.setLineDash(T),iz(e,s,0,p),e.restore()))},x={agg:this.view.presenter.data.aggregation,unitWidth:v("M"),barWidth:this.xScale.bar.width,extent:A,formatString:n,minTickInterval:s||0,duration:C},O=this.getTicks(x),I={date:tG.ZERO_DATE,priority:999,x:-999,text:"",index:-1,textWidth:0};O.forEach(e=>{e.x=this.xScale.indexToX(e.index),e.textWidth=v(e.text);let{x:t,textWidth:i}=e,r=t;if(a){let s=i/2;e.x=r=(r=t-s<d?d+s:t)+s>M?M-s:r,e.forced=t!==r}else e.forced=!1;((e,t)=>{let i,r;if(e.date.valueOf()===tG.ZERO_DATE.valueOf())return!0;if(i=e.date,r=t.date,(eH(i)?um(r,i):tG.FIFTY_YEARS_MILLIS)<s)return!1;let n=t.x-e.x,a=t.date.getTime()-e.date.getTime();return!(e.x+e.textWidth/2>=t.x-t.textWidth/2)&&(n>b||!!_&&a>=E)})(I,e)?(L(I),I=e):e.priority<I.priority&&(I=e)}),L(I),this.drawTimeTransitions(e),this.drawTimeAdornments(e)}drawTransitionsFor(e,t,i,s){let r=this.xScale.domain(),n=this.view.presenter?.mainPlot?.timeSeries.container;if(!eV(n))return;let a=n.getTimeData(),o=null===t?a:n.getData(t);if(!eH(o))return;let l=e_(a,+r[0],Number),u=e_(a,+r[1],Number,eE,l);if(l<u){s.save();let t=iX();t.prolog(s),s.strokeStyle=e.color,s.lineWidth=e.width,s.setLineDash(iv(e.dashStyle));let r=null;for(let e=l;e<u;++e){let t=o[e];if(i(t,r)){let i=a[e],n=this.xScale.timeToX(i);eH(n,r)&&iz(s,n,0,this.viewBox.y),r=t}}t.epilog(s),s.restore()}}drawTimeTransitions(e){let t=this.xScale.domain();if(!eV(t)||!eH(t[0],t[1]))return;let i=this.view.presenter,{xAxis:{contractTransition:s,cycleTransition:r}}=i.display,n=(e,t)=>e!==t;s.enabled&&i?.data?.aggregation.isMultiContract&&this.drawTransitionsFor(s,an.Symbol,n,e),r.enabled&&(i?.data?.aggregation.isIntraday?this.drawTransitionsFor(r,an.TradingDay,n,e):i?.data?.aggregation.unit===$.Day?this.drawTransitionsFor(r,null,(e,t)=>!nl(e,t),e):i?.data?.aggregation.unit===$.Week&&this.drawTransitionsFor(r,null,(e,t)=>!nf(e,t),e))}getAnnXScore(e,t){return[no,np,nl,nf].map((i,s)=>(4-s)*Number(i(e,t))).reduce((e,t)=>e+t,0)}annTimeToX(e){let t=this.xScale.timeToIndex(e);if(!eV(t))return null;let i=this.xScale.timeline.at(t),s=this.xScale.timeToX(e);if(!(t>0)||i.valueOf()===e.valueOf())return s;{let r=t-1,n=this.xScale.timeline.at(r),a=this.xScale.indexToX(r);if(!this.view.presenter.display?.xAxis?.isOrdinal){if(n.valueOf()>e.valueOf())return s;let t=this.getAnnXScore(n,e),r=this.getAnnXScore(i,e);return t>r?a:r>t?s:this.view.presenter?.data?.aggregation?.isIntraday?a:s}return a+(s-a)*((e.valueOf()-n.valueOf())/(i.valueOf()-n.valueOf()))}}drawTimeAdornments(e){e.save();let t=this.view.presenter,{chart:{fontFamily:i},xAxis:{preventLabelOverlap:s}}=t.display,r=[],n=t.mainPane?.getBoundsWithoutScales()??new iD(0,0,0,0);t.allAnnotations.concat(t.plotAnnotations).forEach(i=>{r.push(...i.getTimeScaleAdornments().map(i=>{let s=this.annTimeToX(i.time);if(s<n.x||s>n.x+n.width)return null;let r=hy(t,this.view.presenter?.display?.xAxis?.isOrdinal?i.time:this.xScale.xToTime(s)),a=e.measureText(r).width/2;return{x:s,value:r,color:i.color,halfWidth:a}}).filter(e=>null!=e))}),r.sort((e,t)=>e.x-t.x),s&&function(e,t){let i=e.length-1;e.forEach((e,s,r)=>{let n=0===s,a=n?null:r[s-1],o=(({x:e,halfWidth:t})=>e-t-4)(e),l=n?t.x:(({x:e,halfWidth:t})=>e+t+4)(a);if(e.x-e.halfWidth<t.x&&(e.x=gk(t.x,e.halfWidth)),o<l)e.x=gk(l,e.halfWidth+4);else{let t=(({x:e,halfWidth:t})=>e+t+4)(e),n=s<i?(({x:e,halfWidth:t})=>e-t-4)(r[s+1]):Number.MAX_SAFE_INTEGER;if(t>n){let i=gF(e.x,t-n),s=gF(e.x,e.halfWidth-2);e.x=Math.max(s,i,gk(l,a?.halfWidth??0))}}(({x:e,halfWidth:t})=>e+t+4)(e)>t.x+t.width&&(e.x=gF(t.x+t.width,e.halfWidth))})}(r,this.viewBox),r.forEach(t=>{let s=ix(t.color);new gH({position:"bottom",fontSize:this.config.fontSize,fontFamily:i,padding:this.config.indicatorPadding,strokeColor:tG.COLOR_TRANSPARENT,textColor:s,backgroundColor:t.color,arrowLength:this.config.innerTickSize}).draw(e,t.x,this.viewBox.y+1,t.value)}),e.restore()}drawCrosshair(e,{x:t}){let i=this.view.presenter,s=i.display.xAxis,{enabled:r,showValue:n,color:a,dashStyle:o,format:l}=s.crosshair,u=this.xScale.xToTime(t);if(!(eH(u)&&od(u)))return!1;if(!r)return!0;t=this.xScale.timeToX(u);let h=iv(o);e.strokeStyle=a,e.setLineDash(h);let c=iX();if(c.prolog(e),iz(e,c.adjust(t),0,c.adjust(this.viewBox.y)),c.epilog(e),!n||!s.visible)return!0;let d=hy(i,u,eH(s.format)?l:void 0);this.crosshairIndicator.draw(e,t,this.viewBox.y+1,d,void 0,this.viewBox.height-2);let{plotHover:p}=i.display.chart;return p&&i.allPlots.filter(e=>e.visible).forEach(i=>i.curves.forEach(i=>i.drawHover(e,u,t))),!0}}let gq={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",dblclick:"onMouseDblClick",contextmenu:"onContextMenu",mouseover:"onMouseEnter",mouseout:"onMouseLeave",wheel:"onWheel",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",keydown:"onKeyDown"},gX={Shift:"shiftKey",Alt:"altKey",Control:"ctrlKey",Meta:"metaKey"};class gZ{view;subscriptions;constructor(e){this.view=e,this.subscriptions=[]}init(e){let t=eI();Object.keys(gq).filter(e=>!e.startsWith("touch")||t).forEach(t=>{let i=e=>{let i=gq[t];!0===this.notifyActiveTool(i,e)&&e.preventDefault()};e.addEventListener(t,i),this.subscriptions.push(()=>{e.removeEventListener(t,i)})})}shutdown(){this.subscriptions.forEach(e=>e()),this.subscriptions=[]}notifyActiveTool(e,t){let i=this.view.presenter;if(void 0===i||null===i.activeTool)return!1;let s=this.getPayload(t,i),r=i.activeTool,n=!1;return"function"==typeof r[e]&&(n=r[e](s)||!1),n}getPayload(e,t){let i=e instanceof MouseEvent,s=eI()&&e instanceof TouchEvent;if(i||s){let r={x:0,y:0};if(s&&1===e.touches.length){let t=e.touches[0],{left:i,top:s}=e.target.getBoundingClientRect();r.x=t.clientX-i,r.y=t.clientY-s}else i&&(r.x=e.offsetX,r.y=e.offsetY);let n={button:i?e.which:ee.Left,offset:r,view:t.view,presenter:t,originalEvent:e,getModifier:t=>e[gX[et[t]]]};if(e instanceof WheelEvent&&(n.delta=e.shiftKey?e.deltaX:e.deltaY),s&&2===e.touches.length){let t=e.touches[0],i=e.touches[1];n.pinchZoom=!0;let s=t.clientX-i.clientX,r=t.clientY-i.clientY;n.pinchDistance=Math.sqrt(s*s+r*r)}return this.view.splitters.forEach((e,t)=>{e.contains(r)&&(n.splitter=[t,t+1])}),t.panes.forEach(e=>{let t=e.getBounds();if(eH(t)&&t.contains(r)){let t=e.axes.find(e=>e.viewBox?.contains(r));t?n.priceAxis=t:n.point=e.axes.find(e=>e.primary).toAnnotationPoint(r)}}),n}if(e instanceof KeyboardEvent)return{key:e.key??e.keyIdentifier,code:e.keyCode||e.charCode,repeat:e.repeat,presenter:t,getModifier:t=>e.getModifierState(et[t])}}}let gJ=us.concat(an.PercentChange);class gQ{view;id;isOptionsChart;constructor(e){this.view=e,this.isOptionsChart=!1,this.id=`bc-legend-${e0()}`}getLegendElem(){let e=this.view.el;return tV(this.id,e,"div")}update(){let e=this.getLegendElem(),t=hV(this.presenter.mainPane);if(!eH(t))return;this.isOptionsChart=this.mainPlot.title.startsWith(tG.FAKE_SYMBOL_PREFIX);let{left:i,right:s,top:r,width:n}=t;mP(e,"row",i,s,r,n),tH(e,{"bcharts-card":!0,"bcharts-legend":!0});let a=this.mainPlot,o=a.isSeasonal||this.isOptionsChart?this.getFirstColorBadge(a):"",l=this.getPlotTitle(a),u=this.maybeGetQuote(),h=this.div(`${o} ${l} `)+this.div(`${u}`),c=this.maybeGetAdditionalPlots();e.innerHTML=`${h} ${c}`}remove(){this.getLegendElem().remove()}get presenter(){return this.view.presenter}get mainPlot(){return this.presenter.mainPlot}getAttributes(e){return Object.entries(e).map(([e,t])=>{if(null===t)return"";let i=Array.isArray(t)?t.join(" "):t;return`${e} = "${i}" `}).join(" ")}span(e,t={}){return`<span ${this.getAttributes(t)}>${e}</span>`}div(e){return`<div class="plot" style="flex: 0 0 auto">${e}</div>`}get meta(){return this.mainPlot.metaData}isSingleSymbolSeasonal(e){return e.isSeasonal&&!e.hasComputation}format(e,t,i){return(i??this.meta).format(e,t)}spanAsName(e){return this.span(e,{class:"field-name"})}spanAsValue(e,t=null,i=null){return this.span(e,{class:["field-value",t],style:i})}getQuoteFromRecord(e){let t=gJ.map(t=>e.getValue(t));if(eg(t)){let e=t[4],i=`field-${e>0?"up":e<0?"down":"same"}-value`,s=t.slice(0,-1).map((e,t)=>{let s=gJ[t],r=this.format(e,s),n=hk(s);return`${this.spanAsName(n)}${this.spanAsValue(r,i)}`}).join(" "),r=this.spanAsValue(`(${this.format(eb(t),eb(gJ))})`,i);return`${s} ${r}`}return""}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries?.record?.isValid){let e=yQ().getRecordSource().getRecord(this.mainPlot.timeSeries.record.symbol);return this.getQuoteFromRecord(e)}if(this.mainPlot.isExpression&&this.mainPlot.record.isValid){let e=this.mainPlot.record;return e.evaluate(),this.getQuoteFromRecord(e)}return""}getTitle(e,t,i){let s=this.span(`${e.name} (${e.symbol})`,{"data-plot-id":i,class:["value-title",t?"value-main":null]}),r=t?` ${this.span(e.exchange,{class:"value-subtitle"})}`:"";return`${s}${r}`}getPlotTitle(e){if(e.isSymbol)return this.getTitle(e.metaData,e.main,e.id);if(!(this.isSingleSymbolSeasonal(e)&&0===e.offset&&(e.symbols?.length??0)>0))return this.span(e.title,{"data-plot-id":e.id,class:"value-title"});{let t=yQ().getMetaDataSource().getMetaData(e.getActualSymbols()[0]);return this.getTitle(t,!0,e.id)}}getFirstColorBadge(e){return hx("rectangle",e.mainCurve.colors[0])}getLastValues(e){return this.isOptionsChart?"":gU(e).filter(e=>eH(e.value)).map(t=>{let i=this.format(t.value,t.field,e.metaData);return this.spanAsValue(i,null,`color:${t.color}`)}).join(" ")}canBeDeleted(e){return e.isStudy||!e.main&&this.isOptionsChart}maybeGetAdditionalPlots(){let e=this.presenter.mainPane.axes.map(e=>e.plots).flat().filter((e,t)=>!e.main||e.isSeasonal&&t>0),t=this.presenter.display.yAxis.showLastValue;return e.length>0?e.map(e=>{let i=this.getFirstColorBadge(e),s=this.getPlotTitle(e),r=this.canBeDeleted(e)?hR(e.id):"",n="All"===t||e.isSeasonal?"":this.getLastValues(e);return this.div(`${r} ${i} ${s} ${n}`)}).join(" "):""}}class g0{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 gQ(this),this.draw=this.draw.bind(this),this.notifyLayoutChanged=function(e,t=100){var i,s;let r;return i=t=>eR(e,t),s=t,r=!1,function(...e){r||(i.apply(this,e),r=!0,setTimeout(function(){r=!1},s))}}(aa.CH_CHTLAYOUTCHANGED,tG.LAYOUT_THROTTLE_DELAY)}get canShowLegend(){if(!this.presenter.hasLegend)return!1;let e=this.presenter.display.chart.showLegend;return"boolean"!=typeof e||!!e}updateLegend(){this.canShowLegend&&this.legend.update()}removeLegend(){this.legend.remove()}findSvgParentWithClass(e,t){return[e,e.parentElement,e.parentElement.parentElement].find(e=>eH(e)&&e.className===t)}onNonToolHandledMouseDown(e){let t=this.presenter,i=e.target;if("string"==typeof i.className&&i.className.split(" ").includes("value-title"))t.onCardClicked(i);else{let s=this.findSvgParentWithClass(i,"move-pane");if(eV(s))return void t.onMovePaneClicked(s);let r=this.findSvgParentWithClass(i,"delete-plot");if(eV(r))return void t.deletePlotClicked(r);let n=this.findSvgParentWithClass(i,"show-hide-plot");if(eV(n))return void t.showHidePlotClicked(n);let a=this.findSvgParentWithClass(i,"more-actions");if(eV(a))return void t.plotMoreActionsClicked(a,e)}}initialize(e){this.presenter=e,this.el=this.presenter.hostElement;let t=new ResizeObserver(e=>{for(let t of e){let{width:e,height:i}=t.contentRect;this.setSize(e,i),eH(this.tooltip)&&this.tooltip.repositionAuto()}});t.observe(this.el.parentElement),this.listeners.push(()=>t.unobserve(this.el.parentElement));let i=e=>this.onNonToolHandledMouseDown(e);this.el.addEventListener("mousedown",i),this.listeners.push(()=>this.el.removeEventListener("mousedown",i)),tR(this.el,{flex:1,display:"flex",position:"relative","flex-direction":"column","touch-action":"pan-x pan-y"}),this.tooltip=new mS(this);let s=yQ().config.getCustomEventPopup;this.customEventPopup=s?s(this):null;let{clientHeight:r,clientWidth:n}=this.el;this.width=n,this.height=r,this.canvasContainer=tF(this.el,"div"),tN(this.canvasContainer,{class:"chart-canvas-container"}),tR(this.canvasContainer,{flex:1,display:"flex","flex-direction":"column",position:"relative",height:"100%"}),this.mainCanvas=tF(this.canvasContainer,"canvas");let a={height:`${r}px`,width:`${n}px`,"z-index":2,position:"absolute",top:0,left:0};tR(this.mainCanvas,a),this.mouseCanvas=tF(this.canvasContainer,"canvas"),tN(this.mouseCanvas,{tabIndex:0}),a["z-index"]=3,a.outline="none",tR(this.mouseCanvas,a),this.goToLatestButton=tF(this.el,"button"),tB(this.goToLatestButton,`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
18
+ `.trim()})(t,a,f,r,l,u,h,e)),y=`${m}${g.join("")}`,T=function(e,t){let i=e>0,s=e<t-1;return`${i?hI(!0,e):""} ${s?hI(!1,e):""}`.trim()}(d,t.length);return{id:`bc-tip-${c.id.substring(0,8)}`,isMainPane:f,content:y,moveContent:T,bounds:c.bounds}})}(e,t,i,s,r,a,o,l);c.some(e=>!eH(e.bounds))||c.forEach(({id:t,isMainPane:i,content:s,moveContent:r,bounds:{left:a,right:o,top:l,width:c}},d)=>{if(""!==s&&(!n||!i)){let r=tV(t,h,"div");mC(r,i&&h_(e)?"column":"row",a,o,l+u,c),tH(r,{"bcharts-card":!0,"bcharts-card-main":i,"bcharts-card-first":0===d}),r.innerHTML=s}let p=tw(`#right-${t}`,h);eH(p)||((p=document.createElement("div")).id=`right-${t}`,h.appendChild(p),tH(p,"bcharts-card bcharts-card-move")),tR(p,{position:"absolute",display:"block",right:`${o+tG.CARDS_X_OFFSET}px`,top:`${l+u+tG.CARDS_Y_OFFSET}px`}),p.innerHTML=r})}let m_=null;function mM(){return null===m_&&(m_=y0().config.hostingModel===ea[ea.Application]),m_}class mL extends fJ{ap;presenter;panY;snapToSupported;warmUp;preventDefault;lastOffset;lastPanningExtremes;constructor(e){super(),this.ap=e,this.snapToSupported=!1,this.warmUp=!0,this.preventDefault=!1,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)return void this.presenter.resetActiveTool();let{point:t,view:i,offset:s}=e;if(t&&t.axis!==this.ap.axis)return;let{x:r,y:n}=s,a=r-this.lastOffset.x,o=Math.abs(a),l=this.lastOffset.y,u=Math.abs(n-l);o>=1&&this.cancelLongPress();let h=mM();if(eI()&&!h&&this.warmUp)return(o>7||u>7)&&(this.warmUp=!1,this.preventDefault=o>u),!1;if(this.preventDefault||!eI()||h){if(i.xAxis.pan(a),this.panY&&t&&t.axis){u>=1&&this.cancelLongPress();let e=function(e,t,i,s){let r=(i-t)/e.viewBox.height,[n,a]=s,o=r*(a-n);return[n+o,a+o]}(t.axis,l,n,this.lastPanningExtremes);this.lastPanningExtremes=e,t.axis.yScale.domain(e)}this.lastOffset=s,i.redraw(),t&&t.presenter.view.setCursor(Q.Grabbing)}return h||this.preventDefault}finished(){gE(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:e,offset:t,originalEvent:i}){eI()&&mN(e,t,i)}performLongPress(e,t,i){e.enableTooltip(!0),e.resetActiveTool(),e.activeTool.startTouchCrosshairMode(e,t,i)}}let mx=null;class mO extends mo{constructor(e,t){super(e,t)}hitTest(e){if(!this.visible)return!1;let t=this.getRect();return null!==t&&t.contains(e)}draw(e,t){return!!super.draw(e,t)&&(iW(e,this.getRect()),!0)}}function mI(e,t){return e<t?[e,t]:[t,e]}let mD={line:{width:1,color:"rgba(127, 127, 127, 0.3)",dashStyle:"LongDash"},fill:{color:"rgba(127, 127, 127, 0.1)"}};class mw extends md{snapToSupported=!1;preventDefault=!1;axis;presenter;constructor(){super(f8("Rectangle",mO,null,mD),!1)}activated(){}deactivated(){eH(this.axis,this.annotation)&&this.axis.deleteAnnotation(this.annotation,!1)}onMouseDown(e){let t=super.onMouseDown(e);if(!0===t){let{point:t}=e;this.axis=t.axis,this.presenter=t.presenter}return t}finish(){if(eH(this.axis,this.presenter)){gE(this.presenter,{toolChange:eo.Executed,annId:"ZoomIn"});let e=this.annotation.points,t=mI(e[0].price,e[1].price),i=mI(e[0].time,e[1].time),s=(e,t)=>Math.abs(t(e[0])-t(e[1])),r=s(i,e=>this.axis.toX(e)),n=s(t,e=>this.axis.toY(e)),a=this.presenter.view,o=tG.MINIMUM_ZOOM_DIMENSION;if(r>o&&n>o){let e=a.xAxis.xScale;this.axis.isCustomDomain=!0,this.axis.yScale.domain(t),e.wasZoomed=!0,e.scaleBarToFitRange(i,!1),e.domain(i)}a.redraw()}}}function mR(e,t){let i=f6(e);i.offset={x:t.x,y:t.y},i.canFlip=null!==e.getFlipAnchorIndices();let s=e.axis.pane.presenter;s.clearSelection(),s.notifyHost(ao.CH_ANNNEEDSCONTEXTMENU,i)}function mN(e,t,i){let s={offset:{x:t.x,y:t.y},chart:e.accessor,originalEvent:i};e.notifyHost(ao.CH_CHTNEEDSCONTEXTMENU,s)}class mV extends mc{factory;maxClicks;clicks;snapToSupported;isDrawingAnnotation;constructor(e,t){super(e.annName),this.factory=e,this.maxClicks=t,this.clicks=0,this.snapToSupported=!0,this.isDrawingAnnotation=!0}onMouseMove(e){let{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){let{point:t,view:i}=e;if(0===this.clicks){if(void 0===t)return gL(e),!1;t.axis.pane.presenter.clearSelection(),this.annotation=this.factory(t.axis)}this.applyToPoints(t),this.clicks++,this.clicks===this.maxClicks&&void 0!==this.annotation?(this.annotation.drawn=!1,this.annotation.requestRedraw(),"function"==typeof this.annotation.updateOtherPoints&&this.annotation.updateOtherPoints(i.mainContext),g_(this.annotation,!0,eo.Created)):this.annotation.requestRedraw()}applyToPoints(e){this.annotation.points[this.clicks].update(e.price,e.time)}}class mH{snapToSupported=!1;constructor(e,t){setTimeout(()=>this.finalize(e,t),10)}finalize(e,t){let i=e(t);t.pane.presenter.clearSelection(),i.drawn=!1,i.requestRedraw(),g_(i,!0,eo.None)}}let mF=tG.MARKER_ARROW_ANGLE*Math.PI/180/2;function mk(e,t,i=tG.MARKER_ARROW_LENGTH){return new mB(e,t,i)}class mB{vertex;arrowLen;p1;p2;constructor(e,t,i=tG.MARKER_ARROW_LENGTH){this.vertex=t,this.arrowLen=i,this.p1=e[0],this.p2=e[1]}hitTest(e){let{anchor:t,p1:i,p2:s}=this.getArrowPoints();return iS([t,i],e,tG.HIT_TEST_TOLERANCE)||iS([t,s],e,tG.HIT_TEST_TOLERANCE)}draw(e){let{anchor:t,p1:i,p2:s}=this.getArrowPoints();iG(e,t,i),iG(e,t,s)}getArrowPoints(){let e=iA(this.p1,this.p2),t="start"===this.vertex?0:Math.PI,i=e-mF+t,s=e+mF+t,r="start"===this.vertex?this.p1:this.p2,n=this.arrowLen*Math.cos(i)+r.x,a=this.arrowLen*Math.sin(i)+r.y,o=this.arrowLen*Math.cos(s)+r.x,l=this.arrowLen*Math.sin(s)+r.y;return{anchor:r,p1:{x:n,y:a},p2:{x:o,y:l}}}}class mU{hitTest(){return!1}draw(){}}class mW extends mt{constructor(e,t){super(e,t),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[tG.AT_EXTEND_PT_1]}get extend2(){return this.traits[tG.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[tG.AT_SHOW_PERCENTDIFF]}get showBarCount(){return this.traits[tG.AT_SHOW_BARCOUNT]}get showRatio(){return this.traits[tG.AT_RATIO]}getElements(){let e=this.points[0].point,t=this.points[1].point,i=new f9(e,t,this.extend1,this.extend2,this.axis),s=[];return this.extend1&&s.push(new f9(i.p1,e,!0,!1,this.axis)),s.push(new f9(e,t,!1,!1,this.axis)),this.extend2&&s.push(new f9(t,i.p2,!1,!0,this.axis)),s}formatRatio(e,t){return` (${eF(e/t,3)})`}formatPercDiff(e,t){let i=(t-e)/e*100,s=i>0?"+":"";return` (${s}${eF(i,2)}%)`}formatPrice(e){return hy(this.axis,this.priceMap(e))}adornElements(e,t){if(!this.showBarCount&&!this.showPrices&&!this.showPercentDiff&&!this.showRatio)return;let[i,s]=this.points,r=e[+!!this.extend1].getAdornOffset(t);if(this.showBarCount){let e=iT(im(i.point,s.point),r);iU(t,this.getBarCount(i.time,s.time).toFixed(0),e,J.Right)}let n=this.showRatio?this.formatRatio(i.price,s.price):"",a=this.showPrices?this.formatPrice(i.price):"",o=`${a}${n}`.trim();""!==o&&iU(t,o,iT(i.point,r),J.Right);let l=this.showPercentDiff?this.formatPercDiff(i.price,s.price):"",u=this.showPrices?this.formatPrice(s.price):"",h=`${u}${l}`.trim();""!==h&&iU(t,h,iT(s.point,r),J.Right)}getMarkers(){let e=this.marker;if(!e||"none"===e.vertex)return[];let{vertex:t,kind:i}=e;return("both"===t?["start","end"]:[t]).map(e=>{if("arrow"===i){var t;return t=this.points,mk(t.map(e=>e.point),e)}return console.warn(`There is no marker of ${i} kind`),new mU})}}class m$ extends mt{constructor(e,t){super(e,t),this.addPoints(1)}get showTimestamps(){return this.traits[tG.AT_SHOW_TIMESTAMPS]}getElements(){return[new f2(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}}class mG extends mt{constructor(e,t){super(e,t),this.addPoints(1)}getElements(){return[new f2(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}}class mz extends mt{constructor(e,t,i){super(e,t),this.addPoints(2),eH(i)&&eH(i.points)&&i.points.forEach((e,t)=>this.points[t].update(e.price,e.time))}allPoints(){let[e,t]=this.points;return eH(e,e.point,t,t.point)?[e,this.axis.toAnnotationPoint(im(e.point,t.point)),t]:tG.EMPTY_ARRAY}line2(){return this.traits[tG.AT_LINE_2]}use52WeekPrices(){return this.traits[tG.AT_USE_52WEEK_PRICES]}getElements(){let e=this.allPoints();return e===tG.EMPTY_ARRAY?tG.EMPTY_ARRAY:e.map(e=>new f9({x:-tG.OUT_OF_SCREEN,y:e.point.y},{x:tG.OUT_OF_SCREEN,y:e.point.y},!1,!1,this.axis))}wasPointMovedByTool(e,t){eH(this.use52WeekPrices())&&(this.traits[tG.AT_USE_52WEEK_PRICES]=!1)}getStyleForElement(e,t){let i=this.line2();if(1!==t||!eH(i))return super.getStyleForElement(e,t);let s=eG(this.traits);return s.line=i,i7(s)}getPriceScaleAdornments(){let e=this.allPoints();if(!this.showPrices||e===tG.EMPTY_ARRAY)return super.getPriceScaleAdornments();let t=this.traits.line,i=e.map(e=>({price:e.price,color:t.color})),s=this.line2();return eH(s)&&(i[1].color=s.color),i}getFlipAnchorIndices(){return null}}class mY extends mi{helper;constructor(e,t,i){super(e,t),this.addPoints(i),this.helper=new f3(e)}get showTrendLine(){return this.traits[tG.AT_SHOW_TRENDLINE]}get hasAllPoints(){return eH(...this.points.map(e=>e.point))}get line2(){return this.traits[tG.AT_LINE_2]}get extendLeft(){return this.traits[tG.AT_EXTEND_LEFT]}get extendRight(){return this.traits[tG.AT_EXTEND_RIGHT]}get reverse(){return this.traits[tG.AT_REVERSE]}get levelsRespectLogScale(){return this.traits[tG.AT_LEVELS_RESPECT_LOG_SCALE]}getStyleForElement(e,t){if(e.isTrend){let e=eG(this.traits);return e.line=this.line2,i7(e)}return super.getStyleForElement(e,t)}getKeyPoints(){let e=e=>e.map(e=>this.points[e]);return e(this.isExtended?this.reverse?[1,0,2]:[0,1,2]:this.reverse?[0,1,0]:[1,0,1])}getElements(){if(!this.hasAllPoints)return[];let[e,t,i]=this.getKeyPoints(),s=t.price-e.price,r=t.price/e.price,n=this.extendLeft,a=this.extendRight,o=this.leftPoint,l=this.rightPoint,u=(e,t,i=!1)=>{let s=new f9(e,t,!i&&n,!i&&a,this.axis);return s.isTrend=i,s},h=this.levelsRespectLogScale&&this.axis.scale===q.Logarithmic,c=({value:e})=>{let t=i.price+s*e,n=i.price*Math.pow(r,e);this.helper.update(h?n:t,i.time);let a=this.helper.point.y;return u({x:o.x,y:a},{x:l.x,y:a})},d=this.getColoredElements(c);return this.showTrendLine&&(d.push(u(e.point,t.point,!0)),this.isExtended&&d.push(u((this.reverse?e:t).point,i.point,!0))),d}getAdornPointAndAlign(e,t){let i=this.labels,s=(e,t,i)=>({pt:e,align:t,offset:i}),r=this.axis.pane.getBoundsWithoutScales();switch(i){case tG.AT_LABELS_LEFT:return this.extendLeft?s({x:r.x,y:e.anchor1.y},J.Left,t):super.getAdornPointAndAlign(e,t);default:case tG.AT_LABELS_RIGHT:return this.extendRight?s({x:r.x+r.width,y:e.anchor2.y},J.Right,-t):super.getAdornPointAndAlign(e,t);case tG.AT_LABELS_CENTER:return super.getAdornPointAndAlign(e,t)}}getTextRef(){return(e,t,i)=>{let s=this.formatLevelPrice(i,t.anchor1.y);return{ref:t,spacing:5,offsetY:-5,text:s}}}adornElements(e,t){this.adornElementsForColoredFactors(e,(e,t)=>{let i=new Path2D;return null===e||(iR(i,e.p1),i.lineTo(t.p2.x,e.p1.y),iN(i,t.p2),i.lineTo(e.p1.x,t.p2.y)),i},this.getTextRef(),t)}getPriceScaleAdornments(){if(!this.pricesOnScale)return super.getPriceScaleAdornments();let e=this.getElements();if(0===e.length)return super.getPriceScaleAdornments();let t=this.traits.line.color;return this.factors.map((i,s)=>{let r=e[s++].p1,n=this.singleStyle?t:i.line.color;return{price:this.axis.toPrice(r.y),color:n}})}}class mj extends mY{constructor(e,t){super(e,t,2)}}class mK extends mY{constructor(e,t){super(e,t,3)}}let mq=(e,t)=>{let i=new Path2D;return null===e||(iR(i,e.p1),iN(i,e.p2),iN(i,t.p2)),i};class mX extends mi{constructor(e,t){super(e,t),this.addPoints(2)}get reverse(){return this.traits[tG.AT_REVERSE]}getElements(){let[e,t]=this.getScreenPoints(),i=t.y-e.y,s=({value:s})=>{let r=this.reverse?e.y+s*i:t.y-s*i;return new f9(e,{x:t.x,y:r},!1,!0,this.axis)};return this.getColoredElements(s)}getTextRef(){let[e,t]=this.getScreenPoints(),i=t.y-e.y,[s,r]=[this.leftPoint,this.rightPoint];return(n,a,o)=>{let l=this.reverse?e.y+o*i:t.y-o*i;return{ref:new f9({x:s.x,y:l},{x:r.x,y:l},!1,!1,this.axis),spacing:5,offsetY:!0,text:o.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,mq,this.getTextRef(),t)}}class mZ extends mX{constructor(e,t){super(e,t)}}class mJ{center;rim;radius;startAngle;endAngle;antiClockwise;axis;left;right;scale;clip;style;constructor(e,t,i,s,r,n,a){this.center=e,this.rim=t,this.radius=i,this.startAngle=s,this.endAngle=r,this.antiClockwise=n,this.axis=a,this.left=null,this.right=null,this.scale=null,this.clip=null,null!==t&&(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 null!==this.scale}get hasClip(){return null!==this.clip}get hasRim(){return null!==this.rim}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),i=this.axis.pane.presenter.view.mouseContext;i.save(),i.resetTransform(),this.applyScale(i);let s=i.getTransform().inverse();return i.restore(),s.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(ig(this.left,e),ig(this.right,e));else{let{x:i,y:s}=iy(this.hasScale?this.inverseScale(e):e,this.center);if(!this.hasRim){let{startAngle:e,endAngle:t,antiClockwise:r}=this,n=Math.PI/2;if(0===e&&t===n&&!r&&(i<0||s<0)||e===n&&t===Math.PI&&!r&&(i>0||s<0)||e===-n&&t===Math.PI&&r&&(i>0||s>0)||0===e&&t===-n&&r&&(i<0||s>0))return!1}t=Math.abs(Math.sqrt(i*i+s*s)-this.radius)}return t<=tG.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),i$(e,this.center,this.radius,this.startAngle,this.endAngle,this.isAntiClockwise??!1),e.restore()}}let mQ=(e,t)=>{let i=new Path2D,{center:s}=t;if(iR(i,s),i.arc(s.x,s.y,t.radius,t.startAngle,t.endAngle,t.isAntiClockwise??!1),null===e)return i;let r=new Path2D,{center:n}=e;return iR(r,n),r.arc(n.x,n.y,e.radius,e.endAngle,e.startAngle,!e.isAntiClockwise),i.addPath(r),i};class m0 extends mi{constructor(e,t){super(e,t),this.addPoints(2)}getElements(){let[e,t]=this.getScreenPoints();if(!eH(e,t))return[];let i=ig(e,t),s=iy(t,e),r=s.y/i,n=s.x/i,a=({value:t})=>{let s=i*t,a={x:e.x+n*s,y:e.y+r*s};var o=this.axis;let l=ig(e,a);return new mJ(e,a,l,0,Math.PI,null,o)},o=this.getColoredElements(a);if(this.showTrendLine){let i=new f9(e,t,!1,!1,this.axis);i.isTrend=!0,o.unshift(i)}return o}get showTrendLine(){return!0}getTextRef(){return(e,t,i)=>{let{center:s}=t,r=t.isAntiClockwise?-1:1;return{ref:{x:s.x,y:s.y+r*t.radius},spacing:0,offsetY:!0,text:i.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,mQ,this.getTextRef(),t)}}class m1 extends m0{constructor(e,t){super(e,t)}getStyleForElement(e,t){if(e.isTrend){let e=eG(this.traits);return e.line=this.line2,i7(e)}return super.getStyleForElement(e,t)}get showTrendLine(){return this.traits[tG.AT_SHOW_TRENDLINE]}get line2(){return this.traits[tG.AT_LINE_2]}}class m2 extends mi{constructor(e,t){super(e,t),this.addPoints(2)}get factorsPropName(){return tG.AT_ANGLES}getElements(){let[e,t]=this.getScreenPoints(),{x:i,y:s}=iy(t,e),r=({value:r})=>{let n=(t,i)=>new f9(e,{x:t,y:i},!1,!0,this.axis),a="1"!==r.charAt(0),o=Number(a?r.charAt(0):r.charAt(2));return a?n(t.x,e.y+s/o):n(e.x+i/o,t.y)};return this.getColoredElements(r)}getTextRef(){return(e,t,i)=>({ref:t.anchor2,spacing:0,offsetY:!0,text:i.toString()})}adornElements(e,t){this.adornElementsForColoredFactors(e,mq,this.getTextRef(),t)}}class m3 extends mX{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 f9(e,t,!1,!1,this.axis)].concat(super.getElements())}}class m4 extends m0{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}}class m5 extends mt{constructor(e,t){super(e,t),this.addPoints(3)}getElements(){let e=this.points[0].point,t=this.points[1].point,i=this.points[2].point,s=(t.x+i.x)/2-e.x,r=(t.y+i.y)/2-e.y,n=[];return n.push(new f9(t,{x:t.x+s,y:t.y+r},!1,!0,this.axis)),n.push(new f9(e,{x:e.x+s,y:e.y+r},!1,!0,this.axis)),n.push(new f9(i,{x:i.x+s,y:i.y+r},!1,!0,this.axis)),n.push(new f9(t,i,!1,!1,this.axis)),n}}class m6 extends mo{constructor(e,t){super(e,t)}getEllipse(){let e=this.getRect();return null===e?null:new iw(e.centerX,e.centerY,e.width/2,e.height/2)}hitTest(e){if(!this.visible)return!1;let t=this.getEllipse();return null!==t&&t.contains(e)}draw(e,t){var i;return!!super.draw(e,t)&&(i=this.getEllipse(),e.beginPath(),e.ellipse(i.cx,i.cy,i.radiusX,i.radiusY,0,0,2*Math.PI),e.stroke(),e.fill(),!0)}}class m7 extends mt{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[tG.AT_EXTEND_PT_1]}get extend2(){return this.traits[tG.AT_EXTEND_PT_2]}getLastPoint(){let[e,t,i]=this.points;var s=ig(e.point,t.point),r=iA(e.point,t.point);return{x:i.point.x+s*Math.cos(r),y:i.point.y+s*Math.sin(r)}}getElements(){let[e,t,i]=this.points;var s=[];if(s.push(new f9(e.point,t.point,this.extend1,this.extend2,this.axis)),eH(i?.price)){var r=this.getLastPoint();s.push(new f9(i.point,r,this.extend1,this.extend2,this.axis))}return s}}class m8 extends mo{kind;constructor(e,t,i){super(e,t),this.kind=i,this.adjustFill=!0}hitTest(e){if(!this.visible)return!1;let t=this.getRect();return null!==t&&t.contains(e)}get dimension(){let e="fish_hook"===this.kind?2:1;return tG.DEFAULT_SYMBOL_WIDTH_HEIGHT*e}updateOtherPoints(){this.points[1].price||this.setBottomRight()}setBottomRight(){let e=this.dimension,t=this.axis.pane.presenter.timeline,{price:i,time:s}=this.points[0],r=e_(t,s,Number,hP);if(-1!==r){let s=this.axis.pane.presenter.view.xAxis.xScale.bar.totalWidth,n=1;for(;(2*n+1)*s<e;)n++;this.points[0].update(i,t.at(r-n)),this.points[1].update(i,t.at(r+n));let a=iT(this.points[0].point,{x:0,y:-e/2}),o=iT(this.points[1].point,{x:0,y:e/2});this.points[0].updateFromPoint(a),this.points[1].updateFromPoint(o)}}draw(e,t){if(!super.draw(e,t))return!1;let i=this.getRect();switch(0===i.width&&(i.width=this.dimension),this.kind){case"zero":ij(e,i,"0");break;case"one":ij(e,i,"1");break;case"two":ij(e,i,"2");break;case"three":ij(e,i,"3");break;case"four":ij(e,i,"4");break;case"five":ij(e,i,"5");break;case"six":ij(e,i,"6");break;case"seven":ij(e,i,"7");break;case"eight":ij(e,i,"8");break;case"nine":ij(e,i,"9");break;case"question":ij(e,i,"?");break;case"fish_hook":var s=e,r=i;s.save(),s.translate(r.x,r.y);let n=Math.min(r.width,r.height)/560;s.scale(n,n),s.lineCap="butt",s.lineJoin="miter",s.miterLimit=4,s.save(),s.save(),s.miterLimit=10,s.beginPath(),s.moveTo(377.8,354.8),s.bezierCurveTo(377.8,354.8,401.8,517.8,290.6,507),s.bezierCurveTo(173.2,495.5,171.5,50.39,171.5,50.39),s.bezierCurveTo(171.5,50.39,191.7,252.59,212.3,351),s.bezierCurveTo(212.3,351,230.9,472.8,286.7,488.7),s.bezierCurveTo(350.4,507,369.5,452.7,377.8,354.79),s.closePath(),s.fill(),s.restore(),s.save(),s.miterLimit=10,s.beginPath(),s.moveTo(378.3,351.1),s.lineTo(341.1,446.6),s.lineTo(371.2,436.7),s.lineTo(378.3,351.1),s.closePath(),s.fill(),s.restore(),s.restore(),s.restore();break;case"arrow_up":var a=e,o=i;a.save();let{cx:l,cy:u,left:h,right:c,top:d,bottom:p,halfBaseSize:f}=iK(o);a.beginPath(),a.moveTo(c,u),a.lineTo(l,d),a.lineTo(h,u),a.lineTo(Math.floor(l-f),u),a.lineTo(Math.floor(l-f),p),a.lineTo(Math.floor(l+f),p),a.lineTo(Math.floor(l+f),u),a.closePath(),a.fill(),a.restore();break;case"arrow_down":var m=e,g=i;m.save();let{cx:y,cy:T,left:A,right:S,top:v,bottom:b,halfBaseSize:P}=iK(g);m.beginPath(),m.moveTo(S,T),m.lineTo(y,b),m.lineTo(A,T),m.lineTo(Math.floor(y-P),T),m.lineTo(Math.floor(y-P),v),m.lineTo(Math.floor(y+P),v),m.lineTo(Math.floor(y+P),T),m.closePath(),m.fill(),m.restore();break;case"arrow_right":var C=e,E=i;C.save();let{cx:_,cy:M,left:L,right:x,top:O,bottom:I,halfBaseSize:D}=iK(E);C.beginPath(),C.moveTo(_,O),C.lineTo(x,M),C.lineTo(_,I),C.lineTo(_,Math.floor(M+D)),C.lineTo(L,Math.floor(M+D)),C.lineTo(L,Math.floor(M-D)),C.lineTo(_,Math.floor(M-D)),C.closePath(),C.fill(),C.restore();break;case"arrow_left":var w=e,R=i;w.save();let{cx:N,cy:V,left:H,right:F,top:k,bottom:B,halfBaseSize:U}=iK(R);w.beginPath(),w.moveTo(N,k),w.lineTo(H,V),w.lineTo(N,B),w.lineTo(N,Math.floor(V+U)),w.lineTo(F,Math.floor(V+U)),w.lineTo(F,Math.floor(V-U)),w.lineTo(N,Math.floor(V-U)),w.closePath(),w.fill(),w.restore();break;case"arrow_horizontal":var W=e,$=i;W.save();let{cx:G,cy:z,left:Y,right:j,top:K,bottom:q,halfBaseSize:X}=iK($,1.5),Z=Math.floor(G-(G-Y)/3),J=Math.floor(G+(G-Y)/3);W.beginPath(),W.moveTo(Z,K),W.lineTo(Y,z),W.lineTo(Z,q),W.lineTo(Z,Math.floor(z+X)),W.lineTo(J,Math.floor(z+X)),W.lineTo(J,q),W.lineTo(j,z),W.lineTo(J,K),W.lineTo(J,Math.floor(z-X)),W.lineTo(Z,Math.floor(z-X)),W.lineTo(Z,K),W.closePath(),W.fill(),W.restore();break;case"arrow_vertical":var Q=e,ee=i;Q.save();let{cx:et,cy:ei,left:es,right:er,top:en,bottom:ea,halfBaseSize:eo}=iK(ee,2/3),el=Math.floor(ei-(ei-en)/3),eu=Math.floor(ei+(ei-en)/3);Q.beginPath(),Q.moveTo(er,el),Q.lineTo(et,en),Q.lineTo(es,el),Q.lineTo(Math.floor(et-eo),el),Q.lineTo(Math.floor(et-eo),eu),Q.lineTo(es,eu),Q.lineTo(et,ea),Q.lineTo(er,eu),Q.lineTo(Math.floor(et+eo),eu),Q.lineTo(Math.floor(et+eo),el),Q.lineTo(er,el),Q.closePath(),Q.fill(),Q.restore();break;case"arc_down":!function(e,t){let{cx:i,cy:s,left:r,right:n,deflection:a,arcWidth:o}=iq(t);e.save(),e.beginPath(),e.moveTo(n,s);let l=i+a,u=s+a,h=i-a,c=s+a;e.bezierCurveTo(l,u,h,c,r,s),e.lineTo(r,s+o),e.bezierCurveTo(h,c+o,l,u+o,n,s+o),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arc_up":!function(e,t){let{cx:i,cy:s,left:r,right:n,deflection:a,arcWidth:o}=iq(t);e.save(),e.beginPath(),e.moveTo(n,s);let l=i+a,u=s-a,h=i-a,c=s-a;e.bezierCurveTo(l,u,h,c,r,s),e.lineTo(r,s-o),e.bezierCurveTo(h,c-o,l,u-o,n,s-o),e.closePath(),e.fill(),e.restore()}(e,i);break;case"thumbs_up":var eh=e,ec=i;eh.save(),eh.translate(ec.x,ec.y),eh.lineWidth=.05;let ed=Math.min(ec.width,ec.height)/18;eh.scale(ed,ed),eh.lineCap="butt",eh.save(),eh.save(),eh.beginPath(),eh.moveTo(3.23,8.96),eh.lineTo(4.17,8.96),eh.bezierCurveTo(4.73,8.81,5.91,6.45,6.45,5.82),eh.bezierCurveTo(6.88,5.33,7.66,5.09,8.48,3.7),eh.bezierCurveTo(9.11,2.78,8.38,1.49,10.06,1.17),eh.bezierCurveTo(10.9,1.01,11.86,2.61,11.58,4.11),eh.bezierCurveTo(11.49,4.6,11.25,5.14,11.07,5.54),eh.bezierCurveTo(10.63,6.5,10.05,6.58,10.17,7.23),eh.bezierCurveTo(10.98,7.25,11.79,7.32,12.67,7.27),eh.bezierCurveTo(14.33,7.17,15.55,9.08,14.43,10.38),eh.bezierCurveTo(14.9,11.12,14.79,12.33,14.14,12.81),eh.bezierCurveTo(14.42,13.58,14.25,14.45,13.67,14.8),eh.bezierCurveTo(14.13,16.77,12.36,16.87,11.77,16.84),eh.lineTo(4.65,16.84),eh.bezierCurveTo(3.87,16.77,3.95,16.28,3.5,16.27),eh.bezierCurveTo(3.39,16.26,3.3,16.26,3.3,16.26),eh.bezierCurveTo(3.18,16.26,3.19,15.7,3.28,15.7),eh.bezierCurveTo(3.36,15.69,3.61,15.68,3.87,15.71),eh.bezierCurveTo(4.03,15.79,4.4,16.26,4.75,16.27),eh.lineTo(12.12,16.26),eh.bezierCurveTo(13.13,16.27,13.67,15.11,12.8,14.56),eh.bezierCurveTo(13.85,14.53,13.98,12.98,13.19,12.6),eh.bezierCurveTo(14.35,12.49,14.5,10.65,13.44,10.41),eh.bezierCurveTo(14.8,9.97,14.39,7.59,12.35,7.83),eh.bezierCurveTo(11.42,7.77,9.87,7.94,9.68,7.62),eh.bezierCurveTo(9.41,6.82,9.684,6.45,10.17,5.88),eh.bezierCurveTo(10.5,5.46,11.02,4.6,11.04,3.64),eh.bezierCurveTo(11.05,2.5,10.41,1.23,9.58,1.98),eh.bezierCurveTo(9.38,2.21,9.36,3.47,8.94,4.02),eh.bezierCurveTo(8.09,5.52,7.3,5.66,6.95,6.15),eh.bezierCurveTo(6.27,6.86,4.93,9.52,4.36,9.52),eh.bezierCurveTo(3.98,9.52,3.243,9.52,3.24,9.52),eh.bezierCurveTo(3.12,9.52,3.08,8.98,3.22,8.95),eh.closePath(),eh.fill(),eh.restore(),eh.restore(),eh.restore();break;case"thumbs_down":var ep=e,ef=i;ep.save(),ep.translate(ef.x,ef.y),ep.lineWidth=.05;let em=Math.min(ef.width,ef.height)/18;ep.scale(em,em),ep.lineCap="butt",ep.save(),ep.save(),ep.beginPath(),ep.moveTo(14.77,9.04),ep.lineTo(13.82,9.04),ep.bezierCurveTo(13.27,9.18,12.09,11.55,11.54,12.17),ep.bezierCurveTo(11.12,12.66,10.34,12.9,9.52,14.29),ep.bezierCurveTo(8.88,15.21,9.62,16.51,7.93,16.82),ep.bezierCurveTo(7.1,16.98,6.13,15.39,6.42,13.88),ep.bezierCurveTo(6.51,13.4,6.75,12.855,6.93,12.46),ep.bezierCurveTo(7.37,11.49,7.95,11.41,7.82,10.76),ep.bezierCurveTo(7.02,10.75,6.21,10.68,5.33,10.73),ep.bezierCurveTo(3.66,10.83,2.44,8.91,3.57,7.62),ep.bezierCurveTo(3.09,6.88,3.2,5.67,3.85,5.19),ep.bezierCurveTo(3.57,4.42,3.74,3.55,4.33,3.2),ep.bezierCurveTo(3.87,1.22,5.64,1.13,6.22,1.16),ep.lineTo(13.35,1.16),ep.bezierCurveTo(14.12,1.22,14.04,1.71,14.49,1.73),ep.bezierCurveTo(14.6,1.73,14.7,1.73,14.7,1.73),ep.bezierCurveTo(14.82,1.74,14.8,2.29,14.72,2.3),ep.bezierCurveTo(14.63,2.31,14.39,2.32,14.12,2.28),ep.bezierCurveTo(13.96,2.21,13.6,1.74,13.25,1.73),ep.lineTo(5.88,1.73),ep.bezierCurveTo(4.86,1.73,4.33,2.88,5.19,3.44),ep.bezierCurveTo(4.14,3.47,4.01,5.02,4.8,5.39),ep.bezierCurveTo(3.64,5.5,3.49,7.35,4.55,7.58),ep.bezierCurveTo(3.19,8.02,3.6,10.4,5.64,10.16),ep.bezierCurveTo(6.57,10.23,8.12,10.05,8.32,10.37),ep.bezierCurveTo(8.58,11.17,8.32,11.54,7.82,12.11),ep.bezierCurveTo(7.49,12.54,6.97,13.39,6.96,14.36),ep.bezierCurveTo(6.94,15.49,7.59,16.76,8.41,16.01),ep.bezierCurveTo(8.62,15.78,8.63,14.52,9.05,13.97),ep.bezierCurveTo(9.9,12.47,10.69,12.33,11.04,11.84),ep.bezierCurveTo(11.72,11.13,13.06,8.47,13.637,8.47),ep.bezierCurveTo(14.01,8.47,14.75,8.47,14.75,8.47),ep.bezierCurveTo(14.87,8.47,14.91,9.01,14.77,9.04),ep.closePath(),ep.fill(),ep.restore(),ep.restore(),ep.restore();break;case"buy":ij(e,i,"B");break;case"sell":ij(e,i,"S")}return!0}}class m9 extends mi{helper;constructor(e,t){super(e,t),this.addPoints(2),this.helper=new f3(e)}getElements(){let e=this.axis.pane.presenter.timeline,{price:t,time:i}=this.points[0],s=e_(e,i,Number,hP),r=e_(e,this.points[1].time,Number,hP),n=r-s;if(-1===s||-1===r)return[];let a=({value:i})=>{let r=e.at(s+i*n);return null===r?null:(this.helper.update(t,r),new f2(this.helper.point,!0,this.axis))};return this.getColoredElements(a)}getTextRef(){return(e,t,i)=>({ref:t.anchor,spacing:3,offsetY:!0,text:i.toString()})}adornElements(e,t){let i=this.axis.pane.getBoundsWithoutScales();this.adornElementsForColoredFactors(e,(e,t)=>{let s=new Path2D;if(null===e)return s;let r=t.anchor.x-e.anchor.x;return s.rect(e.anchor.x,i.y,r,i.height),s},this.getTextRef(),t)}getTimeScaleAdornments(){let e=e=>({time:this.points[e].time,color:this.traits.line.color});return[e(0),e(1)]}}class ge{snapToSupported=!0;isDrawingAnnotation=!0;constructor(){}onMouseMove(e){let{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){if(eI()&&e.originalEvent instanceof TouchEvent)return;let{point:t}=e,i=t.axis.pane.presenter,s={chart:i.accessor,axis:t.axis,point:{time:t.time.getTime(),price:t.price}};i.notifyHost(ao.CH_ANNPOINTPICKED,s),gE(i,void 0)}}let gt="Closed";class gi extends mt{isLong;twoDecMeta;_dataWindow;_metaData;isHit;constructor(e,t,i){super(e,t),this.isLong=i,this.isHit=!1,this.addPoints(4);let s=(e,t)=>this.points[e].moveDirection=t;s(1,ei.Vertical),s(2,ei.Vertical),s(3,ei.Horizontal),this.twoDecMeta=new it(2)}data(e){return this.presenter.mainPlot.timeSeries.container.getData(e)}get presenter(){return this.axis.pane.presenter}getDataWindow(e,t,i=!0,s=!0){let r=this.data(aa.DateTime),n=e_(r,+e,Number),a=e_(r,+t,Number),o={refIndex:-1,highestIndex:-1,lowestIndex:-1,highest:null,lowest:null,data:[]},[l,u,h]=[aa.High,aa.Low,aa.Close].map(e=>this.data(e)),c=e=>e-n;for(let e=n;e<=a;e++)i&&-1===o.refIndex&&eH(this.entryPrice)&&this.entryPrice>=u[e]&&this.entryPrice<=l[e]&&(o.refIndex=c(e)),(!i||o.refIndex>=0&&c(e)>=o.refIndex)&&((!eH(o.highest)||l[e]>o.highest)&&(o.highest=l[e]),(!eH(o.lowest)||u[e]<o.lowest)&&(o.lowest=u[e])),i&&-1!==o.refIndex&&(-1===o.highestIndex&&l[e]>this.upperPrice&&(o.highestIndex=c(e)),-1===o.lowestIndex&&u[e]<this.lowerPrice&&(o.lowestIndex=c(e))),s&&o.data.push({high:l[e],low:u[e],close:h[e],time:r[e]});if(s&&o.data&&o.data.length>0){o.state=eH(o.highest,o.lowest)&&(this.upperPrice<o.highest||this.lowerPrice>o.lowest)?gt:"Open",o.special=-1===o.highestIndex&&-1===o.lowestIndex||o.highestIndex===o.lowestIndex;let e=eb(o.data);if(o.toPrice=e.close,o.toTime=e.time,o.state===gt)if(o.special){if(-1!==o.refIndex){let e=o.data[o.refIndex];o.toTime=e.time;let t=this.isLong?this.lowerPrice<o.lowest:this.upperPrice<o.highest;o.toPrice=t?this.upperPrice:this.lowerPrice}}else{let e=-1!==o.highestIndex&&-1!==o.lowestIndex;e&&o.highestIndex<o.lowestIndex||-1===o.lowestIndex?(o.toPrice=this.upperPrice,o.toTime=o.data[o.highestIndex].time):(e&&o.lowestIndex<o.highestIndex||-1===o.highestIndex)&&(o.toPrice=this.lowerPrice,o.toTime=o.data[o.lowestIndex].time)}let t=this.isLong?o.toPrice-this.entryPrice:this.entryPrice-o.toPrice;o.pAndL=eF(t,2)}return o}get dataWindow(){return eH(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=e_(e,+this.points[0].time,Number,hP),i=Math.min(e.length-1,t+50);return e.at(i).getTime()}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[tG.AT_ACCOUNT_SIZE]}get risk(){let e=this.traits[tG.AT_RISK_IS_PERCENT],t=this.traits[tG.AT_RISK];return eF(e?t/100*this.accountSize:t,2)}get pointValue(){return this._metaData||(this._metaData=this.presenter.mainPlot.metaData),this._metaData.pointValue}formatDollarValue(e){return Number.isFinite(e)?`${e<0?"-":""}$${this.twoDecMeta.format(Math.abs(e))}`:tG.NOT_APPLICABLE}get qty(){return Math.floor(this.risk/(this.isLong?this.entryPrice-this.lowerPrice:this.upperPrice-this.entryPrice))}get upperDiff(){return eF(this.upperPrice-this.entryPrice,2)}get amountMultiplier(){return this.isLong?1:-1}get upperAmount(){return eF(this.accountSize+this.amountMultiplier*this.qty*this.upperDiff,2)}get upperPandL(){return eF(this.amountMultiplier*this.upperDiff*this.pointValue,2)}get isCompact(){return this.traits[tG.AT_COMPACT]}get upper(){let e=hy(this.axis,this.priceMap(this.upperPrice)),t=`(${eF(this.upperDiff/this.entryPrice*100,2).toFixed(2)}%)`;return this.isCompact,`${e} ${t}`}get upperText(){let e=`${this.formatDollarValue(this.upperPandL)}`,t=`${this.formatDollarValue(this.upperAmount)}`,i=this.isLong?"Target":"Stop";return this.isCompact?`${this.upper} ${e}`:`${i}: ${this.upper}, P&L: ${e}, Amount: ${t}`}get lowerDiff(){return eF(this.entryPrice-this.lowerPrice,2)}get lowerAmount(){return eF(this.accountSize-this.amountMultiplier*this.qty*this.lowerDiff,2)}get lowerPandL(){return eF(-this.amountMultiplier*this.lowerDiff*this.pointValue,2)}get lower(){let e=hy(this.axis,this.priceMap(this.lowerPrice)),t=`(${eF(this.lowerDiff/this.entryPrice*100,2).toFixed(2)}%)`;return this.isCompact,`${e} ${t}`}get lowerText(){let e=`${this.formatDollarValue(this.lowerPandL)}`,t=`${this.formatDollarValue(this.lowerAmount)}`,i=this.isLong?"Stop":"Target";return this.isCompact?`${this.lower} ${e}`:`${i}: ${this.lower}, P&L: ${e}, Amount: ${t}`}get riskReward(){return eF(this.isLong?this.upperDiff/this.lowerDiff:this.lowerDiff/this.upperDiff,2)}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(tG.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(tG.AT_FILL)}get textStyle(){return this.fillOnlyStyle(tG.AT_FILL_TEXT)}get secondaryLineStyle(){return i7({line:{color:this.traits.line.color,dashStyle:"ShortDash"},fill:{color:tG.COLOR_TRANSPARENT}})}wasModifiedByTool(){eH(this.points[2].price)||this.positionPoints(),this._dataWindow=void 0}wasPointMovedByTool(e,t){let i=this.getVisiblePriceRange()/5e3;if(3>this.points.indexOf(e)){let t=t=>e.update(t,e.time);this.entryAnchor.price>this.upperAnchor.price&&t(e===this.entryAnchor?this.upperAnchor.price-i:this.entryAnchor.price+i),this.entryAnchor.price<this.lowerAnchor.price&&t(e===this.entryAnchor?this.lowerAnchor.price+i:this.entryAnchor.price-i)}if(e===this.entryAnchor){let t=(t,i,s)=>t.update(i?e.price:t.price,s?e.time:t.time);t(this.exitAnchor,!0,!1),t(this.upperAnchor,!1,!0),t(this.lowerAnchor,!1,!0)}this.wasModifiedByTool()}get isUpperPerPAndL(){let e=this.dataWindow;return this.isLong?e.pAndL>0:e.pAndL<=0}getStyleForElement(e,t){return e.style||this.defaultStyle}getElements(){let e=new f9(this.entryAnchor.point,this.exitAnchor.point,!1,!1,this.axis),t=this.exitAnchor.point.x<this.entryAnchor.point.x,i=Math.abs(this.exitAnchor.point.x-this.entryAnchor.point.x),s=(e,t)=>({x:e.x+t,y:e.y}),r=new me(s(this.upperAnchor.point,t?-i:0),i,Math.abs(this.upperAnchor.point.y-this.entryAnchor.point.y),this.axis);r.style=this.upperStyle;let n=new me(s(this.entryAnchor.point,t?-i:0),i,Math.abs(this.entryAnchor.point.y-this.lowerAnchor.point.y),this.axis);n.style=this.lowerStyle;let a=[e,r,n],o=this.dataWindow;if(-1!==o.refIndex){let e=o.data[o.refIndex],t=new f3(this.axis,this.entryPrice,e.time),i=new f3(this.axis,o.toPrice,o.toTime),s=new f9(t.point,i.point,!1,!1,this.axis);if(s.style=this.secondaryLineStyle,a.push(s),t.time!==i.time){let e=this.entryPrice<o.toPrice,s=new me({x:t.point.x,y:Math.min(t.point.y,i.point.y)},i.point.x-t.point.x,Math.abs(i.point.y-t.point.y),this.axis);s.style=e?this.upperStyle:this.lowerStyle,a.push(s)}}return a}hitTest(e){if(!this.visible)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=>ib(this.traits[e].color);return[{price:this.upperPrice,color:e(tG.AT_FILL)},{price:this.entryPrice,color:e(tG.AT_LINE)},{price:this.lowerPrice,color:e(tG.AT_FILL2)}]}adornElements(e,t){let[i,s,r]=e;if(this.showTextAdornments){let[e,n]=[!0,!1].map(e=>iF(t,e)),{x:a,y:o,width:l}=s.rect,u=this.textStyle.fillStyle;iU(t,this.upperText,{x:a+l/2,y:o+e},J.Center,u,ib(this.upperStyle.fillStyle));let{x:h,y:c,width:d,height:p}=r.rect;iU(t,this.lowerText,{x:h+d/2,y:c+p+Math.abs(n)},J.Center,u,ib(this.lowerStyle.fillStyle));let{p1:f,p2:m}=i,{x:g,y:y}=f,{x:T}=m,A=this.state||tG.NOT_APPLICABLE,S=this.isCompact?`${this.formatDollarValue(this.pAndLValue)}`:`${A} P&L: ${this.formatDollarValue(this.pAndLValue)}, Qty: ${this.qty}`,v=this.isCompact?`${this.riskReward.toFixed(2)}`:`Risk/Reward Ratio: ${this.riskReward.toFixed(2)}`,b=e=>t.measureText(e).width,P=Math.abs(T-g)<1.25*Math.max(b(S),b(v))?y+Math.abs(n)+5:y+e+10,C=ib(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);iU(t,[S,v],{x:g+(T-g)/2,y:P},J.Center,u,C)}}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}}var gs=["years","months","weeks","days","hours","minutes","seconds"];function gr(e,t){te(2,arguments);var i=ti(e),s=ti(t),r=i.getTime()-s.getTime();return r<0?-1:r>0?1:r}function gn(e){return(gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ga(e,t){if(te(2,arguments),!t||"object"!==gn(t))return new Date(NaN);var i=t.years?e9(t.years):0,s=t.months?e9(t.months):0,r=t.weeks?e9(t.weeks):0,n=t.days?e9(t.days):0,a=t.hours?e9(t.hours):0,o=t.minutes?e9(t.minutes):0,l=t.seconds?e9(t.seconds):0,u=ti(e),h=s||i?ts(u,s+12*i):u;return new Date((n||r?lO(h,n+7*r):h).getTime()+1e3*(l+60*(o+60*a)))}function go(e,t,i){te(2,arguments);var s=ug(e,t)/6e4;return uT(null==i?void 0:i.roundingMethod)(s)}class gl extends ms{markers;display=null;constructor(e,t){super(e,t),this.points=ma(e),this.points[2].visible=!1,this.points[3].visible=!1,this.markers=[new mU]}isPointDrawn(e){return!!super.isPointDrawn(e)&&e.visible}makeLineArrow(e,t,i,s){let r=[im(e,t),im(i,s)];return[this.makeLine(r[0],r[1]),mk(r,"end",10)]}get rectColor(){return this.traits[tG.AT_FILL].color}get textColor(){return this.traits[tG.AT_FILL_TEXT].color}getMarkers(){return this.markers}formatDateDifference(e,t){return this.presenter.data.aggregation.isEndOfDay?`${lL(t,e)}d`:(function(e,t){if(arguments.length<1)throw TypeError("1 argument required, but only ".concat(arguments.length," present"));var i,s,r,n,a,o=null!=(i=null!=(s=null==t?void 0:t.locale)?s:nd.locale)?i:oU,l=null!=(r=null==t?void 0:t.format)?r:gs,u=null!=(n=null==t?void 0:t.zero)&&n,h=null!=(a=null==t?void 0:t.delimiter)?a:" ";return o.formatDistance?l.reduce(function(t,i){var s="x".concat(i.replace(/(^.)/,function(e){return e.toUpperCase()})),r=e[i];return"number"==typeof r&&(u||e[i])?t.concat(o.formatDistance(s,r)):t},[]).join(h):""})(function(e){te(1,arguments);var t=ti(e.start),i=ti(e.end);if(isNaN(t.getTime()))throw RangeError("Start Date is invalid");if(isNaN(i.getTime()))throw RangeError("End Date is invalid");var s={};s.years=Math.abs(function(e,t){te(2,arguments);var i=ti(e),s=ti(t),r=gr(i,s),n=Math.abs(function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return i.getFullYear()-s.getFullYear()}(i,s));i.setFullYear(1584),s.setFullYear(1584);var a=gr(i,s)===-r,o=r*(n-Number(a));return 0===o?0:o}(i,t));var r=gr(i,t),n=ga(t,{years:r*s.years});s.months=Math.abs(function(e,t){te(2,arguments);var i,s=ti(e),r=ti(t),n=gr(s,r),a=Math.abs(function(e,t){te(2,arguments);var i=ti(e),s=ti(t);return 12*(i.getFullYear()-s.getFullYear())+(i.getMonth()-s.getMonth())}(s,r));if(a<1)i=0;else{1===s.getMonth()&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-n*a);var o=gr(s,r)===-n;(function(e){te(1,arguments);var t=ti(e);return lx(t).getTime()===(function(e){te(1,arguments);var t=ti(e),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t})(t).getTime()})(ti(e))&&1===a&&1===gr(e,r)&&(o=!1),i=n*(a-Number(o))}return 0===i?0:i}(i,n));var a=ga(n,{months:r*s.months});s.days=Math.abs(lL(i,a));var o=ga(a,{days:r*s.days});s.hours=Math.abs(function(e,t,i){te(2,arguments);var s=ug(e,t)/36e5;return uT(null==i?void 0:i.roundingMethod)(s)}(i,o));var l=ga(o,{hours:r*s.hours});s.minutes=Math.abs(go(i,l));var u=ga(l,{minutes:r*s.minutes});return s.seconds=Math.abs(uA(i,u)),s}({start:e,end:t}),{format:["days","hours","minutes","seconds"]}).replaceAll(/(days?)|(hours?)|(minutes?)|(seconds?)/g,e=>e[0])}computeState(){}get text(){return null===this.display&&this.computeState(),this.display}getTextCoord(e,t){let i=this.points[0].price<this.points[1].price,s=iF(t,i,this.text.length),{x:r,y:n,width:a,height:o}=e.rect;return{x:r+a/2,y:n+(i?0:o)+(i?s:Math.abs(s))}}adornElements(e,t){iU(t,this.text,this.getTextCoord(e[0],t),J.Center,this.textColor,ib(this.rectColor))}getDateDifference(){let[e,t]=this.points.slice(0,2).map(e=>e.time),i=Math.min(+e,+t),s=Math.max(+e,+t),r=this.data(aa.DateTime),n=e_(r,+i,Number),a=e_(r,+s,Number),o=ef(this.data(aa.Volume).slice(n,a+1)),l=this.formatter.format(o,aa.Volume),u=a-n,h=0===u?"":this.formatDateDifference(i,s),c=e<t?"":"-";return[`${c}${u} bars, ${c}${h}`,`Vol ${l}`]}getPriceDifference(){let[e,t]=this.points.slice(0,2).map(e=>e.price),i=t-e,s=this.formatter.format(i,aa.Close),r=this.formatter.format(i/e,aa.PercentChange);return[`${s} (${r})`]}resetComputedState(){this.display=null}getFlipAnchorIndices(){return[0,1]}}class gu extends gl{getElements(){this.points.slice(2).forEach(e=>e.toPoint());let[e,t,i,s]=this.getScreenPoints(),r=this.makeLine(e,s),n=this.makeLine(t,i),[a,o]=this.makeLineArrow(e,s,t,i);return this.markers[0]=o,[this.rect,r,n,a]}computeState(){this.display=this.getDateDifference()}}class gh extends gl{getElements(){this.points.slice(2).forEach(e=>e.toPoint());let[e,t,i,s]=this.getScreenPoints(),r=this.makeLine(e,i),n=this.makeLine(t,s),[a,o]=this.makeLineArrow(e,i,t,s);return this.markers[0]=o,[this.rect,r,n,a]}computeState(){this.display=this.getPriceDifference()}}class gc extends gl{get drawBorder(){return this.traits[tG.AT_DRAW_BORDER]}getBorderElements(){if(!this.drawBorder)return[];let[e,t,i,s]=this.getScreenPoints();return[this.makeLine(e,s),this.makeLine(t,i),this.makeLine(e,i),this.makeLine(t,s)]}getElements(){this.points.slice(2).forEach(e=>e.toPoint());let[e,t,i,s]=this.getScreenPoints(),[r,n]=this.makeLineArrow(e,s,t,i),[a,o]=this.makeLineArrow(e,i,t,s);this.markers=[n,o];let l=this.getBorderElements();return[this.rect,r,a].concat(l)}computeState(){this.display=this.getPriceDifference().concat(this.getDateDifference())}}class gd extends ms{constructor(e,t){super(e,t),this.points=ma(e)}get priceLevels(){return i0(this.traits[tG.AT_PRICE_LEVELS])}get timeLevels(){return i0(this.traits[tG.AT_TIME_LEVELS])}get showAngles(){return this.traits[tG.AT_SHOW_ANGLES]}get reverse(){return this.traits[tG.AT_REVERSE]}get showLeftLabels(){return this.traits[tG.AT_SHOW_LEFT_LABELS]}get showRightLabels(){return this.traits[tG.AT_SHOW_RIGHT_LABELS]}get showTopLabels(){return this.traits[tG.AT_SHOW_TOP_LABELS]}get showBottomLabels(){return this.traits[tG.AT_SHOW_BOTTOM_LABELS]}getAngles(e,t){let i=this.getScreenPoints(),s=this.lineOnlyStyle(tG.AT_LINE_2),r=[];e.concat(t).flatMap(e=>[e.p1,e.p2]).map(e=>{r.some(t=>e.x===t.x&&e.y===t.y)||r.push(e)});let n=i.map(e=>r.filter(t=>t.x!==e.x&&t.y!==e.y).map(t=>this.makeLine(e,t))).flat();return n.forEach(e=>e.style=s),n}getElements(){let e=this.getLinesDataAtLevels(this.priceLevels,this.timeLevels),{priceLines:t,timeLines:i}=this.getLineElements(e),s=this.showAngles?this.getAngles(t,i):[];return[...t,...i,...s]}adornElements(e,t){let i=this.singleStyle,s=this.showBackground,r=t.fillStyle,n=iH(t,1)/2,{x:a,y:o}=tG.DEFAULT_ADORN_OFFSET,l=(e,i,s,r,n)=>{let a=iT(e,i);iU(t,Number(s.toFixed(4)).toString(),a,r,n)},u=null;if(e.forEach(e=>{if(!e._data)return;let{level:h,isPrice:c}=e._data,d=i?r:e.style.strokeStyle,p=u&&s&&!i;c?(this.showLeftLabels&&l(e.p1,{x:a,y:n},h,J.Right,d),this.showRightLabels&&l(e.p2,{x:-a,y:n},h,J.Left,d)):(this.showTopLabels&&l(e.p1,{x:0,y:o},h,J.Center,d),this.showBottomLabels&&l(e.p2,{x:0,y:-(2*o)},h,J.Center,d)),p&&((e,i)=>{let s=new Path2D;iV(s,e.p1,i.p2),t.fillStyle=i.style.fillStyle,t.fill(s)})(u,e),u=e}),i&&s){let e=this.applyBackgroundOpacity(this.traits.line.color),i=new Path2D,[s,r]=this.getScreenPoints();iV(i,s,r),t.fillStyle=e,t.fill(i)}}resetComputedState(){this.lines=void 0}updateFrom(e,t,i,s,r){let n=e.reverse!==this.reverse;super.updateFrom(e,t,i,s,r),n&&this.resetComputedState()}getFlipAnchorIndices(){return[0,1]}}let gp=e=>e.map(e=>({...e,dimensions:e.value.split("x").map(Number)})),gf=(e,t)=>1e-7>Math.abs(e-t);class gm extends ms{_parsedFans=null;_parsedArcs=null;constructor(e,t){super(e,t),this.points=ma(e),this._parsedFans=this._parsedArcs=null}get levels(){return i0(this.traits[tG.AT_LEVELS])}setComputedAndTraits(e,t){let i={...e,computed:t,traits:this.getTraitsFor(e)};return delete i.line,i}get computedLevels(){return this.levels.map(e=>this.setComputedAndTraits(e,e.value/5))}get showRangesRatio(){return this.traits[tG.AT_SHOW_RANGES_RATIO]}get arcs(){return i0(this.traits[tG.AT_ARCS])}get fans(){return i0(this.traits[tG.AT_FANS])}get reverse(){return this.traits[tG.AT_REVERSE]}get parsedFans(){return null===this._parsedFans&&(this._parsedFans=gp(this.fans)),this._parsedFans}get computedFans(){let[,,e,t]=this.getReversedScreenPoints(),{dx:i,dy:s}=this.unit,{signX:r,signY:n}=this.getOrientation();return this.parsedFans.map(a=>{let[o,l]=a.dimensions;return this.setComputedAndTraits(a,o>=l?{x:e.x,y:e.y+l/o*n*5*s}:{x:t.x+o/l*5*r*i,y:t.y})})}get parsedArcs(){return null===this._parsedArcs&&(this._parsedArcs=gp(this.arcs)),this._parsedArcs}get computedArcs(){let{dx:e}=this.unit;return this.parsedArcs.map(t=>{let[i,s]=t.dimensions;return this.setComputedAndTraits(t,Math.sqrt(e**2*(i**2+s**2)))})}getReversedScreenPoints(){let[e,t,i,s]=this.getScreenPoints();return this.reverse?[t,e,s,i]:[e,t,i,s]}get unit(){let[e,t]=this.getReversedScreenPoints();return e.x!==t.x&&e.y!==t.y?{dx:Math.abs(t.x-e.x)/5,dy:Math.abs(t.y-e.y)/5}:null}get priceBarRatio(){return this.traits[tG.AT_PRICE_BAR_RATIO]}set priceBarRatio(e){this.traits[tG.AT_PRICE_BAR_RATIO]=e}makeStyledLine(e,t,i){let s=this.makeLine(e,t);return this.singleStyle||(s.style=i7(i)),s}getGridLines(e,t){let i=t.x-e.x,s=t.y-e.y;return this.computedLevels.map(({computed:r,traits:n})=>{let a=e.x+r*i,o=e.y+r*s;return[this.makeStyledLine({x:a,y:e.y},{x:a,y:t.y},n),this.makeStyledLine({x:e.x,y:o},{x:t.x,y:o},n)]}).flat()}getArcs(e){let{flipX:t,flipY:i,signY:s}=this.getOrientation(),{dx:r,dy:n}=this.unit,a=gf(r,n)?null:{x:1,y:n/r},o=this.getClipPath();return this.computedArcs.map(({computed:r,traits:n})=>{let l=new mJ(e,null,r,t?s*Math.PI/2:0,t?Math.PI:s*Math.PI/2,i,this.axis);return null!==a&&(l.scale=a),l.clip=o,this.singleStyle||(l.style=i7(n)),l})}getFans(e){return this.computedFans.map(({computed:t,traits:i})=>this.makeStyledLine(e,t,i))}getElements(){if(null===this.unit)return[];let[e,t]=this.getReversedScreenPoints(),i=this.getGridLines(e,t);return[...i,...this.getArcs(e),...this.getFans(e)]}getOrientation(){let[e,t]=this.getReversedScreenPoints(),i=t.x<e.x,s=t.y<e.y;return{flipX:i,signX:i?-1:1,flipY:s,signY:s?-1:1}}getClipPath(){let[e,t]=this.getReversedScreenPoints(),i=new Path2D;return iV(i,e,t),i}adornElements(e,t){if(0===e.length)return;let i=(e,i,s)=>{t.fillStyle=s;let r=i.hasScale;r&&(t.save(),i.applyScale(t)),t.fill(e),r&&t.restore()};if(this.showBackground){let s=e.filter(e=>e.radius),r=this.getClipPath();if(t.save(),t.clip(r),this.singleStyle){let e=eb(s);i(mQ(null,e),e,this.applyBackgroundOpacity(this.traits.line.color))}else{let e=null;s.forEach(t=>{let s=mQ(e,t),r=t.style.fillStyle;i(s,t,r),e=t})}t.restore()}if(this.showRangesRatio&&null!==this.unit){let e=eb(this.computedLevels),i=(this.singleStyle?this:e).traits.line.color,[,s,r,n]=this.getReversedScreenPoints(),{x:a,y:o}=tG.DEFAULT_ADORN_OFFSET,{flipX:l,signX:u,signY:h}=this.getOrientation(),c=iT(r,{x:-a*u,y:o*h}),{priceDiff:d,barsDiff:p}=this.getLinesDataAtLevels(null,null),f=l?J.Right:J.Left;iU(t,p.toFixed(0),c,f,i);let m=iT(n,{x:2*a*u,y:-o*h}),g=l?J.Left:J.Right;iU(t,this.formatter.format(d,aa.Close),m,g,i);let y=iT(s,{x:-a*u,y:-o*h});iU(t,this.priceBarRatio.toFixed(6),y,f,i)}}resetComputedState(){if(this.lines=void 0,4===this.points.length&&null!==this.unit){let{priceDiff:e,barsDiff:t}=this.getLinesDataAtLevels(null,null);this.priceBarRatio=Math.abs(e/t)}}updateFrom(e,t,i,s,r){if(super.updateFrom(e,t,i,s,r),this._parsedFans=this._parsedArcs=null,!gf(e.priceBarRatio,this.priceBarRatio)){let[t,i,,]=this.points;this.reverse&&([t,i]=[i,t]);let{priceDiff:s,barsDiff:r}=this.getLinesDataAtLevels(null,null);i.update(t.price+Math.sign(s)*e.priceBarRatio*r,i.time),this.resetComputedState()}}getFlipAnchorIndices(){return[0,1]}}class gg extends mi{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[tG.AT_EXTEND_PT_1]}get extend2(){return this.traits[tG.AT_EXTEND_PT_2]}getElements(){let[e,t,i]=this.getScreenPoints(),{x:s,y:r}=iy(i,e),n=i=>{let[s,r]=[e,t].map(e=>iT(e,i));return new f9(s,r,this.extend1,this.extend2,this.axis)};return this.getColoredElements(({value:e})=>n({x:s*e,y:r*e}))}getTextRef(){return(e,t,i)=>{let s=this.formatLevelPrice(i,t.anchor1.y);return{ref:t,spacing:5,offsetY:!0,text:s}}}adornElements(e,t){this.adornElementsForColoredFactors(e,(e,t)=>{let i=new Path2D;return null===e||(iR(i,e.p1),iN(i,e.p2),iN(i,t.p2),iN(i,t.p1)),i},this.getTextRef(),t)}}class gy extends mt{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,i){super(e,t),this.computed=!0,this.studyPlotId=i,this.gotData=!1}setOptions(e){switch(this.levelMode=e.LevelMode,this.levelSize=e1(1,1e3,e.LevelSize),this.alignLeft="Left"===e.Position,this.totalVolume="Total"===e.Volume,this.widthPercent=e1(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(U.ChangeBased)??!1}}eV(e.PeriodType)&&(this.periodType=e.PeriodType),this.period=e.Period,this.valueRangePercent=e.ValueRangePercent/100;let t=es[y0()?.config.mode??"Unspecified"];this.usesFinerGrainedAgg=sF(t)}get isCountMode(){return"Count"===this.levelMode}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),t=e?.getTimeData();if(!eH(t))return;let i=t[t.length-1],s=this.boxes.length>0?this.boxes[this.boxes.length-1]:null;if(eV(s)&&i.valueOf()<s.lastDate.valueOf())this.updateLastBox();else{let e=this.getDataForRange(i,this.getBoxEndFromStart(i));e&&this.boxes.push(e)}break}case"DataPointChanged":this.updateLastBox();break;case"NewChunkArrived":this.gotData=!1}}}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,i=this.axis.toY(e.min),s=this.axis.toY(e.max),r=this.axis.pane.presenter.view.toX(e.firstDate)-t.width/2,n=0;if("Days"===this.periodType){let i=e.lastDate,s=this.axis.pane.presenter.view.xAxis.xScale.timeline,a=s.at(s.lastSeriesIndex),o=a.valueOf()<i.valueOf(),l=o?a:i,u=(o?1:-2)*t.width/2;n=this.axis.pane.presenter.view.toX(l)+u-r}else n=this.period*t.width+(this.period-1)*t.spacing;return new iD(r,s,n,i-s)}default:throw Error("Unexpected period type for Volume At Price annotation")}}getElementsForBox(e){let t=this.getBoxRect(e),i=[];if(this.isPeriodic){let e=new me({x:t.x,y:t.y},t.width,t.height,this.axis);e.style=this.backgroundStyle,i.push(e)}let{x:s,width:r}=t,n=r*this.widthPercent,a=e.bars[e.maxVolumeIndex];return e.bars.forEach((t,o)=>{let{upVolume:l,downVolume:u,totalVolume:h,isValue:c}=t;if(0===l&&0===u)return null;let d=this.axis.toY(e.min+o*e.zone),p=this.axis.toY(e.min+(o+1)*e.zone),f=Math.abs(d-p),m=(e,t,i=0)=>{let n=new me({x:this.alignLeft?s+i:s+r-e-i,y:p},e,f,this.axis);return n.style=t,n},g=(e,t,i)=>e/t.totalVolume*i,y=this.studyPlot.curves[2].visible,T=y&&c?this.upValueStyle:this.upStyle,A=y&&c?this.downValueStyle:this.downStyle,S=y&&c?this.totalValueStyle:this.totalStyle;if(this.totalVolume){let e=g(h,a,n);i.push(m(e,S))}else{let e=g(u,a,n),t=g(l,a,n);i.push(m(t,T),m(e,A,t))}if(this.studyPlot.curves[1].visible&&o===e.maxVolumeIndex){let e=i[i.length-1].rect,t=this.alignLeft?e.x+e.width:s,n=(p+d)/2,a=this.alignLeft?s+r:e.x;i.push(new f9({x:t,y:n},{x:a,y:n},!1,!1,this.axis))}}),i}get isVisible(){return this.studyPlot.visible&&this.studyPlot.mainCurve.visible}getElements(){if(this.gotData||this.getData(),!this.gotData||!this.isVisible||0===this.boxes.length)return[];switch(this.periodType){case"VisibleScreen":{let e=this.boxes[0];if(!e||0===e.bars.length)return[];return this.getElementsForBox(e)}case"Bars":case"Days":{let[e,t]=this.presenter.view.xAxis.xScale.domain()||[];if(!op(e)||!op(t))return[];let i=this.boxes.findIndex(t=>t.firstDate.getTime()<=e.getTime()&&t.lastDate.getTime()>=e.getTime());-1===i&&(i=0,this.studySeries.loadMoreData());let s=this.boxes.findIndex(e=>e.firstDate.getTime()<=t.getTime()&&e.lastDate.getTime()>=t.getTime());-1===s&&-1!==i&&(s=this.boxes.length-1);let r=[];for(let e=i;e<=s;e++)r.push(...this.getElementsForBox(this.boxes[e]));return r}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(tG.AT_FILL)}get upStyle(){return this.fillOnlyStyle(tG.AT_FILL2)}get totalStyle(){return this.fillOnlyStyle(tG.AT_FILL3)}get downValueStyle(){return this.fillOnlyStyle(tG.AT_FILL4)}get upValueStyle(){return this.fillOnlyStyle(tG.AT_FILL5)}get totalValueStyle(){return this.fillOnlyStyle(tG.AT_FILL6)}get backgroundStyle(){return this.fillOnlyStyle(tG.AT_FILL7)}get lineStyle(){return this.lineOnlyStyle(tG.AT_LINE)}getBoxEndFromStart(e){switch(this.periodType){case"VisibleScreen":default:return null;case"Days":return om(l$($.Day,this.period)(e),1);case"Bars":{let t=this.axis.pane.presenter.data.aggregation;return om(l$(t.unit,t.size*this.period)(e),1)}}}getData(){let e=this.axis.pane.presenter.data.aggregation;if(e.isTick||e.hasSpec&&!pR(e.spec))return;let[t,i]=this.presenter.view.xAxis.xScale.domain()||[];if(!op(t)||!op(i))return;let s=l$(e.unit,e.size);switch(this.periodType){case"VisibleScreen":{let e=this.boxes[0];if(e&&e.firstDate===t&&e.lastDate===i)this.gotData=!0;else{let e=this.getDataForRange(t,i);e&&(this.boxes[0]=e)}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 i=e.getTimeData(),r=0;for(this.boxes=[];r<i.length;){let e=i[r],t=r+this.period,n=om(t<i.length?i[t]:s(i[i.length-1]),1),a=this.getDataForRange(e,n);a&&this.boxes.push(a),r+=this.period}this.gotData=!0;break}case"Days":{if(e.isEndOfDay){this.boxes=[],this.gotData=!0;return}let[t,i]=[0,1].map(e=>this.studySeries.innCont(e));if((t?.size??0)<1||(i?.size??0)<1)return;let r=t.getTimeData(),n=t.getData(aa.TradingDay),a=e=>{let t=0,i=r[e],s=n[e];for(let a=e;a<r.length;a++)if(tl(r[a],i)>0&&n[a]!==s&&(t+=1,i=r[a],s=n[a],t===this.period))return a;return -1},o=0,l=r[0],u=a(o)-1;for(;(u<0||u===o)&&o<r.length;)o+=1,u=a(o)-1;for(this.boxes=[];o<r.length&&u<r.length&&o<u;){let e=om(s(r[u]),1),t=this.getDataForRange(l,e);t&&this.boxes.push(t),l=r[o=u+1],u=a(o)-1}if(u<0&&o<r.length-1){let e=om(s(r[r.length-1]),1),t=this.getDataForRange(r[o],e);t&&this.boxes.push(t)}this.gotData=!0}}}getBoxAt(e){if(0===this.boxes.length)return null;switch(this.periodType){case"VisibleScreen":{let t=this.boxes[0];if(t.firstDate>e||t.lastDate<e)return null;return t}case"Bars":case"Days":{let t=e.getTime(),i=this.boxes.find(e=>e.firstDate.getTime()<=t&&e.lastDate.getTime()>=t);if(!i)return null;return i}}}getValueAt(e,t,i){if(!this.isVisible)return null;let s=this.getBoxAt(t);if(!s)return null;let r=this.getBarIndex(s,i);if(r<0||r>=s.bars.length)return null;let n=s.bars[r];switch(e){case aa.UPVOL:return this.totalVolume?null:n.upVolume;case aa.DNVOL:return this.totalVolume?null:n.downVolume;case aa.TOTVOL:return this.totalVolume?n.totalVolume:null;case aa.POC:case aa.VAREA:case aa.BARBACK:return null;default:throw Error("Unexpected Volume At Price field")}}getBarIndex(e,t,i=!1){if(0===e.bars.length||0===e.zone)return -1;let s=Math.floor((t-e.min)/e.zone);return i?Math.min(e.bars.length-1,s):s}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:5e-324,zone:0,bars:[],maxVolumeIndex:-1,firstDate:e,lastDate:t}}findExtremes(e,t,i,s,r,n){let a=eV(r)&&eV(n);for(let o=t;o<=i;o++)if(a){let t=r[o];t>e.max&&(e.max=t);let i=n[o];i<e.min&&(e.min=i)}else{let t=s[o];t<e.min&&(e.min=t),t>e.max&&(e.max=t)}}findValueArea(e){if(-1===e.maxVolumeIndex||0===e.bars.length)return;e.bars[e.maxVolumeIndex].isValue=!0;let t=ef(e.bars.map(e=>e.totalVolume))*this.valueRangePercent,i=e.bars[e.maxVolumeIndex].totalVolume,s=e.maxVolumeIndex,r=e.maxVolumeIndex;for(;i<t;){let n=[{dir:"lower",count:2,startIdx:s-2,endIdx:s-1},{dir:"lower",count:1,startIdx:s-1,endIdx:s-1},{dir:"upper",count:2,startIdx:r+1,endIdx:r+2},{dir:"upper",count:1,startIdx:r+1,endIdx:r+1}].filter(t=>t.startIdx>=0&&t.endIdx<e.bars.length).map(t=>{let s=ef(e.bars.slice(t.startIdx,t.endIdx+1).map(e=>e.totalVolume));return{...t,volume:s,newTotal:i+s}});if(0===n.length)break;let a=(e,t)=>t.newTotal<e.newTotal?t:e,o=(e,t)=>t.volume>e.volume?t:e,l=n.filter(e=>e.newTotal>=t),u=l.length>0?l.reduce(a):n.reduce(o);for(let t=u.startIdx;t<=u.endIdx;t++)e.bars[t].isValue=!0;if("lower"===u.dir?s=u.startIdx:r=u.endIdx,(i=u.newTotal)>=t)break}}tallyVolume(e,t,i,s,r,n,a){let o=5e-324,l=!1;for(let u=t;u<=i;u++){let t=r[u],i=this.getBarIndex(e,t,!0);if(-1===i){l=!0;break}let h=a[u],c=this.useChange?n[u]>=0:s[u]<=r[u],d=e.bars[i];c?d.upVolume+=h:d.downVolume+=h,d.totalVolume=d.downVolume+d.upVolume,d.totalVolume>o&&(o=d.totalVolume,e.maxVolumeIndex=i)}l||this.findValueArea(e)}get isPeriodic(){return"Bars"===this.periodType||"Days"===this.periodType}get isVisibleScreen(){return"VisibleScreen"===this.periodType}getDataForRange(e,t){let i=this.makeBox(e,t),s=this.studySeries.innCont(1),r=s?.getTimeData();if(!eH(r))return null;let n=e=>e_(r,+e,Number),a=n(e),o=n(t);if(r[o].getTime()>t.getTime()&&(o-=1),a>o)return null;if(this.axis.pane.presenter.data.aggregation.unit===$.Day&&"Bars"===this.periodType){let e=s.getData(aa.TradingDay),t=e[a];for(;t===e[a]&&a>0;)a-=1;a+=1;let i=0;for(o=a;o<r.length&&i<this.period;)e[o]!==t&&(i+=1,t=e[o]),o+=1;o-=2}this.isVisibleScreen&&this.usesFinerGrainedAgg&&a<1e3&&this.studySeries.loadMoreData();let[l,u,h,c,d,p]=["Open","High","Low","Close","Change","Volume"].map(e=>{let t;return t=aa[e],s.getData(t)});this.findExtremes(i,a,o,c,u,h);let f=i.max-i.min,m=e=>({upVolume:0,downVolume:0,isValue:!1,totalVolume:0});if(this.isCountMode)i.zone=f/this.levelSize,i.bars=eL(this.levelSize,m);else{let e=Math.max(1,Math.ceil(f/((this.presenter.mainPlot?.metaData.minMovement??1)*this.levelSize)));i.zone=f/e,i.bars=eL(e,m)}return this.tallyVolume(i,a,o,l,c,d,p),this.gotData=!0,i}}function gT(e){let t=Math.abs(e)/Math.SQRT2,i=1/(1+.3275911*t);return .5*(1+(e<0?-1:1)*(1-((((1.061405429*i+-1.453152027)*i+1.421413741)*i+-.284496736)*i+.254829592)*i*Math.exp(-t*t)))}class gA extends mt{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,i){super(e,t),this.studyPlotId=i}makeStyles(){let e=this.lineOnlyStyle(tG.AT_LINE),t=this.lineOnlyStyle(tG.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 0!==this.targetPrice1?this.targetPrice1:this.targetPrice2}setOptions(e){if(this.periodTarget=e.PeriodTarget,this.targetPrice1=e.TargetPrice1,this.targetPrice2=e.TargetPrice2,this.pricesCount=+(0!==this.targetPrice1)+ +(0!==this.targetPrice2),this.pricesCount>1&&this.targetPrice1<this.targetPrice2){let e=this.targetPrice1;this.targetPrice1=this.targetPrice2,this.targetPrice2=e}}get haveInput(){return 0!==this.periodTarget&&(0!==this.targetPrice1||0!==this.targetPrice2)}get haveData(){return eV(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 f3(this.axis,this.targetPrice,this.targetDate)],this.pricesCount>1&&this.points.push(new f3(this.axis,this.targetPrice2,this.targetDate)),this.unitsPerYear=fD(this.presenter.data.aggregation),this.anchorPrice=this.mainCont.getLastDataPoint(aa.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),i=gT(t(this.targetPrice));if(this.pricesCount>1){let e=gT(t(this.targetPrice2));this.probabilityAbove=1-i,this.probabilityBelow=e,this.probabilityBetween=i-e}else this.probabilityBelow=i,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.mainCurve.visible)return[];let e=[];return e.push(new f2(this.points[0].point,!0,this.axis)),e.push(new f2(this.points[0].point,!1,this.axis)),this.pricesCount>1&&e.push(new f2(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,i]=[!0,!1].map(e=>Math.abs(iF(t,e))),s=this.pricesCount>1,r=this.points[0].point,n=s?this.points[1].point:r,a=this.traits.line2.color,o=ix(a),l=iH(t),u=["Above","Below","Between"],h=(e,t)=>`${eF(100*e,2).toFixed(2)}% Probability ${u[t]}`,c=(e,i)=>iU(t,e,i,J.Right,o,a);if(c(h(this.probabilityAbove,0),{x:r.x-10,y:r.y-e}),s){let e=r.y+(n.y-r.y+l)/2;c(h(this.probabilityBetween,2),{x:r.x-10,y:e})}c(h(this.probabilityBelow,1),{x:n.x-10,y:n.y+i})}}}let gS=new 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=eN(ao.CH_ZOOMCHANGED,1e3)}startTouchCrosshairMode(e,t,i){this.touchCrosshairMode=!0,this.showCrosshairAndTooltips(e.view,t,i)}activated(){}deactivated(){}findHit(e){let t;if(!e.point)return[];if(e.axis.pane.axes.some(t=>t.plots.some(t=>t.hitTestCustomEvent(e.point))))return tG.EVENT_PIN_HIT;let i=e.presenter.selectedAnnotation;void 0!==i&&(t=i.points.find(t=>t.hitTest(e.point)));let s=eb(e.axis.annotations.filter(t=>t.computed?null:t.hitTest(e.point)));return void 0!==t&&null==s&&(s=i),[s,t]}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)}fireZoomChanged(e){this.notifyZoomChanged({chart:e.accessor})}onMouseDblClick({priceAxis:e,offset:t,presenter:i,view:s}){let r=s.xAxis.viewBox.contains(t),n=!1;if(eH(e))this.resetVerticalAxis(e),n=!0;else if(r)this.resetHorizontalAxis(i),n=!0;else if(eI()){let e=i.selectedAnnotation;null!=e?mR(e,t):mN(i,t)}n&&s.redraw()}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!eI())return null;let e=new Date().getTime(),t=eH(this.previousTouchTimestamp)?e-this.previousTouchTimestamp:null;return this.previousTouchTimestamp=e,t}onMouseDown(e){let{point:t,button:i,splitter:s,offset:r,priceAxis:n,presenter:a,originalEvent:o}=e,l=window.navigator.platform.toLowerCase().startsWith("mac"),u=l?et.Meta:et.Control,h=i===ee.Right||l&&i===ee.Left&&e.getModifier(et.Control);this.touchCrosshairMode&&eH(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);let c=this.computePreviousTouchStartDuration();if(eH(c)&&c<tG.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(e),!0;if(!h&&this.isLogoLink(r)&&a.notifyHost(ao.CH_LOGOCLICKED,{chart:a.accessor}),eH(t)&&a.allPlots.some(e=>e.tryHandleCustomEventClick(t.point)))return!0;if(eH(s))return this.resizingPanes=!0,this.lastResizingOffset=r,this.splitter=s,a.enableTooltip(!1),!0;if(eH(n))return eB(a.display.chart.zooming)[0]&&this.startAxisScaling(n,r),!0;if(null!=t){if(e.getModifier(u))return a.activeTool=new mw,a.activeTool.onMouseDown(e),!0;let[i,s]=this.findHit(t);if(a.clearSelection(),null!=i&&a.setSelection(i),null==i||i?.locked)return h?(null==i?mN(a,r,o):i?.locked&&mR(i,r),!0):!!this.touchCrosshairMode||(a.activeTool=new mL(t),a.activeTool.startPan(r),mM());let n=null!=s;return h?(mR(i,r),eI()):(!n||!!s.movable)&&(!!n||!!i.canMove(t.point))&&(a.activeTool=n&&-1!==i.points.indexOf(s)?new f1(i,s):new f0(i,t,r),eI())}return this.prevZoomingOffset=r,!1}onContextMenu(e){return!0}isLogoLink(e){let t=eV(mx)&&mx.logoClickable?mx.rect:null;return eH(t)&&t.contains(e)}onMouseMove(e){let{point:t,splitter:i,priceAxis:s,view:r,presenter:n,offset:a}=e;if(eH(e.pinchZoom)&&e.pinchZoom&&eH(e.pinchDistance))return eH(this.prevPinchDistance)&&(e.delta=this.prevPinchDistance-e.pinchDistance,this.onWheel(e)),this.prevPinchDistance=e.pinchDistance,eI();if(null!=i||this.resizingPanes)r.setCursor(Q.ResizeVertical),this.resizingPanes&&this.resizePanes(r,a);else if(eH(t)){let[e,i]=this.findHit(t);eH(i)?t.presenter.view.setCursor(Q.Crosshair):eH(e)?e.isSelected?t.presenter.view.setCursor(Q.Move):t.presenter.view.setCursor(Q.Hand):t.presenter.view.setCursor(Q.Arrow)}else if(eH(s))eB(n.display.chart.zooming)[0]&&(r.setCursor(Q.ResizeVertical),this.performAxisScaling(r,s,a));else{if(this.prevZoomingOffset){let{x:e}=this.prevZoomingOffset,{x:t}=a;this.applyZoom(r.presenter,-(e-t)),this.prevZoomingOffset=a}r.setCursor(Q.ResizeHorizontal)}return!t||this.resizingPanes?this.hideCrosshairAndTooltips(r):(this.isLogoLink(a)&&r.setCursor(Q.Hand),this.showCrosshairAndTooltips(r,t,a)),eI()}showCrosshairAndTooltips(e,t,i){t.time&&(!eI()||this.touchCrosshairMode)&&e.drawCrosshair({ap:t,offset:i})&&e.presenter.showTooltip&&mP(e.presenter,{time:t.time,offset:i,price:t.price,lastBarRefresh:void 0,justMain:void 0})}hideCrosshairAndTooltips(e,t=!1){e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(t),t&&"cards"===e.tooltip.mode&&!e.presenter?.hasLegend&&mb(e.presenter)}onMouseLeave(e){let{view:t,offset:i}=e,s=t.presenter.accessor.getPaneBounds();s?.every(e=>!e.contains(i)||i.x===e.x||i.x===e.x+e.width||i.y===e.y||i.y===e.y+e.height)&&(this.hideCrosshairAndTooltips(t,!0),this.stopResizeZoom(t.presenter)),t.setCursor(Q.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),eI()){let t=function(){let e=y0().config.touchCrosshairTimeoutMillis;return eH(e)&&Number.isFinite(e)?e:tG.LONG_PRESS_TIMEOUT_MILLIS}();this.touchCrosshairTimeout=window.setTimeout(()=>{this.hideCrosshairAndTooltips(e.view,!0),this.touchCrosshairMode=!1},t)}}applyZoom(e,t,i=!0){if(!eB(e.display.chart.zooming)[1])return;let s=Math.sign(t)*(eI()?2:10),r=e.view;r.xAxis.zoom(s)&&(r.setPriceAxesDomains(),r.redraw(),i&&this.fireZoomChanged(e))}onWheel({view:e,presenter:t,getModifier:i,delta:s}){let{scrollBehavior:r}=t.display;return!!(eI()?"none"!==r:"wheel"===r||"wheel+shift"===r&&i(et.Shift))&&0!==s&&(e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(),this.applyZoom(t,s),!0)}get useKeyboardShortcuts(){return y0().config.hostingModel!==ea[ea.Application]}onKeyDown(e){let{key:t,code:i,presenter:s}=e;if(eH(s.selectedAnnotation)&&("Backspace"===t||"Delete"===t||8===i||46===i)){let e=s.selectedAnnotation;e.axis.deleteAnnotation(e),s.onAnnotationModifiedByTool(e,eo.Deleted)}if(eH(s.selectedAnnotation)&&(eD(t,i)?s.clearSelection():("F2"===t||113===i)&&s.selectedAnnotation instanceof mu&&s.selectedAnnotation.textEditable&&(s.activeTool=new mm(null,s.selectedAnnotation),s.activeTool.startEditing())),ew(t,i)||"ArrowRight"===t||39===i){let e=ew(t,i)?1:-1,r=s.view;r.xAxis.pan(e*r.xAxis.xScale.bar.totalWidth),r.redraw()}let r=window.navigator.platform.toLowerCase().startsWith("mac")?et.Meta:et.Control;if(e.getModifier(r)&&this.useKeyboardShortcuts){let e="z"===t||90===i,r="y"===t||89===i;return e&&s.undoRedoManager.undo(),r&&s.undoRedoManager.redo(),e||r}("r"===t||82===i)&&e.getModifier(et.Alt)&&this.resetView(s)}resetView(e){e.allAxes.forEach(e=>this.resetVerticalAxis(e,!1)),this.resetHorizontalAxis(e,!1),e.view.xAxis.goToLatest(!0)}resizePanes(e,t){let i=t.y-this.lastResizingOffset.y;if(0===i)return;let s=e.presenter.panes,[r,n]=this.splitter,a=s.map((e,t)=>{let s=e.getBounds().height;return t===r?s+i:t===n?s-i:s});if(a.some(e=>e<tG.MINIMUM_PANE_HEIGHT))return;let o=(e,t)=>e+t,l=a.reduce(o,0),u=s.map(e=>e.height).reduce(o,0);s.forEach((e,t)=>e.height=eF(a[t]/l*u,4)),this.lastResizingOffset=t,e.recalculateLayout(),e.redraw()}startAxisScaling(e,t){this.resizingScale=!0,this.resizingScaleId=e.id,this.lastScaleResizingOffset=t}performAxisScaling(e,t,i){if(this.resizingScale&&this.resizingScaleId===t.id){let s=eI()?4:5,r=function(e,t,i,s=1,r=-1){let n=(i.y-t.y)/10,a=e.yScale.rangeWithPadding().reverse();return[a[0]+n*s,a[1]+n*r].map(t=>e.yScale.yToPrice(t))}(t,this.lastScaleResizingOffset,i,s,-s);this.lastScaleResizingOffset=i,t.isCustomDomain=!0,t.yScale.domain(r),e.redraw()}}},gv=e=>gM(mV,m8,1,e),gb=e=>gM(mV,mh,1,e),gP={Default:()=>function(){return gS},Line:()=>gM(md,mW,!1),DateRange:()=>gM(md,gu,!1),PriceRange:()=>gM(md,gh,!1),DatePriceRange:()=>gM(md,gc,!1),GannBox:()=>gM(md,gd,!1),GannSquare:()=>gM(mf,gm),Ray:()=>gM(md,mW,!1),GannLine:()=>gM(mp,mW,!1),VerticalLine:()=>gM(mV,m$,1),HorizontalLine:()=>gM(mV,mG,1),LongPosition:()=>gM(mV,gi,1,!0),ShortPosition:()=>gM(mV,gi,1,!1),FiftyPercentLine:function(e,t){return eH(e)?gM(mH,mz,e.axis||t.mainAxis,e):gM(mV,mz,2)},FibonacciRetracement:()=>gM(md,mj,!1),TrendBasedFibExtension:()=>gM(md,mK,!0),FibonacciFan:()=>gM(md,mZ,!1),FibonacciArcs:()=>gM(md,m1,!1),FibonacciChannel:()=>gM(md,gg,!0),GannFan:()=>gM(md,m2,!1),SpeedResistanceFan:()=>gM(md,m3,!1),SpeedResistanceArcs:()=>gM(md,m4,!1),AndrewsPitchfork:()=>gM(mV,m5,3),Rectangle:()=>gM(md,mO,!1),Ellipse:()=>gM(md,m6,!1),TrendChannel:()=>gM(md,m7,!0),SymbolArrowUp:()=>gv("arrow_up"),SymbolArrowDown:()=>gv("arrow_down"),SymbolArrowRight:()=>gv("arrow_right"),SymbolArrowLeft:()=>gv("arrow_left"),SymbolArrowHorizontal:()=>gv("arrow_horizontal"),SymbolArrowVertical:()=>gv("arrow_vertical"),SymbolArcDown:()=>gv("arc_down"),SymbolArcUp:()=>gv("arc_up"),SymbolThumbsUp:()=>gv("thumbs_up"),SymbolThumbsDown:()=>gv("thumbs_down"),SymbolZero:()=>gv("zero"),SymbolOne:()=>gv("one"),SymbolTwo:()=>gv("two"),SymbolThree:()=>gv("three"),SymbolFour:()=>gv("four"),SymbolFive:()=>gv("five"),SymbolSix:()=>gv("six"),SymbolSeven:()=>gv("seven"),SymbolEight:()=>gv("eight"),SymbolNine:()=>gv("nine"),SymbolQuestion:()=>gv("question"),SymbolFishHook:()=>gv("fish_hook"),SymbolBuy:()=>gv("buy"),SymbolSell:()=>gv("sell"),FibonacciTimeZones:()=>gM(md,m9,!1),Text:()=>gM(mm,mu,null),PickPoint:()=>function(){return new ge},ZoomIn:()=>function(){return new mw},ProfitLoss:gb,RewardRisk:gb,VolumeAtPrice:function(e){return gM(mV,gy,2,e)},ProbabilityCones:function(e){return gM(mV,gA,2,e)}};function gC(e,t=!1,i=null,s=null,r=null){let n=gP[e];return(n=n(s,r))(e,t,i)}function gE(e,t={}){e.enableTooltip(!0),e.resetActiveTool();let{axis:i,annotation:s,toolChange:r,annId:n}=t;eH(i)&&e.onAnnotationsUpdated(i),eH(s)&&e.onAnnotationModifiedByTool(s,r),[eo.Cancelled,eo.Executed,eo.TextChanged].includes(r)&&e.onAnnotationDone(n,r)}function g_(e,t=!0,i=eo.None){e.wasModifiedByTool();let s=e.axis;gE(s.pane.presenter,t?{axis:s,annotation:e,toolChange:i}:void 0)}function gM(e,t,i,s){return function(r,n,a){let o=f8(r,t,s,a);return(o.annName=r,n)?o:new e(o,i)}}function gL(e){e.button===ee.Right&&gE(e.presenter)}function gx(e,t,i){let s={};s.source=aa[e.source],s.inputs=ej(e.inputs);let r=void 0!==e.target,n=eH(i)?i:e.curves;return s.outFields=function(e){let t=[];for(let i of e)t.includes(i)||t.push(i);return t}(r?[aa[e.target]]:n.map(e=>e.fields).flat()),s.target=r?aa[e.target]:s.outFields[0],s.aggregation=t,s}class gO extends fq{model;basePlot;_hasEvents;_params;_shiftFmt;_title;range;shouldMaybePriceMap;annIndex;_canPriceMap;#e(e=3){let t=this.model.inputs||[],i=t.length;if(0===i)return"";let s="";i>e&&(t=t.slice(0,3),s=", ...");let r="AVWAP"===this.model.study;return 0===t.length?"":`(${t.map(e=>r&&"Anchor"===e.name?new Date(e.value).toLocaleString():e.value).join(", ")}${s})`}get params(){return eH(this._params)||(this._params=this.#e()),this._params}get fullParams(){return this.#e(Number.MAX_VALUE)}get shiftFmt(){if("PC"===this.model.study)return"";if(!eH(this._shiftFmt)){let e=this.curves.map(e=>Number(e.shift)).filter(e=>0!==e);this._shiftFmt=0===e.length?"":`[${e.join(", ")}]`}return this._shiftFmt}get title(){if(!eH(this._title)){let e=this.params,t=this.shiftFmt;this._title=`${this.model.study} ${e} ${t}`.trim()}return this._title}fromModel(e){this.model=e,super.fromModel(this.model)}getMetaData(){let e=sw(this.model.study),t=e.meta.decimals;this.metaData=void 0!==t?new it(t):this.basePlot.metaData,eH(e.meta.range)&&(this.range=e.meta.range)}getDetachedScaleMargins(){return"VOL"===this.model?.study&&this.axis?.pane.isMain?tG.VOLUME_DETACHED_SCALE_MARGINS:super.getDetachedScaleMargins()}applySpecifics(e){let t=this.model.study;!0===sw(t).meta.shiftable&&this.curves.forEach(t=>{Number.isFinite(e.inputs.Offset)&&(t.shift=e.inputs.Offset)});let i=(e,t,i)=>this.curves[e].zones[t].value=this.model.levels[i].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,i)=>e.visible=e.visible&&i<t);break}case"CRS":{let t="PercentChange"===e.inputs.Display;this.axis.comparison=t?K.Percent:K.None;break}case"PERF":{let t="VisibleStart"===e.inputs.Anchor;this.axis.comparison=t?K.Percent:K.None;break}case"JPI":case"CTTP":case"CTTI":{let t=eL(10,e=>(e+1)*.025),i=([e,i])=>[...t.map(t=>i_(t)(e)).reverse(),i,"#6a4a3a","#a000c8","#ffffff"];this.curves[0].colors=i(this.curves[0].colors),this.curves[1].colors=i(this.curves[1].colors);let s=this.curves[0].colors.length;this.curves[0].colors[s-1]=this.curves[1].colors[t.length],this.curves[1].colors[s-1]=this.curves[0].colors[t.length],this.shouldMaybePriceMap="Performance"===e.inputs.Height;break}case"RSI":case"RSIMOD":case"RSISTO":case"CCI":i(0,0,0),i(0,1,2);break;case"STC":i(0,0,0),i(0,1,1);break;case"RVOL":case"DPO":case"COPP":i(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,eH(this.annotations)||(this.annotations=[]);let t=this.curves[1],i=this.curves[2],s=gC("VolumeAtPrice",!0,{[tG.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[tG.AT_FILL]:{color:this.curves[0].colors[0]},[tG.AT_FILL2]:{color:this.curves[0].colors[1]},[tG.AT_FILL3]:{color:this.curves[0].colors[2]},[tG.AT_FILL4]:{color:i.colors[0]},[tG.AT_FILL5]:{color:i.colors[1]},[tG.AT_FILL6]:{color:i.colors[2]}},this.id)(this.axis,!1);s.setOptions(e.inputs),this.annIndex=this.annotations.push(s)-1;break}case"PVACP":{this.customPlotValues=!0,eH(this.annotations)||(this.annotations=[]);let t=this.curves[1],i=this.curves[2],s=this.curves[3],r=gC("VolumeAtPrice",!0,{[tG.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[tG.AT_FILL]:{color:this.curves[0].colors[0]},[tG.AT_FILL2]:{color:this.curves[0].colors[1]},[tG.AT_FILL3]:{color:this.curves[0].colors[2]},[tG.AT_FILL4]:{color:i.colors[0]},[tG.AT_FILL5]:{color:i.colors[1]},[tG.AT_FILL6]:{color:i.colors[2]},[tG.AT_FILL7]:{color:s.colors[0]}},this.id)(this.axis,!1);r.setOptions(e.inputs),this.annIndex=this.annotations.push(r)-1;break}case"IVRANK":{let t=aa.ImplVolRank1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=aa.ImplVolRank5D;break;case"1-Month":t=aa.ImplVolRank1M;break;case"3-Month":t=aa.ImplVolRank3M;break;case"6-Month":t=aa.ImplVolRank6M;break;case"YTD":t=aa.ImplVolRankYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"IVPCTL":{let t=aa.ImplVolPerc1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=aa.ImplVolPerc5D;break;case"1-Month":t=aa.ImplVolPerc1M;break;case"3-Month":t=aa.ImplVolPerc3M;break;case"6-Month":t=aa.ImplVolPerc6M;break;case"YTD":t=aa.ImplVolPercYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"OPTIV":{let t=[aa.WeighImplVolHigh,aa.WeighImplVol,aa.WeighImplVolLow];switch(e.inputs.TimeFrame){case"1-Day":default:break;case"5-Day":t=[aa.WeighImplVolHigh5D,aa.WeighImplVol5D,aa.WeighImplVolLow5D];break;case"1-Month":t=[aa.WeighImplVolHigh1M,aa.WeighImplVol1M,aa.WeighImplVolLow1M];break;case"3-Month":t=[aa.WeighImplVolHigh3M,aa.WeighImplVol3M,aa.WeighImplVolLow3M];break;case"6-Month":t=[aa.WeighImplVolHigh6M,aa.WeighImplVol6M,aa.WeighImplVolLow6M];break;case"1-Year":t=[aa.WeighImplVolHigh1Y,aa.WeighImplVol1Y,aa.WeighImplVolLow1Y];break;case"YTD":t=[aa.WeighImplVolHighYTD,aa.WeighImplVolYTD,aa.WeighImplVolLowYTD]}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),eH(this.annotations)||(this.annotations=[]);let i=this.curves[11],s=this.curves[12],r=gC("ProbabilityCones",!0,{[tG.AT_LINE]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle},[tG.AT_LINE_2]:{color:s.colors[0],width:s.lineWidth,dashStyle:s.dashStyle}},this.id)(this.axis,!1);r.setOptions(e.inputs),this.annIndex=this.annotations.push(r)-1}}}getValueAt(e,t,i){return this.isVolAP?this.annotations[this.annIndex].getValueAt(e,t,i):super.getValueAt(e,t,i)}getColorOf(e){if(!this.isVolAP)return null;let t=this.curves[0].colors;switch(e){case aa.UPVOL:return t[1];case aa.DNVOL:return t[0];case aa.TOTVOL:return t[2];case aa.POC:case aa.VAREA:case aa.BARBACK:return tG.COLOR_TRANSPARENT;default:throw Error("Unexpected Volume At Price field")}}isEmpty(){return!this.isVolAP&&super.isEmpty()}setCurveAttributes(e,t){let i=t=>this.curves[e].attributes=[U[t]];switch(t){case"LikeMain":{let t=this.axis.pane.presenter.mainPlot.curves[0].attributes,s=y0().config.defaultVolumeBarColoring;eH(t)?this.curves[e].attributes=[t[0]]:i(eH(s)?"OpenToClose"===s?"OpenVsClose":"ChangeBased":"OpenVsClose");break}case"OpenToClose":i("OpenVsClose");break;case"CloseToClose":i("ChangeBased");break;default:throw Error(`Unexpected bar coloring choice: ${t}`)}}get hasEvents(){return this._hasEvents}get eventsSeries(){return this.timeSeries}doesSeriesEmitEvents(){let e=this.timeSeries.helpers;return e.includes(aa.Buy)||e.includes(aa.Sell)}getEventFor(e){switch(e){case aa.Buy:return{show:!0,title:"B",color:"#03c03c"};case aa.Sell:return{show:!0,title:"S",color:"#c23b22"};default:return null}}getEventFields(){return this.hasEvents?[aa.Buy,aa.Sell]:[]}async initialize(){if(this.model.basis!==tG.BASIS_MAIN)throw Error("Studies can currently only be based on the main (symbol) plot");return tU.call(this,async()=>{this.basePlot=this.axis.pane.presenter.mainPlot,await this.basePlot.initialize(),this.getMetaData();let e=this.axis.pane.presenter.data.aggregation,t=gx(this.model,e,this.curves);this.applySpecifics(t);let i=this.basePlot.timeSeries;i instanceof cl&&(i=i.actual),this.timeSeries=fi(this.model.study,t,i),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;let s=this.title,r=this.basePlot.timeSeries instanceof uW;return this.timeSeries.ready().then(e=>{e||r||this.timeSeries.computedServerSide||yK(`Unable to calculate study values for ${s}`,"error")}),!0})}get isJpi(){return["JPI","CTTP","CTTI"].includes(this.model.study)}get isVolAP(){return"VOLAP"===this.model.study||"PVACP"===this.model.study}invalidateAssociatedAnnotations(e){this.isVolAP&&this.annotations[this.annIndex].invalidate(e)}onPriceDomainsUpdated(){this.invalidateAssociatedAnnotations("PriceDomainsChanged")}shouldPriceMap(e){return this.isJpi?!!this.shouldMaybePriceMap&&(e.id===aa.JPIB.id||e.id===aa.JPIS.id):super.shouldPriceMap(e)}canPriceMap(e,t){if(!this.isJpi)return super.canPriceMap(e,t);this._canPriceMap=e>0}priceMap(e,t,i){if(!this.isJpi)return super.priceMap(e,t,i);if(t>this.visToIndex)return e;let s=(e,t)=>this.timeSeries.container.getData(e)[t],r=s(aa.JPIB,t),n=s(aa.JPIS,t);if(null===r&&i.id===aa.JPIB.id||null===n&&i.id===aa.JPIS.id)return null;let a=0,o=this.visFromIndex,l=this.timeSeries.helpers[0],u=this.timeSeries.helpers[2];for(;o<=t;)a+=1===s(u,o)?0:s(l,o),o++;return a}}let gI=[aa.Open,aa.High,aa.Low,aa.Close,aa.Volume];class gD extends fq{_expression;exprModel=null;symbols=null;errorText;get title(){return this.expression}get expression(){return this._expression}async parseExpression(){let e=nF(this._expression);if(this.exprModel=null,this.symbols=null,nH(e))this.errorText=e.error;else{let{model:t,clean:i,symbols:s}=e;this.errorText=void 0,this.symbols=s,this.exprModel=t,this._expression=i}}get isValid(){return!eH(this.errorText)}#t(e){return{mapper:e=>e.query.symbol,loadMoreData:!0,recompute:F.Minimum,missing:H.UseNext,stretch:e=>!1,fieldMap:new Map(gI.map(e=>[e,e])),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:e}}getTimeSeries(){let e=this.getInnerSeries(),t=this.axis?.pane.presenter.data?.exprSkipLeadingEmpty??!1,i=new po(this.exprModel,e,this.#t(t));this.timeSeries=this.wrapIfAdvancedStyle(i);let s=this.title;this.timeSeries.ready().then(e=>{e||yK(`Unable to calculate expression: ${s}`,"error")})}getInnerSeries(){let e=nW(this.exprModel),t=y0().getTimeSeriesDataSource();return e.map(e=>{let i=this.makeQuery();return i.symbol=e,t.getTimeSeries(i)})}getRecord(){if(eH(this.errorText))return;let e=this.metaData.inner.map(e=>[e.symbol,e.resolved]);this.record=new aP(e,eG(this.exprModel)),this.record.ready().then(e=>e)}getMetaData(){this.isValid&&(this.metaData=new is(this.symbols),this.metaData.ready().then(e=>{e&&(this.getRecord(),this.presenter?.notifyHost(ao.MD_CHANGED,{plot:this}))}))}fromModel(e){super.fromModel(e),this._expression=e.expression}async initialize(){return tU.call(this,async()=>(await this.parseExpression(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class gw extends fq{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),this.offset=e.offset,this._forward=e.forward}async parseForward(){let e=nF(this.forward),t=nH(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=` (${ec(um(this.offset),lw(tG.FMT_US_DATE_ONLY))(new Date)})`,this.outField=new as(`Close_${this.offset}`,z.Number,j.Forward,`Close (${this.offset})`),this.curves[0].fields[0]=this.outField):(this.suffix="",this.outField=aa.Close);let{yes:t,no:i}=eT(e.symbols,e=>tg(`${e}*1`)),s=(await Promise.all(t.map(e=>tM(e)))).map(e=>e.map(e=>e.name));this.roots=t.reduce((e,t,i)=>(e[t]=s[i],e),{}),this.symbols=i}}get isValid(){return!eH(this.errorText)}getMetaData(){if(this.isValid){let e=Object.values(this.roots).flat();this.metaData=new is(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(ao.MD_CHANGED,{plot:this})})}}getForwardPolicy(e){return{mapper:e=>e.query.root,loadMoreData:!1,recompute:F.Everything,missing:H.UseNext,stretch:e=>!1,fieldMap:new Map([[aa.Close,this.outField]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1,valueProvider:e}}getTimeSeries(){let e=y0().getTimeSeriesDataSource(),t=Object.keys(this.roots),i=0===this.offset?Z.Forward:Z.HistoricalForward,s=t.map(t=>{let s={seriesKind:i,root:t,offset:this.offset,symbols:this.roots[t],getHashKey:()=>`${i}|${t}|${this.offset}`};return e.getTimeSeries(s)}),r=this.symbols.length>0?new uK(this.symbols):void 0;this.timeSeries=new po(this.fwdModel,s,this.getForwardPolicy(r)),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:er.Unspecified};this.presenter?.notifyHost(ao.TS_MANYCHANGED,e)}})}async initialize(){return tU.call(this,async()=>(await this.parseForward(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}let gR=e=>e.substr(0,e.lastIndexOf("::"));class gN extends fq{isAverage;hasComputation;offset;offsets;useInAverage;_seasonal;symbolToOffset;errorText;seaModel=null;isPlain=!1;isFutures=!1;suffix="";outField;symbols;coreModel;coreHasComputation;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),this.offset=e.offset,this.offsets=e.offsets,this.useInAverage=e.useInAverage,this.isAverage=e.offset<0,this._seasonal=e.seasonal}constructSeasonal(e,t){return nU(nG(e,e=>this.applyOffset(e,t)))}constructAverage(e,t=null){let i=null===t?null:t.map(e=>this.symbolToOffset[e]),s=null===i,r=this.offsets.filter(e=>!!s||i.includes(e)).map(t=>`(${this.constructSeasonal(e,t)})`);return`(${r.join("+")})/${r.length}`}prepareFields(){let e=this.isPlain?`${this.yearFromOffset(this.offset)}`:`${this.offset}Y`,t=this.isAverage?"Avg":e;this.suffix=0===this.offset?"":` (${t})`,this.outField=new as(`Close_${t}`,z.Number,j.Seasonal,`Close${this.suffix}`),this.curves[0].fields[0]=this.outField}applyOffset(e,t){let i=this.isPlain?e:function(e,t){let i=tg(e),s=tS(e),r=tT(e);if(i)return tx(e,t);if(s){let i=tA.exec(e),s=Number.parseInt(i[2]),r=tu(tr(new Date(s+(s>79?1900:2e3),0,1),t));return`${i[1]}${tb(r)}${i[3]}`}if(!r)return null;{let i=e.match(ty),s=tx(i[1],t),r=tx(i[2],t);return`_S_SP_${s}_${r}`}}(e,-t);return`${i}::${t}`}createSymbolToOffsetMapping(e){this.symbolToOffset={},e.forEach(e=>{this.offsets.forEach(t=>{this.symbolToOffset[this.applyOffset(e,t)]=t})})}async parseSeasonal(){let e=nF(this.seasonal,!0),t=nH(e),i=e=>(this.errorText=e,this.seaModel=null,null);if(t)return i(e.error);let{model:s,symbols:r}=e;this.prepareFields();let n=new Map;for(let e of r){let t=tP(await tf(e));n.set(e,t)}s=nG(s,e=>n.get(e));let a=(r=Array.from(n.values())).every(e=>tg(e)||tT(e)),o=r.every(e=>tS(e)),l=r.every(e=>!tg(e)&&!tS(e)&&!tT(e));if(!a&&!o&&!l)return i("Mixed types of symbols aren't supported yet");this.isPlain=l,this.isFutures=a,this.createSymbolToOffsetMapping(r),this.coreModel=this.isAverage?s:null,this.coreHasComputation=n$(s);let{model:u,symbols:h}=nF(this.isAverage?this.constructAverage(s):this.constructSeasonal(s,this.offset),!0);this.seaModel=u,this.hasComputation=n$(u),this._seasonal=nU(nG(u,gR)),this.symbols=h,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!eH(this.errorText)}getActualSymbols(){return[...new Set(this.symbols.map(gR))]}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){let e=gR(this.symbols[0]);if(this.isPlain)return`${e} ${new Date().getFullYear()-this.offset}`;if(this.isFutures)return tP(e,!0)}return this.title}getMetaData(){if(this.isValid){let e=this.getActualSymbols(),t=1===e.length&&!this.hasComputation&&!this.isAverage,i=y0().getMetaDataSource();this.metaData=t?i.getMetaData(e[0]):new is(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(ao.MD_CHANGED,{plot:this})})}}getNoDataApproach(){return this.isAverage&&!this.coreHasComputation?k.ModelTransformRequired:this.hasComputation?k.NoAction:k.IgnoreTimelineOnly}get seasonalPolicy(){return{mapper:e=>e.query.surrogate||e.query.symbol,loadMoreData:!1,recompute:F.Everything,missing:this.hasComputation||this.useInAverage?H.UsePrevious:H.UseNone,stretch:e=>this.shouldStretch(e),fieldMap:new Map([[aa.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(e,t)=>0===t.length?this.seaModel:nF(this.constructAverage(this.coreModel,e)).model,skipLeadingEmpty:!1}}shouldStretch(e){return 0===this.symbolToOffset[e]&&(this.isAverage&&this.symbols.length>1||this.offset>0)}shiftYears(e){return tr(new Date,-e)}yearFromOffset(e){return tu(this.shiftYears(e))}getCmdtyRange(e){let t=this.shiftYears(e);return[tn(t),function(e){te(1,arguments);var t=ti(e),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}(t)]}getTimeSeries(){if(!this.isValid)return;let e=y0().getTimeSeriesDataSource(),t=Object.keys(this.symbolToOffset).map(t=>{let i=this.makeQuery();return i.surrogate=t,i.symbol=gR(t),i.offset=this.symbolToOffset[t],i.cacheMe=!this.isPlain||0===i.offset,this.isPlain&&(i.range=this.getCmdtyRange(i.offset)),this.isFutures&&i.offset>0&&eH(...i.range)&&(i.range=i.range.map(e=>tr(e,-i.offset))),i.offset>0&&(i.disableStreamingUpdates=!0),e.getTimeSeries(i)});this.timeSeries=new po(this.seaModel,t,this.seasonalPolicy),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:er.Unspecified};this.presenter?.notifyHost(ao.TS_MANYCHANGED,e)}})}async initialize(){return tU.call(this,async()=>(await this.parseSeasonal(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}let gV=["bottom","right","left"],gH={bottom:"center",right:"start",left:"end"};class gF{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,i,s,r,n){let a=eH(r);if(n=n||this.fontSize+this.padding+this.padding+(a?this.padding:0),!gV.includes(this.position.toLowerCase()))return void console.error(`Can not draw indicator in position [${this.position}]`);e.font=`bold ${this.fontSize}px ${this.fontFamily}`,e.textAlign=gH[this.position],e.strokeStyle=this.strokeColor,e.fillStyle=ib(this.backgroundColor),e.lineWidth=this.lineWidth;let o=Math.round(Math.max(...[s,r??""].map(t=>e.measureText(t).width))+("bottom"!==this.position?this.arrowLength:0)+this.padding+this.padding),l=Math.round(o/2),u=Math.round(n/2);e.setLineDash([]),e.beginPath(),e.moveTo(t,i);let h=i+u,c=i+2*u,d=i-u;if("right"===this.position){e.lineTo(t,h);let i=t+o;a&&(e.lineTo(t,c),e.lineTo(i,c)),e.lineTo(i,h),e.lineTo(i,d),e.lineTo(t,d)}else if("left"===this.position){e.lineTo(t,h);let s=t-o;a&&(e.lineTo(t,c),e.lineTo(s,c)),e.lineTo(s,h),e.lineTo(s,d),e.lineTo(t,i-u)}else if("bottom"===this.position){let s=t-l,r=t+l;e.lineTo(t,i),e.lineTo(r,i),e.lineTo(r,i+n),e.lineTo(s,i+n),e.lineTo(s,i),e.lineTo(t,i)}if(e.closePath(),e.stroke(),e.fill(),e.fillStyle=this.textColor,e.textBaseline="middle","bottom"===this.position)e.fillText(s,t,i+iH(e,1));else if("right"===this.position){let n=t+this.arrowLength+this.padding;e.fillText(s,n,i),a&&e.fillText(r,n,i+this.padding+u)}else if("left"===this.position){let n=t-this.arrowLength-this.padding;e.fillText(s,n,i),a&&e.fillText(r,n,i+this.padding+u)}}}let gk=(e,t)=>e-1-t-4,gB=(e,t)=>e+1+t+4,gU=Array.from(Array(6),(e,t)=>++t).reverse();function gW(e){return e.curves.filter(t=>t.visible&&(e.type!==X.Study||t.style!==W.Ribbon)).map(t=>{let i=t.pickMainField(),[s,r]=function(e,t){let i=e.timeSeries.container;if(null===i||i.size<1)return[null,-1];let s=i.getLastDataPoint(t),r=i.getData(t),n=r.length-1,a=e.type===X.Study&&["JPI","CTTP","CTTI"].includes(e.model.study);return null!=s||a||(s=-1!==(n=eA(r,e=>null!==e))?r[n]:null),[s,n]}(e,i);return{value:s,color:function(e){let t=e.plot.timeSeries.container;return null===t||t.size<1?null:e.getColor(t.size-1)}(t),field:i,index:r}})}class g${pane;annotations;id;isCustomDomain;primary;onTheRight;viewBox;plots;comparison;scale;yScale;label;crosshairIndicator;ticks;lastUsedOptions;config;_fullDomain;constructor(e){this.pane=e,this.annotations=[],this.isCustomDomain=!1,this.primary=!1,this.onTheRight=!0,this.plots=[],this.label="",this.id=e0(),this.ticks=null,this.lastUsedOptions=null;let{chart:{fontSize:t},yAxis:{fontSize:i}}=this.pane.presenter.display;this.config={innerTickSize:7,tickPadding:5,indicatorPadding:4,fontWeight:400,fontSize:i||t||12},this.crosshairIndicator=new gF({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}makePlot(e){let t=null;switch(X[e.type]){case X.Symbol:t=new fX;break;case X.Expression:t=new gD;break;case X.Study:t=new gO;break;case X.IncomeStatement:t=new fZ(Z.IncomeStatement);break;case X.BalanceSheet:t=new fZ(Z.BalanceSheet);break;case X.Forward:t=new gw;break;case X.Seasonal:t=new gN;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===K.None?t:this.pane.presenter.mainPlot.priceMap(t,void 0,aa.Close,!0)}toTime(e){return this.pane.presenter.view.toTime(e)}toAnnotationPoint(e){return new f3(this,this.toPrice(e.y),this.toTime(e.x)||void 0)}toX(e){return this.pane.presenter.view.toX(e)}priceMap(e){return this.comparison===K.None?e:this.pane.presenter.mainPlot.priceMap(e,void 0,aa.Close)}toY(e){let t=this.priceMap(e);return this.yScale.priceToY(t)}get plotAnnotations(){let e=[];return this.plots.forEach(t=>{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)},i=this.pane.presenter,s=i.activeTool,r=s.annotation;return s.alignPointsMode&&r&&r.alignPointsSupported&&r.points.includes(e)?this.alignPoints(r,e,t):s.snapToSupported&&i.display.yAxis.snapAnnotationsToPrices&&!e.passive&&(e.moveDirection===ei.Both||e.moveDirection===ei.Vertical)&&this.snapToPrices(e,t),t}snapToPrices(e,t){let i=this.plots.find(e=>e.main);if(i&&i.timeSeries&&i.timeSeries.hasData){let s=i.timeSeries.container,r=e_(s.getTimeData(),+e.time,Number),n=[].concat(...i.curves.map(e=>e.fields)).filter(e=>s.hasField(e)).map(e=>{let i=s.getData(e)[r],n=this.toY(i),a=Math.abs(n-t.y);return{priceSnap:i,ySnap:n,dist:a}}).filter(e=>e.dist<=tG.SNAP_PROXIMITY_PIXELS).reduce((e,t)=>null===e||t.dist<e.dist?t:e,null);eH(n)&&(e.price=n.priceSnap,t.y=n.ySnap,e.time=s.getTimeData()[r],t.x=this.toX(e.time))}}alignPoints(e,t,i){let s=e.points.find(e=>e!==t);if(t!==s&&s&&s.point){let e=s.point,r=(360+-(180*iA(e,i))/Math.PI)%360;if(r>337.5||r<22.5||r>157.5&&r<202.5)i.y=e.y,t.price=this.toPrice(i.y);else if(r>67.5&&r<112.5||r>247.5&&r<292.5)i.x=e.x,t.time=this.toTime(i.x);else{let s=Math.abs(i.x-e.x),r=e.y>i.y?-1:1;i.y=e.y+s*r,t.price=this.toPrice(i.y)}}}toPoint(e){if(eH(this.pane.presenter.view))return this.snapTo(e)}makeAnnotation(e,t=!0){let i=gC(e.id,!0,e.traits)(this,!1);t&&e.uid&&(i.uid=e.uid);let s=i.activePoints,r=e.points.length-s.length;return r>0&&i.addPoints(r),i.activePoints.forEach((t,i)=>{let s=e.points[i];ek(s.price)&&ek(s.time)&&t.update(s.price,s.time)}),i.visible=e.visible,i.locked=e.locked,i}expand(e){let t=[];switch(e.type){case"Forward":{let i=e.curves,s=e.offsets;delete e.curves,delete e.offsets;for(let r=0;r<i.length;r++){let n=Object.assign({},e);n.curves=[i[r]],n.offset=s[r],t.push(n)}break}case"Seasonal":{let i=e.curves,s=e.offsets;delete e.curves,delete e.offsets;let r=s.length,n=new Set;for(let a=0;a<i.length;a++){let o=Object.assign({},e);o.curves=[i[a]],o.offset=s[a];let l=o.offset<0;if(l)if(-1===o.offset)for(let e of(o.offsets=s.filter(e=>e>=0),o.offsets))n.add(e);else{o.offsets=[];for(let e=1;e<=Math.abs(o.offset);e++)o.offsets.push(e),n.add(e)}else o.offsets=[o.offset];o.useInAverage=!l&&n.has(o.offset),(!l||r>1)&&t.push(o)}break}default:t.push(e)}return t}fromModel(e){this.comparison=K[e.comparison??"None"],this.scale=q[e.scale??"Linear"],this.yScale=new f$(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:i,backgroundColor:s},yAxis:{textColor:r,crosshair:{color:n},primaryOnTheLeft:a}}=this.pane.presenter.display,o=a??!1;this.onTheRight=this.primary&&!o||!this.primary&&o,this.crosshairIndicator.configure({position:this.onTheRight?"right":"left",fontFamily:i,strokeColor:n,textColor:r,backgroundColor:i_(.15)(s)})}findIndex(e){return this.annotations.findIndex(t=>t.uid===e.uid)}addAnnotation(e){let t=this.makeAnnotation(e,!0);this.appendAnnotation(t),t.requestRedraw(),this.fireAnnotationsChanged()}appendAnnotation(e){-1===this.findIndex(e)&&this.annotations.push(e)}fireAnnotationsChanged(e=!1){this.pane.presenter.onAnnotationsUpdated(this,e)}deleteAnnotation(e,t=!0){e.isSelected&&this.pane.presenter.clearSelection();let i=this.findIndex(e);-1!==i&&this.annotations.splice(i,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,i=this.makeAnnotation(e.toModel(),!1);i.drawPoints(null,!0),i.offset({x:tG.ANN_DUPLICATE_OFFSET,y:tG.ANN_DUPLICATE_OFFSET}),t.appendAnnotation(i),i.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(e,t){e.isSelected&&this.pane.presenter.clearSelection(),s7(e.name,t.traits),e.updateFrom(t.traits,t.extras,t.isUndoRedo?null:t.points,t.visible,t.locked),t.isUndoRedo&&eH(t.points)&&e.updateActivePoints(t.points),t.isUndoRedo||this.pane.presenter.undoRedoManager.done(f5(e,eo.Moved)),e.requestRedraw(),this.fireAnnotationsChanged()}setViewBox(e){this.viewBox=e;let{y:t,height:i}=this.viewBox;this.yScale.range([Math.floor(t),Math.floor(t+i)]),this.plots.forEach(t=>t.setViewBox(e))}get fullDomain(){return eH(this._fullDomain)||(this._fullDomain=this.getDataDomain().domain),this._fullDomain}updateFullDomain(e=null){if(null===e&&this.comparison!==K.None)return;let t=this.fullDomain;this._fullDomain=this.getDataDomain([e,e],t).domain}getPlotDataDomain(e,t,i){let s=e.timeSeries;if(!s.hasData)return{domain:null};let r=s.container,n=r.getTimeData(),a=e=>e_(n,+e,Number),o=eH(t),l=o?a(t):0,u=eH(i),h=u?a(i):n.length-1,c=e.curves.map(e=>e.fields).flat().filter(e=>e.id!==aa.Change.id),d=eH(e.targetFields);d&&c.push(...e.targetFields);let p={},f=t=>{let[i,s]=(t=>{let i=d?e.curves[0]:e.curves.find(e=>e.fields.includes(t));if(!eH(i)||0===i.shift)return[l,h];if(!eH(p[i.id])){let e=i.shiftedTimeDomain;if(!eH(e))return[l,h];p[i.id]=[a(e[0]),a(e[1])]}return p[i.id]})(t),n=r.getData(t),o=Math.max(i,0),u=Math.min(n.length-1,s);return n.slice(o,u+1).map((i,s)=>e.priceMapper(i,s,t))},m=[null,null],g=e=>e.id,y=new Set(ev(r.fields,c,g).map(g));e.curves.filter(e=>e.visible).map(e=>{let t=e.fields.filter(e=>y.has(e.id));e.isStackedColumn?ex(eM(t.map(e=>f(e)).reduce((e,t)=>t.map((t,i)=>(e[i]||0)+(t||0)),[])),m):t.map(e=>{ex(eM(f(e)),m)})});let T=el.None,A=[W.Column,W.MultiColumn,W.StackedColumn];if(o&&u&&!e.main&&e.curves.some(e=>A.includes(e.style))){let e=m[0]>0,t=m[1]<0;e?(T=el.Min,m[0]=0):t&&(T=el.Max,m[1]=0)}return{domain:m,clamped:T}}getDataDomain([e,t]=[null,null],i=[null,null]){let s=eG(i),r=!1;for(let i of this.plots.filter(e=>!e.hasDetachedScale)){let{domain:n,clamped:a}=this.getPlotDataDomain(i,e,t);eH(n)&&(ex(n,s),r=r||a!==el.None)}if(!eH(s))return{domain:null};let[n,a]=s;if(!eH(n,a))return{domain:null};let o=[Number(n),Number(a)];o[0]===o[1]&&(o[0]-=1,o[1]+=1);let l=el.None;return r&&(0===o[0]?l=el.Min:0===o[1]&&(l=el.Max)),{domain:o,clamped:l}}setDomain(){let e=this.pane.presenter,t=e.view.xAxis.xScale.domain();if(!eH(t))return;for(let e of this.plots.filter(e=>e.hasDetachedScale)){let{domain:i}=this.getPlotDataDomain(e,t[0],t[1]);eH(i)&&e.yScale.domain(i)}if(this.isCustomDomain)return;let{domain:i,clamped:s}=this.getDataDomain(t);if(this===e.mainAxis&&e.mainPlot?.showPrevious){let t=e.mainPlot.getPreviousValue(),s=e$(e.display,!1,"chart","previous","forceVisible");eH(t,i)&&s&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],t))}if(this.yScale.domain(i),eH(i)){let e=this.getPadding(s);eH(e)&&this.yScale.padding(e)}}getInitialPadding(){let e=tI(this.pane.presenter.hostElement),t=tw(`#${tG.HEADER_SIZE_PLACEHOLDER_ID}`,e);if(!eH(t)){tR(t=tF(e,"div"),{display:"none"}),tN(t,{id:tG.HEADER_SIZE_PLACEHOLDER_ID,class:"bcharts-card bcharts-card-first"});let{lineHeight:i}=getComputedStyle(t);isNaN(Number.parseFloat(i))&&tR(t,{lineHeight:"120%"})}let{paddingTop:i,paddingBottom:s,marginTop:r,lineHeight:n}=getComputedStyle(t),a=this.pane.isMain?r:"0";return"cards"!==this.pane.presenter.display.tooltip.mode?Number.parseFloat(a):[i,s,a,n].map(Number.parseFloat).reduce((e,t)=>e+t,0)+tG.CARDS_Y_OFFSET}getPadding(e){let t=this.pane.presenter,i=t.display,s=e$(i,null,"yAxis","minPaddingPercent"),r=e$(i,null,"yAxis","maxPaddingPercent"),n=eH(s),a=eH(r),o=n||a?0:this.getInitialPadding(),l=n?s:tG.PANE_CAP_MIN_PADDING_PERCENT,u=a?r:tG.PANE_CAP_MAX_PADDING_PERCENT,h=l*this.viewBox.height,c=[a?u*this.viewBox.height:Math.max(h,Math.min(u*this.viewBox.height,o)),h];e===el.Max?c[0]=tG.PANE_TINY_PADDING_PIXELS:e===el.Min&&(c[1]=tG.PANE_TINY_PADDING_PIXELS);let d=t.mainPlot;return d&&d.hasEvents&&(c[0]+=3*t.view.getEventRadius()),c}clearTicks(){this.ticks=null}getTicks(e,t=0){let{height:i}=this.viewBox,s=iH(e,1.3),r={height:i,approxLineHeight:s,domain:this.yScale.domain()};if(eH(this.ticks)&&eH(r.domain)&&eH(this.lastUsedOptions)&&eH(this.lastUsedOptions.domain)&&r.height===this.lastUsedOptions.height&&r.approxLineHeight===this.lastUsedOptions.approxLineHeight&&r.domain[0]===this.lastUsedOptions.domain[0]&&r.domain[1]===this.lastUsedOptions.domain[1])return this.ticks;this.lastUsedOptions=r;let n=Math.floor((i+40)/(s+40)),a=this.yScale.getTicks(n),o=e$(y0().config,null,"overrides","yAxis","tickProvider");if(eH(o)&&"function"==typeof o&&r.height>0&&eH(r.domain)){let e=eG(r);e.autoTicks=eG(a),a=o(e)}let{innerTickSize:l,tickPadding:u,fontSize:h}=this.config,c=null,d=this.yScale?.checkTicks(),p=d?30:40;return this.ticks=a.map(i=>{let s=Math.round(this.yScale.priceToY(i)),r=Math.abs(s-(c??s));if(d&&null!==c&&r<p)return null;c=s;let n=hy(this,i),a=e.measureText(n).width,o={x1:0,x2:0,y1:s,y2:s,dy:0,label:n,labelX:0,labelY:s+.32*h};return this.onTheRight?(o.x1=t,o.x2=o.x1+l,o.labelX=o.x2+a+u):(o.x1=t-l,o.x2=o.x1+l,o.labelX=o.x1-u),o}).filter(e=>null!==e),this.ticks}widthNeeded(e){if(!eH(this.fullDomain))return tG.DEFAULT_PRICE_AXIS_WIDTH;e.save();let{fontWeight:t,fontSize:i}=this.config,{chart:{fontFamily:s}}=this.pane.presenter.display;e.font=`${t} ${i}px ${s}`;let r=t=>e.measureText(hy(this,t,!0)).width,n=Math.max(...this.fullDomain.map(r)),{innerTickSize:a,tickPadding:o}=this.config,l=eH(this.label)?iH(e,1.6):0;return e.restore(),n+a+2*o+l}draw(e){let{chart:{fontFamily:t},yAxis:{gridLines:i,textColor:s,visible:r}}=this.pane.presenter.display;if(!r||!this.viewBox)return;e.save();let{x:n,y:a,width:o,height:l}=this.viewBox,{fontWeight:u,fontSize:h}=this.config;if(iI(e,this.viewBox),e.font=`${u} ${h}px ${t}`,e.lineWidth=2,e.strokeStyle=i.color,e.textAlign="end",eH(this.label)){e.save(),e.fillStyle=iE(.4)(s),e.translate(0,0);let t=this.onTheRight?1:-1;e.rotate(t*Math.PI/2),e.textAlign="center";let i=iH(e),r=t*(a+l/2);this.onTheRight?e.fillText(this.label,r,-(n+o-i)):e.fillText(this.label,r,n+i),e.restore()}let c=this.onTheRight?n:o;e.setLineDash([]),iz(e,c,a,a+l);let d=this.getTicks(e,c);this.drawTicks(e,d,s),this.drawPriceAdornments(e),e.restore()}drawTicks(e,t,i){t&&(e.fillStyle=i,t.forEach(t=>{e.fillText(t.label,t.labelX,t.labelY+t.dy)}))}drawCrosshairIndicator(e,t){if(0===this.plots.length||!this.pane.presenter.display.yAxis.crosshair.enabled)return;let i=this.onTheRight?this.viewBox.x:this.viewBox.width,s=hy(this,this.yScale.yToPrice(t));this.crosshairIndicator.draw(e,i,t,s)}get indicatorHeight(){return this.config.fontSize+this.config.indicatorPadding+this.config.indicatorPadding}drawPriceAdornments(e){var t;let i=this.pane.presenter,{chart:{fontFamily:s,previous:r},yAxis:{showLastValue:n,preventLabelOverlap:a,includePercentChangeWithLastValue:o}}=i.display,l=i.view,u=[],h=(e,t,i,s,r,n)=>{if(null!=t){let a,l=t;t=e.priceMapper(t,n,r);let h=e.is(X.Symbol)||e.is(X.Expression);if(o&&h){let t=e.axis.comparison===K.Percent?K.None:K.Percent;a=e.priceMapper(l,n,r,t)}let c=e.hasDetachedScale?e.metaData.format(t,r):void 0,d=eH(a)?1:2;u.push({y:e.priceToY(t),formattedValue:c,value:t,auxValue:a,color:i,halfHeight:Math.round(this.indicatorHeight/d),priority:s})}};this.plots.forEach(e=>{if(e.timeSeries&&e.timeSeries.hasData){if("All"===n||"Main"===n&&e.main){let t=e.main?1:3;gW(e).filter(e=>null!=e.value&&-1!==e.index).forEach(i=>h(e,i.value,i.color,t,i.field,i.index))}e.showPrevious&&h(e,e.getPreviousValue(),r.color,2,aa.PreviousClose,void 0)}}),this.annotations.concat(this.plotAnnotations).forEach(e=>{u.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})))}),u.sort((e,t)=>e.y-t.y),a&&(t=this.viewBox,u.forEach((e,i,s)=>{if(0===i&&e.y-e.halfHeight<t.y)e.y=t.y+e.halfHeight+1;else if(i>0){let r=s[i-1],n=(({y:e,halfHeight:t})=>e-t)(e),a=(({y:e,halfHeight:t})=>e+t)(r);n<a&&(e.y=a+1+e.halfHeight),(({y:e,halfHeight:t})=>e+t)(e)>t.y+t.height&&(e.y=t.y+t.height-e.halfHeight-1)}}));let c=({y:t,value:i,formattedValue:r,color:n,auxValue:a})=>{let o,{leftOffset:u,rightOffset:h}=l,c=this.onTheRight?this.pane.viewBox.width-h:u,d=ix(n),p=new gF({position:this.onTheRight?"right":"left",fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:s,textColor:d,strokeColor:n,backgroundColor:n}),f=r||hy(this,i),m=this.comparison===K.Percent;eV(a)&&(o=m?hg(this,a):hm(a)),p.draw(e,c,t,f,o)};a?u.forEach(c):gU.forEach(e=>u.filter(t=>t.priority===e).forEach(c))}}let gG=Symbol.for("__dloacip__");class gz{presenter;id;axes;height;alignedToYear;viewBox;constructor(e){this.presenter=e,this.axes=[],this.height=0,this.alignedToYear=null,this.id=e0()}fromModel(e){this.height=e.height,!0===e.alignOnExpirations&&(this.alignedToYear=function(e){let t=e.map(e=>e.plots).flat().filter(e=>X[e.type]==X.Symbol).map(e=>e.symbol).map(e=>tL(e)).filter(e=>null!==e).map(e=>e.getFullYear());return 0!=t.length?Math.max(...t):null}(e.axes)),this.axes=e.axes.map((e,t)=>{let i=new g$(this);return i.primary=0===t,i.fromModel(e),i},this)}getBounds(){return this.viewBox}setViewBox(e){this.viewBox=e}drawBackground(e){eH(this.viewBox)&&(this.drawAxes(e),e.save(),this.clipToNoScales(e),this.drawGrid(e),e.restore())}draw(e){eH(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&&!1!==this.presenter[gG]&&function(e,{x:t,y:i,height:s,width:r}){if(!eV(mx))return;let{path:n,width:a,height:o,rect:l}=mx,u=Math.min(Math.max(50,r/8),a)/a;l.width=a*u,l.height=o*u,l.x=t+5,l.y=i+s-l.height-5,e.save();let h=getComputedStyle(e.canvas).getPropertyValue("--widget-logo-fill-color");e.fillStyle=0===h.length?"rgba(127, 127, 127, 0.6)":h,e.translate(l.x,l.y),e.scale(u,u),e.fill(n),e.restore()}(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 i=t.getPreviousValue();if(null!=(i=t.priceMapper(i,void 0,aa.PreviousClose))){let{leftOffset:s,rightOffset:r}=this.presenter.view,n=this.viewBox.width-r,a=t.axis.yScale.priceToY(i),{color:o,dashStyle:l,lineWidth:u}=this.presenter.display.chart.previous,h=iv(l);e.save(),e.strokeStyle=o,e.lineWidth=u,e.setLineDash(h),iY(e,a,s,n),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){iI(e,this.getBoundsWithoutScales())}drawAnnotations(e){e.save();let{chart:{fontFamily:t},yAxis:{fontSize:i}}=this.presenter.display;e.font=`${i??12}px ${t}`;let s=t=>t.draw(e,!0);this.axes.forEach(e=>{e.annotations.forEach(s),e.plotAnnotations.forEach(s)}),e.restore()}drawGrid(e){let{chart:{fontFamily:t},yAxis:{gridLines:i,visible:s,minorGridLines:r}}=this.presenter.display;if(!s||!i.visible)return;let{lineWidth:n,color:a,dashStyle:o}=i;e.save();let l=this.axes[0].plots?.length===0&&this.axes.length>1,u=this.axes[+!!l],{fontWeight:h,fontSize:c}=u.config;e.font=`${h} ${c}px ${t}`;let d=u.getTicks(e),{leftOffset:p,rightOffset:f}=this.presenter.view,m=this.viewBox.width-f,g=(t,i,s)=>{e.lineWidth=t,e.strokeStyle=i,e.setLineDash(iv(s)),e.beginPath()};if(g(n,a,o),d.forEach(t=>{e.moveTo(p,t.y1),e.lineTo(m,t.y2)}),e.stroke(),r&&r.visible&&d.length>=2){let{lineWidth:t,color:i,dashStyle:s}=r,n=(d[0].y1-d[1].y1)/5;g(t,i,s),d.forEach(t=>{for(let i=1;i<5;i++){let s=Math.ceil(t.y1+i*n);e.moveTo(p,s),e.lineTo(m,s)}}),e.stroke()}e.restore()}drawYCrosshair(e,t){let{yAxis:{crosshair:{enabled:i,showValue:s,color:r,dashStyle:n}}}=this.presenter.display;if(!i)return;let a=iv(n);e.strokeStyle=r,e.setLineDash(a);let o=this.presenter.view.leftOffset,l=this.viewBox.width-this.presenter.view.rightOffset,u=iX();u.prolog(e),iY(e,u.adjust(t.y),u.adjust(o),u.adjust(l)),u.epilog(e),s&&this.axes.forEach(i=>{i.drawCrosshairIndicator(e,t.y)})}drawNoData(e){e.save(),e.font=`800 14px ${this.presenter.display.chart.fontFamily}`,e.fillStyle="#f00",iU(e,y0().config.noDataText||tG.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},J.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,i=this.presenter.display.chart.showNoDataText,s=!eH(i)||i,r=new Map,n=!0,a=i=>{for(let e of this.axes){for(let s of e.plots){let e=s.isEmpty();n=n&&s.main&&e,s===t||e||i(s)}e.plots.includes(t)&&!t.isEmpty()&&i(t)}s&&n&&this.drawNoData(e)};a(t=>t.draw(e)),a(t=>t.drawTopmost(e,r)),e.restore()}}function gY(e,t){return{width:e,spacing:t,get totalWidth(){return this.width+this.spacing},offset:0}}class gj extends fH{timeline;aggregation;marginBars;bar;resetBar;wasZoomed;fitAllData;constructor(e,t){super(),this.timeline=e,this.aggregation=t;let i=e.presenter.display;this.marginBars=i.xAxis.marginBars||0,this.bar=gY(e$(i,tG.DEFAULT_BAR_WIDTH,"chart","bar","width"),e$(i,tG.DEFAULT_BAR_SPACING,"chart","bar","spacing")),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}extent(e){return fV.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(eH(e))return this.scaleBarToFitRange([e.from,e.to]);let t=this.display.density;if(Number.isFinite(t))return this.scaleBarToFitDensity(t);let i=this.display.period;if(Number.isFinite(i))return this.scaleBarToFitPeriod(i)}deriveExtentsFromBarWidth(e){if(!eH(this._range)||0===this.timeline.length)return null;let t=this._range[1]-this._range[0],i=Math.ceil(t/e.totalWidth);e.offset=t-i*e.totalWidth;let s=this.timeline.lastSeriesIndex+this.marginBars,r=this._domain&&this._domain[1];return r&&(s=e_(this.timeline,+r,Number,hP)),[s-i+1,s]}adjustDomain(){if(!eH(this._range))return;this.scaleBarToFit();let e=this.deriveExtentsFromBarWidth(this.bar);eH(e)&&(this.extent(e),this.setDomainFromExtent())}xToTime(e){if(!this.ready)return null;let t=Math.floor((e-this._range[0]-this.bar.offset)/this.bar.totalWidth),i=this._extent[0]+t;return this.timeline.at(i)}timeToIndex(e){return this.ready?(e="number"==typeof e?e:+e,e_(this.timeline,e,Number,hP)):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*this.bar.width/100,i=this.bar.width-t,s=this.bar.spacing-e*this.bar.spacing/100;if(i>tG.MAXIMUM_BAR_WIDTH||i<tG.MINIMUM_BAR_WIDTH)return!1;let r=gY(i,s),n=this.deriveExtentsFromBarWidth(r);return!!this.isUsableExtent(n)&&(this.setBar(i,s),this.adjustDomain(),this.wasZoomed=!0,!0)}scaleBarToFitRange(e,t=!0){let i=(e,t,i,s)=>eH(e)?e_(this.timeline,e,Number,hP,i,s):t,{from:s,to:r}=this.presenter.data.range||{},n=+e[0]===s&&+e[1]===r,{firstSeriesIndex:a,lastSeriesIndex:o}=this.timeline,l=n?a:void 0,u=n?o:void 0,h=[i(e[0],a,l,u),i(e[1],o,l,u)];this.timeline.at(h[1])>e[1]&&(h[1]=Math.max(0,h[1]-1)),this.extent(h),this.scaleBarToFitDensity(h[1]-h[0]+1,t)}scaleBarToFitDensity(e,t=!0){let i=Math.max(tG.MINIMUM_BARS_VISIBLE,e),s=t&&this.display.xAxis.marginBars||0,r=(this._range[1]-this._range[0])/(i+s);this.setBar(2/3*r,1/3*r,!1)}scaleBarToFitPeriod(e){let t=this.timeline.lastSeriesIndex,i=this.timeline.at(t),s=i,r=t,n=this.presenter.data.aggregation;if(n.isEndOfDay||n.isIntraday&&e>=tG.INTRA_THRESHOLD)for(;r>0&&ug(i,s)<e;)r--,s=this.timeline.at(r);else if(!n.isTick){let t=Math.floor(e/tG.ONE_DAY_MILLIS),s=e=>go(e,to(e)),n=s(i),a=i;for(;r>0;){let e=this.timeline.at(r),i=nl(e,a);if(0===t){if(s(e)<=n||!i)break}else i||(t--,a=e);r--}}this.scaleBarToFitDensity(t-r+1)}setBar(e,t,i=!0){let[s,r]=eQ(e,t,tG.MINIMUM_BAR_WIDTH,tG.MAXIMUM_BAR_WIDTH);this.bar.width=s,this.bar.spacing=r,this.wasZoomed||(this.resetBar={width:s,spacing:r}),i&&(this.presenter.model.display.chart.bar={width:e,spacing:t})}resetZoom(){eH(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=tG.DEFAULT_BAR_WIDTH,this.bar.spacing=tG.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(e){return eH(e)&&eH(e[0],e[1])&&e[0]>=0&&e[1]<this.timeline.withPrologEpilogLength&&e[1]-e[0]>=tG.MINIMUM_BARS_VISIBLE}shiftBars(e,t=null){if(!this._extent)return;let i=this._extent.map(t=>t+e);this.isUsableExtent(i)&&(eH(t)&&(this.bar.offset=t),this.extent(i),this.setDomainFromExtent())}setDomainFromExtent(){this.domain(this.extent().map(e=>this.timeline.at(e)))}pan(e){if(!Number.isFinite(e)||0===e)return;let t=e%this.bar.totalWidth,i=this.bar.offset+t,s=Math.sign(e),r=-(e<0?Math.ceil:Math.floor)(e/this.bar.totalWidth);(i>this.bar.totalWidth||i<-this.bar.totalWidth)&&(r+=i>0?-1:1,i-=s*this.bar.totalWidth),this.shiftBars(r,i)}getSeriesThatCouldLoadMoreData(){let e=this.domain();if(!eH(e)||!eH(e[0]))return[];let t=e[0].getTime();return this.timeline.presenter.allPlots.map(e=>e.timeSeries).filter(e=>!!eH(e)&&!!e.hasData&&0!==e.container.size&&!0===e.canLoadMoreData&&t<=e.container.getTimeData()[0].getTime())}}function gK(e){return{date:e,priority:1,text:hf(e)}}class gq{view;xScale;ticks;lastUsedOptions;wasPanned;panningXAxisAllowed;config;isVisible;crosshairIndicator;viewBox;overrideTickGetter;overrideFormatter;constructor(e){this.view=e,this.xScale=new gj(e.presenter.timeline,e.presenter.data.aggregation),this.ticks=null,this.lastUsedOptions=null,this.wasPanned=!1,this.panningXAxisAllowed=e$(e.presenter.display,!0,"xAxis","panning"),this.updateConfigFromModel();let t=e.presenter.renderTo.id,i=e$(y0().config,null,"overrides","xAxis","tickProvider");eH(i)&&"function"==typeof i&&(this.overrideTickGetter=eu(i,t));let s=e$(y0().config,null,"overrides","xAxis","formatter");eH(s)&&"function"==typeof s&&(this.overrideFormatter=eu(s,t))}updateConfigFromModel(){let{chart:{fontFamily:e,backgroundColor:t,fontSize:i},xAxis:{textColor:s,visible:r,fontSize:n,crosshair:{color:a}}}=this.view.presenter.display;this.config={innerTickSize:5,tickPadding:5,indicatorPadding:5,fontWeight:400,fontSize:n||i||12},this.isVisible=r,this.crosshairIndicator=new gF({position:"bottom",fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:a,textColor:s,backgroundColor:i_(.15)(t),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();let e=this.view.presenter.display.period===tG.FIFTY_YEARS_MILLIS;eH(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!!eH(t)&&e-this.xScale.timeline.lastSeriesIndex>=0&&e-t[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(),i=t?t[1]:e;return e-i}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=0!==this.barsToLast?this.barsToLast+this.xScale.marginBars+1:0;this.xScale.shiftBars(e),this.view.setPriceAxesDomains(),this.view.redraw()}}setViewBox(e){this.viewBox=e;let{x:t,width:i}=this.viewBox;this.xScale.range([t,t+i])}heightNeeded(e){if(!this.isVisible)return 0;let t=this.view.presenter.display.chart.fontFamily,{fontWeight:i,fontSize:s}=this.config;e.save(),e.font=`${i} ${s}px ${t}`;let{innerTickSize:r,tickPadding:n,indicatorPadding:a}=this.config,o=iH(e,1)+r+n+a;return e.restore(),o}getTickGetter(e){if(this.overrideTickGetter)return this.overrideTickGetter;let t=this.view.presenter.display.xAxis.isOrdinal||!1,i=function(e){switch(e.agg.unit){case $.Tick:return new hl(e);case $.Intraday:return new hu(e,e.agg.size);case $.Day:return new hh(e);case $.Week:return new hc(e);case $.Month:case $.Quarter:return new hd(e);case $.Year:return new hp(e);default:throw Error(`Aggregation unit ${$[e.agg.unit]} not supported.`)}}(e);return t?gK:e=>i.getTick(e)}getTicks(e){let t,i;if(eH(this.lastUsedOptions)&&(t=e.agg,i=this.lastUsedOptions.agg,t.unit===i.unit&&t.size===i.size&&t.spec===i.spec)&&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&&eH(this.ticks))return this.ticks;this.lastUsedOptions=e;let s=this.getTickGetter(e),r=Math.max(0,e.extent[0]),n=Math.min(this.xScale.timeline.withPrologEpilogLength-1,e.extent[1]+1);return this.ticks=this.view.presenter.timeline.slice(r,n).map((e,t)=>{if(!eH(e)||Number.isNaN(e.getTime()))return null;let i=s(e);return eH(i)&&(i.index=r+t),i}).filter(e=>eH(e)),this.ticks}normalizeDuration(e){let t=function(){let e=Object.keys(he);return 1===he.Day.Multipliers[0]&&e.forEach(e=>{let t=he[e],i=eJ(t.Period);t.One=+i,t.Multipliers=t.Multipliers.map(e=>e*i)}),he}(),i=t.Year,s=Object.keys(t);for(let r=0;r<s.length-1;++r){let n=t[s[r]].Multipliers,a=t[s[r+1]].Multipliers;if(e<=(eb(n)+eP(a))/2){i=t[s[r]];break}}let r=i.Multipliers,n=r.findIndex(t=>e<t),a=-1===n?eb(r):r[n];return"P1M"===i.Period?a*=.9:"P1W"===i.Period&&(a*=.84),a}draw(e){if(!this.isVisible)return;let{xAxis:{gridLines:t,textColor:i,minTickInterval:s,tickPixelInterval:r,format:n,forceTicksVisible:a},chart:{fontFamily:o}}=this.view.presenter.display,{fontWeight:l,fontSize:u,innerTickSize:h,tickPadding:c}=this.config,{x:d,y:p,width:f}=this.viewBox,{lineWidth:m,color:g,dashStyle:y}=t,T=iv(y);e.textAlign="center",e.font=`${l} ${u}px ${o}`,e.lineWidth=1,e.strokeStyle=g,e.fillStyle=i,e.setLineDash([]),iY(e,p,d,d+f);let A=this.xScale.extent(),S=e=>!eH(e)||!eH(e[0],e[1]);if(S(A))return;let v=t=>e.measureText(t).width,b=r>0?r:120,P=this.xScale.domain();if(S(P))return;let C=(P[1].getTime()-P[0].getTime())*b*.6/f,E=this.normalizeDuration(C),_=this.view.presenter.data.aggregation.isEndOfDay,M=d+f,L=({text:i,x:s,date:r,forced:n})=>{eH(r)&&(n||iz(e,s,p,p+h),e.fillText(i,s,p+h+c+.71*u),t.visible&&!n&&(e.save(),e.lineWidth=m,e.setLineDash(T),iz(e,s,0,p),e.restore()))},x={agg:this.view.presenter.data.aggregation,unitWidth:v("M"),barWidth:this.xScale.bar.width,extent:A,formatString:n,minTickInterval:s||0,duration:C},O=this.getTicks(x),I={date:tG.ZERO_DATE,priority:999,x:-999,text:"",index:-1,textWidth:0};O.forEach(e=>{e.x=this.xScale.indexToX(e.index),e.textWidth=v(e.text);let{x:t,textWidth:i}=e,r=t;if(a){let s=i/2;e.x=r=(r=t-s<d?d+s:t)+s>M?M-s:r,e.forced=t!==r}else e.forced=!1;((e,t)=>{let i,r;if(e.date.valueOf()===tG.ZERO_DATE.valueOf())return!0;if(i=e.date,r=t.date,(eH(i)?ug(r,i):tG.FIFTY_YEARS_MILLIS)<s)return!1;let n=t.x-e.x,a=t.date.getTime()-e.date.getTime();return!(e.x+e.textWidth/2>=t.x-t.textWidth/2)&&(n>b||!!_&&a>=E)})(I,e)?(L(I),I=e):e.priority<I.priority&&(I=e)}),L(I),this.drawTimeTransitions(e),this.drawTimeAdornments(e)}drawTransitionsFor(e,t,i,s){let r=this.xScale.domain(),n=this.view.presenter?.mainPlot?.timeSeries.container;if(!eV(n))return;let a=n.getTimeData(),o=null===t?a:n.getData(t);if(!eH(o))return;let l=e_(a,+r[0],Number),u=e_(a,+r[1],Number,eE,l);if(l<u){s.save();let t=iX();t.prolog(s),s.strokeStyle=e.color,s.lineWidth=e.width,s.setLineDash(iv(e.dashStyle));let r=null;for(let e=l;e<u;++e){let t=o[e];if(i(t,r)){let i=a[e],n=this.xScale.timeToX(i);eH(n,r)&&iz(s,n,0,this.viewBox.y),r=t}}t.epilog(s),s.restore()}}drawTimeTransitions(e){let t=this.xScale.domain();if(!eV(t)||!eH(t[0],t[1]))return;let i=this.view.presenter,{xAxis:{contractTransition:s,cycleTransition:r}}=i.display,n=(e,t)=>e!==t;s.enabled&&i?.data?.aggregation.isMultiContract&&this.drawTransitionsFor(s,aa.Symbol,n,e),r.enabled&&(i?.data?.aggregation.isIntraday?this.drawTransitionsFor(r,aa.TradingDay,n,e):i?.data?.aggregation.unit===$.Day?this.drawTransitionsFor(r,null,(e,t)=>!nu(e,t),e):i?.data?.aggregation.unit===$.Week&&this.drawTransitionsFor(r,null,(e,t)=>!nm(e,t),e))}getAnnXScore(e,t){return[nl,nf,nu,nm].map((i,s)=>(4-s)*Number(i(e,t))).reduce((e,t)=>e+t,0)}annTimeToX(e){let t=this.xScale.timeToIndex(e);if(!eV(t))return null;let i=this.xScale.timeline.at(t),s=this.xScale.timeToX(e);if(!(t>0)||i.valueOf()===e.valueOf())return s;{let r=t-1,n=this.xScale.timeline.at(r),a=this.xScale.indexToX(r);if(!this.view.presenter.display?.xAxis?.isOrdinal){if(n.valueOf()>e.valueOf())return s;let t=this.getAnnXScore(n,e),r=this.getAnnXScore(i,e);return t>r?a:r>t?s:this.view.presenter?.data?.aggregation?.isIntraday?a:s}return a+(s-a)*((e.valueOf()-n.valueOf())/(i.valueOf()-n.valueOf()))}}drawTimeAdornments(e){e.save();let t=this.view.presenter,{chart:{fontFamily:i},xAxis:{preventLabelOverlap:s}}=t.display,r=[],n=t.mainPane?.getBoundsWithoutScales()??new iD(0,0,0,0);t.allAnnotations.concat(t.plotAnnotations).forEach(i=>{r.push(...i.getTimeScaleAdornments().map(i=>{let s=this.annTimeToX(i.time);if(s<n.x||s>n.x+n.width)return null;let r=hT(t,this.view.presenter?.display?.xAxis?.isOrdinal?i.time:this.xScale.xToTime(s)),a=e.measureText(r).width/2;return{x:s,value:r,color:i.color,halfWidth:a}}).filter(e=>null!=e))}),r.sort((e,t)=>e.x-t.x),s&&function(e,t){let i=e.length-1;e.forEach((e,s,r)=>{let n=0===s,a=n?null:r[s-1],o=(({x:e,halfWidth:t})=>e-t-4)(e),l=n?t.x:(({x:e,halfWidth:t})=>e+t+4)(a);if(e.x-e.halfWidth<t.x&&(e.x=gB(t.x,e.halfWidth)),o<l)e.x=gB(l,e.halfWidth+4);else{let t=(({x:e,halfWidth:t})=>e+t+4)(e),n=s<i?(({x:e,halfWidth:t})=>e-t-4)(r[s+1]):Number.MAX_SAFE_INTEGER;if(t>n){let i=gk(e.x,t-n),s=gk(e.x,e.halfWidth-2);e.x=Math.max(s,i,gB(l,a?.halfWidth??0))}}(({x:e,halfWidth:t})=>e+t+4)(e)>t.x+t.width&&(e.x=gk(t.x+t.width,e.halfWidth))})}(r,this.viewBox),r.forEach(t=>{let s=ix(t.color);new gF({position:"bottom",fontSize:this.config.fontSize,fontFamily:i,padding:this.config.indicatorPadding,strokeColor:tG.COLOR_TRANSPARENT,textColor:s,backgroundColor:t.color,arrowLength:this.config.innerTickSize}).draw(e,t.x,this.viewBox.y+1,t.value)}),e.restore()}drawCrosshair(e,{x:t}){let i=this.view.presenter,s=i.display.xAxis,{enabled:r,showValue:n,color:a,dashStyle:o,format:l}=s.crosshair,u=this.xScale.xToTime(t);if(!(eH(u)&&op(u)))return!1;if(!r)return!0;t=this.xScale.timeToX(u);let h=iv(o);e.strokeStyle=a,e.setLineDash(h);let c=iX();if(c.prolog(e),iz(e,c.adjust(t),0,c.adjust(this.viewBox.y)),c.epilog(e),!n||!s.visible)return!0;let d=hT(i,u,eH(s.format)?l:void 0);this.crosshairIndicator.draw(e,t,this.viewBox.y+1,d,void 0,this.viewBox.height-2);let{plotHover:p}=i.display.chart;return p&&i.allPlots.filter(e=>e.visible).forEach(i=>i.curves.forEach(i=>i.drawHover(e,u,t))),!0}}let gX={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",dblclick:"onMouseDblClick",contextmenu:"onContextMenu",mouseover:"onMouseEnter",mouseout:"onMouseLeave",wheel:"onWheel",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",keydown:"onKeyDown"},gZ={Shift:"shiftKey",Alt:"altKey",Control:"ctrlKey",Meta:"metaKey"};class gJ{view;subscriptions;constructor(e){this.view=e,this.subscriptions=[]}init(e){let t=eI();Object.keys(gX).filter(e=>!e.startsWith("touch")||t).forEach(t=>{let i=e=>{let i=gX[t];!0===this.notifyActiveTool(i,e)&&e.preventDefault()};e.addEventListener(t,i),this.subscriptions.push(()=>{e.removeEventListener(t,i)})})}shutdown(){this.subscriptions.forEach(e=>e()),this.subscriptions=[]}notifyActiveTool(e,t){let i=this.view.presenter;if(void 0===i||null===i.activeTool)return!1;let s=this.getPayload(t,i),r=i.activeTool,n=!1;return"function"==typeof r[e]&&(n=r[e](s)||!1),n}getPayload(e,t){let i=e instanceof MouseEvent,s=eI()&&e instanceof TouchEvent;if(i||s){let r={x:0,y:0};if(s&&1===e.touches.length){let t=e.touches[0],{left:i,top:s}=e.target.getBoundingClientRect();r.x=t.clientX-i,r.y=t.clientY-s}else i&&(r.x=e.offsetX,r.y=e.offsetY);let n={button:i?e.which:ee.Left,offset:r,view:t.view,presenter:t,originalEvent:e,getModifier:t=>e[gZ[et[t]]]};if(e instanceof WheelEvent&&(n.delta=e.shiftKey?e.deltaX:e.deltaY),s&&2===e.touches.length){let t=e.touches[0],i=e.touches[1];n.pinchZoom=!0;let s=t.clientX-i.clientX,r=t.clientY-i.clientY;n.pinchDistance=Math.sqrt(s*s+r*r)}return this.view.splitters.forEach((e,t)=>{e.contains(r)&&(n.splitter=[t,t+1])}),t.panes.forEach(e=>{let t=e.getBounds();if(eH(t)&&t.contains(r)){let t=e.axes.find(e=>e.viewBox?.contains(r));t?n.priceAxis=t:n.point=e.axes.find(e=>e.primary).toAnnotationPoint(r)}}),n}if(e instanceof KeyboardEvent)return{key:e.key??e.keyIdentifier,code:e.keyCode||e.charCode,repeat:e.repeat,presenter:t,getModifier:t=>e.getModifierState(et[t])}}}let gQ=ur.concat(aa.PercentChange);class g0{view;id;isOptionsChart;constructor(e){this.view=e,this.isOptionsChart=!1,this.id=`bc-legend-${e0()}`}getLegendElem(){let e=this.view.el;return tV(this.id,e,"div")}update(){let e=this.getLegendElem(),t=hH(this.presenter.mainPane);if(!eH(t))return;this.isOptionsChart=this.mainPlot.title.startsWith(tG.FAKE_SYMBOL_PREFIX);let{left:i,right:s,top:r,width:n}=t;mC(e,"row",i,s,r,n),tH(e,{"bcharts-card":!0,"bcharts-legend":!0});let a=this.mainPlot,o=a.isSeasonal||this.isOptionsChart?this.getFirstColorBadge(a):"",l=this.getPlotTitle(a),u=this.maybeGetQuote(),h=this.div(`${o} ${l} `)+this.div(`${u}`),c=this.maybeGetAdditionalPlots();e.innerHTML=`${h} ${c}`}remove(){this.getLegendElem().remove()}get presenter(){return this.view.presenter}get mainPlot(){return this.presenter.mainPlot}getAttributes(e){return Object.entries(e).map(([e,t])=>{if(null===t)return"";let i=Array.isArray(t)?t.join(" "):t;return`${e} = "${i}" `}).join(" ")}span(e,t={}){return`<span ${this.getAttributes(t)}>${e}</span>`}div(e){return`<div class="plot" style="flex: 0 0 auto">${e}</div>`}get meta(){return this.mainPlot.metaData}isSingleSymbolSeasonal(e){return e.isSeasonal&&!e.hasComputation}format(e,t,i){return(i??this.meta).format(e,t)}spanAsName(e){return this.span(e,{class:"field-name"})}spanAsValue(e,t=null,i=null){return this.span(e,{class:["field-value",t],style:i})}getQuoteFromRecord(e){let t=gQ.map(t=>e.getValue(t));if(eg(t)){let e=t[4],i=`field-${e>0?"up":e<0?"down":"same"}-value`,s=t.slice(0,-1).map((e,t)=>{let s=gQ[t],r=this.format(e,s),n=hB(s);return`${this.spanAsName(n)}${this.spanAsValue(r,i)}`}).join(" "),r=this.spanAsValue(`(${this.format(eb(t),eb(gQ))})`,i);return`${s} ${r}`}return""}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries?.record?.isValid){let e=y0().getRecordSource().getRecord(this.mainPlot.timeSeries.record.symbol);return this.getQuoteFromRecord(e)}if(this.mainPlot.isExpression&&this.mainPlot.record.isValid){let e=this.mainPlot.record;return e.evaluate(),this.getQuoteFromRecord(e)}return""}getTitle(e,t,i){let s=this.span(`${e.name} (${e.symbol})`,{"data-plot-id":i,class:["value-title",t?"value-main":null]}),r=t?` ${this.span(e.exchange,{class:"value-subtitle"})}`:"";return`${s}${r}`}getPlotTitle(e){if(e.isSymbol)return this.getTitle(e.metaData,e.main,e.id);if(!(this.isSingleSymbolSeasonal(e)&&0===e.offset&&(e.symbols?.length??0)>0))return this.span(e.title,{"data-plot-id":e.id,class:"value-title"});{let t=y0().getMetaDataSource().getMetaData(e.getActualSymbols()[0]);return this.getTitle(t,!0,e.id)}}getFirstColorBadge(e){return hO("rectangle",e.mainCurve.colors[0])}getLastValues(e){return this.isOptionsChart?"":gW(e).filter(e=>eH(e.value)).map(t=>{let i=this.format(t.value,t.field,e.metaData);return this.spanAsValue(i,null,`color:${t.color}`)}).join(" ")}canBeDeleted(e){return e.isStudy||!e.main&&this.isOptionsChart}maybeGetAdditionalPlots(){let e=this.presenter.mainPane.axes.map(e=>e.plots).flat().filter((e,t)=>!e.main||e.isSeasonal&&t>0),t=this.presenter.display.yAxis.showLastValue;return e.length>0?e.map(e=>{let i=this.getFirstColorBadge(e),s=this.getPlotTitle(e),r=this.canBeDeleted(e)?hN(e.id):"",n="All"===t||e.isSeasonal?"":this.getLastValues(e);return this.div(`${r} ${i} ${s} ${n}`)}).join(" "):""}}class g1{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 g0(this),this.draw=this.draw.bind(this),this.notifyLayoutChanged=function(e,t=100){var i,s;let r;return i=t=>eR(e,t),s=t,r=!1,function(...e){r||(i.apply(this,e),r=!0,setTimeout(function(){r=!1},s))}}(ao.CH_CHTLAYOUTCHANGED,tG.LAYOUT_THROTTLE_DELAY)}get canShowLegend(){if(!this.presenter.hasLegend)return!1;let e=this.presenter.display.chart.showLegend;return"boolean"!=typeof e||!!e}updateLegend(){this.canShowLegend&&this.legend.update()}removeLegend(){this.legend.remove()}findSvgParentWithClass(e,t){return[e,e.parentElement,e.parentElement.parentElement].find(e=>eH(e)&&e.className===t)}onNonToolHandledMouseDown(e){let t=this.presenter,i=e.target;if("string"==typeof i.className&&i.className.split(" ").includes("value-title"))t.onCardClicked(i);else{let s=this.findSvgParentWithClass(i,"move-pane");if(eV(s))return void t.onMovePaneClicked(s);let r=this.findSvgParentWithClass(i,"delete-plot");if(eV(r))return void t.deletePlotClicked(r);let n=this.findSvgParentWithClass(i,"show-hide-plot");if(eV(n))return void t.showHidePlotClicked(n);let a=this.findSvgParentWithClass(i,"more-actions");if(eV(a))return void t.plotMoreActionsClicked(a,e)}}initialize(e){this.presenter=e,this.el=this.presenter.hostElement;let t=new ResizeObserver(e=>{for(let t of e){let{width:e,height:i}=t.contentRect;this.setSize(e,i),eH(this.tooltip)&&this.tooltip.repositionAuto()}});t.observe(this.el.parentElement),this.listeners.push(()=>t.unobserve(this.el.parentElement));let i=e=>this.onNonToolHandledMouseDown(e);this.el.addEventListener("mousedown",i),this.listeners.push(()=>this.el.removeEventListener("mousedown",i)),tR(this.el,{flex:1,display:"flex",position:"relative","flex-direction":"column","touch-action":"pan-x pan-y"}),this.tooltip=new mv(this);let s=y0().config.getCustomEventPopup;this.customEventPopup=s?s(this):null;let{clientHeight:r,clientWidth:n}=this.el;this.width=n,this.height=r,this.canvasContainer=tF(this.el,"div"),tN(this.canvasContainer,{class:"chart-canvas-container"}),tR(this.canvasContainer,{flex:1,display:"flex","flex-direction":"column",position:"relative",height:"100%"}),this.mainCanvas=tF(this.canvasContainer,"canvas");let a={height:`${r}px`,width:`${n}px`,"z-index":2,position:"absolute",top:0,left:0};tR(this.mainCanvas,a),this.mouseCanvas=tF(this.canvasContainer,"canvas"),tN(this.mouseCanvas,{tabIndex:0}),a["z-index"]=3,a.outline="none",tR(this.mouseCanvas,a),this.goToLatestButton=tF(this.el,"button"),tB(this.goToLatestButton,`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
19
19
  <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>
20
- </svg>`),tR(this.goToLatestButton,{position:"absolute",right:0,bottom:0,"z-index":3}),tN(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 gK(this),this.eventCapture=new gZ(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(n,r);let o=tI(this.el);eH(tw(`.${tG.SVG_ICONS_DOM_NODE}`,o))||function(e){let t=tF(e,"div");tN(t,{class:tG.SVG_ICONS_DOM_NODE});let i=Object.keys(hC).map(e=>`<symbol id="${hL(e)}" viewBox="0 0 1024 1024">${hC[e]}</symbol>`).join("");t.innerHTML=`<svg style="display:none" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs>${i}</defs></svg>`}(o)}reinitialize(){this.el&&tk(".bcharts-card",this.el).forEach(e=>e.remove()),this.customEventPopup?.hide(),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.resetZoomAndVisibleRange?this.xAxis=new gK(this):this.xAxis?.updateConfigFromModel(),this.recalculateLayout(),this.redraw()}setSize(e,t,i=!1){this.setChartSize(e,t),this.redraw(i)}setChartSize(e,t){let i={width:`${e}px`,height:`${t}px`};tR(this.el,i),this.width=e,this.height=t;let s=globalThis.devicePixelRatio||1,r={height:this.height*s,width:this.width*s};[this.mainCanvas,this.mouseCanvas].forEach(e=>{tN(e,r),tR(e,i)}),this.mainContext.scale(s,s),this.mouseContext.scale(s,s),this.recalculateLayout(),this.presenter&&mv(this.presenter)}widthNeeded(e,t){let i=this.presenter.allAxes.filter(e=>e.onTheRight===t);return 0===i.length?0:Math.max(...i.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),i=this.widthNeeded(this.mainContext,!1),s=this.height-e,r=this.presenter.panes,n=ef(r.map(e=>e.height)),a=0,o=tG.PANE_SPLITTER_PERCENT_HEIGHT/100,l=Math.floor(o*s);n*=1+(r.length-1)*o;let u=this.presenter.display?.yAxis?.primaryOnTheLeft??!1;this.presenter.display.yAxis.visible&&(r.some(e=>e.axes.length>1)?(this.leftOffset=i,this.rightOffset=t):u?this.leftOffset=i:this.rightOffset=t),r.forEach((e,i,r)=>{let o=i===r.length-1,u=Math.floor(s*e.height/n),h=new iD(0,a,this.width,u);e.setViewBox(h);let c=new iD(this.width-this.rightOffset,a,t,u),d=new iD(0,a,this.leftOffset,u),p=e=>e.setViewBox(e.onTheRight?c:d);if(p(e.axes[0]),e.axes[1]&&p(e.axes[1]),a+=u,!o){let e=new iD(this.leftOffset,a,this.width-this.rightOffset-this.leftOffset,l);this.splitters.push(e),a+=l}});let h=new iD(this.leftOffset,a,this.width-this.rightOffset-this.leftOffset,e);this.xAxis.setViewBox(h),tR(this.goToLatestButton,{right:`${t+5}px`,bottom:`${e+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(){for(let e of(this.mainContext.save(),this.mainContext.miterLimit=1,this.drawBackground(this.mainContext),this.presenter.panes))e.drawBackground(this.mainContext);for(let e of(this.xAxis.draw(this.mainContext),this.presenter.panes))e.draw(this.mainContext);this.drawSplitters(this.mainContext),this.presenter.title.draw(this.mainContext);let e=yQ().config.showGoToLatest,{showGoToLatest:t}=this.presenter.display.chart,i=eH(e)?e:t;this.goToLatestButton.style.display=i&&this.xAxis.canGoToLast()?"block":"none",this.mainContext.restore()}get isHostElementVisible(){return eH(this.el)&&eH(this.el.offsetParent)}redraw(e=!1){this.isHostElementVisible&&(e?this.draw():yQ().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 i=this.mouseContext;return i.clearRect(0,0,this.width,this.height),!!e&&!!this.xAxis.drawCrosshair(i,t)&&(this.presenter.display.yAxis.visible&&e.axis.pane.drawYCrosshair(i,t),!0)}drawSplitters(e){e.strokeStyle=(e=>{let t=iM(e);return iO(iC(function({r:e,g:t,b:i,a:s}){return{r:255-e,g:255-t,b:255-i,a:s}}(t),t,.7))})(this.presenter.display.chart.backgroundColor),e.lineWidth=2,this.splitters.forEach(t=>{let{x:i,y:s,width:r,height:n}=t,a=s+n/2;e.beginPath(),e.moveTo(i,a),e.lineTo(i+r,a),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=function(e){switch(e){case Q.Arrow:default:return"default";case Q.Crosshair:return"crosshair";case Q.Hand:return"pointer";case Q.Move:return"move";case Q.ResizeVertical:return"ns-resize";case Q.Grabbing:return"grabbing";case Q.ResizeHorizontal:return"ew-resize"}}(e);tR(this.el,{cursor:t})}shutdown(){this.listeners.forEach(e=>e()),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&tk(".bcharts-card",this.el).forEach(e=>e.remove()),this.canvasContainer.remove()}getEventRadius(){return Math.max(this.xAxis.xScale.bar.width/2,tG.MIN_EVENT_RADIUS)}}class g1{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=tF(this.view.el,"div"),tN(this.popupElement,{id:`${this.view.presenter.elementId}-custom-event-host`}),tR(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=tF(this.popupElement,"a");tN(e,{class:"custom-event-close-button"}),tR(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,i){this._initialized||this.initialize(),this.date=t,this.value!==i&&(this.value=i,this.showValue()),tR(this.popupElement,{visibility:"visible",top:`${e.y}px`,left:`${e.x}px`,width:"310px"}),this.visible=!0}hideValue(){}hide(){this.visible&&(this.hideValue(),tR(this.popupElement,{visibility:"hidden"}),this.visible=!1)}}function g2(e,t){if(!(e.annotations&&e.annotations.length>0))return;let i=t.annotations||[];t.annotations=i.concat(e.annotations)}let g3='..axes{..plots{.type==="Study"}}';var ci=R("c15IW");let g4={ok:!1,change:void 0,toApply:void 0};class g5{presenter;paused;undoStack;redoStack;initial;isPaused;constructor(e){this.presenter=e,this.paused=null,this.undoStack=[],this.redoStack=[],this.initial=new Map,this.isPaused=!1,this.clear()}clear(e=!1){this.undoStack=[],this.redoStack=[],this.initial=new Map,e&&this.presenter.allAnnotations.forEach(e=>this.initial.set(e.uid,f4(e,eo.Moved)))}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&&eV(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){this.presenter.handleAnnotationChange({annotation:e,id:"Add"})}apply(e,t,i){if(!eH(e))return!1;switch(t){case eo.None:case eo.Undo:case eo.Redo:yj(`Unexpected tool change ${eo[t]} for undo/redo`,"warn");break;case eo.Created:i?this.delete(e):this.add(e);break;case eo.Deleted:i?this.add(e):this.delete(e);break;default:{let t={...e,id:"Update"};this.presenter.handleAnnotationChange(t)}}let s=this.presenter.allAnnotations.find(t=>t.uid===e.uid),r=i?eo.Undo:eo.Redo;return eH(s)&&this.presenter.onAnnotationModifiedByTool(s,r),!0}can(e){let t=e?this.undoStack:this.redoStack;if(t.length<1)return g4;let i=eb(t),s=i.toolChange;if(!(e&&s!==eo.Deleted&&s!==eo.Created))return{ok:!0,change:s,toApply:i};let r=eC(t,e=>e.uid===i.uid,t.length-2),n=-1!==r?t[r]:null,a=null===n;return a&&!this.initial.has(i.uid)?g4:{ok:!0,change:s,toApply:a?this.initial.get(i.uid):n}}get canUndo(){return this.can(!0).ok}get canRedo(){return this.can(!1).ok}undoRedo(e,t,i){let{ok:s,change:r,toApply:n}=this.can(i);if(!s)return;let a=e.pop();this.apply(n,r,i),t.push(a)}}class g6{presenter;text;align;verticalAlign;x;y;style;constructor(e){this.presenter=e,this.text=null,this.align="center",this.verticalAlign="top",this.x=0,this.y=0,this.style={color:"#333",fontSize:18}}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:i,color:s,fontWeight:r}=this.style,{x:n,y:a,width:o,height:l}=this.presenter.mainPlot.axis.pane.getBounds(),u=n+this.presenter.view.leftOffset,h=n+o-this.presenter.view.rightOffset,c=u;c="center"===this.align?o/2:"right"===this.align?h:u;let d=a+i;"middle"===this.verticalAlign?d=a+i+l/2:"bottom"===this.verticalAlign&&(d=a+l),c+=this.x,d+=this.y,e.save(),e.font=`${r||"normal"} ${i}px ${t}`,e.textAlign=this.align,e.textBaseline="bottom",e.fillStyle=s,e.fillText(this.text,c,d),e.restore()}}function g7(e={}){let t=this.allPlots;if(!t.every(e=>eH(e.timeSeries)&&e.timeSeries.hasData))return"No data to export";let i=e.excludeHeader??!1,s=e.numDecimals??null,r=e.excludeFields??[],n=e=>{let t=new Map;return e.main&&(t.set(an.DateTime,0),this.data.aggregation.isMultiContract&&!e.isExpression&&t.set(an.Symbol,0)),e.curves.forEach(e=>{e.fields.forEach(i=>{r.includes(i.id)||t.set(i,e.shift)})}),Array.from(t)},a=this.data.aggregation.isEndOfDay?tG.FMT_ISO_DATE_ONLY:tG.FMT_EXPORT_ALL_BUT_MILLIS,o=(e,t)=>e===an.DateTime?oY(t,a):(eH(s,t)?eF(t,s):t)?.toString()??"",l={},u=this.timeline.lastSeriesIndex,h=eP(this.mainPlot.timeSeries.container.getTimeData()),c=e_(this.timeline,+h,Number,hb),d=(e,t)=>{let i=this.timeline.at(e),s=t.timeSeries.container,r=s.getTimeData(),u=e_(r,+i,Number,eE,l[t.id]||0),h=+i==+r[u];return h&&(l[t.id]=u),n(t).map(([t,n])=>{if(0===n)if(h)return o(t,s.getData(t)[u]);else if(t===an.DateTime)return oY(i,a);else return"";{let i=this.timeline.at(e-n),a=e_(r,+i,Number,eE,0);return+i==+r[a]?o(t,s.getData(t)[a]):""}})},p=e=>{let i=t.map(e).flat();return i.slice(1).every(e=>0===e.length)?null:i.join(",")},f=[];i||(f.push(p(e=>{let t=Array(n(e).length).fill("");return t[0]=`"${X[e.type]}: ${e.title}"`,t})),f.push(p(e=>n(e).map(([e,t])=>`"${e.name}"`))));let m=[0,0];this.allCurves.forEach(e=>{!e.fields.every(e=>r.includes(e.id))&&(e.shift<0&&(m[0]=Math.min(m[0],e.shift)),e.shift>0&&(m[1]=Math.max(m[1],e.shift)))});for(let e=c+m[0];e<=u+m[1];e++){let t=p(eu(d,e));null!==t&&f.push(t)}return f.join("\n")}function g8(e={}){let t=this.view.mainCanvas,{width:i,height:s}=t,{width:r,height:n,title:a}=e,o=(e,t)=>{let i=document.createElement("canvas");return i.width=e,i.height=t,i.getContext("2d")},l=o(i,s),u=globalThis.devicePixelRatio;if(l.drawImage(t,0,0),l.scale(u,u),eV(a)){let e=new g6(this);e.update(a),e.draw(l)}let h=this.mainPlot?.timeSeries.container?.getLastDataPoint(an.DateTime);if(eV(h)){let{fontFamily:e}=this.display.chart,{fontWeight:i,fontSize:s}=this.mainAxis.config;l.font=`${i} ${1.2*s}px ${e}`,l.textBaseline="top";let r=1.5*s,n=getComputedStyle(t),a=n.getPropertyValue("--app-hc-color"),o=n.getPropertyValue("--app-color-pl"),u={x:tG.CARDS_X_OFFSET,y:tG.CARDS_Y_OFFSET},c=hN(this,h,u,void 0,!1,0),d=`${c.date} ${c.time??""}`.trim(),[p,f]=[1,5],m=(e,t)=>l.measureText(e).width+t,g=(e,t,i,s,r)=>(l.fillStyle=s,l.fillText(e,t,i),m(e,r)),y=(e,t)=>e.type===X[t];c.panes.forEach(e=>{let{top:t,left:i,width:s,right:n}=e.bounds,l=i+s-n-f,h=i+u.x,c=t+u.y;e.plots.some(e=>e.isMain)&&(h+=g(d,h,c,a,f)),e.plots.forEach((e,t)=>{let s,n=(s=e.name,e.isMain&&y(e,"Symbol")?s=`${e.description} (${e.name}) [${e.exchange}]`:y(e,"Study")&&(s=`${e.description} ${e.name.substring(e.name.indexOf(" "))}`),s),d=!y(e,"Study")&&e.values.length>1;if(!e.isMain&&t>0){let t=h+m(n,f);e.values.forEach(e=>{d&&(t+=m(e.abbreviation,p)),t+=m(e.value,f)}),t>=l&&(h=i+u.x,c+=r)}h+=g(n,h,c,a,f),e.values.forEach(e=>{d&&(h+=g(e.abbreviation,h,c,o,p)),h+=g(e.value,h,c,e.color,f)})})})}let c=e=>({width:r??i,height:n??s,data:e.toDataURL("image/png")});if(!(eV(r)&&eV(n)))return c(l.canvas);{let e=o(r,n);return e.drawImage(l.canvas,0,0,r,n),c(e.canvas)}}let g9=Symbol.for("__ias__");class ye{accessor;view;defaultTool;_activeTool;tooltipEnabled;timeline;sentInitialLoadNotification;_hostElement;undoRedoManager;title;display;model;data;panes;_hasLegend;renderTo;seriesChangedToken;metaChangedToken;streamingSubscription;_previousMask;_ohlcMask;selectedAnnotation;forceResetVisibleRange;_maxOffset;_isShutdown;notifySelectionChanged;notifyRecreated;notifyDefinitionChanged;constructor(e){this.accessor=e,this.tooltipEnabled=!0,this.sentInitialLoadNotification=!1,this._hostElement=null,this.panes=[],this.seriesChangedToken="",this.metaChangedToken="",this.streamingSubscription=null,this._previousMask=0,this.forceResetVisibleRange=!1,this._maxOffset=0,this._isShutdown=!1,this.defaultTool=gP("Default"),this._activeTool=this.defaultTool,this.timeline=new hP(this),this.undoRedoManager=new g5(this),this.title=new g6(this),this.notifySelectionChanged=eN(aa.CH_ANNSELECTIONCHANGED),this.notifyRecreated=eN(aa.CH_RECREATED),this.notifyDefinitionChanged=eN(aa.CH_DEFINITION_CHANGED)}getModel(){return this.model}get isEmpty(){return!eH(this.model)}notifyHost(e,t){eR(e,t)}async fromModel(e,t){if(this._isShutdown)return;eH(this.model)&&this.allPlots.forEach(e=>e.shutdown()),this.sentInitialLoadNotification=!1,this.clearSelection(),this.model=e;let i=eG(e);this.data=i.data,this.data.aggregation=ng(i.data.aggregation),this.display=i.display,eH(this.display.period)&&(this.display.period=eJ(this.display.period)),this.panes=i.panes.map(e=>{let t=new gG(this);return t.fromModel(e),t},this);let s=this.allPlots.map(e=>e.initialize());await Promise.all(s),this._isShutdown||(this.timeline.invalidate(),this.checkZoomAndVisibleRange(e,t),eH(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 i=!t||function(e,t,i){let s={id:"Aggregation",context:{id:"Get"}};if(ys(nm(yN(s,t,i)),nm(yN(s,e,i)))||!yt(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!yt(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 r=nY(t),n=nY(e);if(function(e,t){let i=e=>e.curves[0],s=i(e),r=i(t),n=yi.includes(s.style),a=yi.includes(r.style);if(n!==a)return!0;if(!a)return!1;if(s.style!==r.style)return!0;if(t.inputs&&ys(ej(e.inputs),ej(t.inputs)))return!0;return!1}(r,n))return!0;let a=e=>{let t=e.toLowerCase();return n.type===e&&r.type===e&&r[t]!==n[t]},o=r.type!==n.type,l=a("Forward"),u=a("Expression"),h=a("Symbol");return o||l||u||h}(e,t,this);this.view.resetZoomAndVisibleRange=i,i&&(this._maxOffset=0)}}closeView(){eH(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(eH(this.view)?this.view.reinitialize():(this.view=new g0,this.view.initialize(this)),this.notifyRecreated({elementId:this.elementId}))}getCacheableEntities(e){this.isEmpty||this.allPlots.map(t=>t.getCacheableEntities(e))}get activeTool(){return this._activeTool}set activeTool(e){eH(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,eH(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(aa.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.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)}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 i=t.series,s=e=>e.timeSeries===i||e.eventsSeries===i,r=this.allPlots.find(s);if(!eH(r))return;let n=eH(r)&&r.main,a=!1,o=!1;if(e===aa.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;a=!0}let l=eH(t.index)?i.container.getTimeData()[t.index]:null,u=e===aa.TS_EVENTSCHANGED,h=this.view.xAxis,c=h.xScale;if(e===aa.TS_MANYCHANGED||u){if(n&&this.data.checkRange)if(eH(this.display.xAxis.visibleRange)){let e={id:"Period",context:{range:this.display.xAxis.visibleRange}};e[g9]=!0,this.accessor.change(e);return}else delete this.data.checkRange;r.isForward&&this.fixupDensityForForwards();let e=this.view.xAxis?.getMaxCurveOffset()??0;if(r.isStudy&&(e!==this._maxOffset&&(this._maxOffset=e,h.goToLatest(!0)),r.invalidateAssociatedAnnotations("NewChunkArrived")),(r.isSeasonal&&!h.wasVisibleRangeChanged||this.display?.xAxis?.isOrdinal)&&h.goToLatest(!0),t.part===er.Tail){let e=e_(this.timeline,l,Number,hb);h.shouldScrollIntoView(e)&&c.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach(e=>e.invalidatePriceMappingCache()),a=!0}else if(e===aa.TS_DATAPOINTADDED){let e=this.timeline.mergeDateIntoTimeline(l);-1!=e&&h.shouldScrollIntoView(e)?(c.shiftBars(1),a=!0):o=!0,r.isStudy&&r.invalidateAssociatedAnnotations("DataPointAdded")}else e===aa.TS_DATAPOINTCHANGED&&(o=!0,r.isStudy&&r.invalidateAssociatedAnnotations("DataPointChanged"));if(!u&&s(this.mainPlot)&&i.hasData&&0===i.container.size&&this.notifyHost(aa.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),a&&this.view.recalculateLayout(),o&&(a&&yj("Performance : redundant call to recompute price domains (layout recalculation took care of this)","warn"),this.allAxes.filter(e=>e.plots.includes(r)).forEach(e=>{e.setDomain(),eH(l)&&e.updateFullDomain(l)})),!this.sentInitialLoadNotification&&e===aa.TS_MANYCHANGED&&this.allPlots.every(e=>e.timeSeries&&e.timeSeries.hasData)){this.sentInitialLoadNotification=!0,this.notifyHost(aa.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),mv(this);let e=this.display.period===tG.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(c.fitAllData=!0,c.adjustDomain())}this.view.redraw()}onMetaChanged(e,t){e===aa.MD_CHANGED&&this.view&&this.allPlots&&this.allPlots.find(e=>e.id===t.plot.id)&&(this.view.recalculateLayout(),this.view.redraw())}priceDomainsUpdated(){this.allPlots.forEach(e=>{e.notifyAboutPriceDomains&&e.onPriceDomainsUpdated()})}onScaleDomainChanged(e){let t=this.panes.indexOf(e.pane),i=e.pane.axes.indexOf(e),s={chart:this.accessor,paneIndex:t,axisIndex:i};this.notifyHost(aa.CH_AXISSCALECHANGED,s)}get previousMask(){return eH(this._previousMask)||(this._previousMask=al(an.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some(e=>e.updated&&t)}get hasLegend(){return eH(this._hasLegend)||(this._hasLegend=yQ().config.mode===es[es.cmdtyView]),this._hasLegend}onStreamingUpdates(e){eH(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 eH(this._ohlcMask)||(this._ohlcMask=al(an.Open,an.High,an.Low,an.Close,an.PreviousClose)),this._ohlcMask}updateMatches(e,t){if((e&this.ohlcMask)==0)return!1;let i=(e,t)=>eV(e)&&e.isValid&&e.hasSymbol(t);return this.mainPlot.isSymbol?i(this.mainPlot.timeSeries.record,t):!!this.mainPlot.isExpression&&i(this.mainPlot.record,t)}getStreamingSubscription(){return yQ().getRecordSource().subject.pipe(up(e=>e.filter(e=>this.updateMatches(e.updated,e.data.symbol))),oh(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return eH(this._hostElement)?this._hostElement.id:null}initialize(t){if(this._hostElement=t instanceof HTMLElement?t:tw(`#${t}`),!this._hostElement)throw Error(`There is no element ${t} in the DOM`);this.renderTo=t,this.seriesChangedToken=e(ci).subscribe(aa.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=e(ci).subscribe(aa.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return e(ci).unsubscribe(this.seriesChangedToken),e(ci).unsubscribe(this.metaChangedToken),eH(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach(e=>e.shutdown()),this.model=void 0,this.closeView(),this.notifyHost(aa.CH_SHUTDOWN,{elementId:this.elementId}),this._isShutdown=!0,!0}setSelection(e){this.selectedAnnotation=e,this.selectedAnnotation.isSelected=!0,this.selectedAnnotation.requestRedraw(),this.notifySelectionChanged({chart:this.accessor})}clearSelection(){eH(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(Q.Arrow)}print(e={}){let t=tF(document.body,"iframe");t.src="",t.style.display="none",t.onload=()=>{let{title:i}=e,s=g8.call(this,{title:i}),r=new Image;r.src=s.data,r.style.width="100%",t.contentDocument.body.appendChild(r),new Promise(e=>{let t=()=>{r&&void 0!==r.naturalWidth&&0!==r.naturalWidth&&r.complete?e():setTimeout(t,150)};t()}).then(()=>{let e=t.contentWindow;t.focus(),e.print(),t.remove()})}}setTitle(e,t=!1){this.title.update(e),eH(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;let t=this.display.tooltip.mode===tG.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){let t=this.display.tooltip,i=eI();!e&&t.visible&&t.mode===tG.TOOLTIP_CARDS&&tk(".bcharts-card",this.hostElement).forEach(e=>{let t=e.classList.contains("bcharts-card-move");i&&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("List"===e.id)return this.allAnnotations.map(t);if("Cache"===e.id)return sG(this.model,"..annCache{.annotations}").map(e=>({symbol:e.symbol,annotations:e.annotations.map(e=>t(e,!1))}));if("Add"===e.id)return this.mainAxis.addAnnotation(e.annotation);let i=this.allAnnotations.find(t=>t.uid===e.uid);if(void 0!==i){let t=i.axis,s=t[`${e.id.toLowerCase()}Annotation`];if("function"==typeof s){s.call(t,i,e),"Delete"!==e.id||e.isUndoRedo||this.onAnnotationModifiedByTool(i,eo.Deleted);return}}throw Error(`Unknown sub-action ${e.id} for action ${tG.ANN_ACTION_ID}`)}getPlotInfoFromDomId(e){let t=e.attributes.getNamedItem("data-plot-id").value,i=this.allPlots,s=i.findIndex(e=>e.id===t);return{type:X[i[s].type],index:s}}getSimplePlot(e,t){return this.accessor.change({id:"Plot",context:{id:tG.ACTION_GET,type:e,index:t}})[0]}onCardClicked(e){let t=this.getPlotInfoFromDomId(e),i=this.getSimplePlot(t.type,t.index),s={chart:this.accessor,plot:i};this.notifyHost(aa.CH_CARDPLOTCLICKED,s)}deletePlotClicked(e){let t=this.getPlotInfoFromDomId(e),i=this.getSimplePlot(t.type,t.index);this.accessor.change({id:"Plot",context:{id:"Delete",type:t.type,index:t.index}});let s={chart:this.accessor,plot:i};this.notifyHost(aa.CH_CARDPLOTREMOVED,s)}showHidePlotClicked(e){this.defaultTool.hideCrosshairAndTooltips(this.view,!0);let t=this.getPlotInfoFromDomId(e),i="Show"===e.attributes.getNamedItem("data-act").value;this.accessor.change({id:"Plot",context:{id:"Update",type:t.type,index:t.index,visible:i}});let s=this.getSimplePlot(t.type,t.index),r={chart:this.accessor,plot:s,visible:i};this.notifyHost(aa.CH_CARDPLOTVISIBILITYCHANGED,r)}plotMoreActionsClicked(e,t){let i=this.getPlotInfoFromDomId(e),s=this.getSimplePlot(i.type,i.index),r={x:t.clientX,y:t.clientY},n={chart:this.accessor,plot:s,offset:r,originalEvent:t};this.notifyHost(aa.CH_PLOTNEEDSCONTEXTMENU,n)}onMovePaneClicked(e){let t=parseInt(e.attributes.getNamedItem("data-pane").value),i="Down"===e.attributes.getNamedItem("data-dir").value,s=t+ +!!i,r=t-!i;setTimeout(()=>{this.accessor.change({id:"MovePane",context:{from:s,to:r}}),this.notifyHost(aa.CH_PANESREORDERED,{chart:this.accessor})})}onAnnotationsUpdated(e,t=!1){var i,s;let r=this.allAxes.indexOf(e),n=e.annotations.map(e=>e.toModel()),a=(i=this.model,s={axisIndex:r,annotations:n},sz(i,`..axes[${s.axisIndex}]`,e=>(e.annotations=s.annotations,e)));try{this.model=n9(a,tG.CHART_SCHEMA)}catch(e){yj(`Cannot update annotation (corrupts definition), error is: ${e.message}`,"error")}t&&this.view.draw(),this.notifyHost(aa.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,i=!0){if(t!==eo.None){if(i&&t!==eo.Undo&&t!==eo.Redo){let i=f4(e,t);this.undoRedoManager.done(i)}let s=f5(e);s.toolChange=eo[t],this.notifyHost(aa.CH_ANNMODIFIEDBYTOOL,s)}}onAnnotationDone(e,t){let i={id:e,chart:this.accessor,toolChange:eo[t]};this.notifyHost(aa.CH_ANNMODIFIEDBYTOOL,i)}onPaneHeightsUpdated(){var e,t;let i,s=this.panes.map((e,t)=>({index:t,relativeHeight:e.height}));this.model=(e=this.model,t={paneHeights:s},i=e,t.paneHeights.forEach(e=>{let t;i=sz(i,(t=e.index,`..panes[${t}]`),t=>(t.height=e.relativeHeight,t))}),i),this.notifyHost(aa.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){let e=this.mainPlot.timeSeries.container;if(!eH(e)||0===e.size)return null;let t=e.getTimeData();return{dataRange:{from:eP(t).getTime(),to:eb(t).getTime()},barCount:e.size}}}function yt(e,t){return e?.from===t?.from&&e?.to===t?.to}let yi=["Renko","Range","LineBreak","Kagi","PointAndFigure"];function ys(e,t){for(let i of Object.keys(e))if(e[i]!==t[i])return!0}let yr="MARKED_FOR_DELETION";function yn(e,t){if(0===t.plots.length)return e;let i=e;return t.plots.forEach(e=>{let t=yl(e.index),s=yu(i,t);eH(s)&&s.type===e.type&&(i=sz(i,t,e=>(e[yr]=!0,e)))}),ae(i=sz(i,`..plots{.${yr} === true}`,e=>tG.NULL_OBJECT))}function ya(e,{main:t,type:i,index:s},r){let n="..plots{.main === true}",a=sG(e,"..panes").map((e,t)=>{let i=1===sG(e,n).length;return sG(e,"..axes").map((e,s)=>{let a=1===sG(e,n).length;return sG(e,"..plots").map(e=>{let n=function(e,t,i,s){let r=X[e.type],n={curves:eG(e.curves),type:e.type};n.precision=e.precision,n.visible=e.visible;let a=(e,t)=>{eH(e[t])?n[t]=e[t].map(e=>eG(e)):n[t]=[]},o=(e,t,i=!1)=>{!0===t.main&&(e.main=!0,e.showPrevious=t.showPrevious,i&&null!=t.events&&(e.events=eG(t.events)))},l=e=>{eH(s)&&(e.subtitles=s.allPlots.filter(e=>e.type===r).map(e=>e.title))};switch(r){case X.Symbol:{n.title=e.symbol;let t=n.curves[0].style,i=t=>{a(e,"inputs"),0===n.inputs.length&&(n.inputs=eG(t))};switch(t){case"Renko":i(tG.DEFAULT_RENKO_INPUTS);break;case"Kagi":i(tG.DEFAULT_KAGI_INPUTS);break;case"PointAndFigure":i(tG.DEFAULT_PNF_INPUTS);break;case"LineBreak":i(tG.DEFAULT_LINEBREAK_INPUTS);break;case"Baseline":i(tG.DEFAULT_BASELINE_INPUTS)}o(n,e,!0);break}case X.Study:{a(e,"inputs");let s=sw(e.study),r=n.inputs,o="AVWAP"===e.study,l=0===r.length?"":` (${r.map(e=>o&&"Anchor"===e.name?new Date(e.value).toLocaleString():e.value).join(", ")})`,u=n.curves.map(e=>Number(e.shift)).filter(e=>e>0),h=0===u.length?"":` [${u.join(", ")}]`;n.title=`${s.id}${l}${h}`,n.studyId=s.id,a(e,"levels"),a(e,"bands"),n.placement=t?i?"overlay":"withMain":"standalone",n.detachedScale=e.detachedScale;break}case X.BalanceSheet:case X.IncomeStatement:{let t=an[e.curves[0].fields[0]];n.title=`${t.name} (${e.fundamental.substring(0,1)})`,n.fundamentalId=t.id,n.frequency=e.fundamental;break}case X.Expression:n.title=e.expression,o(n,e);break;case X.Forward:n.title=e.forward,a(e,"offsets"),l(n),o(n,e);break;case X.Seasonal:n.title=e.seasonal,l(n),a(e,"offsets"),a(e,"usesInAverage"),o(n,e);break;default:throw Error("Unexpected plot type")}return n}(e,i,a,r);return n.paneIndex=t,n.axisIndex=s,n})})}).flat(2).map((e,t)=>(e.index=t,e));if(t)return a.filter(e=>e.main);if(!eH(i))return a;{let e=a.filter(e=>e.type===i);return eH(s)?e.filter(e=>e.index===s):e}}function yo(e,t){"Study"===e.type&&t.curves?.forEach(e=>delete e.varyColorPerBar),function(e){let t=X[e.type];return t===X.Forward||t===X.Seasonal}(e)?eH(t.curves)&&(e.curves=t.curves):function(e,t){if(void 0!==t&&t.length===e.length)for(let i=0;i<e.length;++i){let s=t[i],r=e[i];for(let e of(ez(r,s),["shift","dashStyle","lineSmoothing","lineMarker"])){let t=s[e];eH(t)&&(r[e]=t)}}}(e.curves,t.curves);let i=X[t.type];eH(t.precision)?e.precision=t.precision:delete e.precision,i===X.Symbol?e.symbol=t.symbol:i===X.Study?(function(e,t,i){let s=ej(e),r=ej(t);ez(s,r);let n=Object.keys(r).map(e=>({name:e,value:r[e]}));n.length>0&&(i.inputs=n)}(e.inputs,t.inputs,e),["bands","levels","detachedScale"].forEach(i=>{t[i]&&(e[i]=t[i])})):(i===X.BalanceSheet||i===X.IncomeStatement)&&t.frequency?e.fundamental=t.frequency:i===X.Expression?eH(t.expression)&&(e.expression=t.expression):i===X.Forward?(eH(t.offsets)&&(e.offsets=t.offsets),eH(t.forward)&&(e.forward=t.forward)):i===X.Seasonal&&(eH(t.offsets)&&(e.offsets=t.offsets),eH(t.usesInAverage)&&(e.usesInAverage=t.usesInAverage),eH(t.seasonal)&&(e.seasonal=t.seasonal))}let yl=e=>`..plots[${e}]`;function yu(e,t){let i=sG(e,t);return 1!==i.length?null:i[0]}let yh=["withMain","overlay","standalone","clone"];function yc(){return{plots:[]}}function yd(e){let t=e.display.chart.newPaneHeight??1;return{axes:[yc()],height:t}}function yp(e){let t=yd(e);return e.panes.push(t),t}function yf(e,t){let i=eV(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:yp(e),s=i.axes[0];return t.oppositeScale?yC(i,s):s}function ym(e,t,i){let s=null,{mainPane:r,mainAxis:n}=nj(e);switch(t){case"withMain":s=yC(r,n);break;case"overlay":s=n;break;case"standalone":s=yp(e).axes[0];break;case"clone":if("number"==typeof i){let t={main:!1,index:i,type:X[X.Study]},r=ya(e,t).find(e=>e.index===t.index);s=sG(e,`..panes[${r.paneIndex}]..axes[${r.axisIndex}]`)[0]}}return s}let yg=[{fields:[an.Close.id],colors:["#888"],style:"Line",lineWidth:2,varyColorPerBar:!1,visible:!0}];function yy(e){return"Symbol"===e.type}let yT={attributes:["OpenVsClose"],colors:["#b63400","#007f3e","#1664db"],fields:["Open","High","Low","Close","Change"],style:"Candlestick",varyColorPerBar:!0,lineWidth:1},yA=0,yS=["#0d223a","#8abc21","#910000","#2f7ed8","#42ccdc","#bf95df","#860262","#e5daa3","#4682e8","#aaa9c1","#fcccdc","#f66b00","#d875be","#e84b46"],yv="Symbol";function yb(e,t){let i={curves:[{attributes:[],colors:yS.slice(yA,yA+1),fields:e?[an.Last.id]:[an.Close.id],style:"Line",dashStyle:"Solid",varyColorPerBar:!1,lineWidth:2,lineMarker:void 0,lineSmoothing:void 0}]};return delete t.oppositeScale,eY(i,t),eH(t.curves)&&ez(i.curves,t.curves),yA=(yA+1)%yS.length,i}let yP='..plots{(.type === "Symbol" || .type === "Expression") && .main !== true}';function yC(e,t){let i=e.axes.find(e=>e!==t);return eH(i)||(i=yc(),e.axes.push(i)),i}let yE=()=>tG.NULL_OBJECT;function y_(e){return sz(e,"..axes.annotations",yE)}function yM(e){return ae(sz(e,'..plots{.type === "Symbol" && .main !== true}',yE))}let yL=".display.chart.previous";function yx(e,t,i){let s=[],r=i.allPlots[t.index];if(r?.type!==X[t.type])return s;let n=i.panes.indexOf(r.axis.pane),a=n===i.panes.length-1,o=1===i.panes[n].axes.reduce((e,t)=>e+t.plots.length,0);return 0!==n&&s.push("ExistingAbove"),o||s.push("NewAbove"),a||s.push("ExistingBelow"),o||s.push("NewBelow"),s}function yO(e,t,i){let s=[],r=i.allPlots[t.index];if(r?.type!==X[t.type])return s;let n=r.axis.pane,a=r.axis===n.axes[0],o=n.axes.some(e=>e.plots.some(e=>r!==e&&!e.hasDetachedScale)),l=r.hasDetachedScale;return(a||l)&&s.push("SecondaryAxis"),(!a||l)&&s.push("PrimaryAxis"),o&&s.push("NoAxis"),s}function yI(e,t){let i=e.panes[t],s=i.axes.map(e=>e.plots.reduce((e,t)=>e+ +!!t.detachedScale,0)),r=i.axes.length;return i.axes.forEach((e,t)=>{let n=s[t],a=e.plots.length;if(0!==n&&!(n<a)&&n===a)if(r>1&&1===n){let n=(t+1)%r;if(s[n]<i.axes[n].plots.length){let t=e.plots.find(e=>e.detachedScale);t&&(i.axes[n].plots.push(t),e.plots=e.plots.filter(e=>!e.detachedScale),s[n]++)}}else{let t=e.plots.find(e=>e.detachedScale);t&&(t.detachedScale=!1)}}),e}function yD(e,t){let i=e.allPlots[t],s=e.panes.indexOf(i.axis.pane),r=e.panes[s].axes.indexOf(i.axis),n=e.panes[s].axes[r].plots.findIndex(e=>e===i);return{pane:s,axis:r,plot:n}}let yw={MainPlot:n0,Aggregation:{Update:n3,Get:function(e,t,i){return eG(e.data.aggregation)}},Period:{Update:function(e,t,i){let s=eH(t.period),r=eH(t.range),n=eH(t.density);if(+!!s+ +!!r+ +!!n>1)throw Error("Cannot set more than one of: period, range, density.");if(s&&(e.display.period=t.period,nC(e),n_(e)),r)if((!eH(e.display.period)||n6(e.display.period))&&(e.display.xAxis.visibleRange=t.range),nE(e),n_(e),eH(i)){let s=function(e){let t=e.getDataStats();return null===t?null:t.dataRange}(i),r=ng(e.data.aggregation),n=i.data.aggregation,a=r.unit!==n.unit||r.size!==n.size||r.spec!==n.spec||!eH(s)||e.data.checkRange,o=a;if(!a){let{from:e,to:i}=s,{from:r,to:n}=t.range;o=r<e||r>i||n<e||n>i}o&&(e.data.range=t.range),delete e.data.checkRange}else e.data.checkRange=!0;return n&&(e.display.density=t.density,nC(e),nE(e)),(s||r||n)&&(nP(e),i&&(i.forceResetVisibleRange=!0)),e},Delete:function(e,t,i){return eH(t.period)&&t.period&&(delete e.display.period,n1(e),i&&(i.forceResetVisibleRange=!0)),e}},Crosshair:{Update:function(e,t){let[i,s]=eB(t.crosshair),{color:r,dashStyle:n}=t.horizontal||{},{color:a,dashStyle:o}=t.vertical||{},l=(e,t,i)=>{t&&(e.color=t),i&&(e.dashStyle=i)},u=sz(e,".display.xAxis.crosshair",e=>(e.enabled=i,l(e,a,o),e));return u=sz(u,".display.yAxis.crosshair",e=>(e.enabled=s,l(e,r,n),e)),eH(t.haloTracking)&&"boolean"==typeof t.haloTracking&&(u=sz(u,".display.chart",e=>(e.plotHover=t.haloTracking,e))),u},Get:function(e,t,i){let s=t=>sG(e,t)[0],r=s(".display.chart"),n=s(".display.xAxis.crosshair"),a=s(".display.yAxis.crosshair"),o="none";return n.enabled&&a.enabled?o="both":n.enabled?o="vertical":a.enabled&&(o="horizontal"),{crosshair:o,horizontal:{color:a.color,dashStyle:a.dashStyle},vertical:{color:n.color,dashStyle:n.dashStyle},haloTracking:r.plotHover}}},Tooltip:{Update:function(e,t){return sz(e,".display.tooltip",e=>(null!=t.visible&&(e.visible=t.visible),t.mode&&(e.mode=t.mode),null!=t.showMainTitle&&(e.showMainTitle=t.showMainTitle),t.mainTitle&&(e.mainTitle=t.mainTitle),e))},Get:function(e,t,i){let s=sG(e,".display.tooltip")[0];return{visible:s.visible,mode:s.mode,showMainTitle:s.showMainTitle,mainTitle:s.mainTitle}}},Events:function(e,t){let i=eG(t);return Object.keys(t).forEach(e=>{tG.EVENTS.includes(e)||delete i[e];let s=t[e];"boolean"==typeof s?s={show:t[e]}:Object.keys(s).forEach(e=>{tG.EVENT_PROPERTIES.includes(e)||delete s[e]}),i[e]=s}),sz(e,nz,e=>("Symbol"===e.type&&(e.events=e.events||{},Object.keys(i).forEach(t=>{e.events[t]=e.events[t]||{},ez(e.events[t],i[t],!1)})),e))},Scale:{Update:function(e,t){let i=sz(e,"..panes[0]..axes",e=>(eV(t.scale)&&(e.scale=t.scale),e));return i=sz(i,".display.xAxis",e=>(eV(t.marginBars)&&(e.marginBars=t.marginBars),eV(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),eV(t.ordinalName)&&(e.ordinalName=t.ordinalName),eV(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e)),i=sz(i,".display.yAxis",e=>{(eH(t.minPadding)||eH(t.maxPadding))&&yj("The 'minPadding' and 'maxPadding' are deprecated (ignored)","warn");let i=eV(t.preventLabelOverlap)&&!eV(t.preventVerticalLabelOverlap);i&&yj("The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'","warn");let s=i?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return eV(s)&&(e.preventLabelOverlap=s),eH(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),eH(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),e}),eH(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach(e=>{let{axis:t,text:s,index:r,paneIndex:n}=e;eH(t,s,r)&&"vertical"===t&&Number.isInteger(r)&&(i=sz(i,`..panes[${n??0}]..axes[${r}]`,e=>eH(e)?(e.label=s,e):tG.NULL_OBJECT))}),eV(t.contractTransition)&&(i=sz(i,".display.xAxis",e=>(ez(e.contractTransition,t.contractTransition),e))),eV(t.cycleTransition)&&(i=sz(i,".display.xAxis",e=>(ez(e.cycleTransition,t.cycleTransition),e))),i},Get:function(e,t,i){let{mainAxis:s}=nj(e),r=sG(e,".display.xAxis")[0],n=sG(e,".display.yAxis")[0];return{scale:s.scale,marginBars:r.marginBars??0,preventLabelOverlap:n.preventLabelOverlap,preventVerticalLabelOverlap:n.preventLabelOverlap,preventHorizontalLabelOverlap:r.preventLabelOverlap,snapAnnotationsToPrices:n.snapAnnotationsToPrices,nonEodLabelWithDate:r.nonEodLabelWithDate??!1,includePercentChangeWithLastValue:n.includePercentChangeWithLastValue??!1,ordinalName:r.ordinalName??"",contractTransition:r.contractTransition,cycleTransition:r.cycleTransition}}},Other:{Update:function(e,t,i){let s=e;if(eH(t.comparisonMode)&&"string"==typeof t.comparisonMode&&eW(K,t.comparisonMode)&&(s=sz(s,`..panes{${nz}}.axes`,e=>(e.comparison=t.comparisonMode,e))),eH(t.gridLines)){let[e,i]=eB(t.gridLines);s=sz(s,".display.xAxis.gridLines",t=>(t.visible=e,t)),s=sz(s,".display.yAxis.gridLines",e=>(e.visible=i,e))}if(eH(t.minorGridLines)){let[,e]=eB(t.minorGridLines);s=sz(s,".display.yAxis.minorGridLines",t=>(t.visible=e,t))}eH(t.newPaneHeight)&&"number"==typeof t.newPaneHeight&&(s=sz(s,".display.chart{.newPaneHeight > 0}",e=>(e.newPaneHeight=t.newPaneHeight,e))),eH(t.showNavigator)&&"boolean"==typeof t.showNavigator&&(s=sz(s,".display.scrollbar",e=>(e.visible=t.showNavigator,e))),eH(t.plotHover)&&"boolean"==typeof t.plotHover&&(s=sz(s,".display.chart",e=>(e.plotHover=t.plotHover,e))),eH(t.showLastValue)&&"string"==typeof t.showLastValue&&(s=sz(s,".display.yAxis",e=>(e.showLastValue=t.showLastValue,e))),eH(t.showMinMaxArc)&&"boolean"==typeof t.showMinMaxArc&&(s=sz(s,".display.chart",e=>(e.showMinMaxArc=t.showMinMaxArc,e))),eH(t.showGoToLatest)&&"boolean"==typeof t.showGoToLatest&&(s=sz(s,".display.chart",e=>(e.showGoToLatest=t.showGoToLatest,e))),eH(t.showLegend)&&"boolean"==typeof t.showLegend&&(s=sz(s,".display.chart",e=>(e.showLegend=t.showLegend,e)),t.showLegend||i.view.removeLegend()),eH(t.allAnnotationsLocked)&&"boolean"==typeof t.allAnnotationsLocked&&(s=sz(s,".display",e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e))),eH(t.exprSkipLeadingEmpty)&&"boolean"==typeof t.exprSkipLeadingEmpty&&(s=sz(s,".data",e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e)));let r=[];if(eH(t.extendedHours)&&"boolean"==typeof t.extendedHours&&(s=sz(s,".data",e=>(e.extendedHours=t.extendedHours,e))),eH(t.realTimeCboeBzx)&&"boolean"==typeof t.realTimeCboeBzx&&(s=sz(s,".data",e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&r.push("realTimeCboeBzx"),e.realTimeCboeBzx=t.realTimeCboeBzx,e))),eH(t.buildContinuation)&&"boolean"==typeof t.buildContinuation&&(s=sz(s,".data",e=>(e.buildContinuation=t.buildContinuation,e))),r.length>0){let e={chart:i.accessor,hostPropsChanged:r};i.notifyHost(aa.CH_HOST_PROPS_CHANGED,e)}return s},Get:function(e,t,i){let s=sG(e,`..panes{${nz}}.axes.comparison`)[0],r=e.display,n=(e,t)=>e$(e,!1,t,"visible"),a=e=>(function(e,t){let i=e=>eH(e)&&"boolean"==typeof e&&e,s=i(e),r=i(t);return s&&r?"both":s?"vertical":r?"horizontal":"none"})(n(r.xAxis,e),n(r.yAxis,e)),o=e$(r.chart,!0,"showLegend");return{comparison:s,gridLines:a("gridLines"),minorGridLines:a("minorGridLines"),newPaneHeight:r.chart.newPaneHeight,showLastValue:r.yAxis.showLastValue,showLegend:o,showMinMaxArc:r.chart.showMinMaxArc,allAnnotationsLocked:r.allAnnotationsLocked,exprSkipLeadingEmpty:e.data?.exprSkipLeadingEmpty??!1,extendedHours:e.data?.extendedHours??!1,realTimeCboeBzx:e.data?.realTimeCboeBzx??!1,buildContinuation:e.data?.buildContinuation??!1}}},Plot:{Add:function(e,t){switch(t.type){case"Study":return function(e,t){let i=sw(t.studyId);if(!eV(i))return yj(`Unknown or unavailable study with the id '${t.studyId}'`,"error"),e;let s=nY(e),r=sH(i);if(s.type===X[X.Expression]&&r)return yj(`Cannot add study "${i.meta.title}" because it cannot be based on an expression (current main plot); study needs more than "OHLCV" fields to be calculated.`,"error"),e;let n=t.placement||(i.meta.overlay?"overlay":"standalone"),a={type:"Study",study:t.studyId,visible:!0};"overlay"===n&&"VOL"===t.studyId&&(a.detachedScale=!0),void 0!==t.curves&&(a.curves=i.defaults.curves),yo(a,t);let o=ym(e,n,t.cloneIndex);eH(o)&&o.plots.push(a);let l=e.data.aggregation;return n2(e,"Tick"===l.unit&&"None"===l.spec)}(e,t);case"IncomeStatement":case"BalanceSheet":return function(e,t){let i=nY(e);if(i.type!==X[X.Symbol])throw Error("Cannot add fundamental to the chart whose main plot is not a Symbol plot.");let s=i.symbol,r={curves:[{fields:[t.fundamentalId],lineWidth:2,style:"Line",varyColorPerBar:!1,visible:!0,colors:["#888"]}],fundamental:"Quarter",symbol:s,type:j[an[t.fundamentalId].category],visible:!0};return yo(r,t),e.panes.push({axes:[{plots:[r]}]}),e}(e,t);case"Expression":let i=nY(e),s={curves:eG(yy(i)?i.curves:yg),expression:"",type:"Expression",visible:!0};return yo(s,t),yf(e,t).plots.push(s),e;case"Symbol":return function(e,t){let i=nY(e),s=yQ().getDefaultMultiFieldCurve(),r=eH(s)?s:yT,n=i.curves?.length,a={curves:n===t.curves.length&&1===n?eG(yy(i)?i.curves:[r]):t.curves,symbol:"",type:"Symbol",visible:!0};return yo(a,t),yf(e,t).plots.push(a),e}(e,t);default:throw Error("Unexpected plot type '${type}', not supported currently")}},Get:ya,Delete:yn,Update:function(e,t,i){if(eH(t.placement)&&!yh.includes(t.placement))throw Error(`Unknown placement: ${t.placement}`);let s=t.main?nz:yl(t.index),r=yu(e,s);if(!eV(r)||eV(t.type)&&r.type!==t.type)return e;if(eV(t.visible))return r.visible=t.visible,e;if(r.main&&function(e){let t=X[e.type];return t===X.Symbol||t===X.Expression}(r)){if(t.curves){let i=e=>e.curves[0].style===W[W.Range],[s,n]=[i(r),i(t)];s&&!n?e=n3(e,{unit:"Day",size:1,spec:"None"}):!s&&n&&(e=n3(e,{unit:"Intraday",size:100,spec:"PerRange"}))}return t.type||(t.type=r.type),eH(t.precision)?r.precision=t.precision:delete r.precision,eH(t.showPrevious)&&(e=sz(e,nz,e=>(e.showPrevious=t.showPrevious,e))),t.curves?nO(e,t):e}{let r=sz(e,s,e=>(yo(e,t),e)),n=ya(r,t,i).find(e=>e.index===t.index);if(!eH(n))return e;if(!(t.type===X[X.Study]&&eH(t.placement)&&t.placement!==n.placement))return r;let a=yu(r,s),o=ym(r=yn(r,{id:"Delete",plots:[{index:t.index,type:t.type}]}),t.placement);return null!==o&&o.plots.push(a),r}}},Compare:{Update:function(e,t){let{yes:i,no:s}=eT((eH(t.symbols)&&(yj("Use of 'symbols' for Compare API is deprecated. Please see docs for the latest version which supports more plot types","warn"),t.plots=t.symbols.map(e=>(e.type=yv,e))),t.plots?.some(e=>eH(e.leftScale)))?(yj("Use of 'leftScale' for Compare API is deprecated. Please use 'oppositeScale'","warn"),t.plots.map(e=>{let t=e.leftScale;return delete e.leftScale,{...e,oppositeScale:t}})):t.plots,e=>e.oppositeScale??!1),{mainPane:r,mainAxis:n}=nj(e);r.alignOnExpirations=t.alignOnExpirations||!1;let a=yC(r,n),o=e=>![yv,"Expression"].includes(e.type);a.plots=a.plots.filter(o);let l=n.plots.filter(e=>e.main||o(e)),u="Tick"===e.data.aggregation.unit;yA=0;let h=eu(yb,u);return n.plots=l.concat(s.map(h)),i.length>0&&(a.plots.push(...i.map(h)),a.comparison=n.comparison,a.scale=n.scale),ae(e)},Get:function(e,t){let i=sG(e,yP),{mainPane:s,mainAxis:r}=nj(e),n=[];for(let e of i){let t=r.plots.includes(e),i=e.type.toLowerCase(),s={curves:eG(e.curves),type:e.type,[i]:e[i],leftScale:!t};n.push(s)}return{plots:n,alignOnExpirations:s.alignOnExpirations}}},Annotation:{Get:function(e,t,i){let s=sG(e,"..panes").map((e,t)=>sG(e,"..axes").map((e,i)=>sG(e,".annotations").map(e=>({...e,paneIndex:t,axisIndex:i})))).flat(2).map((e,t)=>({...e,index:t}));return eH(t.index)&&Number.isFinite(t.index)?t.index<s.length?[s[t.index]]:tG.EMPTY_ARRAY:s}},MovePane:function(e,t){let i=e.panes;return i.splice(t.to,0,i.splice(t.from,1)[0]),e},Template:function(e,t){let i=eG(e);if(t.strip.main){let e=nY(i),t=e.type.toLowerCase();e[t]=tG.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(i=y_(i)),t.strip.compare&&(i=yM(i)),i=sz(i,".data",e=>(e.range&&(delete e.range,e.checkRange=!0),e))},Outline:function(e,t,i){let s=ya(e,{main:!0},i)[0],r=s.title===tG.PLACEHOLDER_SYMBOL_NAME,n="Symbol"===s.type,a="Expression"===s.type,o=nH(s.title),l=[];return a&&!nV(o)?l=o.symbols:r||(l=[s.title]),{isTemplate:r,isDefinition:!r,main:{isSymbol:n,isExpression:a,symbols:l,title:r?null:s.title},compare:sG(e,yP).map(e=>e.symbol),annotations:sG(e,"..annotations").map(e=>e.id),studies:ya(e,{type:"Study"},i).map(e=>e.title)}},Theme:{Update:function(e,t){let i=e,{backgroundColor:s,axis:{gridLinesColor:r,textColor:n,crosshairColor:a,gridLinesStyle:o},fontSize:l}=t,{chart:u,xAxis:h,yAxis:c}=l||{};if((s||u)&&(i=sz(e,".display.chart",e=>(s&&(e.backgroundColor=s),u&&(e.fontSize=u),e))),r){let e=e=>(e.color=r,e);i=sz(i,".display.xAxis.gridLines",e),i=sz(i,".display.yAxis.gridLines",e),i=sz(i,".display.yAxis.minorGridLines",e)}if(o){let e=e=>(e.dashStyle=o,e);i=sz(i,".display.xAxis.gridLines",e),i=sz(i,".display.yAxis.gridLines",e),i=sz(i,".display.yAxis.minorGridLines",e)}if(n){let e=e=>(e.textColor=n,e);i=sz(i,".display.xAxis",e),i=sz(i,".display.yAxis",e)}if(a){let e=e=>(e.color=a,e);i=sz(i,".display.xAxis.crosshair",e),i=sz(i,".display.yAxis.crosshair",e)}if(h||c){let e=e=>t=>(t.fontSize=e,t);h&&(i=sz(i,".display.xAxis",e(h))),c&&(i=sz(i,".display.yAxis",e(c)))}return i},Get:function(e,t,i){let{chart:s,xAxis:r,yAxis:n}=e.display||{},{fontSize:a,backgroundColor:o}=s||{},{fontSize:l,gridLines:u,textColor:h,crosshair:c}=r||{},{color:d,dashStyle:p}=u||{},{fontSize:f}=n||{},{color:m}=c||{};return{backgroundColor:o,axis:{gridLinesColor:d,textColor:h,crosshairColor:m,gridLinesStyle:p},fontSize:{chart:a,xAxis:l,yAxis:f}}}},Clear:function(e,t,i){let{paneIndex:s,annotations:r,studies:n}=t||{},a=Number.isInteger(s)?`[${s}]`:"",o=`..panes${a}`,l=e,u=e=>tG.NULL_OBJECT;return!0===r&&(i.allAnnotations.forEach(e=>i.onAnnotationModifiedByTool(e,eo.Deleted,!1)),l=sz(l,`${o}..annotations`,u)),!0===n&&(l=sz(l,`${o}..plots{.type=="Study"}`,u)),l=ae(l)},Previous:{Update:function(e,t,i){return sz(e,yL,e=>(ez(e,t),e))},Get:function(e,t,i){return sG(e,yL)[0]}},MovePlot:{Update:function(e,t,i){if(!yx(e,t,i).includes(t.targetPane))return e;let s=yD(i,t.index),r=yu(e,yl(t.index));e.panes[s.pane].axes[s.axis].plots.splice(s.plot,1);let n=s.pane,a=!0;switch(t.targetPane){case"ExistingAbove":n--;break;case"NewAbove":e.panes.splice(n,0,yd(e)),a=!1;break;case"ExistingBelow":n++;break;case"NewBelow":n++,a=!1,e.panes.splice(n,0,yd(e))}a&&i.panes[n].isMain&&r?.type==="Study"&&"VOL"===r.study&&(r.detachedScale=!0);let o=e.panes[n];o.axes.length<2&&o.axes[0].plots.length>0&&o.axes.push(yc());let l=o.axes.findIndex(e=>0===e.plots.length),u=-1===l?o.axes.length-1:l;o.axes[u].plots.push(r);let h=yI(e,s.pane);return ae(h=yI(h,n))},Get:yx},PinPlot:{Update:function(e,t,i){if(!yO(e,t,i).includes(t.targetAxis))return e;let s=yD(i,t.index),r=e.panes[s.pane],n=yu(e,yl(t.index)),a=-1;switch(t.targetAxis){case"PrimaryAxis":a=0;break;case"SecondaryAxis":a=1;break;case"NoAxis":n.detachedScale=!0}if(-1!==a)if(a!==s.axis)delete n.detachedScale,r.axes.length<2&&a>0&&r.axes.push(yc()),r.axes[a].plots.push(n),r.axes[+(0===a)].plots.splice(s.plot,1);else{let e=r.axes[s.axis].plots[s.plot];delete e.detachedScale}return ae(yI(e,s.pane))},Get:yO}};function yR(e){return"function"==typeof e}function yN(e,t,i){return(function(e,t){let i=yw[e];if(yR(i))return i;{let e=void 0!==t?i[t]:void 0;if(!yR(e)&&!yR(e=i[tG.DEFAULT_ACCESSOR_SUBACTION]))throw Error("Invalid accesor id and/or sub id");return e}})(e.id,e.context.id)(t,e.context,i)}function yV(e){return{id:"MainPlot",context:e}}let yH={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},yF=Symbol.for("__ias__");class yk{headless;presenter;_model;constructor(e=!1){this.headless=e,this.presenter=e?null:new ye(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)return void console.error("You cannot initialize a headless chart.");if(this.presenter.initialize(e),eV(t)){let e="string"==typeof t;e?yj("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 i=e?{symbol:t}:t;this.change(yV(i))}}shutdown(){if(!this.headless){let e=this.presenter?.shutdown();return this.presenter=null,e}return!1}annotate(e,t=null,i=null){if(!this.headless)if(eH(e)){s8(e,t),s7(e,t);let s=gP(e,!1,t,i,this.presenter);s.isDrawingAnnotation&&this.presenter.view.setCursor(Q.Crosshair),this.presenter.activeTool=s,eI()||this.presenter.view.mouseCanvas.focus({preventScroll:!0})}else this.presenter.resetActiveTool()}cancelAnnotation(){this.headless||this.presenter.resetActiveTool()}zoom(e){this.headless||"boolean"!=typeof e||(e?this.annotate("ZoomIn"):this.presenter.defaultTool.resetView(this.presenter))}getDefaultTemplate(){return y0()}get model(){return(this.headless?this._model:this.presenter.getModel())||y0()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:tG.ACTION_TEMPLATE,context:{strip:e}})}change(...e){let t={chart:this,actions:e.filter(e=>!e[yF])};t.actions.length>0&&this.presenter?.notifyHost(aa.CH_API_ACTIONS_RECEIVED,t);let i=yQ().config.validateInput,s=e.map(e=>i?n9(e,tG.ACCESSOR_SCHEMA):e);if(1===s.length){let e=s[0];if(e.id===tG.ACTION_TEMPLATE||e.context.id===tG.ACTION_GET)return yN(e,this.model,this.presenter);if(!this.headless&&e.id===tG.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}let{yes:r,no:n}=eT(s,e=>e.id===tG.ACTION_PLOT&&eH(e.context)&&e.context.id===tG.ACTION_DELETE),a=eG(this.model),o=eG(this.model);r.length>0&&n.push({id:tG.ACTION_PLOT,context:{id:tG.ACTION_DELETE,plots:r.map(e=>e.context)}}),n.forEach(e=>{if(!eH(o=yN(e,o,this.presenter)))throw Error("Forgot to return model from accessor")}),this.fromModel(o,a)}async fromModel(e,t){let i=n9(e,tG.CHART_SCHEMA);this.headless?this._model=i:await this.presenter?.fromModel(i,t)}async load(e,t){let i={...yH,...t},s=n9(JSON.parse(e),tG.CHART_SCHEMA),r=this.model,n=eG(r);if(eH(r)){if(s=function(e,t,i){let s=nY(t),r=s.type.toLowerCase();if(s[r]===tG.PLACEHOLDER_SYMBOL_NAME){let s=nY(e),{mainAxis:r}=nj(t),n=r.annotations,a=n0(t,s);if(i){let{mainAxis:e}=nj(a);e.annotations=n}return a}return t}(r,s,i.keepNewAnnotations),i.keepNewAnnotations||(s=y_(s)),i.keepOldAnnotations&&(s=function(e,t){let{mainAxis:i}=nj(e),{mainAxis:s}=nj(t);g2(i,s);let r=e=>sG(e,'..plots{.type==="Study"}.study')[0],n=sG(e,g3).filter(e=>e!==i),a=sG(t,g3).filter(e=>e!==s);return n.forEach(e=>{let t=r(e),i=a.find(e=>t===r(e));eH(i)&&g2(e,i)}),t}(r,s)),i.keepNewCompare||(s=yM(s)),i.keepOldCompare&&(s=function(e,t){let i=sG(e,yP),s=sG(t,yP),r=Math.max(0,4-s.length);if(0===r)return t;let n=i.filter(e=>!s.find(t=>e.symbol===t.symbol)).slice(0,r);if(0===n.length)return t;let{mainPane:a,mainAxis:o}=nj(t),{mainAxis:l}=nj(e);return n.forEach(e=>{l.plots.includes(e)?o.plots.push(e):yC(a,o).plots.push(e)}),t}(r,s)),i.keepOldAggregation){let e={id:tG.ACTION_AGGREGATION,context:r.data.aggregation},t=s.display.density;s=yN(e,s,this.presenter),i.keepNewBarWidth&&eH(t)&&(s.display.density=t)}await this.fromModel(s,n),this.clearUndoRedo()}}save(){return JSON.stringify(this.model)}clearUndoRedo(){this.headless||this.presenter.undoRedoManager.clear(!0)}reset(e=!0){let t=y0();if(this.headless)this._model=t;else if(this.presenter.getModel()){let i=this.presenter.mainPlot,s=null;if(i.isSymbol?s={symbol:i.symbol}:i.isExpression?s={expression:i.expression}:i.isForward?s={forward:i.forward}:i.isSeasonal&&(s={seasonal:i.seasonal}),eH(s)){let i=yN({id:"Theme",context:{id:"Get"}},this.model,this.presenter),r=yN(yV(s),t,this.presenter);e&&(r=yN({id:"Theme",context:i},r,this.presenter)),this.presenter?.fromModel(r)}}this.clearUndoRedo(),this.presenter?.notifyHost(aa.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){yj("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:g7.call(this.presenter,e)}exportImage(e={}){return this.headless?null:g8.call(this.presenter,e)}getDataStats(){return this.presenter.getDataStats()}get canUndo(){return!this.headless&&this.presenter.undoRedoManager.canUndo}get canRedo(){return!this.headless&&this.presenter.undoRedoManager.canRedo}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,i=0){let s=this.presenter;if(this.headless||t<0||i<0||t>s.panes.length)return null;let r=s.panes[t];return i>r.axes.length?null:r.axes[i].toY(e)}yToPrices(e){let t=this.presenter;if(this.headless)return null;for(let[i,s]of t.panes.entries()){let t=s.getBounds();if(eH(t)&&e>=t.y&&e<=t.y+t.height)return{pane:i,prices:s.axes.map(t=>t.toPrice(e))}}return{pane:-1,prices:[]}}activate(){this.presenter?.notifyHost(aa.CH_DIDBECOMEACTIVE,{chart:this})}}var ci=R("c15IW");function yB(e,t,i,s,r){void 0===s&&(s=0),void 0===r&&(r=!1);var n=t.schedule(function(){i(),r?e.add(this.schedule(null,s)):this.unsubscribe()},s);if(e.add(n),!r)return n}function yU(e,t){return e+Math.random()*(t-e)}let yW=Function(atob("Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg")),y$=Function("f",atob("Zi5yZW1vdmVBbGxDaGFydHMoKTsg")),yG=Function("m",atob("cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiOw=="));async function yz(e,t){if(t&&!yG(e.mode))return;let i=!1,s=0,r=25;for(;!i&&s<5;){let t=function(){let e=globalThis.parent?.location?.hostname||"";return["","localhost","127.0.0.1"].includes(e)||function(e){let t=e.split(".");if(!t||4!==t.length)return!1;let i=t.map(Number);if(!i.every(e=>Number.isFinite(e)&&e>=0&&e<=255))return!1;let[s,r]=i;return 10===s||172===s&&r>=16&&r<=31||192===s&&168===r}(e)}()||"FreeWidget"===e.mode,n=t?e.apiKey:"";try{let r=t?"":function(){let e=document.domain,t=e.split("."),i="__tld"+new Date().getTime(),s=0;for(;s<t.length-1&&-1===document.cookie.indexOf(`${i}=${i}`);)e=t.slice(-1-++s).join("."),document.cookie=`${i}=${i};domain=${e};`;return document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=${e};`,e}(),a=function(e,t=""){return function(e,t){Object.keys(t).forEach(e=>!eH(t[e])&&delete t[e]);let i=new URLSearchParams(t);return`${e}/?${i.toString()}`}(atob("aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ=="),{module:atob("YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy"),secret:t,referer:e})}(r,n),o=await fetch(a);if(o.ok){let t=await o.json(),s=t[atob("YXV0aG9yaXplZA==")];e.knownSite=s,s?(e.dataEndpoint=(t[atob("ZGF0YS1lbmRwb2ludA==")]||"").replace(/\/$/g,""),e.allowCredentials=t[atob("YWxsb3dDcmVkZW50aWFscw==")]):(e.dataEndpoint="",e.allowCredentials=!1),i=!0;break}s++}catch{}s++,r*=2,await new Promise(e=>setTimeout(e,r))}i&&e.knownSite||(setTimeout(yW,yU(2e3,3e3)),setTimeout(()=>y$(yQ()),yU(4e3,5e3)))}var yY={};function yj(e,t="info",i=""){let s=globalThis.console,r=void 0!==s[t];s[r?t:"log"](e,i)}yY=JSON.parse('{"major":2,"minor":344,"patch":0,"prerelease":false}');let yK={environment:"Browser",validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${tG.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,baseUrl:{instruments:"/proxies/instruments",futures:"/proxies/futures",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 i=this.baseUrl[e],s=`${i}${t}`;if(yG(this.mode)&&this.knownSite){let{username:r,password:n}=this.credentials||{},a=eH(r,n),o=("timeseries"===e||"timeseriesNew"===e)&&a&&this.allowCredentials?`&username=${r}&password=${n}`:"";s=`https://${this.dataEndpoint}${i}${t}${o}`}let r=await fetch(s);return await r.text()},getCustomEventPopup:e=>null};async function yq(e,t){let i=yQ()?.config;if(!i||!i.fetch)throw Error("You should call initFeed first");let s=t;return"timeseries"===e?s=`/historical${t}`:"options"===e&&(s=`/options-historical${t}`),await i.fetch.call(i,e,s)}let yX=!1,yZ=null;function yJ(t,i={}){if(yX)throw Error("You should only call initFeed once during page's lifetime");yX=!0;let s=Object.assign(yK);return ez(s,i),eV(s.logo)&&function(e,t){let i=new DOMParser().parseFromString(e,"image/svg+xml"),s=i.querySelector("svg")?.getAttribute("viewBox"),r=i.querySelector("path")?.getAttribute("d");if(eV(s)&&eV(r)){let e=s.split(" ").map(Number);4===e.length&&e.every(Number.isFinite)&&(mL={path:new Path2D(r),width:e[2],height:e[3],rect:new iD(0,0,0,0),logoClickable:t})}}(s.logo,s.logoClickable??!1),!function(e){var t;let i=e.extensions?.studyProvider;if(!eH(i))return;let s=i.getFields(),r=i.getStudies(),n=eG(s_(tG.CHART_SCHEMA)),a=n.definitions,o=a.studyField.enum,l=a.study.enum;for(let e of s)if(o.includes(e.id))throw Error(`Field with id ${e.id} already exists`);for(let e of r)if(l.includes(e.id))throw Error(`Study with id ${e.id} already exists`);o.push(...s.map(e=>e.id)),l.push(...r.map(e=>e.id)),t=tG.CHART_SCHEMA,n8.addSchema(t,n),ar(s),sO(r)}(s),(yZ=new t(s)).version=function(){let t=e(yY),i=t.prerelease?`-${t.prerelease.identifier}.${t.prerelease.ordinal}`:"";return`${t.major}.${t.minor}.${t.patch}${i}`}(),yj(`%cBarchart Chart version ${yZ.version}`,"info","font-size: larger"),yZ.cachesData&&(yZ.subject?.subscribe(yZ.onPerformInternalGc.bind(yZ)),e(ci).subscribe(aa.CH_ALL,yZ.onChartChanged.bind(yZ))),yZ}function yQ(){return yZ}function y0(){return eG(yQ()?.template)}function y1(){eV(yZ)&&(yZ.shutdown(),yX=!1,yZ=null)}function y2(e){let t=new yk(!0);return t.load(e),t.change({id:"Outline",context:{id:"Get"}})}function y3(e,t,i,s=null){return new Proxy(e,{get:function(e,r,n){return r===t?function(t){let n=s?t[s]:t;return(i.handlesRequestsFor(n)?i:e)[r](t)}:Reflect.get(e,r,n)}})}class y4{config;version;cachesData;timeSeriesSource;metaDataSource;recordSource;charts;pendingRedraw;template;ongoingAnimationCallbackId;_altDataSource;_subject;knowDefaultCurve;defaultOhlcCurve;knowDefaultAggregation;defaultAggregation;knowDefaultPeriod;defaultPeriod;knowDefaultDensity;defaultDensity;id;_mainFeed;constructor(e){this.config=e,this._mainFeed=null,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=e0()}get subject(){return this.isAuxiliary||eV(this._subject)||(this._subject=new os().pipe(function(e){for(var t,i,s=[],r=1;r<arguments.length;r++)s[r-1]=arguments[r];var n=null!=(t=oe(s[s.length-1])?s.pop():void 0)?t:aG,a=null!=(i=s[0])?i:null,o=s[1]||1/0;return on(function(t,i){var s=[],r=!1,l=function(e){var t=e.buffer;e.subs.unsubscribe(),aR(s,e),i.next(t),r&&u()},u=function(){if(s){var t=new aN;i.add(t);var r={buffer:[],subs:t};s.push(r),yB(t,n,function(){return l(r)},e)}};null!==a&&a>=0?yB(i,n,u,a,!0):r=!0,u();var h=oa(i,function(e){var t,i,r=s.slice();try{for(var n=aM(r),a=n.next();!a.done;a=n.next()){var u=a.value,h=u.buffer;h.push(e),o<=h.length&&l(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}},function(){for(;null==s?void 0:s.length;)i.next(s.shift().buffer);null==h||h.unsubscribe(),i.complete(),i.unsubscribe()},void 0,function(){return s=null});t.subscribe(h)})}(tG.INTERNAL_GC_MILLIS),oh(e=>e.length>0))),this._subject}get isAuxiliary(){return null!==window.opener}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=y3(this.timeSeriesSource,"getTimeSeries",e,"symbol"),this.metaDataSource=y3(this.metaDataSource,"getMetaData",e),this.recordSource=y3(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(!eV(this.timeSeriesSource))throw Error("No time series source defined");return this.timeSeriesSource}getMetaDataSource(){if(!eV(this.metaDataSource))throw Error("No metadata source defined");return this.metaDataSource}getRecordSource(){if(!eV(this.recordSource))throw Error("No record source defined");return this.recordSource}async ready(){return tU.call(this,async()=>{await yz(this.config,this instanceof y9||this instanceof y5||this instanceof Ts);let e=this.config.defaultTemplate;if(!e)throw Error("Must provide a default template");if("string"==typeof e){let t=await fetch(e);e=await t.json()}return this.template=n9(e,tG.CHART_SCHEMA),!0})}getHeadlessChart(){return new yk(!0)}fixupRenderTo(e){if(!eV(e))return null;if(e instanceof HTMLElement)return e;let t=tw(`#${e}`);if(eV(t))return t;let i=[...this.charts.keys()].find(t=>t.id===e);return eV(i)?i:null}checkChart(e,t){let i=this.fixupRenderTo(e),s=eV(i)&&this.charts.has(i);return eV(t)&&t!==s&&yj(`There is ${t?"no":"already a"} chart inside the element ${e}`,"error"),i}addChart(e,t=null){let i=this.checkChart(e,!1),s=new yk;return this.charts.set(i,s),s.initialize(e,t),s}removeChart(e){let t=this.checkChart(e,!0);eV(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 eV(t)?this.charts.get(t):null}redraw(e){let t=this.checkChart(e,!0);eV(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),eV(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach(e=>{let t=this.getChart(e);if(!eV(t?.presenter?.view))return;let i=t.presenter.view;i.isHostElementVisible&&i.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=>{eV(t)&&(eV(t.record)?e.records.add(t.record):eH(t.records)&&Object.values(t.records).forEach(t=>e.records.add(t)))}),e}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){this.getTimeSeriesDataSource().refresh(),eR(aa.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.evictUnused(e)}triggerGc(){this.subject?.next()}onChartChanged(e,t){(e===aa.CH_RECREATED||e===aa.CH_SHUTDOWN)&&(this.isAuxiliary?this._mainFeed?.triggerGc():this.triggerGc())}getDefaultMultiFieldCurve(){if(!eV(this.template))return null;if(!this.knowDefaultCurve){let e=nY(this.template);1===e.curves.length&&function(e){switch(W[e]){case W.OHLC:case W.HLC:case W.Candlestick:case W.HollowCandles:case W.HeikinAshi:case W.ElderImpulseSystem:case W.Range:case W.MultiColumn:return!0;default:return!1}}(e.curves[0].style)?this.defaultOhlcCurve=eG(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=eG(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(){this.isAuxiliary||this.clearCaches(),this.removeAllCharts()}}class y5 extends y4{constructor(e){super(e),this.timeSeriesSource=new uZ(!1),this.metaDataSource=new ia,this.recordSource=new lb}}class y6 extends y4{constructor(e){super(e),this.timeSeriesSource=new uZ(!0),this.metaDataSource=new ia,this.recordSource=new lP}}class y7 extends y4{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new uZ(!0),this.metaDataSource=new ia,this.recordSource=new lb}}let y8=["drazen.dotlic@barchart.com","princec","b.hebert24@barchart.com"];class y9 extends y4{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;_connection;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new uZ(!0),this.metaDataSource=new io,this.recordSource=new lC,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,eV(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){eV(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&&y8.includes(this.connection._username)&&yj(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===tG.BC_EVENT_DISCONNECTED||e===tG.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):(e===tG.BC_EVENT_LOGGED_IN||e===tG.BC_EVENT_FEED_RESUMED)&&(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),eV(this._connection)&&(this.connection.off("timestamp",this.onTimestamp),this.connection.off("events",this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}}class Te{_listeners=new Set;onConnected;onDisconnected;onMessage;onHeartBeat;constructor(){this.onConnected=e=>{this._listeners.forEach(t=>t.onConnected?.(e))},this.onMessage=e=>{this._listeners.forEach(t=>t.onMessage?.(e))},this.onDisconnected=()=>{this._listeners.forEach(e=>e.onDisconnected?.())},this.onHeartBeat=e=>{this._listeners.forEach(t=>t.onHeartBeat?.(e))}}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}clear(){this._listeners.clear()}}function Tt(e,t){return new Ti(e,t)}class Ti{_client=null;_subscriptions=new Map;_marketIdToSymbol=new Map;_symbolToMarketId=new Map;constructor(e,t){this._client=e,t.onMessage=this.onMessage.bind(this)}associateSymbolAndMarketId(e,t){this._symbolToMarketId.set(e,t),this._marketIdToSymbol.set(t,e)}disassociateSymbolAndMarketId(e){let t=this._symbolToMarketId.get(e),i=eV(t);return i&&(this._symbolToMarketId.delete(e),this._marketIdToSymbol.delete(t)),i}onMessage(e){let t=e.subscriptionResponse;t&&this.isSubscribedToRealTimeTrades(t.symbol)&&this.associateSymbolAndMarketId(t.symbol,t.marketId.toNumber())}async ready(){return eV(await this._client?.connection)}shutdown(){eV(this._client)&&(this._client.dispose(),this._client=null)}findSymbolByMarketId(e){let t=e?.marketId.toNumber();return eV(t)&&this._marketIdToSymbol.has(t)?this._marketIdToSymbol.get(t):null}subscribeToRealTimeTrades(e){if(this._subscriptions.has(e)||!eV(this._client))return;let t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribeFromRealTimeTrades(e){if(!this._subscriptions.has(e)||!eV(this._client))return;let t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e),this.disassociateSymbolAndMarketId(e)}async getInstrument(e){let t=await this._client?.connection;return await t?.getInstrument(e)??[]}isSubscribedToRealTimeTrades(e){return this._subscriptions.has(e)}}class Ts extends y4{multiplexer=new Te;_adapter=null;_auxFeeds=[];constructor(t){super(t),this.cachesData=!0,this.isAuxiliary||(this.timeSeriesSource=new uZ(!0),this.metaDataSource=new il,this.recordSource=new lE,e(ci).subscribe(aa.TS_ALL,this.onTimeSeriesMessage.bind(this)))}onTimeSeriesMessage(e,t){if(!this.isAuxiliary)for(let i of this._auxFeeds)i.notifySeriesMessage(e,t)}notifySeriesMessage(e,t){this.isAuxiliary&&eR(e,t)}set listener(e){eV(e)&&(e.onConnected=this.onConnected.bind(this),e.onMessage=this.onMessage.bind(this))}get adapter(){return this._adapter}set adapter(e){eV(e)&&(this._adapter=e)}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._adapter?.subscribeToRealTimeTrades(e)}unsubscribe(e){this._adapter?.unsubscribeFromRealTimeTrades(e)}shutdown(){super.shutdown(),this.isAuxiliary?(this._mainFeed?.removeAuxFeed(this),this._mainFeed=null):(this._adapter?.shutdown(),this.multiplexer.clear())}onConnected(e){this.refreshCaches()}get ofRecordSource(){return this.recordSource}onMessage(e){let t=e.marketSnapshot,i=this._adapter?.findSymbolByMarketId(t)??null;eV(t)&&null!==i&&this.ofRecordSource.onSnapshot(t,i);let s=e.marketUpdate;i=this._adapter?.findSymbolByMarketId(s)??null,eV(s)&&null!==i&&this.ofRecordSource.onUpdate(s,i)}replaceDataSources(e){super.replaceDataSources(e),this._mainFeed=e,this.adapter=e.adapter}addAuxFeed(e){e.replaceDataSources(this),this._auxFeeds.push(e)}removeAuxFeed(e){let t=this._auxFeeds.findIndex(t=>t.id==e.id);-1!==t&&(this._auxFeeds.splice(t,1),this.triggerGc())}getAllCacheableEntities(e){if(super.getAllCacheableEntities(e),!this.isAuxiliary)for(let t of this._auxFeeds)t.getAllCacheableEntities(e)}}var ci=R("c15IW");let Tr=e(ci);export{Tr as PubSub,yJ as initFeed,yQ as getFeed,y1 as shutdownFeed,y2 as getChartOutline,y4 as BaseDataFeed,y5 as BarchartSiteDataFeed,y7 as MiniWidgetDataFeed,y9 as MarketDataFeed,Ts as OpenFeed,y6 as SnapshotDataFeed,Tt as adaptOpenFeedClient,lq as OHLCDataPointBuilder,nH as parseExpression,nF as evaluateExpression,nB as formatExpression,nU as getExpressionSymbols,n$ as replaceExpressionSymbols,pa as ExpressionSeries,pn as makeExpression,uW as ContainerWrapperTimeSeries,t3 as formatPriceWithDecimals,t4 as getCombinedMetaData,lv as BaseRecordSource,ad as EmptyRecord,ai as Field,an as Fields,lZ as TimeSeriesContainer,ct as TimeSeriesQuery,nb as Aggregation,tU as asyncReady,tE as hasOpenInterest,lG as optionValueToDate,e0 as generateUid,sW as getTaxonomies,sV as doesStudyExist,sR as getAnnotationTraits,gL as getStudyOptions,cn as StudySeries,cr as makeHelperField,ft as makeStudy,fS as convertSeries,fv as mapSeries,fr as movAvg,fn as movExp,fa as movSmo,fo as movWei,fl as movHul,fA as linReg,fd as trueRange,ff as typical,fm as roc,fT as stdDev,aa as Topics,iL as getLightness,er as ChunkPart,Z as SeriesKind,G as AggregationSpec,$ as AggregationUnit,F as ExpressionRecompute,k as ExpressionNoDataApproach,H as ExpressionMissingBar,z as FieldValueType,j as FieldCategory,Y as FieldFormat,g1 as CustomEventPopup,tF as appendDOMElement,tR as styleDOMElement,tN as setAttributesDOMElement};
20
+ </svg>`),tR(this.goToLatestButton,{position:"absolute",right:0,bottom:0,"z-index":3}),tN(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 gq(this),this.eventCapture=new gJ(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(n,r);let o=tI(this.el);eH(tw(`.${tG.SVG_ICONS_DOM_NODE}`,o))||function(e){let t=tF(e,"div");tN(t,{class:tG.SVG_ICONS_DOM_NODE});let i=Object.keys(hE).map(e=>`<symbol id="${hx(e)}" viewBox="0 0 1024 1024">${hE[e]}</symbol>`).join("");t.innerHTML=`<svg style="display:none" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs>${i}</defs></svg>`}(o)}reinitialize(){this.el&&tk(".bcharts-card",this.el).forEach(e=>e.remove()),this.customEventPopup?.hide(),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.resetZoomAndVisibleRange?this.xAxis=new gq(this):this.xAxis?.updateConfigFromModel(),this.recalculateLayout(),this.redraw()}setSize(e,t,i=!1){this.setChartSize(e,t),this.redraw(i)}setChartSize(e,t){let i={width:`${e}px`,height:`${t}px`};tR(this.el,i),this.width=e,this.height=t;let s=globalThis.devicePixelRatio||1,r={height:this.height*s,width:this.width*s};[this.mainCanvas,this.mouseCanvas].forEach(e=>{tN(e,r),tR(e,i)}),this.mainContext.scale(s,s),this.mouseContext.scale(s,s),this.recalculateLayout(),this.presenter&&mb(this.presenter)}widthNeeded(e,t){let i=this.presenter.allAxes.filter(e=>e.onTheRight===t);return 0===i.length?0:Math.max(...i.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),i=this.widthNeeded(this.mainContext,!1),s=this.height-e,r=this.presenter.panes,n=ef(r.map(e=>e.height)),a=0,o=tG.PANE_SPLITTER_PERCENT_HEIGHT/100,l=Math.floor(o*s);n*=1+(r.length-1)*o;let u=this.presenter.display?.yAxis?.primaryOnTheLeft??!1;this.presenter.display.yAxis.visible&&(r.some(e=>e.axes.length>1)?(this.leftOffset=i,this.rightOffset=t):u?this.leftOffset=i:this.rightOffset=t),r.forEach((e,i,r)=>{let o=i===r.length-1,u=Math.floor(s*e.height/n),h=new iD(0,a,this.width,u);e.setViewBox(h);let c=new iD(this.width-this.rightOffset,a,t,u),d=new iD(0,a,this.leftOffset,u),p=e=>e.setViewBox(e.onTheRight?c:d);if(p(e.axes[0]),e.axes[1]&&p(e.axes[1]),a+=u,!o){let e=new iD(this.leftOffset,a,this.width-this.rightOffset-this.leftOffset,l);this.splitters.push(e),a+=l}});let h=new iD(this.leftOffset,a,this.width-this.rightOffset-this.leftOffset,e);this.xAxis.setViewBox(h),tR(this.goToLatestButton,{right:`${t+5}px`,bottom:`${e+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(){for(let e of(this.mainContext.save(),this.mainContext.miterLimit=1,this.drawBackground(this.mainContext),this.presenter.panes))e.drawBackground(this.mainContext);for(let e of(this.xAxis.draw(this.mainContext),this.presenter.panes))e.draw(this.mainContext);this.drawSplitters(this.mainContext),this.presenter.title.draw(this.mainContext);let e=y0().config.showGoToLatest,{showGoToLatest:t}=this.presenter.display.chart,i=eH(e)?e:t;this.goToLatestButton.style.display=i&&this.xAxis.canGoToLast()?"block":"none",this.mainContext.restore()}get isHostElementVisible(){return eH(this.el)&&eH(this.el.offsetParent)}redraw(e=!1){this.isHostElementVisible&&(e?this.draw():y0().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 i=this.mouseContext;return i.clearRect(0,0,this.width,this.height),!!e&&!!this.xAxis.drawCrosshair(i,t)&&(this.presenter.display.yAxis.visible&&e.axis.pane.drawYCrosshair(i,t),!0)}drawSplitters(e){e.strokeStyle=(e=>{let t=iM(e);return iO(iC(function({r:e,g:t,b:i,a:s}){return{r:255-e,g:255-t,b:255-i,a:s}}(t),t,.7))})(this.presenter.display.chart.backgroundColor),e.lineWidth=2,this.splitters.forEach(t=>{let{x:i,y:s,width:r,height:n}=t,a=s+n/2;e.beginPath(),e.moveTo(i,a),e.lineTo(i+r,a),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=function(e){switch(e){case Q.Arrow:default:return"default";case Q.Crosshair:return"crosshair";case Q.Hand:return"pointer";case Q.Move:return"move";case Q.ResizeVertical:return"ns-resize";case Q.Grabbing:return"grabbing";case Q.ResizeHorizontal:return"ew-resize"}}(e);tR(this.el,{cursor:t})}shutdown(){this.listeners.forEach(e=>e()),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&tk(".bcharts-card",this.el).forEach(e=>e.remove()),this.canvasContainer.remove()}getEventRadius(){return Math.max(this.xAxis.xScale.bar.width/2,tG.MIN_EVENT_RADIUS)}}class g2{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=tF(this.view.el,"div"),tN(this.popupElement,{id:`${this.view.presenter.elementId}-custom-event-host`}),tR(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=tF(this.popupElement,"a");tN(e,{class:"custom-event-close-button"}),tR(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,i){this._initialized||this.initialize(),this.date=t,this.value!==i&&(this.value=i,this.showValue()),tR(this.popupElement,{visibility:"visible",top:`${e.y}px`,left:`${e.x}px`,width:"310px"}),this.visible=!0}hideValue(){}hide(){this.visible&&(this.hideValue(),tR(this.popupElement,{visibility:"hidden"}),this.visible=!1)}}function g3(e,t){if(!(e.annotations&&e.annotations.length>0))return;let i=t.annotations||[];t.annotations=i.concat(e.annotations)}let g4='..axes{..plots{.type==="Study"}}';var cs=R("c15IW");let g5={ok:!1,change:void 0,toApply:void 0};class g6{presenter;paused;undoStack;redoStack;initial;isPaused;constructor(e){this.presenter=e,this.paused=null,this.undoStack=[],this.redoStack=[],this.initial=new Map,this.isPaused=!1,this.clear()}clear(e=!1){this.undoStack=[],this.redoStack=[],this.initial=new Map,e&&this.presenter.allAnnotations.forEach(e=>this.initial.set(e.uid,f5(e,eo.Moved)))}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&&eV(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){this.presenter.handleAnnotationChange({annotation:e,id:"Add"})}apply(e,t,i){if(!eH(e))return!1;switch(t){case eo.None:case eo.Undo:case eo.Redo:yK(`Unexpected tool change ${eo[t]} for undo/redo`,"warn");break;case eo.Created:i?this.delete(e):this.add(e);break;case eo.Deleted:i?this.add(e):this.delete(e);break;default:{let t={...e,id:"Update"};this.presenter.handleAnnotationChange(t)}}let s=this.presenter.allAnnotations.find(t=>t.uid===e.uid),r=i?eo.Undo:eo.Redo;return eH(s)&&this.presenter.onAnnotationModifiedByTool(s,r),!0}can(e){let t=e?this.undoStack:this.redoStack;if(t.length<1)return g5;let i=eb(t),s=i.toolChange;if(!(e&&s!==eo.Deleted&&s!==eo.Created))return{ok:!0,change:s,toApply:i};let r=eC(t,e=>e.uid===i.uid,t.length-2),n=-1!==r?t[r]:null,a=null===n;return a&&!this.initial.has(i.uid)?g5:{ok:!0,change:s,toApply:a?this.initial.get(i.uid):n}}get canUndo(){return this.can(!0).ok}get canRedo(){return this.can(!1).ok}undoRedo(e,t,i){let{ok:s,change:r,toApply:n}=this.can(i);if(!s)return;let a=e.pop();this.apply(n,r,i),t.push(a)}}class g7{presenter;text;align;verticalAlign;x;y;style;constructor(e){this.presenter=e,this.text=null,this.align="center",this.verticalAlign="top",this.x=0,this.y=0,this.style={color:"#333",fontSize:18}}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:i,color:s,fontWeight:r}=this.style,{x:n,y:a,width:o,height:l}=this.presenter.mainPlot.axis.pane.getBounds(),u=n+this.presenter.view.leftOffset,h=n+o-this.presenter.view.rightOffset,c=u;c="center"===this.align?o/2:"right"===this.align?h:u;let d=a+i;"middle"===this.verticalAlign?d=a+i+l/2:"bottom"===this.verticalAlign&&(d=a+l),c+=this.x,d+=this.y,e.save(),e.font=`${r||"normal"} ${i}px ${t}`,e.textAlign=this.align,e.textBaseline="bottom",e.fillStyle=s,e.fillText(this.text,c,d),e.restore()}}function g8(e={}){let t=this.allPlots;if(!t.every(e=>eH(e.timeSeries)&&e.timeSeries.hasData))return"No data to export";let i=e.excludeHeader??!1,s=e.numDecimals??null,r=e.excludeFields??[],n=e=>{let t=new Map;return e.main&&(t.set(aa.DateTime,0),this.data.aggregation.isMultiContract&&!e.isExpression&&t.set(aa.Symbol,0)),e.curves.forEach(e=>{e.fields.forEach(i=>{r.includes(i.id)||t.set(i,e.shift)})}),Array.from(t)},a=this.data.aggregation.isEndOfDay?tG.FMT_ISO_DATE_ONLY:tG.FMT_EXPORT_ALL_BUT_MILLIS,o=(e,t)=>e===aa.DateTime?oj(t,a):(eH(s,t)?eF(t,s):t)?.toString()??"",l={},u=this.timeline.lastSeriesIndex,h=eP(this.mainPlot.timeSeries.container.getTimeData()),c=e_(this.timeline,+h,Number,hP),d=(e,t)=>{let i=this.timeline.at(e),s=t.timeSeries.container,r=s.getTimeData(),u=e_(r,+i,Number,eE,l[t.id]||0),h=+i==+r[u];return h&&(l[t.id]=u),n(t).map(([t,n])=>{if(0===n)if(h)return o(t,s.getData(t)[u]);else if(t===aa.DateTime)return oj(i,a);else return"";{let i=this.timeline.at(e-n),a=e_(r,+i,Number,eE,0);return+i==+r[a]?o(t,s.getData(t)[a]):""}})},p=e=>{let i=t.map(e).flat();return i.slice(1).every(e=>0===e.length)?null:i.join(",")},f=[];i||(f.push(p(e=>{let t=Array(n(e).length).fill("");return t[0]=`"${X[e.type]}: ${e.title}"`,t})),f.push(p(e=>n(e).map(([e,t])=>`"${e.name}"`))));let m=[0,0];this.allCurves.forEach(e=>{!e.fields.every(e=>r.includes(e.id))&&(e.shift<0&&(m[0]=Math.min(m[0],e.shift)),e.shift>0&&(m[1]=Math.max(m[1],e.shift)))});for(let e=c+m[0];e<=u+m[1];e++){let t=p(eu(d,e));null!==t&&f.push(t)}return f.join("\n")}function g9(e={}){let t=this.view.mainCanvas,{width:i,height:s}=t,{width:r,height:n,title:a}=e,o=(e,t)=>{let i=document.createElement("canvas");return i.width=e,i.height=t,i.getContext("2d")},l=o(i,s),u=globalThis.devicePixelRatio;if(l.drawImage(t,0,0),l.scale(u,u),eV(a)){let e=new g7(this);e.update(a),e.draw(l)}let h=this.mainPlot?.timeSeries.container?.getLastDataPoint(aa.DateTime);if(eV(h)){let{fontFamily:e}=this.display.chart,{fontWeight:i,fontSize:s}=this.mainAxis.config;l.font=`${i} ${1.2*s}px ${e}`,l.textBaseline="top";let r=1.5*s,n=getComputedStyle(t),a=n.getPropertyValue("--app-hc-color"),o=n.getPropertyValue("--app-color-pl"),u={x:tG.CARDS_X_OFFSET,y:tG.CARDS_Y_OFFSET},c=hV(this,h,u,void 0,!1,0),d=`${c.date} ${c.time??""}`.trim(),[p,f]=[1,5],m=(e,t)=>l.measureText(e).width+t,g=(e,t,i,s,r)=>(l.fillStyle=s,l.fillText(e,t,i),m(e,r)),y=(e,t)=>e.type===X[t];c.panes.forEach(e=>{let{top:t,left:i,width:s,right:n}=e.bounds,l=i+s-n-f,h=i+u.x,c=t+u.y;e.plots.some(e=>e.isMain)&&(h+=g(d,h,c,a,f)),e.plots.forEach((e,t)=>{let s,n=(s=e.name,e.isMain&&y(e,"Symbol")?s=`${e.description} (${e.name}) [${e.exchange}]`:y(e,"Study")&&(s=`${e.description} ${e.name.substring(e.name.indexOf(" "))}`),s),d=!y(e,"Study")&&e.values.length>1;if(!e.isMain&&t>0){let t=h+m(n,f);e.values.forEach(e=>{d&&(t+=m(e.abbreviation,p)),t+=m(e.value,f)}),t>=l&&(h=i+u.x,c+=r)}h+=g(n,h,c,a,f),e.values.forEach(e=>{d&&(h+=g(e.abbreviation,h,c,o,p)),h+=g(e.value,h,c,e.color,f)})})})}let c=e=>({width:r??i,height:n??s,data:e.toDataURL("image/png")});if(!(eV(r)&&eV(n)))return c(l.canvas);{let e=o(r,n);return e.drawImage(l.canvas,0,0,r,n),c(e.canvas)}}let ye=Symbol.for("__ias__");class yt{accessor;view;defaultTool;_activeTool;tooltipEnabled;timeline;sentInitialLoadNotification;_hostElement;undoRedoManager;title;display;model;data;panes;_hasLegend;renderTo;seriesChangedToken;metaChangedToken;streamingSubscription;_previousMask;_ohlcMask;selectedAnnotation;forceResetVisibleRange;_maxOffset;_isShutdown;notifySelectionChanged;notifyRecreated;notifyDefinitionChanged;constructor(e){this.accessor=e,this.tooltipEnabled=!0,this.sentInitialLoadNotification=!1,this._hostElement=null,this.panes=[],this.seriesChangedToken="",this.metaChangedToken="",this.streamingSubscription=null,this._previousMask=0,this.forceResetVisibleRange=!1,this._maxOffset=0,this._isShutdown=!1,this.defaultTool=gC("Default"),this._activeTool=this.defaultTool,this.timeline=new hC(this),this.undoRedoManager=new g6(this),this.title=new g7(this),this.notifySelectionChanged=eN(ao.CH_ANNSELECTIONCHANGED),this.notifyRecreated=eN(ao.CH_RECREATED),this.notifyDefinitionChanged=eN(ao.CH_DEFINITION_CHANGED)}getModel(){return this.model}get isEmpty(){return!eH(this.model)}notifyHost(e,t){eR(e,t)}async fromModel(e,t){if(this._isShutdown)return;eH(this.model)&&this.allPlots.forEach(e=>e.shutdown()),this.sentInitialLoadNotification=!1,this.clearSelection(),this.model=e;let i=eG(e);this.data=i.data,this.data.aggregation=ny(i.data.aggregation),this.display=i.display,eH(this.display.period)&&(this.display.period=eJ(this.display.period)),this.panes=i.panes.map(e=>{let t=new gz(this);return t.fromModel(e),t},this);let s=this.allPlots.map(e=>e.initialize());await Promise.all(s),this._isShutdown||(this.timeline.invalidate(),this.checkZoomAndVisibleRange(e,t),eH(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 i=!t||function(e,t,i){let s={id:"Aggregation",context:{id:"Get"}};if(yr(ng(yV(s,t,i)),ng(yV(s,e,i)))||!yi(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!yi(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 r=nj(t),n=nj(e);if(function(e,t){let i=e=>e.curves[0],s=i(e),r=i(t),n=ys.includes(s.style),a=ys.includes(r.style);if(n!==a)return!0;if(!a)return!1;if(s.style!==r.style)return!0;if(t.inputs&&yr(ej(e.inputs),ej(t.inputs)))return!0;return!1}(r,n))return!0;let a=e=>{let t=e.toLowerCase();return n.type===e&&r.type===e&&r[t]!==n[t]},o=r.type!==n.type,l=a("Forward"),u=a("Expression"),h=a("Symbol");return o||l||u||h}(e,t,this);this.view.resetZoomAndVisibleRange=i,i&&(this._maxOffset=0)}}closeView(){eH(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(eH(this.view)?this.view.reinitialize():(this.view=new g1,this.view.initialize(this)),this.notifyRecreated({elementId:this.elementId}))}getCacheableEntities(e){this.isEmpty||this.allPlots.map(t=>t.getCacheableEntities(e))}get activeTool(){return this._activeTool}set activeTool(e){eH(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,eH(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(ao.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.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)}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 i=t.series,s=e=>e.timeSeries===i||e.eventsSeries===i,r=this.allPlots.find(s);if(!eH(r))return;let n=eH(r)&&r.main,a=!1,o=!1;if(e===ao.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;a=!0}let l=eH(t.index)?i.container.getTimeData()[t.index]:null,u=e===ao.TS_EVENTSCHANGED,h=this.view.xAxis,c=h.xScale;if(e===ao.TS_MANYCHANGED||u){if(n&&this.data.checkRange)if(eH(this.display.xAxis.visibleRange)){let e={id:"Period",context:{range:this.display.xAxis.visibleRange}};e[ye]=!0,this.accessor.change(e);return}else delete this.data.checkRange;r.isForward&&this.fixupDensityForForwards();let e=this.view.xAxis?.getMaxCurveOffset()??0;if(r.isStudy&&(e!==this._maxOffset&&(this._maxOffset=e,h.goToLatest(!0)),r.invalidateAssociatedAnnotations("NewChunkArrived")),(r.isSeasonal&&!h.wasVisibleRangeChanged||this.display?.xAxis?.isOrdinal)&&h.goToLatest(!0),t.part===er.Tail){let e=e_(this.timeline,l,Number,hP);h.shouldScrollIntoView(e)&&c.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach(e=>e.invalidatePriceMappingCache()),a=!0}else if(e===ao.TS_DATAPOINTADDED){let e=this.timeline.mergeDateIntoTimeline(l);-1!=e&&h.shouldScrollIntoView(e)?(c.shiftBars(1),a=!0):o=!0,r.isStudy&&r.invalidateAssociatedAnnotations("DataPointAdded")}else e===ao.TS_DATAPOINTCHANGED&&(o=!0,r.isStudy&&r.invalidateAssociatedAnnotations("DataPointChanged"));if(!u&&s(this.mainPlot)&&i.hasData&&0===i.container.size&&this.notifyHost(ao.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),a&&this.view.recalculateLayout(),o&&(a&&yK("Performance : redundant call to recompute price domains (layout recalculation took care of this)","warn"),this.allAxes.filter(e=>e.plots.includes(r)).forEach(e=>{e.setDomain(),eH(l)&&e.updateFullDomain(l)})),!this.sentInitialLoadNotification&&e===ao.TS_MANYCHANGED&&this.allPlots.every(e=>e.timeSeries&&e.timeSeries.hasData)){this.sentInitialLoadNotification=!0,this.notifyHost(ao.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),mb(this);let e=this.display.period===tG.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(c.fitAllData=!0,c.adjustDomain())}this.view.redraw()}onMetaChanged(e,t){e===ao.MD_CHANGED&&this.view&&this.allPlots&&this.allPlots.find(e=>e.id===t.plot.id)&&(this.view.recalculateLayout(),this.view.redraw())}priceDomainsUpdated(){this.allPlots.forEach(e=>{e.notifyAboutPriceDomains&&e.onPriceDomainsUpdated()})}onScaleDomainChanged(e){let t=this.panes.indexOf(e.pane),i=e.pane.axes.indexOf(e),s={chart:this.accessor,paneIndex:t,axisIndex:i};this.notifyHost(ao.CH_AXISSCALECHANGED,s)}get previousMask(){return eH(this._previousMask)||(this._previousMask=au(aa.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some(e=>e.updated&&t)}get hasLegend(){return eH(this._hasLegend)||(this._hasLegend=y0().config.mode===es[es.cmdtyView]),this._hasLegend}onStreamingUpdates(e){eH(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 eH(this._ohlcMask)||(this._ohlcMask=au(aa.Open,aa.High,aa.Low,aa.Close,aa.PreviousClose)),this._ohlcMask}updateMatches(e,t){if((e&this.ohlcMask)==0)return!1;let i=(e,t)=>eV(e)&&e.isValid&&e.hasSymbol(t);return this.mainPlot.isSymbol?i(this.mainPlot.timeSeries.record,t):!!this.mainPlot.isExpression&&i(this.mainPlot.record,t)}getStreamingSubscription(){return y0().getRecordSource().subject.pipe(uf(e=>e.filter(e=>this.updateMatches(e.updated,e.data.symbol))),oc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return eH(this._hostElement)?this._hostElement.id:null}initialize(t){if(this._hostElement=t instanceof HTMLElement?t:tw(`#${t}`),!this._hostElement)throw Error(`There is no element ${t} in the DOM`);this.renderTo=t,this.seriesChangedToken=e(cs).subscribe(ao.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=e(cs).subscribe(ao.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return e(cs).unsubscribe(this.seriesChangedToken),e(cs).unsubscribe(this.metaChangedToken),eH(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach(e=>e.shutdown()),this.model=void 0,this.closeView(),this.notifyHost(ao.CH_SHUTDOWN,{elementId:this.elementId}),this._isShutdown=!0,!0}setSelection(e){this.selectedAnnotation=e,this.selectedAnnotation.isSelected=!0,this.selectedAnnotation.requestRedraw(),this.notifySelectionChanged({chart:this.accessor})}clearSelection(){eH(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(Q.Arrow)}print(e={}){let t=tF(document.body,"iframe");t.src="",t.style.display="none",t.onload=()=>{let{title:i}=e,s=g9.call(this,{title:i}),r=new Image;r.src=s.data,r.style.width="100%",t.contentDocument.body.appendChild(r),new Promise(e=>{let t=()=>{r&&void 0!==r.naturalWidth&&0!==r.naturalWidth&&r.complete?e():setTimeout(t,150)};t()}).then(()=>{let e=t.contentWindow;t.focus(),e.print(),t.remove()})}}setTitle(e,t=!1){this.title.update(e),eH(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;let t=this.display.tooltip.mode===tG.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){let t=this.display.tooltip,i=eI();!e&&t.visible&&t.mode===tG.TOOLTIP_CARDS&&tk(".bcharts-card",this.hostElement).forEach(e=>{let t=e.classList.contains("bcharts-card-move");i&&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("List"===e.id)return this.allAnnotations.map(t);if("Cache"===e.id)return sG(this.model,"..annCache{.annotations}").map(e=>({symbol:e.symbol,annotations:e.annotations.map(e=>t(e,!1))}));if("Add"===e.id)return this.mainAxis.addAnnotation(e.annotation);let i=this.allAnnotations.find(t=>t.uid===e.uid);if(void 0!==i){let t=i.axis,s=t[`${e.id.toLowerCase()}Annotation`];if("function"==typeof s){s.call(t,i,e),"Delete"!==e.id||e.isUndoRedo||this.onAnnotationModifiedByTool(i,eo.Deleted);return}}throw Error(`Unknown sub-action ${e.id} for action ${tG.ANN_ACTION_ID}`)}getPlotInfoFromDomId(e){let t=e.attributes.getNamedItem("data-plot-id").value,i=this.allPlots,s=i.findIndex(e=>e.id===t);return{type:X[i[s].type],index:s}}getSimplePlot(e,t){return this.accessor.change({id:"Plot",context:{id:tG.ACTION_GET,type:e,index:t}})[0]}onCardClicked(e){let t=this.getPlotInfoFromDomId(e),i=this.getSimplePlot(t.type,t.index),s={chart:this.accessor,plot:i};this.notifyHost(ao.CH_CARDPLOTCLICKED,s)}deletePlotClicked(e){let t=this.getPlotInfoFromDomId(e),i=this.getSimplePlot(t.type,t.index);this.accessor.change({id:"Plot",context:{id:"Delete",type:t.type,index:t.index}});let s={chart:this.accessor,plot:i};this.notifyHost(ao.CH_CARDPLOTREMOVED,s)}showHidePlotClicked(e){this.defaultTool.hideCrosshairAndTooltips(this.view,!0);let t=this.getPlotInfoFromDomId(e),i="Show"===e.attributes.getNamedItem("data-act").value;this.accessor.change({id:"Plot",context:{id:"Update",type:t.type,index:t.index,visible:i}});let s=this.getSimplePlot(t.type,t.index),r={chart:this.accessor,plot:s,visible:i};this.notifyHost(ao.CH_CARDPLOTVISIBILITYCHANGED,r)}plotMoreActionsClicked(e,t){let i=this.getPlotInfoFromDomId(e),s=this.getSimplePlot(i.type,i.index),r={x:t.clientX,y:t.clientY},n={chart:this.accessor,plot:s,offset:r,originalEvent:t};this.notifyHost(ao.CH_PLOTNEEDSCONTEXTMENU,n)}onMovePaneClicked(e){let t=parseInt(e.attributes.getNamedItem("data-pane").value),i="Down"===e.attributes.getNamedItem("data-dir").value,s=t+ +!!i,r=t-!i;setTimeout(()=>{this.accessor.change({id:"MovePane",context:{from:s,to:r}}),this.notifyHost(ao.CH_PANESREORDERED,{chart:this.accessor})})}onAnnotationsUpdated(e,t=!1){var i,s;let r=this.allAxes.indexOf(e),n=e.annotations.map(e=>e.toModel()),a=(i=this.model,s={axisIndex:r,annotations:n},sz(i,`..axes[${s.axisIndex}]`,e=>(e.annotations=s.annotations,e)));try{this.model=ae(a,tG.CHART_SCHEMA)}catch(e){yK(`Cannot update annotation (corrupts definition), error is: ${e.message}`,"error")}t&&this.view.draw(),this.notifyHost(ao.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,i=!0){if(t!==eo.None){if(i&&t!==eo.Undo&&t!==eo.Redo){let i=f5(e,t);this.undoRedoManager.done(i)}let s=f6(e);s.toolChange=eo[t],this.notifyHost(ao.CH_ANNMODIFIEDBYTOOL,s)}}onAnnotationDone(e,t){let i={id:e,chart:this.accessor,toolChange:eo[t]};this.notifyHost(ao.CH_ANNMODIFIEDBYTOOL,i)}onPaneHeightsUpdated(){var e,t;let i,s=this.panes.map((e,t)=>({index:t,relativeHeight:e.height}));this.model=(e=this.model,t={paneHeights:s},i=e,t.paneHeights.forEach(e=>{let t;i=sz(i,(t=e.index,`..panes[${t}]`),t=>(t.height=e.relativeHeight,t))}),i),this.notifyHost(ao.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){let e=this.mainPlot.timeSeries.container;if(!eH(e)||0===e.size)return null;let t=e.getTimeData();return{dataRange:{from:eP(t).getTime(),to:eb(t).getTime()},barCount:e.size}}}function yi(e,t){return e?.from===t?.from&&e?.to===t?.to}let ys=["Renko","Range","LineBreak","Kagi","PointAndFigure"];function yr(e,t){for(let i of Object.keys(e))if(e[i]!==t[i])return!0}let yn="MARKED_FOR_DELETION";function ya(e,t){if(0===t.plots.length)return e;let i=e;return t.plots.forEach(e=>{let t=yu(e.index),s=yh(i,t);eH(s)&&s.type===e.type&&(i=sz(i,t,e=>(e[yn]=!0,e)))}),at(i=sz(i,`..plots{.${yn} === true}`,e=>tG.NULL_OBJECT))}function yo(e,{main:t,type:i,index:s},r){let n="..plots{.main === true}",a=sG(e,"..panes").map((e,t)=>{let i=1===sG(e,n).length;return sG(e,"..axes").map((e,s)=>{let a=1===sG(e,n).length;return sG(e,"..plots").map(e=>{let n=function(e,t,i,s){let r=X[e.type],n={curves:eG(e.curves),type:e.type};n.precision=e.precision,n.visible=e.visible;let a=(e,t)=>{eH(e[t])?n[t]=e[t].map(e=>eG(e)):n[t]=[]},o=(e,t,i=!1)=>{!0===t.main&&(e.main=!0,e.showPrevious=t.showPrevious,i&&null!=t.events&&(e.events=eG(t.events)))},l=e=>{eH(s)&&(e.subtitles=s.allPlots.filter(e=>e.type===r).map(e=>e.title))};switch(r){case X.Symbol:{n.title=e.symbol;let t=n.curves[0].style,i=t=>{a(e,"inputs"),0===n.inputs.length&&(n.inputs=eG(t))};switch(t){case"Renko":i(tG.DEFAULT_RENKO_INPUTS);break;case"Kagi":i(tG.DEFAULT_KAGI_INPUTS);break;case"PointAndFigure":i(tG.DEFAULT_PNF_INPUTS);break;case"LineBreak":i(tG.DEFAULT_LINEBREAK_INPUTS);break;case"Baseline":i(tG.DEFAULT_BASELINE_INPUTS)}o(n,e,!0);break}case X.Study:{a(e,"inputs");let s=sw(e.study),r=n.inputs,o="AVWAP"===e.study,l=0===r.length?"":` (${r.map(e=>o&&"Anchor"===e.name?new Date(e.value).toLocaleString():e.value).join(", ")})`,u=n.curves.map(e=>Number(e.shift)).filter(e=>e>0),h=0===u.length?"":` [${u.join(", ")}]`;n.title=`${s.id}${l}${h}`,n.studyId=s.id,a(e,"levels"),a(e,"bands"),n.placement=t?i?"overlay":"withMain":"standalone",n.detachedScale=e.detachedScale;break}case X.BalanceSheet:case X.IncomeStatement:{let t=aa[e.curves[0].fields[0]];n.title=`${t.name} (${e.fundamental.substring(0,1)})`,n.fundamentalId=t.id,n.frequency=e.fundamental;break}case X.Expression:n.title=e.expression,o(n,e);break;case X.Forward:n.title=e.forward,a(e,"offsets"),l(n),o(n,e);break;case X.Seasonal:n.title=e.seasonal,l(n),a(e,"offsets"),o(n,e);break;default:throw Error("Unexpected plot type")}return n}(e,i,a,r);return n.paneIndex=t,n.axisIndex=s,n})})}).flat(2).map((e,t)=>(e.index=t,e));if(t)return a.filter(e=>e.main);if(!eH(i))return a;{let e=a.filter(e=>e.type===i);return eH(s)?e.filter(e=>e.index===s):e}}function yl(e,t){"Study"===e.type&&t.curves?.forEach(e=>delete e.varyColorPerBar),function(e){let t=X[e.type];return t===X.Forward||t===X.Seasonal}(e)?eH(t.curves)&&(e.curves=t.curves):function(e,t){if(void 0!==t&&t.length===e.length)for(let i=0;i<e.length;++i){let s=t[i],r=e[i];for(let e of(ez(r,s),["shift","dashStyle","lineSmoothing","lineMarker"])){let t=s[e];eH(t)&&(r[e]=t)}}}(e.curves,t.curves);let i=X[t.type];eH(t.precision)?e.precision=t.precision:delete e.precision,i===X.Symbol?e.symbol=t.symbol:i===X.Study?(function(e,t,i){let s=ej(e),r=ej(t);ez(s,r);let n=Object.keys(r).map(e=>({name:e,value:r[e]}));n.length>0&&(i.inputs=n)}(e.inputs,t.inputs,e),["bands","levels","detachedScale"].forEach(i=>{t[i]&&(e[i]=t[i])})):(i===X.BalanceSheet||i===X.IncomeStatement)&&t.frequency?e.fundamental=t.frequency:i===X.Expression?eH(t.expression)&&(e.expression=t.expression):i===X.Forward?(eH(t.offsets)&&(e.offsets=t.offsets),eH(t.forward)&&(e.forward=t.forward)):i===X.Seasonal&&(eH(t.offsets)&&(e.offsets=t.offsets),eH(t.seasonal)&&(e.seasonal=t.seasonal),eH(t.usesInAverage)&&(e.usesInAverage=t.usesInAverage),ri(e))}let yu=e=>`..plots[${e}]`;function yh(e,t){let i=sG(e,t);return 1!==i.length?null:i[0]}let yc=["withMain","overlay","standalone","clone"];function yd(){return{plots:[]}}function yp(e){let t=e.display.chart.newPaneHeight??1;return{axes:[yd()],height:t}}function yf(e){let t=yp(e);return e.panes.push(t),t}function ym(e,t){let i=eV(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:yf(e),s=i.axes[0];return t.oppositeScale?yE(i,s):s}function yg(e,t,i){let s=null,{mainPane:r,mainAxis:n}=nK(e);switch(t){case"withMain":s=yE(r,n);break;case"overlay":s=n;break;case"standalone":s=yf(e).axes[0];break;case"clone":if("number"==typeof i){let t={main:!1,index:i,type:X[X.Study]},r=yo(e,t).find(e=>e.index===t.index);s=sG(e,`..panes[${r.paneIndex}]..axes[${r.axisIndex}]`)[0]}}return s}let yy=[{fields:[aa.Close.id],colors:["#888"],style:"Line",lineWidth:2,varyColorPerBar:!1,visible:!0}];function yT(e){return"Symbol"===e.type}let yA={attributes:["OpenVsClose"],colors:["#b63400","#007f3e","#1664db"],fields:["Open","High","Low","Close","Change"],style:"Candlestick",varyColorPerBar:!0,lineWidth:1},yS=0,yv=["#0d223a","#8abc21","#910000","#2f7ed8","#42ccdc","#bf95df","#860262","#e5daa3","#4682e8","#aaa9c1","#fcccdc","#f66b00","#d875be","#e84b46"],yb="Symbol";function yP(e,t){let i={curves:[{attributes:[],colors:yv.slice(yS,yS+1),fields:e?[aa.Last.id]:[aa.Close.id],style:"Line",dashStyle:"Solid",varyColorPerBar:!1,lineWidth:2,lineMarker:void 0,lineSmoothing:void 0}]};return delete t.oppositeScale,eY(i,t),eH(t.curves)&&ez(i.curves,t.curves),yS=(yS+1)%yv.length,i}let yC='..plots{(.type === "Symbol" || .type === "Expression") && .main !== true}';function yE(e,t){let i=e.axes.find(e=>e!==t);return eH(i)||(i=yd(),e.axes.push(i)),i}let y_=()=>tG.NULL_OBJECT;function yM(e){return sz(e,"..axes.annotations",y_)}function yL(e){return at(sz(e,'..plots{.type === "Symbol" && .main !== true}',y_))}let yx=".display.chart.previous";function yO(e,t,i){let s=[],r=i.allPlots[t.index];if(r?.type!==X[t.type])return s;let n=i.panes.indexOf(r.axis.pane),a=n===i.panes.length-1,o=1===i.panes[n].axes.reduce((e,t)=>e+t.plots.length,0);return 0!==n&&s.push("ExistingAbove"),o||s.push("NewAbove"),a||s.push("ExistingBelow"),o||s.push("NewBelow"),s}function yI(e,t,i){let s=[],r=i.allPlots[t.index];if(r?.type!==X[t.type])return s;let n=r.axis.pane,a=r.axis===n.axes[0],o=n.axes.some(e=>e.plots.some(e=>r!==e&&!e.hasDetachedScale)),l=r.hasDetachedScale;return(a||l)&&s.push("SecondaryAxis"),(!a||l)&&s.push("PrimaryAxis"),o&&s.push("NoAxis"),s}function yD(e,t){let i=e.panes[t],s=i.axes.map(e=>e.plots.reduce((e,t)=>e+ +!!t.detachedScale,0)),r=i.axes.length;return i.axes.forEach((e,t)=>{let n=s[t],a=e.plots.length;if(0!==n&&!(n<a)&&n===a)if(r>1&&1===n){let n=(t+1)%r;if(s[n]<i.axes[n].plots.length){let t=e.plots.find(e=>e.detachedScale);t&&(i.axes[n].plots.push(t),e.plots=e.plots.filter(e=>!e.detachedScale),s[n]++)}}else{let t=e.plots.find(e=>e.detachedScale);t&&(t.detachedScale=!1)}}),e}function yw(e,t){let i=e.allPlots[t],s=e.panes.indexOf(i.axis.pane),r=e.panes[s].axes.indexOf(i.axis),n=e.panes[s].axes[r].plots.findIndex(e=>e===i);return{pane:s,axis:r,plot:n}}let yR={MainPlot:n1,Aggregation:{Update:n4,Get:function(e,t,i){return eG(e.data.aggregation)}},Period:{Update:function(e,t,i){let s=eH(t.period),r=eH(t.range),n=eH(t.density);if(+!!s+ +!!r+ +!!n>1)throw Error("Cannot set more than one of: period, range, density.");if(s&&(e.display.period=t.period,nE(e),nM(e)),r)if((!eH(e.display.period)||n7(e.display.period))&&(e.display.xAxis.visibleRange=t.range),n_(e),nM(e),eH(i)){let s=function(e){let t=e.getDataStats();return null===t?null:t.dataRange}(i),r=ny(e.data.aggregation),n=i.data.aggregation,a=r.unit!==n.unit||r.size!==n.size||r.spec!==n.spec||!eH(s)||e.data.checkRange,o=a;if(!a){let{from:e,to:i}=s,{from:r,to:n}=t.range;o=r<e||r>i||n<e||n>i}o&&(e.data.range=t.range),delete e.data.checkRange}else e.data.checkRange=!0;return n&&(e.display.density=t.density,nE(e),n_(e)),(s||r||n)&&(nC(e),i&&(i.forceResetVisibleRange=!0)),e},Delete:function(e,t,i){return eH(t.period)&&t.period&&(delete e.display.period,n2(e),i&&(i.forceResetVisibleRange=!0)),e}},Crosshair:{Update:function(e,t){let[i,s]=eB(t.crosshair),{color:r,dashStyle:n}=t.horizontal||{},{color:a,dashStyle:o}=t.vertical||{},l=(e,t,i)=>{t&&(e.color=t),i&&(e.dashStyle=i)},u=sz(e,".display.xAxis.crosshair",e=>(e.enabled=i,l(e,a,o),e));return u=sz(u,".display.yAxis.crosshair",e=>(e.enabled=s,l(e,r,n),e)),eH(t.haloTracking)&&"boolean"==typeof t.haloTracking&&(u=sz(u,".display.chart",e=>(e.plotHover=t.haloTracking,e))),u},Get:function(e,t,i){let s=t=>sG(e,t)[0],r=s(".display.chart"),n=s(".display.xAxis.crosshair"),a=s(".display.yAxis.crosshair"),o="none";return n.enabled&&a.enabled?o="both":n.enabled?o="vertical":a.enabled&&(o="horizontal"),{crosshair:o,horizontal:{color:a.color,dashStyle:a.dashStyle},vertical:{color:n.color,dashStyle:n.dashStyle},haloTracking:r.plotHover}}},Tooltip:{Update:function(e,t){return sz(e,".display.tooltip",e=>(null!=t.visible&&(e.visible=t.visible),t.mode&&(e.mode=t.mode),null!=t.showMainTitle&&(e.showMainTitle=t.showMainTitle),t.mainTitle&&(e.mainTitle=t.mainTitle),e))},Get:function(e,t,i){let s=sG(e,".display.tooltip")[0];return{visible:s.visible,mode:s.mode,showMainTitle:s.showMainTitle,mainTitle:s.mainTitle}}},Events:function(e,t){let i=eG(t);return Object.keys(t).forEach(e=>{tG.EVENTS.includes(e)||delete i[e];let s=t[e];"boolean"==typeof s?s={show:t[e]}:Object.keys(s).forEach(e=>{tG.EVENT_PROPERTIES.includes(e)||delete s[e]}),i[e]=s}),sz(e,nY,e=>("Symbol"===e.type&&(e.events=e.events||{},Object.keys(i).forEach(t=>{e.events[t]=e.events[t]||{},ez(e.events[t],i[t],!1)})),e))},Scale:{Update:function(e,t){let i=sz(e,"..panes[0]..axes",e=>(eV(t.scale)&&(e.scale=t.scale),e));return i=sz(i,".display.xAxis",e=>(eV(t.marginBars)&&(e.marginBars=t.marginBars),eV(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),eV(t.ordinalName)&&(e.ordinalName=t.ordinalName),eV(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e)),i=sz(i,".display.yAxis",e=>{(eH(t.minPadding)||eH(t.maxPadding))&&yK("The 'minPadding' and 'maxPadding' are deprecated (ignored)","warn");let i=eV(t.preventLabelOverlap)&&!eV(t.preventVerticalLabelOverlap);i&&yK("The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'","warn");let s=i?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return eV(s)&&(e.preventLabelOverlap=s),eH(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),eH(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),e}),eH(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach(e=>{let{axis:t,text:s,index:r,paneIndex:n}=e;eH(t,s,r)&&"vertical"===t&&Number.isInteger(r)&&(i=sz(i,`..panes[${n??0}]..axes[${r}]`,e=>eH(e)?(e.label=s,e):tG.NULL_OBJECT))}),eV(t.contractTransition)&&(i=sz(i,".display.xAxis",e=>(ez(e.contractTransition,t.contractTransition),e))),eV(t.cycleTransition)&&(i=sz(i,".display.xAxis",e=>(ez(e.cycleTransition,t.cycleTransition),e))),i},Get:function(e,t,i){let{mainAxis:s}=nK(e),r=sG(e,".display.xAxis")[0],n=sG(e,".display.yAxis")[0];return{scale:s.scale,marginBars:r.marginBars??0,preventLabelOverlap:n.preventLabelOverlap,preventVerticalLabelOverlap:n.preventLabelOverlap,preventHorizontalLabelOverlap:r.preventLabelOverlap,snapAnnotationsToPrices:n.snapAnnotationsToPrices,nonEodLabelWithDate:r.nonEodLabelWithDate??!1,includePercentChangeWithLastValue:n.includePercentChangeWithLastValue??!1,ordinalName:r.ordinalName??"",contractTransition:r.contractTransition,cycleTransition:r.cycleTransition}}},Other:{Update:function(e,t,i){let s=e;if(eH(t.comparisonMode)&&"string"==typeof t.comparisonMode&&eW(K,t.comparisonMode)&&(s=sz(s,`..panes{${nY}}.axes`,e=>(e.comparison=t.comparisonMode,e))),eH(t.gridLines)){let[e,i]=eB(t.gridLines);s=sz(s,".display.xAxis.gridLines",t=>(t.visible=e,t)),s=sz(s,".display.yAxis.gridLines",e=>(e.visible=i,e))}if(eH(t.minorGridLines)){let[,e]=eB(t.minorGridLines);s=sz(s,".display.yAxis.minorGridLines",t=>(t.visible=e,t))}eH(t.newPaneHeight)&&"number"==typeof t.newPaneHeight&&(s=sz(s,".display.chart{.newPaneHeight > 0}",e=>(e.newPaneHeight=t.newPaneHeight,e))),eH(t.showNavigator)&&"boolean"==typeof t.showNavigator&&(s=sz(s,".display.scrollbar",e=>(e.visible=t.showNavigator,e))),eH(t.plotHover)&&"boolean"==typeof t.plotHover&&(s=sz(s,".display.chart",e=>(e.plotHover=t.plotHover,e))),eH(t.showLastValue)&&"string"==typeof t.showLastValue&&(s=sz(s,".display.yAxis",e=>(e.showLastValue=t.showLastValue,e))),eH(t.showMinMaxArc)&&"boolean"==typeof t.showMinMaxArc&&(s=sz(s,".display.chart",e=>(e.showMinMaxArc=t.showMinMaxArc,e))),eH(t.showGoToLatest)&&"boolean"==typeof t.showGoToLatest&&(s=sz(s,".display.chart",e=>(e.showGoToLatest=t.showGoToLatest,e))),eH(t.showLegend)&&"boolean"==typeof t.showLegend&&(s=sz(s,".display.chart",e=>(e.showLegend=t.showLegend,e)),t.showLegend||i.view.removeLegend()),eH(t.allAnnotationsLocked)&&"boolean"==typeof t.allAnnotationsLocked&&(s=sz(s,".display",e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e))),eH(t.exprSkipLeadingEmpty)&&"boolean"==typeof t.exprSkipLeadingEmpty&&(s=sz(s,".data",e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e)));let r=[];if(eH(t.extendedHours)&&"boolean"==typeof t.extendedHours&&(s=sz(s,".data",e=>(e.extendedHours=t.extendedHours,e))),eH(t.realTimeCboeBzx)&&"boolean"==typeof t.realTimeCboeBzx&&(s=sz(s,".data",e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&r.push("realTimeCboeBzx"),e.realTimeCboeBzx=t.realTimeCboeBzx,e))),eH(t.buildContinuation)&&"boolean"==typeof t.buildContinuation&&(s=sz(s,".data",e=>(e.buildContinuation=t.buildContinuation,e))),r.length>0){let e={chart:i.accessor,hostPropsChanged:r};i.notifyHost(ao.CH_HOST_PROPS_CHANGED,e)}return s},Get:function(e,t,i){let s=sG(e,`..panes{${nY}}.axes.comparison`)[0],r=e.display,n=(e,t)=>e$(e,!1,t,"visible"),a=e=>(function(e,t){let i=e=>eH(e)&&"boolean"==typeof e&&e,s=i(e),r=i(t);return s&&r?"both":s?"vertical":r?"horizontal":"none"})(n(r.xAxis,e),n(r.yAxis,e)),o=e$(r.chart,!0,"showLegend");return{comparison:s,gridLines:a("gridLines"),minorGridLines:a("minorGridLines"),newPaneHeight:r.chart.newPaneHeight,showLastValue:r.yAxis.showLastValue,showLegend:o,showMinMaxArc:r.chart.showMinMaxArc,allAnnotationsLocked:r.allAnnotationsLocked,exprSkipLeadingEmpty:e.data?.exprSkipLeadingEmpty??!1,extendedHours:e.data?.extendedHours??!1,realTimeCboeBzx:e.data?.realTimeCboeBzx??!1,buildContinuation:e.data?.buildContinuation??!1}}},Plot:{Add:function(e,t){switch(t.type){case"Study":return function(e,t){let i=sw(t.studyId);if(!eV(i))return yK(`Unknown or unavailable study with the id '${t.studyId}'`,"error"),e;let s=nj(e),r=sH(i);if(s.type===X[X.Expression]&&r)return yK(`Cannot add study "${i.meta.title}" because it cannot be based on an expression (current main plot); study needs more than "OHLCV" fields to be calculated.`,"error"),e;let n=t.placement||(i.meta.overlay?"overlay":"standalone"),a={type:"Study",study:t.studyId,visible:!0};"overlay"===n&&"VOL"===t.studyId&&(a.detachedScale=!0),void 0!==t.curves&&(a.curves=i.defaults.curves),yl(a,t);let o=yg(e,n,t.cloneIndex);eH(o)&&o.plots.push(a);let l=e.data.aggregation;return n3(e,"Tick"===l.unit&&"None"===l.spec)}(e,t);case"IncomeStatement":case"BalanceSheet":return function(e,t){let i=nj(e);if(i.type!==X[X.Symbol])throw Error("Cannot add fundamental to the chart whose main plot is not a Symbol plot.");let s=i.symbol,r={curves:[{fields:[t.fundamentalId],lineWidth:2,style:"Line",varyColorPerBar:!1,visible:!0,colors:["#888"]}],fundamental:"Quarter",symbol:s,type:j[aa[t.fundamentalId].category],visible:!0};return yl(r,t),e.panes.push({axes:[{plots:[r]}]}),e}(e,t);case"Expression":let i=nj(e),s={curves:eG(yT(i)?i.curves:yy),expression:"",type:"Expression",visible:!0};return yl(s,t),ym(e,t).plots.push(s),e;case"Symbol":return function(e,t){let i=nj(e),s=y0().getDefaultMultiFieldCurve(),r=eH(s)?s:yA,n=i.curves?.length,a={curves:n===t.curves.length&&1===n?eG(yT(i)?i.curves:[r]):t.curves,symbol:"",type:"Symbol",visible:!0};return yl(a,t),ym(e,t).plots.push(a),e}(e,t);default:throw Error("Unexpected plot type '${type}', not supported currently")}},Get:yo,Delete:ya,Update:function(e,t,i){if(eH(t.placement)&&!yc.includes(t.placement))throw Error(`Unknown placement: ${t.placement}`);let s=t.main?nY:yu(t.index),r=yh(e,s);if(!eV(r)||eV(t.type)&&r.type!==t.type)return e;if(eV(t.visible))return r.visible=t.visible,e;if(r.main&&function(e){let t=X[e.type];return t===X.Symbol||t===X.Expression}(r)){if(t.curves){let i=e=>e.curves[0].style===W[W.Range],[s,n]=[i(r),i(t)];s&&!n?e=n4(e,{unit:"Day",size:1,spec:"None"}):!s&&n&&(e=n4(e,{unit:"Intraday",size:100,spec:"PerRange"}))}return t.type||(t.type=r.type),eH(t.precision)?r.precision=t.precision:delete r.precision,eH(t.showPrevious)&&(e=sz(e,nY,e=>(e.showPrevious=t.showPrevious,e))),t.curves?nI(e,t):e}{let r=sz(e,s,e=>(yl(e,t),e)),n=yo(r,t,i).find(e=>e.index===t.index);if(!eH(n))return e;if(!(t.type===X[X.Study]&&eH(t.placement)&&t.placement!==n.placement))return r;let a=yh(r,s),o=yg(r=ya(r,{id:"Delete",plots:[{index:t.index,type:t.type}]}),t.placement);return null!==o&&o.plots.push(a),r}}},Compare:{Update:function(e,t){let{yes:i,no:s}=eT((eH(t.symbols)&&(yK("Use of 'symbols' for Compare API is deprecated. Please see docs for the latest version which supports more plot types","warn"),t.plots=t.symbols.map(e=>(e.type=yb,e))),t.plots?.some(e=>eH(e.leftScale)))?(yK("Use of 'leftScale' for Compare API is deprecated. Please use 'oppositeScale'","warn"),t.plots.map(e=>{let t=e.leftScale;return delete e.leftScale,{...e,oppositeScale:t}})):t.plots,e=>e.oppositeScale??!1),{mainPane:r,mainAxis:n}=nK(e);r.alignOnExpirations=t.alignOnExpirations||!1;let a=yE(r,n),o=e=>![yb,"Expression"].includes(e.type);a.plots=a.plots.filter(o);let l=n.plots.filter(e=>e.main||o(e)),u="Tick"===e.data.aggregation.unit;yS=0;let h=eu(yP,u);return n.plots=l.concat(s.map(h)),i.length>0&&(a.plots.push(...i.map(h)),a.comparison=n.comparison,a.scale=n.scale),at(e)},Get:function(e,t){let i=sG(e,yC),{mainPane:s,mainAxis:r}=nK(e),n=[];for(let e of i){let t=r.plots.includes(e),i=e.type.toLowerCase(),s={curves:eG(e.curves),type:e.type,[i]:e[i],leftScale:!t};n.push(s)}return{plots:n,alignOnExpirations:s.alignOnExpirations}}},Annotation:{Get:function(e,t,i){let s=sG(e,"..panes").map((e,t)=>sG(e,"..axes").map((e,i)=>sG(e,".annotations").map(e=>({...e,paneIndex:t,axisIndex:i})))).flat(2).map((e,t)=>({...e,index:t}));return eH(t.index)&&Number.isFinite(t.index)?t.index<s.length?[s[t.index]]:tG.EMPTY_ARRAY:s}},MovePane:function(e,t){let i=e.panes;return i.splice(t.to,0,i.splice(t.from,1)[0]),e},Template:function(e,t){let i=eG(e);if(t.strip.main){let e=nj(i),t=e.type.toLowerCase();e[t]=tG.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(i=yM(i)),t.strip.compare&&(i=yL(i)),i=sz(i,".data",e=>(e.range&&(delete e.range,e.checkRange=!0),e))},Outline:function(e,t,i){let s=yo(e,{main:!0},i)[0],r=s.title===tG.PLACEHOLDER_SYMBOL_NAME,n="Symbol"===s.type,a="Expression"===s.type,o=nF(s.title),l=[];return a&&!nH(o)?l=o.symbols:r||(l=[s.title]),{isTemplate:r,isDefinition:!r,main:{isSymbol:n,isExpression:a,symbols:l,title:r?null:s.title},compare:sG(e,yC).map(e=>e.symbol),annotations:sG(e,"..annotations").map(e=>e.id),studies:yo(e,{type:"Study"},i).map(e=>e.title)}},Theme:{Update:function(e,t){let i=e,{backgroundColor:s,axis:{gridLinesColor:r,textColor:n,crosshairColor:a,gridLinesStyle:o},fontSize:l}=t,{chart:u,xAxis:h,yAxis:c}=l||{};if((s||u)&&(i=sz(e,".display.chart",e=>(s&&(e.backgroundColor=s),u&&(e.fontSize=u),e))),r){let e=e=>(e.color=r,e);i=sz(i,".display.xAxis.gridLines",e),i=sz(i,".display.yAxis.gridLines",e),i=sz(i,".display.yAxis.minorGridLines",e)}if(o){let e=e=>(e.dashStyle=o,e);i=sz(i,".display.xAxis.gridLines",e),i=sz(i,".display.yAxis.gridLines",e),i=sz(i,".display.yAxis.minorGridLines",e)}if(n){let e=e=>(e.textColor=n,e);i=sz(i,".display.xAxis",e),i=sz(i,".display.yAxis",e)}if(a){let e=e=>(e.color=a,e);i=sz(i,".display.xAxis.crosshair",e),i=sz(i,".display.yAxis.crosshair",e)}if(h||c){let e=e=>t=>(t.fontSize=e,t);h&&(i=sz(i,".display.xAxis",e(h))),c&&(i=sz(i,".display.yAxis",e(c)))}return i},Get:function(e,t,i){let{chart:s,xAxis:r,yAxis:n}=e.display||{},{fontSize:a,backgroundColor:o}=s||{},{fontSize:l,gridLines:u,textColor:h,crosshair:c}=r||{},{color:d,dashStyle:p}=u||{},{fontSize:f}=n||{},{color:m}=c||{};return{backgroundColor:o,axis:{gridLinesColor:d,textColor:h,crosshairColor:m,gridLinesStyle:p},fontSize:{chart:a,xAxis:l,yAxis:f}}}},Clear:function(e,t,i){let{paneIndex:s,annotations:r,studies:n}=t||{},a=Number.isInteger(s)?`[${s}]`:"",o=`..panes${a}`,l=e,u=e=>tG.NULL_OBJECT;return!0===r&&(i.allAnnotations.forEach(e=>i.onAnnotationModifiedByTool(e,eo.Deleted,!1)),l=sz(l,`${o}..annotations`,u)),!0===n&&(l=sz(l,`${o}..plots{.type=="Study"}`,u)),l=at(l)},Previous:{Update:function(e,t,i){return sz(e,yx,e=>(ez(e,t),e))},Get:function(e,t,i){return sG(e,yx)[0]}},MovePlot:{Update:function(e,t,i){if(!yO(e,t,i).includes(t.targetPane))return e;let s=yw(i,t.index),r=yh(e,yu(t.index));e.panes[s.pane].axes[s.axis].plots.splice(s.plot,1);let n=s.pane,a=!0;switch(t.targetPane){case"ExistingAbove":n--;break;case"NewAbove":e.panes.splice(n,0,yp(e)),a=!1;break;case"ExistingBelow":n++;break;case"NewBelow":n++,a=!1,e.panes.splice(n,0,yp(e))}a&&i.panes[n].isMain&&r?.type==="Study"&&"VOL"===r.study&&(r.detachedScale=!0);let o=e.panes[n];o.axes.length<2&&o.axes[0].plots.length>0&&o.axes.push(yd());let l=o.axes.findIndex(e=>0===e.plots.length),u=-1===l?o.axes.length-1:l;o.axes[u].plots.push(r);let h=yD(e,s.pane);return at(h=yD(h,n))},Get:yO},PinPlot:{Update:function(e,t,i){if(!yI(e,t,i).includes(t.targetAxis))return e;let s=yw(i,t.index),r=e.panes[s.pane],n=yh(e,yu(t.index)),a=-1;switch(t.targetAxis){case"PrimaryAxis":a=0;break;case"SecondaryAxis":a=1;break;case"NoAxis":n.detachedScale=!0}if(-1!==a)if(a!==s.axis)delete n.detachedScale,r.axes.length<2&&a>0&&r.axes.push(yd()),r.axes[a].plots.push(n),r.axes[+(0===a)].plots.splice(s.plot,1);else{let e=r.axes[s.axis].plots[s.plot];delete e.detachedScale}return at(yD(e,s.pane))},Get:yI}};function yN(e){return"function"==typeof e}function yV(e,t,i){return(function(e,t){let i=yR[e];if(yN(i))return i;{let e=void 0!==t?i[t]:void 0;if(!yN(e)&&!yN(e=i[tG.DEFAULT_ACCESSOR_SUBACTION]))throw Error("Invalid accesor id and/or sub id");return e}})(e.id,e.context.id)(t,e.context,i)}function yH(e){return{id:"MainPlot",context:e}}let yF={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},yk=Symbol.for("__ias__");class yB{headless;presenter;_model;constructor(e=!1){this.headless=e,this.presenter=e?null:new yt(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)return void console.error("You cannot initialize a headless chart.");if(this.presenter.initialize(e),eV(t)){let e="string"==typeof t;e?yK("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 i=e?{symbol:t}:t;this.change(yH(i))}}shutdown(){if(!this.headless){let e=this.presenter?.shutdown();return this.presenter=null,e}return!1}annotate(e,t=null,i=null){if(!this.headless)if(eH(e)){s8(e,t),s7(e,t);let s=gC(e,!1,t,i,this.presenter);s.isDrawingAnnotation&&this.presenter.view.setCursor(Q.Crosshair),this.presenter.activeTool=s,eI()||this.presenter.view.mouseCanvas.focus({preventScroll:!0})}else this.presenter.resetActiveTool()}cancelAnnotation(){this.headless||this.presenter.resetActiveTool()}zoom(e){this.headless||"boolean"!=typeof e||(e?this.annotate("ZoomIn"):this.presenter.defaultTool.resetView(this.presenter))}getDefaultTemplate(){return y1()}get model(){return(this.headless?this._model:this.presenter.getModel())||y1()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:tG.ACTION_TEMPLATE,context:{strip:e}})}change(...e){let t={chart:this,actions:e.filter(e=>!e[yk])};t.actions.length>0&&this.presenter?.notifyHost(ao.CH_API_ACTIONS_RECEIVED,t);let i=y0().config.validateInput,s=e.map(e=>i?ae(e,tG.ACCESSOR_SCHEMA):e);if(1===s.length){let e=s[0];if(e.id===tG.ACTION_TEMPLATE||e.context.id===tG.ACTION_GET)return yV(e,this.model,this.presenter);if(!this.headless&&e.id===tG.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}let{yes:r,no:n}=eT(s,e=>e.id===tG.ACTION_PLOT&&eH(e.context)&&e.context.id===tG.ACTION_DELETE),a=eG(this.model),o=eG(this.model);r.length>0&&n.push({id:tG.ACTION_PLOT,context:{id:tG.ACTION_DELETE,plots:r.map(e=>e.context)}}),n.forEach(e=>{if(!eH(o=yV(e,o,this.presenter)))throw Error("Forgot to return model from accessor")}),this.fromModel(o,a)}async fromModel(e,t){let i=ae(e,tG.CHART_SCHEMA);this.headless?this._model=i:await this.presenter?.fromModel(i,t)}async load(e,t){let i={...yF,...t},s=ae(JSON.parse(e),tG.CHART_SCHEMA),r=this.model,n=eG(r);if(eH(r)){if(s=function(e,t,i){let s=nj(t),r=s.type.toLowerCase();if(s[r]===tG.PLACEHOLDER_SYMBOL_NAME){let s=nj(e),{mainAxis:r}=nK(t),n=r.annotations,a=n1(t,s);if(i){let{mainAxis:e}=nK(a);e.annotations=n}return a}return t}(r,s,i.keepNewAnnotations),i.keepNewAnnotations||(s=yM(s)),i.keepOldAnnotations&&(s=function(e,t){let{mainAxis:i}=nK(e),{mainAxis:s}=nK(t);g3(i,s);let r=e=>sG(e,'..plots{.type==="Study"}.study')[0],n=sG(e,g4).filter(e=>e!==i),a=sG(t,g4).filter(e=>e!==s);return n.forEach(e=>{let t=r(e),i=a.find(e=>t===r(e));eH(i)&&g3(e,i)}),t}(r,s)),i.keepNewCompare||(s=yL(s)),i.keepOldCompare&&(s=function(e,t){let i=sG(e,yC),s=sG(t,yC),r=Math.max(0,4-s.length);if(0===r)return t;let n=i.filter(e=>!s.find(t=>e.symbol===t.symbol)).slice(0,r);if(0===n.length)return t;let{mainPane:a,mainAxis:o}=nK(t),{mainAxis:l}=nK(e);return n.forEach(e=>{l.plots.includes(e)?o.plots.push(e):yE(a,o).plots.push(e)}),t}(r,s)),i.keepOldAggregation){let e={id:tG.ACTION_AGGREGATION,context:r.data.aggregation},t=s.display.density;s=yV(e,s,this.presenter),i.keepNewBarWidth&&eH(t)&&(s.display.density=t)}await this.fromModel(s,n),this.clearUndoRedo()}}save(){return JSON.stringify(this.model)}clearUndoRedo(){this.headless||this.presenter.undoRedoManager.clear(!0)}reset(e=!0){let t=y1();if(this.headless)this._model=t;else if(this.presenter.getModel()){let i=this.presenter.mainPlot,s=null;if(i.isSymbol?s={symbol:i.symbol}:i.isExpression?s={expression:i.expression}:i.isForward?s={forward:i.forward}:i.isSeasonal&&(s={seasonal:i.seasonal}),eH(s)){let i=yV({id:"Theme",context:{id:"Get"}},this.model,this.presenter),r=yV(yH(s),t,this.presenter);e&&(r=yV({id:"Theme",context:i},r,this.presenter)),this.presenter?.fromModel(r)}}this.clearUndoRedo(),this.presenter?.notifyHost(ao.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){yK("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:g8.call(this.presenter,e)}exportImage(e={}){return this.headless?null:g9.call(this.presenter,e)}getDataStats(){return this.presenter.getDataStats()}get canUndo(){return!this.headless&&this.presenter.undoRedoManager.canUndo}get canRedo(){return!this.headless&&this.presenter.undoRedoManager.canRedo}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,i=0){let s=this.presenter;if(this.headless||t<0||i<0||t>s.panes.length)return null;let r=s.panes[t];return i>r.axes.length?null:r.axes[i].toY(e)}yToPrices(e){let t=this.presenter;if(this.headless)return null;for(let[i,s]of t.panes.entries()){let t=s.getBounds();if(eH(t)&&e>=t.y&&e<=t.y+t.height)return{pane:i,prices:s.axes.map(t=>t.toPrice(e))}}return{pane:-1,prices:[]}}activate(){this.presenter?.notifyHost(ao.CH_DIDBECOMEACTIVE,{chart:this})}}var cs=R("c15IW");function yU(e,t,i,s,r){void 0===s&&(s=0),void 0===r&&(r=!1);var n=t.schedule(function(){i(),r?e.add(this.schedule(null,s)):this.unsubscribe()},s);if(e.add(n),!r)return n}function yW(e,t){return e+Math.random()*(t-e)}let y$=Function(atob("Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg")),yG=Function("f",atob("Zi5yZW1vdmVBbGxDaGFydHMoKTsg")),yz=Function("m",atob("cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiOw=="));async function yY(e,t){if(t&&!yz(e.mode))return;let i=!1,s=0,r=25;for(;!i&&s<5;){let t=function(){let e=globalThis.parent?.location?.hostname||"";return["","localhost","127.0.0.1"].includes(e)||function(e){let t=e.split(".");if(!t||4!==t.length)return!1;let i=t.map(Number);if(!i.every(e=>Number.isFinite(e)&&e>=0&&e<=255))return!1;let[s,r]=i;return 10===s||172===s&&r>=16&&r<=31||192===s&&168===r}(e)}()||"FreeWidget"===e.mode,n=t?e.apiKey:"";try{let r=t?"":function(){let e=document.domain,t=e.split("."),i="__tld"+new Date().getTime(),s=0;for(;s<t.length-1&&-1===document.cookie.indexOf(`${i}=${i}`);)e=t.slice(-1-++s).join("."),document.cookie=`${i}=${i};domain=${e};`;return document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=${e};`,e}(),a=function(e,t=""){return function(e,t){Object.keys(t).forEach(e=>!eH(t[e])&&delete t[e]);let i=new URLSearchParams(t);return`${e}/?${i.toString()}`}(atob("aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ=="),{module:atob("YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy"),secret:t,referer:e})}(r,n),o=await fetch(a);if(o.ok){let t=await o.json(),s=t[atob("YXV0aG9yaXplZA==")];e.knownSite=s,s?(e.dataEndpoint=(t[atob("ZGF0YS1lbmRwb2ludA==")]||"").replace(/\/$/g,""),e.allowCredentials=t[atob("YWxsb3dDcmVkZW50aWFscw==")]):(e.dataEndpoint="",e.allowCredentials=!1),i=!0;break}s++}catch{}s++,r*=2,await new Promise(e=>setTimeout(e,r))}i&&e.knownSite||(setTimeout(y$,yW(2e3,3e3)),setTimeout(()=>yG(y0()),yW(4e3,5e3)))}var yj={};function yK(e,t="info",i=""){let s=globalThis.console,r=void 0!==s[t];s[r?t:"log"](e,i)}yj=JSON.parse('{"major":2,"minor":345,"patch":0,"prerelease":false}');let yq={environment:"Browser",validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${tG.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,baseUrl:{instruments:"/proxies/instruments",futures:"/proxies/futures",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 i=this.baseUrl[e],s=`${i}${t}`;if(yz(this.mode)&&this.knownSite){let{username:r,password:n}=this.credentials||{},a=eH(r,n),o=("timeseries"===e||"timeseriesNew"===e)&&a&&this.allowCredentials?`&username=${r}&password=${n}`:"";s=`https://${this.dataEndpoint}${i}${t}${o}`}let r=await fetch(s);return await r.text()},getCustomEventPopup:e=>null};async function yX(e,t){let i=y0()?.config;if(!i||!i.fetch)throw Error("You should call initFeed first");let s=t;return"timeseries"===e?s=`/historical${t}`:"options"===e&&(s=`/options-historical${t}`),await i.fetch.call(i,e,s)}let yZ=!1,yJ=null;function yQ(t,i={}){if(yZ)throw Error("You should only call initFeed once during page's lifetime");yZ=!0;let s=Object.assign(yq);return ez(s,i),eV(s.logo)&&function(e,t){let i=new DOMParser().parseFromString(e,"image/svg+xml"),s=i.querySelector("svg")?.getAttribute("viewBox"),r=i.querySelector("path")?.getAttribute("d");if(eV(s)&&eV(r)){let e=s.split(" ").map(Number);4===e.length&&e.every(Number.isFinite)&&(mx={path:new Path2D(r),width:e[2],height:e[3],rect:new iD(0,0,0,0),logoClickable:t})}}(s.logo,s.logoClickable??!1),!function(e){var t;let i=e.extensions?.studyProvider;if(!eH(i))return;let s=i.getFields(),r=i.getStudies(),n=eG(s_(tG.CHART_SCHEMA)),a=n.definitions,o=a.studyField.enum,l=a.study.enum;for(let e of s)if(o.includes(e.id))throw Error(`Field with id ${e.id} already exists`);for(let e of r)if(l.includes(e.id))throw Error(`Study with id ${e.id} already exists`);o.push(...s.map(e=>e.id)),l.push(...r.map(e=>e.id)),t=tG.CHART_SCHEMA,n9.addSchema(t,n),an(s),sO(r)}(s),(yJ=new t(s)).version=function(){let t=e(yj),i=t.prerelease?`-${t.prerelease.identifier}.${t.prerelease.ordinal}`:"";return`${t.major}.${t.minor}.${t.patch}${i}`}(),yK(`%cBarchart Chart version ${yJ.version}`,"info","font-size: larger"),yJ.cachesData&&(yJ.subject?.subscribe(yJ.onPerformInternalGc.bind(yJ)),e(cs).subscribe(ao.CH_ALL,yJ.onChartChanged.bind(yJ))),yJ}function y0(){return yJ}function y1(){return eG(y0()?.template)}function y2(){eV(yJ)&&(yJ.shutdown(),yZ=!1,yJ=null)}function y3(e){let t=new yB(!0);return t.load(e),t.change({id:"Outline",context:{id:"Get"}})}function y4(e,t,i,s=null){return new Proxy(e,{get:function(e,r,n){return r===t?function(t){let n=s?t[s]:t;return(i.handlesRequestsFor(n)?i:e)[r](t)}:Reflect.get(e,r,n)}})}class y5{config;version;cachesData;timeSeriesSource;metaDataSource;recordSource;charts;pendingRedraw;template;ongoingAnimationCallbackId;_altDataSource;_subject;knowDefaultCurve;defaultOhlcCurve;knowDefaultAggregation;defaultAggregation;knowDefaultPeriod;defaultPeriod;knowDefaultDensity;defaultDensity;id;_mainFeed;constructor(e){this.config=e,this._mainFeed=null,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=e0()}get subject(){return this.isAuxiliary||eV(this._subject)||(this._subject=new or().pipe(function(e){for(var t,i,s=[],r=1;r<arguments.length;r++)s[r-1]=arguments[r];var n=null!=(t=ot(s[s.length-1])?s.pop():void 0)?t:az,a=null!=(i=s[0])?i:null,o=s[1]||1/0;return oa(function(t,i){var s=[],r=!1,l=function(e){var t=e.buffer;e.subs.unsubscribe(),aN(s,e),i.next(t),r&&u()},u=function(){if(s){var t=new aV;i.add(t);var r={buffer:[],subs:t};s.push(r),yU(t,n,function(){return l(r)},e)}};null!==a&&a>=0?yU(i,n,u,a,!0):r=!0,u();var h=oo(i,function(e){var t,i,r=s.slice();try{for(var n=aL(r),a=n.next();!a.done;a=n.next()){var u=a.value,h=u.buffer;h.push(e),o<=h.length&&l(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}},function(){for(;null==s?void 0:s.length;)i.next(s.shift().buffer);null==h||h.unsubscribe(),i.complete(),i.unsubscribe()},void 0,function(){return s=null});t.subscribe(h)})}(tG.INTERNAL_GC_MILLIS),oc(e=>e.length>0))),this._subject}get isAuxiliary(){return null!==window.opener}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=y4(this.timeSeriesSource,"getTimeSeries",e,"symbol"),this.metaDataSource=y4(this.metaDataSource,"getMetaData",e),this.recordSource=y4(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(!eV(this.timeSeriesSource))throw Error("No time series source defined");return this.timeSeriesSource}getMetaDataSource(){if(!eV(this.metaDataSource))throw Error("No metadata source defined");return this.metaDataSource}getRecordSource(){if(!eV(this.recordSource))throw Error("No record source defined");return this.recordSource}async ready(){return tU.call(this,async()=>{await yY(this.config,this instanceof Te||this instanceof y6||this instanceof Tr);let e=this.config.defaultTemplate;if(!e)throw Error("Must provide a default template");if("string"==typeof e){let t=await fetch(e);e=await t.json()}return this.template=ae(e,tG.CHART_SCHEMA),!0})}getHeadlessChart(){return new yB(!0)}fixupRenderTo(e){if(!eV(e))return null;if(e instanceof HTMLElement)return e;let t=tw(`#${e}`);if(eV(t))return t;let i=[...this.charts.keys()].find(t=>t.id===e);return eV(i)?i:null}checkChart(e,t){let i=this.fixupRenderTo(e),s=eV(i)&&this.charts.has(i);return eV(t)&&t!==s&&yK(`There is ${t?"no":"already a"} chart inside the element ${e}`,"error"),i}addChart(e,t=null){let i=this.checkChart(e,!1),s=new yB;return this.charts.set(i,s),s.initialize(e,t),s}removeChart(e){let t=this.checkChart(e,!0);eV(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 eV(t)?this.charts.get(t):null}redraw(e){let t=this.checkChart(e,!0);eV(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),eV(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach(e=>{let t=this.getChart(e);if(!eV(t?.presenter?.view))return;let i=t.presenter.view;i.isHostElementVisible&&i.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=>{eV(t)&&(eV(t.record)?e.records.add(t.record):eH(t.records)&&Object.values(t.records).forEach(t=>e.records.add(t)))}),e}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){this.getTimeSeriesDataSource().refresh(),eR(ao.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.evictUnused(e)}triggerGc(){this.subject?.next()}onChartChanged(e,t){(e===ao.CH_RECREATED||e===ao.CH_SHUTDOWN)&&(this.isAuxiliary?this._mainFeed?.triggerGc():this.triggerGc())}getDefaultMultiFieldCurve(){if(!eV(this.template))return null;if(!this.knowDefaultCurve){let e=nj(this.template);1===e.curves.length&&function(e){switch(W[e]){case W.OHLC:case W.HLC:case W.Candlestick:case W.HollowCandles:case W.HeikinAshi:case W.ElderImpulseSystem:case W.Range:case W.MultiColumn:return!0;default:return!1}}(e.curves[0].style)?this.defaultOhlcCurve=eG(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=eG(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(){this.isAuxiliary||this.clearCaches(),this.removeAllCharts()}}class y6 extends y5{constructor(e){super(e),this.timeSeriesSource=new uJ(!1),this.metaDataSource=new ia,this.recordSource=new lP}}class y7 extends y5{constructor(e){super(e),this.timeSeriesSource=new uJ(!0),this.metaDataSource=new ia,this.recordSource=new lC}}class y8 extends y5{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new uJ(!0),this.metaDataSource=new ia,this.recordSource=new lP}}let y9=["drazen.dotlic@barchart.com","princec","b.hebert24@barchart.com"];class Te extends y5{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;_connection;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new uJ(!0),this.metaDataSource=new io,this.recordSource=new lE,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,eV(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){eV(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&&y9.includes(this.connection._username)&&yK(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===tG.BC_EVENT_DISCONNECTED||e===tG.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):(e===tG.BC_EVENT_LOGGED_IN||e===tG.BC_EVENT_FEED_RESUMED)&&(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),eV(this._connection)&&(this.connection.off("timestamp",this.onTimestamp),this.connection.off("events",this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}}class Tt{_listeners=new Set;onConnected;onDisconnected;onMessage;onHeartBeat;constructor(){this.onConnected=e=>{this._listeners.forEach(t=>t.onConnected?.(e))},this.onMessage=e=>{this._listeners.forEach(t=>t.onMessage?.(e))},this.onDisconnected=()=>{this._listeners.forEach(e=>e.onDisconnected?.())},this.onHeartBeat=e=>{this._listeners.forEach(t=>t.onHeartBeat?.(e))}}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}clear(){this._listeners.clear()}}function Ti(e,t){return new Ts(e,t)}class Ts{_client=null;_subscriptions=new Map;_marketIdToSymbol=new Map;_symbolToMarketId=new Map;constructor(e,t){this._client=e,t.onMessage=this.onMessage.bind(this)}associateSymbolAndMarketId(e,t){this._symbolToMarketId.set(e,t),this._marketIdToSymbol.set(t,e)}disassociateSymbolAndMarketId(e){let t=this._symbolToMarketId.get(e),i=eV(t);return i&&(this._symbolToMarketId.delete(e),this._marketIdToSymbol.delete(t)),i}onMessage(e){let t=e.subscriptionResponse;t&&this.isSubscribedToRealTimeTrades(t.symbol)&&this.associateSymbolAndMarketId(t.symbol,t.marketId.toNumber())}async ready(){return eV(await this._client?.connection)}shutdown(){eV(this._client)&&(this._client.dispose(),this._client=null)}findSymbolByMarketId(e){let t=e?.marketId.toNumber();return eV(t)&&this._marketIdToSymbol.has(t)?this._marketIdToSymbol.get(t):null}subscribeToRealTimeTrades(e){if(this._subscriptions.has(e)||!eV(this._client))return;let t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribeFromRealTimeTrades(e){if(!this._subscriptions.has(e)||!eV(this._client))return;let t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e),this.disassociateSymbolAndMarketId(e)}async getInstrument(e){let t=await this._client?.connection;return await t?.getInstrument(e)??[]}isSubscribedToRealTimeTrades(e){return this._subscriptions.has(e)}}class Tr extends y5{multiplexer=new Tt;_adapter=null;_auxFeeds=[];constructor(t){super(t),this.cachesData=!0,this.isAuxiliary||(this.timeSeriesSource=new uJ(!0),this.metaDataSource=new il,this.recordSource=new l_,e(cs).subscribe(ao.TS_ALL,this.onTimeSeriesMessage.bind(this)))}onTimeSeriesMessage(e,t){if(!this.isAuxiliary)for(let i of this._auxFeeds)i.notifySeriesMessage(e,t)}notifySeriesMessage(e,t){this.isAuxiliary&&eR(e,t)}set listener(e){eV(e)&&(e.onConnected=this.onConnected.bind(this),e.onMessage=this.onMessage.bind(this))}get adapter(){return this._adapter}set adapter(e){eV(e)&&(this._adapter=e)}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._adapter?.subscribeToRealTimeTrades(e)}unsubscribe(e){this._adapter?.unsubscribeFromRealTimeTrades(e)}shutdown(){super.shutdown(),this.isAuxiliary?(this._mainFeed?.removeAuxFeed(this),this._mainFeed=null):(this._adapter?.shutdown(),this.multiplexer.clear())}onConnected(e){this.refreshCaches()}get ofRecordSource(){return this.recordSource}onMessage(e){let t=e.marketSnapshot,i=this._adapter?.findSymbolByMarketId(t)??null;eV(t)&&null!==i&&this.ofRecordSource.onSnapshot(t,i);let s=e.marketUpdate;i=this._adapter?.findSymbolByMarketId(s)??null,eV(s)&&null!==i&&this.ofRecordSource.onUpdate(s,i)}replaceDataSources(e){super.replaceDataSources(e),this._mainFeed=e,this.adapter=e.adapter}addAuxFeed(e){e.replaceDataSources(this),this._auxFeeds.push(e)}removeAuxFeed(e){let t=this._auxFeeds.findIndex(t=>t.id==e.id);-1!==t&&(this._auxFeeds.splice(t,1),this.triggerGc())}getAllCacheableEntities(e){if(super.getAllCacheableEntities(e),!this.isAuxiliary)for(let t of this._auxFeeds)t.getAllCacheableEntities(e)}}var cs=R("c15IW");let Tn=e(cs);export{Tn as PubSub,yQ as initFeed,y0 as getFeed,y2 as shutdownFeed,y3 as getChartOutline,y5 as BaseDataFeed,y6 as BarchartSiteDataFeed,y8 as MiniWidgetDataFeed,Te as MarketDataFeed,Tr as OpenFeed,y7 as SnapshotDataFeed,Ti as adaptOpenFeedClient,lX as OHLCDataPointBuilder,nF as parseExpression,nk as evaluateExpression,nU as formatExpression,nW as getExpressionSymbols,nG as replaceExpressionSymbols,po as ExpressionSeries,pa as makeExpression,u$ as ContainerWrapperTimeSeries,t3 as formatPriceWithDecimals,t4 as getCombinedMetaData,lb as BaseRecordSource,ap as EmptyRecord,as as Field,aa as Fields,lJ as TimeSeriesContainer,ci as TimeSeriesQuery,nP as Aggregation,tU as asyncReady,tE as hasOpenInterest,lz as optionValueToDate,e0 as generateUid,sW as getTaxonomies,sV as doesStudyExist,sR as getAnnotationTraits,gx as getStudyOptions,ca as StudySeries,cn as makeHelperField,fi as makeStudy,fv as convertSeries,fb as mapSeries,fn as movAvg,fa as movExp,fo as movSmo,fl as movWei,fu as movHul,fS as linReg,fp as trueRange,fm as typical,fg as roc,fA as stdDev,ao as Topics,iL as getLightness,er as ChunkPart,Z as SeriesKind,G as AggregationSpec,$ as AggregationUnit,F as ExpressionRecompute,k as ExpressionNoDataApproach,H as ExpressionMissingBar,z as FieldValueType,j as FieldCategory,Y as FieldFormat,g2 as CustomEventPopup,tF as appendDOMElement,tR as styleDOMElement,tN as setAttributesDOMElement};
21
21
  //# sourceMappingURL=barchart.chart.js.map