@barchart/chart-lib 2.365.2 → 2.366.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chart-lib/barchart.chart.js +9 -22
- chart-lib/package.json +1 -1
chart-lib/barchart.chart.js
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
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,A,S,T,v,P,C,b,E,L,_,M,x,I,D,O=globalThis,w={},R={},N=O.parcelRequireffd0;null==N&&((N=function(e){if(e in w)return w[e].exports;if(e in R){var t=R[e];delete R[e];var i={id:e,exports:{}};return w[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){R[e]=t},O.parcelRequireffd0=N);var V=N.register;V("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(){A("(");var e=r();A(")");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("[")?(A("["),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}}(),A("]"),{type:4,arg:e}):f("{")?(A("{"),t=u(),A("}"),{type:3,arg:t}):f("(")?a():void 0}function l(){m()||b(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=S(),(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=S().type)||2===e||4===e||5===e?{type:11,val:v().val}:m()?l():f("(")?(A("("),t=u(),A(")"),t):b(v())}function f(e){var t=S();return 6===t.type&&t.val===e}function m(){return g()||y()||f("^")}function g(){var e=S();if(6===e.type){var t=e.val;return"."===t||".."===t}return!1}function y(){var e=S();return 1===e.type&&"$"===e.val[0]}function A(e){var t=v();(6!==t.type||t.val!==e)&&b(t)}function S(){if(null!==i)return i;var e=t;return i=T(),t=e,i}function T(){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(P(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(C(i)){for(var r,n=t,a=i;++t<s&&(C(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||P(r)){for(var a=r;++t<s;){if("."===(r=e[t])){if(n)return;n=!0}else if(!P(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],b(r)}function v(){var e;return i?(t=i.range[1],e=i,i=null,e):T()}function P(e){return"0123456789".indexOf(e)>=0}function C(e){return"$"===e||"@"===e||"_"===e||e>="a"&&e<="z"||e>="A"&&e<="Z"}function b(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&&b(o),a}}(),i=function(){function e(){if(S.length)return S.shift();var e="v"+ ++A;return y.push(e),e}function t(){for(var e=arguments,t=e.length;t--;)S.push(e[t])}function i(o,h,c){switch(o.type){case 1:var d,p,f,m,y,A,S,v,P,C,b,E,L,_,M,x,I,D,O,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 B=V[H++];switch(B.type){case 2:".."===B.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)}(B,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)}}(B,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)}(B,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))}(B,h,h);break;case 8:r(B,h,h)}}break;case 8:r(o,h,c);break;case 6:d=o,p=h,f=c,m=e(),y=e(),A=e(),S=e(),v=e(),P=e(),C=e(),b=e(),E=d.args[0],L=d.args[1],g.push(p,"= false;"),i(E,m,f),i(L,y,f),_=1===E.type,M=11===L.type,g.push(A,"="),_?g.push("true;"):g.push("isArr(",m,");"),g.push(S,"="),M?g.push("false;"):g.push("isArr(",y,");"),g.push("if("),_||g.push(A,"&&"),g.push(m,".length === 1) {",m,"=",m,"[0];",A,"= false;","}"),M||g.push("if(",S,"&&",y,".length === 1) {",y,"=",y,"[0];",S,"= false;","}"),g.push(v,"= 0;","if(",A,") {",C,"=",m,".length;"),M||(g.push("if(",S,") {",b,"=",y,".length;","while(",v,"<",C,"&& !",p,") {",P,"= 0;","while(",P,"<",b,") {"),s(d.op,m+"["+v+"]",y+"["+P+"]"),g.push(p,"= true;","break;","}","++",P,";","}","++",v,";","}","}","else {")),g.push("while(",v,"<",C,") {"),s(d.op,m+"["+v+"]",y),g.push(p,"= true;","break;","}","++",v,";","}"),M||g.push("}"),g.push("}"),M||(g.push("else if(",S,") {",b,"=",y,".length;","while(",v,"<",b,") {"),s(d.op,m,y+"["+v+"]"),g.push(p,"= true;","break;","}","++",v,";","}","}")),g.push("else {",p,"=",T[d.op](m,y),";","}"),t(m,y,A,S,v,P,C,b);break;case 7:x=o,I=h,D=c,O=e(),w=e(),i((R=x.args)[0],O,D),i(R[1],w,D),g.push(I,"=",T[x.op](u(R[0],O),u(R[1],w)),";"),t(O,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 k=o,W=h,U=c,$=e(),G=k.arg;switch(i(G,$,U),k.op){case"!":g.push(W,"= !",l(G,$)+";");break;case"-":g.push(W,"= -",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(",T[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,A,S,T={"===":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"],A=0,S=[],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}()}),V("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,A,S,T,v,P,C=!1,b={},E=t.length-1,L=t[E],_=n.length-1,M=n[_].object,x=n[_].key,I=M[x];if(L.hasOwnProperty("$ref"))return(t=u(e,t,L.$ref))?c(e,t,n,a):{$ref:L.$ref};if(L.hasOwnProperty("type"))if("string"==typeof L.type){if(a.useCoerce&&e.coerceType.hasOwnProperty(L.type)&&(I=M[x]=e.coerceType[L.type](I)),!e.fieldType[L.type](I))return{type:L.type}}else{for(d=0,C=!0,p=L.type.length;d<p&&C;d++)e.fieldType[L.type[d]](I)&&(C=!1);if(C)return{type:L.type}}if(L.hasOwnProperty("allOf")){for(d=0,p=L.allOf.length;d<p;d++)if(S=c(e,t.concat(L.allOf[d]),n,a))return S}if(a.useCoerce||a.useDefault||a.removeAdditional){if(L.hasOwnProperty("oneOf")){for(d=0,l=1/0,p=L.oneOf.length,f=0;d<p;d++)if(P=i(n),S=c(e,t.concat(L.oneOf[d]),P,a))(o=S.schema?Object.keys(S.schema).length:1)<l&&(l=o,b=S);else{if((f+=1)>1)break;s(P,n)}if(f>1)return{oneOf:!0};if(f<1)return b;b={}}if(L.hasOwnProperty("anyOf")){for(d=0,b=null,l=1/0,p=L.anyOf.length;d<p;d++)if(P=i(n),S=c(e,t.concat(L.anyOf[d]),P,a))(o=S.schema?Object.keys(S.schema).length:1)<l&&(l=o,b=S);else{s(P,n),b=null;break}if(b)return b}if(L.hasOwnProperty("not")&&(P=i(n),!(S=c(e,t.concat(L.not),P,a))))return{not:!0}}else{if(L.hasOwnProperty("oneOf")){for(d=0,l=1/0,p=L.oneOf.length,f=0;d<p;d++)if(S=c(e,t.concat(L.oneOf[d]),n,a))(o=S.schema?Object.keys(S.schema).length:1)<l&&(l=o,b=S);else if((f+=1)>1)break;if(f>1)return{oneOf:!0};if(f<1)return b;b={}}if(L.hasOwnProperty("anyOf")){for(d=0,b=null,l=1/0,p=L.anyOf.length;d<p;d++)if(S=c(e,t.concat(L.anyOf[d]),n,a))(o=S.schema?Object.keys(S.schema).length:1)<l&&(l=o,b=S);else{b=null;break}if(b)return b}if(L.hasOwnProperty("not")&&!(S=c(e,t.concat(L.not),n,a)))return{not:!0}}if(L.hasOwnProperty("dependencies")){for(y in L.dependencies)if(L.dependencies.hasOwnProperty(y)&&I.hasOwnProperty(y)){if(Array.isArray(L.dependencies[y])){for(d=0,p=L.dependencies[y].length;d<p;d++)if(!I.hasOwnProperty(L.dependencies[y][d]))return{dependencies:!0}}else if(S=c(e,t.concat(L.dependencies[y]),n,a))return S}}if(Array.isArray(I)){if(L.hasOwnProperty("items"))if(Array.isArray(L.items)){for(d=0,p=L.items.length;d<p;d++)null!==(S=c(e,t.concat(L.items[d]),n.concat({object:I,key:d}),a))&&(b[d]=S,C=!0);if(I.length>p&&L.hasOwnProperty("additionalItems"))if("boolean"==typeof L.additionalItems){if(!L.additionalItems)return{additionalItems:!0}}else for(d=p,p=I.length;d<p;d++)null!==(S=c(e,t.concat(L.additionalItems),n.concat({object:I,key:d}),a))&&(b[d]=S,C=!0)}else for(d=0,p=I.length;d<p;d++)null!==(S=c(e,t.concat(L.items),n.concat({object:I,key:d}),a))&&(b[d]=S,C=!0);else if(L.hasOwnProperty("additionalItems")&&"boolean"!=typeof L.additionalItems)for(d=0,p=I.length;d<p;d++)null!==(S=c(e,t.concat(L.additionalItems),n.concat({object:I,key:d}),a))&&(b[d]=S,C=!0);if(C)return{schema:b}}else{for(y in T=[],b={},I)I.hasOwnProperty(y)&&T.push(y);if(a.checkRequired&&L.required)for(d=0,p=L.required.length;d<p;d++)I.hasOwnProperty(L.required[d])||(b[L.required[d]]={required:!0},C=!0);if(m=L.hasOwnProperty("properties"),g=L.hasOwnProperty("patternProperties"),m||g)for(d=T.length;d--;){if(v=!1,m&&L.properties.hasOwnProperty(T[d])&&(v=!0,null!==(S=c(e,t.concat(L.properties[T[d]]),n.concat({object:I,key:T[d]}),a))&&(b[T[d]]=S,C=!0)),g)for(y in L.patternProperties)L.patternProperties.hasOwnProperty(y)&&T[d].match(y)&&(v=!0,null!==(S=c(e,t.concat(L.patternProperties[y]),n.concat({object:I,key:T[d]}),a))&&(b[T[d]]=S,C=!0));v&&T.splice(d,1)}if(a.useDefault&&m&&!C)for(y in L.properties)L.properties.hasOwnProperty(y)&&!I.hasOwnProperty(y)&&L.properties[y].hasOwnProperty("default")&&(I[y]=L.properties[y].default);if(a.removeAdditional&&m&&!0!==L.additionalProperties&&"object"!=typeof L.additionalProperties)for(d=0,p=T.length;d<p;d++)delete I[T[d]];else if(L.hasOwnProperty("additionalProperties"))if("boolean"==typeof L.additionalProperties){if(!L.additionalProperties)for(d=0,p=T.length;d<p;d++)b[T[d]]={additional:!0},C=!0}else for(d=0,p=T.length;d<p;d++)null!==(S=c(e,t.concat(L.additionalProperties),n.concat({object:I,key:T[d]}),a))&&(b[T[d]]=S,C=!0);if(C)return{schema:b}}for(A in L)L.hasOwnProperty(A)&&!r.hasOwnProperty(A)&&("format"===A?e.fieldFormat.hasOwnProperty(L[A])&&!e.fieldFormat[L[A]](I,L,n,a)&&(b[A]=!0,C=!0):e.fieldValidate.hasOwnProperty(A)&&!e.fieldValidate[A](I,L[A].hasOwnProperty("$data")?h(n,L[A].$data):L[A],L,n,a)&&(b[A]=!0,C=!0));return C?b: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)}),V("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}),V("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}),V("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}),V("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 H=((i={})[i.Browser=0]="Browser",i[i.NodeJs=1]="NodeJs",i),F=((s={})[s.UsePrevious=0]="UsePrevious",s[s.UseNext=1]="UseNext",s[s.UseNone=2]="UseNone",s),B=((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),W=((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),$=((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),G=((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),z=((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),Y=((c={})[c.Number=0]="Number",c[c.String=1]="String",c[c.Date=2]="Date",c),j=((d={})[d.FromMetaData=0]="FromMetaData",d[d.AsInteger=1]="AsInteger",d[d.UseMetricUnit=2]="UseMetricUnit",d[d.AsPercent=3]="AsPercent",d),K=((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),q=((f={})[f.None=0]="None",f[f.Value=1]="Value",f[f.Percent=2]="Percent",f),X=((m={})[m.Linear=0]="Linear",m[m.Logarithmic=1]="Logarithmic",m),Z=((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),J=((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),Q=((A={})[A.Left=0]="Left",A[A.Center=1]="Center",A[A.Right=2]="Right",A),ee=((S={})[S.Arrow=0]="Arrow",S[S.Crosshair=1]="Crosshair",S[S.Move=2]="Move",S[S.Hand=3]="Hand",S[S.ResizeVertical=4]="ResizeVertical",S[S.Grabbing=5]="Grabbing",S[S.ResizeHorizontal=6]="ResizeHorizontal",S),et=((T={})[T.NotApplicable=0]="NotApplicable",T[T.Left=1]="Left",T[T.Middle=2]="Middle",T[T.Right=3]="Right",T),ei=((v={})[v.Shift=0]="Shift",v[v.Alt=1]="Alt",v[v.Control=2]="Control",v[v.Meta=3]="Meta",v),es=((P={})[P.None=0]="None",P[P.Horizontal=1]="Horizontal",P[P.Vertical=2]="Vertical",P[P.Both=3]="Both",P),er=((C={})[C.Unspecified=0]="Unspecified",C[C.GBE=1]="GBE",C[C.cmdtyView=2]="cmdtyView",C[C.DemoSite=3]="DemoSite",C[C.InternalFeed=4]="InternalFeed",C[C.Widget=5]="Widget",C[C.FreeWidget=6]="FreeWidget",C),en=((b={})[b.Unspecified=0]="Unspecified",b[b.Head=1]="Head",b[b.Tail=2]="Tail",b),ea=((E={})[E.wheel=0]="wheel",E[E["wheel+shift"]=1]="wheel+shift",E[E.none=2]="none",E),eo=((L={})[L.Page=0]="Page",L[L.Application=1]="Application",L),el=((_={})[_.None=0]="None",_[_.Created=1]="Created",_[_.Deleted=2]="Deleted",_[_.Moved=3]="Moved",_[_.PointMoved=4]="PointMoved",_[_.TextChanged=5]="TextChanged",_[_.Undo=6]="Undo",_[_.Redo=7]="Redo",_[_.Cancelled=8]="Cancelled",_[_.Executed=9]="Executed",_),eu=((M={})[M.None=0]="None",M[M.Min=1]="Min",M[M.Max=2]="Max",M);function eh(e,t){return function(...i){return e.apply(this,[t,...i])}}function ec(e,t,i){return function(...s){return e.apply(this,[t,i,...s])}}function ed(...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 ep(e){return e}function ef(e){return null!==e}function em(e){return e.reduce((e,t)=>e+t,0)}function eg(e){let t=e.length;return t>0?em(e)/t:0}function ey(e){return e.every(e=>null!==e)}function eA(e,t){return Array.from(Array(t)).map((t,i)=>i+e)}function eS(e,t){let i=[],s=[];return e.forEach(e=>{t(e)?i.push(e):s.push(e)}),{yes:i,no:s}}function eT(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 ev(e,t){return e.filter(e=>!t.includes(e))}function eP(e,t,i=ep){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 eC(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function eb(e){if(!(e.length<1))return e[0]}function eE(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 eL=(e,t)=>e[t];function e_(e,t,i=e=>e,s=eL,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 ex(e,t){return Array.from({length:e},(e,i)=>t(i))}function eI(e,t){let i=eF;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 eD=null;function eO(){return null===eD&&(eD="ontouchstart"in globalThis),eD}function ew(e,t){return"Escape"===e||27===t}function eR(e,t){return"ArrowLeft"===e||37===t}function eN(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function eV(e,t=100){var i,s;let r;return i=t=>eN(e,t),s=t,r=null,function(...e){let t=this;clearTimeout(r),r=setTimeout(function(){i.apply(t,e)},s)}}function eH(e){return null!=e}function eF(...e){return e.every(e=>null!=e)}function eB(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 eF(e)&&Number.isFinite(e)}function eW(e){let t="both"===e;return[t||"vertical"===e,t||"horizontal"===e]}function eU(e,t,i){return t.includes(e)?e:i}function e$(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function eG(e,t,...i){if(!eF(e))return t;let s=e;for(let e of i){if(!eF(s)||!e$(s,e))return t;s=s[e]}return s}function ez(e){return null==e?e:JSON.parse(JSON.stringify(e))}function eY(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],eY(a,t[i]))}}function ej(e,t){for(let i of Object.keys(t))e[i]=e[i]||t[i]}function eK(e=[]){return e.reduce((e,t)=>(e[t.name]=t.value,e),{})}function eq(e){return e?new Date(e):null}function eX(e){let t="";for(let i in e){let s=`${i}=${encodeURIComponent(e[i])}`;t+=(t.length>0?"&":"")+s}return t}let eZ=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,eJ=[1e3,60,60,24,7,30/7,12];function eQ(e){let t=eZ.exec(e);if(!eF(t))return null;let i=t.slice(2,9).map(e=>eF(e)?parseFloat(e):0).reverse();return eJ.forEach((e,t)=>{for(let s=t;s<i.length;s++)i[s]=i[s]*e}),Math.floor(em(i))}function e0(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 e1(){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 e2(e,t,i){return Math.min(Math.max(i,e),t)}var e3={},e4={};e4={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 e5={},e6={};e6=(()=>{function e(e,i,s,r,n){s===String?e4.string(e)||t(i,"string",n):s===Number?e4.number(e)||t(i,"number",n):s===Function?e4.fn(e)||t(i,"function",n):s===Boolean?e4.boolean(e)||t(i,"boolean",n):s===Date?e4.date(e)||t(i,"date",n):s===Array?e4.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),e4.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()}]`)}}})(),e5=(()=>{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=>(e6.argumentIsRequired(t,"s",String),t.replace(e.camel.violations,e=>e.toLocaleLowerCase())),truncate:(e,t)=>e4.string(e)&&e.length>t?e.substring(0,t)+" ...":e,padLeft(e,t,i){if(e6.argumentIsRequired(e,"s",String),e6.argumentIsRequired(t,"length",Number),e6.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)=>(e6.argumentIsRequired(e,"s",String),e.replace(/{(\d+)}/g,(e,i)=>{let s;if(i<t.length){let r=t[i];s=e4.undefined(r)||e4.null(r)?e:r.toString()}else s=e;return s}))}})();var e7={},e8={};e8=(()=>{let e=new Map;class t{constructor(i,s){e6.argumentIsRequired(i,"code",String),e6.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})(),e7=(()=>{class e extends e8{constructor(e,t,i){super(e,t),this._id=i}get id(){return this._id}toJSON(){return this._id}static parse(t){return e8.fromCode(e,t)}static fromId(t){return e8.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})(),e3=(()=>{class e{constructor(){}static getIsConcrete(e){return e4.string(e)&&!this.getIsReference(e)}static getIsReference(e){return e4.string(e)&&n.futures.alias.test(e)}static getIsFuture(e){return e4.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 e4.string(e)&&n.futures.spread.test(e)}static getIsFutureOption(e){return e4.string(e)&&(n.futures.options.short.test(e)||n.futures.options.long.test(e)||n.futures.options.historical.test(e))}static getIsForex(e){return e4.string(e)&&n.forex.test(e)}static getIsCrypto(e){return e4.string(e)&&n.crypto.test(e)}static getIsIndex(e){return e4.string(e)&&n.indicies.external.test(e)}static getIsSector(e){return e4.string(e)&&n.indicies.sector.test(e)}static getIsCanadianFund(e){return e4.string(e)&&n.funds.canadian.test(e)}static getIsCmdty(e){return e4.string(e)&&(n.cmdty.stats.test(e)||n.cmdty.internal.test(e)||n.cmdty.external.test(e))}static getIsCmdtyStats(e){return e4.string(e)&&n.cmdty.stats.test(e)}static getIsBats(e){return e4.string(e)&&r.bats.test(e)}static getIsEquityOption(e){return e4.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 e4.string(e)&&(n.c3.concrete.test(e)||n.c3.alias.test(e))}static getIsPlatts(e){return e4.string(e)&&(n.platts.concrete.test(e)||n.platts.alias.test(e))}static getIsPit(e,t){return e4.string(e)&&e4.string(t)&&r.pit.test(t)}static getIsGrainBid(e){return e4.string(e)&&n.bids.test(e)}static parseInstrumentType(e){if(!e4.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(!e4.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}${e5.padLeft(Math.floor(s.year%100).toString(),2,"0")}`}return i}static getFuturesYear(e,t){return h(e,t)}static displayUsingPercent(e){return e4.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=e7.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=e7.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=e7.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=e7.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=e7.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=e7.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=e7.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 e9={};function te(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 tt(e,t){if(t.length<e)throw TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function ti(e){return(ti="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 ts(e){tt(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===ti(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 tr(e,t){tt(2,arguments);var i=ts(e),s=te(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 tn(e,t){return tt(2,arguments),tr(e,12*te(t))}function ta(e){tt(1,arguments);var t=ts(e),i=new Date(0);return i.setFullYear(t.getFullYear(),0,1),i.setHours(0,0,0,0),i}function to(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 tl(e){tt(1,arguments);var t=ts(e);return t.setHours(0,0,0,0),t}function tu(e,t){tt(2,arguments);var i=tl(e),s=tl(t);return Math.round((i.getTime()-to(i)-(s.getTime()-to(s)))/864e5)}function th(e){return tt(1,arguments),ts(e).getFullYear()}function tc(e){tt(1,arguments);var t=ts(e);return t.setDate(1),t.setHours(0,0,0,0),t}function td(t){return e(e3).parseInstrumentType(t)}e9=(()=>{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 tp=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}}),tf=e=>tp(e,function(e){tt(1,arguments);var t=ts(e);return tu(t,ta(t))+1}(Date.now()));async function tm(e){if(!tE(e))return e;let{root:t,dynamic:i,dynamicCode:s}=td(e);if(!eF(t,i,s))return null;let{symbols:r,nearest:n}=await tf(t),a=parseInt(s);if(0===a)return n;let o=a-1;return o<r.length?r[o]:null}function tg(t){return e(e3).getIsFutureOption(t)}function ty(t){return e(e3).getIsFuture(t)}let tA=/^_S_SP_([^_]+)_([^_]+)$/;function tS(e){let t=e.match(tA);return!!t&&3===t.length&&ty(t[1])&&ty(t[2])}let tT=/^([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 tv(e){return tT.test(e)}function tP(t){return e(e3).getIsEquityOption(t)}function tC(e){return String(e%100).padStart(2,"0")}function tb(e,t=!1){if(!ty(e))return e;let i=td(e);return function(e,t,i,s=!1){return`${e}${t}${s?i:tC(i)}`}(i.root,i.month,i.year,t)}function tE(e){let t=td(e);return eF(t)&&!0===t.dynamic}function tL(e){let t=ty(e)||tg(e),i="_S_"===e.substring(0,2);return(t||tP(e))&&!i}function t_(e){return ty(e)?"America/Chicago":"America/New_York"}async function tM(e){let t=JSON.parse(await Ab("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 tx(e){return ty(e)?td(e).root:null}function tI(t){if(!ty(t))return null;let i=td(t),s=e(e9).getCodeToNumberMap()[i.month];return tc(new Date(i.year,s-1))}function tD(e,t){let i=td(e),s=(i.year+t)%100;return`${i.root}${i.month}${tC(s)}`}async function tO(e){let t=e=>[e,!1,!1],i=ty(e),s=tv(e),r=!!ty(e)&&"Y"===td(e).month;if(!i&&!s||r)return t(e);if(i){let{root:t,month:i}=td(e),s=await tm(`${t}*1`);if(!tE(e)){let s=(await tf(t))?.symbols??[];if(s.includes(e))return[e,!0,!1];for(let e of s)if(td(e).month===i)return[e,!0,!0]}return[s,!0,!0]}if(s){let i=tT.exec(e);return t(`${i[1]}${tC(th(new Date))}${i[3]}`)}return t(e)}function tw(e){let t=e.getRootNode();return t===document?document.body:t}function tR(e,t=document){let i=tN(e,t);return eF(i)?i.innerHTML:null}function tN(e,t=document){return tW(e,t)[0]}function tV(e,t){for(let i in t)e.style[i]=t[i]}function tH(e,t){for(let i in t)e.setAttribute(i,t[i])}function tF(e,t,i){let s=tN(`#${e}`,t);if(eF(s))return s;let r=tk(t,i);return r.id=e,r}function tB(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 tk(e,t){return e.appendChild(document.createElement(t))}function tW(e,t=document){return t.querySelectorAll(e)}function tU(e,t){e&&(e.innerHTML=t)}async function t$(e,t="asyncReadyWork"){eF(this[t])||(this[t]={});let i=this[t];return eF(i.result)?Promise.resolve(i.result):(eF(i.promise)||(i.promise=e.call(this),i.promise.then(e=>{i.result=e})),i.promise)}class tG{_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 tz=globalThis.devicePixelRatio||1,tY={EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:eO()?20*tz:5*tz,HALF_ANN_POINT_DIMENSION:eO()?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_LINE_3:"line3",AT_FILL:"fill",AT_FILL2:"fill2",AT_FILL3:"fill3",AT_FILL4:"fill4",AT_FILL5:"fill5",AT_FILL6:"fill6",AT_FILL7:"fill7",AT_FILL_TEXT:"fillText",AT_SINGLE_STYLE:"singleStyle",AT_SHOW_BACKGROUND:"showBackground",AT_BACKGROUND_OPACITY:"backgroundOpacity",AT_COMPACT:"compact",AT_SHOWN:"shown",AT_VALUE:"value",AT_ACCOUNT_SIZE:"accountSize",AT_RISK:"risk",AT_REWARD:"reward",AT_RATIO:"ratio",AT_KIND:"kind",AT_ARROW:"arrow",AT_VERTEX:"vertex",AT_VERTEX_START:"start",AT_VERTEX_END:"end",AT_VERTEX_BOTH:"both",AT_VERTEX_NONE:"none",AT_TEXT_ITEM:"textItem",AT_RISK_IS_PERCENT:"riskIsPercent",AT_SHOW_PRICES:"showPrices",AT_USE_52WEEK_PRICES:"use52WeekPrices",AT_SHOW_LEVELS:"showLevels",AT_LEVELS_KIND:"levelsKind",AT_LEVELS_VALUES:"Values",AT_LEVELS_PERCENTS:"Percents",AT_LABELS:"labels",AT_LABELS_LEFT:"Left",AT_LABELS_CENTER:"Center",AT_LABELS_RIGHT:"Right",AT_SHOW_BARCOUNT:"showBarCount",AT_EXTEND_PT_1:"extendPoint1",AT_EXTEND_PT_2:"extendPoint2",AT_EXTEND_LEFT:"extendLeft",AT_EXTEND_RIGHT:"extendRight",AT_TEXT_LINES:"textLines",AT_SHOW_TIMESTAMPS:"showTimestamps",AT_SHOW_TRENDLINE:"showTrendline",AT_SHOW_PERCENTDIFF:"showPercentDiff",AT_FACTORS:"factors",AT_FACTOR_ITEM:"factorItem",AT_MARKER:"marker",AT_DRAW_LINES:"drawLines",AT_DRAW_BORDER:"drawBorder",AT_ALLOW_PRICES_CHANGE_UI:"allowPricesChangeUI",AT_PRICES_ON_SCALE:"pricesOnScale",AT_PRICE_LEVELS:"priceLevels",AT_TIME_LEVELS:"timeLevels",AT_SHOW_LABELS:"showLabels",AT_SHOW_LEFT_LABELS:"showLeftLabels",AT_SHOW_RIGHT_LABELS:"showRightLabels",AT_SHOW_TOP_LABELS:"showTopLabels",AT_SHOW_BOTTOM_LABELS:"showBottomLabels",AT_SHOW_ANGLES:"showAngles",AT_REVERSE:"reverse",AT_LEVELS:"levels",AT_FANS:"fans",AT_ARCS:"arcs",AT_SHOW_RANGES_RATIO:"showRangesRatio",AT_PRICE_BAR_RATIO:"priceBarRatio",AT_ANGLES:"angles",AT_NUM_CONTRACTS:"numContracts",AT_POSITION:"position",AT_POSITION_SHORT:"Short",AT_POSITION_LONG:"Long",AT_PROFIT_LOSS:"profitLoss",AT_LEVELS_RESPECT_LOG_SCALE:"levelsRespectLogScale",ANN_ACTION_ID:"Annotation",ANN_DUPLICATE_OFFSET:20,DEFAULT_ADORN_OFFSET:{x:-5,y:-10},LAYOUT_THROTTLE_DELAY:100,MINIMUM_PANE_HEIGHT:10,DEBUG_TIME_FORMAT:"yyyy-LL-dd HH:mm:ss.SSS",DEBUG_SYMBOL:"NOTASYMBOL",DEBUG_CHART_ID:"root",COLOR_DEFAULT_OHLC:"#808080",COLOR_DEFAULT_VARY:["#d33e32","#19ab52"],COLOR_DEFAULT_AREA:"#2d76b3",TOOLTIP_STD:"standard",TOOLTIP_CARDS:"cards",TOOLTIP_BUBBLE:"bubble",TOOLTIP_EXTERNAL:"external",NS_SVG:"http://www.w3.org/2000/svg",NS_XLINK:"http://www.w3.org/1999/xlink",NULL_OBJECT:{magic: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:[$.Renko,$.LineBreak,$.Kagi,$.PointAndFigure],INTRA_THRESHOLD:eQ("P30D"),ONE_DAY_MILLIS:eQ("P1D"),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:eQ("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 tj={},tK={};tK=function(e,t,i,s){if(!e4.number(e))return"";(!e4.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 tq={};tq=function(e,t,i,s,r){var n;let a,o;if(!e4.number(e)||!e4.number(t)||!e4.number(i))return"";(!e4.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=e4.boolean(r)&&r)?(a="(",o=")"):(a="-",o=""):(a="",o=""),[a,u,s,h,o].join("")};var tX={},tZ={},tJ={};!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,A=i.slice(0,u),S=A.length,T=e,v=T.c=[],P=0,C=o+(T.e=this.e-e.e)+1;for(T.s=n,n=C<0?0:C,m.unshift(0);S++<u;)A.push(0);do{for(d=0;d<10;d++){if(u!=(S=A.length))p=u>S?1:-1;else for(f=-1,p=0;++f<u;)if(s[f]!=A[f]){p=s[f]>A[f]?1:-1;break}if(p<0){for(c=S==u?s:m;S;){if(A[--S]<c[S]){for(f=S;f&&!A[--f];)A[f]=9;--A[f],A[S]+=10}A[S]-=c[S]}for(;!A[0];)A.shift()}else break}v[P++]=p?d:++d,A[0]&&p?A[S]=i[g]||0:A=[i[g]]}while((g++<y||A[0]!==l)&&n--)return!v[0]&&1!=P&&(v.shift(),T.e--,C--),P>C&&h(T,C,t.RM,A[0]!==l),T},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}):tJ?tJ=t:e.Big=t}(tJ),tZ=(()=>{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 e6.argumentIsRequired(t,"exponent",Number),new e(this._big.pow(t))}round(t,i){e6.argumentIsRequired(t,"places",Number),e6.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 e6.argumentIsOptional(e,"approximate",Boolean),e6.argumentIsOptional(i,"places",Number),this._big.eq(t)||e4.boolean(e)&&e&&this.round(i||tJ.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(e6.argumentIsOptional(i,"exclusive",Boolean),e4.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 e6.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 e6.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 e6.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsZero()}static getIsNotZero(t){return e6.argumentIsRequired(t,"instance",e,"Decimal"),!t.getIsZero()}static getIsPositive(t){return e6.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()}static getIsNotPositive(t){return e6.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return e6.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()}static getIsNotNegative(t){return e6.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,i){return(e6.argumentIsRequired(t,"a",e,"Decimal"),e6.argumentIsRequired(i,"b",e,"Decimal"),t._big.gt(i._big))?1:t._big.lt(i._big)?-1:0}toString(){return"[Decimal]"}}let t=new tJ(0),i=new tJ(1),s=new tJ(-1),r=new e(t),n=new e(i),a=new e(s);function o(t){return t instanceof tJ?t:t instanceof e?t._big:new tJ(t)}class l extends e8{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})(),tX=(()=>{class e extends e8{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){e6.argumentIsValid(e,"tickIncrement",e4.integer,"must be an integer");let t=new tZ(1),i=new tZ(10);return(this.supportsFractions?t.divide(this._fractionFactor):t.divide(i.raise(this._decimalDigits))).multiply(e).toFloat()}getMinimumTickValue(e,t){return e6.argumentIsValid(e,"tickIncrement",e4.integer,"must be an integer"),e6.argumentIsValid(t,"pointValue",e4.number,"must be a number"),new tZ(this.getMinimumTick(e)).multiply(t).toFloat()}roundToNearestTick(e,t,i){let s;e6.argumentIsValid(e,"value",e=>e4.number(e)||e instanceof tZ,"must be a number primitive or a Decimal instance"),e6.argumentIsValid(t,"minimumTick",e=>e4.number(e)||e instanceof tZ,"must be a number primitive or a Decimal instance"),e6.argumentIsOptional(i,"roundToZero",Boolean);let r=(s=e instanceof tZ?e:new tZ(e)).divide(t);return s.mod(t).getIsZero()||(r=r.round(0,e4.boolean(i)&&i?tZ.ROUNDING_MODE.DOWN:tZ.ROUNDING_MODE.NORMAL)),r.multiply(t).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(t){return e8.fromCode(e,t)}static fromBaseCode(t){return e8.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})(),tj=function(e,t,i,s,r,n){if(!e4.number(e))return"";let a=tX.parse(t);if(null===a)return"";if((!e4.string(i)||i.length>1)&&(i="."),s=e4.boolean(s)&&s,n=e4.boolean(n)&&n,!a.supportsFractions||"."===i)return tK(e,a.decimalDigits,r,n);{let t=a.getFractionFactor(s),r=a.getFractionDigits(s);return tq(e,t,r,i,n)}};var tQ={};tQ=(()=>{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===e7.FUTURE_OPTION){let i=s.root;if("ZB"===i||"ZN"===i||e.ZB.test(i)||e.ZN.test(i))return tq(t,64,2,"-",!1);if("ZT"===i||"ZF"===i||e.ZT.test(i)||e.ZF.test(i))return tq(t,640,3,"-",!1)}return tj(t,i,"-",!0,",")}})();let t0=[{min:0,divider:1,suffix:"",decimals:0},{min:1e5,divider:1e3,suffix:"K",decimals:0},{min:1e6,divider:1e6,suffix:"M",decimals:2},{min:1e9,divider:1e9,suffix:"B",decimals:3},{min:1e12,divider:1e12,suffix:"T",decimals:3}];function t1(e){if(eF(e)){let t=eG(AM().config,null,"overrides","symbology","translateSymbol");if(eF(t)&&"function"==typeof t)try{let i=t(e);if(eF(i))return i}catch(t){AP(`Failed translating the symbol '${e}', error is ${t.message}`,"warn")}}return e}function t2(t,i,s){if(null==t)return"";if(!this.isReady)return t.toFixed(0);if(i.format===j.FromMetaData)return function(t,i,s){let r=AM().config;return r.mode===er[er.cmdtyView]&&null!=s?e(tQ)(t,i,s):e(tj)(t,i,"-",r.isAlt64,",",!1)}(t,this.unitCode,this._profile);switch(i.format){case j.AsInteger:return t.toFixed();case j.UseMetricUnit:{let e=Object.assign({},{range:[t,t],allDigits:!1},s=s||{});if(s.allDigits)return t5(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=eT(e,t);return -1===i?null:e[i]}(t0,e=>i>e.min)||t0[0];return`${(t/r.divider).toFixed(r.decimals)}${r.suffix}`}case j.AsPercent:return`${(100*t).toFixed(2)}%`;default:return""}}function t3(e,t,i){let s=i?.overridePrecision;return Number.isFinite(s)&&s>=0?t5(e,s):null}class t4{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_(t1(this.symbol)),this._profile=null}initialize(e){t8(e)||eY(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=t3(e,t,i);return null!==s?s:t2.call(this,e,t,i)}parse(e){throw Error("Not implemented yet")}getInlineMetadata(e){let t=tR(`#${tY.INLINE_DATA_ELEMENT_ID}`);if(!eF(t))return null;let i=JSON.parse(t),s=e;return s in i||(s=function(e,t){if(!ty(e))return e;let i=td(e);return t.find(e=>td(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 Ab("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){AP(`Failed fetching the metadata for ${e}, error is ${t.message}`,"warn")}return{name:"",exchange:"",unitCode:"A",pointValue:1,tickIncrement:1}}}function t5(t,i){return e(tK)(t,i,",",!1)}function t6(e,t=!1){return new ia(e,t)}class t7 extends t4{shutdown(){}async ready(){return t$.call(this,async()=>{let e=t1(this.symbol),t=this.getInlineMetadata(e);return t8(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0})}getCacheableEntities(e){e.add(this)}}function t8(e){return!eH(e)||!eF(e.unitCode,e.name,e.exchange)||0===e.unitCode.length}class t9 extends t4{shutdown(){}equityOptionProfile(){return{name:this.symbol,exchange:"",unitCode:"A",pointValue:1,tickIncrement:1,symbolType:"EquityOption"}}async ready(){return t$.call(this,async()=>{let e=t1(this.symbol);if(tP(e))return this.initialize(this.equityOptionProfile()),!0;let t=tE(e),i=await (t?tm(e):e);this.resolved=tb(i);let[s,r]=await tO(this.resolved),n=new Promise(e=>{setTimeout(()=>e(null),tY.META_DATA_GET_TIMETOUT)}),a=await Promise.race([n,this.getProfile(s)]);return t8(a)&&(a=this.getInlineMetadata(s)),t8(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 ie extends t9{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=AM(),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 it=((x=it||{})[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 ii extends t9{_profileSource=new tG;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=it[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=AM(),i=await t.getAdapter()?.getInstrument(this.getRequest(e))??[];return i.length<1?null:this.getProfileFromInstrumentDefinition(i[0])}}class is{_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=t3(e,t,i);return null!==s?s:t5(e,this._decimals)}getCacheableEntities(e){}}class ir{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?"":eF(e)?e.toFixed(0):""}getCacheableEntities(e){}}class ia{inner;forceDecimals;unitCode="";pointValue=1;tickIncrement=1;minMovement=0;symbol="";symbolType="Unknown";resolved="";name="";exchange="";constructor(e,t=!1){let i=AM().getMetaDataSource();this.inner=e.map(e=>i.getMetaData(e)),this.forceDecimals=t}get isReady(){return null!=this.unitCode}async ready(){return t$.call(this,async()=>{let e=(await Promise.all(this.inner.map(e=>e.ready()))).every(ep);if(e){let e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:i,no:s}=eS(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=t3(e,t,i);return null!==s?s:t2.call(this,e,t,i)}getCacheableEntities(e){this.inner.forEach(t=>e.add(t))}shutdown(){}}class io{metaDataCache;constructor(){this.metaDataCache=new Map}getMetaData(e){if(e===tY.PLACEHOLDER_SYMBOL_NAME)return new ir;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 il extends io{metaDataCreator(e){return new t7(e)}}class iu extends io{metaDataCreator(e){return new ie(e)}}class ih extends io{metaDataCreator(e){return new ii(e)}}let ic=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,id=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,ip=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,im={r:255,g:255,b:255,a:1},ig={r:0,g:0,b:0,a:1};function iy(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function iA(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 iS(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 iv(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function iP(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 iC(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(ep)}function ib(e){var t=ix(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 iE(e,t){let i=ix(e);return i.a=t,iO(i)}function iL(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 i_=(e,t=!1)=>ed(ix,i=>iL(i,ig,e,t),iO);function iM(e,t=!1){return ed(ix,i=>iL(i,im,e,t),iO)}function ix(e){if(["r","g","b","a"].map(t=>e[t]).every(e=>eF(e)))return e;let t=eF(e.linearGradient)?e._refColor:e,i=ic.exec(t);if(null!==i){let e=eF(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=ip.exec(t),i=id.exec(t),s=(e,t)=>eF(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 iI(e){var t;let{r:i,g:s,b:r}=ix(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 iD(e){return iI(e)>66.66?"#000":"#fff"}function iO(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function iw(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}class iR{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 iR(this.x,this.y,this.width,this.height)}}class iN{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 iV(e,t){e.moveTo(t.x,t.y)}function iH(e,t){e.lineTo(t.x,t.y)}function iF(e,t,i){e.rect(t.x,t.y,i.x-t.x,i.y-t.y)}function iB(e,t=tY.LINE_HEIGHT_MULTIPLIER){return t*e.measureText("M").width}function ik(e,t=!1,i=1){let s=iW(e,t,i).y;return s-Math.sign(s)*tY.DEFAULT_ADORN_OFFSET.y}function iW(e,t=!1,i=1){let s={...tY.DEFAULT_ADORN_OFFSET};return t&&(s.y=-(i*iB(e,1)+s.y)),s}function iU(e,t,i,s=Q.Left){var r;let n=Array.isArray(t)?t:[t],a=iB(e,1),o=Math.max(...n.map(t=>e.measureText(t).width)),l=a*n.length,u=i.x;return s===Q.Right&&(u-=o),s===Q.Center&&(u-=o/2),r=new iR(u,i.y-a,o,l),r.x-=4,r.y-=4,r.width+=8,r.height+=8,r}function i$(e,t,i,s=Q.Left,r,n){e.save();let a=Array.isArray(t)?t:[t],o=iB(e,1);if(eF(n)){let r=iU(e,t,i,s);e.fillStyle=n,iG(e,r,!1)}eF(r)&&(e.fillStyle=r);let l=i.x,u=i.y;a.forEach(t=>{e.textAlign=Q[s].toLowerCase(),e.fillText(t,l,u),u+=o}),e.restore()}function iG(e,t,i=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),i&&e.stroke(),e.fill()}function iz(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 iY(e,{x:t,y:i},{x:s,y:r}){e.beginPath(),e.moveTo(t,i),e.lineTo(s,r),e.stroke()}function ij(e,t,i,s){iY(e,{x:t,y:i},{x:t,y:s})}function iK(e,t,i,s){iY(e,{x:i,y:t},{x:s,y:t})}function iq(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),iz(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 iX(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 iZ(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 iJ(){let e=AM().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?eB(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}let iQ=(e,t)=>!0,i0=(e,t)=>e.map((e,i)=>({shown:t(e,i),value:e,line:{width:1,color:i1(i),dashStyle:"Solid"}})),i1=e=>se[e%se.length],i2=e=>e.filter(e=>e.shown),i3={width:1,color:"#000",dashStyle:"Solid"},i4={width:1,color:"rgba(136,136,136,0.75)",dashStyle:"Dash"},i5={color:tY.COLOR_TRANSPARENT},i6={[tY.AT_SINGLE_STYLE]:!0,[tY.AT_SHOW_BACKGROUND]:!1};function i7(e,t){let i=ez(eG(e,i3,"annotationTraits","line")),s=ez(eG(e,i4,"annotationTraits","line2")),r=ez(eG(e,i5,"annotationTraits","fill")),n=sv[t],a=n?.defaults||{};AM().config.colorfulAnnotations||(eY(a,i6),("GannBox"===t||"GannSquare"===t)&&(a[tY.AT_SHOW_BACKGROUND]=!0));let o=n?.editable.includes(tY.AT_LINE_2),l=eF(a[tY.AT_LINE_2]),u={line:i,fill:r,...a};return o&&!l&&(u.line2=s),u}function i8(e,t){Object.keys(t).forEach(i=>{i===tY.LINE_DASH_PROP_NAME?e.setLineDash(t[i]):e[i]=t[i]})}function i9(e){let t=ed(ix,iO);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:iC(e.line.dashStyle)}}let se=["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)"],st=[tY.AT_LINE,tY.AT_ALLOW_PRICES_CHANGE_UI],si=[tY.AT_FILL,tY.AT_ALLOW_PRICES_CHANGE_UI],ss=[tY.AT_LINE,tY.AT_FILL,tY.AT_ALLOW_PRICES_CHANGE_UI],sr=[...ss,tY.AT_FILL_TEXT],sn=[tY.AT_TEXT_LINES,tY.AT_FILL,tY.AT_ALLOW_PRICES_CHANGE_UI],sa=[...st,tY.AT_LINE_2,tY.AT_SHOW_PRICES,tY.AT_SHOW_LEVELS,tY.AT_LEVELS_KIND,tY.AT_LABELS,tY.AT_EXTEND_LEFT,tY.AT_EXTEND_RIGHT,tY.AT_SHOW_TRENDLINE,tY.AT_FACTORS,tY.AT_PRICES_ON_SCALE,tY.AT_REVERSE,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY,tY.AT_LEVELS_RESPECT_LOG_SCALE],so=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],sl=e=>({[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_SHOW_PRICES]:!0,[tY.AT_SHOW_LEVELS]:!0,[tY.AT_LEVELS_KIND]:tY.AT_LEVELS_PERCENTS,[tY.AT_LABELS]:tY.AT_LABELS_RIGHT,[tY.AT_EXTEND_LEFT]:!1,[tY.AT_EXTEND_RIGHT]:!1,[tY.AT_SHOW_TRENDLINE]:!0,[tY.AT_FACTORS]:i0(so.slice(2),(t,i)=>0<=t&&t<=e),[tY.AT_PRICES_ON_SCALE]:!1,[tY.AT_REVERSE]:!1,[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2,[tY.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),su=[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_SHOW_TRENDLINE,type:"bool"},{id:tY.AT_LINE_2,type:"line",enabledIf:tY.AT_SHOW_TRENDLINE},{id:tY.AT_EXTEND_LEFT,type:"bool"},{id:tY.AT_EXTEND_RIGHT,type:"bool"},{id:tY.AT_FACTORS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"number",editable:!0,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_REVERSE,type:"bool"},{id:tY.AT_SHOW_PRICES,type:"bool"},{id:tY.AT_PRICES_ON_SCALE,type:"bool"},{id:tY.AT_SHOW_LEVELS,type:"bool"},{id:tY.AT_LEVELS_KIND,type:"string",enum:[tY.AT_LEVELS_PERCENTS,tY.AT_LEVELS_VALUES],enabledIf:tY.AT_SHOW_LEVELS},{id:tY.AT_LABELS,type:"string",enum:[tY.AT_LABELS_LEFT,tY.AT_LABELS_CENTER,tY.AT_LABELS_RIGHT]},{id:tY.AT_LEVELS_RESPECT_LOG_SCALE,type:"bool"}],sh={[tY.AT_LINE]:{color:"#3861f6",width:1,dashStyle:"Solid"},[tY.AT_FILL]:{color:"rgba(56, 97, 246, 0.2)"},[tY.AT_FILL_TEXT]:{color:"#f0f0f0"},[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},sc=[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_LINE,type:"line"},{id:tY.AT_FILL,type:"color"},{id:tY.AT_FILL_TEXT,type:"color"}],sd=[0,.25,.382,.5,.618,.75,1],sp=[8,4,3,2,1].map(e=>`1/${e}`).concat([2,3,4,8].map(e=>`${e}/1`)),sf=[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_LINE,type:"line"},{id:tY.AT_SHOW_PRICES,type:"bool"},{id:tY.AT_RATIO,type:"bool"},{id:tY.AT_SHOW_PERCENTDIFF,type:"bool"},{id:tY.AT_SHOW_BARCOUNT,type:"bool"},{id:tY.AT_EXTEND_PT_1,type:"bool"},{id:tY.AT_EXTEND_PT_2,type:"bool"},{id:tY.AT_MARKER,type:"object",properties:[{id:tY.AT_KIND,type:"string",enum:[tY.AT_ARROW]},{id:tY.AT_VERTEX,type:"string",enum:[tY.AT_VERTEX_NONE,tY.AT_VERTEX_START,tY.AT_VERTEX_END,tY.AT_VERTEX_BOTH]}]}],sm=[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_LINE,type:"line"}],sg=[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_LINE,type:"line"},{id:tY.AT_FILL,type:"color"}],sy=[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_LINE,type:"line"},{id:tY.AT_FILL,type:"color"},{id:tY.AT_FILL2,type:"color"},{id:tY.AT_FILL_TEXT,type:"color"},{id:tY.AT_COMPACT,type:"bool"},{id:tY.AT_ACCOUNT_SIZE,type:"number"},{id:tY.AT_RISK,type:"number"},{id:tY.AT_RISK_IS_PERCENT,type:"bool"}],sA=[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_FILL,type:"color"}],sS={[tY.AT_KIND]:tY.AT_ARROW,[tY.AT_VERTEX]:tY.AT_VERTEX_NONE},sT=[tY.AT_LINE,tY.AT_RATIO,tY.AT_SHOW_PRICES,tY.AT_ALLOW_PRICES_CHANGE_UI,tY.AT_SHOW_BARCOUNT,tY.AT_SHOW_PERCENTDIFF,tY.AT_EXTEND_PT_1,tY.AT_EXTEND_PT_2,tY.AT_MARKER],sv={Line:{editable:sT,defaults:{[tY.AT_SHOW_PRICES]:!1,[tY.AT_SHOW_BARCOUNT]:!1,[tY.AT_SHOW_PERCENTDIFF]:!1,[tY.AT_EXTEND_PT_1]:!1,[tY.AT_EXTEND_PT_2]:!1,[tY.AT_MARKER]:sS,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sf,numPoints:2},Ray:{editable:sT,defaults:{[tY.AT_SHOW_PRICES]:!1,[tY.AT_SHOW_BARCOUNT]:!1,[tY.AT_SHOW_PERCENTDIFF]:!1,[tY.AT_EXTEND_PT_1]:!1,[tY.AT_EXTEND_PT_2]:!0,[tY.AT_MARKER]:sS,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sf,numPoints:2},VerticalLine:{editable:[tY.AT_LINE,tY.AT_SHOW_TIMESTAMPS,tY.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tY.AT_SHOW_TIMESTAMPS]:!0,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_LINE,type:"line"},{id:tY.AT_SHOW_TIMESTAMPS,type:"bool"}],numPoints:1},HorizontalLine:{editable:[tY.AT_LINE,tY.AT_SHOW_PRICES,tY.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tY.AT_SHOW_PRICES]:!0,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_LINE,type:"line"},{id:tY.AT_SHOW_PRICES,type:"bool"}],numPoints:1},TrendChannel:{editable:[...st,tY.AT_EXTEND_PT_1,tY.AT_EXTEND_PT_2],defaults:{[tY.AT_EXTEND_PT_1]:!1,[tY.AT_EXTEND_PT_2]:!1,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...sm,{id:tY.AT_EXTEND_PT_1,type:"bool"},{id:tY.AT_EXTEND_PT_2,type:"bool"}],numPoints:3},GannLine:{editable:sT,defaults:{[tY.AT_SHOW_PRICES]:!1,[tY.AT_SHOW_BARCOUNT]:!1,[tY.AT_SHOW_PERCENTDIFF]:!1,[tY.AT_EXTEND_PT_1]:!1,[tY.AT_EXTEND_PT_2]:!0,[tY.AT_MARKER]:sS,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sf,numPoints:2},SpeedResistanceArcs:{editable:st,types:sm,numPoints:2},SpeedResistanceFan:{editable:st,types:sm,numPoints:2},AndrewsPitchfork:{editable:st,types:sm,numPoints:3},Rectangle:{editable:ss,types:sg,numPoints:2},Ellipse:{editable:ss,types:sg,numPoints:2},DateRange:{editable:sr,defaults:sh,types:sc,numPoints:2},PriceRange:{editable:sr,defaults:sh,types:sc,numPoints:2},DatePriceRange:{editable:[...sr,tY.AT_DRAW_BORDER],defaults:{...sh,[tY.AT_DRAW_BORDER]:!1},types:[...sc,{id:tY.AT_DRAW_BORDER,type:"bool"}],numPoints:2},GannBox:{editable:[tY.AT_LINE,tY.AT_LINE_2,tY.AT_ALLOW_PRICES_CHANGE_UI,tY.AT_PRICE_LEVELS,tY.AT_TIME_LEVELS,tY.AT_SHOW_LEFT_LABELS,tY.AT_SHOW_RIGHT_LABELS,tY.AT_SHOW_TOP_LABELS,tY.AT_SHOW_BOTTOM_LABELS,tY.AT_SHOW_ANGLES,tY.AT_REVERSE,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_LINE]:{color:"#33776b",width:1,dashStyle:"Solid"},[tY.AT_LINE_2]:{color:"#33776b",width:1,dashStyle:"Solid"},[tY.AT_PRICE_LEVELS]:i0(sd,iQ),[tY.AT_TIME_LEVELS]:i0(sd,iQ),[tY.AT_SHOW_LEFT_LABELS]:!0,[tY.AT_SHOW_RIGHT_LABELS]:!0,[tY.AT_SHOW_TOP_LABELS]:!0,[tY.AT_SHOW_BOTTOM_LABELS]:!0,[tY.AT_SHOW_ANGLES]:!1,[tY.AT_REVERSE]:!1,[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_PRICE_LEVELS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"number",editable:!0,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_LEFT_LABELS,type:"bool"},{id:tY.AT_SHOW_RIGHT_LABELS,type:"bool"},{id:tY.AT_TIME_LEVELS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"number",editable:!0,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_TOP_LABELS,type:"bool"},{id:tY.AT_SHOW_BOTTOM_LABELS,type:"bool"},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_REVERSE,type:"bool"},{id:tY.AT_SHOW_ANGLES,type:"bool"},{id:tY.AT_LINE_2,type:"line",enabledIf:tY.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[...st,tY.AT_LEVELS,tY.AT_FANS,tY.AT_ARCS,tY.AT_REVERSE,tY.AT_SHOW_RANGES_RATIO,tY.AT_PRICE_BAR_RATIO,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_LINE]:{color:"#712b9c",width:1,dashStyle:"Solid"},[tY.AT_LEVELS]:i0([0,1,2,3,4,5],iQ),[tY.AT_FANS]:i0(["8x1","5x1","4x1","3x1","2x1","1x1","1x2","1x3","1x4","1x5","1x8"],(e,t)=>t>3&&t<7),[tY.AT_ARCS]:i0(["1x0","1x1","1.5x0","2x0","2x1","3x0","3x1","4x0","4x1","5x0","5x1"],iQ),[tY.AT_REVERSE]:!1,[tY.AT_SHOW_RANGES_RATIO]:!0,[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_LEVELS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"string",editable:!1,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_FANS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"string",editable:!1,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_ARCS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"string",editable:!1,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_REVERSE,type:"bool"},{id:tY.AT_PRICE_BAR_RATIO,type:"number",editable:!0},{id:tY.AT_SHOW_RANGES_RATIO,type:"bool"}],numPoints:2},LongPosition:{editable:[tY.AT_LINE,tY.AT_FILL,tY.AT_FILL2,tY.AT_FILL_TEXT,tY.AT_COMPACT,tY.AT_ACCOUNT_SIZE,tY.AT_RISK,tY.AT_RISK_IS_PERCENT,tY.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tY.AT_FILL]:{color:"rgba(0, 160, 0, 0.2)"},[tY.AT_FILL2]:{color:"rgba(205, 0, 0, 0.2)"},[tY.AT_FILL_TEXT]:{color:"#fff"},[tY.AT_COMPACT]:!1,[tY.AT_ACCOUNT_SIZE]:1e3,[tY.AT_RISK]:25,[tY.AT_RISK_IS_PERCENT]:!0,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sy,numPoints:4},ShortPosition:{editable:[tY.AT_LINE,tY.AT_FILL,tY.AT_FILL2,tY.AT_FILL_TEXT,tY.AT_COMPACT,tY.AT_ACCOUNT_SIZE,tY.AT_RISK,tY.AT_RISK_IS_PERCENT,tY.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tY.AT_FILL]:{color:"rgba(205, 0, 0, 0.2)"},[tY.AT_FILL2]:{color:"rgba(0, 160, 0, 0.2)"},[tY.AT_FILL_TEXT]:{color:"#fff"},[tY.AT_COMPACT]:!1,[tY.AT_ACCOUNT_SIZE]:1e3,[tY.AT_RISK]:25,[tY.AT_RISK_IS_PERCENT]:!0,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:sy,numPoints:4},FiftyPercentLine:{editable:[tY.AT_USE_52WEEK_PRICES,tY.AT_LINE,tY.AT_LINE_2,tY.AT_SHOW_PRICES,tY.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[tY.AT_USE_52WEEK_PRICES]:!1,[tY.AT_SHOW_PRICES]:!0,[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_USE_52WEEK_PRICES,type:"bool"},{id:tY.AT_LINE,type:"line"},{id:tY.AT_LINE_2,type:"line"},{id:tY.AT_SHOW_PRICES,type:"bool"}],numPoints:2},FibonacciRetracement:{editable:sa,defaults:sl(1),types:su,numPoints:2},TrendBasedFibExtension:{editable:sa,defaults:sl(5),types:su,numPoints:3},FibonacciFan:{editable:[...st,tY.AT_SHOW_LEVELS,tY.AT_LABELS,tY.AT_FACTORS,tY.AT_REVERSE,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_SHOW_LEVELS]:!0,[tY.AT_LABELS]:tY.AT_LABELS_RIGHT,[tY.AT_REVERSE]:!1,[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2,[tY.AT_FACTORS]:i0(so.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_FACTORS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"number",editable:!0,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_LEVELS,type:"bool"},{id:tY.AT_LABELS,type:"string",enum:[tY.AT_LABELS_LEFT,tY.AT_LABELS_CENTER,tY.AT_LABELS_RIGHT]},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_REVERSE,type:"bool"}],numPoints:2},FibonacciArcs:{editable:[...st,tY.AT_LINE_2,tY.AT_SHOW_TRENDLINE,tY.AT_FACTORS,tY.AT_SHOW_LEVELS,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_SHOW_TRENDLINE]:!0,[tY.AT_SHOW_LEVELS]:!0,[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2,[tY.AT_FACTORS]:i0(so.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_SHOW_TRENDLINE,type:"bool"},{id:tY.AT_LINE_2,type:"line",enabledIf:tY.AT_SHOW_TRENDLINE},{id:tY.AT_FACTORS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"number",editable:!0,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},FibonacciChannel:{editable:[...st,tY.AT_SHOW_PRICES,tY.AT_SHOW_LEVELS,tY.AT_LEVELS_KIND,tY.AT_LABELS,tY.AT_EXTEND_PT_1,tY.AT_EXTEND_PT_2,tY.AT_FACTORS,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_SHOW_PRICES]:!0,[tY.AT_SHOW_LEVELS]:!0,[tY.AT_LEVELS_KIND]:tY.AT_LEVELS_PERCENTS,[tY.AT_LABELS]:tY.AT_LABELS_RIGHT,[tY.AT_EXTEND_PT_1]:!1,[tY.AT_EXTEND_PT_2]:!1,[tY.AT_FACTORS]:i0(so.slice(2),iQ),[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_EXTEND_PT_1,type:"bool"},{id:tY.AT_EXTEND_PT_2,type:"bool"},{id:tY.AT_FACTORS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"number",editable:!0,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_SHOW_PRICES,type:"bool"},{id:tY.AT_SHOW_LEVELS,type:"bool"},{id:tY.AT_LEVELS_KIND,type:"string",enum:[tY.AT_LEVELS_PERCENTS,tY.AT_LEVELS_VALUES],enabledIf:tY.AT_SHOW_LEVELS},{id:tY.AT_LABELS,type:"string",enum:[tY.AT_LABELS_LEFT,tY.AT_LABELS_CENTER,tY.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[...st,tY.AT_ANGLES,tY.AT_SHOW_LEVELS,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_SHOW_LEVELS]:!0,[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2,[tY.AT_ANGLES]:i0(sp,iQ)},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_ANGLES,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"string",editable:!1,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},SymbolArrowUp:{editable:si,types:sA,numPoints:1},SymbolArrowDown:{editable:si,types:sA,numPoints:1},SymbolArrowRight:{editable:si,types:sA,numPoints:1},SymbolArrowLeft:{editable:si,types:sA,numPoints:1},SymbolArrowHorizontal:{editable:si,types:sA,numPoints:1},SymbolArrowVertical:{editable:si,types:sA,numPoints:1},SymbolArcDown:{editable:si,types:sA,numPoints:1},SymbolArcUp:{editable:si,types:sA,numPoints:1},SymbolThumbsUp:{editable:si,types:sA,numPoints:1},SymbolThumbsDown:{editable:si,types:sA,numPoints:1},SymbolZero:{editable:si,types:sA,numPoints:1},SymbolOne:{editable:si,types:sA,numPoints:1},SymbolTwo:{editable:si,types:sA,numPoints:1},SymbolThree:{editable:si,types:sA,numPoints:1},SymbolFour:{editable:si,types:sA,numPoints:1},SymbolFive:{editable:si,types:sA,numPoints:1},SymbolSix:{editable:si,types:sA,numPoints:1},SymbolSeven:{editable:si,types:sA,numPoints:1},SymbolEight:{editable:si,types:sA,numPoints:1},SymbolNine:{editable:si,types:sA,numPoints:1},SymbolQuestion:{editable:si,types:sA,numPoints:1},SymbolFishHook:{editable:si,types:sA,numPoints:1},SymbolBuy:{editable:si,types:sA,numPoints:1},SymbolSell:{editable:si,types:sA,numPoints:1},FibonacciTimeZones:{editable:[...st,tY.AT_FACTORS,tY.AT_SHOW_LEVELS,tY.AT_LABELS,tY.AT_SINGLE_STYLE,tY.AT_SHOW_BACKGROUND,tY.AT_BACKGROUND_OPACITY],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!0,[tY.AT_FACTORS]:i0([0,1,2,3,5,8,13,21,34,55,89,144],iQ),[tY.AT_SHOW_LEVELS]:!0,[tY.AT_LABELS]:tY.AT_LABELS_RIGHT,[tY.AT_SINGLE_STYLE]:!1,[tY.AT_SHOW_BACKGROUND]:!0,[tY.AT_BACKGROUND_OPACITY]:.2},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_SINGLE_STYLE,type:"bool"},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SINGLE_STYLE},{id:tY.AT_FACTORS,type:"array",items:{ref:tY.AT_FACTOR_ITEM}},{id:tY.AT_FACTOR_ITEM,type:"object",properties:[{id:tY.AT_SHOWN,type:"bool",label:!1},{id:tY.AT_VALUE,type:"number",editable:!0,enabledIf:tY.AT_SHOWN},{id:tY.AT_LINE,type:"line",enabledIf:tY.AT_SHOWN}]},{id:tY.AT_SHOW_BACKGROUND,type:"bool"},{id:tY.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:tY.AT_SHOW_BACKGROUND},{id:tY.AT_SHOW_LEVELS,type:"bool"},{id:tY.AT_LABELS,type:"string",enum:[tY.AT_LABELS_LEFT,tY.AT_LABELS_CENTER,tY.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:sn,types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_TEXT_LINES,type:"array",items:{ref:tY.AT_TEXT_ITEM}},{id:tY.AT_TEXT_ITEM,type:"string"},{id:tY.AT_FILL,type:"color"}],numPoints:2},ProfitLoss:{editable:[...ss,tY.AT_SHOW_PRICES,tY.AT_NUM_CONTRACTS,tY.AT_POSITION,tY.AT_PROFIT_LOSS],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!1,[tY.AT_SHOW_PRICES]:!0,[tY.AT_NUM_CONTRACTS]:1,[tY.AT_POSITION]:tY.AT_POSITION_LONG,[tY.AT_PROFIT_LOSS]:void 0},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_PROFIT_LOSS,type:"number",editable:!1},{id:tY.AT_NUM_CONTRACTS,type:"number"},{id:tY.AT_POSITION,type:"string",enum:[tY.AT_POSITION_SHORT,tY.AT_POSITION_LONG]},...sg,{id:tY.AT_SHOW_PRICES,type:"bool"}],numPoints:2},RewardRisk:{editable:[...ss,tY.AT_SHOW_PRICES,tY.AT_NUM_CONTRACTS,tY.AT_POSITION,tY.AT_RISK,tY.AT_REWARD,tY.AT_RATIO],defaults:{[tY.AT_ALLOW_PRICES_CHANGE_UI]:!1,[tY.AT_SHOW_PRICES]:!0,[tY.AT_NUM_CONTRACTS]:1,[tY.AT_POSITION]:tY.AT_POSITION_LONG,[tY.AT_RISK]:void 0,[tY.AT_REWARD]:void 0,[tY.AT_RATIO]:void 0},types:[{id:tY.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:tY.AT_REWARD,type:"number",editable:!1},{id:tY.AT_RISK,type:"number",editable:!1},{id:tY.AT_RATIO,type:"number",editable:!1},{id:tY.AT_NUM_CONTRACTS,type:"number"},{id:tY.AT_POSITION,type:"string",enum:[tY.AT_POSITION_SHORT,tY.AT_POSITION_LONG]},...sg,{id:tY.AT_SHOW_PRICES,type:"bool"}],numPoints:2}};function sP(e){return e?sv[e].editable:sv}var sC={};sC=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","SharesOutstanding","DeferredIncomeTax","DeferredLongRevenues","EquityOtherInvestments","IncomeTaxPayable","Intangibles","Inventories","LongTermDebt","MarketableSec","OtherCurrentAssets","OtherCurrentLiabilities","OtherEquity","OtherNonCurrentAssets","OtherNonCurrentLiabilities","PpeNet","PrepaidExpenses","Receivables","RetainedEarnings","ShorttermDebt","TotalAssets","TotalCurrentAssets","TotalCurrentLiabilities","TotalLiabilities","TotalLiabilitiesAndEquity","TotalNonCurrentAssets","TotalNonCurrentLiabilities","TotalShareholdersEquity","BasicEpsContOp","BasicEpsTotalOp","CostGoods","DilutedEpsContOp","DilutedEpsTotalOp","Ebitda","GrossProfit","IncomeTax","InterestExpense","NetIncome","OperatingExpenses","OperatingIncome","OtherIncomeExpenses","PreTaxIncome","Sales"]},"studyField":{"type":"string","enum":["HL/2","OC/2","HLC/3","OHLC/4","HLCC/4","AVG","MA","MA1","MA2","MA3","MA4","MA5","MA6","MA7","MA8","MA9","MA10","MAS","MAL","EMA","MAHI","MALO","MACD","MACDS","MACDH","MACDV","MACDVS","MACDVH","ENVU","ENVD","ENVEXPU","ENVEXPD","ENVSMOU","ENVSMOD","SMA","TMA","WMA","VOLMA","OSC","VOSC","RSI","RSIAVG","RSA","RSAAVG","STORSI","STORSIAVG","HH","LL","PercK","PercD","PercR","WGCL","BOLLBU","BOLLBL","BOLLBM","BOLLW","BOLLP","BOLLBW","BOLLBWA","OBVOL","OBVOLAVG","ATR","ADR","ADRP","ATRP","PDI","MDI","ADX","ADXM","ADL","ADWM","ADWMMA","CHAOSC","TP","KCUP","KCMID","KCLOW","KBUP","KBMID","KBLOW","DONUP","DONMID","DONLOW","DONW","PVT","ROC","TRIX","PVPT","PVPTR","PVPTS","ARNUP","ARNLOW","ARNOSC","TCHNUP","TCHNLOW","ALJAW","ALTEETH","ALLIPS","PLTLN","AWOS","AWOSMA","MFMUL","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","EMVMA","ERBLPOW","ERBRPOW","FI","MI","MOM","MOMMA","MFI","MSD","NVI","NVIEMA","PVI","PVIEMA","PPO","PPOS","PPOH","PVO","PVOS","PVOH","HV","PERF","WASI","WWVSARU","WWVSARD","PARSARS","PARSARL","MOVLR","TRSP1","TRSP2","PPTPIV","PPTR1","PPTR2","PPTR3","PPTS1","PPTS2","PPTS3","COTLCCMSP","COTLCLGSP","COTLCSMSP","COTDAGPRO","COTDAGSPD","COTDAGMNM","COTDAGOTH","COTFTRDLI","COTFTRASM","COTFTRLVF","COTFTROTH","TR","IMPVOL","CTM","CPMI","CTLTM","CTLTMF","DEMA","EOSC","TEMA","TSI","TSISIG","ADJATR","COTR","GMMA3","GMMA5","GMMA8","GMMA10","GMMA12","GMMA15","GMMA30","GMMA35","GMMA40","GMMA45","GMMA50","GMMA60","MCGD","HMA","COPP","CPPH4","CPPH3","CPPH2","CPPH1","CPPL1","CPPL2","CPPL3","CPPL4","REATRS","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","ATRMA","STOMOMIX","CHDMOMOSC","CHDMOMOSCAVG","VSTOPUP","VSTOPLOW","SUPTR","BARCOLIX","BARKIND","CONVLN","BASELN","LEADSP1","LEADSP2","LAGGSP","VWAP","VWAPSD1U","VWAPSD1L","VWAPSD2U","VWAPSD2L","PLVI","MNVI","DIFA","DOSCH","DOSCS","TTMSQZON","TTMSQZOFF","TTMSQZOSC","CRS","CRSAVG","JPIB","JPIS","DRS","MRS","PMO","PMOS","RVOL","WGALPH","UPVOL","DNVOL","TOTVOL","POC","VAREA","BARBACK","AVWAP","KST","KSTSIG","STC","MCCLO","NHLAI","CMBCI","CMBCIF","CMBCIS","COTI","CHEXL","CHEXS","MBBUO","MBBUI","MBBM","MBBLI","MBBLO","CHOP","MACLD1","MACLD2","BTI","PCUP1","PCDN1","PCUP2","PCDN2","PCUP3","PCDN3","PCTD","PCTP","TDIPRC","TDITSL","TDIMBL","TDIUPR","TDILWR","PPS","FRAMA","FISHER","FISHTRG","RCI","RCISIG","ZZPIVOT"]},"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","BBANDW","OBVOL","ATR","ADR","ADRP","ATRP","ADX","ADXMOD","ADL","ADWM","CHAOSC","TP","KELCHN","KELBND","DONCHN","DONWIDTH","PVT","ROC","TRIX","PPMOV","ARNUPDW","ARNOSC","TCHN","ALLG","PLTLN","AWEOSC","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","ERBLPOW","ERBRPOW","FI","MI","MOM","MFI","MSD","NVI","PVI","PPO","PVO","HV","PERF","WASI","WWVOL","PARTP","MOVLR","TRSP","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","EOSC","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRS","LINRCHN","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","OPINT","STOMOMIX","CHDMOMOSC","VSTOP","SUPTR","ICHCLD","VWAP","VOIN","DIFA","DOSC","MARIB","HASMO","TTMSQZ","CRS","JPI","CTTP","CTTI","DRS","MRS","PMO","RVOL","WGALPH","VOLAP","AVWAP","KST","STC","MCCLO","NHLAI","CMBCI","COTI","CHEXI","MBBANDS","OPTIV","IVRANK","IVPCTL","OPTVOLPC","OPTOIPC","OPTVOL","OPTOI","CHOP","MACLD","BTI","PC","GREEKS","PVACP","TDI","PPS","FRAMA","FISHER","RCI","ZIGZAG"]},"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","fillColor":"rgba(119,119,119,0.1)","dashStyle":"LongDashDot"}},"cycleTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","fillColor":"rgba(119,119,119,0.1)","dashStyle":"ShortDashDot"}}}}]},"annotationTraits":{"$ref":"#/definitions/annTraits"},"curveTraits":{"type":"array","items":{"$ref":"#/definitions/curveTrait"}},"allAnnotationsLocked":{"type":"boolean","default":false}}},"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"},"fillColor":{"$ref":"#/definitions/color"},"dashStyle":{"$ref":"#/definitions/dashStyle"}}},"fillTrait":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color"}}},"markerTrait":{"type":"object","additionalProperties":false,"properties":{"vertex":{"enum":["start","end","both","none"]},"kind":{"enum":["arrow"],"default":"arrow"}},"required":["vertex"]},"curveTrait":{"type":"object","additionalProperties":false,"properties":{"curveStyle":{"$ref":"#/definitions/curveStyle"},"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["curveStyle"]},"annTraits":{"type":"object","additionalProperties":true,"properties":{"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"},"marker":{"$ref":"#/definitions/markerTrait"},"zIndex":{"type":"number","minimum":1}}},"annotation":{"type":"object","additionalProperties":false,"properties":{"id":{"$ref":"#/definitions/annId"},"uid":{"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":166,"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 sE={};sE=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 sL={};sL=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 s_={};function sM(t){switch(t){case tY.CHART_SCHEMA:return e(sC);case tY.STUDIES_SCHEMA:return e(sb);case tY.FIELDS_SCHEMA:return e(sE);case tY.ACCESSOR_SCHEMA:return e(sL);default:throw Error(`Unknown schema name: ${t}`)}}s_=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":"MKTCAP","meta":{"title":"Market Capitalization","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#3498db"],"fields":["MKTCAP"]}]}},{"id":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10},{"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,"enumerations":[{"input":"ExtendLines","values":["None","Left","Right","Both"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Width","value":2},{"name":"ExtendLines","value":"None"}],"curves":[{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRUP"]},{"colors":["rgba(255, 0, 0, 0.3)"],"fields":["LINRMID"]},{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRLOW"]},{"colors":["rgba(0, 0, 255, 0.1)"],"fields":["LINRUP","LINRMID"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 0, 0, 0.1)"],"fields":["LINRMID","LINRLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVEXP","meta":{"title":"Moving Average Envelope Exponential","overlay":true},"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":"Bollinger Bands Modified","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"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":["BOLLW"]}]}},{"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":["BOLLP"]}],"levels":[{"value":0,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":1,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(19, 132, 132, 0.1)"},"range":{"from":0,"to":1}}]}},{"id":"OBVOL","meta":{"title":"On Balance Volume","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":20}],"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":"ADR","meta":{"title":"Average Daily Range (ADR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#ffaf1c"],"fields":["ADR"]}]}},{"id":"ADRP","meta":{"title":"Average Daily Range Percent (ADRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#fb1cff"],"fields":["ADRP"]}]}},{"id":"ATRP","meta":{"title":"Average True Range Percent (ATRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"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":"EOSC","meta":{"title":"Exponential Oscillator","overlay":false,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10},{"name":"Source","value":"Close"}],"curves":[{"colors":["#ff6f00"],"fields":["EOSC"]}]}},{"id":"TEMA","meta":{"title":"Moving Average Exponential TEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"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":"REATRS","meta":{"title":"Retracement ATR Stop","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]}]},"defaults":{"source":"Close","inputs":[{"name":"Direction","value":"Long"},{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"High/Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#981e7a"],"fields":["REATRS"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true},"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":"ATR 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},{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["DIFA"],"style":"Area","visible":false,"zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false},"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":"BBANDW","meta":{"title":"Bollinger BandWidth","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"curves":[{"colors":["#3d8283"],"fields":["BOLLBW"]},{"colors":["#f08f4c"],"fields":["BOLLBWA"]}]}},{"id":"MARIB","meta":{"title":"Moving Average Ribbon","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"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"]}]}},{"id":"TDI","meta":{"title":"Traders Dynamic Index","overlay":false,"range":{"min":0,"max":100},"decimals":2,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodRSI","value":13},{"name":"PeriodTradeSignal","value":7},{"name":"PeriodMarketBase","value":34},{"name":"PeriodBB","value":34},{"name":"MultiplierBB","value":1.6185},{"name":"Source","value":"Close"}],"curves":[{"colors":["#0088ff"],"fields":["TDIUPR"]},{"colors":["#0088ff"],"fields":["TDILWR"]},{"colors":["rgba(0, 136, 255, 0.1)"],"fields":["TDIUPR","TDILWR"],"style":"Ribbon","lineWidth":0},{"colors":["#00c853"],"fields":["TDIPRC"],"lineWidth":2},{"colors":["#ff1744"],"fields":["TDITSL"],"lineWidth":2},{"colors":["#ff9100"],"fields":["TDIMBL"],"lineWidth":2}],"levels":[{"value":70,"name":"Overbought","line":{"color":"#808080","dashStyle":"Dash"}},{"value":30,"name":"Oversold","line":{"color":"#808080","dashStyle":"Dash"}}]}},{"id":"PPS","meta":{"title":"Price Percent Stop","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]},{"input":"Type","values":["Percent","Price"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Range","value":"High/Low"},{"name":"Direction","value":"Long"},{"name":"Type","value":"Percent"},{"name":"StopValue","value":10}],"curves":[{"colors":["#fc0d1b","#00b04b"],"fields":["PPS"],"varyColorPerBar":true}]}},{"id":"FRAMA","meta":{"title":"Fractal Adaptive Moving Average","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":16},{"name":"Source","value":"HL/2"}],"curves":[{"colors":["#ef4226"],"fields":["FRAMA"]}]}},{"id":"FISHER","meta":{"title":"Fisher Transform","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":9}],"curves":[{"colors":["#2962FF"],"fields":["FISHER"]},{"colors":["#FF6D00"],"fields":["FISHTRG"]}],"levels":[{"value":1.5,"name":"1.5","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":0.75,"name":"0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":0,"name":"0","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":-0.75,"name":"-0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":-1.5,"name":"-1.5","line":{"color":"#E91E63","dashStyle":"Dash"}}]}},{"id":"RCI","meta":{"title":"Spearman Rank Correlation Index","overlay":false,"decimals":2,"range":{"min":-100,"max":100},"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":10},{"name":"PeriodSignal","value":3},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#2196F3"],"fields":["RCI"],"lineWidth":2},{"colors":["#FF9800"],"fields":["RCISIG"]}],"levels":[{"value":80,"name":"+80","line":{"color":"#808080","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#808080","dashStyle":"DashDot"}},{"value":-80,"name":"-80","line":{"color":"#808080","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":-80,"to":80}}]}},{"id":"ZIGZAG","meta":{"title":"ZigZag","overlay":true,"enumerations":[{"input":"PercentMode","values":["Fixed","ATR"]},{"input":"Method","values":["High/Low","Source"]},{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"ReversalChange","values":["None","Absolute","Percent"]}]},"defaults":{"inputs":[{"name":"PercentMode","value":"ATR"},{"name":"Method","value":"High/Low"},{"name":"Source","value":"Close"},{"name":"ReversalChange","value":"None"},{"name":"Percent","value":5},{"name":"PeriodAtr","value":14},{"name":"MultiplierAtr","value":2.5}],"curves":[{"colors":["#2962FF"],"fields":["ZZPIVOT"]}]}}]');let sx=[],sI=!1,sD=!0;function sO(e){sx=sx.concat(aT(e,tY.STUDIES_SCHEMA))}let sw=new Map;function sR(){sI||(sO(e(s_)),sI=!0);let t=er[AM()?.config.mode??"Unspecified"];if(!sD)return sx;if(!sw.has(t)){let e=eh(sW,t);sw.set(t,sx.filter(e))}return sw.get(t)}function sN(e){return ez(sH(e))}function sV(e){return i7(Ax().display,e)}function sH(e){return sR().find(t=>t.id===e)}function sF(e){return void 0!==sH(e)}function sB(e){let t=[aL.Open,aL.High,aL.Low,aL.Close,aL.Volume].map(e=>e.id);return e.defaults.source&&!t.includes(e.defaults.source)}function sk(e){return[er.DemoSite,er.cmdtyView].includes(e)}function sW(e,t){let i=t.id;if("PVACP"===i)return[er.cmdtyView,er.DemoSite].includes(e);let s=[er.GBE,er.cmdtyView];return!(["CPMI","CTPI","CTM","JPI","CTTP","CTTI"].includes(i)&&!s.includes(e))}let sU=null,s$=!1;function sG(){if(!s$){let e=[K.Study,K.BalanceSheet,K.IncomeStatement],t=e.reduce((e,t)=>(e[t]=[],e),{});Object.values(aL).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($).filter(e=>{let t=parseInt(e);if(Number.isFinite(t))return $[t]}),s=ez(sR()).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(sP()).map(([e,t])=>({id:e,options:t.editable,types:t.types,numPoints:t.numPoints}));sU={studies:s,incomeStatements:t[K.IncomeStatement],balanceSheets:t[K.BalanceSheet],studyFields:t[K.Study],curveStyles:i,annotations:r},s$=!0}return sU}var sz={};function sY(e,t,i){return[].concat((0,sz.apply)(t,e,i))}function sj(e,t,i){let s=ez(e),r=sY(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!==tY.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)}sz=N("3DQaT");let sK=["1D","5D","1M","3M","6M","1Y","5Y","Max"];function sq(e){return 1===e.length}function sX(e){return 1===e.length}let sZ={ATRLTR:"REATRHI",ATRSTR:"REATRLO",PeriodMARng:"PeriodAdjATR",PeriodAdjATR:"FactorAdjATR"},sJ={BBANDS:{colors:["#89211e"],fields:["BOLLBM"],visible:!1},DONCHN:{colors:["#ff6a00"],fields:["DONMID"],visible:!1}},sQ={[tY.AT_SINGLE_STYLE]:!0,[tY.AT_SHOW_BACKGROUND]:!1,[tY.AT_BACKGROUND_OPACITY]:.2},s0={[tY.AT_SHOW_PRICES]:!0,[tY.AT_SHOW_LEVELS]:!0,[tY.AT_LEVELS_KIND]:tY.AT_LEVELS_PERCENTS,[tY.AT_LABELS]:tY.AT_LABELS_LEFT,[tY.AT_EXTEND_LEFT]:!1,[tY.AT_EXTEND_RIGHT]:!0,[tY.AT_REVERSE]:!1,...sQ},s1={FibonacciFan:{[tY.AT_SHOW_LEVELS]:!1,[tY.AT_LABELS]:tY.AT_LABELS_RIGHT,[tY.AT_REVERSE]:!1,...sQ},FibonacciArcs:{[tY.AT_SHOW_LEVELS]:!1,...sQ},FibonacciRetracement:{...s0},TrendBasedFibExtension:{...s0},FibonacciChannel:{[tY.AT_SHOW_LEVELS]:!0,[tY.AT_LEVELS_KIND]:tY.AT_LEVELS_PERCENTS,[tY.AT_LABELS]:tY.AT_LABELS_LEFT,...sQ},FibonacciTimeZones:{[tY.AT_SHOW_LEVELS]:!0,[tY.AT_LABELS]:tY.AT_LABELS_RIGHT,...sQ},GannFan:{[tY.AT_SHOW_LEVELS]:!1,...sQ},GannBox:{...sQ,[tY.AT_SHOW_BACKGROUND]:!0},GannSquare:{...sQ,[tY.AT_SHOW_BACKGROUND]:!0}},s2=()=>({width:1,color:i1(Math.floor(100*Math.random())),dashStyle:"Solid"}),s3=["FibonacciFan","FibonacciArcs","FibonacciChannel","FibonacciTimeZones","FibonacciRetracement","TrendBasedFibExtension"],s4=[...s3,"GannFan","GannBox","GannSquare"],s5=["Line","Ray","GannLine"],s6=["ComputedText","ProfitLoss","RewardRisk"];function s7(e){return s3.includes(e)?["factors"]:"GannFan"===e?["angles"]:"GannBox"===e?["priceLevels","timeLevels"]:"GannSquare"===e?["levels","fans","arcs"]:[]}function s8(e,t,i){let s=!e$(e,t)||!Array.isArray(e[t]),r=!s&&e[t].some(e=>!eF(e.value));if(s||r)return e[t]=i[t],!0}function s9(e,t){if(!eF(t))return;let i=s7(e),s=i7(null,e);for(let e of i)if(!s8(t,e,s))for(let i of t[e])Number.isFinite(i.value)&&(i.value=eB(i.value,6))}function re(e,t,i=!1){let s="FibonacciFan"===e,r=eF(t);if(s4.includes(e)&&r){i&&ej(t,s1[e]);let r=s7(e),n=i7(null,e);for(let e of r)if(!s8(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));eF(i.line)||(i.line=t?t.line:s2()),s&&0===i.value&&!eF(i.shown)&&(i.shown=!0)}"FibonacciChannel"===e&&t[tY.AT_SHOW_LABELS]?(t[tY.AT_SHOW_LEVELS]=t[tY.AT_SHOW_LABELS],delete t[(0,tY).AT_SHOW_LABELS]):"FibonacciArcs"!==e||t[tY.AT_SHOW_TRENDLINE]||(t[tY.AT_SHOW_TRENDLINE]=!0)}s5.includes(e)&&r&&!eF(t[tY.AT_MARKER])&&(t[tY.AT_MARKER]={...sS}),r&&(t[tY.AT_ALLOW_PRICES_CHANGE_UI]=!s6.includes(e))}let rt=[3,4,5,6,7,8,9,10,11],ri=[12,13,14,15,16,17,18,19,20],rs=[{name:"Source",value:"Close"},{name:"Average",value:"MA"}];function rr(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 rn(e,t){let i=e.find(e=>"TurtleChnField"===e.name&&e.value===t);eH(i)&&(i.value="High/Low")}let ra={colors:["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],fields:["DIFA"],style:"Area",visible:!1,zones:[{value:0,colors:1},{colors:1}]};function ro(e){return function(t){return t.version=e,t}}let rl=ro(44),ru=ro(45),rh=ro(46),rc=ro(47),rd=ro(48),rp=ro(49),rf=ro(50),rm=ro(51),rg=ro(52),ry=ro(53),rA=ro(54),rS=ro(55),rT=ro(56),rv=ro(58),rP=ro(59),rC=ro(61),rb=ro(62),rE=ro(63),rL=ro(64),r_=ro(67),rM=ro(69),rx=ro(74),rI=ro(75),rD=ro(76),rO=ro(81),rw=ro(82),rR=ro(83),rN=ro(85),rV=ro(86),rH=ro(88),rF=ro(89),rB=ro(92),rk=ro(93),rW=ro(94),rU=ro(95),r$=ro(97),rG=ro(98),rz=ro(99),rY=ro(100),rj=ro(101),rK=ro(103),rq=ro(105),rX=ro(107),rZ=ro(108),rJ=ro(110),rQ=ro(112),r0=ro(115),r1=ro(118),r2=ro(119),r3=ro(121),r4=ro(122),r5=ro(123),r6=ro(124),r7=ro(126),r8=ro(127),r9=ro(129),ne=ro(130),nt=ro(132),ni=ro(133),ns=ro(134),nr=ro(135),nn=ro(136),na=ro(138),no=ro(139),nl=ro(141),nu=ro(143),nh=ro(146),nc=ro(147),nd=ro(148),np=ro(150),nf=ro(153),nm=ro(155),ng=ro(156),ny=ro(157),nA=ro(158),nS=ro(159),nT=ro(160),nv=ro(163),nP={_3to4:function(e){let t=e.data.period;if(null!==t){let i="Max"===t?tY.AUTOFIT_PERIOD:`P${t}`,s=sK.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=sY(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=ez(tY.COLOR_DEFAULT_VARY)}return e.version=5,e},_5to6:function(e){let t=sY(e,'..panes[0]..plots{.type === "Symbol"}[0]');return 1===t.length&&(t[0].main=!0),e.version=6,e},_6to7:function(e){let t=sY(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=ix(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=sY(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===tY.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=sY(e,t);if(sq(s)&&!sq(sY(s,i))){let e=sY(AM().template,t+i);sq(e)&&(s[0].minorGridLines=e[0])}return e.version=9,e},_9to10:function(e){let t=".display.navigator",i=".enabled",s=sY(e,t);if(sX(s)&&!sX(sY(s,i))){let e=sY(AM().template,t+i);sX(e)&&(s[0].enabled=e[0])}return e.version=10,e},_10to11:function(e){let t=sY(e,'..plots{.type === "Study" && .study === "TCHN"}');return t.length>0&&t.forEach(e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===tY.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=sY(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 sY(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=sY(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=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ATRLTR","ATRSTR"]}),i=e=>e$(sZ,e)?sZ[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=sY(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(eF(t)&&eF(t.factors)){let e=i7(null,i).factors,s=t.factors.map((t,i)=>{let s=!eF(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=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHM","STOCHS"]});return t.length>0&&t.forEach(e=>{let t="STOCHM"===e.study,i=sN(t?"STOCHS":e.study);eF(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=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["BBANDS","DONCHN"]});return t.length>0&&t.forEach(e=>{if(eF(e.curves)&&e.curves?.length===3){let t=ez(sJ[e.study]);e.curves.push(t)}}),e.version=18,e},_18to19:function(e){let t=sY(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=sY(e,".display.yAxis");if(1===t.length){let e=t[0];eF(e.showLastValue)&&(e.showLastValue=e.showLastValue?"All":"None")}return e.version=20,e},_20to21:function(e){let t=sY(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=sY(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=sY(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=sY(e,'..plots{.type === "Study" && .study === "MOM"}');if(t.length>0){let e=sN("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=sY(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=sN(e.study).defaults.inputs}),e.version=26,e},_26to27:function(e){let t=sY(e,'..plots{.type === "Study" && .study === "ATR"}');if(t.length>0){let e=sN("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=sY(e,'..plots{.type === "Study"}'),i=sN("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(eF(t))return t.shift})(e);eF(t)&&(e.shift=t)})}),e.version=28,e},_28to29:function(e){let t=av(sj(e,'..plots{.type === "Study" && .study === "DEMARK"}',e=>tY.NULL_OBJECT));return t.version=29,t},_29to30:function(e){let t=av(sj(e,'..plots{.type === "Study" && .study === "ULTOSC"}',e=>tY.NULL_OBJECT));return t.version=30,t},_30to31:function(e){let t=sY(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;eF(r)&&(r.line2=i7(null,i).line2)}}),e.version=31,e},_31to32:function(e){return e.version=32,e},_32to33:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:sR().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=sY(e,'..plots{.type === "Study" && .study === "VWAP"}'),i=sN("VWAP");return t.length>0&&t.forEach(e=>{eF(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=sY(e,`..plots{.type === "Study" && .study === "${t}"}`);if(i.length>0){let e=sN(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 sY(e,"..annotations").forEach(e=>{e.uid=e1()}),e.version=36,e},_36to37:function(e){return e.version=37,e},_37to38:function(e){let t=sY(e,'..plots{.type === "Study" && .study === "CRS"}'),i=sN("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=sY(e,'..plots{.type === "Study" && .study === "PERF"}'),i=sN("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=sY(e,"..annotations"),i=["FibonacciTimeZones","FibonacciFan","FibonacciArcs"],s=sP();return t.forEach(e=>{let t=e.id;i.includes(t)?e.traits.factors=ez(s[t].defaults.factors):"GannFan"===t&&(e.traits.angles=ez(s[t].defaults.angles))}),e.version=43,e},_43to44:rl,_44to45:ru,_45to46:rh,_46to47:rc,_47to48:rd,_48to49:rp,_49to50:rf,_50to51:rm,_51to52:rg,_52to53:ry,_53to54:rA,_54to55:rS,_55to56:rT,_56to57:function(e){let t=sY(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:rv,_58to59:rP,_59to60:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["VOL","MAVOL"]}),i=sN("MAVOL");return t.length>0&&t.forEach(e=>{if(!eF(e.curves))return;let t=+("VOL"!==e.study);eF(e.inputs)||(e.inputs=[]),1===t&&e.curves?.length===1&&e.curves.push(ez(i.defaults.curves[1])),e.inputs.push({name:"BarColoring",value:(e=>{if(!eF(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:rC,_61to62:rb,_62to63:rE,_63to64:rL,_64to65:function(e){let t="DIFA",i=sY(e,`..plots{.type === "Study" && .study === "${t}"}`),s=sN(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 sY(e,"..annotations").forEach(e=>{if("FibonacciTimeZones"===e.id){let t=e.points;if(1===t.length){let e=ez(t[0]);e.time+=1,t.push(e)}}}),e.version=66,e},_66to67:r_,_67to68:function(e){let t=sY(e,'..plots{.type === "Study" && .study === "DPO"}'),i=sN("DPO");return t.length>0&&t.forEach(e=>{if(eF(e.curves)&&e.curves?.length===1&&!eF(e.levels)){let t=e.curves[0];if(t.colors?.length===1&&!eF(t.zones)){e.levels=i.defaults.levels,t.zones=i.defaults.curves[0].zones;let s=iE(t.colors[0],.3);t.colors=[s,s]}}}),e.version=68,e},_68to69:rM,_69to70:function(e){let t="RSISTO",i=sY(e,`..plots{.type === "Study" && .study === "${t}"}`),s=sN(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 sY(e,"..annotations").forEach(e=>re(e.id,e.traits,!0)),e.version=71,e},_71to72:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["GTPI","GPMI","CBMI"]}),i=sN("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:rt[Number(e.value)-1]}:"SlowNumber"===e.name?{name:"SlowPeriod",value:ri[Number(e.value)-1]}:e),e.inputs.splice(2,0,i.defaults.inputs[2])))}),e.version=72,e},_72to73:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["JPI"]}),i=sN("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:rx,_74to75:rI,_75to76:rD,_76to77:function(e){let t="COPP",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[`${t}`]}),s=sN(t);return i.length>0&&i.forEach(e=>{eF(e.inputs)&&(e.curves=s.defaults.curves,e.levels=s.defaults.levels)}),e.version=77,e},_77to78:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MFI"]}),i=sN("MFI");return t.length>0&&t.forEach(e=>{eF(e.inputs)&&(e.levels=i.defaults.levels,e.bands=i.defaults.bands)}),e.version=78,e},_78to79:function(e){let t="RSIMOD",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["RSI",t]}),s=sN("RSI"),r=sN(t);return i.length>0&&i.forEach(e=>{if(eF(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=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CCI"]}),i=sN("CCI");return t.length>0&&t.forEach(e=>{if(eH(e.inputs)){let t=e.curves[0].colors[0],s=iE(t,.3);e.curves=i.defaults.curves;let r=e.curves[0].colors;r[0]=r[3]=s,r[2]=t,eH(e.levels)?e.levels.splice(1,0,i.defaults.levels[1]):e.levels=i.defaults.levels,eH(e.bands)||(e.bands=i.defaults.bands)}}),e.version=80,e},_80to81:rO,_81to82:rw,_82to83:rR,_83to84:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP"]}),i=sN("MACD");return t.length>0&&t.forEach(e=>{eF(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=84,e},_84to85:rN,_85to86:rV,_86to87:function(e){let t="BBANDS",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sN(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===3&&e.inputs.push(s.defaults.inputs[3])}),e.version=87,e},_87to88:rH,_88to89:rF,_89to90:function(e){let t=sY(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=sY(e,`..plots{.type === "Study" && .study === "${t}" }`),s=sN(t);return i.length>0&&i.forEach(e=>{e.inputs?.length===3&&e.inputs.push(s.defaults.inputs[3])}),e.version=91,e},_91to92:rB,_92to93:rk,_93to94:rW,_94to95:rU,_95to96:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PMO"]}),i=sN("PMO");return t.length>0&&t.forEach(e=>{eF(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=96,e},_96to97:r$,_97to98:rG,_98to99:rz,_99to100:rY,_100to101:rj,_101to102:function(e){return sY(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[tY.AT_SHOW_PRICES]=e.traits[tY.AT_DRAW_LINES]??!0,delete e.traits[(0,tY).AT_DRAW_LINES],e.traits[tY.AT_POSITION]=e.traits.pos??"Long",delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[tY.AT_ALLOW_PRICES_CHANGE_UI]=!1}}),e.version=102,e},_102to103:rK,_103to104:function(e){let t="UseAllFields";return sY(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:rq,_105to106:function(e){let t=sY(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(eH(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:rX,_107to108:rZ,_108to109:function(e){let t=sY(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;eH(i)&&i.splice(0,0,...rs);let s=e.curves;eH(s)&&t&&(s[0].fields[0]="AVG")}),e.version=109,e},_109to110:rJ,_110to111:function(e){return sY(e,"..annotations").forEach(e=>{("LongPosition"===e.id||"ShortPosition"===e.id)&&(e.traits[tY.AT_ALLOW_PRICES_CHANGE_UI]=!0)}),e.version=111,e},_111to112:rQ,_112to113:function(e){let t="CHEXI",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sN(t).defaults;return i.length>0&&i.forEach(e=>{eH(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=sY(e,"..plots{.detachedScale}");return t.length>0&&t.forEach(e=>{e.detachedScale=!0}),e.version=114,e},_114to115:r0,_115to116:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHS"]});return t.length>0&&t.forEach(e=>{let t=sN(e.study).defaults;eH(e.inputs)&&eH(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=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHAMF"]});return t.length>0&&t.forEach(e=>{let t=sN(e.study).defaults;eH(e.inputs)&&eH(e.curves)&&(e.curves[0]=t.curves[0])}),e.version=117,e},_117to118:r1,_118to119:r2,_119to120:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHDMOMOSC","TSI","DIFA"]});return t.length>0&&t.forEach(e=>{let t=sN(e.study).defaults;if(eH(e.inputs)&&eH(e.curves))switch(e.study){case"CHDMOMOSC":case"TSI":{let i=e.levels?.[0];e.levels=t.levels,eH(i)&&(e.levels[1]=i);break}case"DIFA":{let[i,s]=e.curves[0].colors;e.curves=[t.curves[0]],e.curves[0].colors=[i,ib(i),s,ib(s)]}}}),e.version=120,e},_120to121:r3,_121to122:r4,_122to123:r5,_123to124:r6,_124to125:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP","PPO"]});return t.length>0&&t.forEach(e=>{let t=sN(e.study).defaults;if(eH(e.inputs)&&eH(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=>iE(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:r7,_126to127:r8,_127to128:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CRS"]}),i=sN("CRS");return t.length>0&&t.forEach(e=>{eF(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=128,e},_128to129:r9,_129to130:ne,_130to131:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PC"]}),i=sN("PC");return t.length>0&&t.forEach(e=>{if(eH(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:nt,_132to133:ni,_133to134:ns,_134to135:nr,_135to136:nn,_136to137:function(e){let t="VOLAP",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sN(t);return i.length>0&&i.forEach(e=>{if(eH(e.inputs)&&5===e.inputs.length){let t=e.inputs.find(e=>"Bars"===e.name);eH(t)&&(t.name="LevelSize"),e.inputs=[{name:"LevelMode",value:"Count"},...e.inputs,{name:"ValueRangePercent",value:70}]}if(eH(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=>iE(e,.6))}}),e.version=137,e},_137to138:na,_138to139:no,_139to140:function(e){let t="ADXMOD",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ADX",t]}),s=sN("ADX"),r=sN(t);return i.length>0&&i.forEach(e=>{if(eF(e.inputs)){let t="ADX"===e.study?s.defaults:r.defaults;e.levels=[...t.levels]}}),e.version=140,e},_140to141:nl,_141to142:function(e){let t="CHDMOMOSC",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sN(t);return i.length>0&&i.forEach(e=>{if(eF(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:nu,_143to144:function(e){let t="MACDV",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sN(t);return i.length>0&&i.forEach(e=>{if(eH(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=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i,s]}),n=sN(t),a=sN(s);return r.length>0&&r.forEach(e=>{if(eH(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:nh,_146to147:nc,_147to148:nd,_148to149:function(e){let t=sY(e,'..plots{.type === "Seasonal"}');return t.length>0&&t.forEach(e=>{rr(e)}),e.version=149,e},_149to150:np,_150to151:function(e){let t="REATRHI",i="REATRLO",s=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i]});return s.length>0&&s.forEach(e=>{if(eH(e.inputs)){switch(e.study){case t:e.inputs.unshift({name:"Direction",value:"Long"}),rn(e.inputs,"High");break;case i:e.inputs.unshift({name:"Direction",value:"Short"}),rn(e.inputs,"Low")}e.study="REATRS",e.curves[0].fields[0]="REATRS"}}),e.version=151,e},_151to152:function(e){let t=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:["DIFA"]});return t.length>0&&t.forEach(e=>{eH(e.curves)&&e.curves.push(ra)}),e.version=152,e},_152to153:nf,_153to154:function(e){let t=["BPERC","BSQUEEZE","BWIDTH"],i=["BOLLP","BOLLBW","BOLLW"],s=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:t});return s.length>0&&s.forEach(e=>{let s=t.indexOf(e.study),r="BSQUEEZE"===e.study;r&&(e.study="BBANDW"),eH(e.curves)&&(e.curves[0].fields[0]=i[s],r&&e.curves.push({colors:["#f08f4c"],fields:["BOLLBWA"]})),eH(e.inputs)&&r&&e.inputs.push({name:"Average",value:"MA"},{name:"PeriodAvg",value:5})}),e.version=154,e},_154to155:nm,_155to156:ng,_156to157:ny,_157to158:nA,_158to159:nS,_159to160:nT,_160to161:function(e){let t=sY(e,'..plots{.type === "Study" && .study === "LINRCHN"}');return t.length>0&&t.forEach(e=>{eH(e.inputs)&&e.inputs.push({name:"ExtendLines",value:"None"})}),e.version=161,e},_161to162:function(e){let t=e.display?.xAxis?.cycleTransition,i=e.display?.xAxis?.contractTransition,s=e=>{eF(e)&&!eF(e.fillColor)&&(e.fillColor="rgba(119,119,119,0.1)")};return s(t),s(i),e.version=162,e},_162to163:nv,_163to164:ro(164),_164to165:ro(165),_165to166:function(e){let t="ZIGZAG",i=sY(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=sN(t).defaults.inputs??[],r=s.find(e=>"ReversalChange"===e.name),n=s.findIndex(e=>"ReversalChange"===e.name);return i.length>0&&eH(r)&&i.forEach(e=>{if(eH(e.inputs)&&!e.inputs.some(e=>"ReversalChange"===e.name)){let t=n>=0?Math.min(n,e.inputs.length):e.inputs.length;e.inputs.splice(t,0,{...r})}}),e.version=166,e}};function nC(e,t){tt(2,arguments);var i=tl(e),s=tl(t);return i.getTime()===s.getTime()}function nb(e,t){tt(2,arguments);var i=ts(e),s=ts(t);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function nE(e){tt(1,arguments);var t=ts(e),i=t.getMonth();return t.setMonth(i-i%3,1),t.setHours(0,0,0,0),t}function nL(e,t){tt(2,arguments);var i=nE(e),s=nE(t);return i.getTime()===s.getTime()}var n_={};function nM(e,t){tt(1,arguments);var i,s,r,n,a,o,l,u,h=te(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:n_.weekStartsOn)?s:null==(l=n_.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=ts(e),d=c.getDay();return c.setDate(c.getDate()-(7*(d<h)+d-h)),c.setHours(0,0,0,0),c}function nx(e,t,i){tt(2,arguments);var s=nM(e,i),r=nM(t,i);return s.getTime()===r.getTime()}function nI(e,t){tt(2,arguments);var i=ts(e),s=ts(t);return i.getFullYear()===s.getFullYear()}function nD(e){return{unit:eG(e,"Day","unit"),size:eG(e,1,"size"),spec:eG(e,"None","spec"),isContractVolume:eG(e,!1,"isContractVolume"),dividendsAdjust:eG(e,!1,"dividendsAdjust"),backAdjust:eG(e,!1,"backAdjust"),daysToExpiration:eG(e,1,"daysToExpiration"),contractRoll:eG(e,"combined","contractRoll")}}function nO(e){let t=nD(e);return new nF(G[t.unit],t.size,z[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function nw(e,t){return nC(e,t)&&nN(e,t)}function nR(e,t){return nx(e,t)&&nN(e,t)}function nN(e,t){return nb(e,t)&&nI(e,t)}function nV(e,t){return nL(e,t)&&nI(e,t)}function nH(e,t){return+e==+t}class nF{unit;size;spec;isContractVolume;dividendsAdjust;backAdjust;daysToExpiration;contractRoll;constructor(e=G.Day,t=1,i=z.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 nF(this.unit,this.size,this.spec,this.isContractVolume,this.dividendsAdjust,this.backAdjust,this.daysToExpiration,this.contractRoll)}getHashKey(){return`[${this.unit}:${this.size}:${this.spec}:${this.isContractVolume}:${this.dividendsAdjust}:${this.backAdjust}:${this.daysToExpiration}:${this.contractRoll}]`}toShortString(){if(this.unit===G.Tick){let e="T",t=!0;switch(this.spec){case z.PerCount:e="Tpb";break;case z.PerVolume:e="Vpb";break;case z.PerRange:e="Rpb";break;case z.PerSeconds:e="Spb";break;default:t=!1}return`${t?this.size:""}${e}`}if(this.unit===G.Intraday)return this.size%60==0?`${this.size/60}h`:`${this.size}`;{let e="";return this.spec===z.Nearest?e="n":this.spec===z.Continue&&(e="c"),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e="";switch(this.unit){case G.Tick:e="Tick";break;case G.Intraday:if(this.size%60==0){let t=this.size/60;e=`${t} hour${t>1?"s":""}`}else e=`${this.size<10?" ":""}${this.size} minute${this.size>1?"s":""}`;break;case G.Day:e="Daily";break;case G.Week:e="Weekly";break;case G.Month:e="Monthly";break;case G.Quarter:e="Quarterly";break;case G.Year:e="Yearly"}return e}describe(){let e=this.unitToString();switch(this.spec){case z.Nearest:e+=" Nearest";break;case z.Continue:e+=" Continue";break;case z.PerCount:e="Ticks Per Bar";break;case z.PerVolume:e="Volume Per Bar";break;case z.PerRange:e="Range Per Bar";break;case z.PerSeconds:e="Seconds Per Bar";case z.None:}return e}get hasSpec(){return this.spec!==z.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===G.Tick}get isIntraday(){return this.unit===G.Intraday}get isMultiContract(){let e=this.spec===z.Nearest,t=this.spec===z.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}}function nB(e){delete e.display.chart.bar}function nk(e){eF(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,eF(e.data.range)&&delete e.data.range,delete e.data.checkRange}function nW(e){ay(e.display.period)&&delete e.display.period}function nU(e){eF(e.display.density)&&delete e.display.density}function n$(e){switch($[e]){case $.Candlestick:case $.HollowCandles:case $.HeikinAshi:case $.ElderImpulseSystem:case $.Column:case $.Renko:case $.Range:case $.Kagi:case $.PointAndFigure:case $.LineBreak:case $.HLC:return!0;default:return!1}}function nG(e,t){let i=AM().getDefaultMultiFieldCurve();if(null!==i&&i.style===e)return i;let s=e=>e.id,r=[aL.Open,aL.High,aL.Low,aL.Close,aL.Change].map(s);$[e]===$.HLC&&r.splice(0,1);let n=[aL.Close].map(s),a=ez(tY.COLOR_DEFAULT_AREA),o=ez(tY.COLOR_DEFAULT_OHLC),l=ez(tY.COLOR_DEFAULT_VARY),u={fields:r,colors:l,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch($[e]){case $.OHLC:case $.HLC:case $.Renko:case $.LineBreak:case $.Range:case $.Kagi:case $.PointAndFigure:u.colors=t?l:[o];break;case $.Candlestick:case $.HollowCandles:case $.HeikinAshi:case $.MultiColumn:break;case $.ElderImpulseSystem:u.colors=l.concat(a);break;case $.Line:case $.PercentChange:u.fields=n,u.colors=[o];break;case $.Area:u.fields=n,u.colors=[iE(a,.5),a];break;case $.Baseline:u.fields=n,u.colors=l.map(e=>iE(e,.5)),u.zones=[{value:0,colors:1},{colors:1}];break;case $.Column:u.fields=n;break;default:throw Error(`Curve style "${e}" is not supported here.`)}return u}let nz=["Renko","Kagi","PointAndFigure","LineBreak","Baseline"];function nY(e,t){let i=t.curves[0],s=as(e);return s.curves=[function(e,t){var i;Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||n$(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 Z.Symbol:case Z.Expression:{let e=t.style||"Candlestick",i=t.varyColorPerBar||n$(e);return nG(e,i)}case Z.Forward:case Z.Seasonal:return{fields:["Close"],style:"Line",lineWidth:2,visible:!0,colors:["#888"],varyColorPerBar:!1};default:throw Error(`Unexpected plot type '${Z[e]}', don't know its default curve.`)}}(Z[t],e);return eY(s,e,!1),s}(i,t.type)],t.isMultiCurveMain&&t.curves.length>1&&s.curves.push(...t.curves.slice(1)),"Symbol"===t.type&&eF(i)&&nz.includes(i.style)&&(eF(t.inputs)?s.inputs=t.inputs:delete s.inputs),e}function nj(e,t,i){return(i=i||" ",e.length>t)?e:(t-=e.length,e+(i+=i.repeat(t)).slice(0,t))}class nK 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,nK.prototype):this.__proto__=nK.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,nK)}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=nj("",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+" | "+nj("",r.column-1," ")+nj("",o-r.column,"^")}else t+="\n at "+n}return t}}let nq=function(e,t){var i,s,r;let n,a={},o=(t=void 0!==t?t:{}).grammarSource,l={expr:ee},u=ee,h=K("//",!1),c=/^[^\r\n]/,d=q(["\r","\n"],!0,!1),p=/^[\r\n]/,f=q(["\r","\n"],!1,!1),m=function(e){return e.trim()},g=function(e,t,i){return{op:t.op,opLoc:t.loc,right:i}},y=function(e,t,i){return eh(t.reduce((e,t)=>ec({op:t.op,left:e,right:t.right},t.opLoc),e),i)},A=K("+",!1),S=K("-",!1),T=function(e){return{op:e,loc:j()}},v=K("*",!1),P=K("/",!1),C=K("^",!1),b=K("(",!1),E=K(")",!1),L=/^[0-9]/,_=q([["0","9"]],!1,!1),M=K(".",!1),x=K("{",!1),I=/^[A-Za-z0-9\^*$\-.|:_]/,D=q([["A","Z"],["a","z"],["0","9"],"^","*","$","-",".","|",":","_"],!1,!1),O=K("}",!1),w=/^[A-Za-z]/,R=q([["A","Z"],["a","z"]],!1,!1),N=X("trailing comment"),V=/^[ \t]/,H=q([" "," "],!1,!1),F=X("whitespace"),B=/^[ \t\r\n]/,k=q([" "," ","\r","\n"],!1,!1),W=0,U=0,$=[{line:1,column:1}],G=0,z=[],Y=0;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 j(){return J(U,W)}function K(e,t){return{type:"literal",text:e,ignoreCase:t}}function q(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function X(e){return{type:"other",description:e}}function Z(t){let i,s=$[t];if(s)return s;for(i=t-1;!$[i];)i--;for(s={line:(s=$[i]).line,column:s.column};i<t;)10===e.charCodeAt(i)?(s.line++,s.column=1):s.column++,i++;return $[t]=s,s}function J(e,t){let i=Z(e),s=Z(t);return{source:o,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:s.line,column:s.column}}}function Q(e){W<G||(W>G&&(G=W,z=[]),z.push(e))}function ee(){let t,i,s,r;if(t=W,(i=function(){let t,i,s,r,n,o,l,u;if(t=W,i=[],s=W,(r=eu())!==a)if("//"===e.substr(W,2)?(n="//",W+=2):(n=a,0===Y&&Q(h)),n!==a){for(o=W,l=[],c.test(e.charAt(W))?(u=e.charAt(W),W++):(u=a,0===Y&&Q(d));u!==a;)l.push(u),c.test(e.charAt(W))?(u=e.charAt(W),W++):(u=a,0===Y&&Q(d));(o=l!==a?e.substring(o,W):l)!==a?(p.test(e.charAt(W))?(l=e.charAt(W),W++):(l=a,0===Y&&Q(f)),l!==a?(U=s,s=r=m(o)):(W=s,s=a)):(W=s,s=a)}else W=s,s=a;else W=s,s=a;for(;s!==a;)if(i.push(s),s=W,(r=eu())!==a)if("//"===e.substr(W,2)?(n="//",W+=2):(n=a,0===Y&&Q(h)),n!==a){for(o=W,l=[],c.test(e.charAt(W))?(u=e.charAt(W),W++):(u=a,0===Y&&Q(d));u!==a;)l.push(u),c.test(e.charAt(W))?(u=e.charAt(W),W++):(u=a,0===Y&&Q(d));(o=l!==a?e.substring(o,W):l)!==a?(p.test(e.charAt(W))?(l=e.charAt(W),W++):(l=a,0===Y&&Q(f)),l!==a?(U=s,s=r=m(o)):(W=s,s=a)):(W=s,s=a)}else W=s,s=a;else W=s,s=a;return i!==a&&(U=t,i=i.filter(e=>e.length>0)),i}())!==a)if((s=et())!==a)if((r=el())!==a)if(eu()!==a){var n,o,l;U=t,n=i,o=eh(s,r),(l=n).length>0&&(o.leadingComments=l),t=i=o}else W=t,t=a;else W=t,t=a;else W=t,t=a;else W=t,t=a;return t}function et(){let e,t,i,s,r,n;if(e=W,(t=es())!==a){for(i=[],s=W,eu()!==a&&(r=ei())!==a&&eu()!==a&&(n=es())!==a?(U=s,s=g(t,r,n)):(W=s,s=a);s!==a;)i.push(s),s=W,eu()!==a&&(r=ei())!==a&&eu()!==a&&(n=es())!==a?(U=s,s=g(t,r,n)):(W=s,s=a);i!==a&&(s=el())!==a?(U=e,e=t=y(t,i,s)):(W=e,e=a)}else W=e,e=a;return e}function ei(){let t,i;return t=W,43===e.charCodeAt(W)?(i="+",W++):(i=a,0===Y&&Q(A)),i===a&&(45===e.charCodeAt(W)?(i="-",W++):(i=a,0===Y&&Q(S))),i!==a&&(U=t,i=T(i)),t=i}function es(){let e,t,i,s,r,n;if(e=W,(t=en())!==a){for(i=[],s=W,eu()!==a&&(r=er())!==a&&eu()!==a&&(n=en())!==a?(U=s,s=g(t,r,n)):(W=s,s=a);s!==a;)i.push(s),s=W,eu()!==a&&(r=er())!==a&&eu()!==a&&(n=en())!==a?(U=s,s=g(t,r,n)):(W=s,s=a);i!==a&&(s=el())!==a?(U=e,e=t=y(t,i,s)):(W=e,e=a)}else W=e,e=a;return e}function er(){let t,i;return t=W,42===e.charCodeAt(W)?(i="*",W++):(i=a,0===Y&&Q(v)),i===a&&(47===e.charCodeAt(W)?(i="/",W++):(i=a,0===Y&&Q(P))),i!==a&&(U=t,i=T(i)),t=i}function en(){let t,i,s,r;return(t=W,eu()!==a&&(45===e.charCodeAt(W)?(i="-",W++):(i=a,0===Y&&Q(S)),i!==a&&eu()!==a&&(s=ea())!==a&&(r=el())!==a))?(U=t,t=ec(eh({op:"-",left:s},r),j())):(W=t,t=a),t===a&&(t=ea()),t}function ea(){let t,i,s,r,n;if(t=W,(i=eo())!==a)if(eu()!==a){let o,l;if(o=W,94===e.charCodeAt(W)?(l="^",W++):(l=a,0===Y&&Q(C)),l!==a&&(U=o,l=T(l)),(s=o=l)!==a)if(eu()!==a)if((r=eo())!==a)if((n=el())!==a)U=t,t=i=ec(eh({op:"^",left:i,right:r},n),s.loc);else W=t,t=a;else W=t,t=a;else W=t,t=a;else W=t,t=a}else W=t,t=a;else W=t,t=a;return t===a&&(t=eo()),t}function eo(){let t,i,s,r,n;return(t=function(){let t,i,s,r,n,o,l,u,h;if(t=W,(i=eu())!==a){if(s=W,r=W,n=[],L.test(e.charAt(W))?(o=e.charAt(W),W++):(o=a,0===Y&&Q(_)),o!==a)for(;o!==a;)n.push(o),L.test(e.charAt(W))?(o=e.charAt(W),W++):(o=a,0===Y&&Q(_));else n=a;if(n!==a){if(o=W,46===e.charCodeAt(W)?(l=".",W++):(l=a,0===Y&&Q(M)),l!==a){for(u=[],L.test(e.charAt(W))?(h=e.charAt(W),W++):(h=a,0===Y&&Q(_));h!==a;)u.push(h),L.test(e.charAt(W))?(h=e.charAt(W),W++):(h=a,0===Y&&Q(_));u!==a?o=l=[l,u]:(W=o,o=a)}else W=o,o=a;o===a&&(o=null),o!==a?r=n=[n,o]:(W=r,r=a)}else W=r,r=a;if((s=r!==a?e.substring(s,W):r)!==a)if((r=el())!==a){var c,d;U=t,c=s,d=r,t=i=ec(eh({op:"num",left:parseFloat(c)},d),j())}else W=t,t=a;else W=t,t=a}else W=t,t=a;return t}())===a&&(t=function(){let t,i,s,r,n,o,l,u,h,c;if(t=W,(i=eu())!==a)if(123===e.charCodeAt(W)?(s="{",W++):(s=a,0===Y&&Q(x)),s!==a){if(r=W,n=[],I.test(e.charAt(W))?(o=e.charAt(W),W++):(o=a,0===Y&&Q(D)),o!==a)for(;o!==a;)n.push(o),I.test(e.charAt(W))?(o=e.charAt(W),W++):(o=a,0===Y&&Q(D));else n=a;if((r=n!==a?e.substring(r,W):n)!==a)if(125===e.charCodeAt(W)?(n="}",W++):(n=a,0===Y&&Q(O)),n!==a){if(o=W,46===e.charCodeAt(W)?(l=".",W++):(l=a,0===Y&&Q(M)),l!==a){if(u=W,h=[],w.test(e.charAt(W))?(c=e.charAt(W),W++):(c=a,0===Y&&Q(R)),c!==a)for(;c!==a;)h.push(c),w.test(e.charAt(W))?(c=e.charAt(W),W++):(c=a,0===Y&&Q(R));else h=a;if((u=h!==a?e.substring(u,W):h)!==a)U=o,o=l=u;else W=o,o=a}else W=o,o=a;(o===a&&(o=null),o!==a&&(l=el())!==a)?(U=t,t=i=ec(eh({op:"sym",left:r,right:o},l),j())):(W=t,t=a)}else W=t,t=a;else W=t,t=a}else W=t,t=a;else W=t,t=a;return t}())===a&&((t=W,eu()!==a&&(40===e.charCodeAt(W)?(i="(",W++):(i=a,0===Y&&Q(b)),i!==a&&eu()!==a&&(s=et())!==a&&eu()!==a&&(41===e.charCodeAt(W)?(r=")",W++):(r=a,0===Y&&Q(E)),r!==a&&(n=el())!==a)))?(U=t,t=ec(eh({op:"grp",left:s},n),j())):(W=t,t=a)),t}function el(){let t,i,s,r,n,o;for(Y++,t=W,i=[],V.test(e.charAt(W))?(s=e.charAt(W),W++):(s=a,0===Y&&Q(H));s!==a;)i.push(s),V.test(e.charAt(W))?(s=e.charAt(W),W++):(s=a,0===Y&&Q(H));if(i!==a)if("//"===e.substr(W,2)?(s="//",W+=2):(s=a,0===Y&&Q(h)),s!==a){for(r=W,n=[],c.test(e.charAt(W))?(o=e.charAt(W),W++):(o=a,0===Y&&Q(d));o!==a;)n.push(o),c.test(e.charAt(W))?(o=e.charAt(W),W++):(o=a,0===Y&&Q(d));(r=n!==a?e.substring(r,W):n)!==a?(U=t,t=i=m(r)):(W=t,t=a)}else W=t,t=a;else W=t,t=a;return t===a&&(t=W,(i="")!==a&&(U=t,i=null),t=i),Y--,t===a&&(i=a,0===Y&&Q(N)),t}function eu(){let t,i;for(Y++,t=[],B.test(e.charAt(W))?(i=e.charAt(W),W++):(i=a,0===Y&&Q(k));i!==a;)t.push(i),B.test(e.charAt(W))?(i=e.charAt(W),W++):(i=a,0===Y&&Q(k));return Y--,t===a&&(i=a,0===Y&&Q(F)),t}function eh(e,t){return null!==t&&(e.trailingComment=t),e}function ec(e,t){return e.loc={start:{offset:t.start.offset,line:t.start.line,column:t.start.column},end:{offset:t.end.offset,line:t.end.line,column:t.end.column}},e}if((n=u())!==a&&W===e.length)return n;throw n!==a&&W<e.length&&Q({type:"end"}),i=z,s=G<e.length?e.charAt(G):null,r=G<e.length?J(G,G+1):J(G,G),new nK(nK.buildMessage(i,s),i,s,r)},nX=JSON.stringify([["0","9"]]),nZ=JSON.stringify([["A","Z"],["a","z"]]),nJ=JSON.stringify([["A","Z"],["a","z"],["0","9"],"^","*","$","-",".","|",":","_"]);function nQ(e){if(null===e)return"end of expression";switch(e){case" ":return"a space";case" ":return"a tab";case"\n":return"a newline";case"\r":return"a carriage return";default:return`"${e}"`}}function n0(e){let t={expectsValue:!1,expectsOperator:!1,expectsCloseParen:!1,expectsCloseBrace:!1,expectsFieldName:!1,expectsEnd:!1};for(let i of e)switch(i.type){case"literal":switch(i.text){case"(":case"{":case"-":case"//":t.expectsValue=!0;break;case"+":case"*":case"/":case"^":t.expectsOperator=!0;break;case")":t.expectsCloseParen=!0;break;case"}":t.expectsCloseBrace=!0}break;case"class":{if(i.inverted)break;let e=JSON.stringify(i.parts);e===nX?t.expectsValue=!0:e===nZ?t.expectsFieldName=!0:e===nJ&&(t.expectsCloseBrace=!0);break}case"end":t.expectsEnd=!0}return t}let n1=new Map,n2=/\w:\w/;function n3(e){return"error"in e}function n4(e,t=!1,i=!0){let s=e.trim();if(t&&n1.has(s))return ez(n1.get(s));try{var r;let n=nq(s);ae(n,e=>e.toUpperCase(),!0,!0);let a=n8(n);i&&(r=a,r.some(e=>e.includes(":"))&&(n6(n,(e,t,i)=>{let s=(e,t=null,i="sym")=>({op:i,left:e,right:t});if("sym"!==e.op||!n2.test(t))return null;let r=t.split(":");return e.op="grp",e.left=s(s(r[0]),s(r[1]),"-"),null}),1))&&(a=n8(n));let o=n7(n,!1),l=n7(n,!0),u={text:e,model:n,clean:o,verbose:l,symbols:a};return t&&n1.set(s,u),u}catch(t){return{text:e,error:function(e,t){if(!(e instanceof nK))return e instanceof Error?e.message:"Invalid expression.";let i=Array.isArray(e.expected)?e.expected:[],s=e.found??null,r=n0(i),n=e.location?.start?.offset??0,a=n>0?t[n-1]:"";return null===s?!function(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0&&t.every(e=>e.startsWith("//"))}(t)?r.expectsFieldName&&"."===a?"Missing field name after '.'.":r.expectsCloseBrace?"Missing closing brace '}' in symbol.":r.expectsCloseParen?"Missing closing parenthesis ')'.":r.expectsValue?"Expression ended unexpectedly; expected a value.":"Expression ended unexpectedly.":"Expression contains only comments. Add a value (for example {AAPL} or 1).":r.expectsFieldName&&"."===a?`Expected a field name (letters only) after '.', but found ${nQ(s)}.`:r.expectsCloseBrace&&"{"===a&&"}"===s?"Symbol name cannot be empty inside '{}'.":r.expectsOperator&&r.expectsEnd?`Expected an operator (+, -, *, /, or ^) or end of expression, but found ${nQ(s)}.`:r.expectsOperator&&r.expectsCloseParen?`Expected an operator or closing parenthesis ')' but found ${nQ(s)}.`:r.expectsValue?`Expected a value (number, symbol, or parenthesized expression), but found ${nQ(s)}.`:r.expectsCloseParen?`Expected a closing parenthesis ')', but found ${nQ(s)}.`:r.expectsCloseBrace?`Expected a closing brace '}', but found ${nQ(s)}.`:`Invalid expression near ${nQ(s)}.`}(t,s),loc:function(e,t){if(!(e instanceof nK)||!e.location)return;let i=Array.isArray(e.expected)?e.expected:[],s=e.found??null,r=n0(i);if(!(null===s&&r.expectsCloseParen))return e.location;let n=function(e){let t=Math.max(e.lastIndexOf("\n"),e.lastIndexOf("\r")),i=e.indexOf("//",t+1);return i>=0?i:void 0}(t);if(void 0===n)return e.location;let a=Math.max(t.lastIndexOf("\n"),t.lastIndexOf("\r"))+1,o=n-1;for(;o>=a&&/\s/.test(t[o]);)o--;if(o<a)return e.location;let l=o+1,u=function(e,t){let i=1,s=1;for(let r=0;r<t&&r<e.length;r++){let t=e[r];"\n"===t?(i++,s=1):"\r"===t?"\n"!==e[r+1]&&(i++,s=1):s++}return{line:i,column:s}}(t,l);return{...e.location,start:{...e.location.start,offset:l,line:u.line,column:u.column},end:{...e.location.end,offset:l,line:u.line,column:u.column}}}(t,s)??t?.location}}}function n5(e,t){var i;return n6(e,(i=t,(e,t,s)=>{if(function(e){return!eF(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 n6(e,t,i){if(!eF(e))return null;let s=typeof e;if("number"===s||"string"===s)return e;let r=n6(e.left,t,i),n=n6(e.right,t,i);return t(e,r,n,i)}function n7(e,t=!1){let i={preserveComments:t};if(t){let t=e.leadingComments;return((t?t.map(e=>`// ${e}
|
|
2
|
-
|
|
3
|
-
`:r}let ai="..plots{.main === true}";function as(e){return sY(e,ai)[0]}function ar(e){let t=sY(e,`..panes{${ai}}`)[0],i=sY(t,`..axes{${ai}}`)[0];return{mainPane:t,mainAxis:i}}let an="Symbol",aa="Expression",ao="Forward",al="Seasonal",au=[an,aa,ao,al];function ah(e){let t=n4(e),i=n3(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 ac(e,t){let i=as(e),s=e=>eF(t[e.toLowerCase()]),r=au.find(e=>s(e)),n=r.toLowerCase(),a=t[n],o=a===tY.PLACEHOLDER_SYMBOL_NAME,l=s(aa)||s(ao)||s(al),u=au.some(e=>s(e)&&i.type!==e),h=AM().config.cachedAnnotationsCount||0,{mainAxis:c}=ar(e);u&&(c.comparison="None");let d=ah(a),p=e=>{throw Error(e)};!o&&(l?(d.hasErrors&&p(`[Main Plot] "${a}" is an invalid expression.
|
|
4
|
-
${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===tY.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===an)m(i.symbol,e);else if(i.type===aa)m(i.expression,e);else if(i.type===al){let t=ah(i.seasonal);1===t.symbolCount&&m(t.firstSymbol,e)}delete e.annotations,s(an)?g(t.symbol,e):s(aa)?g(t.expression,e):s(al)&&1===d.symbolCount&&g(t.seasonal,e)};if(h>0)for(let t of sY(e,"..axes"))y(t);let A=s(aa)&&i.type===an||s(an)&&i.type===aa,S=sj(e,ai,e=>(u&&(delete e.expression,delete e.symbol,delete e.showPrevious,delete e.forward,delete e.offsets,delete e.seasonal,e.type=r,A||(e.curves=[{}]),(s(ao)||s(al))&&(e.offsets=[0])),e[n]=a,e));if(u)if(s(ao))S.data.aggregation={unit:"Month"},S.display.period="P10Y";else if(s(al)&&!S.data.aggregation.isEndOfDay)S.data.aggregation={unit:"Day"},S.display.period=s(al)?"P9M":"P1Y10D";else if(i.type===ao||i.type===al){S.data.aggregation=AM().getDefaultAggregation(),S.data.maxDataPoints=tY.DEFAULT_MAX_RECORDS;let e=AM().getDefaultPeriod();eF(e)&&(S.display.period=e)}else s(aa)&&i.type===an&&(nz.includes(i.curves[0].style)&&(S=sj(S,ai,e=>(delete e.inputs,e))),"PerRange"===S.data.aggregation.spec&&(S.data.aggregation={unit:"Day"}));for(let[e,t]of new Map([['..plots{.type === "Study"}',e=>{let t=sN(e.study);if(!eH(t))return tY.NULL_OBJECT;let i=sB(t);return s(ao)||s(al)||s(aa)&&i?tY.NULL_OBJECT:e}],['..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}',e=>s(an)?(e.symbol=a,e):tY.NULL_OBJECT],["..plots{..events}",e=>(s(an)||delete e.events,e)]]))S=sj(S,e,t);return u&&!A&&(S=nY(S,{type:r,curves:[{}]})),S=av(S)}function ad(e){let t=AM().getDefaultDensity();eF(t)&&(e.display.density=t)}function ap(e,t){return sj(e,'..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}',e=>(e.fields=t?[aL.TradeSize.id]:[aL.Volume.id],e))}function af(e,t){let i=nO(e.data.aggregation),s=i.isTick&&!i.hasSpec,r=nO(t),n=r.isTick&&!r.hasSpec,a=e=>e.isIntraday&&e.hasSpec&&e.spec===z.PerRange,o=a(i),l=a(r),u=sj(e,`${ai}.curves[0]`,e=>{let t=[aL.Open.id,aL.High.id,aL.Low.id,aL.Close.id,aL.Change.id].slice();if(!o&&l)return nG("Range",!0);if(o&&!l&&(e.style="OHLC"),!n&&s){let i=AM().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=[aL.Last.id,aL.Change.id],e.style="Line",e.colors=["#0055cc"],e.varyColorPerBar=!1);return e});return eY((u=ap(u,n)).data.aggregation,t,!1),(i.unit!==r.unit||i.size!==r.size)&&(nW(u),nk(u),ad(u),nB(u)),u}function am(e,t){tt(2,arguments);var i=ts(e),s=ts(t);return i.getTime()<s.getTime()}function ag(e,t){return tt(2,arguments),tr(e,-te(t))}function ay(e){return eF(e)&&e!==tY.AUTOFIT_PERIOD}var aA={};aA=N("2nrEA");let aS=null;function aT(t,i){null===aS&&((aS=e(aA)()).defaultOptions.useDefault=!0,[tY.CHART_SCHEMA,tY.STUDIES_SCHEMA,tY.FIELDS_SCHEMA,tY.ACCESSOR_SCHEMA].forEach(e=>{aS.addSchema(e,sM(e))}));let s=function(e,t){if(t===tY.CHART_SCHEMA){let s=sY(sM(t),".properties.version.minimum")[0],r=e.version;if(r<s){var i=r;let t=e;try{for(sD=!1;i<s;)t=(0,nP[`_${i}to${i+1}`])(t),i+=1}finally{sD=!0}return t}}return e}(t,i);i===tY.CHART_SCHEMA&&(sY(s,`..plots{.type==="${Z[Z.Study]}"}`).forEach(e=>{let t=sN(e.study);eF(t)&&ej(e,t.defaults)}),s=function(e){let t=sY(e,"..axes{.annotations{.points{!.price || !.time}}}");t.length>0&&t.forEach(e=>{let t=e.annotations.map(e=>{let t=e.points.find(e=>eF(e.price)),i=e.points.find(e=>eF(e.time));return eF(t)&&eF(i)?(e.points.forEach(e=>{eF(e.price)||(e.price=t.price),eF(e.time)||(e.time=i.time)}),e):null}).filter(e=>eF(e));t.length>0?e.annotations=t:delete e.annotations});let i=sY(e,"..panes"),s=e=>eF(e.height)?e.height:1,r=Math.min(...i.map(e=>s(e))),n=r<.01?5/r:1;i.forEach(e=>e.height=eB(n*s(e),4));let a=AM().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=a;let o="wheel+shift",l=AM().config.scrollBehavior||o;Object.values(ea).filter(e=>"string"==typeof e).includes(l)||(l=o),e.display.scrollBehavior=l;let u=sY(e,'..plots{.type === "Study" && .study === "RSI"}');u.length>0&&u.forEach(e=>{if(eF(e.bands)&&e.bands.length>0){let t=e.inputs&&1===e.inputs.length&&e.inputs[0].name===tY.INPUT_PERIOD?e.inputs[0].value:null,i=sN("RSI").defaults;e.curves=i.curves,e.inputs=i.inputs,eF(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=i.levels}}),e.display?.density?(nW(e),nk(e)):ay(e.display?.period)&&nk(e);let h=eG(e.display,null,"chart","bar");if(eF(h)){let[e,t]=e0(h.width||0,h.spacing||0,tY.MINIMUM_BAR_WIDTH,tY.MAXIMUM_BAR_WIDTH);h.width=e,h.spacing=t}e.display?.period&&"YTD"===e.display.period&&delete e.display.period;let c=sY(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=sY(e,"..panes[0].axes[0].scale");if(1===g.length){let t=g[0],i=sY(e,"..panes[0]..axes");i.length>0&&i.forEach(e=>e.scale=t)}let[y]=sY(e,ai);eF(y)&&y.type===Z[Z.Symbol]&&!nz.includes(y.curves[0].style)&&eF(y.inputs)&&delete y.inputs;let[A]=sY(e,ai);eF(A)&&A.type===Z[Z.Symbol]&&A.curves[0].style===$[$.Renko]&&eF(A.inputs)&&A.inputs.map(e=>e.value).some(e=>void 0===e)&&(A.inputs=ez(tY.DEFAULT_RENKO_INPUTS)),function(e){let[t]=sY(e,ai);if(eF(t)&&t.type===Z[Z.Expression]){let i=t.curves[0].style,s=i===$[$.Range],r=i===$[$.Baseline],n=nz.includes(i);s&&e.data?.aggregation.spec===z[z.PerRange]&&(e.data.aggregation={unit:"Day"}),!r&&(n||s)&&(delete t.inputs,t.curves[0]=nG("Candlestick",!0))}}(e),sY(e,"..annotations").forEach(e=>{let{id:t,traits:i}=e;re(t,i),s9(t,i)});try{sD=!1,sY(e,'..plots{.type === "Study" && .curves.zones}').forEach(e=>{let t=sN(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{sD=!0}let[S]=sY(e,ai);if("Symbol"===S.type&&S.curves?.length===1){let e=S.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 T=sY(e,"..annotations{.id === 'RewardRisk' || .id === 'ProfitLoss' }");T.length>0&&T.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))}),AM()?.config?.mode==="cmdtyView"&&(delete e.data?.extendedHours,delete e.data?.buildContinuation);let v=e.data?.aggregation,P=eH(e.data?.extendedHours);v&&"FormT"===v.spec&&(v.spec="None",P||(e.data.extendedHours=!0));let C=e.data?.buildContinuation,b=eH(C),E=e.data?.aggregation;b&&E&&("Continue"!==E.spec||C||(E.spec="None"),C&&(E.spec="Continue"));try{sD=!1,sY(e,'..plots{.type === "Study" && .curves.varyColorPerBar}').forEach(e=>{let t=sN(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{sD=!0}try{sD=!1,sY(e,'..plots{.type === "Study"}').forEach(e=>{let t=sN(e.study).defaults;eH(e.inputs)&&e.inputs.forEach((e,i)=>{let s=t.inputs?.[i]?.value;!eH(e.value)&&eH(s)&&(e.value=s)}),eH(e.levels)&&e.levels.forEach((e,i)=>{let s=t.levels?.[i]?.value;!eH(e.value)&&eH(s)&&(e.value=s)}),eH(e.bands)&&e.bands.forEach((e,i)=>{let s=t.bands?.[i]?.range;!eH(e.range.from)&&eH(s?.from)&&(e.range.from=s.from),!eH(e.range.to)&&eH(s?.to)&&(e.range.to=s.to)})})}finally{sD=!0}let L=sj(e,"..annCache{!.annotations}",e=>tY.NULL_OBJECT);L=sj(L,"..annCache",e=>{let t=tI(e.symbol);return null===t?e:am(t,ag(new Date,3))?tY.NULL_OBJECT:e});let _=(L=sj(L,"..annotations{.id === 'ComputedText' && !.traits.textLines}",e=>tY.NULL_OBJECT)).data.aggregation;return ap(L,"Tick"===_.unit&&"None"===_.spec)}(s));let r=aS.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===tY.ACCESSOR_SCHEMA&&function(e){let{id:t,context:i}=e,s=e=>eF(i[e]),r=(e,t)=>{if(!eF(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(!eF(i.forward)){if(!eF(i.curves)||!eF(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(!eF(i.seasonal)){if(!eF(i.curves)||!eF(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=sN(i.studyId);if(!eF(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!==ev(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 av(e){let t=sj(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 sj(t,"..panes{!.axes}",e=>tY.NULL_OBJECT)}var aP={};aP=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":"FRAMA","category":"Study","name":"FRAMA","shortName":"FRAMA"},{"id":"MA","category":"Study","name":"MA-Simple","shortName":"MA"},{"id":"MACLD1","category":"Study","name":"MA-Cloud-Fast","shortName":"MACLD1"},{"id":"MACLD2","category":"Study","name":"MA-Cloud-Slow","shortName":"MACLD2"},{"id":"MA1","category":"Study","name":"MA1-Simple","shortName":"MA1"},{"id":"MA2","category":"Study","name":"MA2-Simple","shortName":"MA2"},{"id":"MA3","category":"Study","name":"MA3-Simple","shortName":"MA3"},{"id":"MA4","category":"Study","name":"MA4-Simple","shortName":"MA4"},{"id":"MA5","category":"Study","name":"MA5-Simple","shortName":"MA5"},{"id":"MA6","category":"Study","name":"MA6-Simple","shortName":"MA6"},{"id":"MA7","category":"Study","name":"MA7-Simple","shortName":"MA7"},{"id":"MA8","category":"Study","name":"MA8-Simple","shortName":"MA8"},{"id":"MA9","category":"Study","name":"MA9-Simple","shortName":"MA9"},{"id":"MA10","category":"Study","name":"MA10-Simple","shortName":"MA10"},{"id":"MAS","category":"Study","name":"MA-Shorter","shortName":"MAS"},{"id":"MAL","category":"Study","name":"MA-Longer","shortName":"MAL"},{"id":"CMBCI","category":"Study","name":"Composite Index","shortName":"CMBCI"},{"id":"CMBCIF","category":"Study","name":"Fast Ma","shortName":"CMBCIF"},{"id":"CMBCIS","category":"Study","name":"Slow Ma","shortName":"CMBCIS"},{"id":"COTI","category":"Study","name":"COT Index","shortName":"COTI"},{"id":"CHEXL","category":"Study","name":"ChandelierExitLong","shortName":"CHEXL"},{"id":"CHEXS","category":"Study","name":"ChandelierExitShort","shortName":"CHEXS"},{"id":"SUPTR","category":"Study","name":"Supertrend","shortName":"SUPTR"},{"id":"BARCOLIX","category":"Study","name":"BarColorIndex","shortName":"BARCOLIX"},{"id":"BARKIND","category":"Study","name":"BarKind","shortName":"BARKIND"},{"id":"BREL","category":"Study","name":"BarRelation","shortName":"BREL"},{"id":"EMA","category":"Study","name":"MA-Exp","shortName":"MA(EXP)"},{"id":"MAHI","category":"Study","name":"MA-High","shortName":"MA(HI)"},{"id":"MALO","category":"Study","name":"MA-Low","shortName":"MA(LO)"},{"id":"MACD","category":"Study","name":"MACD","shortName":"MACD"},{"id":"MACDS","category":"Study","name":"MACD-Signal","shortName":"MACD(S)"},{"id":"MACDH","category":"Study","name":"MACD-Histogram","shortName":"MACD(H)"},{"id":"MACDV","category":"Study","name":"MACD-V","shortName":"MACD-V"},{"id":"MACDVS","category":"Study","name":"MACD-V-Signal","shortName":"MACD-V(S)"},{"id":"MACDVH","category":"Study","name":"MACD-V-Histogram","shortName":"MACD-V(H)"},{"id":"ENVU","category":"Study","name":"Envelope-Up","shortName":"ENV(UP)"},{"id":"ENVD","category":"Study","name":"Envelope-Down","shortName":"ENV(DN)"},{"id":"ENVEXPU","category":"Study","name":"Envelope-Exponential-Up","shortName":"ENVEXP(UP)"},{"id":"ENVEXPD","category":"Study","name":"Envelope-Exponential-Down","shortName":"ENVEXP(DN)"},{"id":"ENVSMOU","category":"Study","name":"Envelope-Smoothed-Up","shortName":"ENVSMO(UP)"},{"id":"ENVSMOD","category":"Study","name":"Envelope-Smoothed-Down","shortName":"ENVSMO(DN)"},{"id":"SMA","category":"Study","name":"MA-Smoothed","shortName":"MA(S)"},{"id":"CSHO","category":"Study","name":"Cash-Overlay","shortName":"CSHO"},{"id":"CSHB","category":"Study","name":"Cash-Basis","shortName":"CSHB"},{"id":"MKTCAP","category":"Study","name":"Market-Cap","format":"UseMetricUnit","shortName":"MktCap"},{"id":"TMA","category":"Study","name":"MA-Triangular","shortName":"MA(TRI)"},{"id":"WMA","category":"Study","name":"MA-Weighted","shortName":"MA(W)"},{"id":"VOLMA","category":"Study","format":"UseMetricUnit","name":"MA-Volume","shortName":"VOLMA"},{"id":"OSC","category":"Study","name":"OSC","shortName":"OSC"},{"id":"VOSC","category":"Study","format":"UseMetricUnit","name":"OSC-Volume","shortName":"VOLOSC"},{"id":"RSI","category":"Study","name":"RSI","shortName":"RSI"},{"id":"RSIAVG","category":"Study","name":"RSI-Average","shortName":"RSIAVG"},{"id":"RSA","category":"Study","name":"RSA","shortName":"RSA"},{"id":"RSAAVG","category":"Study","name":"RSA-Average","shortName":"RSIAVG"},{"id":"STORSI","category":"Study","name":"StochRSI","shortName":"STOCHRSI"},{"id":"STORSIAVG","category":"Study","name":"StochRSIAvg","shortName":"STOCHRSIAVG"},{"id":"HH","category":"Study","name":"HighestHigh","shortName":"HHIGH"},{"id":"LL","category":"Study","name":"LowestLow","shortName":"LLOW"},{"id":"PercK","category":"Study","name":"%K","shortName":"PCNTK"},{"id":"PercD","category":"Study","name":"%D","shortName":"PCNTD"},{"id":"PercR","category":"Study","name":"%R","shortName":"PCNTR"},{"id":"WGCL","category":"Study","name":"WeightedClose","shortName":"WTCL"},{"id":"WGALPH","category":"Study","name":"WeightedAlpha","shortName":"WGALPH"},{"id":"UPVOL","category":"Study","format":"UseMetricUnit","name":"UpVol","shortName":"UPVOL"},{"id":"DNVOL","category":"Study","format":"UseMetricUnit","name":"DownVol","shortName":"DNVOL"},{"id":"TOTVOL","category":"Study","format":"UseMetricUnit","name":"TotVol","shortName":"TOTVOL"},{"id":"POC","category":"Study","name":"PointOfControl","shortName":"POC"},{"id":"VAREA","category":"Study","name":"ValueArea","shortName":"VAREA"},{"id":"BARBACK","category":"Study","name":"Background","shortName":"BARBACK"},{"id":"BOLLBU","category":"Study","name":"Bollinger-Upper","shortName":"BOLL(U)"},{"id":"BOLLBL","category":"Study","name":"Bollinger-Lower","shortName":"BOLL(L)"},{"id":"BOLLBM","category":"Study","name":"Bollinger-Mid","shortName":"BOLL(M)"},{"id":"BOLLW","category":"Study","name":"Bollinger-Width","shortName":"BOLL(W)"},{"id":"BOLLP","category":"Study","name":"Bollinger-Percent","shortName":"BOLL(%B)"},{"id":"BOLLBW","category":"Study","name":"Bollinger-BandWidth","shortName":"BOLL(BW)"},{"id":"BOLLBWA","category":"Study","name":"Bollinger-BandWidthAvg","shortName":"BOLL(BWA)"},{"id":"PCUP1","category":"Study","name":"ProbCone-Up1","shortName":"PCUP1"},{"id":"PCDN1","category":"Study","name":"ProbCone-Down1","shortName":"PCDN1"},{"id":"PCUP2","category":"Study","name":"ProbCone-Up2","shortName":"PCUP2"},{"id":"PCDN2","category":"Study","name":"ProbCone-Down2","shortName":"PCDN2"},{"id":"PCUP3","category":"Study","name":"ProbCone-Up3","shortName":"PCUP3"},{"id":"PCDN3","category":"Study","name":"ProbCone-Down3","shortName":"PCDN3"},{"id":"PCTD","category":"Study","name":"ProbCone-TgtDate","shortName":"PCTD"},{"id":"PCTP","category":"Study","name":"ProbCone-TgtPrice","shortName":"PCTP"},{"id":"MBBUO","category":"Study","name":"ModifiedBoll-UppOut","shortName":"MBOLL(UO)"},{"id":"MBBUI","category":"Study","name":"ModifiedBoll-UppIn","shortName":"MBOLL(UI)"},{"id":"MBBM","category":"Study","name":"ModifiedBoll-Mid","shortName":"MBOLL(M)"},{"id":"MBBLI","category":"Study","name":"ModifiedBoll-LowIn","shortName":"MBOLL(LI)"},{"id":"MBBLO","category":"Study","name":"ModifiedBoll-LowOut","shortName":"MBOLL(LO)"},{"id":"OBVOL","category":"Study","format":"UseMetricUnit","name":"OnBalanceVol","shortName":"OBVOL"},{"id":"OBVOLAVG","category":"Study","format":"UseMetricUnit","name":"OnBalanceVolAvg","shortName":"OBVOL"},{"id":"TR","category":"Study","name":"TrueRange","shortName":"TR"},{"id":"ATR","category":"Study","name":"AvgTrueRange","shortName":"ATR"},{"id":"ATRMA","category":"Study","name":"MA-ATR","shortName":"MA(ATR)"},{"id":"ADJATR","category":"Study","name":"AdjAvgTrueRange","shortName":"ADJATR"},{"id":"COTR","category":"Study","name":"ChgOverTrueRange","shortName":"COTR"},{"id":"ATRP","category":"Study","name":"AvgTrueRangePerc","shortName":"ATRP"},{"id":"STOMOMIX","category":"Study","name":"StochMomIndex","shortName":"STOMOMIX"},{"id":"CHDMOMOSC","category":"Study","name":"ChandeMomOsc","shortName":"CHDMOMOSC"},{"id":"CHDMOMOSCAVG","category":"Study","name":"ChandeMomOsc-Avg","shortName":"CHDMOMOSCAVG"},{"id":"PDI","category":"Study","name":"+DI","shortName":"+DI"},{"id":"MDI","category":"Study","name":"-DI","shortName":"-DI"},{"id":"PLVI","category":"Study","name":"+VI","shortName":"+VI"},{"id":"MNVI","category":"Study","name":"-VI","shortName":"-VI"},{"id":"ADX","category":"Study","name":"ADX","shortName":"ADX"},{"id":"ADXM","category":"Study","name":"ADX-Modified","shortName":"ADXM"},{"id":"ADL","category":"Study","format":"UseMetricUnit","name":"AccDist","shortName":"ACCDIS"},{"id":"ADWM","category":"Study","name":"AccDistWill","shortName":"ACCDISWIL"},{"id":"ADWMMA","category":"Study","name":"AccDistWillMovAvg","shortName":"ACCDISWILMA"},{"id":"MCGD","category":"Study","name":"McGinleyDyn","shortName":"MCGD"},{"id":"HMA","category":"Study","name":"HullMovAvg","shortName":"HMA"},{"id":"COPP","category":"Study","name":"CoppCurve","shortName":"COPP"},{"id":"CHAOSC","category":"Study","format":"UseMetricUnit","name":"ChaikinOsc","shortName":"CHAIKOSC"},{"id":"TP","category":"Study","name":"TypicalPrice","shortName":"TP"},{"id":"KCUP","category":"Study","name":"KeltChan-Up","shortName":"KELT(UP)"},{"id":"KCMID","category":"Study","name":"KeltChan-Mid","shortName":"KELT(MID)"},{"id":"KCLOW","category":"Study","name":"KeltChan-Low","shortName":"KELT(LO)"},{"id":"KBUP","category":"Study","name":"KeltBands-Up","shortName":"KELB(UP)"},{"id":"KBMID","category":"Study","name":"KeltBands-Mid","shortName":"KELB(MID)"},{"id":"KBLOW","category":"Study","name":"KeltBands-Low","shortName":"KELB(LO)"},{"id":"DONUP","category":"Study","name":"Donchian-Up","shortName":"DON(U)"},{"id":"DONMID","category":"Study","name":"Donchian-Mid","shortName":"DON(M)"},{"id":"DONLOW","category":"Study","name":"Donchian-Low","shortName":"DON(L)"},{"id":"DONW","category":"Study","name":"Donchian-Width","shortName":"DON(W)"},{"id":"PVT","category":"Study","format":"UseMetricUnit","name":"PriceVolChange","shortName":"PVOL"},{"id":"TRIX","category":"Study","name":"Triple-MA-Exp","shortName":"TRIX"},{"id":"ROC","category":"Study","name":"RateOfChange","shortName":"ROC"},{"id":"PVPT","category":"Study","name":"PivotPoint","shortName":"PVMOV"},{"id":"PVPTR","category":"Study","name":"PvtPt-Resistance","shortName":"PVMOV(R)"},{"id":"PVPTS","category":"Study","name":"PvtPt-Support","shortName":"PVMOV(S)"},{"id":"FISHER","category":"Study","name":"Fisher","shortName":"Fisher"},{"id":"FISHTRG","category":"Study","name":"Fisher-Trigger","shortName":"Trigger"},{"id":"ARNUP","category":"Study","name":"Aroon-Up","shortName":"ARN(UP)"},{"id":"ARNLOW","category":"Study","name":"Aroon-Down","shortName":"ARN(DN)"},{"id":"VSTOPUP","category":"Study","name":"VolaStop-Up","shortName":"VSTOP(UP)"},{"id":"VSTOPLOW","category":"Study","name":"VolaStop-Down","shortName":"VSTOP(DN)"},{"id":"ARNOSC","category":"Study","name":"Aroon-Osci","shortName":"ARNOSC"},{"id":"TCHNUP","category":"Study","name":"TurtleChn-Up","shortName":"TCH(UP)"},{"id":"TCHNLOW","category":"Study","name":"TurtleChn-Low","shortName":"TCH(LO)"},{"id":"TCHRE","category":"Study","name":"TurtleChnRetrace","shortName":"TCHRE"},{"id":"ALJAW","category":"Study","name":"Alligator-Jaw","shortName":"AL(J)"},{"id":"ALTEETH","category":"Study","name":"Alligator-Teeth","shortName":"AL(T)"},{"id":"ALLIPS","category":"Study","name":"Alligator-Lips","shortName":"AL(L)"},{"id":"PLTLN","category":"Study","name":"PlotLine","shortName":"LINE"},{"id":"AWOS","category":"Study","name":"AwesomeOsc","shortName":"AWOSC"},{"id":"AWOSMA","category":"Study","name":"AwesomeOsc-MA","shortName":"AWOSC(MA)"},{"id":"MFMUL","category":"Study","name":"MoneyFlowMul"},{"id":"CLV","category":"Study","name":"CloseLocationValue","shortName":"CLV"},{"id":"CHOP","category":"Study","name":"ChoppinessIndex","shortName":"ChopIx"},{"id":"CHAMF","category":"Study","name":"ChaikinMoneyFlow","shortName":"CHAIKMF"},{"id":"CHAVOL","category":"Study","name":"ChaikinVolatility","shortName":"CHAIKVOL"},{"id":"DPO","category":"Study","name":"DetrendedPriceOsc","shortName":"DPO"},{"id":"CCI","category":"Study","name":"CommodityChannelIndex","shortName":"CCI"},{"id":"EMV","category":"Study","name":"EaseOfMovement","shortName":"EOM"},{"id":"EMVMA","category":"Study","name":"EaseOfMovementMA","shortName":"EOM(MA)"},{"id":"ERBLPOW","category":"Study","name":"ElderRayBullPow","shortName":"ER(BULL)"},{"id":"ERBRPOW","category":"Study","name":"ElderRayBearPow","shortName":"ER(BEAR)"},{"id":"FI","category":"Study","format":"UseMetricUnit","name":"ForceIndex","shortName":"FORCE"},{"id":"MI","category":"Study","name":"MassIndex","shortName":"MASS"},{"id":"MOM","category":"Study","name":"Momentum","shortName":"MOM"},{"id":"MOMMA","category":"Study","name":"MA-Momentum","shortName":"MA(MOM)"},{"id":"MFI","category":"Study","name":"MoneyFlowIndex","shortName":"MFI"},{"id":"MSD","category":"Study","name":"MovingStdDev","shortName":"MSD"},{"id":"PCTCHG","category":"Study","name":"PercentChange","shortName":"PCTCHG"},{"id":"LINRUP","category":"Study","name":"LinRegUpper","shortName":"LINRUP"},{"id":"LINRMID","category":"Study","name":"LinRegMiddle","shortName":"LINRMID"},{"id":"LINRLOW","category":"Study","name":"LinRegLower","shortName":"LINRLOW"},{"id":"NVI","category":"Study","name":"NegativeVolIndex","shortName":"NVI"},{"id":"NVIEMA","category":"Study","name":"NegativeVolIndexEMA","shortName":"NVI(EMA)"},{"id":"PVI","category":"Study","name":"PositiveVolIndex","shortName":"PVI"},{"id":"PVIEMA","category":"Study","name":"PositiveVolIndexEMA","shortName":"PVI(EMA)"},{"id":"PPO","category":"Study","name":"PercPriceOsc","shortName":"PPO"},{"id":"PPOS","category":"Study","name":"PPO-Signal","shortName":"PPO(S)"},{"id":"PPOH","category":"Study","name":"PPO-Histogram","shortName":"PPO(H)"},{"id":"PVO","category":"Study","name":"PercVolOsc","shortName":"PVO"},{"id":"PVOS","category":"Study","name":"PVO-Signal","shortName":"PVO(S)"},{"id":"PVOH","category":"Study","name":"PVO-Histogram","shortName":"PVO(H)"},{"id":"HV","category":"Study","name":"HistVolatility","shortName":"HISTVOL"},{"id":"PERF","category":"Study","name":"Performance","shortName":"PERF"},{"id":"STC","category":"Study","name":"SchaffTrendCycle","shortName":"STC"},{"id":"MCCLO","category":"Study","name":"McClellanOsc","shortName":"MCCLO"},{"id":"BTI","category":"Study","name":"BreadthThrust","shortName":"BTI"},{"id":"NHLAI","category":"Study","name":"NewHiLoAccIx","shortName":"NHLAI"},{"id":"KST","category":"Study","name":"KnowSureThing","shortName":"KST"},{"id":"KSTSIG","category":"Study","name":"KST-Signal","shortName":"KSTSIG"},{"id":"WASI","category":"Study","name":"WilderAccSwingIndex","shortName":"WACCSW"},{"id":"WWVSARU","category":"Study","name":"WilderVolSarUp","shortName":"WVOL-UP"},{"id":"WWVSARD","category":"Study","name":"WilderVolSarDown","shortName":"WVOL-DN"},{"id":"PARSARS","category":"Study","name":"ParabolicSarShort","shortName":"SHORT"},{"id":"PARSARL","category":"Study","name":"ParabolicSarLong","shortName":"LONG"},{"id":"REATRS","category":"Study","name":"RetraceATRStop","shortName":"REATRS"},{"id":"MOVLR","category":"Study","name":"MovingLinRegression","shortName":"MOVLINREG"},{"id":"TRSP1","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TRSP2","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"COTLCCMSP","category":"Study","name":"Comm Spec","shortName":"COT(C)"},{"id":"COTLCLGSP","category":"Study","name":"Large Spec","shortName":"COT(L)"},{"id":"COTLCSMSP","category":"Study","name":"Small Spec","shortName":"COT(S)"},{"id":"COTDAGPRO","category":"Study","name":"Producers","shortName":"COTDIS(P)"},{"id":"COTDAGSPD","category":"Study","name":"Swap Dealers","shortName":"COTDIS(S)"},{"id":"COTDAGMNM","category":"Study","name":"Managed Money","shortName":"COTDIS(M)"},{"id":"COTDAGOTH","category":"Study","name":"Other Report","shortName":"COTDIS(O)"},{"id":"COTFTRDLI","category":"Study","name":"Dealer Intermediary","shortName":"COTFIN(D)"},{"id":"COTFTRASM","category":"Study","name":"Asset Manager","shortName":"COTFIN(A)"},{"id":"COTFTRLVF","category":"Study","name":"Leveraged Funds","shortName":"COTFIN(L)"},{"id":"COTFTROTH","category":"Study","name":"Other Report","shortName":"COTFIN(O)"},{"id":"PPTPIV","category":"Study","name":"Pivot Point","shortName":"PPT(P)"},{"id":"PPTR1","category":"Study","name":"1st Resistance","shortName":"PPT(R1)"},{"id":"PPTR2","category":"Study","name":"2nd Resistance","shortName":"PPT(R2)"},{"id":"PPTR3","category":"Study","name":"3rd Resistance","shortName":"PPT(R3)"},{"id":"PPTS1","category":"Study","name":"1st Support","shortName":"PPT(S1)"},{"id":"PPTS2","category":"Study","name":"2nd Support","shortName":"PPT(S2)"},{"id":"PPTS3","category":"Study","name":"3rd Support","shortName":"PPT(S3)"},{"id":"CPPH4","category":"Study","name":"4th Camarilla Res","shortName":"CPP(H4)"},{"id":"CPPH3","category":"Study","name":"3rd Camarilla Res","shortName":"CPP(H3)"},{"id":"CPPH2","category":"Study","name":"2nd Camarilla Res","shortName":"CPP(H2)"},{"id":"CPPH1","category":"Study","name":"1st Camarilla Res","shortName":"CPP(H1)"},{"id":"CPPL1","category":"Study","name":"1st Camarilla Supp","shortName":"CPP(L1)"},{"id":"CPPL2","category":"Study","name":"2nd Camarilla Supp","shortName":"CPP(L2)"},{"id":"CPPL3","category":"Study","name":"3rd Camarilla Supp","shortName":"CPP(L3)"},{"id":"CPPL4","category":"Study","name":"4th Camarilla Supp","shortName":"CPP(L4)"},{"id":"IMPVOL","category":"Study","name":"Implied Volatility","shortName":"IV"},{"id":"CTM","category":"Study","name":"Cycle Trading Momentum","shortName":"CTM"},{"id":"CPMI","category":"Study","name":"Principal Momentum","shortName":"CPMI"},{"id":"CTPI","category":"Study","name":"Turning Point","shortName":"CTPI"},{"id":"CTLTM","category":"Study","name":"Long-Term Momentum","shortName":"LTM"},{"id":"CTLTMF","category":"Study","name":"Long-Term Momentum, Fast","shortName":"LTM(F)"},{"id":"DEMA","category":"Study","name":"Double EMA","shortName":"DEMA"},{"id":"EOSC","category":"Study","name":"Exponential Oscillator","shortName":"EOSC"},{"id":"TEMA","category":"Study","name":"Triple EMA","shortName":"TEMA"},{"id":"TSI","category":"Study","name":"True Strength Index","shortName":"Tsi"},{"id":"TSISIG","category":"Study","name":"True Strength Index Signal","shortName":"TsiSig"},{"id":"GMMA3","category":"Study","name":"GMMA-EMA3","shortName":"GMMA(3)"},{"id":"GMMA5","category":"Study","name":"GMMA-EMA5","shortName":"GMMA(5)"},{"id":"GMMA8","category":"Study","name":"GMMA-EMA8","shortName":"GMMA(8)"},{"id":"GMMA10","category":"Study","name":"GMMA-EMA10","shortName":"GMMA(10)"},{"id":"GMMA12","category":"Study","name":"GMMA-EMA12","shortName":"GMMA(12)"},{"id":"GMMA15","category":"Study","name":"GMMA-EMA15","shortName":"GMMA(15)"},{"id":"GMMA30","category":"Study","name":"GMMA-EMA30","shortName":"GMMA(30)"},{"id":"GMMA35","category":"Study","name":"GMMA-EMA35","shortName":"GMMA(35)"},{"id":"GMMA40","category":"Study","name":"GMMA-EMA40","shortName":"GMMA(40)"},{"id":"GMMA45","category":"Study","name":"GMMA-EMA45","shortName":"GMMA(45)"},{"id":"GMMA50","category":"Study","name":"GMMA-EMA50","shortName":"GMMA(50)"},{"id":"GMMA60","category":"Study","name":"GMMA-EMA60","shortName":"GMMA(60)"},{"id":"CONVLN","category":"Study","name":"ConversionLine","shortName":"ConvLn"},{"id":"BASELN","category":"Study","name":"BaseLine","shortName":"BaseLn"},{"id":"LEADSP1","category":"Study","name":"LeadingSpanA","shortName":"LeadSpA"},{"id":"LEADSP2","category":"Study","name":"LeadingSpanB","shortName":"LeadSpB"},{"id":"LAGGSP","category":"Study","name":"LaggingSpan","shortName":"LaggSp"},{"id":"VWAP","category":"Study","name":"VWAP","shortName":"VWAP"},{"id":"AVWAP","category":"Study","name":"Anchored VWAP","shortName":"Anch-VWAP"},{"id":"VWAPSD1U","category":"Study","name":"VWAP Stdev1 Upper","shortName":"VWAP-Std1-Up"},{"id":"VWAPSD1L","category":"Study","name":"VWAP Stdev1 Lower","shortName":"VWAP-Std1-Lo"},{"id":"VWAPSD2U","category":"Study","name":"VWAP Stdev2 Upper","shortName":"VWAP-Std2-Up"},{"id":"VWAPSD2L","category":"Study","name":"VWAP Stdev2 Lower","shortName":"VWAP-Std2-Lo"},{"id":"DIFA","category":"Study","name":"Distance From Average","shortName":"DistAvg"},{"id":"DOSCH","category":"Study","name":"Derivative Oscillator","shortName":"DerOsc"},{"id":"DOSCS","category":"Study","name":"Derivative Oscillator Signal","shortName":"DerOscSig"},{"id":"TTMSQZON","category":"Study","name":"TTM Squeeze On","shortName":"TtmSqzOn"},{"id":"TTMSQZOFF","category":"Study","name":"TTM Squeeze Off","shortName":"TtmSqzOff"},{"id":"TTMSQZOSC","category":"Study","name":"TTM Squeeze Osc","shortName":"TtmSqzOsc"},{"id":"CRS","category":"Study","name":"CompRelStrength","shortName":"CRS"},{"id":"CRSAVG","category":"Study","name":"CompRelStrengthAvg","shortName":"CRS-Avg"},{"id":"DRS","category":"Study","name":"DorseyRelStrength","shortName":"DRS"},{"id":"MRS","category":"Study","name":"MansfieldRelStrength","shortName":"MRS"},{"id":"PMO","category":"Study","name":"PriceMomOsc","shortName":"PMO"},{"id":"PMOS","category":"Study","name":"PriceMomOscSig","shortName":"PMOS"},{"id":"RVOL","category":"Study","name":"Relative Volume","shortName":"RVOL"},{"id":"AccountsPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Accounts Payable","shortName":"AcctsPay"},{"id":"AccruedExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Accrued Expenses","shortName":"AccrdExp"},{"id":"Cash","category":"BalanceSheet","format":"UseMetricUnit","name":"Cash & Cash Equivalents","shortName":"Cash&CashEqv"},{"id":"CommonShares","category":"BalanceSheet","format":"UseMetricUnit","name":"Common Shares","shortName":"CommonShares"},{"id":"SharesOutstanding","category":"BalanceSheet","format":"UseMetricUnit","name":"Shares Outstanding","shortName":"SharesOutstanding"},{"id":"DeferredIncomeTax","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Income Tax","shortName":"DefIncTax"},{"id":"DeferredLongRevenues","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Revenues","shortName":"DefRev"},{"id":"EquityOtherInvestments","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity Investments","shortName":"OthEquityInvest"},{"id":"IncomeTaxPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Income Tax Payable","shortName":"IncTaxPayble"},{"id":"Intangibles","category":"BalanceSheet","format":"UseMetricUnit","name":"Intangibles","shortName":"Intangibles"},{"id":"Inventories","category":"BalanceSheet","format":"UseMetricUnit","name":"Inventories","shortName":"Inventory"},{"id":"LongTermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Long Term Debt","shortName":"LTDebt"},{"id":"MarketableSec","category":"BalanceSheet","format":"UseMetricUnit","name":"Liquid Securities","shortName":"LiqSecurities"},{"id":"OtherCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Miscellaneous Current Assets","shortName":"MiscCurrAssets"},{"id":"OtherCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Current Liabilities","shortName":"OthCurrLiab"},{"id":"OtherEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity","shortName":"OthEquity"},{"id":"OtherNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Assets","shortName":"OthNonCurrAssets"},{"id":"OtherNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Liabilities","shortName":"OthNonCurrLiab"},{"id":"PpeNet","category":"BalanceSheet","format":"UseMetricUnit","name":"PPE Net","shortName":"PPENet"},{"id":"PrepaidExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Prepaid Expenses","shortName":"PpdExp"},{"id":"Receivables","category":"BalanceSheet","format":"UseMetricUnit","name":"Receivables","shortName":"Receivables"},{"id":"RetainedEarnings","category":"BalanceSheet","format":"UseMetricUnit","name":"Retained Earnings","shortName":"RetEarnings"},{"id":"ShorttermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Short-Term Debt","shortName":"ShortTermDebt"},{"id":"TotalAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Assets","shortName":"TotAssets"},{"id":"TotalCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Assets","shortName":"TotCurrAssets"},{"id":"TotalCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Liabilities","shortName":"TotCurrLiab"},{"id":"TotalLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities","shortName":"TotalLiab"},{"id":"TotalLiabilitiesAndEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities & Equity","shortName":"TotLiab&Equity"},{"id":"TotalNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Assets","shortName":"TotNonCurrAssets"},{"id":"TotalNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Liabilities","shortName":"TotNonCurrLiabs"},{"id":"TotalShareholdersEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Shareholders Equity","shortName":"TotShareEquity"},{"id":"BasicEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Continued Operations","shortName":"EPSContOps"},{"id":"BasicEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Total Operations","shortName":"EPSTotOps"},{"id":"CostGoods","category":"IncomeStatement","format":"UseMetricUnit","name":"Cost of Goods","shortName":"COGS"},{"id":"DilutedEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Continued Operations","shortName":"DilutedEPSContOps"},{"id":"DilutedEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Total Operations","shortName":"DilutedEPSTotOps"},{"id":"Ebitda","category":"IncomeStatement","format":"UseMetricUnit","name":"EBITDA","shortName":"EBITDA"},{"id":"GrossProfit","category":"IncomeStatement","format":"UseMetricUnit","name":"Gross Profit","shortName":"GrProfit"},{"id":"IncomeTax","category":"IncomeStatement","format":"UseMetricUnit","name":"Income Tax","shortName":"IncomeTax"},{"id":"InterestExpense","category":"IncomeStatement","format":"UseMetricUnit","name":"Interest Expense","shortName":"IntExp"},{"id":"NetIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Net Income Less Expenses & Tax","shortName":"NetIncome"},{"id":"OperatingExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Expenses","shortName":"OpExpense"},{"id":"OperatingIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Income","shortName":"OpIncome"},{"id":"OtherIncomeExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Other Income","shortName":"OthInc"},{"id":"PreTaxIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Pretax Income","shortName":"PretaxInc"},{"id":"Sales","category":"IncomeStatement","format":"UseMetricUnit","name":"Sales","shortName":"Sales"},{"id":"JPIB","category":"Study","name":"JPI-Buy","shortName":"Buy"},{"id":"JPIS","category":"Study","name":"JPI-Sell","shortName":"Sell"},{"id":"TDIPRC","category":"Study","name":"TDI Price Line","shortName":"PriceLn"},{"id":"TDITSL","category":"Study","name":"TDI Trade Signal","shortName":"TradeSig"},{"id":"TDIMBL","category":"Study","name":"TDI Market Base","shortName":"MktBase"},{"id":"TDIUPR","category":"Study","name":"TDI Upper Band","shortName":"UpperBnd"},{"id":"TDILWR","category":"Study","name":"TDI Lower Band","shortName":"LowerBnd"},{"id":"PPS","category":"Study","name":"PricePercentStop","shortName":"PPS"},{"id":"RCI","category":"Study","name":"RankCorrelationIndex","shortName":"RCI"},{"id":"RCISIG","category":"Study","name":"RCI Signal","shortName":"RCISig"},{"id":"ZZPIVOT","category":"Study","name":"ZigZag Pivot","shortName":"ZZPivot"},{"id":"ADR","category":"Study","name":"AvgDailyRange","shortName":"ADR"},{"id":"ADRP","category":"Study","name":"AvgDailyRangePerc","shortName":"ADRP"}]');class aC{id;type;category;name;format;shortName;constructor(e,t=Y.Number,i=K.Common,s,r=j.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 ab={};function aE(e){aT(e,tY.FIELDS_SCHEMA).map(e=>{ab[e.id]=new aC(e.id,Y[e.type],K[e.category],e.name,j[e.format],e.shortName)})}let aL=(aE(e(aP)),ab),a_={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"},aM=[aL.Open,aL.High,aL.Low,aL.Close,aL.Volume,aL.Change,aL.PercentChange,aL.PreviousClose].reduce((e,t,i)=>(e.set(t.id,1<<i),e),new Map);function ax(...e){return e.reduce((e,t)=>aM.has(t.id)?e|aM.get(t.id):e,0)}class aI{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&&aM.has(i)&&(this._updated=this._updated|aM.get(i)),r}}computeWellKnown(){let e=this.getValue(aL.Close),t=this.getValue(aL.PreviousClose);eF(e,t)&&(this.hasField(aL.Change)&&this.update(aL.Change,e-t),this.hasField(aL.PercentChange)&&this.update(aL.PercentChange,(e-t)/t))}hasField(e){return eF(this.fields)&&this.fields.some(t=>t.id===e.id)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}}class aD extends aI{translated;constructor(e){super(),this.symbol=e,this.translated=t1(this.symbol)}hasSymbol(e){return this.symbol===e}}class aO extends aI{actual;constructor(e){super(tY.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}}class aw extends aI{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 aR={previousOpen:aL.PreviousOpen,previousClose:aL.PreviousClose,previousHigh:aL.PreviousHigh,previousLow:aL.PreviousLow,weeklyPreviousClose:aL.WeekPreviousClose,weeklyPreviousHigh:aL.WeekPreviousHigh,weeklyPreviousLow:aL.WeekPreviousLow,monthlyPreviousClose:aL.MonthPreviousClose,monthlyPreviousHigh:aL.MonthPreviousHigh,monthlyPreviousLow:aL.MonthPreviousLow,fiftyTwoWkHigh:aL.YearHigh,fiftyTwoWkLow:aL.YearLow},aN={open:aL.Open,high:aL.High,low:aL.Low,close:aL.Close,lastPrice:aL.Last,volume:aL.Volume,netChange:aL.Change,percentChange:aL.PercentChange},aV=Object.values(aR),aH=Object.keys(aR),aF=Object.keys(aN);class aB extends aD{triedFetchingExtraValues=!1;includeBaseFields=!1;async ready(){return t$.call(this,async()=>{let e=AM().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid})}shutdown(){}getValue(e){return this.hasField(e)&&aV.some(t=>t.id===e.id)&&null===super.getValue(e)&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,Ab("ondemand",`/getQuote.json?symbols=${this.translated}&fields=${aH.join(",")}`).then(e=>{try{let t=JSON.parse(e);if(200===t.status.code&&1===t.results.length){let e=t.results[0];aH.forEach(t=>this.update(aR[t],e[t])),this.includeBaseFields&&aF.forEach(t=>this.update(aN[t],e[t])),AM().getRecordSource().subject.next({topic:a_.RT_QUOTE,data:{symbol:this.symbol}})}}catch(e){AP(`Failed to fetch extra values for ${this.translated}`,"error")}})}}class ak extends aB{constructor(e){super(e),this.includeBaseFields=!0,this.supplementPreviousValues()}async ready(){return Promise.resolve(!0)}}class aW extends aD{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){eF(t)&&(this.addFields(e),this.update(e,t))}async ready(){return t$.call(this,async()=>{let e=AM().config.environment===H[H.NodeJs]?null:tR(`#${tY.INLINE_DATA_ELEMENT_ID}`);if(eF(e)){let t=JSON.parse(e);if(this.translated in t){let e=t[this.translated].quote;this.update(aL.Open,e.open),this.update(aL.High,e.high),this.update(aL.Low,e.low),this.update(aL.Close,e.close),this.update(aL.PreviousClose,e.previousClose),this.update(aL.Volume,e.volume),aH.filter(e=>"previousClose"!==e).forEach(t=>{this.addOptionalField(aR[t],e[t])}),this.isValid=!0}else this.isValid=!1}else this.isValid=!1;return this.isValid})}}let aU=[aL.Open,aL.High,aL.Low,aL.Close,aL.PreviousClose];class a$ extends aI{mapping;resolved;model;constructor(e,t){super(),this.resolved=e.map(([e,t])=>t),this.mapping=new Map(e.map(([e,t])=>[e,AM().getRecordSource().getRecord(t)])),this.model=t;let i=aU.concat(aL.Change,aL.PercentChange);this.addFields(...i.filter(e=>e!==aL.Volume))}async ready(){return t$.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(){aU.forEach(e=>{let t=n5(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)}),this.computeWellKnown()}}function aG(e,t){return i=>i.topic===e&&i.data.symbol===t}var az=function(e,t){return(az=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 aY(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}az(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function aj(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 aK(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 aq(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 aZ(e){return this instanceof aZ?(this.v=e,this):new aZ(e)}function aJ(e){return"function"==typeof e}function aQ(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 a0=aQ(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 a1(e,t){if(e){var i=e.indexOf(t);0<=i&&e.splice(i,1)}}var a2=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=aK(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(aJ(l))try{l()}catch(e){r=e instanceof a0?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=aK(u),c=h.next();!c.done;c=h.next()){var d=c.value;try{a5(d)}catch(e){r=null!=r?r:[],e instanceof a0?r=aX(aX([],aq(r)),aq(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 a0(r)}},t.prototype.add=function(e){var i;if(e&&e!==this)if(this.closed)a5(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)&&a1(t,e)},t.prototype.remove=function(e){var i=this._finalizers;i&&a1(i,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),a3=a2.EMPTY;function a4(e){return e instanceof a2||e&&"closed"in e&&aJ(e.remove)&&aJ(e.add)&&aJ(e.unsubscribe)}function a5(e){aJ(e)?e():e.unsubscribe()}var a6=function(e){function t(t,i){return e.call(this)||this}return aY(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(a2),a7={setInterval:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=a7.delegate;return(null==r?void 0:r.setInterval)?r.setInterval.apply(r,aX([e,t],aq(i))):setInterval.apply(void 0,aX([e,t],aq(i)))},clearInterval:function(e){var t=a7.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},a8=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 aY(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),a7.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&&a7.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,a1(s,this),null!=t&&(this.id=this.recycleAsyncId(i,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(a6),a9={now:function(){return(a9.delegate||Date).now()},delegate:void 0},oe=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=a9.now,e}(),ot=new(function(e){function t(t,i){void 0===i&&(i=oe.now);var s=e.call(this,t,i)||this;return s.actions=[],s._active=!1,s}return aY(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}(oe))(a8),oi=void 0,os={setTimeout:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=os.delegate;return(null==r?void 0:r.setTimeout)?r.setTimeout.apply(r,aX([e,t],aq(i))):setTimeout.apply(void 0,aX([e,t],aq(i)))},clearTimeout:function(e){var t=os.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function or(e){os.setTimeout(function(){!1;throw e})}function on(){}var oa=oo("C",void 0,void 0);function oo(e,t,i){return{kind:e,value:t,error:i}}var ol=null;function ou(e){var t,i,s,r;1;e()}var oh=function(e){function t(t){var i=e.call(this)||this;return i.isStopped=!1,t?(i.destination=t,a4(t)&&t.add(i)):i.destination=oy,i}return aY(t,e),t.create=function(e,t,i){return new of(e,t,i)},t.prototype.next=function(e){this.isStopped?og(oo("N",e,void 0),this):this._next(e)},t.prototype.error=function(e){this.isStopped?og(oo("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?og(oa,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}(a2),oc=Function.prototype.bind;function od(e,t){return oc.call(e,t)}var op=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){om(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){om(e)}else om(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){om(e)}},e}(),of=function(e){function t(t,i,s){var r,n,a=e.call(this)||this;return aJ(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 op(r),a}return aY(t,e),t}(oh);function om(e){1;or(e)}function og(e,t){}var oy={closed:!0,next:on,error:function(e){throw e},complete:on},oA="function"==typeof Symbol&&Symbol.observable||"@@observable",oS=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 oh||e&&aJ(e.next)&&aJ(e.error)&&aJ(e.complete)&&a4(e)}(e)?new of(e,t,i):e;return ou(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=oT(t))(function(t,s){var r=new of({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[oA]=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=oT(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 oT(e){var t;return null!=(t=null!=e?e:oi)?t:Promise}function ov(e){return e&&aJ(e.schedule)}function oP(e,t){var i,s,r,n;return void 0===e&&(e=0),void 0===t&&(t=ot),e<0&&(e=0),i=e,s=e,void 0===i&&(i=0),void 0===(r=t)&&(r=ot),n=-1,null!=s&&(ov(s)?r=s:n=s),new oS(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 oC=aQ(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ob=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 aY(t,e),t.prototype.lift=function(e){var t=new oE(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new oC},t.prototype.next=function(e){var t=this;ou(function(){var i,s;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var r=aK(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;ou(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;ou(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?a3:(this.currentObservers=null,r.push(e),new a2(function(){t.currentObservers=null,a1(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 oS;return e.source=this,e},t.create=function(e,t){return new oE(e,t)},t}(oS),oE=function(e){function t(t,i){var s=e.call(this)||this;return s.destination=t,s.source=i,s}return aY(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:a3},t}(ob);function oL(e){return function(t){if(aJ(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 o_(e,t,i,s,r){return new oM(e,t,i,s,r)}var oM=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 aY(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}(oh),ox="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function oI(e){return new oS(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 aj(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=aK(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 oD(e,t){return oL(function(i,s){var r=0;i.subscribe(o_(s,function(i){return e.call(t,i,r++)&&s.next(i)}))})}function oO(e){return(oO="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 ow(e){return tt(1,arguments),(!!function(e){return tt(1,arguments),e instanceof Date||"object"===oO(e)&&"[object Date]"===Object.prototype.toString.call(e)}(e)||"number"==typeof e)&&!isNaN(Number(ts(e)))}function oR(e,t){return tt(2,arguments),new Date(ts(e).getTime()+te(t))}function oN(e,t){return tt(2,arguments),oR(e,-te(t))}function oV(e){tt(1,arguments);var t=ts(e),i=t.getUTCDay();return t.setUTCDate(t.getUTCDate()-(7*(i<1)+i-1)),t.setUTCHours(0,0,0,0),t}function oH(e){tt(1,arguments);var t=ts(e),i=t.getUTCFullYear(),s=new Date(0);s.setUTCFullYear(i+1,0,4),s.setUTCHours(0,0,0,0);var r=oV(s),n=new Date(0);n.setUTCFullYear(i,0,4),n.setUTCHours(0,0,0,0);var a=oV(n);return t.getTime()>=r.getTime()?i+1:t.getTime()>=a.getTime()?i:i-1}function oF(e,t){tt(1,arguments);var i,s,r,n,a,o,l,u,h=te(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:n_.weekStartsOn)?s:null==(l=n_.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=ts(e),d=c.getUTCDay();return c.setUTCDate(c.getUTCDate()-(7*(d<h)+d-h)),c.setUTCHours(0,0,0,0),c}function oB(e,t){tt(1,arguments);var i,s,r,n,a,o,l,u,h=ts(e),c=h.getUTCFullYear(),d=te(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:n_.firstWeekContainsDate)?s:null==(l=n_.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=oF(p,t),m=new Date(0);m.setUTCFullYear(c,0,d),m.setUTCHours(0,0,0,0);var g=oF(m,t);return h.getTime()>=f.getTime()?c+1:h.getTime()>=g.getTime()?c:c-1}function ok(e,t){for(var i=Math.abs(e).toString();i.length<t;)i="0"+i;return(e<0?"-":"")+i}var oW=function(e,t){var i=e.getUTCFullYear(),s=i>0?i:1-i;return ok("yy"===t?s%100:s,t.length)},oU=function(e,t){var i=e.getUTCMonth();return"M"===t?String(i+1):ok(i+1,2)},o$=function(e,t){var i=t.length;return ok(Math.floor(e.getUTCMilliseconds()*Math.pow(10,i-3)),t.length)};function oG(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||"")+ok(n,2)}function oz(e,t){return e%60==0?(e>0?"-":"+")+ok(Math.abs(e)/60,2):oY(e,t)}function oY(e,t){var i=Math.abs(e);return(e>0?"-":"+")+ok(Math.floor(i/60),2)+(t||"")+ok(i%60,2)}var oj={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 oW(e,t)},Y:function(e,t,i,s){var r=oB(e,s),n=r>0?r:1-r;return"YY"===t?ok(n%100,2):"Yo"===t?i.ordinalNumber(n,{unit:"year"}):ok(n,t.length)},R:function(e,t){return ok(oH(e),t.length)},u:function(e,t){return ok(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 ok(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 ok(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 oU(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 ok(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){tt(1,arguments);var i=ts(e);return Math.round((oF(i,t).getTime()-(function(e,t){tt(1,arguments);var i,s,r,n,a,o,l,u,h=te(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:n_.firstWeekContainsDate)?s:null==(l=n_.locale)||null==(u=l.options)?void 0:u.firstWeekContainsDate)?i:1),c=oB(e,t),d=new Date(0);return d.setUTCFullYear(c,0,h),d.setUTCHours(0,0,0,0),oF(d,t)})(i,t).getTime())/6048e5)+1}(e,s);return"wo"===t?i.ordinalNumber(r,{unit:"week"}):ok(r,t.length)},I:function(e,t,i){var s=function(e){tt(1,arguments);var t=ts(e);return Math.round((oV(t).getTime()-(function(e){tt(1,arguments);var t=oH(e),i=new Date(0);return i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0),oV(i)})(t).getTime())/6048e5)+1}(e);return"Io"===t?i.ordinalNumber(s,{unit:"week"}):ok(s,t.length)},d:function(e,t,i){var s,r;return"do"===t?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):(s=e,r=t,ok(s.getUTCDate(),r.length))},D:function(e,t,i){var s=function(e){tt(1,arguments);var t=ts(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"}):ok(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 ok(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 ok(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 ok(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,ok(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,ok(s.getUTCHours(),r.length))},K:function(e,t,i){var s=e.getUTCHours()%12;return"Ko"===t?i.ordinalNumber(s,{unit:"hour"}):ok(s,t.length)},k:function(e,t,i){var s=e.getUTCHours();return(0===s&&(s=24),"ko"===t)?i.ordinalNumber(s,{unit:"hour"}):ok(s,t.length)},m:function(e,t,i){var s,r;return"mo"===t?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):(s=e,r=t,ok(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,ok(s.getUTCSeconds(),r.length))},S:function(e,t){return o$(e,t)},X:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return oz(r);case"XXXX":case"XX":return oY(r);default:return oY(r,":")}},x:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"x":return oz(r);case"xxxx":case"xx":return oY(r);default:return oY(r,":")}},O:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+oG(r,":");default:return"GMT"+oY(r,":")}},z:function(e,t,i,s){var r=(s._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+oG(r,":");default:return"GMT"+oY(r,":")}},t:function(e,t,i,s){return ok(Math.floor((s._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,i,s){return ok((s._originalDate||e).getTime(),t.length)}},oK=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"})}},oq=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:oq,P:function(e,t){var i,s=e.match(/(P+)(p+)?/)||[],r=s[1],n=s[2];if(!n)return oK(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}}",oK(r,t)).replace("{{time}}",oq(n,t))}},oZ=["D","DD"],oJ=["YY","YYYY"];function oQ(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 o0={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 o1(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 o2={date:o1({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:o1({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:o1({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},o3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function o4(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 o5(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 o6(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 o7={code:"en-US",formatDistance:function(e,t,i){var s,r=o0[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:o2,formatRelative:function(e,t,i,s){return o3[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:o4({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:o4({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:o4({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:o4({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:o4({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:o6({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:o5({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:o5({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:o5({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:o5({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:o5({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}},o8=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,o9=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,le=/^'([^]*?)'?$/,lt=/''/g,li=/[a-zA-Z]/;function ls(e,t,i){tt(2,arguments);var s,r,n,a,o,l,u,h,c,d,p,f,m,g,y,A,S,T,v=String(t),P=null!=(s=null!=(r=null==i?void 0:i.locale)?r:n_.locale)?s:o7,C=te(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:n_.firstWeekContainsDate)?a:null==(c=n_.locale)||null==(d=c.options)?void 0:d.firstWeekContainsDate)?n:1);if(!(C>=1&&C<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var b=te(null!=(p=null!=(f=null!=(m=null!=(g=null==i?void 0:i.weekStartsOn)?g:null==i||null==(y=i.locale)||null==(A=y.options)?void 0:A.weekStartsOn)?m:n_.weekStartsOn)?f:null==(S=n_.locale)||null==(T=S.options)?void 0:T.weekStartsOn)?p:0);if(!(b>=0&&b<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!P.localize)throw RangeError("locale must contain localize property");if(!P.formatLong)throw RangeError("locale must contain formatLong property");var E=ts(e);if(!ow(E))throw RangeError("Invalid time value");var L=to(E),_=oN(E,L),M={firstWeekContainsDate:C,weekStartsOn:b,locale:P,_originalDate:E};return v.match(o9).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,oX[t])(e,P.formatLong):e}).join("").match(o8).map(function(s){if("''"===s)return"'";var r,n,a=s[0];if("'"===a){return(n=(r=s).match(le))?n[1].replace(lt,"'"):r}var o=oj[a];if(o)return null!=i&&i.useAdditionalWeekYearTokens||-1===oJ.indexOf(s)||oQ(s,t,String(e)),null!=i&&i.useAdditionalDayOfYearTokens||-1===oZ.indexOf(s)||oQ(s,t,String(e)),o(_,s,P.localize,M);if(a.match(li))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join("")}var lr={year:0,month:1,day:2,hour:3,minute:4,second:5},ln={};function la(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 lo=/^(Z)$/,ll=/^([+-]\d{2})$/,lu=/^([+-]\d{2}):?(\d{2})$/;function lh(e,t,i){if(!e||(s=lo.exec(e)))return 0;if(s=ll.exec(e))return ld(n=parseInt(s[1],10))?-(36e5*n):NaN;if(s=lu.exec(e)){var s,r,n=parseInt(s[1],10),a=parseInt(s[2],10);return ld(n,a)?(r=36e5*Math.abs(n)+6e4*a,n>0?-r:r):NaN}if(function(e){if(lp[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),lp[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var o,l=lc(i?t:la((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=lc(new Date(s),i);if(t===r)return t;var n=lc(new Date(s-=r-t),i);return r===n?r:Math.max(r,n)}(t,l,e))}return NaN}function lc(e,t){var i,s,r,n,a,o=(a=function(e){if(!ln[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"));ln[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 ln[e]}(t)).formatToParts?function(e,t){try{for(var i=e.formatToParts(t),s=[],r=0;r<i.length;r++){var n=lr[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=la(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 ld(e,t){return -23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var lp={},lf=N("9J8r2"),lm=N("6ejce"),lg=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,ly=/^([0-9W+-]+)(T| )(.*)/,lA=/^([0-9W+-]+)(.*)/,lS=/^(\d{2})$/,lT=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],lv=/^(\d{4})/,lP=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],lC=/^-(\d{2})$/,lb=/^-?(\d{3})$/,lE=/^-?(\d{2})-?(\d{2})$/,lL=/^-?W(\d{2})$/,l_=/^-?W(\d{2})-?(\d{1})$/,lM=/^(\d{2}([.,]\d*)?)$/,lx=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,lI=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/;function lD(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(lf)(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=ly.exec(e);if(s?(i.date=s[1],t=s[3]):(s=lA.exec(e))?(i.date=s[1],t=s[2]):(i.date=null,t=e),t){var r=lg.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=lT[t],r=lP[t];if(i=lv.exec(e)||r.exec(e)){var n=i[1];return{year:parseInt(n,10),restDateString:e.slice(n.length)}}if(i=lS.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=lC.exec(e))return(n=new Date(0),lV(t,s=parseInt(i[1],10)-1))?(n.setUTCFullYear(t,s),n):new Date(NaN);if(i=lb.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=lN(e);return(!i||!(t>366))&&(!!i||!(t>365))}(t,a)?new Date(NaN):(n.setUTCFullYear(t,0,a),n)}if(i=lE.exec(e)){n=new Date(0),s=parseInt(i[1],10)-1;var o=parseInt(i[2],10);return lV(t,s,o)?(n.setUTCFullYear(t,s,o),n):new Date(NaN)}if(i=lL.exec(e))return lH(t,r=parseInt(i[1],10)-1)?lO(t,r):new Date(NaN);if(i=l_.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return lH(t,r,l)?lO(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=lM.exec(e))return lF(i=parseFloat(t[1].replace(",",".")))?i%24*36e5:NaN;if(t=lx.exec(e))return lF(i=parseInt(t[1],10),s=parseFloat(t[2].replace(",",".")))?i%24*36e5+6e4*s:NaN;if(t=lI.exec(e)){var t,i=parseInt(t[1],10),s=parseInt(t[2],10),r=parseFloat(t[3].replace(",","."));return lF(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=lh(n.timeZone||s.timeZone,new Date(h+c))))return new Date(NaN)}else u=e(lm)(new Date(h+c)),u=e(lm)(new Date(h+c+u));return new Date(h+c+u)}function lO(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 lw=[31,28,31,30,31,30,31,31,30,31,30,31],lR=[31,29,31,30,31,30,31,31,30,31,30,31];function lN(e){return e%400==0||e%4==0&&e%100!=0}function lV(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var s=lN(e);if(s&&i>lR[t]||!s&&i>lw[t])return!1}return!0}function lH(e,t,i){return!(t<0)&&!(t>52)&&(null==i||!(i<0)&&!(i>6))}function lF(e,t,i){return(null==e||!(e<0)&&!(e>=25))&&(null==t||!(t<0)&&!(t>=60))&&(null==i||!(i<0)&&!(i>=60))}var lB={};Object.defineProperty(lB,"__esModule",{value:!0}),lB.default=function(e){return(0,lk.default)({},e)};var lk=(t=N("eG07G"))&&t.__esModule?t:{default:t};lB=lB.default;let lW=[aL.Open,aL.High,aL.Low,aL.Last,aL.Close,aL.TradingDay,aL.PreviousClose,aL.PreviousHigh,aL.PreviousLow,aL.PreviousOpen,aL.Volume,aL.Change,aL.PercentChange,aL.YearHigh,aL.YearLow,aL.WeekPreviousClose,aL.WeekPreviousHigh,aL.WeekPreviousLow,aL.MonthPreviousClose,aL.MonthPreviousHigh,aL.MonthPreviousLow];class lU{recordCache;translateSymbolBack;_subject;constructor(){this.recordCache=new Map,this.translateSymbolBack=new Map}get subject(){if(!eF(this._subject)){var e;let t=oP(Math.max(tY.MINIMUM_THROTTLE,AM().config.throttleMillis||0)),i=oP(tY.BACKGROUND_TAB_THROTTLE);this._subject=new ob().pipe((e=()=>globalThis.document?.hidden?i:t,oL(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 oS)return e;if(null!=e){var t,i,s,r;if(aJ(e[oA])){return t=e,new oS(function(e){var i=t[oA]();if(aJ(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 oS(function(e){for(var t=0;t<i.length&&!e.closed;t++)e.next(i[t]);e.complete()})}if(aJ(null==e?void 0:e.then)){return s=e,new oS(function(e){s.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,or)})}if(Symbol.asyncIterator&&aJ(null==e?void 0:e[Symbol.asyncIterator]))return oI(e);if(aJ(null==e?void 0:e[ox])){return r=e,new oS(function(e){var t,i;try{for(var s=aK(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(aJ(null==e?void 0:e.getReader))return oI(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 aZ?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 aj(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,aZ(t.read())];case 3:if(s=(i=r.sent()).value,!i.done)return[3,5];return[4,aZ(void 0)];case 4:return[2,r.sent()];case 5:return[4,aZ(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=o_(i,n,on))};n(),t.subscribe(o_(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}))})),oD(e=>e.length>0))}return this._subject}addRecordForSymbol(e,t){let i=t1(e);i!==e&&this.translateSymbolBack.set(i,e),this.recordCache.set(e,t)}removeRecordForSymbol(e){this.recordCache.delete(e);let t=t1(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 lW}makeAndCacheRecord(e,t){if(e===tY.PLACEHOLDER_SYMBOL_NAME)return new aO(tY.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 l$ extends lU{getRecord(e){return this.makeAndCacheRecord(e,()=>new aW(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class lG extends lU{getRecord(e){return this.makeAndCacheRecord(e,()=>new ak(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class lz extends lU{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),AM().connection.off("marketUpdate",this.onMarketUpdate,e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new aB(e))}postInit(e,t){e&&AM().connection.on("marketUpdate",this.onMarketUpdate,t.translated)}onMarketUpdate(e){if(e.type===tY.REALTIME_INITIAL_QUOTE){let t=this.updateFromQuote(e,!0);this.subject.next({topic:a_.RT_QUOTE,data:e,updated:t})}else if(e.type===tY.REALTIME_TRADE){let t=AM().connection.getMarketState().getQuote(e.symbol),i=this.updateFromQuote(t);this.subject.next({topic:a_.RT_TRADE,data:e,updated:i}),e.symbol===tY.DEBUG_SYMBOL&&console.log(`Trade
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Bars %csame %c${i(t.lastTimestamp)} == ${i(t.newTimestamp)}`,"color:#0f0","color:#f96"),this.addBar(e,t)):null}alignToQuote(e){if(eF(e.lastPrice,e.time))return this.updateLastBar(e.highPrice,e.lowPrice,e.lastPrice,void 0),{isUpdate:!0,time:e.time.getTime(),index:us(this.container)}}}class uo extends ua{innerBuilder;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.processRetrieved()}get base(){return this.innerBuilder.container}fixupTimeBasedAggregationTimestamp(e){let t=lK(e,tY.START_OF_LAST_CENTURY);return lZ(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(aL.DateTime)[e],tradeSize:0,tradePrice:0,tradingDay:0};[aL.Open,aL.High,aL.Low].forEach(i=>{t.tradePrice=this.base.getData(i)[e],super.process(t)}),t.tradePrice=this.base.getData(aL.Close)[e],t.tradeSize=this.base.getData(aL.Volume)[e],super.process(t)}}process(e){return this.innerBuilder.process(e),super.process(e)}}class ul{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!==aL.Change||!this.hasField(aL.Close)||t<1)return;let i=this.storage[e.id],s=this.storage[aL.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(aL.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(aL.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(aL.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),eC(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 uu extends ul{constructor(){super([])}get size(){return 0}}class uh extends ul{wrapper;constructor(e,t){super(e),this.wrapper=t}isWrapped(e){return e$(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 uc=tY.RENKO_KAGI_NAMES;function ud(e){let{Method:t,Period:i,Source:s,BrickSize:r}=eK(e),n=eU(t,[uc.ATR,uc.TRD,uc.PCT],uc.ATR),a=Number.isFinite(i)?i:14;return{method:n,period:a,source:eU(s,[uc.CLS,uc.HL],uc.CLS),brickSize:Number.isFinite(r)?r:10}}function up(e,t,i){return e.getData(t)[i]}function uf(e,t){let[i,s]=[aL.High,aL.Low].map(i=>up(e,i,t)),r=up(e,aL.Close,t-1);return Math.max(i-s,Math.abs(i-r),Math.abs(s-r))}function um(e,t){if(e.size<t)return null;let i=t-1,s=[];s.push(up(e,aL.High,0)-up(e,aL.Low,0));for(let i=1;i<t;++i)s.push(uf(e,i));let r=eg(s);for(let s=t;s<e.size;++s)r=(r*i+uf(e,s))/t;return r}let ug=e=>aL[e],uy=["DateTime","Open","High","Low","Close","Volume"].map(ug),uA=uy.concat(["Change","Projection","BarIndex"].map(ug));class uS extends ur{innerBuilder;inputs;brickSize;lastFinalBrick;projectionCount;refPrices;constructor(e,t){super(),this.supportsChunks=!1,this.innerBuilder=e,this.inputs=ez(t.inputs),this.brickSize=null,this.container=new ul(uA),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]=uy.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,eB(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*tY.RENKO_MAX_BARS;for(;t>0&&e<i;)e+=Math.floor(uf(this.base,t)/this.brickSize),t--;return t}processRetrieved(){let e=ud(this.inputs),{method:t,period:i,source:s}=e;if(this.brickSize=e.brickSize,t===uc.ATR)this.brickSize=um(this.base,i);else if(t===uc.PCT)if((this.base?.size??0)>0){let e=this.base.getLastDataPoint(aL.Close);this.brickSize=e*this.brickSize/100}else this.brickSize=null;if(!eF(this.brickSize))return;this.refPrices=s===uc.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(tY.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(aL.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(aL.DateTime,e.date),t.addDataPoint(aL.Open,e.open),t.addDataPoint(aL.Close,e.close),t.addDataPoint(aL.High,e.high),t.addDataPoint(aL.Low,e.low),t.addDataPoint(aL.Change,e.change),t.addDataPoint(aL.Volume,e.volume),t.addDataPoint(aL.Projection,e.proj),t.addDataPoint(aL.BarIndex,e.barIndex)}updateLastDataPoint(e){let t=this.container;t.setLastDataPoint(aL.DateTime,e.date),t.setLastDataPoint(aL.Open,e.open),t.setLastDataPoint(aL.Close,e.close),t.setLastDataPoint(aL.High,e.high),t.setLastDataPoint(aL.Low,e.low),t.setLastDataPoint(aL.Change,e.change),t.setLastDataPoint(aL.Volume,e.volume),t.setLastDataPoint(aL.Projection,e.proj),t.setLastDataPoint(aL.BarIndex,e.barIndex)}}let uT=[aL.DateTime,aL.TradingDay,aL.Last,aL.TradeSize,aL.Change],uv=[aL.DateTime,aL.Open,aL.High,aL.Low,aL.Close,aL.Volume,aL.Change],uP=[...uv,aL.OpenInterest],uC=[...uP,aL.Symbol],ub=[aL.Open,aL.High,aL.Low,aL.Close,aL.Change];function uE(e,t){let i=tL(e);if(t.isTick)return uT;{let e=uv;return t.isMultiContract?e=uC:(i||t.isEndOfDay)&&(e=uP),t.isIntraday?[...e,aL.TradingDay]:e}}class uL{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=ty(e),this.padded=s,this.needsResolution=tE(e),this.hasOpenInterest=tL(e)}makeContainer(){return new ul(uE(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(aL.DateTime,this.parseDate(e[0+t])),this.container.addDataPoint(aL.TradingDay,parseInt(e[1+t])),this.container.addDataPoint(aL.Last,parseFloat(e[3+t])),this.container.addDataPoint(aL.TradeSize,parseInt(e[4+t])),this.container.addDataPoint(aL.Change,this.calculateChange(aL.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(aL.Symbol)&&this.container.addDataPoint(aL.Symbol,t?e[0]:this.symbol),this.container.addDataPoint(aL.DateTime,this.parseDate(e[0+i])),this.container.addDataPoint(aL.TradingDay,parseInt(e[1+i])),this.container.addDataPoint(aL.Open,parseFloat(e[2+i])),this.container.addDataPoint(aL.High,parseFloat(e[3+i])),this.container.addDataPoint(aL.Low,parseFloat(e[4+i])),this.container.addDataPoint(aL.Close,parseFloat(e[5+i])),this.container.addDataPoint(aL.Volume,this.nullify(parseInt(e[6+i]))),this.container.addDataPoint(aL.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(aL.Symbol,e[0]),this.container.addDataPoint(aL.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aL.Open,this.parseFloatOrNull(e[2])),this.container.addDataPoint(aL.High,parseFloat(e[3])),this.container.addDataPoint(aL.Low,parseFloat(e[4])),this.container.addDataPoint(aL.Close,parseFloat(e[5])),this.container.addDataPoint(aL.Volume,this.nullify(this.parseIntOrNull(e[6]))),this.hasOpenInterest&&this.container.addDataPoint(aL.OpenInterest,this.nullify(this.parseIntOrNull(e[7]))),this.container.addDataPoint(aL.Change,this.calculateChange()))}calculateChange(e=aL.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 G.Tick:case G.Intraday:return function(e,t=tY.ZERO_DATE){let i=new Date(e.replace(" ","T"));return ow(i)?i:t}(e);default:return ui(e)}}parseDate(e){let t=this.parseTimestamp(e);return this.aggregation.isEndOfDay?tn(t,this.offset):(!function(e,t){tt(2,arguments);var i=ts(e),s=ts(t);return i.getTime()>s.getTime()}(t,this.previousTime)?this.previousTime=oR(this.previousTime,1):this.previousTime=t,this.previousTime)}getTimeZone(){return t_(this.symbol)}}let{BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:u_,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:uM}=tY;class ux{supportsChunks;constructor(){this.supportsChunks=!0}getPageNameFor(e,t){switch(e.unit){case G.Tick:return tY.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case G.Intraday:return t&&e.spec===z.Nearest?u_:uM;case G.Day:case G.Week:case G.Month:case G.Quarter:case G.Year:return tY.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return""}}addExtraParams(e){}makeUrl(e){let t={},i=t1(e.symbol);t.symbol=i;let s=e.aggregation,r=this.getDataParam(s);r.length>0&&(t.data=r),s.size>1&&s.unit===G.Intraday&&(t.interval=(s.spec===z.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||tY.DEFAULT_MAX_RECORDS;s.unit===G.Tick&&s.spec!==z.None&&(i*=tY.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=eX(t),h=ty(i),c=this.getPageNameFor(s,h);return`/${c}?${u}`}toHistoricalFeedDate(e,t){return ls(e,t.isTick||t.isIntraday?tY.FMT_HIST_FEED_PARAM_DATE_TIME:tY.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(e){let t="",i=this.getSpecPart(e);switch(e.unit){case G.Tick:case G.Intraday:break;case G.Day:t=`daily${i}`;break;case G.Week:t=`weekly${i}`;break;case G.Month:t=`monthly${i}`;break;case G.Quarter:t=`quarterly${i}`;break;case G.Year:t=`yearly${i}`}return t}getSpecPart(e){return e.isMultiContract?e.spec===z.Continue?"continue":"nearest":""}getParser(e){return new uL(t1(e.symbol),e.aggregation,e.offset,e.padded)}async retrieve(e){let t=this.makeUrl(e),i=e.aggregation.unit===G.Tick?"timeseriesNew":"timeseries",s=await Ab(i,t);return this.getParser(e).parse(s)}}class uI{supportsChunks;constructor(){this.supportsChunks=!1}addExtraParams(e){}async retrieve(e){let t=t1(e.symbol),i=this.emptyContainer(t,e.aggregation);if(e.aggregation.unit!==G.Day)return i;let s={symbol:t};this.addExtraParams(s);let r=`/${this.getPageName()}.json?${eX(s)}`,n=await Ab("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){AP(`Failed parsing the JSON result from OnDemand, error is ${e.message}`)}return i}}class uD extends uI{emptyContainer(e,t){return new ul(uE(e,t))}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){let s=i.hasField(aL.Symbol),r=t>0?i.getLastDataPoint(aL.Close):null;i.addDataPoint(aL.DateTime,ui(e.date)),s&&i.addDataPoint(aL.Symbol,e.symbol),i.addDataPoint(aL.Open,e.open),i.addDataPoint(aL.High,e.high),i.addDataPoint(aL.Low,e.low),i.addDataPoint(aL.Close,e.close),i.addDataPoint(aL.Volume,e.volume),i.addDataPoint(aL.OpenInterest,e.openInterest);let n=null===r?null:eB(e.close-r,2);i.addDataPoint(aL.Change,n)}}let uO={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 uw{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){let t=t1(e.symbol).replace(/\.bz$/i,""),i=e.fields.concat(aL.DateTime),s=()=>new ul(i);if(e.aggregation.unit!==G.Day)return s();let r={symbol:t,apiKey:"default",fields:i.map(e=>uO[e.id]).join(",")},n=`/get?${eX(r)}`,a=await Ab("options",n);try{let e=JSON.parse(a).data,t=s();return e.forEach(e=>{i.forEach(i=>{if(i===aL.DateTime)t.addDataPoint(aL.DateTime,ui(e.date));else{let s;t.addDataPoint(i,(s=e[uO[i.id]],Number.parseFloat(s.replace(/,/g,""))))}})}),t}catch(e){AP(`Failed parsing options JSON historical data result, error is ${e.message}`)}return s()}}function uR(e,t){return oL(function(i,s){var r=0;i.subscribe(o_(s,function(i){s.next(e.call(t,i,r++))}))})}var uN=lJ(lZ,2);function uV(e,t){return tt(2,arguments),ts(e).getTime()-ts(t).getTime()}var uH={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function uF(e){return e?uH[e]:uH.trunc}function uB(e,t,i){tt(2,arguments);var s=uV(e,t)/1e3;return uF(null==i?void 0:i.roundingMethod)(s)}class uk extends ua{innerBuilder;isBuildingBars;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.isBuildingBars=!1,this.retryCountForChunk=tY.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]=[aL.DateTime,aL.TradeSize,aL.Last,aL.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 uW extends uk{constructor(e,t,i){super(e,t,i)}fixupTimeBasedAggregationTimestamp(e){let t=uB(e,tc(ag(e,1)));return function(e,t){return tt(2,arguments),l5(e,-te(t))}(e,t%this.agg.size)}}class uU extends uk{series;constructor(e,t,i,s){super(e,i,s),this.series=t}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}}let u$=new aC("_TICK_COUNT");class uG extends uU{anchorTimestamp=null;constructor(e,t,i,s){super(e,t,i,s)}get startFromIndex(){let e=0,t=this.base.getTimeData();if(eF(this.anchorTimestamp))e=eE(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(u$,1),i}changeLastBar(e,t){let i=super.changeLastBar(e,t),s=this.container.getLastDataPoint(u$);return this.container.setLastDataPoint(u$,s+1),i}isUpdate(e,t,i,s){return this.container.getLastDataPoint(u$)<this.agg.size}}let uz=new aC("_VOLUME_TALLY");class uY extends uU{constructor(e,t,i,s){super(e,t,i,s)}addBar(e,t){let i=this.container,s=(i.getLastDataPoint(uz)||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(aL.Volume,a?1:r),i.setLastDataPoint(uz,s));let o=super.addBar(e,t);return i.setLastDataPoint(aL.Volume,1),i.addDataPoint(uz,a?0:n),o}changeLastBar(e,t){let i=this.container,s=super.changeLastBar(e,t);i.setLastDataPoint(aL.Volume,1);let r=i.getLastDataPoint(uz)??0;return i.setLastDataPoint(uz,r+e.tradeSize),s}isUpdate(e,t,i,s){if(!nC(e,t))return!1;let r=this.container.getLastDataPoint(uz)??0;return s.tradeSize+r<this.agg.size}}class uj extends ua{innerBuilder;metadata;range;step;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.range=i.size,this.step=1;let r=AM().getMetaDataSource();this.metadata=r.getMetaData(s)}get priceRange(){return this.step*this.range}get base(){return this.innerBuilder.container}ready(){return t$.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(aL.Volume)[e],i=this.useHighOrLow(e);if(!eF(i)){this.updateLastBar(void 0,void 0,void 0,t);continue}let s={isTrade:!0,time:this.base.getData(aL.DateTime)[e],tradeSize:t,tradePrice:i,tradingDay:0};super.process(s)}}useHighOrLow(e){let t=this.base.getData(aL.Close)[e];if(0==this.container.size)return t;let i=this.container.getLastDataPoint(aL.High),s=this.container.getLastDataPoint(aL.High),r=this.base.getData(aL.High)[e],n=this.base.getData(aL.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(aL.Low)+this.priceRange;if(i>s)return this.changeAndAddBar(s,e,t);let r=this.container.getLastDataPoint(aL.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(aL.Projection,0),this.addBar(t,i)}addBar(e,t){return this.container.addDataPoint(aL.Projection,1),super.addBar(e,t)}}let uK=[aL.Open,aL.High,aL.Low,aL.Close],uq=[aL.BARCOLIX,aL.High,aL.Low],uX=tY.RENKO_KAGI_NAMES;function uZ(e){let{BoxSizeMethod:t,Period:i,ReversalAmount:s}=eK(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 uJ extends ua{innerBuilder;inputs;reversal;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=ez(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(aL.BARCOLIX,null),this.container.size>1){let e=this.dataAt(aL.Close,this.container.size-2);this.setLast(aL.Open,e),this.updateLastBar(e,e)}return null}isUpdate(e,t,i,s){let r=s.tradePrice,n=r-this.getLast(aL.Close),a=n>=0,o=Math.abs(n)>=this.reversal,[l,u,h,c]=uK.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(aL.Close,e)>this.dataAt(aL.Open,e),t=this.container.size;if(t>1){let i=e(t-1),[s,r,n]=uq.map(e=>this.dataAt(e,t-2)),[,a,o]=uq.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(aL.BARCOLIX,l)}else this.setLast(aL.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}=uZ(this.inputs);if(this.reversal=i,e===uX.ATR&&(this.reversal=um(this.base,t)),eF(this.reversal)){this.container.clear(),this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){let t={isTrade:!0,time:this.baseAt(aL.DateTime,e),tradePrice:this.baseAt(aL.Close,e),tradeSize:this.baseAt(aL.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}function uQ(e){let{LineCount:t}=eK(e);return{lineBreak:Number.isFinite(t)?t:3}}class u0 extends ua{innerBuilder;lineBreak;currentVolume;inputs;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.inputs=ez(s.inputs);let r=uQ(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(aL.DateTime)[e],tradeSize:this.base.getData(aL.Volume)[e],tradePrice:this.base.getData(aL.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(aL.Open,r),this.container.setLastDataPoint(aL.Low,Math.min(r,i)),this.container.setLastDataPoint(aL.High,Math.max(r,i))):this.resetProjection()}resetProjection(){let e=this.container;e.setLastDataPoint(aL.High,null),e.setLastDataPoint(aL.Low,null),e.setLastDataPoint(aL.Open,null),e.setLastDataPoint(aL.Close,null),e.setLastDataPoint(aL.Change,null)}isProjection(e){return this.agg.isIntraday||this.durationAdd(e).getTime()>Date.now()}updateProjection(e,t){this.container.setLastDataPoint(aL.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(aL.Projection)){let s=i.getLastDataPoint(aL.Close);if(null===this.findOpen(s,this.lineBreak,1))return this.updateProjection(e,t);i.setLastDataPoint(aL.Projection,0),i.setLastDataPoint(aL.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(aL.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(aL.Projection,1),!0)}findOpen(e,t,i=0){if(!eF(e))return null;let s=this.container,r=s.size-1-i,n=s.getData(aL.Close)[r],a=s.getData(aL.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(aL.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(aL.High)[r-i])return null;return a}return n}startLine(e){this.container.addDataPoint(aL.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 u1=tY.RENKO_KAGI_NAMES;function u2(e){switch(e){case tY.BARKIND_O:case tY.BARKIND_XO:return!0;default:return!1}}function u3(e){switch(e){case tY.BARKIND_X:case tY.BARKIND_OX:return!0;default:return!1}}function u4(e){let t=eK(e),{Source:i,BoxSizeMethod:s,Period:r}=t,{ReversalAmount:n,BoxSize:a,OneStepBack:o}=t,l=eU(i,[u1.CLS,u1.HL],u1.CLS),u=eU(s,[u1.ATR,u1.TRD],u1.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 u5 extends ua{innerBuilder;inputs;boxSize;reversal;source;firstTrend;oneStepBack;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=ez(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===u1.CLS}get currentKind(){return this.getLast(aL.BARKIND)}getTrendField(e){return this.closeBased?aL.Close:e?aL.Low:aL.High}getTrendPrice(e,t){return this.closeBased?e.tradePrice:t?e._lowPrice:e._highPrice}changeLastBar(e,t){let i=u2(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=u2(this.currentKind),r=s?1:-1,n=i?null:this.getLast(aL.Close),a=this.getTrendPrice(e,!s);if(e.tradePrice=(i?this.roundToBox(this.baseAt(aL.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(aL.BARKIND,null),this.computeBarColor(),null}inplaceReverse(){let e=u2(this.currentKind)?tY.BARKIND_OX:tY.BARKIND_XO;this.setLast(aL.BARKIND,e)}canInplaceReverse(){return!function(e){switch(e){case tY.BARKIND_OX:case tY.BARKIND_XO:return!0;default:return!1}}(this.currentKind)&&this.getLast(aL.High)===this.getLast(aL.Low)}isUpdate(e,t,i,s){let r=u2(this.currentKind),n=this.getTrendPrice(s,r),a=this.getTrendPrice(s,!r),o=n-this.getLast(aL.Close),l=o>=0,u=Math.abs(o)>=this.boxSize,h=a-this.getLast(aL.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(aL.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,tY.BARKIND_X];if(2===t&&s<0)return[r,tY.BARKIND_O];if(3===t)return[r,s>0?tY.BARKIND_X:tY.BARKIND_O]}}return[null,null]}findFirstBarTrend(){if(this.innerBuilder.container.size<2)return null;if(this.closeBased){let[,e]=this.findFirstDiffLargerThanBox(aL.Close,3);return e}{let[e,t]=this.findFirstDiffLargerThanBox(aL.High,1),[i,s]=this.findFirstDiffLargerThanBox(aL.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=u2(this.dataAt(aL.BARKIND,e-2))?tY.BARKIND_X:tY.BARKIND_O),this.setLast(aL.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}=u4(this.inputs);if((this.reversal=i,this.source=s,e===u1.ATR?this.boxSize=um(this.base,t):this.boxSize=r,eF(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(aL.DateTime,e),tradePrice:this.baseAt(aL.Close,e),_highPrice:this.baseAt(aL.High,e),_lowPrice:this.baseAt(aL.Low,e),tradeSize:this.baseAt(aL.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}let u6=new nF(G.Intraday,0);class u7{query;container;canLoadMoreData;alignToQuote;record;isLoading;serverComputedSeries;builder;retriever;streamingSubscription;records;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 aO(e.symbol)}get isTotalVolumeMode(){let e=this.query.symbol,t=this.query.aggregation;return ty(e)&&!t.isContractVolume&&t.isEndOfDay}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 ua(e,t);switch(t.spec){case z.None:case z.PerSeconds:case z.PerCount:case z.PerVolume:return new un(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 ul(uE(this.query.symbol,e).concat(t));switch(this.query.curveStyle){case $.Renko:return new uS(t,this.query);case $.Kagi:return new uJ(t,s(u6,[aL.BARCOLIX]),this.query);case $.PointAndFigure:return new u5(t,s(u6,[aL.BARKIND]),this.query);case $.LineBreak:return new u0(t,s(i,[aL.Projection]),i,this.query)}if(i.isIntraday&&i.spec===z.PerRange)return new uj(t,s(u6,[aL.Projection]),i,this.query.symbol);if(i.isTick)switch(i.spec){case z.PerSeconds:return new uW(t,s(u6),i);case z.PerCount:return new uG(t,this,s(u6,[u$]),i);case z.PerVolume:return new uY(t,this,s(u6,[uz]),i)}return i.unit===G.Day&&i.size>1?new uo(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&&(eN(a_.TS_QUOTEMARKER,{series:this}),this.alignToQuote)){let t=this.builder.alignToQuote(e);return this.alignToQuote=!1,t}return null}).filter(e=>eF(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)eN(a_.TS_MANYCHANGED,{series:this,part:en.Unspecified});else{let t={series:this,index:e.index};eN(e.isUpdate?a_.TS_DATAPOINTCHANGED:a_.TS_DATAPOINTADDED,t)}e.timeCorrection&&eN(a_.TS_TIMELINECORRECTION,{...e.timeCorrection,series:this})})}get hasData(){return null!==this.container}getRetriever(){return tP(this.query.symbol)&&this.query.aggregation.isEndOfDay?new uD:new ux}getStreamingSubscription(){return AM().getRecordSource().subject.pipe(uR(e=>{let t=this.query.aggregation.isEndOfDay,i=aG(a_.RT_TRADE,this.record.symbol),s=e=>"T"!==e.data.session||this.query.extendedHours&&!t,r=e.filter(i).filter(e=>eF(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}));if(this.isTotalVolumeMode&&this.records){let t=this.getSiblingVolume(e);if(t>0&&r.length>0)r[0].tradeSize+=t;else if(t>0&&0===r.length){let e=this.record.getValue(aL.Last)??this.record.getValue(aL.Close);if(eF(e)){let i=new Date;r.push({isTrade:!0,tradePrice:e,tradeSize:t,time:i,tradingDay:this.record.getValue(aL.TradingDay)})}}}let n=r.reduce((e,t)=>{let i=eC(e);return eF(i)&&eF(i.tradePrice)&&eF(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},[]),a=aG(a_.RT_QUOTE,this.record.symbol);return n.concat(e.filter(a).map(e=>({isQuote:!0,openPrice:e.data.openPrice,highPrice:e.data.highPrice,lowPrice:e.data.lowPrice,lastPrice:e.data.lastPrice,time:e.data.tradeTime})))}),oD(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}getSiblingVolume(e){if(!this.records)return 0;let t=e=>e.topic===a_.RT_TRADE&&e.data.symbol in this.records;return e.filter(t).filter(e=>eF(e.data.time)).filter(e=>"T"!==e.data.session).reduce((e,t)=>e+t.data.tradeSize,0)}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();eF(e.offset)&&0!==e.offset&&(t=tn(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;eN(a_.TS_MANYCHANGED,{series:this,part:en.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);eF(s.offset)&&0!==s.offset&&(r=tn(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),eN(a_.TS_MANYCHANGED,{series:this,part:en.Head}))}async applyNearbyFixup(e){let t=this.query.aggregation,i=t.spec===z.Nearest,s=this.query.symbol,r=ty(s);return r&&t.isMultiContract&&i&&!(e.size<1)&&!this.serverComputedSeries?e.getLastDataPoint(aL.Symbol):r&&tE(s)?await tm(s):s}async ready(){return t$.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=AM().getRecordSource().getRecord(t)),this.canLoadMoreData=!this.hasVisibleFrom&&e.size>0,this.isTotalVolumeMode&&await this.setupTotalVolumeSubscriptions(),this.builder=this.makeBuilder(e),await this.builder.ready(),this.container=this.builder.container,this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0})}async setupTotalVolumeSubscriptions(){let e=tx(this.query.symbol);if(e)try{let t=(await tM(e)).map(e=>e.name).filter(e=>e!==this.record.symbol),i=AM().getRecordSource();for(let e of(this.records={},t))this.records[e]=i.getRecord(e);await Promise.all(Object.values(this.records).map(e=>e.ready()))}catch(e){this.records=void 0}}getCacheableEntities(e){e.add(this)}shutdown(){eF(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.records=void 0}}class u8{query;container;_pretendEmpty;constructor(e,t=!1){this._pretendEmpty=t,this.query=e,this.container=new uu}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 u9{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 he{query;container;supplyCustomDemoData;canLoadMoreData;isLoading;constructor(e){this.query=e,this.canLoadMoreData=!0,this.isLoading=!0,this.container=null,this.supplyCustomDemoData="DemoSite"===AM().config.mode}refresh(){}loadMoreData(e){throw Error("Should not be called.")}get hasData(){return null!==this.container}shutdown(){}parseEvents(e){let t=new ul([aL.DateTime,aL.Dividends,aL.Earnings,aL.Splits,aL.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=ui(i[1]);t.addDataPoint(aL.DateTime,r),s(aL.Dividends,"Dividend",i[2],i[3]),s(aL.Earnings,"Earnings",i[2],i[3]),s(aL.Splits,"Split",i[2],i[3]),this.supplyCustomDemoData?s(aL.Custom,"Custom","Custom",tY.FAKE_CUSTOM_EVENT):s(aL.Custom,"Custom",i[2],i[3])}),t}makeUrl(){let e={};e.symbols=this.query.symbol,e.start="19700102",e.end="20501230",tY.EVENTS_BUILT_IN.forEach(t=>e[t]=this.query[t]);let t=eX(e);return`/queryevents.ashx?${t}`}async retrieve(){let e=this.makeUrl(),t=await Ab("timeseries",e);return this.parseEvents(t)}async ready(){return t$.call(this,async()=>(this.container=await this.retrieve(),this.isLoading=this.canLoadMoreData=!1,!0))}getCacheableEntities(e){e.add(this)}}class ht{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 ul(this.query.fields.concat(aL.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(aL.DateTime,ui(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===G.Quarter?"Quarter":"Annual";let t=eX(e),i=this.query.seriesKind===J.BalanceSheet?"getBalanceSheets":"getIncomeStatements";return`/${i}.json?${t}`}async retrieve(){let e=this.makeUrl(),t=await Ab("ondemand",e);return this.parseFundamental(t)}async ready(){return t$.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}function hi(e,t){let i=e.findIndex(e=>e>t);return Math.max(i<0?e.length:i,0)}class hs{records;streamingSubscription;setSymbols(e){let t=AM().getRecordSource();this.records=e.reduce((e,i)=>{let s=t.getRecord(i);return this.addFieldsToRecord(s,i),e[i]=s,e},{})}getStreamingSubscription(){return AM().getRecordSource().subject.pipe(oD(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}onStreamingUpdates(e){e.forEach(e=>{let t=e.data,i=this.records[t.symbol];eF(i)&&this.process(i)}),this.notifyAboutUpdates()}async retrieve(){let e=Object.values(this.records);return(await Promise.all(e.map(e=>e.ready()))).every(ep)&&(this.onRecordsReady(),e.forEach(e=>this.process(e)),this.streamingSubscription=this.getStreamingSubscription()),this.hasData}async ready(){return t$.call(this,async()=>await this.retrieve())}shutdown(){eF(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class hr extends hs{symbols=[];constructor(e){super(),this.symbols=e,this.setSymbols(e)}addFieldsToRecord(e,t){e.addFields(aL.Symbol),e.update(aL.Symbol,t)}notifyAboutUpdates(){eN(a_.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(aL.Close)}}class hn extends hs{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=[aL.DateTime,aL.Close,aL.Symbol]}addFieldsToRecord(e,t){e.addFields(aL.DateTime,aL.Symbol),e.update(aL.DateTime,tI(t)),e.update(aL.Symbol,t)}refresh(){}loadMoreData(e){throw Error("Should not be called.")}get hasData(){return null!==this.container&&this.container.size===this.dataPoints}notifyAboutUpdates(){eN(a_.TS_MANYCHANGED,{series:this,part:en.Unspecified})}onRecordsReady(){this.container=new ul(this.fields)}findOrAddIndex(e){let t=this.container.getData(aL.Symbol).indexOf(e.symbol);return t<0&&(t=hi(this.container.getData(aL.DateTime),tI(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(aL.Last)??i});if(!ey(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 ha{query;container;fields;canLoadMoreData=!1;isLoading=!1;constructor(e){this.query=e,this.fields=[aL.DateTime,aL.Close,aL.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(aL.DateTime),n=tI(t),a=hi(r,n);s(a,aL.DateTime,n),s(a,aL.Close,i),s(a,aL.Symbol,t)}parseHistoricalForward(e){let t=new ul(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=ed(uN(this.query.offset),lQ(tY.FMT_HIST_FEED_PARAM_DATE_ONLY))(new Date);let t=eX(e);return`/querylatesteod.ashx?${t}`}async retrieve(){let e=this.makeUrl(),t=await Ab("timeseries",e);return this.parseHistoricalForward(t)}async ready(){return t$.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}class ho extends u7{constructor(e){super(e)}getRetriever(){return new uw}onStreamingUpdates(e){}}class hl{cacheSeries;seriesCache;constructor(e=!1){this.cacheSeries=e,this.seriesCache=new Map}getTimeSeries(e){return eF(e.symbol)&&e.symbol===tY.PLACEHOLDER_SYMBOL_NAME?new u8(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 J.Normal:return new u7(e);case J.BalanceSheet:case J.IncomeStatement:return new ht(e);case J.Events:return new he(e);case J.Forward:return new hn(e);case J.HistoricalForward:return new ha(e);default:case J.Options:return new ho(e);case J.Study:throw Error(`The series kind '${J[e.seriesKind]}' is not supported yet.`)}}}var hu={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"}},hh={date:o1({formats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:o1({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:o1({formats:{full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},hc={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},hd={code:"fr",formatDistance:function(e,t,i){var s,r=hu[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:hh,formatRelative:function(e,t,i,s){return hc[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:o4({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:o4({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:o4({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:o4({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:o4({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:o6({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e)}}),era:o5({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:o5({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:o5({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:o5({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:o5({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 hp(e){return tt(1,arguments),ts(e).getDay()}function hf(e){tt(1,arguments);var t=ts(e);return t.setMinutes(0,0,0),t}function hm(e,t){tt(2,arguments);var i=hf(e),s=hf(t);return i.getTime()===s.getTime()}function hg(e){tt(1,arguments);var t=ts(e);return t.setSeconds(0,0),t}let hy=/{value:([^}]+)}/,hA=/%([aAdewbBmyYHkIlMpPSL])+/g;var hS=((I=hS||{})[I.Second=0]="Second",I[I.Minute=1]="Minute",I[I.Hour=2]="Hour",I[I.Day=3]="Day",I[I.Week=4]="Week",I[I.Month=5]="Month",I[I.Year=6]="Year",I);let hT={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]}},hv=new Map;function hP(e){if(!eF(e))return null;if(!hv.has(e)){var t;let i=eF(t=e)?t.replace(hy,(e,t)=>t.replace(hA,(e,t)=>tY.PHP_TO_UNICODE_TS_35_MAP[t])):t;hv.set(e,i)}return hv.get(e)}class hC{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=hP(i),this.prevDate=null}get noPrevDate(){return!eF(this.prevDate)}formatDate(e,t){return hk(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 hb="yyyy",hE="LLL ''yy",hL=()=>"fr"===hB()?"d LLL":"LLL d",h_="HH:mm";class hM extends hC{repeatEach;repeatCounter;constructor(e){super(e),this.repeatEach=tY.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(!nC(this.prevDate,e))return this.asTick(e,1,"EEE");if(!hm(this.prevDate,e))return this.asTick(e,2,h_);this.repeatCounter++;let t=this.repeatCounter===this.repeatEach;return!function(e,t){tt(2,arguments);var i=hg(e),s=hg(t);return i.getTime()===s.getTime()}(this.prevDate,e)||t?this.asTick(e,t?4:3,h_):null}}class hx extends hC{getTick(e){let t=this.checkPrev(e),i=0===this.minTickInterval||0==(e=>{let t=tl(e);return uB(e,t)})(e)%(this.minTickInterval/1e3),s=!nC(this.prevDate,e),r=function(e){return tt(1,arguments),ts(e).getMinutes()}(e),n=!hm(this.prevDate,e)||t&&0===r;if(i){if(s)return this.asTick(e,1,hL());if(n)return this.asTick(e,2,h_);if(0==r%30&&this.size<15)return this.asTick(e,3,h_);if(0==r%15&&this.size<=5)return this.asTick(e,4,h_)}return null}}class hI extends hC{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<22*hT.Day.One,this.monthYear=this.duration>22*hT.Day.One&&this.duration<7*hT.Month.One,this.year=this.duration>7*hT.Month.One}useTuesday(e){return!!this.noPrevDate||2===hp(e)&&uV(e,this.prevDate)>1728e5}getTick(e){this.checkPrev(e);let t=!nb(e,this.prevDate),i=!nI(e,this.prevDate);return this.monthDay?1===hp(e)||this.useTuesday(e)?this.asTick(e,1,hL()):null:this.monthYear?t?this.asTick(e,1,hE):null:this.year&&i?this.asTick(e,1,hb):null}}class hD extends hC{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<4*hT.Week.One,this.monthYear=this.duration>4*hT.Week.One&&this.duration<6*hT.Month.One,this.year=this.duration>6*hT.Month.One}getTick(e){this.checkPrev(e);let t=!nb(e,this.prevDate),i=!nI(e,this.prevDate);return this.monthDay?this.asTick(e,1,hL()):this.monthYear?t?this.asTick(e,1,hE):null:this.year&&i?this.asTick(e,1,hb):null}}class hO extends hC{showMonths;constructor(e){super(e),this.showMonths=this.duration<7*hT.Month.One}getTick(e){this.checkPrev(e);let t=!nI(e,this.prevDate);return this.showMonths?this.asTick(e,1,hE):t?this.asTick(e,1,hb):null}}class hw extends hC{constructor(e){super(e)}getTick(e){return this.checkPrev(e),nI(e,this.prevDate)?null:this.asTick(e,1,hb)}}function hR(e){return((e.valueOf()-tY.OPTIONS_DATA_BASE)/tY.OPTIONS_DATA_INCREMENT).toString()}function hN(e){return eF(e)?`${e.toFixed(2)}%`:""}function hV(e,t,i=!1){let s=e.plots[0],r=s.curves[0],n=eF(r)&&r.fields.length>0?r.fields[0]:null;if(!eF(n))return"";let a={range:e.fullDomain,allDigits:!1,forceTrailingZeros:i};return h5(s,e.pane.presenter,a),s.metaData.format(t,n,a)}function hH(e,t,i=!1){return e.comparison===q.Percent?hN(t):hV(e,t,i)}function hF(e,t,i){let s=e.view?.xAxis?.overrideFormatter;if(s)return s(t);if(eF(e.display.xAxis.isOrdinal))return hR(t);let r=i||e.display.xAxis.format;if(eF(r))return hk(t,hP(r));let n=e.data.aggregation,a=e.display?.xAxis?.nonEodLabelWithDate??!1;return n.isEndOfDay?hW(n,t):hU(n,t,a)}function hB(){let e=eG(AM().config,null,"overrides","xAxis","getLocaleName");if(eF(e)&&"function"==typeof e)try{return e()}catch(e){AP(`Failed retrieving the locale name, error is ${e.message}`,"warn")}}function hk(e,t){return ls(e,t,"fr"===hB()?{locale:hd}:void 0)}function hW(e,t){if(!ow(t))return"";switch(e.unit){case G.Tick:case G.Intraday:case G.Day:case G.Week:default:return hk(t,"P");case G.Month:return hk(t,"LLL yyyy");case G.Quarter:return hk(t,"qqq yyyy");case G.Year:return hk(t,"yyyy")}}function hU(e,t,i){return ow(t)?hk(t,`${i?"P ":""} ${e.isTick?"pp":"p"}`):""}let h$=(e,t)=>e.at(t);class hG{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+tY.TIMELINE_PROLOG_PADDING_BARS}get withPrologEpilogLength(){return this.withPrologLength+tY.TIMELINE_EPILOG_PADDING_BARS}get firstSeriesIndex(){return tY.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<tY.TIMELINE_PROLOG_PADDING_BARS){let t=eb(this._dates),i=e-tY.TIMELINE_PROLOG_PADDING_BARS;return this.applyDateShift(t,i)}if(e>=this.withPrologLength){let t=eC(this._dates),i=e-this.withPrologLength+1;return this.applyDateShift(t,i)}return this._dates[e-tY.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 G.Year:return tr(e,12*t);case G.Quarter:return tr(e,3*t);case G.Month:return tr(e,t);case G.Week:return lX(e,7*t);case G.Day:return this.addTradingDays(e,t);case G.Intraday:return oR(e,s*t*tY.ONE_MINUTE_MILLIS);case G.Tick:return oR(e,1e3*t)}}addTradingDays(e,t){if(this.presenter.display?.xAxis?.isOrdinal||!e||!Number.isFinite(t)||!Number.isInteger(t))return lX(e,t);let i=t>0?1:-1;if(0===t){let t=e.getDay();return 0===t?lX(e,1):6===t?lX(e,2):e}let s=Math.abs(t),r=e,n=r.getDay();if(i>0?0===n?(r=lX(r,1),s--):6===n&&(r=lX(r,2),s--):0===n?(r=lX(r,-2),s--):6===n&&(r=lX(r,-1),s--),s<=0)return r;let a=Math.trunc(s/5);a>0&&(r=lX(r,7*a*i),s-=5*a);let o=14;for(;s>0;){if(--o<0)return lX(e,t);0!==(n=(r=lX(r,i)).getDay())&&6!==n&&s--}return r}}let hz={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 hY(e){return!0===AM().config.useAllFieldsForComparison&&e.mainPlot.mainCurve.isOhlc&&e.mainAxis.comparison===q.None&&e.mainPane.axes.map(e=>e.plots).flat().reduce((e,t)=>e+ +!!t.isSymbol,0)>1}let hj=new nF;function hK({plots:e,isMultiSymbol:t,isMultiContract:i,date:s,time:r,dateFieldName:n,hideSymbols:a,revealingClose:o}){let l=a&&o,u=[hJ(n,s,null,"heading"),r?hJ("Time",r,null,"heading"):""].concat(e.map(e=>{if(0===e.values.length)return null;let s=(e=>{let s=e.name.startsWith(tY.FAKE_SYMBOL_PREFIX);switch(e.type){case Z.Expression:return!0;case Z.Symbol:if((t||i)&&!s)return!0;return!a;default:return!1}})(e)?hQ(Z[e.type],e.name,e.values[0].color):"",r=e.values.map(t=>hJ(t.id===aL.Close.id&&l?e.description:t.longName,t.value,t.color));if(e.events&&e.events.length){let t=e.events.map(e=>hQ(`${e.field.name} (${hW(hj,e.date)})`,e.value,e.color));r.push(...t)}return r.unshift(s),eF(e.unalignedDate)&&r.unshift(hJ("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 hq(e){return`bchart-icon-${e}`}function hX(e,t=null,i=10){let s=eF(t)?`style="fill:${t}"`:"",r=hq(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 hZ(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 hJ(e,t,i=null,s=[]){"string"==typeof s&&(s=s.split(" "));let r=["value-row",...s],n="string"==typeof i?` style="color: ${i}"`:"";return`
|
|
9
|
-
<tr class="${r.join(" ")}">
|
|
10
|
-
<td class="field-name">${e}</td>
|
|
11
|
-
<td${n} class="field-value">${t}</td>
|
|
12
|
-
</tr>
|
|
13
|
-
`}function hQ(e,t,i=null){return hJ(e,t,i,"value-title")}function h0(e,t,i){let s="string"==typeof i?` style="color: ${i}"`:"",r=eF(e)?`<span class="field-name">${e}</span>`:"";return`${r}<span${s} class="field-value">${t}</span>`}function h1(e){return`<a class="delete-plot" data-plot-id="${e}" title="Delete plot">${hX("delete")}</a>`}function h2(e,t,i,s,r,n){let a=function(e,t){let i=e.data.aggregation,s=e.display.xAxis,r=s.isOrdinal,n=eH(r)&&r,a=n?s.ordinalName??"Value":"Date";return{date:n?hR(t):hW(i,t),time:i.isEndOfDay||n?null:hU(i,t,!1),isMultiSymbol:function(e){let t=e.mainPlot.symbol;return e.allPlots.some(e=>e.type===Z.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:h3(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,Z.Expression;let o=r.axis.comparison!==q.None,l=r.axis.comparison===q.Percent,u=(e,s)=>r.customPlotValues&&s!==aL.DateTime?[r.getValueAt(s,t,i),0]:h4(e,s,t,o),h=n?`${sH(r.model.study).meta.title} ${r.fullParams}`:r.metaData.name||"",c={isMain:r.main,type:r.type,typeName:Z[r.type],name:r.title,description:h,exchange:r.metaData.exchange||"",error:r.errorText,id:r.id,visible:r.visible};eF(r.yearOffset)&&0!=r.yearOffset&&(c.unalignedDate=hW(e.data.aggregation,function(e,t){return tt(2,arguments),tn(e,-te(t))}(t,r.yearOffset)));let d=r.curves[0];s&&r.type===Z.Symbol&&a.hasField(aL.Symbol)&&(t.valueOf()===tY.ZERO_DATE.valueOf()?c.name=r.timeSeries.container?.getLastDataPoint(aL.Symbol):c.name=u(d,aL.Symbol)[0]);let p={},f={range:r.axis.yScale.domain(),allDigits:!0};h5(r,e,f);let m=(e,t)=>{let i=(t===aL.Change||t===aL.PercentChange)&&e>0?"+":"";return l?i+hN(e):i+r.metaData.format(e,t,f)},g=hY(e),y=new Set;return c.values=r.curves.filter(e=>e.visible).map(e=>(!r.main&&r.isSymbol&&g?ub: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!==$.HollowCandles,t),l=m(i,t).trim();if(eF(i)&&t===aL.Change){let[t]=u(e,aL.PercentChange);eF(t)&&(l+=` (${m(t,aL.PercentChange)})`)}return{abbreviation:h6(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,aL.DateTime)).filter(e=>e.field!==aL.Custom),c})(e,t,n,a,i)).filter(e=>null!==e)})),a}function h3(e){let t=e.getBounds();if(!eF(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 h4(e,t,i,s=!1){let r=e.plot,n=r.timeSeries.container,a=r.axis.pane.presenter.timeline,o=e_(a,+i,Number,h$),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 h5(e,t,i){eF(e.precision)?i.overridePrecision=e.precision:e.isStudy&&eF(t.mainPlot?.precision)&&!eF(sH(e.model.study).meta.decimals)&&(i.overridePrecision=t.mainPlot.precision)}function h6(e){return e.id===aL.Change.id?"Δ":e.id.substring(0,1)}class h7{plot;id;fields=[];colors=[];style=$.Line;attributes=[];zones;_shift=0;lineWidth=1;lineMarker;lineSmoothing;dashStyle="Solid";varyColorPerBar=!1;visible=!0;_zoneColors;constructor(){this.id=e1(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=eF(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(aL.Close)}get name(){return this.isOhlc?"":this.fields[0].name}get isHeikinAshiStyle(){return this.style===$.HeikinAshi}get isCandle(){return this.style===$.Candlestick||this.style===$.HollowCandles||this.style===$.HeikinAshi}get isHollowCandles(){return this.style===$.HollowCandles}get isElderImpulseSystemStyle(){return this.style===$.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===$.PercentChange}get isOhlcStyle(){return this.style===$.OHLC}get isHlcStyle(){return this.style===$.HLC}get isRangeStyle(){return this.style===$.Range}get isRenko(){return this.style===$.Renko}get isKagi(){return this.style===$.Kagi}get isPointAndFigure(){return this.style===$.PointAndFigure}get isLineBreak(){return this.style===$.LineBreak}get isBaseline(){return this.style===$.Baseline}get isLineLike(){return[$.Line,$.Area,$.Baseline,$.PercentChange].includes(this.style)}get isColumn(){return this.style===$.Column}get isMultiColumn(){return this.style===$.MultiColumn}get isStackedColumn(){return this.style===$.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=>aL[e]),this.style=$[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(q.None),r=e===aL.PercentChange,n=e===aL.Change,a=r||(!i||s)&&n,o=this.timeSeries.container.hasField(aL.Last)?aL.Last:aL.Close,l=a?o:e,u=(e,t)=>{let i=this.timeSeries.container.getData(e)[t];return e.type!==Y.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 eF(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(!eF(t))return null;let i=this.yScale.domain();return eF(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]=h4(this,this.pickMainField(),t);if(eF(s))e.save(),iw(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=ib(this.getColor(r)),e.beginPath(),cd(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=eF(this.zones);this.isOhlc?ch.call(this,e,l):this.isRenko||this.isLineBreak?cr.call(this,e,l):this.style===$.Ribbon?this.varyColorPerBar?cT.call(this,e,l):cS.call(this,e,l,this.colors[0]):this.style===$.Area?u?ct.call(this,e,l,h9,!0):h9.call(this,e,l,this.colors,!0):this.isColumn||this.isMultiColumn?u?ct.call(this,e,l,ca,!0):ca.call(this,e,{...l,range:[null,null]}):this.isStackedColumn?cn.call(this,e,l):this.isBaseline?cs.call(this,e,l):this.style===$.Step?u?ct.call(this,e,l,cl):cl.call(this,e,l,this.colors[0]):this.isKagi?cy.call(this,e,l):this.isPointAndFigure?cA.call(this,e,l):this.style===$.Dots?co.call(this,e,l):this.style===$.Line||this.isPercentChangeStyle?u?ct.call(this,e,l,cp):this.varyColorPerBar?cm.call(this,e,l):cp.call(this,e,l):AP(`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(aL.Last)?aL.Last:this.fields.includes(aL.Close)?aL.Close:this.fields[0]}get zoneColors(){if(!eF(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(aL.BARCOLIX))return null;let t=this.dataAt(aL.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(aL.Open,e),i=this.dataAt(aL.High,e),r=this.dataAt(aL.Low,e),n=this.dataAt(aL.Close,e),a=this.dataAt(aL.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=eF(i),a=eF(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===z.None||(s.open=this.dataAt(aL.Open,e),s.close=this.dataAt(aL.Close,e)),s.change=this.dataAt(aL.Change,e)}let r=function(e,{open:t,close:i,change:s},r){let n=r.length>2&&e!==$.HLC,a=eF(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 $.Candlestick:case $.Renko:case $.LineBreak:case $.Range:case $.HeikinAshi:case $.OHLC:case $.HLC:case $.Column:{if(eF(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(aL.Projection,e)&&(i=i_(.5,!0)(i));break}case $.ElderImpulseSystem:i=this.colors[this.dataAt(aL.BREL,e)];break;case $.HollowCandles:{let e=this.colors[r.isUpPrev||r.isSamePrev?1:0];i=t&&(r.isUp||r.isSame)?tY.COLOR_TRANSPARENT:e;break}case $.Line:case $.PercentChange:case $.Ribbon:case $.Kagi:if(eF(n)){i=n;break}i=this.colors[0];break;case $.PointAndFigure:{let t=+!!u3(this.dataAt(aL.BARKIND,e));i=this.colors[t];break}default:throw Error(`Unexpected style ${$[this.style]} for a curve with varying colors`)}return eF(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===$.Area?this.pickAreaStroke(s):s.length>0?s[0]:this.colors[0]}if((this.isMultiColumn||this.isStackedColumn)&&eF(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 h8([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 h9(e,t,i,s=!1){cp.call(this,e,t,this.pickAreaStroke(i)),cv.call(this,e,t,i[0],s)}function ce(e,t){let i,s,r=eF(e),n=eF(t),a=this.pane.getBounds();if(r)if(n){let r=this.priceToY(e),n=this.priceToY(t);i=(r+n)/2,s=new iR(a.x,n,a.width,r-n)}else i=this.priceToY(e),s=new iR(a.x,a.y,a.width,i-a.y);else i=this.priceToY(t),s=new iR(a.x,i,a.width,a.y+a.height-i);return[i,s]}function ct(e,t,i,s=!1,r){let n;this.zones.forEach((a,o)=>{let l=a.value,[u,h]=ce.call(this,n,l);e.save(),iw(e,h),s&&(t.range=[null,u]);let c=this.zoneColors[o];if(a.gradient){let t=((e,t)=>{let i=i_(.6)(e),s=iM(.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 eF(r)&&(c=r(o,c));i.call(this,e,t,c),e.restore(),n=l})}function ci(e,t){let{x:i,width:s}=this.pane.getBoundsWithoutScales();e.save(),e.lineWidth=1,e.strokeStyle="#888",e.setLineDash(iC("dot")),iK(e,t,i,i+s),e.restore()}function cs(e,t){let[i,s]=t.range,{baseLevel:r}=function(e){let{BaseLevel:t}=eK(e);return{baseLevel:Number.isFinite(t)?e2(0,100,t):50}}(this.plot.inputs),n=(i-s)*r/100+s;this.zones[0].value=this.yToPrice(n),ci.call(this,e,n),ct.call(this,e,t,h9,!0,(t,r)=>{let a=iE(r,0),o=e.createLinearGradient(0,1===t?i:s,0,n);return o.addColorStop(0,r),o.addColorStop(1,a),[o,iE(r,1)]})}function cr(e,{bar:t,slice:i,start:s}){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;h8.call(this,i,s,(i,s)=>{if(!s){let[s,n]=[aL.Open,aL.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 cn(e,{bar:t,slice:i,start:s}){if(!this.isFirstVisibleOfStyle())return!1;let r=this.view.xAxis.xScale.range()[0]+t.offset,n=iJ();n.prolog(e);let a=this.plot.curves.filter(e=>e.isStackedColumn);h8.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(eF(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 ca(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=iJ();h.prolog(e),h8.call(this,i,s,(i,s)=>{s||l.forEach((t,s)=>{let r=this.dataAt(t,i);if(eF(r)){eF(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 co(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||tY.CURVE_STYLE_DOTS_RADIUS),a=2*Math.PI;e.beginPath(),h8.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eF(s)){let t=this.priceToY(s);e.moveTo(r+n,t),e.arc(r,t,n,0,a)}}r+=t.totalWidth}),e.fill()}function cl(e,{bar:t,slice:i,start:s},r){let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,a=iJ();a.prolog(e),e.strokeStyle=r,e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(iC(this.dashStyle)),e.beginPath();let o=!1,l=null;h8.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eF(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(eF(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 cu=[aL.Open,aL.High,aL.Low,aL.Close];function ch(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=iJ();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===ix(l).a?u:l,cc(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(),cc(e,u,h,t,a,n,p)}(e,t,this.lineWidth,!this.isHlcStyle)};h8.call(this,i,s,(e,i)=>{if(!i){let i=cu.map(t=>this.dataAt(t,e)),[s,r,d,p]=i;if(eF(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);(!eF(o)||m<o)&&(o=m,u=f),(!eF(l)||g>l)&&(l=g,h=f),c(f)}}n+=t.totalWidth}),r&&(eF(u)&&(u.isMin=!0,c(u)),eF(h)&&(h.isMax=!0,c(h))),a.epilog(e)}function cc(e,t,i,s,r,n,a,o=3){t&&iz(e,{x:s,y:r+o},a,0,Math.PI),i&&iz(e,{x:s,y:n-o},a,0,Math.PI,!0)}function cd(e,t,i,s,r=1){let n=tY.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 cp(e,{bar:t,slice:i,start:s},r=null){let n=r||this.getColor(0),a=eH(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();h8.call(this,i,s,(i,s)=>{if(!s){let t=this.dataAt(u,i);if(eF(t)){let i=this.priceToY(t);a&&cd(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(iC(this.dashStyle)),eH(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):cf(e,l,n)}function cf(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 cm(e,{bar:t,slice:i,start:s}){e.lineWidth=this.lineWidth,e.lineCap="square",this.dashStyle&&e.setLineDash(iC(this.dashStyle));let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,n=null,a=null,o=[];h8.call(this,i,s,(i,s)=>{if(!s){let t=this.pickMainField(),s=this.dataAt(t,i);if(eF(s)){let t=this.priceToY(s);a=this.getColor(i),n!==a&&(cf(e,o,n),o.length>0&&(o=[o.pop()]),n=a),o.push({x:r,y:t})}}r+=t.totalWidth}),cf(e,o,a)}let cg=[null,null,null,null];function cy(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=iJ();n.prolog(e);let a=null,o=null,l=[];h8.call(this,i,s,(i,s)=>{if(!s){let s=e=>cu.map(t=>this.dataAt(t,e)),[u,h,c,d]=s(i),[,p,f]=i<0?cg:s(i-1);if(eF(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 A=eF(a)&&a!==o,S=u===h?1:2,T=u===h?2:1;l.push({x:m,y:g[0]}),l.push({x:s,y:g[S]}),A&&(l.push({x:s,y:y}),cf(e,l,a),l=[]),A&&l.push({x:s,y:y}),l.push({x:s,y:g[T]}),a=o}}r+=t.totalWidth}),cf(e,l,o),n.epilog(e)}function cA(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=iJ();o.prolog(e);let l=this.plot.timeSeries.builder.boxSize,u=l/2;h8.call(this,i,s,(i,s)=>{if(!s){let[t,s]=[aL.High,aL.Low].map(e=>this.dataAt(e,i)),r=this.colors[0],h=this.colors[1],c=this.dataAt(aL.BARKIND,i),d=u3(c),p=c===tY.BARKIND_XO,f=c===tY.BARKIND_OX;if(eF(t,s))for(let i=t;i>=s;i-=l){let l=o.adjust(a),[c,m]=[l-n,l+n],[g,y,A]=[i,i-u,i+u].map(e=>this.priceToY(e)),S=i===t&&p||i===s&&f?!d:d;e.beginPath(),S?(e.strokeStyle=h,e.moveTo(c,y),e.lineTo(m,A),e.moveTo(c,A),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 cS(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(h8.call(this,i,s,(e,i)=>{if(!i){let t=this.dataAt(n,e),i=this.dataAt(a,e);eF(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 cT(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;h8.call(this,i,s,(e,i)=>{if(!i){let t=this.dataAt(r,e),i=this.dataAt(n,e);if(eF(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 cv(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,iE(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;h8.call(this,i,s,(i,s)=>{if(!s){let t=this.dataAt(u,i);if(eF(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 cP{symbol;aggregation;range;seriesKind;cacheMe;barsToFetch;offset;chartId;curveStyle;extendedHours;fields=[];alwaysUseBarsToFetch;inputs=[];splits;padded;constructor(e,t,i=J.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(!eF(this.curveStyle)||!tY.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return"Standard";switch(this.curveStyle){case $.Renko:{let{method:e,period:t,source:i,brickSize:s}=ud(this.inputs),r="ATR"===e?`ATR;${t}`:`${e};${s}`;return`Renko;${r};${i}`}case $.Kagi:{let{method:e,period:t,reversal:i}=uZ(this.inputs),s="ATR"===e?`ATR;${t}`:`User;${i}`;return`Kagi;${s}`}case $.PointAndFigure:{let{method:e,period:t,reversal:i,boxSize:s,source:r,oneStepBack:n}=u4(this.inputs),a="ATR"===e?`ATR;${t}`:`User;${s}`;return`PointAndFigure;${a};${r};${i};${n}`}case $.LineBreak:{let{lineBreak:e}=uQ(this.inputs);return`LineBreak;${e}`}default:return $[this.curveStyle]}}get needsExtraKey(){return[J.Options,J.BalanceSheet,J.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 cP(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=ez(this.fields),e.splits=this.splits,e.padded=this.padded,e}}var cC=N("c15IW");function cb(e,t){let i=e.query?.duplicate();if(!eF(i)||i.symbol===tY.PLACEHOLDER_SYMBOL_NAME||"Standard"!==i.getBuilderKey())return new u8;{0!==i.barsToFetch&&(i.barsToFetch=i.barsToFetch*tY.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);let e=t(i);return e.serverComputedSeries=!0,e}}function cE(e){return new aC(e,Y.Number,K.Study,e)}class cL{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=e1(),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){ej(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 tY.EMPTY_ARRAY}get hasData(){return null!==this.container}get source(){if(eF(this._source))return this._source;let e=eF(this.inputs)?this.inputs[tY.INPUT_SOURCE]:null;return eF(e)?aL[e]:null}set source(e){this._source=e}async ready(){return t$.call(this,async()=>{this.basisChangedToken=this.useNotifications?e(cC).subscribe(a_.TS_ALL,this.onBasisChanged.bind(this)):null;let t={tag:e1(),src:null},i=(await Promise.all(this.innerSeries.map(e=>e.ready()))).every(ep);return i&&this.calculate(t),i})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===a_.TS_EVENTSCHANGED||e===a_.TS_LOADING||this.innerSeries.some(e=>!e.hasData)||!this.shouldTriggerOurRecalc(t.series)||null===this.base||this===t.series)return;let i={tag:e1(),src:t.series};switch(e){case a_.TS_MANYCHANGED:this.calculate(i);break;case a_.TS_DATAPOINTCHANGED:case a_.TS_DATAPOINTADDED:{let s=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(i,s,e===a_.TS_DATAPOINTADDED);break}case a_.TS_TIMELINECORRECTION:case a_.TS_QUOTEMARKER:break;default:throw Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.useNotifications&&this.basisChangedToken&&e(cC).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){eN(e,{series:this,index:t})}calculateCommon(e,t=null,i=-1,s=!0){let r=-1===i,n=r?t=>{(eF(e.src)||!eF(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&&(eF(e.src)||this.initialNotification)&&this.notify(t,i)}calculate(e){this.calculateCommon(e,a_.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,i){this.computedServerSide||(!i&&eH(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,i?a_.TS_DATAPOINTADDED:a_.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 eF(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(aL.DateTime,aL.Symbol)}makeContainer(){let e=this.defaultWrappers.concat(this.getWrappers());return new uh(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 c_ extends cL{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 cM extends c_{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){let[t,i,s,r]=[aL.Open,aL.High,aL.Low,aL.Close].map(t=>this.baseVal(t,e),this),n=null,a=null,o=null,l=null,u=eg([t,i,s,r]);if(e<1)n=eg([t,r]),a=i,o=s,l=0;else{let[t,r]=[aL.Open,aL.Close].map(t=>this.container.getData(t)[e-1],this);a=Math.max(i,n=eg([t,r]),u),o=Math.min(s,n,u),l=u-r}return{[aL.Open.id]:n,[aL.High.id]:a,[aL.Low.id]:o,[aL.Close.id]:u,[aL.Change.id]:l}}getWrappers(){return this.wrapBaseFields(aL.Volume,aL.OpenInterest,aL.TradingDay)}}class cx extends cL{constructor(e,t){super(e,t),f4(this)}calculateAt(e){let t=null,i=this.period,[,s]=f5(this);if(this.atLeast(e,i)&&s.hasField(this.source)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=eg(r.filter(ef)):ey(r)&&(t=eg(r))}return{[this.target.id]:t}}getWrappers(){return this.source===aL.Volume?this.wrapBaseFields(aL.Volume,aL.TradeSize,aL.Change,aL.Open,aL.Close):[]}}class cI extends cL{multiplier;constructor(e,t,i){super(e,t),this.multiplier=i(this.period),f4(this)}calculateAt(e){let t=null,[i,s]=f5(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=eg(r.filter(ef)):ey(r)&&(t=eg(r))}}}return{[this.target.id]:t}}}class cD extends cL{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=aL.OpenInterest;return this.base.hasField(i)&&(t=this.baseVal(i,e)),{[i.id]:t}}}let cO={inField:aL.MA,outFields:[aL.ENVU,aL.ENVD],func:fF},cw={inField:aL.EMA,outFields:[aL.ENVEXPU,aL.ENVEXPD],func:fB},cR={inField:aL.SMA,outFields:[aL.ENVSMOU,aL.ENVSMOD],func:fk};class cN extends cL{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 cV extends cL{constructor(e,t){super(e,t);let i=fF(t,this.inputs.Period1,this.source),s=fF(t,this.inputs.Period2,this.source),r=f1(this.target,(e,t,i)=>t-i,i,s);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}}let cH={fields:[aL.MACD,aL.MACDS,aL.MACDH],avgFunc:fF,mapFunc:f2,histogramVaryColor:!0},cF={fields:[aL.MACD,aL.MACDS,aL.MACDH],avgFunc:fB,mapFunc:f2,histogramVaryColor:!0},cB={fields:[aL.MACD,aL.CTLTM,aL.CTM],avgFunc:fB,mapFunc:f2,histogramVaryColor:!1},ck={fields:[aL.MACD,aL.CTLTMF,aL.CPMI],avgFunc:fB,mapFunc:f2,histogramVaryColor:!1},cW={fields:[aL.PPO,aL.PPOS,aL.PPOH],avgFunc:fB,mapFunc:f3,histogramVaryColor:!0},cU={fields:[aL.PVO,aL.PVOS,aL.PVOH],avgFunc:fB,mapFunc:f3,histogramVaryColor:!1};class c$ extends cL{histogramVaryColor=!1;histogramField;get helpers(){return[aL.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(eF(i,s)){let r=i<=0;t=r?1:3,e>0&&(r&&i>s&&(t=0),!r&&i<s&&(t=2))}}return{[aL.BARCOLIX.id]:t}}}class cG extends c${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=f1(this.fields[0],t.mapFunc,s,r),a=t.avgFunc(n,e.inputs.Period3,n.target,this.fields[1]),o=f1(this.fields[2],f2,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 cz=cE("_AVG_GAIN"),cY=cE("_AVG_LOSS");class cj extends cL{constructor(e,t,i){super(e,i);let s=fX(i,this.inputs.Period,this.source,aL.RSI,t),r=f9(e,"MA","Average")(s,this.inputs.PeriodAvg,aL.RSI,aL.RSIAVG);this.addInner(s,r)}getWrappers(){return[this.wrapInner(aL.RSI,1),this.wrapInner(aL.RSIAVG,2)]}}class cK extends cL{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);ey(s)&&(t=this.highest?Math.max(...s):Math.min(...s),this.index&&(t=i-s.indexOf(t)-1))}return{[this.target.id]:t}}}class cq extends cL{toHighest;field;highField;lowField;constructor(e,t,i){super(e,i),this.toHighest=t;let s=eF(e.source),r=e.source,n=s?r:aL.Close;this.field=n;let a=s?r:aL.High;this.highField=a;let o=s?r:aL.Low;this.lowField=o;let l=f$(i,e.inputs.Period,this.highField,aL.HH,!0),u=f$(i,e.inputs.Period,this.lowField,aL.LL,!1);this.addInner(l,u)}calculateAt(e){let t=null,i=this.baseVal(this.field,e),s=this.innVal(1,aL.HH,e),r=this.innVal(2,aL.LL,e);if(ey([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=cE("RawPercK");class cZ extends cL{kField;constructor(e,t,i,s){super(e,s);let r=fG(s,this.inputs.Period1,t?cX:i,!1),n=f9(e,"MA"),a=n(r,this.inputs.Period2,r.target,t?i:aL.PercD),o=t?n(a,this.inputs.Period3,a.target,aL.PercD):a;this.kField=i,t?this.addInner(a,o):this.addInner(r,a)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(aL.PercD,2)]}}function cJ(e,t,i,s,r){if(null===r)return null;let n=e*r,a=s+n,o=s-n;switch(t){case aL.BOLLBU:return a;case aL.BOLLBL:return o;case aL.BOLLBW:return(a-o)/s*100;default:return null}}class cQ extends cL{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=this.inputs.Period,r=this.source,n=fF(i,s,r,aL.BOLLBM),a="Modified"===t,o=fJ(a?function(e,t,i=aL.PCTCHG){return fN("PCTCHG",{source:t,target:i,inputs:fz},e)}(i,r):i,s,a?aL.PCTCHG:r),l=this.inputs.Width,u=e=>ec(cJ,l,e),h=f1(aL.BOLLBU,u(aL.BOLLBU),n,o),c=f1(aL.BOLLBL,u(aL.BOLLBL),n,o),d=f1(aL.BOLLBW,u(aL.BOLLBW),n,o),p=f9(e,"MA","Average")(d,this.inputs.PeriodAvg,aL.BOLLBW,aL.BOLLBWA);this.addInner(n,o,h,c,d,p)}calculateAt(e){let t=this.innVal(3,aL.BOLLBU,e),i=this.innVal(4,aL.BOLLBL,e),s=this.innVal(1,aL.BOLLBM,e),r=this.innVal(5,aL.BOLLBW,e),n=this.innVal(6,aL.BOLLBWA,e),a=null;switch(eF(t,i)&&(a=(this.baseVal(aL.Close,e)-i)/(t-i)),this.kind){case"Regular":return{[aL.BOLLBU.id]:t,[aL.BOLLBL.id]:i,[aL.BOLLBM.id]:s};case"Width":return{[aL.BOLLW.id]:t-i};case"Percent":return{[aL.BOLLP.id]:a};case"BandWidth":return{[aL.BOLLBW.id]:r,[aL.BOLLBWA.id]:n};case"Modified":{let t=null,i=null,r=null,n=null,a=this.innVal(2,aL.MSD,e);if(eF(a)){let e=this.inputs.MultInside,o=this.inputs.MultOutside;t=s+e*a,r=s-e*a,i=s+o*a,n=s-o*a}return{[aL.MBBUI.id]:t,[aL.MBBLI.id]:r,[aL.MBBUO.id]:i,[aL.MBBLO.id]:n,[aL.MBBM.id]:s}}default:return null}}}let c0=cE("_ABS_CHG"),c1=cE("_MA_ABS_CHG"),c2=cE("_CHG"),c3=cE("_PDM"),c4=cE("_MDM"),c5=cE("_TRS"),c6=cE("_PDS"),c7=cE("_MDS"),c8=cE("_DX");class c9 extends cL{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=fY(s,aL.TR);this.addInner(r)}get helpers(){return[c3,c4,c5,c6,c7,c8]}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),ey(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,aL.High),c=this.past(e,2,aL.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(aL.TR)[e];r=this.smooth1(e,c3,c6,t),n=this.smooth1(e,c4,c7,i),s=this.smooth1(e,aL.TR,c5,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,c8,this.adxField,l))}return{[c3.id]:t,[c4.id]:i,[c5.id]:s,[c6.id]:r,[c7.id]:n,[aL.PDI.id]:a,[aL.MDI.id]:o,[c8.id]:l,[this.adxField.id]:u}}getWrappers(){return[this.wrapInner(aL.TR,1)]}}class de extends cL{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 eF(s)||(s=t.container.hasField(aL.Close)?aL.Close:t.container.fields[0]),this.innVal(i,s,e)}),i=null;return ey(t)&&(i=this.calculateAtFunc(e,...t)),{[this.target.id]:i}}}function dt(e,t){let i=this.baseVal(aL.High,t),s=this.baseVal(aL.Low,t);return{[e.id]:(i+s)/2}}function di(e,t){let i=this.baseVal(aL.High,t),s=this.baseVal(aL.Low,t);return{[e.id]:i-s}}class ds extends cL{calculateAtFunc;constructor(e,t,i){super(e,i),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}}let dr=cE("_RANGE"),dn=cE("_MOV_RANGE"),da={fields:[aL.KCUP,aL.KCLOW,aL.KCMID],midSeries:e=>fK(e,aL.TP),midTarget:aL.TP,rangeSeries:e=>f0(dr,eh(di,dr),e),rangeTarget:dr,func:"MA",useMultiplier:!1},dl={fields:[aL.KBUP,aL.KBLOW,aL.KBMID],midSeries:e=>e,midTarget:aL.Close,rangeSeries:e=>fY(e,aL.TR),rangeTarget:aL.TR,func:"EMA",useMultiplier:!0};class du extends cL{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=t.midSeries(i),r=f9(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,dn);this.addInner(n,a)}calculateAt(e){let t=this.innVal(1,this.kind.fields[2],e),i=this.innVal(2,dn,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 dh extends cL{isWidth;constructor(e,t,i){super(e,i),this.isWidth=t;let s=f$(i,this.inputs.Period,aL.High,aL.DONUP,!0),r=f$(i,this.inputs.Period,aL.Low,aL.DONLOW,!1);this.addInner(s,r)}calculateAt(e){let t=this.innVal(1,aL.DONUP,e),i=this.innVal(2,aL.DONLOW,e),s=null===t&&null===i;return this.isWidth?{[aL.DONW.id]:s?null:t-i}:{[aL.DONMID.id]:s?null:(t+i)/2}}getWrappers(){return[this.wrapInner(aL.DONUP,1),this.wrapInner(aL.DONLOW,2)]}}let dc=cE("_HIND"),dd=cE("_LIND");class dp extends cL{justWidth;constructor(e,t,i){super(e,i),this.justWidth=t,this.justWidth=t;let s=this.inputs.Period,r=f$(i,s,aL.High,dc,!0,!0),n=f$(i,s,aL.Low,dd,!1,!0);this.addInner(r,n)}calculateAt(e){let t=null,i=null,s=null,r=this.innVal(1,dc,e),n=this.innVal(2,dd,e);if(null!==r&&null!==n){let e=this.period;s=(t=(e-r)/e*100)-(i=(e-n)/e*100)}return this.justWidth?{[aL.ARNOSC.id]:s}:{[aL.ARNUP.id]:t,[aL.ARNLOW.id]:i}}}let df=cE("_MIDPOINT"),dm=cE("_MIDPOINT");class dg extends cL{multiplyVol;constructor(e,t,i){super(e,i),this.multiplyVol=t}calculateAt(e){let[t,i,s,r]=[aL.High,aL.Low,aL.Close,aL.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 dy=cE("_RANGE"),dA=cE("_MATP");class dS extends cL{isBull;constructor(e,t,i){super(e,i),this.isBull=t;let s=fB(i,this.inputs.Period,this.source);this.addInner(s)}calculateAt(e){let t=null,i=this.innVal(1,aL.EMA,e);return null!==i&&(t=this.isBull?this.baseVal(aL.High,e)-i:this.baseVal(aL.Low,e)-i),{[this.isBull?aL.ERBLPOW.id:aL.ERBRPOW.id]:t}}}let dT=cE("_FORCE"),dv=cE("_RANGE"),dP=cE("_EMA1"),dC=cE("_EMA2"),db=cE("_RATIO"),dE={isNegative:!1,fields:[aL.PVI,aL.PVIEMA]},dL={isNegative:!0,fields:[aL.NVI,aL.NVIEMA]};class d_ extends cL{kind;constructor(e,t,i){super(e,i),this.kind=t;let s=f0(this.kind.fields[0],eh(function(e,t){let i=1e3;if(t>0){let s=[aL.Close,aL.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=fB(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 dM=cE("_LOGPC"),dx=cE("_SWING_INDEX"),dI=cE("_MIN_CLOSE"),dD=cE("_MAX_CLOSE"),dO=cE("_EP"),dw=cE("_AF"),dR=cE("_POS"),dN=cE("_IDY"),dV=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],dH=e=>Array(e).fill(0);function dF(e,t,i){let s=e[i-1];return 0===t&&(s=e[i]),t<0&&(s=e[i+1]),s}function dB(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 dk={1:{param:"cot",func:"parseCotLineChart",fields:[aL.DateTime,aL.COTLCCMSP,aL.COTLCLGSP,aL.COTLCSMSP]},2:{param:"cotadv",func:"parseDisaggregated",fields:[aL.DateTime,aL.COTDAGPRO,aL.COTDAGSPD,aL.COTDAGMNM,aL.COTDAGOTH]},3:{param:"cotfin",func:"parseFinancialTradersReport",fields:[aL.DateTime,aL.COTFTRDLI,aL.COTFTRASM,aL.COTFTRLVF,aL.COTFTROTH]}};class dW extends cL{wrappers;constructor(e,t,i){super(e,cb(i,e=>new dU(t,e))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=dk[t].fields.slice(1).map(e=>this.wrapInner(e,0))}getWrappers(){return this.wrappers}}class dU extends u7{kind;constructor(e,t){super(t),this.kind=e}getRetriever(){return new d$(this.kind)}onStreamingUpdates(e){}}class d$ extends ux{kind;constructor(e){super(),this.kind=e}addExtraParams(e){e[dk[this.kind].param]="y"}getParser(e){return new dG(e.symbol,e.aggregation,this.kind)}}class dG extends uL{kind;constructor(e,t,i){super(e,t,0),this.kind=i}makeContainer(){return new ul(dk[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[dk[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(aL.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aL.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(aL.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(aL.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(aL.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aL.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(aL.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(aL.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(aL.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(aL.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aL.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(aL.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(aL.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(aL.COTFTROTH,parseInt(e[5]))}}class dz extends dW{constructor(e,t){super(e,1,t)}}let dY={Day:[aL.PreviousHigh,aL.PreviousLow,aL.PreviousClose],Week:[aL.WeekPreviousHigh,aL.WeekPreviousLow,aL.WeekPreviousClose],Month:[aL.MonthPreviousHigh,aL.MonthPreviousLow,aL.MonthPreviousClose]};class dj extends cL{disabled;record;streamingSubscription;constructor(e,t,i){if(super(e,i),this.disabled=!eF(i.query)||!eF(i.query.symbol),!this.disabled){let e=i.query.symbol;e.endsWith(".BZ")&&(e=e.slice(0,-3)),this.record=AM().getRecordSource().getRecord(e),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()}this.initialNotification=!0}getStreamingSubscription(){return AM().getRecordSource().subject.pipe(uR(e=>{let t=aG(a_.RT_QUOTE,this.record.symbol);return e.filter(t)}),oD(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return t$.call(this,async()=>eF(this.record)?await this.record.ready()&&await super.ready():await super.ready(),"asyncReadyWork2")}onStreamingUpdates(e){if(this.record){let e={tag:e1(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return dY[e].map(e=>this.record.getValue(e))}}class dK extends u7{constructor(e){super(e)}getRetriever(){return tg(this.query.symbol)?new dJ:new dq}onStreamingUpdates(e){}}class dq extends ux{addExtraParams(e){e.impl="y"}getParser(e){return new dZ(e.symbol,e.aggregation)}}function dX(){return new ul([aL.DateTime,aL.IMPVOL])}class dZ extends uL{constructor(e,t){super(e,t)}makeContainer(){return dX()}getParseFunc(){return this.parseImpVol}parseImpVol(e){this.aggregation.isEndOfDay&&!(e.length<9)&&(this.container.addDataPoint(aL.DateTime,this.parseDate(e[1])),this.container.addDataPoint(aL.IMPVOL,parseFloat(e[8])))}}class dJ extends uI{emptyContainer(e,t){return dX()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(aL.DateTime,ui(e.date.substring(0,10)));let s=eH(e.impliedVolatility);i.addDataPoint(aL.IMPVOL,s?100*e.impliedVolatility:null)}}let dQ=cE("_ABS_CHG"),d0=cE("_DS1_EMA1"),d1=cE("_DS1_EMA2"),d2=cE("_DS2_EMA1"),d3=cE("_DS2_EMA2"),d4=cE("_DIFF"),d5=cE("_SUM"),d6=cE("_ABS_CHG"),d7=cE("_HH_LL"),d8=cE("_MULMA");class d9 extends c_{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=[aL.Open,aL.High,aL.Low,aL.Close],r=s.map(t=>i(t,e));if(ey(r)){let n=s.map(t=>i(t,e-1));if(ey(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(aL.Close)[e-1];t[4]=t[3]-i}}}}return{[aL.Open.id]:t[0],[aL.High.id]:t[1],[aL.Low.id]:t[2],[aL.Close.id]:t[3],[aL.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(aL.Volume,aL.OpenInterest,aL.TradingDay)}}let pe=cE("_DIST"),pt=cE("_EMA_DIST1"),pi=cE("_EMA_DIST2"),ps=cE("_DIFF"),pr=cE("_EMA_DIFF1"),pn=cE("_EMA_DIFF2"),pa=cE("_CHG"),po=cE("_M1"),pl=cE("_M2");class pu extends cL{constructor(e,t){super(e,t);let i=f0(pa,function(e){let t=aL.Close,i=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[pa.id]:i}},t),s=f1(po,(e,t)=>t>=0?t:0,i),r=f1(pl,(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,po,this.innCont(1)),r=this.past(e,i,pl,this.innCont(2));if(ey(s)&&ey(r)){let e=em(s),i=em(r);t=this.perc(e-i,e+i)}}return{[aL.CHDMOMOSC.id]:t}}}let ph=cE("_MAX"),pc=cE("_MIN"),pd=cE("_ISUPTREND"),pp=cE("_TRENDUP"),pf=cE("_TRENDDOWN"),pm=cE("_TREND"),pg=cE("_CUM_PRICE"),py=cE("_CUM_VOL"),pA=cE("_PER_CHG");class pS extends cL{constructor(e,t){super(e,t);let i=this.source,s=f0(i,eh(f6,i),t);this.addInner(s)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}}let pT=cE("_DIFF"),pv=[pT,aL.Buy,aL.Sell];function pP(e,t,i,s){let r=null,n=null,a=null;eF(i,s)&&(a=i-s);let o=t>0?e.getData(pT)[t-1]:null;return eF(a,o)&&(r=a>0&&o<=0?1:null,n=a<0&&o>=0?-1:null),{[pT.id]:a,[aL.Buy.id]:r,[aL.Sell.id]:n}}let pC=cE("_PVM"),pb=cE("_NVM");var cC=N("c15IW");function pE(e,t,i){return new pL(e,t,i)}class pL{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=n8(e),this.valueSymbols=this.exprSymbols.filter(e=>void 0===this.innerLookup[e]),this.onlyForTimeline=ev(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!eF(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 t$.call(this,async()=>{this.basisChangedToken=e(cC).subscribe(a_.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=e(cC).subscribe(a_.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(ep);return i&&this.calculate(),i})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every(e=>eF(e.container))&&this.calculateCommon(a_.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===B.Manual||e===a_.TS_EVENTSCHANGED||e===a_.TS_LOADING||!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some(e=>!eF(e.container)))return;let i=this.policy.mapper(t.series);if(!(e===a_.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(i)))switch(this.policy.recompute===B.Everything?a_.TS_MANYCHANGED:e){case a_.TS_MANYCHANGED:this.calculate();break;case a_.TS_DATAPOINTCHANGED:case a_.TS_DATAPOINTADDED:this.recalculate(e===a_.TS_DATAPOINTADDED);break;case a_.TS_TIMELINECORRECTION:case a_.TS_QUOTEMARKER:break;default:throw Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.basisChangedToken&&e(cC).unsubscribe(this.basisChangedToken),this.quoteGroupToken&&(e(cC).unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map((t,i)=>t===aL.Volume?em(this.exprSymbols.map(t=>e.inn[t].values[i]??0)):n5(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===aL.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];eF(s,r)&&e.setLastDataPoint(aL.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(aL.Change,null),this.container.addDataPoint(aL.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){eN(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,aL.DateTime)}timeline(e){return e.container.getData(aL.DateTime)}getRangeHelper(){switch(this.policy.missing){case F.UseNext:case F.UseNone:return Math.min;case F.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=>eb(this.timeline(this.innerLookup[e]))))),end:new Date(e(...this.symbols.map(e=>eC(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 F.UseNext:case F.UseNone:return i.findIndex(e=>e.valueOf()>=t.valueOf());case F.UsePrevious:return eE(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=>!eF(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===F.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 eF(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(;eF(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===F.UsePrevious?this.getInner(e).forEach(t=>{let i=eF(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===F.UseNone&&this.getInner(e).forEach(t=>this.fillPosSymbolAt(t,t.index,e))))}shouldAdd(e){return this.container.getLastDataPoint(aL.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||(AP(e,"error"),this.crashedComputationReported=!0)}}calculate(){let{yes:e,no:t}=eS(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(a_.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;let t=this.getLastPos(),i=this.shouldAdd(t);this.calculateCommon(i?a_.TS_DATAPOINTADDED:a_.TS_DATAPOINTCHANGED,t,i)}recalculateAt(e,t,i){return this.recalculate(i)}makeContainer(){return new ul([aL.DateTime,aL.Change].concat(this.targetFields))}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}}let p_=cE("_AVG"),pM=cE("_HAO"),px=cE("_HAH"),pI=cE("_HAL"),pD=cE("_HAC"),pO=cE("_DELTA"),pw=cE("_DIFF"),pR=cE("_RANK"),pN=cE("_CHG"),pV=cE("_AVG"),pH=cE("_HBRAKE_CHG"),pF=cE("_HEIGHT_DELTA"),pB=cE("_ACTION"),pk=cE("_REVERSAL"),pW=e=>[e>0,e<0],pU=[null,null,null];function p$([e,t],i){let s=null;if(i>0){let t=this.baseVal(e,i-1);eF(t)&&(s=this.baseVal(e,i)-t)}return{[t.id]:s}}class pG extends cL{useHandbrake;constructor(e,t){super(e,t);let i=f9(e,"MA","Average"),s=i(t,e2(1,999,this.inputs.FastPeriod),aL.Close),r=e2(0,999,this.inputs.SlowPeriod),n=r>0,a=n?i(t,r,aL.Close):t,o=f1(pw,n?(e,t,i)=>t-i:(e,t,i)=>i-t,s,a),l=f0(pN,eh(p$,[aL.Close,pN]),t),u=f0(pR,function(e){let t=Math.abs(this.baseVal(pw,e)),i=null,s=0,r=0;for(let i=e-1;i>=0&&s<200;--i){let e=Math.abs(this.baseVal(pw,i));s++,e<t&&r++}return s>0&&(i=Math.floor(r/s*10)),10===i&&i--,{[pR.id]:i}},o),h=e2(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=h>0;let c=i(t,h,aL.Close,pV),d=f0(pH,eh(p$,[pV,pH]),c);this.addInner(l,o,u,d)}get helpers(){return[pF,aL.BARCOLIX,pB,pk]}getStateAt(e){let t=this.innVal(2,pw,e);return eF(t)?pW(t):pU}findPreviousKnownState(e){for(let t=e-1;t>0;t--){let e=this.getStateAt(t);if(e===pU)break;let[i,s]=e;if(i||s)return e}return pU}getBuySell(e){let t=this.getStateAt(e);if(t===pU)return pU;let[i,s]=t,r=this.findPreviousKnownState(e),[n,a]=r;if(!i&&!s)return r===pU?pU:[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]=[pk,pB].map(t=>this.getPrev(t,e)),[c,d]=[0,-1].map(t=>this.innVal(4,pH,e+t));if(r=l?10:this.innVal(3,pR,e),this.useHandbrake&&eF(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,pR,e),n=2):(r=i?11:13,n=1))}if(eF(this.innVal(2,pw,e))){let t=this.innVal(1,pN,e),[i,r]=pW(t),n=Math.abs(t);(a&&i||o&&r)&&(s=n),(a&&r||o&&i)&&(s=-n)}return a?t=1:o&&(i=1),{[aL.JPIB.id]:t,[aL.JPIS.id]:i,[aL.BARCOLIX.id]:r,[pF.id]:s,[pB.id]:n,[pk.id]:l}}}let pz={FastPeriod:8,SlowPeriod:21,HandbrakePeriod:13,Average:"EMA",Height:"Fixed"},pY=cE("_SMTH_ROC"),pj=cE("_TEN_SMTH_ROC");function pK(e,t,i,s,r){return new cI({source:s,target:r,outFields:[r],aggregation:i,inputs:fw(t)},e,e=>2/e)}let pq=cE("_VOL_AVG"),pX=131,pZ=(()=>{let e=eB(.9865008210958766,6),t=ex(52,t=>Math.pow(e,t)),i=52/em(t);return t.map(e=>e*i)})(),pJ=["Renko","Kagi","PointAndFigure","LineBreak"];function pQ(e){return e===z.Continue||e===z.Nearest}class p0 extends cL{additionalChunksCounter=1;noData=!1;isPeriodic=!1;constructor(e,t,i){super(e,i,cb(i,e=>{if(!sk(er[AM()?.config.mode??"Unspecified"]))return i;let t=e.duplicate(),s=e.aggregation;if(s.hasSpec)if(pQ(s.spec))return i;else return new u8(t,!0);let r=s.unit===G.Intraday&&s.size<=5,n=function(e,t){switch(e){case G.Intraday:if(t>=240)return 3;if(t>=120)return 2;return 1;case G.Day:default:return 5;case G.Week:return 15;case G.Month:return 60;case G.Quarter:case G.Year:return 240}}(s.unit,s.size);return t.aggregation=r?new nF(G.Tick,s.size,z.PerSeconds):new nF(G.Intraday,n),t.barsToFetch=Math.min(tY.MAX_INTRADAY_BARS,(r?1:3)*e.barsToFetch),new u7(t)})),this.isPeriodic=t,this.noData=this.innerSeries[1]instanceof u8,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?a_.TS_DATAPOINTADDED:a_.TS_DATAPOINTCHANGED;this.notify(s,this.innerSeries[0].container.size-1)}getWrappers(){return[this.wrapInner(aL.Change,1),this.wrapInner(aL.Open,1),this.wrapInner(aL.Close,1)]}}let p1=cE("_DR");class p2 extends cL{constructor(e,t,i){super(e,i);let s=e=>{let t=this.baseVal(aL.High,e),i=this.baseVal(aL.Low,e);return{[p1.id]:eF(t,i)?t-i:null}},r=f0(p1,s,i),n=f9(e,"MA")(r,this.inputs.Period,p1,aL.ADR);if(t){let e=f1(this.target,(e,t,i)=>eF(t,i)&&0!==i?t/i*100:null,n,i);this.addInner(e)}else this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}}let p3=cE("_EMA1"),p4=cE("_EMA2"),p5=cE("_MACD"),p6=cE("_PCTK"),p7=cE("_PCTD"),p8=cE("_PCTK2"),p9=cE("_EMA1"),fe=cE("_EMA2"),ft=cE("_CORE");class fi extends cL{isEmpty=!1;constructor(e,t){if(super(e,t),ms(t)&&e.aggregation?.isEndOfDay){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{this.isEmpty=!0;let e=f0(aL.Close,(e,t)=>null,t),i=f0(aL.Close,(e,t)=>null,t),s=f0(this.target,(e,t)=>null,t);this.addInner(e,i,s),this.canLoadMoreData=!1}}get baseIndex(){return+!this.isEmpty}getSeries(e,t){let i=e.duplicate();return i.symbol=t,AM().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 fs=cE("_INN_HL_ACC_IX"),fr=new nF;class fn extends cL{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof u8)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===G.Week,this.isWeekly){var i;let e=(i=this.getSeries(t.query,s,fr),new fn({aggregation:fr,source:null,target:fs,outFields:[fs],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*tY.US_TRADING_DAYS_PER_YEAR),AM().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,aL.Close);ey(s)&&(t=em(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(fs);else{let t=this.container.getTimeData()[e],r=s.getTimeData(),n=e_(r,t),a=r[n],o=null;for(;n<s.size&&nx(t,a);)o=n,n+=1,a=r[n];null!==o&&(i=s.getData(fs)[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 fa=cE("_RSI1"),fo=cE("_RSI1_MOM"),fl=cE("_RSI2"),fu=cE("_RSI2_MA"),fh=cE("_MUL_ATR");class fc extends cL{constructor(e,t){super(e,cb(t,t=>{let i=AM().getTimeSeriesDataSource();return t.seriesKind=J.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 fd=cE("_CORE");class fp extends u7{constructor(e){super(e)}getRetriever(){return tg(this.query.symbol)?new fg:tP(this.query.symbol)?new fy:new fm}}function ff(){return new ul([aL.DateTime,aL.Delta,aL.Gamma,aL.Theta,aL.Vega])}class fm{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){return ff()}}class fg extends uI{emptyContainer(e,t){return ff()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(aL.DateTime,ui(e.date.substring(0,10))),i.addDataPoint(aL.Delta,e.delta),i.addDataPoint(aL.Gamma,e.gamma),i.addDataPoint(aL.Theta,e.theta),i.addDataPoint(aL.Vega,e.vega)}}class fy extends uI{emptyContainer(e,t){return ff()}addExtraParams(e){e.fields="delta,gamma,theta,vega"}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){i.addDataPoint(aL.DateTime,ui(e.date)),i.addDataPoint(aL.Delta,e.delta),i.addDataPoint(aL.Gamma,e.gamma),i.addDataPoint(aL.Theta,e.theta),i.addDataPoint(aL.Vega,e.vega)}}let fA=cE("_RSI1"),fS=cE("_RSI2"),fT=cE("_ANCHR"),fv=cE("_HH_N"),fP=cE("_LL_N"),fC=cE("_HH_H1"),fb=cE("_LL_H1"),fE=cE("_HH_H2"),fL=cE("_LL_H2"),f_=cE("_MIDPOINT"),fM=cE("_VALUE");class fx extends cL{constructor(e,t){super(e,t),f4(this)}computeMidranks(e){let t=e.length,i=e.map((e,t)=>({v:e,i:t}));i.sort((e,t)=>e.v-t.v);let s=Array(t),r=0;for(;r<t;){let e=r,n=i[r].v;for(;e+1<t&&i[e+1].v===n;)e++;let a=(r+1+(e+1))/2;for(let t=r;t<=e;t++)s[i[t].i]=a;r=e+1}return s}pearsonCorrelation(e){let t=e.length;if(t<2)return null;let i=(t+1)/2,s=0;for(let i=0;i<t;i++)s+=e[i];let r=s/t,n=0,a=0,o=0;for(let s=0;s<t;s++){let t=s+1-i,l=e[s]-r;n+=t*l,a+=t*t,o+=l*l}let l=Math.sqrt(a*o);return 0===l?null:n/l}calculateAt(e){let t=null,i=this.period,[,s]=f5(this);if(this.atLeast(e,i)){let r=this.past(e,i,this.source,s);if(r.every(e=>null!==e)){let e=this.computeMidranks(r),i=this.pearsonCorrelation(e);null!==i&&(t=100*i)}}return{[aL.RCI.id]:t}}}let fI=cE("_ATR");var fD=((D=fD||{})[D.Uninitialized=0]="Uninitialized",D[D.UpLeg=1]="UpLeg",D[D.DownLeg=-1]="DownLeg",D);let fO={_TR:class extends cL{constructor(e,t){super(e,t)}calculateAt(e){let t=null,i=this.baseVal(aL.High,e),s=this.baseVal(aL.Low,e);if(e>0){let r=this.baseVal(aL.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 cL{isModified;constructor(e,t){super(e,t);let i=e.inputs.Modified;this.isModified=i}get helpers(){return[cz,cY]}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(ey(t)){let e=eA(1,r),n=e.map(e=>this.gain(e,t)),a=e.map(e=>this.loss(e,t));i=eg(n),s=eg(a)}}else{let t=this.container.getData(cz)[e-1],n=this.container.getData(cY)[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{[cz.id]:i,[cY.id]:s,[this.target.id]:t}}},MA:cx,MAEXP:class extends cI{constructor(e,t){super(e,t,e=>2/(e+1))}},MAHLC:class extends cL{constructor(e,t){super(e,t);let i=fF(t,this.inputs.Period1,aL.High,aL.MAHI),s=fF(t,this.inputs.Period2,aL.Low,aL.MALO);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aL.MAHI,1),this.wrapInner(aL.MALO,2)]}},VOL:class extends cD{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(aL.Volume,aL.TradeSize,aL.Change,aL.Open,aL.Close)}},MAENV:class extends cN{constructor(e,t){super(e,cO,t)}},MAENVEXP:class extends cN{constructor(e,t){super(e,cw,t)}},MAENVSMO:class extends cN{constructor(e,t){super(e,cR,t)}},MATRI:class extends cL{constructor(e,t){super(e,t);let i=fF(t,this.inputs.Period,this.source),s=fF(i,this.inputs.Period,aL.MA,aL.TMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aL.TMA,2)]}},MAWEI:class extends cL{triangle;constructor(e,t){super(e,t);let i=this.period;this.triangle=i*(i+1)/2,f4(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]=f5(this);if(this.atLeast(e,i)){let r=this.past(e,i,this.source,s);this.allowEmptyValues?t=this.weightedAverage(r.filter(ef)):ey(r)&&(t=this.weightedAverage(r))}return{[this.target.id]:t}}},MAVOL:cx,MASMO:class extends cI{constructor(e,t){super(e,t,e=>1/e)}},MACD:class extends cG{constructor(e,t){super(e,cH,t)}},MACDEXP:class extends cG{constructor(e,t){super(e,cF,t)}},MACDV:class extends c${constructor(e,t){super(e,t),this.histogramVaryColor=!0,this.histogramField=aL.MACDVH;let i=f9(e,"EMA","Average"),s=i(t,e.inputs.Period1,e.source,void 0),r=i(t,e.inputs.Period2,e.source,void 0),n=fj(t,e.inputs.Period2,e.inputs.Average),a=f1(aL.MACDV,(e,t,i,s)=>(t-i)/s*100,s,r,n),o=i(a,e.inputs.Period3,a.target,aL.MACDVS),l=f1(aL.MACDVH,f2,a,o);this.addInner(a,o,l)}getWrappers(){return[this.wrapInner(aL.MACDV,1),this.wrapInner(aL.MACDVS,2),this.wrapInner(aL.MACDVH,3)]}},GMMA:class extends cL{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(fB(t,n,aL.Close,e.outFields[r-1]))}}getWrappers(){return eA(1,12).map(e=>this.wrapInner(this.outFields[e-1],e))}},OSCI:cV,OSCIVOL:cV,RSI:class extends cj{constructor(e,t){super(e,!1,t)}},RSIMOD:class extends cj{constructor(e,t){super(e,!0,t)}},RSISTO:class extends cL{constructor(e,t){super(e,t);let i=fX(t,this.inputs.Period,this.source),s=this.inputs.Range,r=f0(aL.STORSI,function(e){let t=null;if(this.atLeast(e,s)){let i=this.past(e,s,aL.RSI,this.base),r=eM(i),n=r[0],a=r[1];t=(eC(i)-n)/(a-n)}return{[aL.STORSI.id]:t}},i),n=f9(e,"MA","Average")(r,this.inputs.PeriodAvg,aL.STORSI,aL.STORSIAVG);this.addInner(r,n)}getWrappers(){return[this.wrapInner(aL.STORSI,1),this.wrapInner(aL.STORSIAVG,2)]}},RSA:class extends cL{constructor(e,t){super(e,t);let i=fX(t,this.inputs.Period1,this.source,fA),s=fX(t,this.inputs.Period2,this.source,fS),r=f1(aL.RSA,(e,t,i)=>(t+i)/2,i,s),n=f9(e,"MA","Average")(r,this.inputs.PeriodAvg,aL.RSA,aL.RSAAVG);this.addInner(r,n)}getWrappers(){return[this.wrapInner(aL.RSA,1),this.wrapInner(aL.RSAAVG,2)]}},WPERCR:class extends cq{constructor(e,t){super(e,!0,t)}},HHLL:class extends cL{constructor(e,t){super(e,t);let i=f$(t,this.inputs.Period1,aL.High,aL.HH,!0),s=f$(t,this.inputs.Period2,aL.Low,aL.LL,!1);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aL.HH,1),this.wrapInner(aL.LL,2)]}},WGCL:class extends cL{constructor(e,t){super(e,t)}calculateAt(e){let t=null,[i,s,r]=[aL.Close,aL.High,aL.Low].map(t=>this.baseVal(t,e));return t=(2*i+s+r)/4,{[this.target.id]:t}}},STOCHF:class extends cZ{constructor(e,t){super(e,!1,aL.PercK,t)}},STOCHS:class extends cZ{constructor(e,t){super(e,!0,aL.PercK,t)}},BBANDS:class extends cQ{constructor(e,t){super(e,"Regular",t)}},BWIDTH:class extends cQ{constructor(e,t){super(e,"Width",t)}},BPERC:class extends cQ{constructor(e,t){super(e,"Percent",t)}},OBVOL:class extends cL{constructor(e,t){super(e,t);let i=f0(aL.OBVOL,function(e){let t=null;if(e>0){let i=this.baseVal(aL.Close,e),s=this.baseVal(aL.Volume,e),r=this.baseVal(aL.Close,e-1),n=this.container.getData(this.target)[e-1];eF(n)||(n=0),t=i>r?n+s:i<r?n-s:n}return{[this.target.id]:t}},t),s=f9(e,"MA","Average")(i,this.period,aL.OBVOL,aL.OBVOLAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aL.OBVOL,1),this.wrapInner(aL.OBVOLAVG,2)]}},ATR:class extends cL{constructor(e,t){super(e,t);let i=fY(t,aL.TR),s=f9(e,"SMA")(i,this.inputs.Period,aL.TR,this.target),r=fF(s,this.inputs.Period2,aL.ATR,aL.ATRMA);this.addInner(s,r)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(aL.ATRMA,2)]}},ADR:class extends p2{constructor(e,t){super(e,!1,t)}},ATRP:class extends cL{constructor(e,t){super(e,t);let i=fj(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(1,aL.ATR,e),s=this.baseVal(aL.Close,e);return eF(i,s)&&s>0&&(t=i/s*100),{[aL.ATRP.id]:t}}},ADRP:class extends p2{constructor(e,t){super(e,!0,t)}},ADX:class extends c9{constructor(e,t){super(e,!1,aL.ADX,t)}},ADXMOD:class extends c9{constructor(e,t){super(e,!0,aL.ADXM,t)}},ADL:class extends cL{constructor(e,t){super(e,t);let i=fZ(t);this.addInner(i)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,aL.MFMUL,e),{[this.target.id]:t}}},ADWM:class extends cL{constructor(e,t){super(e,t);let i=f0(aL.ADWM,function(e){let t=null,i=null;if(e>0){let s=this.baseVal(aL.Close,e-1),r=Math.max(s,this.baseVal(aL.High,e)),n=Math.min(s,this.baseVal(aL.Low,e)),a=this.baseVal(aL.Close,e);t=a>s?a-n:a<s?a-r:0,e>1&&(i=(e>2?this.container.getData(aL.ADWM)[e-1]:0)+t)}return{[aL.ADWM.id]:i}},t),s=fF(i,this.inputs.Period,aL.ADWM,aL.ADWMMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aL.ADWM,1),this.wrapInner(aL.ADWMMA,2)]}},CHAOSC:class extends cL{constructor(e,t){super(e,t);let i=aL.ADL,s=function(e,t=aL.ADL){return fN("ADL",fR(t),e)}(t,i),r=fB(s,3,i),n=fB(s,10,i),a=f1(e.target,(e,t,i)=>t-i,r,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},TP:class extends cL{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=eg([aL.Close,aL.High,aL.Low].map(t=>this.baseVal(t,e))),{[this.target.id]:t}}},KELCHN:class extends du{constructor(e,t){super(e,da,t)}},KELBND:class extends du{constructor(e,t){super(e,dl,t)}},DONCHN:class extends dh{constructor(e,t){super(e,!1,t)}},DONWIDTH:class extends dh{constructor(e,t){super(e,!0,t)}},PVT:class extends cL{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){let i=this.baseVal(aL.Close,e),s=this.baseVal(aL.Volume,e),r=this.baseVal(aL.Close,e-1),n=this.container.getData(this.target)[e-1];eF(n)||(n=0),t=n+(i-r)/r*s}return{[this.target.id]:t}}},ROC:class extends cL{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 cL{constructor(e,t){super(e,t);let i=fB(t,this.inputs.Period,this.source),s=fB(i,this.inputs.Period,i.target),r=fB(s,this.inputs.Period,s.target),n=fq(r,1,r.target,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},PPMOV:class extends cL{constructor(e,t){super(e,t);let i=fK(t,aL.PVPT);this.addInner(i)}calculateAt(e){let t=this.innVal(1,aL.PVPT,e),i=this.baseVal(aL.High,e),s=this.baseVal(aL.Low,e);return{[aL.PVPTR.id]:t+i-s,[aL.PVPTS.id]:t-i+s}}getWrappers(){return[this.wrapInner(aL.PVPT,1)]}},PIVPTS:class extends dj{constructor(e,t){super(e,dY[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(ey(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{[aL.PPTPIV.id]:t,[aL.PPTR1.id]:i,[aL.PPTR2.id]:r,[aL.PPTR3.id]:a,[aL.PPTS1.id]:s,[aL.PPTS2.id]:n,[aL.PPTS3.id]:o}}},CPP:class extends dj{constructor(e,t){super(e,dY.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(ey(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{[aL.CPPH4.id]:o,[aL.CPPH3.id]:n,[aL.CPPH2.id]:s,[aL.CPPH1.id]:t,[aL.CPPL1.id]:i,[aL.CPPL2.id]:r,[aL.CPPL3.id]:a,[aL.CPPL4.id]:l}}},ARNUPDW:class extends dp{constructor(e,t){super(e,!1,t)}},ARNOSC:class extends dp{constructor(e,t){super(e,!0,t)}},TCHN:class extends cL{constructor(e,t){super(e,t);let i="Close"===e.inputs.Range,s=mi(t);if(!i&&s){let e=f0(aL.TCHNUP,(e,t)=>null,t),i=f0(aL.TCHNLOW,(e,t)=>null,t);this.addInner(e,i)}else{let s=f$(t,e.inputs.PeriodUpper,i?aL.Close:aL.High,aL.TCHNUP,!0),r=f$(t,e.inputs.PeriodLower,i?aL.Close:aL.Low,aL.TCHNLOW,!1);this.addInner(s,r)}}getWrappers(){return[this.wrapInner(aL.TCHNUP,1),this.wrapInner(aL.TCHNLOW,2)]}},TCHRE:class extends cL{constructor(e,t){super(e,t);let i=function(e,t,i){let s="TCHN",r=fV(s);return fN(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,aL.TCHNUP,e),s=this.innVal(1,aL.TCHNLOW,e),r=this.inputs.Adjustment,n=this.inputs.Retracement;return"Long"===n?t=eF(i)?i-r:null:"Short"===n&&(t=eF(s)?s+r:null),{[this.target.id]:t}}},ALLG:class extends cL{constructor(e,t){super(e,t);let i=f0(df,eh(dt,df),t),s=fk(i,e.inputs.Period1,df,aL.ALJAW),r=fk(i,e.inputs.Period2,df,aL.ALTEETH),n=fk(i,e.inputs.Period3,df,aL.ALLIPS);this.addInner(s,r,n)}calculateAt(e){return{[aL.ALJAW.id]:this.innVal(1,aL.ALJAW,e),[aL.ALTEETH.id]:this.innVal(2,aL.ALTEETH,e),[aL.ALLIPS.id]:this.innVal(3,aL.ALLIPS,e)}}},PLTLN:class extends cL{constructor(e,t){super(e,t)}calculateAt(e){return{[aL.PLTLN.id]:this.inputs.Position}}},AWEOSC:class extends cL{constructor(e,t){super(e,t);let i=f0(dm,eh(dt,dm),t),s=fF(i,this.inputs.Period1,dm),r=fF(i,this.inputs.Period2,dm),n=f1(aL.AWOS,(e,t,i)=>t-i,s,r),a=fF(n,this.inputs.Period3,n.target,aL.AWOSMA);this.addInner(n,a)}getWrappers(){return[this.wrapInner(aL.AWOS,1),this.wrapInner(aL.AWOSMA,2)]}},MFV:class extends dg{constructor(e,t){super(e,!0,t)}},CLV:class extends dg{constructor(e,t){super(e,!1,t)}},CHAMF:class extends cL{constructor(e,t){super(e,t);let i=fZ(t);this.addInner(i)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,aL.Volume),r=this.past(e,i,aL.MFMUL,this.innCont(1));if(ey(s)&&ey(r)){let e=em(s);0!==e&&(t=em(r)/e)}}return{[this.target.id]:t}}},CHAVOL:class extends cL{constructor(e,t){super(e,t);let i=fq(fB(f0(dy,eh(di,dy),t),this.inputs.Period1,dy),this.inputs.Period2,aL.EMA,this.target);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},DPO:class extends cL{shift;constructor(e,t){super(e,t);let i=this.inputs.Period;this.shift=Math.floor(i/2)+1;let s=fF(t,i,e.source);this.addInner(s)}calculateAt(e){let t=null,i=this.shift,s=this.innVal(1,aL.MA,e-i);return null!==s&&(t=this.baseVal(this.source,e)-s),{[this.target.id]:t}}},CCI:class extends cL{constructor(e,t){super(e,t);let i=fK(t),s=fF(i,this.inputs.Period,i.target,dA);this.addInner(i,s)}calculateAt(e){let t=null,i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,aL.TP,this.innCont(1));if(ey(s)){let i=this.innVal(2,dA,e);if(null!==i){let r=s.reduce((e,t,s)=>e+Math.abs(i-t),0)/this.period;t=(this.innVal(1,aL.TP,e)-i)/(.015*r)}}}return{[this.target.id]:t}}},EMV:class extends cL{constructor(e,t){super(e,t);let i=f0(aL.EMV,function(e){let t=null;if(e>0){let[i,s,r]=[aL.High,aL.Low,aL.Volume].map(t=>this.baseVal(t,e)),[n,a]=[aL.High,aL.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=fF(i,this.inputs.Period,aL.EMV,aL.EMVMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aL.EMV,1),this.wrapInner(aL.EMVMA,2)]}},ERBRPOW:class extends dS{constructor(e,t){super(e,!1,t)}},ERBLPOW:class extends dS{constructor(e,t){super(e,!0,t)}},FI:class extends cL{constructor(e,t){super(e,t);let i=fB(f0(dT,function(e){let t=null;if(e>0){let i=this.baseVal(aL.Close,e),s=this.baseVal(aL.Volume,e);t=(i-this.baseVal(aL.Close,e-1))*s}return{[this.target.id]:t}},t),this.inputs.Period,dT,aL.FI);this.addInner(i)}getWrappers(){return[this.wrapInner(aL.FI,1)]}},MI:class extends cL{constructor(e,t){super(e,t);let i=fB(f0(dv,eh(di,dv),t),9,dv,dP),s=fB(i,9,dP,dC),r=f1(db,(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,db,this.innCont(1));ey(i)&&(t=em(i))}return{[this.target.id]:t}}},MOM:class extends cL{constructor(e,t){super(e,t);let i=this.inputs.Period,s=f0(aL.MOM,ec(f7,i,aL.Close),t),r=fF(s,this.inputs.Movement,aL.MOM,aL.MOMMA);this.addInner(s,r)}getWrappers(){return[this.wrapInner(aL.MOM,1),this.wrapInner(aL.MOMMA,2)]}},MFI:class extends cL{constructor(e,t){super(e,t);let i=fK(t);this.addInner(i)}calculateAt(e){let t=null,i=this.period+1;if(this.atLeast(e,i)){let s=this.past(e,i,aL.TP,this.innCont(1)),r=this.past(e,i,aL.Volume).map(e=>null!=e?e:0);if(ey(s)&&ey(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 cL{constructor(e,t){super(e,t),f4(this);let i=fF(t,this.inputs.Period,this.source);this.addInner(i)}calculateAt(e){let t=null,[i,s]=f5(this),r=this.innVal(i+1,aL.MA,e);if(null!==r){let i=this.inputs.Period,n=this.past(e,i,this.source,s);t=Math.sqrt(eg(n=n.map(e=>(e-r)*(e-r))))}return{[this.target.id]:t}}getWrappers(){let[e]=f5(this);return[this.wrapInner(aL.MA,e+1)]}},NVI:class extends d_{constructor(e,t){super(e,dL,t)}},PVI:class extends d_{constructor(e,t){super(e,dE,t)}},PPO:class extends cG{constructor(e,t){super(e,cW,t)}},PVO:class extends cG{constructor(e,t){super(e,cU,t)}},HV:class extends cL{constructor(e,t){super(e,t);let i=Math.sqrt(mt(e.aggregation));if(0===i){let e=f0(this.target,(e,t)=>null,t);this.addInner(e)}else{let s=fJ(f0(dM,eh(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{[dM.id]:i}},aL.Close),t),e.inputs.Period,dM,aL.MSD),r=f0(aL.HV,eh(function(e,t){let i=null,s=this.baseVal(aL.MSD,t);return null!==s&&(i=100*s*e),{[aL.HV.id]:i}},i),s);this.addInner(r)}}getWrappers(){return[this.wrapInner(this.target,1)]}},PERF:class extends cL{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 cL{constructor(e,t){super(e,t)}get helpers(){return[dx]}ohlcVals(e){return[aL.Open,aL.High,aL.Low,aL.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(dx)[e-1];eF(s)||(s=0);let[r,n,a,o]=this.ohlcVals(e),[l,u,h,c]=this.ohlcVals(e-1);if(ey([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{[dx.id]:t,[this.target.id]:i}}},WWVOL:class extends cL{constructor(e,t){super(e,t);let i=fj(t,e.inputs.Period);this.addInner(i)}get helpers(){return[dD,dI]}calculateAt(e){let t=null,i=null,s=null,r=null,n=this.innVal(1,aL.ATR,e);if(null!==n){let a=this.baseVal(aL.Close,e),o=this.baseVal(aL.Close,e-1),l=this.period;s=Math.max(...this.past(e,l,aL.Close)),r=Math.min(...this.past(e,l,aL.Close));let u=n*this.inputs.Constant;if(null===this.innVal(1,aL.ATR,e-1))a>o?t=s-u:i=r+u;else{let[n,o,l,h]=[aL.WWVSARU,aL.WWVSARD,dD,dI].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{[dD.id]:s,[dI.id]:r,[aL.WWVSARU.id]:t,[aL.WWVSARD.id]:i}}},PARTP:class extends cL{constructor(e,t){super(e,t)}get helpers(){return[dO,dw,dR]}hlcVals(e){return[aL.High,aL.Low,aL.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]=[dR,aL.PARSARS,aL.PARSARL,dO,dw].map(t=>this.me(t,e-1)),A=1===u,S=A?m:d,T=y*Math.abs(g-S),v=u===(n=A?S+T>l?-1:1:S-T<o?1:-1);a=v?A?Math.min(S+T,c,this.baseVal(aL.Low,e-2)):Math.max(S-T,h,this.baseVal(aL.High,e-2)):g,s=v?A?Math.max(o,g):Math.min(l,g):1===n?o:l,r=y,v?(A?s>g:s<g)&&y<f&&(r=y+p):r=p,1===n?t=a:i=a}}return{[dO.id]:s,[dw.id]:r,[dR.id]:n,[aL.PARSARS.id]:i,[aL.PARSARL.id]:t}}},MOVLR:class extends cL{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(ey(s)){let e=em(s),r=(i*em(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 cL{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);dV.splice(6,3,...i)}get helpers(){return[dN]}prepareComputation(){let e=this.base.getData(aL.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=dH(s),this.itr=dH(s),this.haveEnoughData&&dB(e,this.s3,s)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,i){let s=this.base.getData(aL.Close),r=s.length;this.haveEnoughData&&dB(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(aL.Close,e)){let n=r(aL.TRSP1),a=r(aL.TRSP2);s=r(dN),null===n&&null===a&&(n=a=this.baseVal(aL.Close,this.firstUsefulIndex)),null===s&&(s=1);let o=this.base.getData(aL.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=dF(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,dV),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*dF(r,i[s],4)}(o,this.s3,this.itr,e,dV);[n,a]=function(e,t,i,s,r,n,a,o,l,u){let h=dF(r,i[s],10),c=dF(r,i[s],13),d=dF(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,A=e[s]+(p-p*m),S=[n,a];return(1===o||1!==d||y>n)&&(S[0]=y),(1===o||1!==d||A<a)&&(S[1]=A),S}(o,this.s3,this.itr,e,dV,n,a,s,l,u),this.itr[e]>=0&&(t=n),this.itr[e]<=0&&(i=a)}return{[dN.id]:s,[aL.TRSP1.id]:t,[aL.TRSP2.id]:i}}},COTLC:dz,COTDAG:class extends dW{constructor(e,t){super(e,2,t)}},COTFTR:class extends dW{constructor(e,t){super(e,3,t)}},IMPVOL:class extends cL{constructor(e,t){super(e,cb(t,e=>new dK(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(aL.IMPVOL,0)]}},CTM:class extends cG{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,cB,t)}},CPMI:class extends cG{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,ck,t)}},DEMA:class extends cL{constructor(e,t){super(e,t);let i=fB(t,this.inputs.Period,this.source),s=fB(i,this.inputs.Period,i.target),r=f1(aL.DEMA,(e,t,i)=>2*t-i,i,s);this.addInner(r)}getWrappers(){return[this.wrapInner(aL.DEMA,1)]}},EOSC:class extends cL{constructor(e,t){super(e,t);let i=fB(t,this.inputs.Period1,this.source),s=fB(t,this.inputs.Period2,this.source),r=f1(aL.EOSC,(e,t,i)=>t-i,i,s);this.addInner(r)}getWrappers(){return[this.wrapInner(aL.EOSC,1)]}},TEMA:class extends cL{constructor(e,t){super(e,t);let i=fB(t,this.inputs.Period,this.source),s=fB(i,this.inputs.Period,i.target),r=fB(s,this.inputs.Period,s.target),n=f1(aL.TEMA,(e,t,i,s)=>3*(t-i)+s,i,s,r);this.addInner(n)}getWrappers(){return[this.wrapInner(aL.TEMA,1)]}},TSI:class extends cL{constructor(e,t){super(e,t);let i=(e,t,i,s,r,n)=>{let a=fB(e,t,i,s);return fB(a,r,s,n)},s=f0(dQ,eh((e,t)=>({[e.id]:Math.abs(this.baseVal(aL.Change,t))}),dQ),t),r=i(t,e.inputs.Period1,aL.Change,d0,e.inputs.Period2,d1),n=i(s,e.inputs.Period1,dQ,d2,e.inputs.Period2,d3),a=f1(aL.TSI,(e,t,i)=>100*t/i,r,n),o=fB(a,e.inputs.Period3,aL.TSI,aL.TSISIG);this.addInner(a,o)}getWrappers(){return[this.wrapInner(aL.TSI,1),this.wrapInner(aL.TSISIG,2)]}},ADJATR:class extends cL{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)),{[c0.id]:Math.abs(i)}},s=f0(c0,eh(i,this.source),t),r=f9(e,"MA")(s,this.inputs.Period,c0,c1),n=f1(aL.ADJATR,(e,t)=>2*t,r);this.addInner(n)}getWrappers(){return[this.wrapInner(aL.ADJATR,1)]}},COTR:class extends cL{constructor(e,t){super(e,t);let i=e=>{let t=0;return e>0&&(t=this.baseVal(aL.Close,e)-this.baseVal(aL.Close,e-1)),{[c2.id]:t}},s=f0(c2,i,t),r=me[e.inputs.TypeOfATR.toLowerCase()],n=r(t,this.inputs.Period,this.inputs.Smoothing),a=f1(this.target,(e,t,i)=>eF(t)&&eF(i)?t/i:null,s,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCGD:class extends cL{constructor(e,t){super(e,t);let i=fB(t,this.inputs.Period,aL.Close);this.addInner(i)}calculateAt(e){let t=null,i=e>0?this.container.getData(this.target)[e-1]:null,s=this.innVal(1,aL.EMA,e);if(eH(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 cL{constructor(e,t){super(e,t);let i=this.inputs.Period,s=Math.floor(i/2),r=this.allowEmptyValues,n=fW(t,s,this.source,aL.WMA,r),a=f1(d4,(e,t,i)=>2*t-i,n,fW(t,i,this.source,aL.WMA,r)),o=fW(a,Math.floor(Math.sqrt(i)),d4,this.target,r);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},COPP:class extends cL{constructor(e,t){super(e,t);let i=fq(t,this.inputs.PeriodRocLong),s=fW(f1(d5,(e,t,i)=>t+i,i,fq(t,this.inputs.PeriodRocShort)),this.inputs.PeriodWma,d5,this.target);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}},REATRS:class extends cL{constructor(e,t){super(e,t);let i="Close"===e.inputs.TurtleChnField,s="Long"===e.inputs.Direction,r=mi(t);if(!i&&r){let e=f0(this.target,(e,t)=>null,t);this.addInner(e)}else{let e=(e,t)=>({[d6.id]:t>0?e*Math.abs(this.baseVal(aL.Change,t)):null}),r=fF(f0(d6,eh(e,this.inputs.FactorATR),t),this.inputs.PeriodAdjATR,d6,aL.MA),n=s?aL.High:aL.Low,a=f$(t,this.inputs.PeriodTurtleChn,i?aL.Close:n,d7,s),o=f1(d8,(e,t)=>this.inputs.FactorAdjATR*t,r),l=s?-1:1,u=f1(this.target,(e,t,i)=>t+l*i,a,o);this.addInner(u)}}getWrappers(){return[this.wrapInner(this.target,1)]}},LINRCHN:class extends cL{state;constructor(e,t){super(e,t),this.resetState()}resetState(){let e=this.inputs.ExtendLines??"None";this.state={startIndex:null,endIndex:null,slope:null,intercept:null,stdDevWidth:null,extendLeft:"Left"===e||"Both"===e,extendRight:"Right"===e||"Both"===e}}calculateAt(e){let t=this.inputs.Period,i=this.inputs.Width;if(e===this.base.size-1&&this.base.size>=t){this.resetState();let e=t*(t+1)/2,s=0,r=0,n=1,a=this.base.size-t;for(let e=0;e<t;++e){let t=this.baseVal(aL.Close,a+e);s+=t,r+=n*t,n+=1}let o=(t*r-e*s)/(t*(t+1)*(2*t+1)/6*t-e*e),l=s/t-o*e/t,u=0;for(let e=0;e<t;++e){let t=this.baseVal(aL.Close,a+e)-(l+o*(e+1));u+=t*t}let h=Math.sqrt(u/t);this.state.startIndex=a,this.state.endIndex=this.base.size-1,this.state.slope=o,this.state.intercept=l,this.state.stdDevWidth=eF(h)?i*h:null}return{}}getCurrentState(){return this.state}},CSHO:class extends cL{computeDone;constructor(e,t){super(e,t,cb(t,e=>{var t;let i=ez(e);return i.symbol=ty(t=e.symbol)?`${tx(t)}Y00`:null,eF(i.symbol)?new u7(i):new u8(i,!0)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){let e=this.innCont(0);if(!eF(e)||0===e.size)return;let t=this.innCont(1),i=e.getTimeData(),s=t.getTimeData(),r=t.getData(aL.Close),n=Array(i.length).fill(null);if(!(this.innerSeries[1]instanceof u8)){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(a_.TS_MANYCHANGED,-1))}},CSHB:class extends cL{constructor(e,t){super(e,t,function(e,t=aL.CSHO){return fN("CSHO",fR(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)=>eF(this.innCont(t))?this.innVal(t,i,e):null,i=t(0,aL.Close),s=t(1,aL.CSHO);return{[this.target.id]:eF(s)&&eF(i)?s-i:null}}},MKTCAP:class extends cL{computeDone;constructor(e,t){super(e,t,cb(t,e=>{let t=new cP(e.symbol,new nF(e.aggregation.unit===G.Year?G.Year:G.Quarter,1),J.BalanceSheet);return t.fields=[aL.SharesOutstanding],t.cacheMe=!0,new ht(t)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignFundamentalTimelineWithUnderlying(){let e=this.innCont(0);if(!eF(e)||0===e.size)return;let t=this.innCont(1);if(!eF(t)||0===t.size)return;let i=e.getTimeData(),s=t.getTimeData(),r=t.getData(aL.SharesOutstanding),n=e.getData(aL.Close),a=Array(i.length),o=0,l=e.size,u=t.size;for(let e=0;e<l;++e){let t=i[e].getTime();for(;o<u-1&&s[o+1].getTime()<=t;)o++;if(o<u&&s[o].getTime()<=t){let t=r[o],i=n[e];a[e]=eF(t,i)?t*i:null}}this.container.setData(this.target,a)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignFundamentalTimelineWithUnderlying(),this.computeDone=!0,this.notify(a_.TS_MANYCHANGED,-1))}},CTPI:class extends cZ{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,aL.CTPI,t)}},PCTCHG:class extends cL{constructor(e,t){super(e,t),f4(this)}calculateAt(e){let t=null,[i]=f5(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 cD{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(aL.TradeSize,aL.Change)}},STOMOMIX:class extends cL{constructor(e,t){super(e,t);let i=f$(t,e.inputs.Period1,aL.High,aL.HH,!0),s=f$(t,e.inputs.Period1,aL.Low,aL.LL,!1),r=fB(f1(pe,(e,t,i)=>this.baseVal(aL.Close,e)-(t+i)/2,i,s),e.inputs.Period2,pe,pt),n=fB(r,e.inputs.Period2,pt,pi),a=fB(f1(ps,(e,t,i)=>t-i,i,s),e.inputs.Period2,ps,pr),o=fB(a,e.inputs.Period2,pr,pn),l=f1(aL.STOMOMIX,(e,t,i)=>100*t/i,n,o);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},CHDMOMOSC:class extends cL{constructor(e,t){super(e,t);let i=new pu(e,t),s=f9(e,"MA","Average")(i,this.inputs.PeriodAvg,aL.CHDMOMOSC,aL.CHDMOMOSCAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(aL.CHDMOMOSC,1),this.wrapInner(aL.CHDMOMOSCAVG,2)]}},VSTOP:class extends cL{constructor(e,t){super(e,t);let i=fj(t,e.inputs.Period);this.addInner(i)}get helpers(){return[ph,pc,pd]}calculateAt(e){let t=null,i=null,s=null,r=null,n=null,a=null,o=1,l=this.baseVal(aL.Close,e),u=e=>eF(e)?e:0,h=(e,t)=>this.container.getData(e)[t];e>0&&(s=Math.max(u(h(ph,e-1)),l),n=Math.min(u(h(pc,e-1)),l),o=h(pd,e-1));let c=this.inputs.Multiplier,d=this.innVal(1,aL.ATR,e);if(eF(d)){let u=1===o,p=u?s-c*d:n+c*d,f=h(u?aL.VSTOPUP:aL.VSTOPLOW,e-1);eF(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{[aL.VSTOPUP.id]:1===a?t:null,[aL.VSTOPLOW.id]:1===a?null:t,[ph.id]:i,[pc.id]:r,[pd.id]:a}}},SUPTR:class extends cL{constructor(e,t){super(e,t);let i=fj(t,e.inputs.Period);this.addInner(i)}get helpers(){return[pp,pf,pm,aL.BARCOLIX]}calculateAt(e){let t=0,i=0,s=0,r=null,n=0,a=this.innVal(1,aL.ATR,e);if(eF(a)){let[o,l,u]=[aL.Close,aL.High,aL.Low].map(t=>this.baseVal(t,e)),h=(l+u)/2,c=this.baseVal(aL.Close,e-1),d=this.inputs.Multiplier,p=h-d*a,f=h+d*a,[m,g,y]=[pp,pf,pm].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 A=1===(s=o>g?1:o<m?-1:eF(y)?y:1);r=A?t:i,n=+!!A}return{[pp.id]:t,[pf.id]:i,[pm.id]:s,[aL.SUPTR.id]:r,[aL.BARCOLIX.id]:n}}},ICHCLD:class extends cL{constructor(e,t){super(e,t);let i=(e,t,i)=>f1(i,(e,t,i)=>(t+i)/2,e,t),s=(e,s)=>i(f$(t,e,aL.Low,aL.LL,!1),f$(t,e,aL.High,aL.HH,!0),s),r=s(e.inputs.PeriodConversionLine,aL.CONVLN),n=s(e.inputs.PeriodBaseLine,aL.BASELN),a=i(r,n,aL.LEADSP1),o=s(e.inputs.PeriodLaggingSpan2,aL.LEADSP2);this.addInner(r,n,a,o)}get helpers(){return[aL.BARCOLIX]}calculateAt(e){let t=+(this.innVal(3,aL.LEADSP1,e)>this.innVal(4,aL.LEADSP2,e));return{[aL.LAGGSP.id]:this.baseVal(aL.Close,e),[aL.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(aL.CONVLN,1),this.wrapInner(aL.BASELN,2),this.wrapInner(aL.LEADSP1,3),this.wrapInner(aL.LEADSP2,4)]}},VWAP:class extends pS{constructor(e,t){super(e,t)}get helpers(){return[pg,py,pA]}isSame(e,t){switch(this.inputs.AnchorPeriod){case"Session":default:return nC(e,t);case"Week":return nx(e,t);case"Month":return nb(e,t);case"Quarter":return nL(e,t);case"Year":return nI(e,t);case"Decade":return ue(10,e)===ue(10,t);case"Century":return ue(100,e)===ue(10,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(1===this.valueAt(pA,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):tY.ZERO_DATE,l=this.dateAt(e),u=a&&this.isSame(o,l),h=u?this.valueAt(pg,e-1):0,c=u?this.valueAt(py,e-1):0,d=this.innVal(0,aL.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(aL.VWAP).slice(a,e);o.push(t);let l=eg(o),u=Math.sqrt(eg(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{[pg.id]:p,[py.id]:f,[pA.id]:+!u,[aL.VWAP.id]:t,[aL.VWAPSD1U.id]:i,[aL.VWAPSD1L.id]:s,[aL.VWAPSD2U.id]:r,[aL.VWAPSD2L.id]:n}}},MACROSS:class extends cL{constructor(e,t){super(e,t);let i=f9(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,aL.MAS),r=i(t,e.inputs.Period2,this.source,aL.MAL);this.addInner(s,r)}get helpers(){return pv}calculateAt(e){let t=this.innVal(1,aL.MAS,e),i=this.innVal(2,aL.MAL,e);return pP(this.container,e,t,i)}getWrappers(){return[this.wrapInner(aL.MAS,1),this.wrapInner(aL.MAL,2)]}},PACROSS:class extends cL{_maIndex;_maTarget;constructor(e,t){super(e,t),f4(this);let i=f9(e,"MA","Average")(t,e.inputs.Period,this.source);this.addInner(i);let[s]=f5(this);this._maIndex=s+1,this._maTarget=i.target}get helpers(){return pv}calculateAt(e){let t=this.innVal(this._maIndex,this._maTarget,e),[,i]=f5(this),s=i.getData(this.source)[e],r=pP(this.container,e,s,t);return r[this.target.id]=t,r}},VOIN:class extends cL{constructor(e,t){super(e,t);let i=f0(pC,function(e){return{[pC.id]:e>0?Math.abs(this.baseVal(aL.High,e)-this.baseVal(aL.Low,e-1)):null}},t),s=f0(pb,function(e){return{[pb.id]:e>0?Math.abs(this.baseVal(aL.Low,e)-this.baseVal(aL.High,e-1)):null}},t),r=fY(t,aL.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,pC,this.innCont(1)),n=this.past(e,s,pb,this.innCont(2)),a=this.past(e,s,aL.TR,this.innCont(3));if(ey(r)&&ey(n)&&ey(a)){let e=em(r),s=em(n),o=em(a);t=e/o,i=s/o}}return{[aL.PLVI.id]:t,[aL.MNVI.id]:i}}},DIFA:class extends cL{isPercent;constructor(e,t){super(e,t);let i=f9(e,"MA","Average")(t,this.period,this.source,p_);this.isPercent="Percentage"===e.inputs.Distance,this.addInner(i)}get helpers(){return[aL.BARCOLIX]}calculateAt(e){let t=null,i=null,s=this.innVal(1,p_,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,[aL.BARCOLIX.id]:i}}},DOSC:class extends cL{constructor(e,t){super(e,t);let i=fB(fX(t,this.inputs.PeriodRsi,this.source,aL.RSI),this.inputs.PeriodEma1,aL.RSI,aL.EMA),s=fB(i,this.inputs.PeriodEma2,aL.EMA,aL.EMA),r=fF(s,this.inputs.PeriodMa,aL.EMA,aL.MA),n=f1(aL.DOSCH,(e,t,i)=>t-i,s,r),a=fF(n,this.inputs.PeriodSig,aL.DOSCH,aL.DOSCS);this.addInner(n,a)}getWrappers(){return[this.wrapInner(aL.DOSCH,1),this.wrapInner(aL.DOSCS,2)]}},BBANDW:class extends cQ{constructor(e,t){super(e,"BandWidth",t)}},MARIB:class extends cL{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=fF(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 cL{constructor(e,t){super(e,t);let i=f9(e,"EMA","Smoothing1"),s=e.inputs.Period1,r=i(t,s,aL.Open),n=i(t,s,aL.High),a=i(t,s,aL.Low),o=i(t,s,aL.Close),l=f1(pD,(e,t,i,s,r)=>(t+i+s+r)/4,r,n,a,o),u=f1(pM,function(e,t,i,s){let r=null;if(e>0){let s=this.container.getData(pM)[e-1],n=this.innVal(2,pD,e-1);eF(s,n)?r=(s+n)/2:eF(t,i)&&(r=(t+i)/2)}return r},r,o,l),h=f1(px,(e,t,i,s)=>eF(t,i,s)?Math.max(t,Math.max(i,s)):null,n,u,l),c=f1(pI,(e,t,i,s)=>eF(t,i,s)?Math.min(t,Math.min(i,s)):null,a,u,l),d=f9(e,"EMA","Smoothing2"),p=e.inputs.Period2,f=d(u,p,pM,aL.Open),m=d(h,p,px,aL.High),g=d(c,p,pI,aL.Low),y=d(l,p,pD,aL.Close),A=f0(aL.Change,function(e){let t=null;if(e>0){let i=this.baseVal(aL.Close,e),s=this.baseVal(aL.Close,e-1);eF(i,s)?t=i-s:eF(i)&&!eF(s)&&(t=0)}return{[aL.Change.id]:t}},y);this.addInner(f,m,g,y,A)}getWrappers(){return[this.wrapInner(aL.Open,1),this.wrapInner(aL.High,2),this.wrapInner(aL.Low,3),this.wrapInner(aL.Close,4),this.wrapInner(aL.Change,5)]}},TTMSQZ:class extends cL{constructor(e,t){super(e,t);let i=e.inputs,s=fB(t,i.PeriodEmaKeltner,aL.Close),r=fj(t,i.PeriodAtrKeltner);function n(e,t,i,s){return eF(i,s)?i+e*s:null}let a=i.MultiplierKeltner,o=f1(aL.KCUP,eh(n,a),s,r),l=f1(aL.KCLOW,eh(n,-a),s,r),u=function(e,t,i,s=aL.Close){let r="BBANDS",n=fV(r);return fN(r,{source:s,inputs:{[tY.INPUT_PERIOD]:t,[tY.INPUT_WIDTH]:i},outFields:n},e)}(t,i.PeriodBollinger,i.WidthBollinger),h=function(e,t){let i="DONCHN",s=fV(i);return fN(i,{inputs:fw(t),outFields:s,source:null},e)}(t,i.PeriodMomentum),c=fF(t,i.PeriodMomentum,aL.Close),d=fQ(f1(pO,function(e,t,i,s){let r=null,n=this.innVal(1,aL.DONMID,e);return eF(n,s)&&(r=t-(n+s)/2),r},t,h,c),i.PeriodMomentum,pO,aL.TTMSQZOSC);this.addInner(o,l,u,d)}get helpers(){return[aL.BARCOLIX]}calculateAt(e){let t=null,i=null,s=-1,r=this.innVal(1,aL.KCUP,e),n=this.innVal(2,aL.KCLOW,e),[a,o]=[aL.BOLLBU,aL.BOLLBL].map(t=>this.innVal(3,t,e));a<r&&o>n?t=0:i=0;let l=this.innVal(4,aL.TTMSQZOSC,e),u=e>0?this.innVal(4,aL.TTMSQZOSC,e-1):null;if(eF(l))if(eF(u)){let e=l>=0,t=u<l;s=e?t?3:2:+!!t}else s=2;return{[aL.TTMSQZON.id]:t,[aL.TTMSQZOFF.id]:i,[aL.BARCOLIX.id]:s}}getWrappers(){return[this.wrapInner(aL.TTMSQZOSC,4)]}},CRS:class extends cL{constructor(e,t){if(super(e,t),ms(t)){let i=AM().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.inputs.Symbol.toUpperCase();let r=i.getTimeSeries(s),n=e=>e.query?.symbol,{model:a}=n4(`{${n(t)}} / {${n(r)}}`,!1),o=new pL(a,[t,r],(e=>{let t=e.unit===G.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:B.Manual,missing:t?F.UseNext:F.UsePrevious,stretch:e=>!1,fieldMap:new Map([[aL.Close,aL.CRS]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation)),l=f9(e,"MA","Average")(o,this.period,aL.CRS,aL.CRSAVG);this.addInner(r,o,l),this.canLoadMoreData=!0,this.initialNotification=!0}else{let e=f0(aL.Close,(e,t)=>null,t),i=f0(aL.CRS,(e,t)=>null,t),s=f0(aL.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(aL.CRS,2),this.wrapInner(aL.CRSAVG,3)]}},JPI:pG,CTTP:class extends pG{constructor(e,t){e.inputs=eK(sN("JPI").defaults.inputs.filter(e=>"HandbrakePeriod"!==e.name)),super(e,t)}},CTTI:class extends pG{constructor(e,t){e.inputs=structuredClone(pz),super(e,t)}},DRS:class extends cL{get indexSymbol(){return this.inputs[tY.INPUT_SYMBOL]}constructor(e,t){if(super(e,t),ms(t)){let i=AM().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.indexSymbol;let r=i.getTimeSeries(s),{model:n}=n4(`{${t.query.symbol}} / {${r.query.symbol}} * 100`,!1),a=new pL(n,[t,r],(e=>{let t=e.unit===G.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:B.Manual,missing:t?F.UseNext:F.UsePrevious,stretch:e=>!1,fieldMap:new Map([[aL.Close,aL.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=f0(aL.Close,(e,t)=>null,t),i=f0(aL.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(aL.DRS,2)]}},MRS:class extends cL{get indexSymbol(){return this.inputs[tY.INPUT_SYMBOL]}constructor(e,t){super(e,t);let i=function(e,t,i,s=aL.DRS){return fN("DRS",{target:s,inputs:{[tY.INPUT_SYMBOL]:t},aggregation:i,source:null},e)}(t,this.indexSymbol,e.aggregation),s=fF(i,this.period,aL.DRS);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){let t=this.innVal(1,aL.DRS,e),i=this.innVal(2,aL.MA,e),s=null;return eF(t,i)&&0!==i&&(s=(t/i-1)*100),{[aL.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 cL{constructor(e,t){super(e,t);let i=fq(t,1),s=e.aggregation,r=f1(pj,(e,t)=>10*t,pK(i,this.inputs.Period1,s,aL.ROC,pY)),n=pK(r,this.inputs.Period2,s,pj,aL.PMO),a=fB(n,this.inputs.Period3,aL.PMO,aL.PMOS);this.addInner(n,a)}getWrappers(){return[this.wrapInner(aL.PMO,1),this.wrapInner(aL.PMOS,2)]}},RVOL:class extends cL{constructor(e,t){super(e,t);let i=f9(e,"MA")(t,this.period,aL.Volume,pq,!0);this.addInner(i)}calculateAt(e){let t=null,i=this.innVal(0,aL.Volume,e),s=this.innVal(1,pq,e);return eF(i,s)&&0!==s&&(t=i/s),{[this.target.id]:t}}},WGALPH:class extends cL{isDaily;isFeasible=!0;constructor(e,t){super(e,t),this.isFeasible=!(t instanceof u8)&&!pJ.includes($[t.query.curveStyle]),this.isDaily=e.aggregation.unit===G.Day}acceptable(e,t,i,s){return this.isDaily?0===s||!nx(this.baseVal(aL.DateTime,t),this.baseVal(aL.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>=pX){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*pZ[e]+1}t=100*(i-1)}return{[this.target.id]:t}}},VOLAP:class extends p0{constructor(e,t){super(e,!1,t)}},AVWAP:class extends pS{constructor(e,t){super(e,t)}get helpers(){return[pg,py]}isSameOhlcBar(e,t){let{unit:i,size:s}=this.aggregation;switch(i){case G.Tick:return e===t;case G.Intraday:return am(t,l1(e,s));case G.Day:return am(t,lX(e,s));case G.Week:return nx(e,t);case G.Month:return nb(e,t);case G.Quarter:return nL(e,t);case G.Year:return nI(e,t);default:throw Error(`Unexpected aggregation unit ${G[i]}`)}}calculateAt(e){let t=null,i=null,s=null,r=this.inputs.Anchor,n=this.dateAt(e);if(am(r,n)||this.isSameOhlcBar(n,r)){let r=e>0,n=r?this.valueAt(pg,e-1):0,a=r?this.valueAt(py,e-1):0,o=this.innVal(0,aL.Volume,e);t=(i=n+this.innVal(1,this.source,e)*o)/(s=a+o)}return{[pg.id]:i,[py.id]:s,[aL.AVWAP.id]:t}}},KST:class extends cL{constructor(e,t){super(e,t);let i=this.source,s=f0(i,eh(f6,i),t),r=fq(s,this.inputs.PeriodRoc1,i),n=fq(s,this.inputs.PeriodRoc2,i),a=fq(s,this.inputs.PeriodRoc3,i),o=fq(s,this.inputs.PeriodRoc4,i),l=fF(r,this.inputs.PeriodMa1,aL.ROC,aL.MA1),u=fF(n,this.inputs.PeriodMa2,aL.ROC,aL.MA2),h=fF(a,this.inputs.PeriodMa3,aL.ROC,aL.MA3),c=fF(o,this.inputs.PeriodMa4,aL.ROC,aL.MA4),d=f1(aL.KST,(e,t,i,s,r)=>t+2*i+3*s+4*r,l,u,h,c),p=fF(d,this.inputs.PeriodSig,aL.KST,aL.KSTSIG);this.addInner(d,p)}getWrappers(){return[this.wrapInner(aL.KST,1),this.wrapInner(aL.KSTSIG,2)]}},STC:class extends cL{constructor(e,t){super(e,t);let i=fB(t,this.inputs.PeriodShort,aL.Close,p3),s=f1(p5,(e,t,i)=>t-i,i,fB(t,this.inputs.PeriodLong,aL.Close,p4)),r=this.inputs.PeriodStoch1,n=this.inputs.PeriodStoch2,a=f9(e,"EMA"),o=a(fG(s,r,p6,!1,p5),n,p6,p7),l=a(fG(o,r,p8,!1,p7),n,p8,this.target);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCCLO:class extends fi{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){let s=(e,t,i)=>t-i,r=f1(ft,"Yes"===this.inputs.RatioAdjusted?(e,t,i)=>(t-i)/(t+i)*1e3:s,t,i),n=fB(r,this.inputs.Period1,ft,p9),a=fB(r,this.inputs.Period2,ft,fe);return f1(this.target,s,n,a)}},NHLAI:fn,CMBCI:class extends cL{constructor(e,t){super(e,t);let i=fX(t,this.inputs.Period1Rsi,aL.Close,fa),s=f0(fo,ec(f7,this.inputs.Period1Mom,fa),i),r=fF(fX(t,this.inputs.Period2Rsi,aL.Close,fl),this.inputs.Period2Ma,fl,fu),n=f1(aL.CMBCI,(e,t,i)=>t+i,s,r),a=fF(n,this.inputs.PeriodFastMa,aL.CMBCI,aL.CMBCIF),o=fF(n,this.inputs.PeriodSlowMa,aL.CMBCI,aL.CMBCIS);this.addInner(n,a,o)}getWrappers(){return[this.wrapInner(aL.CMBCI,1),this.wrapInner(aL.CMBCIF,2),this.wrapInner(aL.CMBCIS,3)]}},COTI:class extends cL{constructor(e,t){super(e,new dz({source:aL.Close,inputs:{},outFields:fV("COTLC")},t));let i=Number.parseInt(this.inputs.History),s=fG(this.innerSeries[0],6===i?26:52*i,aL.COTI,!1,aL.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(s)}getWrappers(){return[this.wrapInner(aL.COTI,1)]}},CHEXI:class extends cL{isLong;constructor(e,t){super(e,t),this.isLong="Long"===this.inputs.Direction;let i=this.period,s=fj(t,i),r=this.inputs.Multiplier,n=f1(fh,(e,t)=>null===t?null:r*t,s),a=f$(t,i,aL.High,aL.HH,!0),o=f$(t,i,aL.Low,aL.LL,!1);this.addInner(n,a,o)}calculateAt(e){let t=null,i=null,s=this.innVal(1,fh,e);return null!==s&&(this.isLong?t=this.innVal(2,aL.HH,e)-s:i=this.innVal(3,aL.LL,e)+s),{[aL.CHEXL.id]:t,[aL.CHEXS.id]:i}}},MBBANDS:class extends cQ{constructor(e,t){super(e,"Modified",t)}},OPTIV:class extends fc{},IVRANK:class extends fc{},IVPCTL:class extends fc{},OPTVOLPC:class extends fc{},OPTOIPC:class extends fc{},OPTVOL:class extends fc{},OPTOI:class extends fc{},CHOP:class extends cL{constructor(e,t){super(e,t);let i=fj(t,1),s=this.inputs.Period,r=f$(t,s,aL.High,aL.HH,!0),n=f$(t,s,aL.Low,aL.LL,!1);this.addInner(i,r,n)}calculateAt(e){let t=null,i=this.period;if(e>i){let s=this.past(e,i,aL.ATR,this.innCont(1));if(ey(s)){let r=em(s),n=this.innVal(2,aL.HH,e);t=100*Math.log10(r/(n-this.innVal(3,aL.LL,e)))/Math.log10(i)}}return{[this.target.id]:t}}},MACLD:class extends cL{constructor(e,t){super(e,t);let i=f9(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,aL.MACLD1),r=i(t,e.inputs.Period2,this.source,aL.MACLD2);this.addInner(s,r)}get helpers(){return[aL.BARCOLIX]}calculateAt(e){let t=this.innVal(1,aL.MACLD1,e),i=this.innVal(2,aL.MACLD2,e);return{[aL.BARCOLIX.id]:+(t>i)}}getWrappers(){return[this.wrapInner(aL.MACLD1,1),this.wrapInner(aL.MACLD2,2)]}},BTI:class extends fi{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){let s=f1(fd,(e,t,i)=>t/(t+i),t,i);return f9(e,"MA","Average")(s,this.inputs.Period,fd,this.target)}},FRAMA:class extends cL{constructor(e,t){super(e,t),f4(this);let i=e.inputs.Period,s=Math.floor(i/2),r=f$(t,i,aL.High,fv,!0),n=f$(t,i,aL.Low,fP,!1),a=f$(t,s,aL.High,fC,!0),o=f$(t,s,aL.Low,fb,!1),l=f$(t,s,aL.High,fE,!0),u=f$(t,s,aL.Low,fL,!1);this.addInner(r,n,a,o,l,u)}calculateAt(e){let t=this.period,i=Math.floor(t/2),[,s]=f5(this),r=s.getData(this.source)[e];if(!this.atLeast(e,t))return{[this.target.id]:r};let n=+!!this.sourceNeedsCompute,a=this.innVal(1+n,fv,e),o=this.innVal(2+n,fP,e),l=this.innVal(3+n,fC,e),u=this.innVal(4+n,fb,e),h=this.innVal(5+n,fE,e-i),c=this.innVal(6+n,fL,e-i);if(!eF(a,o,l,u,h,c))return{[this.target.id]:r};let d=(a-o)/t,p=(l-u)/i,f=(h-c)/i,m=0;p>0&&f>0&&d>0&&(m=(Math.log(p+f)-Math.log(d))/Math.log(2));let g=Math.exp(-4.6*(m-1));g=Math.max(.01,Math.min(1,g));let y=e>0?this.container.getData(this.target)[e-1]:r,A=null!==y?g*r+(1-g)*y:r;return{[this.target.id]:A}}},FISHER:class extends cL{constructor(e,t){super(e,t);let i=e.inputs.Period,s=f0(f_,eh(dt,f_),t),r=f$(s,i,f_,aL.HH,!0),n=f$(s,i,f_,aL.LL,!1);this.addInner(s,r,n)}get helpers(){return[fM]}calculateAt(e){let t=this.innVal(1,f_,e),i=this.innVal(2,aL.HH,e),s=this.innVal(3,aL.LL,e);if(!eF(i,s,t))return{[aL.FISHER.id]:null,[aL.FISHTRG.id]:null,[fM.id]:null};let r=i-s,n=t=>this.container.getData(t)[e-1],a=.66*((0!==r?(t-s)/r:.5)-.5)+.67*((e>0?n(fM):null)??0);a>.99?a=.999:a<-.99&&(a=-.999);let o=e>0?n(aL.FISHER):null,l=.5*Math.log((1+a)/(1-a))+.5*(o??0);return{[aL.FISHER.id]:l,[aL.FISHTRG.id]:o,[fM.id]:a}}},PC:class extends cL{stdDevs;periodForecast;unitsPerYear;constructor(e,t){super(e,t),this.unitsPerYear=mt(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=aL.Close,r=aL.HV){return fN("HV",{source:s,target:r,aggregation:i,inputs:fw(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(aL.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(aL.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{[aL.PCUP1.id]:t,[aL.PCDN1.id]:i,[aL.PCUP2.id]:s,[aL.PCDN2.id]:r,[aL.PCUP3.id]:n,[aL.PCDN3.id]:a}}recalculateAt(e,t,i){let s={tag:e1(),src:this.innerSeries[0]};i&&this.calculate(s)}},GREEKS:class extends cL{constructor(e,t){super(e,cb(t,e=>new fp(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(aL.Delta,0),this.wrapInner(aL.Gamma,0),this.wrapInner(aL.Theta,0),this.wrapInner(aL.Vega,0)]}},PVACP:class extends p0{constructor(e,t){super(e,!0,t)}},TDI:class extends cL{constructor(e,t){super(e,t),f4(this);let i=e.inputs.PeriodRSI,s=e.inputs.PeriodTradeSignal,r=e.inputs.PeriodMarketBase,n=e.inputs.PeriodBB,[a]=f5(this),o=fX(this.innerSeries[a],i,this.source,aL.TDIPRC),l=fF(o,s,aL.TDIPRC,aL.TDITSL),u=fF(o,r,aL.TDIPRC,aL.TDIMBL),h=fJ(o,n,aL.TDIPRC,aL.MSD);this.addInner(o,l,u,h)}calculateAt(e){let t=this.inputs.MultiplierBB,i=+!!this.sourceNeedsCompute,s=this.innVal(1+i,aL.TDIPRC,e),r=this.innVal(2+i,aL.TDITSL,e),n=this.innVal(3+i,aL.TDIMBL,e),a=this.innVal(4+i,aL.MSD,e),o=null,l=null;if(eF(n,a)){let e=t*a;o=n+e,l=n-e}return{[aL.TDIPRC.id]:s,[aL.TDITSL.id]:r,[aL.TDIMBL.id]:n,[aL.TDIUPR.id]:o,[aL.TDILWR.id]:l}}},PPS:class extends cL{isLong;isPercent;constructor(e,t){super(e,t);let i=e.inputs.Period,s=e.inputs.Range,r=e.inputs.Direction;this.isLong="Long"===r,this.isPercent="Percent"===e.inputs.Type;let n=aL.Close;"Close"!==s&&(n=this.isLong?aL.High:aL.Low);let a=f$(t,i,n,fT,this.isLong);this.addInner(a)}get helpers(){return[aL.BARCOLIX]}calculateAt(e){let t=null,i=this.innVal(1,fT,e),s=this.inputs.StopValue;if(null!==i){let e=this.isPercent?i*s/100:s;t=this.isLong?i-e:i+e}let r=+!!this.isLong;return{[aL.PPS.id]:t,[aL.BARCOLIX.id]:r}}},RCI:class extends cL{constructor(e,t){super(e,t);let i=new fx({source:this.source,target:aL.RCI,inputs:{Period:e.inputs.Period}},t),s=e.inputs.PeriodSignal,r=f9(e,"MA","Smoothing")(i,s,aL.RCI,aL.RCISIG);this.addInner(i,r)}getWrappers(){return[this.wrapInner(aL.RCI,1),this.wrapInner(aL.RCISIG,2)]}},ZIGZAG:class extends cL{state;useHighLow;isAtrMode;atrMult;percent;constructor(e,t){if(super(e,t),this.useHighLow="High/Low"===e.inputs.Method,this.isAtrMode="ATR"===e.inputs.PercentMode,this.percent=e.inputs.Percent,this.atrMult=e.inputs.MultiplierAtr,this.useHighLow||f4(this),this.isAtrMode){let t=e.inputs.PeriodAtr,[i]=this.useHighLow?[0]:f5(this),s=fj(this.innerSeries[i],t,"SMA",fI);this.addInner(s)}this.resetState()}getHigh(e){if(this.useHighLow)return this.baseVal(aL.High,e);let[,t]=f5(this);return t.getData(this.source)[e]}getLow(e){if(this.useHighLow)return this.baseVal(aL.Low,e);let[,t]=f5(this);return t.getData(this.source)[e]}getAtrDenom(e){if(this.useHighLow)return this.baseVal(aL.Close,e);let[,t]=f5(this);return t.getData(this.source)[e]}setPivot(e,t){this.state.pivotPrice=e,this.state.pivotIndex=t}setCandidate(e,t){this.state.candPrice=e,this.state.candIndex=t}getDevPct(e){if(this.isAtrMode){let t=!this.useHighLow&&this.sourceNeedsCompute?1:0,i=this.innVal(1+t,fI,e),s=this.getAtrDenom(e);return null===i||null===s||0===s?0:this.atrMult*(i/s*100)}return this.percent}pct(e,t){return 0===e?0:(t-e)/e*100}resetState(){this.state={mode:0,pivotPrice:null,pivotIndex:null,candPrice:null,candIndex:null,confirmedPivots:new Map}}calculateAt(e){let t=this.getHigh(e),i=this.getLow(e),s=this.getDevPct(e);if(null===t||null===i)return{};if(0===e){this.resetState();let i=this.useHighLow?this.baseVal(aL.Close,e):t;return this.setPivot(i,e),this.setCandidate(i,e),{}}if(0===this.state.mode)this.pct(this.state.pivotPrice,t)>=s?(this.state.mode=1,this.setCandidate(t,e)):-this.pct(this.state.pivotPrice,i)>=s&&(this.state.mode=-1,this.setCandidate(i,e));else if(1===this.state.mode){let r=t>=this.state.candPrice;r&&this.setCandidate(t,e);let n=(this.state.candPrice-i)/this.state.candPrice*100;if(!r&&n>=s){let t=this.state.candIndex,s=this.state.candPrice;this.state.confirmedPivots.set(t,s),this.setPivot(s,t),this.setCandidate(i,e),this.state.mode=-1}}else if(-1===this.state.mode){let r=i<=this.state.candPrice;r&&this.setCandidate(i,e);let n=(t-this.state.candPrice)/this.state.candPrice*100;if(!r&&n>=s){let i=this.state.candIndex,s=this.state.candPrice;this.state.confirmedPivots.set(i,s),this.setPivot(s,i),this.setCandidate(t,e),this.state.mode=1}}return{}}getCurrentState(){return this.state}}};function fw(e){return{[tY.INPUT_PERIOD]:e}}function fR(e){return{target:e,source:null,inputs:fz}}function fN(e,t,i){if(e$(fO,e))return new fO[e](t,i);let s=AM()?.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 fV(e){return sN(e).defaults.curves.reduce((e,t)=>e.concat(t.fields.filter(t=>!e.includes(t))),[]).map(e=>aL[e])}function fH(e,t,i,s){return{source:t,target:i,inputs:fw(e),allowEmptyValues:s}}function fF(e,t,i,s=aL.MA,r=!1){return fN("MA",fH(t,i,s,r),e)}function fB(e,t,i,s=aL.EMA,r=!1){return fN("MAEXP",fH(t,i,s,r),e)}function fk(e,t,i,s=aL.SMA,r=!1){return fN("MASMO",fH(t,i,s,r),e)}function fW(e,t,i,s=aL.WMA,r=!1){return fN("MAWEI",fH(t,i,s,r),e)}function fU(e,t,i,s=aL.HMA,r=!1){return fN("HMA",fH(t,i,s,r),e)}function f$(e,t,i,s,r,n=!1){return new cK({source:i,target:s,inputs:fw(t)},r,n,e)}function fG(e,t,i,s,r=null){return new cq({source:r,target:i,inputs:fw(t)},s,e)}let fz={};function fY(e,t=aL.TR){return fN("_TR",fR(t),e)}function fj(e,t,i="SMA",s=aL.ATR){return fN("ATR",{target:s,inputs:{[tY.INPUT_PERIOD]:t,[tY.INPUT_SMOOTHING]:i},source:null},e)}function fK(e,t=aL.TP){return fN("TP",fR(t),e)}function fq(e,t,i=aL.Close,s=aL.ROC){return fN("ROC",{source:i,target:s,inputs:fw(t)},e)}function fX(e,t,i,s=aL.RSI,r=!1){return fN("_RSI",{source:i,target:s,inputs:{...fw(t),Modified:r}},e)}function fZ(e,t=aL.MFMUL){return fN("MFV",fR(t),e)}function fJ(e,t,i,s=aL.MSD){return fN("MSD",{source:i,target:s,inputs:fw(t)},e)}function fQ(e,t,i,s=aL.MOVLR){return fN("MOVLR",{source:i,inputs:fw(t),target:s},e)}function f0(e,t,i){return new ds(fR(e),t,i)}function f1(e,t,...i){return new de(fR(e),t,...i)}function f2(e,t,i){return t-i}function f3(e,t,i){return(t-i)/i*100}function f4(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=f0(t,eh(f6,t),e.innerSeries[0]);e.addInner(i)}}function f5(e){let t=+!!e.sourceNeedsCompute;return[t,e.innCont(t)]}let f6=function(e,t){let[i,s,r,n]=[aL.Open,aL.High,aL.Low,aL.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}},f7=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}},f8={sma:fk,ma:fF,ema:fB,wma:fW,hma:fU};function f9(e,t,i="Smoothing"){return f8[(e.inputs[i]??t).toLowerCase()]}let me={atr:fj,adjatr:function(e,t,i="MA",s=aL.Close,r=aL.ADJATR){return fN("ADJATR",{source:s,target:r,inputs:{[tY.INPUT_PERIOD]:t,[tY.INPUT_SMOOTHING]:i}},e)}};function mt(e){switch(e.unit){case G.Day:return 252;case G.Week:return 52;case G.Month:return 12;default:return 0}}function mi(e){let t=[aL.High,aL.Low];return e instanceof pL&&2!==eP(e.targetFields,t).length}function ms(e){return!(e instanceof u8)&&e.query instanceof cP}class mr extends c_{constructor(e,t){super(e,t,fB(t,13,aL.Close),function(e,t,i,s,r=aL.Close){return fN("MACDEXP",{source:r,inputs:{Period1:12,Period2:26,Period3:9},outFields:[aL.MACD,aL.MACDS,aL.MACDH]},e)}(t,0,0,0,aL.Close)),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=W.Same,i=this.innVal(1,aL.EMA,e),s=this.innVal(1,aL.EMA,e-1),r=this.innVal(2,aL.MACDH,e),n=this.innVal(2,aL.MACDH,e-1);return eF(i,s,r,n)&&(i>s&&r>n?t=W.Up:i<s&&r<n&&(t=W.Down)),{[aL.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(aL.Open,aL.High,aL.Low,aL.Close,aL.Change,aL.Volume,aL.OpenInterest,aL.TradingDay)}}function mn(e,t){return eF(t)?(this[e]=t,null):this[e]}class ma{_domain;_range;_extent;_padding;constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return mn.call(this,"_domain",e)}range(e){return mn.call(this,"_range",e)}padding(e){return mn.call(this,"_padding",e)}get ready(){return eF(this._domain,this._range)}}let mo=1/Math.log2(10);function ml(e,t){let i,s,r,n,a=(i=e[0],(s=e[1]-i)>0?e=>(e-i)/s:e=>ep(isNaN(s)?NaN:.5)),o=(r=t[0],n=t[1],e=>r*(1-e)+n*e);return e=>o(a(e))}function mu(e){return Math.sign(e)*Math.log10(1+Math.abs(e/mo))}function mh(e){return Math.sign(e)*mo*(-1+Math.pow(10,Math.abs(e)))}let mc=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]];class md extends ma{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=ep,s=ep;switch(this.scaleType){case X.Linear:break;case X.Logarithmic:i=mu,s=mh;break;default:throw Error("Unexpected scale type (neither linear nor log)")}let r=this._domain.map(i),n=this.rangeWithPadding(),a=t?ml(n,r):ml(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===X.Linear||s<0||r>1e5)return mp(t,i,e);let n=this.findLogBand(s),a=this.findLogBand(r),o=2*e;return a-n==0?mp(t,i,o):this.getLogTicks(n,a,o,i<t)}findLogBand(e){return mc.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]=mc[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=mp(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===X.Logarithmic}}function mp(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 mf={color:tY.COLOR_TRANSPARENT},mm={color:tY.COLOR_TRANSPARENT,width:0,dashStyle:"Solid"},mg=new Set([aL.Open,aL.High,aL.Low,aL.Close].map(e=>e.id)),my=new iR(0,0,0,0);class mA{axis;id;record;metaData;timeSeries;notifyAboutPriceDomains=!1;customPlotValues=!1;_priceMapFirstIndex;priceMapper;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=Z.Symbol;isShutDown=!1;targetFields=[];detachedScale;yScale=null;levels;bands;annotations;visFromIndex;visToIndex;_eventsData;precision;visible=!0;constructor(){this.axis=null,this.id=e1(),this.record=new aO(""),this.metaData=new ir,this.timeSeries=new u8,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&&eF(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(Z.Symbol)}get isExpression(){return this.is(Z.Expression)}get isStudy(){return this.is(Z.Study)}get isForward(){return this.is(Z.Forward)}get isSeasonal(){return this.is(Z.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 cM(i(ub.slice()),e):this.mainCurve.isElderImpulseSystemStyle?t=new mr(i(ub.slice().concat(aL.BREL)),e):this.mainCurve.isPercentChangeStyle&&(t=new d9(i(ub.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=Z[e.type],this.main=e.main,e.levels&&(this.levels=e.levels),e.bands&&(this.bands=e.bands),eF(e.precision)&&(this.precision=e.precision),this.curves=e.curves.map(e=>{let t=new h7;return t.plot=this,t.fromModel(e),t}),e.detachedScale&&(this.detachedScale=e.detachedScale,this.yScale=new md(X.Linear,null)),this.visible=e.visible??!0}initialize(){}shutdown(){eF(this.timeSeries)&&eF(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){let e=this.axis.pane.presenter,t=new cP(null,e.data.aggregation,J.Normal,[eq(eG(e.data,null,"range","from")),eq(eG(e.data,null,"range","to"))]);return t.barsToFetch=e.data.maxDataPoints||tY.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=eG(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 eF(this.detachedScale,this.yScale)&&this.detachedScale}getDetachedScaleMargins(){return tY.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=tY.OUT_OF_SCREEN;for(let i of this.levels.filter(e=>e.visible)){let s=this.priceToY(i.value);i8(e,i9({line:i.line,fill:mf})),iY(e,{x:-1,y:s},{x:t,y:s})}e.restore()}drawBands(e){e.save();let t=tY.OUT_OF_SCREEN;for(let i of this.bands){let s=this.priceToY(i.range.to),r=this.priceToY(i.range.from);i8(e,i9({fill:i.fill,line:mm})),iG(e,new iR(-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!==aL.DateTime):[]}getEventsAt(e){let t=this.eventsSeries.container,i=i=>t.getData(i)[e];return this.getEventFields().map(t=>{let s=i(t);if(!eF(s))return null;let r=this.getEventFor(t);if(!eF(r))return null;let n={field:t,value:s,date:i(aL.DateTime),text:r.title,color:r.color};if(t!==aL.Custom||s!==tY.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?aL.High:i.isTick?aL.Last:aL.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(!eF(r)||!eF(r[0],r[1]))return;let n=(e,t=aL.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===G.Year)return ta(t);if(i===G.Quarter)return nE(t);if(i===G.Month)return tc(t);if(i===G.Week)return nM(t);if(i===G.Day)return tl(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:my}}):[]).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 iR(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===aL.Custom?t:null}hitTestCustomEvent(e){return null!==this.getCustomEventDataAt(e)}tryHandleCustomEventClick(e){let t=this.getCustomEventDataAt(e);return!!eF(t)&&(this.showCustomEventPopup(t),!0)}isEmpty(){let e=this.timeSeries;return eF(e)&&e.hasData&&e.container.isEmpty}draw(e){if(this.visible)for(let t of(eF(this.levels)&&this.drawLevels(e),eF(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(!eF(e)||!this.timeSeries.hasData||!this.shouldPriceMap(i,s))return e;let[r,n]=this.axis.pane.presenter.view.xAxis.xScale.domain()||[];if(!eF(r)||!ow(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&&mg.has(e.id)}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===aL.PreviousClose?aL.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=q.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(q.Percent)||r===q.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 eF(t)?t!==q.None:this.isComparison(q.Percent)||this.isComparison(q.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}}class mS extends mA{_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(!eF(this.timeSeries)||!eF(this.timeSeries.record))return null;let e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(aL[e])}getTimeSeries(){let e=AM().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.resolved,this.mainCurve.style){case $.Renko:case $.Kagi:case $.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case $.Range:t.barsToFetch=4e3;break;case $.LineBreak:t.inputs=this.inputs}let i=this.axis.pane;if(eF(i.alignedToYear)){let e=tI(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:en.Unspecified};this.presenter?.notifyHost(a_.TS_MANYCHANGED,e),this.getEvents()}})}getMetaData(){let e=AM().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(a_.MD_CHANGED,{plot:this})})}getEvents(){if(!this.hasEvents)return;let e=AM().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:J.Events,getHashKey:function(){return Object.values(this).filter(e=>"function"!=typeof e).join("|")}};tY.EVENTS.forEach(e=>{t[e]=eG(this.events,!1,e,"show")}),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then(e=>{e&&this.presenter?.notifyHost(a_.TS_EVENTSCHANGED,{series:this.eventsSeries})})}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return!!eF(this.events)&&tY.EVENTS.some(e=>eG(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 G.Tick:return nH;case G.Intraday:case G.Day:return nw;case G.Week:return nR;case G.Month:return nN;case G.Quarter:return nV;case G.Year:return nI;default:return nH}}(this.axis.pane.presenter.data.aggregation),this._symbol=e.symbol}getEventFor(e){let t=this.events[e.id.toLowerCase()];return eF(t)&&t.show?t:null}async initialize(){return t$.call(this,async()=>(this.resolved=await tm(this.symbol),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class mT extends mS{seriesKind;fundamental;constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${G[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=G[e.fundamental],super.fromModel(e)}makeQuery(){let e=new cP(this.symbol,new nF(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}}class mv{longPressTimeout;constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){let e=AM().config.touchCrosshairDelayMillis;return eF(e)&&Number.isFinite(e)?e:tY.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,i){eO()&&(this.longPressTimeout=setTimeout(()=>this.longPressTriggered(e,t,i),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,i){this.cancelLongPress(),this.performLongPress(e,t,i)}cancelLongPress(){eO()&&eF(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,i){}}function mP(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}class mC extends mv{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){gs(this.annotation,i)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),mP(this.annotation))return;let{point:t,view:i,offset:s}=e;if(!eH(t)||t.axis!==this.annotation.axis)return;i.drawCrosshair({ap:t,offset:s}),this.cursorSet||(this.previous.axis.pane.presenter.view.setCursor(ee.Move),this.cursorSet=!0);let r=iS(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(),ye(this.annotation,this.moved,el.Moved)}}class mb{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(ei.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),mP(this.annotation))return;let{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),eF(t)){let e=this.annotation.points[this.pointIndex],i=iS(t.point,e.point);switch(e.moveDirection){case es.Both:e.update(t.price,t.time);break;case es.Horizontal:e.update(e.price,t.time);break;case es.Vertical:e.update(t.price,e.time)}this.moved=e.moveDirection!==es.None,this.moved&&this.annotation.wasPointMovedByTool(e,i)}this.annotation.requestRedraw()}onMouseUp(e){ye(this.annotation,this.moved,el.PointMoved)}}class mE{anchor;isVertical;axis;constructor(e,t,i){this.anchor=e,this.isVertical=t,this.axis=i}hitTest(e){return!!eF(this.anchor)&&(this.isVertical?Math.abs(e.x-this.anchor.x)<=tY.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=tY.HIT_TEST_TOLERANCE)}draw(e){let t=tY.OUT_OF_SCREEN;this.isVertical?ij(e,this.anchor.x,-t,t):iK(e,this.anchor.y,-t,t)}}class mL{id;axis;_price;_time;passive=!1;moveDirection=es.Both;visible=!0;point;constructor(e,t,i){this.id=e1(),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!==es.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){let e=this.axis.toPoint(this);eF(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)<=tY.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)-tY.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(eF(this.point)){let i=tY.HALF_ANN_POINT_DIMENSION;eF(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 m_(e){return 0===ix(e.fill.color).a?e.line.color:e.fill.color}function mM(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 mx(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 mI{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=e1()}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 tY.EMPTY_ARRAY}getTimeScaleAdornments(){return tY.EMPTY_ARRAY}extractTraits(e=!0){let t=ez(this.traits),i=sP(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:eB(+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=ez(this.defaultTraits)),this.adjustFill&&(this._traits.fill.color=m_(this._traits),this.adjustFill=!1),this._traits}set traits(e){void 0!==e&&eY(this.traits,e,!1)}get activePoints(){return this.points.filter(e=>!e.passive)}get style(){return i9(this.traits)}get defaultTraits(){return i7(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return i9(this.defaultTraits)}get adornStyle(){let e=ez(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=tY.COLOR_TRANSPARENT,i9(e)}get pointsStyle(){let e=ez(this.defaultTraits);return e.line.dashStyle="Solid",i9(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=eF(e);t&&(s||!r)&&i.toPoint(),r&&s&&(this.isSelected||this.drawn)&&(i8(e,this.pointsStyle),i.draw(e,this))})}addPoints(e){for(let t=0;t<e;t++)this.points.push(new mL(this.axis))}toModel(){let e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:ez(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=eF(e)?ez(e):{};eF(t)&&eY(n,t,!1),this.traits=n,eF(i)&&this.updatePoints(i)}priceMap(e){return this.axis.priceMap(e)}flip(e){let t=this.getFlipAnchorIndices();if(!eH(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 mD(e,t,i,s){return function(r,n=!0){let a=new t(r,e,i);return n?r.appendAnnotation(a):a.drawn=!1,eF(s)&&(a.traits=s),a}}class mO{axis;angle;extent;anchor1;anchor2;p1;p2;style;extended;_data;isTrend;constructor(e,t,i,s,r){this.axis=r,eF(e,t)&&(this.angle=iv(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)+tY.OUT_OF_SCREEN}hitTest(e){return!!eF(this.p1,this.p2)&&iP([this.p1,this.p2],e,tY.HIT_TEST_TOLERANCE)}draw(e){eF(this.p1,this.p2)&&(iY(e,this.p1,this.p2),this.extended)}getAdornOffset(e){var t,i;let s=iW(e),r=iB(e,1);return t=this.p1,i=this.p2,-(t.y-i.y)/(t.x-i.x)<0&&(s.y=r+5),s}}class mw{style;axis;rect;constructor(e,t,i,s){this.axis=s,this.rect=new iR(e.x,e.y,t,i)}hitTest(e){return this.rect.contains(e)}draw(e,t){iG(e,this.rect)}}class mR extends mI{countCache;constructor(e,t){super(e,t)}draw(e,t){if(this.prepareDraw(e,t)&&!this.drawn){let t=this.getElements();i8(e,this.style),t.forEach((t,i)=>{i8(e,this.getStyleForElement(t,i)),t.draw(e)}),i8(e,this.adornStyle),this.adornElements(t,e);let i=this.getMarkers();i8(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,!eF(e)||e}get showBackground(){var e;return e=this.traits?.showBackground,!!eF(e)&&e}get backgroundOpacity(){var e;return eF(e=this.traits?.backgroundOpacity)?e:0}fillOnlyStyle(e){return i9({line:{color:tY.COLOR_TRANSPARENT,dashStyle:"Solid",width:0},fill:this.traits[e]})}lineOnlyStyle(e){return i9({fill:{color:tY.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new mO(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return iE(ib(e),this.backgroundOpacity)}getTraitsFor(e){let t={fill:{color:tY.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 mN extends mR{_factors;constructor(e,t){super(e,t)}get factorsPropName(){return tY.AT_FACTORS}get factors(){return i2(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[tY.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[tY.AT_LEVELS_KIND]}get labels(){return this.traits[tY.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[tY.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){let i=this.levelsKind===tY.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+` (${hH(this.axis,e)})`).trim()}return s}getAdornPointAndAlign(e,t){let i=this.labels,s=e instanceof mO,r=(e,t,i)=>({pt:e,align:t,offset:i});switch(i){case tY.AT_LABELS_LEFT:return r(s?e.anchor1:e,Q.Right,-t);default:case tY.AT_LABELS_RIGHT:return r(s?e.anchor2:e,Q.Left,t);case tY.AT_LABELS_CENTER:return r(s?iy(e.anchor1,e.anchor2):e,Q.Center,0)}}getColoredElements(e){let t=this.singleStyle;return this.factors.map(i=>{let s=e(i);return null===s?null:(t||(s.style=i9(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(!eF(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(iU(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(!eF(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);i$(s,o,f,d,r?l:e.style.strokeStyle)}u=e})}getAdornTextPoint(e,t,i,s){let r=iB(e,.75);return iT(i,{x:s,y:!0===t?r/2:t})}}class mV extends mR{lines;constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(tY.AT_FILL)}get rect(){let[e,t,,]=this.getScreenPoints(),i=new mw({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,h$),h=e_(l,+s.time,Number,h$)-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=i9(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 mH extends mL{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 mF{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 eF(this.points[0].point,this.points[1].point)?new iR(this.left,this.top,this.width,this.height):null}}function mB(e){let t=new mL(e),i=new mL(e),s=new mH(e,t,i),r=new mH(e,i,t);return[t,i,s,r]}class mk extends mI{helper;constructor(e,t){super(e,t),this.points=mB(e),this.helper=new mF(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)&&(i8(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&2===e.length&&e.forEach((e,t)=>this.points[t].update(e.price,e.time))}}class mW{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 mF(this.points)}hitTest(e){let t=this.getRect();return!!eH(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 mR{textEditable;_textAnnElement;constructor(e,t){super(e,t),this.textEditable=!0,this.points=mB(e),this.adjustFill=!0}get textLines(){return this.traits[tY.AT_TEXT_LINES]}set textLines(e){this.traits[tY.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!eF(this._textAnnElement)&&this.visible&&(this._textAnnElement=new mW(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 m$ 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 mL(this.axis,t,e))}updateFrom(e,t,i,s,r){super.updateFrom(e,t,i,s,r),eF(e?.textLines)&&(this.textLines=e.textLines)}getElements(){let e=super.getElements(),t=this.pricesPoints.map(e=>new mE(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 mG{annId;annotation;constructor(e){this.annId=e}onKeyDown(e){if(null==this.annId)return;let{key:t,code:i,presenter:s}=e;ew(t,i)&&(eF(this.annotation)&&(this.annotation.axis.deleteAnnotation(this.annotation,!1),s.view.redraw()),g9(s,{toolChange:el.Cancelled,annId:this.annId}))}}class mz extends mG{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=eH(this.annotation);if(i===et.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}),eF(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(ei.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(){ye(this.annotation,!0,el.Created)}isAccidentalMouseUp(e){let{point:t}=e,i=this.annotation.points[0].point;return iA(t.point,i)<tY.HIT_TEST_TOLERANCE}onMouseUp(e){if(void 0===this.annotation)return void yi(e);if(this.isAccidentalMouseUp(e)){this.dragged=!0;return}this.dragged=!1,this.thirdPoint||this.finish()}}class mY extends mz{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}}class mj extends mz{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}),eF(this.annotation)&&this.dragged){let[e,i]=this.annotation.points;i.update(t.price,t.time);let s=iS(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 mK extends mG{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=!eF(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:m_(i7(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[tY.AT_FILL].color}}}onMouseDown(e){let{point:t}=e;if(this.isNew)if(0===this.clicks){if(void 0===t)return void yi(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();tV(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(),ye(t,!0,this.isNew?el.Created:el.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 mq(e){return AM().config.tooltipMovement===e}function mX(){return mq("Draggable")}let mZ=tY.TOOLTIP_STD_LEGACY_CLASS,mJ=tY.TOOLTIP_STD_CLASS,mQ=tY.TOOLTIP_BUBBLE_CLASS;class m0{view;tooltipElem;leftSide;mode;isDrag;canDrag;isToggling;constructor(e){this.view=e,this.isDrag=!1,this.tooltipElem=tk(e.el,"div"),tH(this.tooltipElem,{id:`${e.presenter.elementId}-global-tooltip`,class:`${mJ} ${mZ}`}),this.leftSide=!0,tV(this.tooltipElem,{visibility:"hidden",position:"absolute",cursor:mX()?"move":"default",zIndex:20,top:`${tY.TOOLTIP_Y_OFFSET}px`,left:`${tY.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===tY.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition="none",this.tooltipElem.classList.remove(mJ,mZ),this.tooltipElem.classList.add(mQ),tV(this.tooltipElem,{pointerEvents:"none"});else if(e===tY.TOOLTIP_STD){this.canDrag=mX(),this.tooltipElem.classList.remove(mQ),this.tooltipElem.classList.add(mJ,mZ);let e=tY.TOOLTIP_TOGGLE_SIDE_ANIM_MS;tV(this.tooltipElem,{pointerEvents:"all",top:`${tY.TOOLTIP_Y_OFFSET}px`,left:`${tY.TOOLTIP_X_OFFSET}px`,transition:mq("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*tY.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"),tU(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){tV(this.tooltipElem,{left:`${e}px`,top:`${t}px`})}isAutoMove(){return this.mode===tY.TOOLTIP_STD&&mq("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=tY.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?tY.TOOLTIP_X_OFFSET:e.width-this.tooltipElem.offsetWidth-tY.TOOLTIP_X_OFFSET);this.reposition(i,t)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout(()=>this.isToggling=!1,tY.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}}function m1(e){e.showTooltip&&m2(e,{time:tY.ZERO_DATE,offset:tY.OFFSCREEN_OFFSET,price:0,lastBarRefresh:void 0,justMain:void 0})}function m2(e,{time:t,lastBarRefresh:i,justMain:s,offset:r,price:n}){let a=h2(e,t,r,i,s,n),{mode:o,showMainPlot:l,hideSymbols:u,revealingClose:h}=e.display.tooltip,{includeTimestamp:c,showMainPlot:d,showPlotActions:p}=AM().config.tooltipHeaders||{},f=eF(d)?d:l,m=!!eF(c)&&c,g=!!eF(u)&&u,y=!!eF(h)&&h,A=!!eF(p)&&p,S=t.valueOf()===tY.ZERO_DATE.valueOf();switch(o){case tY.TOOLTIP_CARDS:s||m4(e,a,f,!S,m&&!S,!1,g,y,A,e.hasLegend?e.view?.legend?.getLegendElem().clientHeight:0);break;case tY.TOOLTIP_BUBBLE:if(!S){let t=a.panes.find(e=>{let{top:t,left:i,width:s,height:n}=e.bounds;return new iR(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=hK({...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)})}m4(e,a,f,!1,!1,e.hasLegend,g,y,A);break;case tY.TOOLTIP_STD:if(!S){let t=hK({...a,hideSymbols:g,revealingClose:y,plots:a.panes.map(e=>e.plots).flat()});e.view.tooltip.show(t)}m4(e,a,f,!1,!1,e.hasLegend,g,y,A);break;case tY.TOOLTIP_EXTERNAL:e.notifyHost(a_.CH_TOOLTIPCHANGED,a);break;default:console.warn(`Unknown tooltip mode requested: ${o}`)}}function m3(e,t,i,s,r,n){tV(e,{position:"absolute",display:"flex","flex-direction":t,"flex-wrap":"wrap",left:`${i+tY.CARDS_X_OFFSET}px`,top:`${r+tY.CARDS_Y_OFFSET}px`,maxWidth:`${n-s-2*tY.CARDS_X_OFFSET}px`})}function m4(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,A=`value-title${m?" value-main":""}`,S=Z[h],T=!(["Study","BalanceSheet","IncomeStatement"].includes(S)||"Expression"===S&&!i)||o.hasLegend&&i?"":h1(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),P=a?function(e){let t=hX("moreActions");return`<a class="more-actions" data-plot-id="${e}" data-act="Menu" title="Actions">${t}</a>`}(l):"",C=hY(o)&&e.type===Z.Symbol,b=(m||C)&&(!s||e.values.length>1),E=t?p.map(e=>h0(b?e.abbreviation:"Close"===e.id&&n?d+" ":null,e.value,e.color)).join(" ")+function(e){if(e&&e.length){let t=e.map(e=>h0(`${e.field.name} (${hW(hj,e.date)})`,e.value,e.color)).join(" ");return`Event ${t}`}return""}(f):"",L=!m&&"Expression"!==S,_=p.slice(0,L?p.length:1).map(e=>`<div class="box" style="background-color:${e.color}"></div>`).join(""),M="Name"===g.mainTitle?u:d,x=r?e.visible&&t?"":`${d}`:`${M}`,I=s&&C?`${d} (${x})`:x;g.showMainTitle||(I="");let D=e.isMain?(()=>{let e=o.data?.aggregation.toShortString(),t=o.data?.aggregation.describe();return`<span class="value-main" title="${t}">·${e}·</span>`})():"";return`
|
|
14
|
-
<div class="plot">
|
|
15
|
-
${T} ${v} ${P} ${t?"":_}
|
|
16
|
-
<a class="${A}" ${y?`title="${y}" `:""}data-plot-id="${l}">${I}</a>
|
|
17
|
-
${D} ${E}
|
|
18
|
-
</div>
|
|
19
|
-
`.trim()})(t,a,f,r,l,u,h,e)),y=`${m}${g.join("")}`,A=function(e,t){let i=e>0,s=e<t-1;return`${i?hZ(!0,e):""} ${s?hZ(!1,e):""}`.trim()}(d,t.length);return{id:`bc-tip-${c.id.substring(0,8)}`,isMainPane:f,content:y,moveContent:A,bounds:c.bounds}})}(e,t,i,s,r,a,o,l);c.some(e=>!eF(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=tF(t,h,"div");m3(r,i&&hY(e)?"column":"row",a,o,l+u,c),tB(r,{"bcharts-card":!0,"bcharts-card-main":i,"bcharts-card-first":0===d}),r.innerHTML=s}let p=tN(`#right-${t}`,h);eF(p)||((p=document.createElement("div")).id=`right-${t}`,h.appendChild(p),tB(p,"bcharts-card bcharts-card-move")),tV(p,{position:"absolute",display:"block",right:`${o+tY.CARDS_X_OFFSET}px`,top:`${l+u+tY.CARDS_Y_OFFSET}px`}),p.innerHTML=r})}let m5=null;function m6(){return null===m5&&(m5=AM().config.hostingModel===eo[eo.Application]),m5}class m7 extends mv{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=m6();if(eO()&&!h&&this.warmUp)return(o>7||u>7)&&(this.warmUp=!1,this.preventDefault=o>u),!1;if(this.preventDefault||!eO()||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(ee.Grabbing)}return h||this.preventDefault}finished(){g9(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:e,offset:t,originalEvent:i}){eO()&&gr(e,t,i)}performLongPress(e,t,i){e.enableTooltip(!0),e.resetActiveTool(),e.activeTool.startTouchCrosshairMode(e,t,i)}}let m8=null;class m9 extends mk{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)&&(iG(e,this.getRect()),!0)}}function ge(e,t){return e<t?[e,t]:[t,e]}let gt={line:{width:1,color:"rgba(127, 127, 127, 0.3)",dashStyle:"LongDash"},fill:{color:"rgba(127, 127, 127, 0.1)"}};class gi extends mz{snapToSupported=!1;preventDefault=!1;axis;presenter;constructor(){super(mD("Rectangle",m9,null,gt),!1)}activated(){}deactivated(){eF(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(eF(this.axis,this.presenter)){g9(this.presenter,{toolChange:el.Executed,annId:"ZoomIn"});let e=this.annotation.points,t=ge(e[0].price,e[1].price),i=ge(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=tY.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 gs(e,t){let i=mx(e);i.offset={x:t.x,y:t.y},i.canFlip=null!==e.getFlipAnchorIndices();let s=e.axis.pane.presenter;s.clearSelection(),s.notifyHost(a_.CH_ANNNEEDSCONTEXTMENU,i)}function gr(e,t,i){let s={offset:{x:t.x,y:t.y},chart:e.accessor,originalEvent:i};e.notifyHost(a_.CH_CHTNEEDSCONTEXTMENU,s)}class gn extends mG{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 yi(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),ye(this.annotation,!0,el.Created)):this.annotation.requestRedraw()}applyToPoints(e){this.annotation.points[this.clicks].update(e.price,e.time)}}class ga{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(),ye(i,!0,el.None)}}let go=tY.MARKER_ARROW_ANGLE*Math.PI/180/2;function gl(e,t,i=tY.MARKER_ARROW_LENGTH){return new gu(e,t,i)}class gu{vertex;arrowLen;p1;p2;constructor(e,t,i=tY.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 iP([t,i],e,tY.HIT_TEST_TOLERANCE)||iP([t,s],e,tY.HIT_TEST_TOLERANCE)}draw(e){let{anchor:t,p1:i,p2:s}=this.getArrowPoints();iY(e,t,i),iY(e,t,s)}getArrowPoints(){let e=iv(this.p1,this.p2),t="start"===this.vertex?0:Math.PI,i=e-go+t,s=e+go+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 gh{hitTest(){return!1}draw(){}}class gc extends mR{constructor(e,t){super(e,t),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[tY.AT_EXTEND_PT_1]}get extend2(){return this.traits[tY.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[tY.AT_SHOW_PERCENTDIFF]}get showBarCount(){return this.traits[tY.AT_SHOW_BARCOUNT]}get showRatio(){return this.traits[tY.AT_RATIO]}getElements(){let e=this.points[0].point,t=this.points[1].point,i=new mO(e,t,this.extend1,this.extend2,this.axis),s=[];return this.extend1&&s.push(new mO(i.p1,e,!0,!1,this.axis)),s.push(new mO(e,t,!1,!1,this.axis)),this.extend2&&s.push(new mO(t,i.p2,!1,!0,this.axis)),s}formatRatio(e,t){return` (${eB(e/t,3)})`}formatPercDiff(e,t){let i=(t-e)/e*100,s=i>0?"+":"";return` (${s}${eB(i,2)}%)`}formatPrice(e){return hH(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(iy(i.point,s.point),r);i$(t,this.getBarCount(i.time,s.time).toFixed(0),e,Q.Right)}let n=this.showRatio?this.formatRatio(i.price,s.price):"",a=this.showPrices?this.formatPrice(i.price):"",o=`${a}${n}`.trim();""!==o&&i$(t,o,iT(i.point,r),Q.Right);let l=this.showPercentDiff?this.formatPercDiff(i.price,s.price):"",u=this.showPrices?this.formatPrice(s.price):"",h=`${u}${l}`.trim();""!==h&&i$(t,h,iT(s.point,r),Q.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,gl(t.map(e=>e.point),e)}return console.warn(`There is no marker of ${i} kind`),new gh})}}class gd extends mR{constructor(e,t){super(e,t),this.addPoints(1)}get showTimestamps(){return this.traits[tY.AT_SHOW_TIMESTAMPS]}getElements(){return[new mE(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}}class gp extends mR{constructor(e,t){super(e,t),this.addPoints(1)}getElements(){return[new mE(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}}class gf extends mR{constructor(e,t,i){super(e,t),this.addPoints(2),eF(i)&&eF(i.points)&&i.points.forEach((e,t)=>this.points[t].update(e.price,e.time))}allPoints(){let[e,t]=this.points;return eF(e,e.point,t,t.point)?[e,this.axis.toAnnotationPoint(iy(e.point,t.point)),t]:tY.EMPTY_ARRAY}line2(){return this.traits[tY.AT_LINE_2]}use52WeekPrices(){return this.traits[tY.AT_USE_52WEEK_PRICES]}getElements(){let e=this.allPoints();return e===tY.EMPTY_ARRAY?tY.EMPTY_ARRAY:e.map(e=>new mO({x:-tY.OUT_OF_SCREEN,y:e.point.y},{x:tY.OUT_OF_SCREEN,y:e.point.y},!1,!1,this.axis))}wasPointMovedByTool(e,t){eF(this.use52WeekPrices())&&(this.traits[tY.AT_USE_52WEEK_PRICES]=!1)}getStyleForElement(e,t){let i=this.line2();if(1!==t||!eF(i))return super.getStyleForElement(e,t);let s=ez(this.traits);return s.line=i,i9(s)}getPriceScaleAdornments(){let e=this.allPoints();if(!this.showPrices||e===tY.EMPTY_ARRAY)return super.getPriceScaleAdornments();let t=this.traits.line,i=e.map(e=>({price:e.price,color:t.color})),s=this.line2();return eF(s)&&(i[1].color=s.color),i}getFlipAnchorIndices(){return null}}class gm extends mN{helper;constructor(e,t,i){super(e,t),this.addPoints(i),this.helper=new mL(e)}get showTrendLine(){return this.traits[tY.AT_SHOW_TRENDLINE]}get hasAllPoints(){return eF(...this.points.map(e=>e.point))}get line2(){return this.traits[tY.AT_LINE_2]}get extendLeft(){return this.traits[tY.AT_EXTEND_LEFT]}get extendRight(){return this.traits[tY.AT_EXTEND_RIGHT]}get reverse(){return this.traits[tY.AT_REVERSE]}get levelsRespectLogScale(){return this.traits[tY.AT_LEVELS_RESPECT_LOG_SCALE]}getStyleForElement(e,t){if(e.isTrend){let e=ez(this.traits);return e.line=this.line2,i9(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 mO(e,t,!i&&n,!i&&a,this.axis);return s.isTrend=i,s},h=this.levelsRespectLogScale&&this.axis.scale===X.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 tY.AT_LABELS_LEFT:return this.extendLeft?s({x:r.x,y:e.anchor1.y},Q.Left,t):super.getAdornPointAndAlign(e,t);default:case tY.AT_LABELS_RIGHT:return this.extendRight?s({x:r.x+r.width,y:e.anchor2.y},Q.Right,-t):super.getAdornPointAndAlign(e,t);case tY.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||(iV(i,e.p1),i.lineTo(t.p2.x,e.p1.y),iH(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 gg extends gm{constructor(e,t){super(e,t,2)}}class gy extends gm{constructor(e,t){super(e,t,3)}}let gA=(e,t)=>{let i=new Path2D;return null===e||(iV(i,e.p1),iH(i,e.p2),iH(i,t.p2)),i};class gS extends mN{constructor(e,t){super(e,t),this.addPoints(2)}get reverse(){return this.traits[tY.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 mO(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 mO({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,gA,this.getTextRef(),t)}}class gT extends gS{constructor(e,t){super(e,t)}}class gv{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(iA(this.left,e),iA(this.right,e));else{let{x:i,y:s}=iS(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<=tY.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),iz(e,this.center,this.radius,this.startAngle,this.endAngle,this.isAntiClockwise??!1),e.restore()}}let gP=(e,t)=>{let i=new Path2D,{center:s}=t;if(iV(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 iV(r,n),r.arc(n.x,n.y,e.radius,e.endAngle,e.startAngle,!e.isAntiClockwise),i.addPath(r),i};class gC extends mN{constructor(e,t){super(e,t),this.addPoints(2)}getElements(){let[e,t]=this.getScreenPoints();if(!eF(e,t))return[];let i=iA(e,t),s=iS(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=iA(e,a);return new gv(e,a,l,0,Math.PI,null,o)},o=this.getColoredElements(a);if(this.showTrendLine){let i=new mO(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,gP,this.getTextRef(),t)}}class gb extends gC{constructor(e,t){super(e,t)}getStyleForElement(e,t){if(e.isTrend){let e=ez(this.traits);return e.line=this.line2,i9(e)}return super.getStyleForElement(e,t)}get showTrendLine(){return this.traits[tY.AT_SHOW_TRENDLINE]}get line2(){return this.traits[tY.AT_LINE_2]}}class gE extends mN{constructor(e,t){super(e,t),this.addPoints(2)}get factorsPropName(){return tY.AT_ANGLES}getElements(){let[e,t]=this.getScreenPoints(),{x:i,y:s}=iS(t,e),r=({value:r})=>{let n=(t,i)=>new mO(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,gA,this.getTextRef(),t)}}class gL extends gS{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 mO(e,t,!1,!1,this.axis)].concat(super.getElements())}}class g_ extends gC{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}}class gM extends mR{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 mO(t,{x:t.x+s,y:t.y+r},!1,!0,this.axis)),n.push(new mO(e,{x:e.x+s,y:e.y+r},!1,!0,this.axis)),n.push(new mO(i,{x:i.x+s,y:i.y+r},!1,!0,this.axis)),n.push(new mO(t,i,!1,!1,this.axis)),n}}class gx extends mk{constructor(e,t){super(e,t)}getEllipse(){let e=this.getRect();return null===e?null:new iN(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 gI extends mR{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[tY.AT_EXTEND_PT_1]}get extend2(){return this.traits[tY.AT_EXTEND_PT_2]}getLastPoint(){let[e,t,i]=this.points;var s=iA(e.point,t.point),r=iv(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 mO(e.point,t.point,this.extend1,this.extend2,this.axis)),eF(i?.price)){var r=this.getLastPoint();s.push(new mO(i.point,r,this.extend1,this.extend2,this.axis))}return s}}class gD extends mk{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 tY.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,h$);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":iq(e,i,"0");break;case"one":iq(e,i,"1");break;case"two":iq(e,i,"2");break;case"three":iq(e,i,"3");break;case"four":iq(e,i,"4");break;case"five":iq(e,i,"5");break;case"six":iq(e,i,"6");break;case"seven":iq(e,i,"7");break;case"eight":iq(e,i,"8");break;case"nine":iq(e,i,"9");break;case"question":iq(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}=iX(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:A,left:S,right:T,top:v,bottom:P,halfBaseSize:C}=iX(g);m.beginPath(),m.moveTo(T,A),m.lineTo(y,P),m.lineTo(S,A),m.lineTo(Math.floor(y-C),A),m.lineTo(Math.floor(y-C),v),m.lineTo(Math.floor(y+C),v),m.lineTo(Math.floor(y+C),A),m.closePath(),m.fill(),m.restore();break;case"arrow_right":var b=e,E=i;b.save();let{cx:L,cy:_,left:M,right:x,top:I,bottom:D,halfBaseSize:O}=iX(E);b.beginPath(),b.moveTo(L,I),b.lineTo(x,_),b.lineTo(L,D),b.lineTo(L,Math.floor(_+O)),b.lineTo(M,Math.floor(_+O)),b.lineTo(M,Math.floor(_-O)),b.lineTo(L,Math.floor(_-O)),b.closePath(),b.fill(),b.restore();break;case"arrow_left":var w=e,R=i;w.save();let{cx:N,cy:V,left:H,right:F,top:B,bottom:k,halfBaseSize:W}=iX(R);w.beginPath(),w.moveTo(N,B),w.lineTo(H,V),w.lineTo(N,k),w.lineTo(N,Math.floor(V+W)),w.lineTo(F,Math.floor(V+W)),w.lineTo(F,Math.floor(V-W)),w.lineTo(N,Math.floor(V-W)),w.closePath(),w.fill(),w.restore();break;case"arrow_horizontal":var U=e,$=i;U.save();let{cx:G,cy:z,left:Y,right:j,top:K,bottom:q,halfBaseSize:X}=iX($,1.5),Z=Math.floor(G-(G-Y)/3),J=Math.floor(G+(G-Y)/3);U.beginPath(),U.moveTo(Z,K),U.lineTo(Y,z),U.lineTo(Z,q),U.lineTo(Z,Math.floor(z+X)),U.lineTo(J,Math.floor(z+X)),U.lineTo(J,q),U.lineTo(j,z),U.lineTo(J,K),U.lineTo(J,Math.floor(z-X)),U.lineTo(Z,Math.floor(z-X)),U.lineTo(Z,K),U.closePath(),U.fill(),U.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}=iX(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}=iZ(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}=iZ(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":iq(e,i,"B");break;case"sell":iq(e,i,"S")}return!0}}class gO extends mN{helper;constructor(e,t){super(e,t),this.addPoints(2),this.helper=new mL(e)}getElements(){let e=this.axis.pane.presenter.timeline,{price:t,time:i}=this.points[0],s=e_(e,i,Number,h$),r=e_(e,this.points[1].time,Number,h$),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 mE(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 gw{snapToSupported=!0;isDrawingAnnotation=!0;constructor(){}onMouseMove(e){let{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){if(eO()&&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(a_.CH_ANNPOINTPICKED,s),g9(i,void 0)}}let gR="Closed";class gN extends mR{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,es.Vertical),s(2,es.Vertical),s(3,es.Horizontal),this.twoDecMeta=new is(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(aL.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]=[aL.High,aL.Low,aL.Close].map(e=>this.data(e)),c=e=>e-n;for(let e=n;e<=a;e++)i&&-1===o.refIndex&&eF(this.entryPrice)&&this.entryPrice>=u[e]&&this.entryPrice<=l[e]&&(o.refIndex=c(e)),(!i||o.refIndex>=0&&c(e)>=o.refIndex)&&((!eF(o.highest)||l[e]>o.highest)&&(o.highest=l[e]),(!eF(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=eF(o.highest,o.lowest)&&(this.upperPrice<o.highest||this.lowerPrice>o.lowest)?gR:"Open",o.special=-1===o.highestIndex&&-1===o.lowestIndex||o.highestIndex===o.lowestIndex;let e=eC(o.data);if(o.toPrice=e.close,o.toTime=e.time,o.state===gR)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=eB(t,2)}return o}get dataWindow(){return eF(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,h$),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[tY.AT_ACCOUNT_SIZE]}get risk(){let e=this.traits[tY.AT_RISK_IS_PERCENT],t=this.traits[tY.AT_RISK];return eB(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))}`:tY.NOT_APPLICABLE}get qty(){return Math.floor(this.risk/(this.isLong?this.entryPrice-this.lowerPrice:this.upperPrice-this.entryPrice))}get upperDiff(){return eB(this.upperPrice-this.entryPrice,2)}get amountMultiplier(){return this.isLong?1:-1}get upperAmount(){return eB(this.accountSize+this.amountMultiplier*this.qty*this.upperDiff,2)}get upperPandL(){return eB(this.amountMultiplier*this.upperDiff*this.pointValue,2)}get isCompact(){return this.traits[tY.AT_COMPACT]}get upper(){let e=hH(this.axis,this.priceMap(this.upperPrice)),t=`(${eB(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 eB(this.entryPrice-this.lowerPrice,2)}get lowerAmount(){return eB(this.accountSize-this.amountMultiplier*this.qty*this.lowerDiff,2)}get lowerPandL(){return eB(-this.amountMultiplier*this.lowerDiff*this.pointValue,2)}get lower(){let e=hH(this.axis,this.priceMap(this.lowerPrice)),t=`(${eB(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 eB(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(tY.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(tY.AT_FILL)}get textStyle(){return this.fillOnlyStyle(tY.AT_FILL_TEXT)}get secondaryLineStyle(){return i9({line:{color:this.traits.line.color,dashStyle:"ShortDash"},fill:{color:tY.COLOR_TRANSPARENT}})}wasModifiedByTool(){eF(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 mO(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 mw(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 mw(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 mL(this.axis,this.entryPrice,e.time),i=new mL(this.axis,o.toPrice,o.toTime),s=new mO(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 mw({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(tY.AT_FILL)},{price:this.entryPrice,color:e(tY.AT_LINE)},{price:this.lowerPrice,color:e(tY.AT_FILL2)}]}adornElements(e,t){let[i,s,r]=e;if(this.showTextAdornments){let[e,n]=[!0,!1].map(e=>ik(t,e)),{x:a,y:o,width:l}=s.rect,u=this.textStyle.fillStyle;i$(t,this.upperText,{x:a+l/2,y:o+e},Q.Center,u,ib(this.upperStyle.fillStyle));let{x:h,y:c,width:d,height:p}=r.rect;i$(t,this.lowerText,{x:h+d/2,y:c+p+Math.abs(n)},Q.Center,u,ib(this.lowerStyle.fillStyle));let{p1:f,p2:m}=i,{x:g,y:y}=f,{x:A}=m,S=this.state||tY.NOT_APPLICABLE,T=this.isCompact?`${this.formatDollarValue(this.pAndLValue)}`:`${S} P&L: ${this.formatDollarValue(this.pAndLValue)}, Qty: ${this.qty}`,v=this.isCompact?`${this.riskReward.toFixed(2)}`:`Risk/Reward Ratio: ${this.riskReward.toFixed(2)}`,P=e=>t.measureText(e).width,C=Math.abs(A-g)<1.25*Math.max(P(T),P(v))?y+Math.abs(n)+5:y+e+10,b=ib(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);i$(t,[T,v],{x:g+(A-g)/2,y:C},Q.Center,u,b)}}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}}var gV=["years","months","weeks","days","hours","minutes","seconds"];function gH(e,t){tt(2,arguments);var i=ts(e),s=ts(t),r=i.getTime()-s.getTime();return r<0?-1:r>0?1:r}function gF(e){return(gF="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 gB(e,t){if(tt(2,arguments),!t||"object"!==gF(t))return new Date(NaN);var i=t.years?te(t.years):0,s=t.months?te(t.months):0,r=t.weeks?te(t.weeks):0,n=t.days?te(t.days):0,a=t.hours?te(t.hours):0,o=t.minutes?te(t.minutes):0,l=t.seconds?te(t.seconds):0,u=ts(e),h=s||i?tr(u,s+12*i):u;return new Date((n||r?lX(h,n+7*r):h).getTime()+1e3*(l+60*(o+60*a)))}function gk(e,t,i){tt(2,arguments);var s=uV(e,t)/6e4;return uF(null==i?void 0:i.roundingMethod)(s)}class gW extends mV{markers;display=null;constructor(e,t){super(e,t),this.points=mB(e),this.points[2].visible=!1,this.points[3].visible=!1,this.markers=[new gh]}isPointDrawn(e){return!!super.isPointDrawn(e)&&e.visible}makeLineArrow(e,t,i,s){let r=[iy(e,t),iy(i,s)];return[this.makeLine(r[0],r[1]),gl(r,"end",10)]}get rectColor(){return this.traits[tY.AT_FILL].color}get textColor(){return this.traits[tY.AT_FILL_TEXT].color}getMarkers(){return this.markers}formatDateDifference(e,t){return this.presenter.data.aggregation.isEndOfDay?`${lK(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:n_.locale)?i:o7,l=null!=(r=null==t?void 0:t.format)?r:gV,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){tt(1,arguments);var t=ts(e.start),i=ts(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){tt(2,arguments);var i=ts(e),s=ts(t),r=gH(i,s),n=Math.abs(function(e,t){tt(2,arguments);var i=ts(e),s=ts(t);return i.getFullYear()-s.getFullYear()}(i,s));i.setFullYear(1584),s.setFullYear(1584);var a=gH(i,s)===-r,o=r*(n-Number(a));return 0===o?0:o}(i,t));var r=gH(i,t),n=gB(t,{years:r*s.years});s.months=Math.abs(function(e,t){tt(2,arguments);var i,s=ts(e),r=ts(t),n=gH(s,r),a=Math.abs(function(e,t){tt(2,arguments);var i=ts(e),s=ts(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=gH(s,r)===-n;(function(e){tt(1,arguments);var t=ts(e);return lq(t).getTime()===(function(e){tt(1,arguments);var t=ts(e),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t})(t).getTime()})(ts(e))&&1===a&&1===gH(e,r)&&(o=!1),i=n*(a-Number(o))}return 0===i?0:i}(i,n));var a=gB(n,{months:r*s.months});s.days=Math.abs(lK(i,a));var o=gB(a,{days:r*s.days});s.hours=Math.abs(function(e,t,i){tt(2,arguments);var s=uV(e,t)/36e5;return uF(null==i?void 0:i.roundingMethod)(s)}(i,o));var l=gB(o,{hours:r*s.hours});s.minutes=Math.abs(gk(i,l));var u=gB(l,{minutes:r*s.minutes});return s.seconds=Math.abs(uB(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=ik(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){i$(t,this.text,this.getTextCoord(e[0],t),Q.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(aL.DateTime),n=e_(r,+i,Number),a=e_(r,+s,Number),o=em(this.data(aL.Volume).slice(n,a+1)),l=this.formatter.format(o,aL.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,aL.Close),r=this.formatter.format(i/e,aL.PercentChange);return[`${s} (${r})`]}resetComputedState(){this.display=null}getFlipAnchorIndices(){return[0,1]}}class gU extends gW{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 g$ extends gW{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 gG extends gW{get drawBorder(){return this.traits[tY.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 gz extends mV{constructor(e,t){super(e,t),this.points=mB(e)}get priceLevels(){return i2(this.traits[tY.AT_PRICE_LEVELS])}get timeLevels(){return i2(this.traits[tY.AT_TIME_LEVELS])}get showAngles(){return this.traits[tY.AT_SHOW_ANGLES]}get reverse(){return this.traits[tY.AT_REVERSE]}get showLeftLabels(){return this.traits[tY.AT_SHOW_LEFT_LABELS]}get showRightLabels(){return this.traits[tY.AT_SHOW_RIGHT_LABELS]}get showTopLabels(){return this.traits[tY.AT_SHOW_TOP_LABELS]}get showBottomLabels(){return this.traits[tY.AT_SHOW_BOTTOM_LABELS]}getAngles(e,t){let i=this.getScreenPoints(),s=this.lineOnlyStyle(tY.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=iB(t,1)/2,{x:a,y:o}=tY.DEFAULT_ADORN_OFFSET,l=(e,i,s,r,n)=>{let a=iT(e,i);i$(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,Q.Right,d),this.showRightLabels&&l(e.p2,{x:-a,y:n},h,Q.Left,d)):(this.showTopLabels&&l(e.p1,{x:0,y:o},h,Q.Center,d),this.showBottomLabels&&l(e.p2,{x:0,y:-(2*o)},h,Q.Center,d)),p&&((e,i)=>{let s=new Path2D;iF(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();iF(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 gY=e=>e.map(e=>({...e,dimensions:e.value.split("x").map(Number)})),gj=(e,t)=>1e-7>Math.abs(e-t);class gK extends mV{_parsedFans=null;_parsedArcs=null;constructor(e,t){super(e,t),this.points=mB(e),this._parsedFans=this._parsedArcs=null}get levels(){return i2(this.traits[tY.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[tY.AT_SHOW_RANGES_RATIO]}get arcs(){return i2(this.traits[tY.AT_ARCS])}get fans(){return i2(this.traits[tY.AT_FANS])}get reverse(){return this.traits[tY.AT_REVERSE]}get parsedFans(){return null===this._parsedFans&&(this._parsedFans=gY(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=gY(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[tY.AT_PRICE_BAR_RATIO]}set priceBarRatio(e){this.traits[tY.AT_PRICE_BAR_RATIO]=e}makeStyledLine(e,t,i){let s=this.makeLine(e,t);return this.singleStyle||(s.style=i9(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=gj(r,n)?null:{x:1,y:n/r},o=this.getClipPath();return this.computedArcs.map(({computed:r,traits:n})=>{let l=new gv(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=i9(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 iF(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=eC(s);i(gP(null,e),e,this.applyBackgroundOpacity(this.traits.line.color))}else{let e=null;s.forEach(t=>{let s=gP(e,t),r=t.style.fillStyle;i(s,t,r),e=t})}t.restore()}if(this.showRangesRatio&&null!==this.unit){let e=eC(this.computedLevels),i=(this.singleStyle?this:e).traits.line.color,[,s,r,n]=this.getReversedScreenPoints(),{x:a,y:o}=tY.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?Q.Right:Q.Left;i$(t,p.toFixed(0),c,f,i);let m=iT(n,{x:2*a*u,y:-o*h}),g=l?Q.Left:Q.Right;i$(t,this.formatter.format(d,aL.Close),m,g,i);let y=iT(s,{x:-a*u,y:-o*h});i$(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,!gj(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]}}let gq=(e,t)=>{let i=new Path2D;return null===e||(iV(i,e.p1),iH(i,e.p2),iH(i,t.p2),iH(i,t.p1)),i};class gX extends mN{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[tY.AT_EXTEND_PT_1]}get extend2(){return this.traits[tY.AT_EXTEND_PT_2]}getElements(){let[e,t,i]=this.getScreenPoints(),{x:s,y:r}=iS(i,e),n=i=>{let[s,r]=[e,t].map(e=>iT(e,i));return new mO(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,gq,this.getTextRef(),t)}}class gZ extends mR{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=e2(1,1e3,e.LevelSize),this.alignLeft="Left"===e.Position,this.totalVolume="Total"===e.Volume,this.widthPercent=e2(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}}eH(e.PeriodType)&&(this.periodType=e.PeriodType),this.period=e.Period,this.valueRangePercent=e.ValueRangePercent/100;let t=er[AM()?.config.mode??"Unspecified"];this.usesFinerGrainedAgg=sk(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(!eF(t))return;let i=t[t.length-1],s=this.boxes.length>0?this.boxes[this.boxes.length-1]:null;if(eH(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 iR(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 mw({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 mw({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,A=y&&c?this.upValueStyle:this.upStyle,S=y&&c?this.downValueStyle:this.downStyle,T=y&&c?this.totalValueStyle:this.totalStyle;if(this.totalVolume){let e=g(h,a,n);i.push(m(e,T))}else{let e=g(u,a,n),t=g(l,a,n);i.push(m(t,A),m(e,S,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 mO({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(!ow(e)||!ow(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(tY.AT_FILL)}get upStyle(){return this.fillOnlyStyle(tY.AT_FILL2)}get totalStyle(){return this.fillOnlyStyle(tY.AT_FILL3)}get downValueStyle(){return this.fillOnlyStyle(tY.AT_FILL4)}get upValueStyle(){return this.fillOnlyStyle(tY.AT_FILL5)}get totalValueStyle(){return this.fillOnlyStyle(tY.AT_FILL6)}get backgroundStyle(){return this.fillOnlyStyle(tY.AT_FILL7)}get lineStyle(){return this.lineOnlyStyle(tY.AT_LINE)}getBoxEndFromStart(e){switch(this.periodType){case"VisibleScreen":default:return null;case"Days":return oN(l9(G.Day,this.period)(e),1);case"Bars":{let t=this.axis.pane.presenter.data.aggregation;return oN(l9(t.unit,t.size*this.period)(e),1)}}}getData(){let e=this.axis.pane.presenter.data.aggregation;if(e.isTick||e.hasSpec&&!pQ(e.spec))return;let[t,i]=this.presenter.view.xAxis.xScale.domain()||[];if(!ow(t)||!ow(i))return;let s=l9(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=oN(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(aL.TradingDay),a=e=>{let t=0,i=r[e],s=n[e];for(let a=e;a<r.length;a++)if(tu(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=oN(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=oN(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 aL.UPVOL:return this.totalVolume?null:n.upVolume;case aL.DNVOL:return this.totalVolume?null:n.downVolume;case aL.TOTVOL:return this.totalVolume?n.totalVolume:null;case aL.POC:case aL.VAREA:case aL.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=eH(r)&&eH(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=em(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=em(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(!eF(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===G.Day&&"Bars"===this.periodType){let e=s.getData(aL.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=aL[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=ex(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=ex(e,m)}return this.tallyVolume(i,a,o,l,c,d,p),this.gotData=!0,i}}let gJ=["None","Absolute","Percent"];class gQ extends mR{studyPlotId;displayMode="None";visibleLabelSegments=[];constructor(e,t,i){super(e,t),this.studyPlotId=i}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get studySeries(){return this.studyPlot.timeSeries}setOptions(e){let t=e.ReversalChange;this.displayMode="string"==typeof t&&gJ.includes(t)?t:"None"}formatSegmentValue(e,t){return"Absolute"===this.displayMode?this.formatter.format(t-e,aL.Close):"Percent"===this.displayMode?0===e?"":this.formatter.format((t-e)/e,aL.PercentChange):""}getElements(){if(this.visibleLabelSegments=[],!this.studyPlot.visible||!this.studyPlot.mainCurve.visible)return[];let e=this.studySeries.getCurrentState();if(!e)return[];let t=e.confirmedPivots,i=Array.from(t.keys()).sort((e,t)=>e-t);if(0===i.length)return[];let s=this.presenter.mainPlot?.timeSeries?.container;if(!s||s.size<2)return[];let r=s.getTimeData();if(!r)return[];let n=this.presenter.view,[a,o]=n.xAxis.xScale.domain()||[];if(!a||!o)return[];let l=a.getTime(),u=o.getTime(),h=-1,c=-1;for(let e=0;e<i.length;e++){let t=r[i[e]].getTime();if(-1===h&&t>=l&&(h=Math.max(0,e-1)),t<=u)c=e;else if(-1!==h)break}if(-1===h){if(i.length>0&&r[i[0]].getTime()>u)return[];h=i.length-1,c=i.length-1}else -1===c&&(c=h);c=Math.min(i.length-1,c+1);let d=[];for(let e=h;e<c;e++){let s=i[e],a=i[e+1],o=t.get(s),h=t.get(a),c=n.toX(r[s]),p=this.axis.toY(o),f=n.toX(r[a]),m=this.axis.toY(h);d.push(this.makeLine({x:c,y:p},{x:f,y:m}));let g=r[a].getTime();g>=l&&g<=u&&this.visibleLabelSegments.push({fromPrice:o,toPrice:h,toPoint:{x:f,y:m}})}if(eF(e.pivotPrice)&&eF(e.candPrice)){let t=r[e.pivotIndex].getTime();if(r[e.candIndex].getTime()>=l&&t<=u){let t=n.toX(r[e.pivotIndex]),i=this.axis.toY(e.pivotPrice),s=n.toX(r[e.candIndex]),a=this.axis.toY(e.candPrice);d.push(this.makeLine({x:t,y:i},{x:s,y:a}))}}return d}adornElements(e,t){if("None"===this.displayMode||0===this.visibleLabelSegments.length)return;let i=Math.abs(ik(t,!0));this.visibleLabelSegments.forEach(e=>{let s=this.formatSegmentValue(e.fromPrice,e.toPrice);if(""===s)return;let r=e.toPrice>=e.fromPrice;i$(t,s,{x:e.toPoint.x,y:e.toPoint.y+(r?-i:i)},Q.Right,r?"#16A34A":"#DC2626")})}}let g0=[tY.AT_LINE,tY.AT_LINE_2,tY.AT_LINE_3];class g1 extends mR{studyPlotId;constructor(e,t,i){super(e,t),this.studyPlotId=i}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get studySeries(){return this.studyPlot.timeSeries}isCurveVisible(e){return this.studyPlot.curves[e]?.visible??!1}makeLines(){if(!this.studyPlot?.visible)return null;let e=this.studySeries.getCurrentState();if(!e||null===e.slope||null===e.intercept||null===e.stdDevWidth)return null;let{startIndex:t,endIndex:i,slope:s,intercept:r,stdDevWidth:n,extendLeft:a,extendRight:o}=e;if(null===t||null===i)return null;let l=this.presenter.mainPlot?.timeSeries?.container;if(!l||l.size<2)return null;let u=l.getTimeData();if(!u||u.length<=i)return null;let h=this.presenter.view,c=e=>r+s*(e+1),d=c(0),p=c(i-t+1-1),f=h.toX(u[t]),m=h.toX(u[i]),g=(e,t)=>{let i=this.axis.toY(d+e),s=new mO({x:f,y:i},{x:m,y:this.axis.toY(p+e)},a,o,this.axis);return s._data={lineIndex:t},s};return[g(n,0),g(0,1),g(-n,2)]}getStyleForElement(e,t){let i=g0[e._data?.lineIndex??t],s=this.traits[i];return s?i9({line:s,fill:{color:tY.COLOR_TRANSPARENT}}):super.getStyleForElement(e,t)}getElements(){let e=this.makeLines();return e?e.filter((e,t)=>this.isCurveVisible(t)):[]}adornElements(e,t){let i=this.makeLines();if(!i||!i.every(e=>eF(e.p1,e.p2)))return;let[s,r,n]=i,a=(e,i,s)=>{t.fillStyle=s,t.fill(gq(e,i))};this.isCurveVisible(3)&&a(s,r,this.traits?.[tY.AT_FILL]?.color),this.isCurveVisible(4)&&a(r,n,this.traits?.[tY.AT_FILL2]?.color)}}function g2(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 g3 extends mR{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(tY.AT_LINE),t=this.lineOnlyStyle(tY.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 eH(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 mL(this.axis,this.targetPrice,this.targetDate)],this.pricesCount>1&&this.points.push(new mL(this.axis,this.targetPrice2,this.targetDate)),this.unitsPerYear=mt(this.presenter.data.aggregation),this.anchorPrice=this.mainCont.getLastDataPoint(aL.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=g2(t(this.targetPrice));if(this.pricesCount>1){let e=g2(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 mE(this.points[0].point,!0,this.axis)),e.push(new mE(this.points[0].point,!1,this.axis)),this.pricesCount>1&&e.push(new mE(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(ik(t,e))),s=this.pricesCount>1,r=this.points[0].point,n=s?this.points[1].point:r,a=this.traits.line2.color,o=iD(a),l=iB(t),u=["Above","Below","Between"],h=(e,t)=>`${eB(100*e,2).toFixed(2)}% Probability ${u[t]}`,c=(e,i)=>i$(t,e,i,Q.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 g4=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=eV(a_.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 tY.EVENT_PIN_HIT;let i=e.presenter.selectedAnnotation;void 0!==i&&(t=i.points.find(t=>t.hitTest(e.point)));let s=eC(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(eF(e))this.resetVerticalAxis(e),n=!0;else if(r)this.resetHorizontalAxis(i),n=!0;else if(eO()){let e=i.selectedAnnotation;null!=e?gs(e,t):gr(i,t)}n&&s.redraw()}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!eO())return null;let e=new Date().getTime(),t=eF(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?ei.Meta:ei.Control,h=i===et.Right||l&&i===et.Left&&e.getModifier(ei.Control);this.touchCrosshairMode&&eF(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);let c=this.computePreviousTouchStartDuration();if(eF(c)&&c<tY.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(e),!0;if(!h&&this.isLogoLink(r)&&a.notifyHost(a_.CH_LOGOCLICKED,{chart:a.accessor}),eF(t)&&a.allPlots.some(e=>e.tryHandleCustomEventClick(t.point)))return!0;if(eF(s))return this.resizingPanes=!0,this.lastResizingOffset=r,this.splitter=s,a.enableTooltip(!1),!0;if(eF(n))return eW(a.display.chart.zooming)[0]&&this.startAxisScaling(n,r),!0;if(null!=t){if(e.getModifier(u))return a.activeTool=new gi,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?(this.hideCrosshairAndTooltips(a.view),null==i?gr(a,r,o):i?.locked&&gs(i,r),!0):!!this.touchCrosshairMode||(a.activeTool=new m7(t),a.activeTool.startPan(r),m6());let n=null!=s;return h?(gs(i,r),eO()):(!n||!!s.movable)&&(!!n||!!i.canMove(t.point))&&(a.activeTool=n&&-1!==i.points.indexOf(s)?new mb(i,s):new mC(i,t,r),eO())}return this.prevZoomingOffset=r,!1}onContextMenu(e){return!0}isLogoLink(e){let t=eH(m8)&&m8.logoClickable?m8.rect:null;return eF(t)&&t.contains(e)}onMouseMove(e){let{point:t,splitter:i,priceAxis:s,view:r,presenter:n,offset:a}=e;if(eF(e.pinchZoom)&&e.pinchZoom&&eF(e.pinchDistance))return eF(this.prevPinchDistance)&&(e.delta=this.prevPinchDistance-e.pinchDistance,this.onWheel(e)),this.prevPinchDistance=e.pinchDistance,eO();if(null!=i||this.resizingPanes)r.setCursor(ee.ResizeVertical),this.resizingPanes&&this.resizePanes(r,a);else if(eF(t)){let[e,i]=this.findHit(t);eF(i)?t.presenter.view.setCursor(ee.Crosshair):eF(e)?e.isSelected?t.presenter.view.setCursor(ee.Move):t.presenter.view.setCursor(ee.Hand):t.presenter.view.setCursor(ee.Arrow)}else if(eF(s))eW(n.display.chart.zooming)[0]&&(r.setCursor(ee.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(ee.ResizeHorizontal)}return!t||this.resizingPanes?this.hideCrosshairAndTooltips(r):(this.isLogoLink(a)&&r.setCursor(ee.Hand),this.showCrosshairAndTooltips(r,t,a)),eO()}showCrosshairAndTooltips(e,t,i){t.time&&(!eO()||this.touchCrosshairMode)&&e.drawCrosshair({ap:t,offset:i})&&e.presenter.showTooltip&&m2(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&&m1(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(ee.Arrow),this.touchCrosshairMode=!1}stopResizeZoom(e){this.resizingPanes&&(this.resizingPanes=!1,e.enableTooltip(!0),e.onPaneHeightsUpdated()),this.resizingScale&&this.stopResizingScale(),this.prevZoomingOffset&&delete this.prevZoomingOffset}onMouseUp({presenter:e}){if(this.stopResizeZoom(e),eO()){let t=function(){let e=AM().config.touchCrosshairTimeoutMillis;return eF(e)&&Number.isFinite(e)?e:tY.LONG_PRESS_TIMEOUT_MILLIS}();this.touchCrosshairTimeout=window.setTimeout(()=>{this.hideCrosshairAndTooltips(e.view,!0),this.touchCrosshairMode=!1},t)}}applyZoom(e,t,i=!0){if(!eW(e.display.chart.zooming)[1])return;let s=Math.sign(t)*(eO()?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!!(eO()?"none"!==r:"wheel"===r||"wheel+shift"===r&&i(ei.Shift))&&0!==s&&(e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(),this.applyZoom(t,s),!0)}get useKeyboardShortcuts(){return AM().config.hostingModel!==eo[eo.Application]}onKeyDown(e){let{key:t,code:i,presenter:s}=e;if(eF(s.selectedAnnotation)&&("Backspace"===t||"Delete"===t||8===i||46===i)){let e=s.selectedAnnotation;e.axis.deleteAnnotation(e),s.onAnnotationModifiedByTool(e,el.Deleted)}if(eF(s.selectedAnnotation)&&(ew(t,i)?s.clearSelection():("F2"===t||113===i)&&s.selectedAnnotation instanceof mU&&s.selectedAnnotation.textEditable&&(s.activeTool=new mK(null,s.selectedAnnotation),s.activeTool.startEditing())),eR(t,i)||"ArrowRight"===t||39===i){let e=eR(t,i)?1:-1,r=s.view;r.xAxis.pan(e*r.xAxis.xScale.bar.totalWidth),this.hideCrosshairAndTooltips(r),r.redraw()}let r=window.navigator.platform.toLowerCase().startsWith("mac")?ei.Meta:ei.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(ei.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<tY.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=eB(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=eO()?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()}}},g5=e=>yt(gn,gD,1,e),g6=e=>yt(gn,m$,1,e),g7={Default:()=>function(){return g4},Line:()=>yt(mz,gc,!1),DateRange:()=>yt(mz,gU,!1),PriceRange:()=>yt(mz,g$,!1),DatePriceRange:()=>yt(mz,gG,!1),GannBox:()=>yt(mz,gz,!1),GannSquare:()=>yt(mj,gK),Ray:()=>yt(mz,gc,!1),GannLine:()=>yt(mY,gc,!1),VerticalLine:()=>yt(gn,gd,1),HorizontalLine:()=>yt(gn,gp,1),LongPosition:()=>yt(gn,gN,1,!0),ShortPosition:()=>yt(gn,gN,1,!1),FiftyPercentLine:function(e,t){return eF(e)?yt(ga,gf,e.axis||t.mainAxis,e):yt(gn,gf,2)},FibonacciRetracement:()=>yt(mz,gg,!1),TrendBasedFibExtension:()=>yt(mz,gy,!0),FibonacciFan:()=>yt(mz,gT,!1),FibonacciArcs:()=>yt(mz,gb,!1),FibonacciChannel:()=>yt(mz,gX,!0),GannFan:()=>yt(mz,gE,!1),SpeedResistanceFan:()=>yt(mz,gL,!1),SpeedResistanceArcs:()=>yt(mz,g_,!1),AndrewsPitchfork:()=>yt(gn,gM,3),Rectangle:()=>yt(mz,m9,!1),Ellipse:()=>yt(mz,gx,!1),TrendChannel:()=>yt(mz,gI,!0),SymbolArrowUp:()=>g5("arrow_up"),SymbolArrowDown:()=>g5("arrow_down"),SymbolArrowRight:()=>g5("arrow_right"),SymbolArrowLeft:()=>g5("arrow_left"),SymbolArrowHorizontal:()=>g5("arrow_horizontal"),SymbolArrowVertical:()=>g5("arrow_vertical"),SymbolArcDown:()=>g5("arc_down"),SymbolArcUp:()=>g5("arc_up"),SymbolThumbsUp:()=>g5("thumbs_up"),SymbolThumbsDown:()=>g5("thumbs_down"),SymbolZero:()=>g5("zero"),SymbolOne:()=>g5("one"),SymbolTwo:()=>g5("two"),SymbolThree:()=>g5("three"),SymbolFour:()=>g5("four"),SymbolFive:()=>g5("five"),SymbolSix:()=>g5("six"),SymbolSeven:()=>g5("seven"),SymbolEight:()=>g5("eight"),SymbolNine:()=>g5("nine"),SymbolQuestion:()=>g5("question"),SymbolFishHook:()=>g5("fish_hook"),SymbolBuy:()=>g5("buy"),SymbolSell:()=>g5("sell"),FibonacciTimeZones:()=>yt(mz,gO,!1),Text:()=>yt(mK,mU,null),PickPoint:()=>function(){return new gw},ZoomIn:()=>function(){return new gi},ProfitLoss:g6,RewardRisk:g6,VolumeAtPrice:function(e){return yt(gn,gZ,2,e)},ZigZag:function(e){return yt(ga,gQ,null,e)},ProbabilityCones:function(e){return yt(gn,g3,2,e)},LinearRegressionChannel:function(e){return yt(ga,g1,null,e)}};function g8(e,t=!1,i=null,s=null,r=null){let n=g7[e];return(n=n(s,r))(e,t,i)}function g9(e,t={}){e.enableTooltip(!0),e.resetActiveTool();let{axis:i,annotation:s,toolChange:r,annId:n}=t;eF(i)&&e.onAnnotationsUpdated(i),eF(s)&&e.onAnnotationModifiedByTool(s,r),[el.Cancelled,el.Executed,el.TextChanged].includes(r)&&e.onAnnotationDone(n,r)}function ye(e,t=!0,i=el.None){e.wasModifiedByTool();let s=e.axis;g9(s.pane.presenter,t?{axis:s,annotation:e,toolChange:i}:void 0)}function yt(e,t,i,s){return function(r,n,a){let o=mD(r,t,s,a);return(o.annName=r,n)?o:new e(o,i)}}function yi(e){e.button===et.Right&&g9(e.presenter)}function ys(e,t,i){let s={};s.source=aL[e.source],s.inputs=eK(e.inputs);let r=void 0!==e.target,n=eF(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?[aL[e.target]]:n.map(e=>e.fields).flat()),s.target=r?aL[e.target]:s.outFields[0],s.aggregation=t,s}class yr extends mA{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 eF(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(!eF(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(!eF(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=sN(this.model.study),t=e.meta.decimals;this.metaData=void 0!==t?new is(t):this.basePlot.metaData,eF(e.meta.range)&&(this.range=e.meta.range)}getDetachedScaleMargins(){return"VOL"===this.model?.study&&this.axis?.pane.isMain?tY.VOLUME_DETACHED_SCALE_MARGINS:super.getDetachedScaleMargins()}applySpecifics(e){let t=this.model.study;!0===sN(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?q.Percent:q.None;break}case"PERF":{let t="VisibleStart"===e.inputs.Anchor;this.axis.comparison=t?q.Percent:q.None;break}case"JPI":case"CTTP":case"CTTI":{let t=ex(10,e=>(e+1)*.025),i=([e,i])=>[...t.map(t=>iM(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,eF(this.annotations)||(this.annotations=[]);let t=this.curves[1],i=this.curves[2],s=g8("VolumeAtPrice",!0,{[tY.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[tY.AT_FILL]:{color:this.curves[0].colors[0]},[tY.AT_FILL2]:{color:this.curves[0].colors[1]},[tY.AT_FILL3]:{color:this.curves[0].colors[2]},[tY.AT_FILL4]:{color:i.colors[0]},[tY.AT_FILL5]:{color:i.colors[1]},[tY.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,eF(this.annotations)||(this.annotations=[]);let t=this.curves[1],i=this.curves[2],s=this.curves[3],r=g8("VolumeAtPrice",!0,{[tY.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[tY.AT_FILL]:{color:this.curves[0].colors[0]},[tY.AT_FILL2]:{color:this.curves[0].colors[1]},[tY.AT_FILL3]:{color:this.curves[0].colors[2]},[tY.AT_FILL4]:{color:i.colors[0]},[tY.AT_FILL5]:{color:i.colors[1]},[tY.AT_FILL6]:{color:i.colors[2]},[tY.AT_FILL7]:{color:s.colors[0]}},this.id)(this.axis,!1);r.setOptions(e.inputs),this.annIndex=this.annotations.push(r)-1;break}case"ZIGZAG":{this.customPlotValues=!0,eF(this.annotations)||(this.annotations=[]);let t=g8("ZigZag",!0,{[tY.AT_LINE]:{color:this.curves[0].colors[0],width:this.curves[0].lineWidth,dashStyle:this.curves[0].dashStyle??"Solid"}},this.id)(this.axis,!1);t.setOptions(e.inputs),this.annIndex=this.annotations.push(t)-1;break}case"LINRCHN":{this.customPlotValues=!0,eF(this.annotations)||(this.annotations=[]);let e=this.curves[0],t=this.curves[1],i=this.curves[2],s=this.curves[3],r=this.curves[4],n=g8("LinearRegressionChannel",!0,{[tY.AT_LINE]:{color:e.colors[0],width:e.lineWidth,dashStyle:e.dashStyle??"Solid"},[tY.AT_LINE_2]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle??"Solid"},[tY.AT_LINE_3]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle??"Solid"},[tY.AT_FILL]:{color:s.colors[0]},[tY.AT_FILL2]:{color:r.colors[0]}},this.id)(this.axis,!1);this.annIndex=this.annotations.push(n)-1;break}case"IVRANK":{let t=aL.ImplVolRank1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=aL.ImplVolRank5D;break;case"1-Month":t=aL.ImplVolRank1M;break;case"3-Month":t=aL.ImplVolRank3M;break;case"6-Month":t=aL.ImplVolRank6M;break;case"YTD":t=aL.ImplVolRankYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"IVPCTL":{let t=aL.ImplVolPerc1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=aL.ImplVolPerc5D;break;case"1-Month":t=aL.ImplVolPerc1M;break;case"3-Month":t=aL.ImplVolPerc3M;break;case"6-Month":t=aL.ImplVolPerc6M;break;case"YTD":t=aL.ImplVolPercYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"OPTIV":{let t=[aL.WeighImplVolHigh,aL.WeighImplVol,aL.WeighImplVolLow];switch(e.inputs.TimeFrame){case"1-Day":default:break;case"5-Day":t=[aL.WeighImplVolHigh5D,aL.WeighImplVol5D,aL.WeighImplVolLow5D];break;case"1-Month":t=[aL.WeighImplVolHigh1M,aL.WeighImplVol1M,aL.WeighImplVolLow1M];break;case"3-Month":t=[aL.WeighImplVolHigh3M,aL.WeighImplVol3M,aL.WeighImplVolLow3M];break;case"6-Month":t=[aL.WeighImplVolHigh6M,aL.WeighImplVol6M,aL.WeighImplVolLow6M];break;case"1-Year":t=[aL.WeighImplVolHigh1Y,aL.WeighImplVol1Y,aL.WeighImplVolLow1Y];break;case"YTD":t=[aL.WeighImplVolHighYTD,aL.WeighImplVolYTD,aL.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),eF(this.annotations)||(this.annotations=[]);let i=this.curves[11],s=this.curves[12],r=g8("ProbabilityCones",!0,{[tY.AT_LINE]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle},[tY.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&&!this.isZigZag&&!this.isLinRegChannel)return null;let t=this.curves[0].colors;if(this.isZigZag)return t[0];switch(e){case aL.UPVOL:return t[1];case aL.DNVOL:return t[0];case aL.TOTVOL:return t[2];case aL.POC:case aL.VAREA:case aL.BARBACK:return tY.COLOR_TRANSPARENT;case aL.LINRUP:return t[0];case aL.LINRMID:return this.curves[1].colors[0];case aL.LINRLOW:return this.curves[2].colors[0];default:throw Error("Unexpected Volume At Price field")}}isEmpty(){return!this.isVolAP&&!this.isZigZag&&!this.isLinRegChannel&&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=AM().config.defaultVolumeBarColoring;eF(t)?this.curves[e].attributes=[t[0]]:i(eF(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(aL.Buy)||e.includes(aL.Sell)}getEventFor(e){switch(e){case aL.Buy:return{show:!0,title:"B",color:"#03c03c"};case aL.Sell:return{show:!0,title:"S",color:"#c23b22"};default:return null}}getEventFields(){return this.hasEvents?[aL.Buy,aL.Sell]:[]}async initialize(){if(this.model.basis!==tY.BASIS_MAIN)throw Error("Studies can currently only be based on the main (symbol) plot");return t$.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=ys(this.model,e,this.curves);this.applySpecifics(t);let i=this.basePlot.timeSeries;i instanceof cM&&(i=i.actual),this.timeSeries=fN(this.model.study,t,i),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;let s=this.title,r=this.basePlot.timeSeries instanceof u8;return this.timeSeries.ready().then(e=>{e||r||this.timeSeries.computedServerSide||AP(`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}get isZigZag(){return"ZIGZAG"===this.model.study}get isLinRegChannel(){return"LINRCHN"===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===aL.JPIB.id||e.id===aL.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(aL.JPIB,t),n=s(aL.JPIS,t);if(null===r&&i.id===aL.JPIB.id||null===n&&i.id===aL.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 yn=[aL.Open,aL.High,aL.Low,aL.Close,aL.Volume];class ya extends mA{_expression;exprModel=null;symbols=null;errorText;get title(){return this.expression}get expression(){return this._expression}async parseExpression(){let e=n4(this._expression);if(this.exprModel=null,this.symbols=null,n3(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!eF(this.errorText)}#t(e){return{mapper:e=>e.query.symbol,loadMoreData:!0,recompute:B.Minimum,missing:F.UseNext,stretch:e=>!1,fieldMap:new Map(yn.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 pL(this.exprModel,e,this.#t(t));this.timeSeries=this.wrapIfAdvancedStyle(i);let s=this.title;this.timeSeries.ready().then(e=>{e||AP(`Unable to calculate expression: ${s}`,"error")})}getInnerSeries(){let e=n8(this.exprModel),t=AM().getTimeSeriesDataSource();return e.map(e=>{let i=this.makeQuery();return i.symbol=e,t.getTimeSeries(i)})}getRecord(){if(eF(this.errorText))return;let e=this.metaData.inner.map(e=>[e.symbol,e.resolved]);this.record=new a$(e,ez(this.exprModel)),this.record.ready().then(e=>e)}getMetaData(){this.isValid&&(this.metaData=new ia(this.symbols),this.metaData.ready().then(e=>{e&&(this.getRecord(),this.presenter?.notifyHost(a_.MD_CHANGED,{plot:this}))}))}fromModel(e){super.fromModel(e),this._expression=e.expression}async initialize(){return t$.call(this,async()=>(await this.parseExpression(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class yo extends mA{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=n4(this.forward),t=n3(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=` (${ed(uN(this.offset),lQ(tY.FMT_US_DATE_ONLY))(new Date)})`,this.outField=new aC(`Close_${this.offset}`,Y.Number,K.Forward,`Close (${this.offset})`),this.curves[0].fields[0]=this.outField):(this.suffix="",this.outField=aL.Close);let{yes:t,no:i}=eS(e.symbols,e=>ty(`${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!eF(this.errorText)}getMetaData(){if(this.isValid){let e=Object.values(this.roots).flat();this.metaData=new ia(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(a_.MD_CHANGED,{plot:this})})}}getForwardPolicy(e){return{mapper:e=>e.query.root,loadMoreData:!1,recompute:B.Everything,missing:F.UseNext,stretch:e=>!1,fieldMap:new Map([[aL.Close,this.outField]]),noDataApproach:k.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1,valueProvider:e}}getTimeSeries(){let e=AM().getTimeSeriesDataSource(),t=Object.keys(this.roots),i=0===this.offset?J.Forward:J.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 hr(this.symbols):void 0;this.timeSeries=new pL(this.fwdModel,s,this.getForwardPolicy(r)),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:en.Unspecified};this.presenter?.notifyHost(a_.TS_MANYCHANGED,e)}})}async initialize(){return t$.call(this,async()=>(await this.parseForward(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}let yl=e=>e.substring(0,e.lastIndexOf("::"));class yu extends mA{isAverage;hasComputation;offset;offsets;_seasonal;symbolToOffset;errorText;seaModel=null;isPlain=!1;isFutures=!1;suffix="";outField;symbols;coreModel;coreHasComputation;refSeasonal;get title(){if(this.isAverage){let e="YB ";return this.offset<-1&&(e=`${Math.abs(this.offset)}y `),`${e}Average`}return!this.hasComputation&&(this.symbols?.length??0)>0?this.outField.name:`${this.seasonal}${this.suffix}`}get seasonal(){return this._seasonal}fromModel(e){super.fromModel(e),this.offset=e.offset,this.offsets=e.offsets,this.isAverage=e.offset<0,this._seasonal=this.refSeasonal=e.seasonal}constructSeasonal(e,t){return n7(ae(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 aC(`Close_${t}`,Y.Number,K.Seasonal,`Close${this.suffix}`),this.curves[0].fields[0]=this.outField}applyOffset(e,t){let i=this.isPlain?e:function(e,t){let i=ty(e),s=tv(e),r=tS(e);if(i)return tD(e,t);if(s){let i=tT.exec(e),s=Number.parseInt(i[2]),r=th(tn(new Date(s+(s>79?1900:2e3),0,1),t));return`${i[1]}${tC(r)}${i[3]}`}if(!r)return null;{let i=e.match(tA),s=tD(i[1],t),r=tD(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=n4(this.seasonal,!0),t=n3(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=tb(await tm(e));n.set(e,t)}s=ae(s,e=>n.get(e));let a=(r=Array.from(n.values())).every(e=>ty(e)||tS(e)),o=r.every(e=>tv(e)),l=r.every(e=>!ty(e)&&!tv(e)&&!tS(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=n9(s);let{model:u,symbols:h}=n4(this.isAverage?this.constructAverage(s):this.constructSeasonal(s,this.offset),!0);this.seaModel=u,this.hasComputation=n9(u),this._seasonal=n7(ae(u,yl)),this.symbols=h,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!eF(this.errorText)}getActualSymbols(){return[...new Set(this.symbols.map(yl))]}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){let e=yl(this.symbols[0]);if(this.isPlain)return`${e} ${new Date().getFullYear()-this.offset}`;if(this.isFutures)return tb(e,!0)}return this.title}getMetaData(){if(this.isValid){let e=this.getActualSymbols(),t=1===e.length&&!this.hasComputation&&!this.isAverage,i=AM().getMetaDataSource();this.metaData=t?i.getMetaData(e[0]):new ia(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(a_.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:B.Everything,missing:this.hasComputation?F.UsePrevious:F.UseNone,stretch:e=>this.shouldStretch(e),fieldMap:new Map([[aL.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(e,t)=>0===t.length?this.seaModel:n4(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 tn(new Date,-e)}yearFromOffset(e){return th(this.shiftYears(e))}getCmdtyRange(e){let t=this.shiftYears(e);return[ta(t),function(e){tt(1,arguments);var t=ts(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=AM().getTimeSeriesDataSource(),t=Object.keys(this.symbolToOffset).map(t=>{let i=this.makeQuery();return i.surrogate=t,i.symbol=yl(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&&eF(...i.range)&&(i.range=i.range.map(e=>tn(e,-i.offset))),i.offset>0&&(i.disableStreamingUpdates=!0),e.getTimeSeries(i)});this.timeSeries=new pL(this.seaModel,t,this.seasonalPolicy),this.timeSeries.ready().then(e=>{if(e){let e={series:this.timeSeries,part:en.Unspecified};this.presenter?.notifyHost(a_.TS_MANYCHANGED,e)}})}async initialize(){return t$.call(this,async()=>(await this.parseSeasonal(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}let yh=["bottom","right","left"],yc={bottom:"center",right:"start",left:"end"};class yd{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=eF(r);if(n=n||this.fontSize+this.padding+this.padding+(a?this.padding:0),!yh.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=yc[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+iB(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 yp=(e,t)=>e-1-t-4,yf=(e,t)=>e+1+t+4,ym=Array.from(Array(6),(e,t)=>++t).reverse();function yg(e){return e.curves.filter(t=>e.visible&&t.visible&&(e.type!==Z.Study||t.style!==$.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===Z.Study&&["JPI","CTTP","CTTI"].includes(e.model.study);return null!=s||a||(s=-1!==(n=eT(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 yy{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=e1(),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 yd({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}makePlot(e){let t=null;switch(Z[e.type]){case Z.Symbol:t=new mS;break;case Z.Expression:t=new ya;break;case Z.Study:t=new yr;break;case Z.IncomeStatement:t=new mT(J.IncomeStatement);break;case Z.BalanceSheet:t=new mT(J.BalanceSheet);break;case Z.Forward:t=new yo;break;case Z.Seasonal:t=new yu;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===q.None?t:this.pane.presenter.mainPlot.priceMap(t,void 0,aL.Close,!0)}toTime(e){return this.pane.presenter.view.toTime(e)}toAnnotationPoint(e){return new mL(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===q.None?e:this.pane.presenter.mainPlot.priceMap(e,void 0,aL.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===es.Both||e.moveDirection===es.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<=tY.SNAP_PROXIMITY_PIXELS).reduce((e,t)=>null===e||t.dist<e.dist?t:e,null);eF(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*iv(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(eF(this.pane.presenter.view))return this.snapTo(e)}makeAnnotation(e,t=!0){let i=g8(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.filter(e=>e>=0);for(let n=0;n<i.length;n++){let a=Object.assign({},e);a.curves=[i[n]],a.offset=s[n];let o=a.offset<0;if(o){let e=-1===a.offset;a.offsets=e?r:ex(Math.abs(a.offset),e=>e+1)}else a.offsets=[a.offset];(!o||a.offsets.length>1)&&t.push(a)}break}default:t.push(e)}return t}fromModel(e){this.comparison=q[e.comparison??"None"],this.scale=X[e.scale??"Linear"],this.yScale=new md(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:iM(.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:tY.ANN_DUPLICATE_OFFSET,y:tY.ANN_DUPLICATE_OFFSET}),t.appendAnnotation(i),i.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(e,t){e.isSelected&&this.pane.presenter.clearSelection(),s9(e.name,t.traits),e.updateFrom(t.traits,t.extras,t.isUndoRedo?null:t.points,t.visible,t.locked),t.isUndoRedo&&eF(t.points)&&e.updateActivePoints(t.points),t.isUndoRedo||this.pane.presenter.undoRedoManager.done(mM(e,el.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 eF(this._fullDomain)||(this._fullDomain=this.getDataDomain().domain),this._fullDomain}updateFullDomain(e=null){if(null===e&&this.comparison!==q.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=eF(t),l=o?a(t):0,u=eF(i),h=u?a(i):n.length-1,c=e.curves.map(e=>e.fields).flat().filter(e=>e.id!==aL.Change.id),d=eF(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(!eF(i)||0===i.shift)return[l,h];if(!eF(p[i.id])){let e=i.shiftedTimeDomain;if(!eF(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(eP(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?eI(eM(t.map(e=>f(e)).reduce((e,t)=>t.map((t,i)=>(e[i]||0)+(t||0)),[])),m):t.map(e=>{eI(eM(f(e)),m)})});let A=eu.None,S=[$.Column,$.MultiColumn,$.StackedColumn];if(o&&u&&!e.main&&e.curves.some(e=>S.includes(e.style))){let e=m[0]>0,t=m[1]<0;e?(A=eu.Min,m[0]=0):t&&(A=eu.Max,m[1]=0)}return{domain:m,clamped:A}}getDataDomain([e,t]=[null,null],i=[null,null]){let s=ez(i),r=!1;for(let i of this.plots.filter(e=>!e.hasDetachedScale)){let{domain:n,clamped:a}=this.getPlotDataDomain(i,e,t);eF(n)&&(eI(n,s),r=r||a!==eu.None)}if(!eF(s))return{domain:null};let[n,a]=s;if(!eF(n,a))return{domain:null};let o=[Number(n),Number(a)];o[0]===o[1]&&(o[0]-=1,o[1]+=1);let l=eu.None;return r&&(0===o[0]?l=eu.Min:0===o[1]&&(l=eu.Max)),{domain:o,clamped:l}}setDomain(){let e=this.pane.presenter,t=e.view.xAxis.xScale.domain();if(!eF(t))return;for(let e of this.plots.filter(e=>e.hasDetachedScale)){let{domain:i}=this.getPlotDataDomain(e,t[0],t[1]);eF(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=eG(e.display,!1,"chart","previous","forceVisible");eF(t,i)&&s&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],t))}if(this.yScale.domain(i),eF(i)){let e=this.getPadding(s);eF(e)&&this.yScale.padding(e)}}getInitialPadding(){let e=tw(this.pane.presenter.hostElement),t=tN(`#${tY.HEADER_SIZE_PLACEHOLDER_ID}`,e);if(!eF(t)){tV(t=tk(e,"div"),{display:"none"}),tH(t,{id:tY.HEADER_SIZE_PLACEHOLDER_ID,class:"bcharts-card bcharts-card-first"});let{lineHeight:i}=getComputedStyle(t);isNaN(Number.parseFloat(i))&&tV(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)+tY.CARDS_Y_OFFSET}getPadding(e){let t=this.pane.presenter,i=t.display,s=eG(i,null,"yAxis","minPaddingPercent"),r=eG(i,null,"yAxis","maxPaddingPercent"),n=eF(s),a=eF(r),o=n||a?0:this.getInitialPadding(),l=n?s:tY.PANE_CAP_MIN_PADDING_PERCENT,u=a?r:tY.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===eu.Max?c[0]=tY.PANE_TINY_PADDING_PIXELS:e===eu.Min&&(c[1]=tY.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=iB(e,1.3),r={height:i,approxLineHeight:s,domain:this.yScale.domain()};if(eF(this.ticks)&&eF(r.domain)&&eF(this.lastUsedOptions)&&eF(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=eG(AM().config,null,"overrides","yAxis","tickProvider");if(eF(o)&&"function"==typeof o&&r.height>0&&eF(r.domain)){let e=ez(r);e.autoTicks=ez(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=hH(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(!eF(this.fullDomain))return tY.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(hH(this,t,!0)).width,n=Math.max(...this.fullDomain.map(r)),{innerTickSize:a,tickPadding:o}=this.config,l=eF(this.label)?iB(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(iw(e,this.viewBox),e.font=`${u} ${h}px ${t}`,e.lineWidth=2,e.strokeStyle=i.color,e.textAlign="end",eF(this.label)){e.save(),e.fillStyle=i_(.4)(s),e.translate(0,0);let t=this.onTheRight?1:-1;e.rotate(t*Math.PI/2),e.textAlign="center";let i=iB(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([]),ij(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=hH(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(Z.Symbol)||e.is(Z.Expression);if(o&&h){let t=e.axis.comparison===q.Percent?q.None:q.Percent;a=e.priceMapper(l,n,r,t)}let c=e.hasDetachedScale?e.metaData.format(t,r):void 0,d=eF(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;yg(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,aL.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=iD(n),p=new yd({position:this.onTheRight?"right":"left",fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:s,textColor:d,strokeColor:n,backgroundColor:n}),f=r||hH(this,i),m=this.comparison===q.Percent;eH(a)&&(o=m?hV(this,a):hN(a)),p.draw(e,c,t,f,o)};a?u.forEach(c):ym.forEach(e=>u.filter(t=>t.priority===e).forEach(c))}}let yA=Symbol.for("__dloacip__");class yS{presenter;id;axes;height;alignedToYear;viewBox;constructor(e){this.presenter=e,this.axes=[],this.height=0,this.alignedToYear=null,this.id=e1()}fromModel(e){this.height=e.height,!0===e.alignOnExpirations&&(this.alignedToYear=function(e){let t=e.map(e=>e.plots).flat().filter(e=>Z[e.type]==Z.Symbol).map(e=>e.symbol).map(e=>tI(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 yy(this);return i.primary=0===t,i.fromModel(e),i},this)}getBounds(){return this.viewBox}setViewBox(e){this.viewBox=e}drawBackground(e){eF(this.viewBox)&&(this.drawAxes(e),e.save(),this.clipToNoScales(e),this.drawGrid(e),e.restore())}draw(e){eF(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[yA]&&function(e,{x:t,y:i,height:s,width:r}){if(!eH(m8))return;let{path:n,width:a,height:o,rect:l}=m8,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,aL.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=iC(l);e.save(),e.strokeStyle=o,e.lineWidth=u,e.setLineDash(h),iK(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){iw(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(iC(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=iC(n);e.strokeStyle=r,e.setLineDash(a);let o=this.presenter.view.leftOffset,l=this.viewBox.width-this.presenter.view.rightOffset,u=iJ();u.prolog(e),iK(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",i$(e,AM().config.noDataText||tY.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},Q.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=!eF(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 yT(e,t){return{width:e,spacing:t,get totalWidth(){return this.width+this.spacing},offset:0}}class yv extends ma{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=yT(eG(i,tY.DEFAULT_BAR_WIDTH,"chart","bar","width"),eG(i,tY.DEFAULT_BAR_SPACING,"chart","bar","spacing")),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}extent(e){return mn.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(eF(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(!eF(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,h$)),[s-i+1,s]}adjustDomain(){if(!eF(this._range))return;this.scaleBarToFit();let e=this.deriveExtentsFromBarWidth(this.bar);eF(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,h$)):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>tY.MAXIMUM_BAR_WIDTH||i<tY.MINIMUM_BAR_WIDTH)return!1;let r=yT(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)=>eF(e)?e_(this.timeline,e,Number,h$,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(tY.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>=tY.INTRA_THRESHOLD)for(;r>0&&uV(i,s)<e;)r--,s=this.timeline.at(r);else if(!n.isTick){let t=Math.floor(e/tY.ONE_DAY_MILLIS),s=e=>gk(e,tl(e)),n=s(i),a=i;for(;r>0;){let e=this.timeline.at(r),i=nC(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]=e0(e,t,tY.MINIMUM_BAR_WIDTH,tY.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(){eF(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=tY.DEFAULT_BAR_WIDTH,this.bar.spacing=tY.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(e){return eF(e)&&eF(e[0],e[1])&&e[0]>=0&&e[1]<this.timeline.withPrologEpilogLength&&e[1]-e[0]>=tY.MINIMUM_BARS_VISIBLE}shiftBars(e,t=null){if(!this._extent)return;let i=this._extent.map(t=>t+e);this.isUsableExtent(i)&&(eF(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(!eF(e)||!eF(e[0]))return[];let t=e[0].getTime();return this.timeline.presenter.allPlots.map(e=>e.timeSeries).filter(e=>!!eF(e)&&!!e.hasData&&0!==e.container.size&&!0===e.canLoadMoreData&&t<=e.container.getTimeData()[0].getTime())}}function yP(e){return{date:e,priority:1,text:hR(e)}}class yC{view;xScale;ticks;lastUsedOptions;wasPanned;panningXAxisAllowed;config;isVisible;crosshairIndicator;viewBox;overrideTickGetter;overrideFormatter;contractParityCache;contractParityCacheKey;constructor(e){this.view=e,this.contractParityCache=null,this.contractParityCacheKey=null,this.xScale=new yv(e.presenter.timeline,e.presenter.data.aggregation),this.ticks=null,this.lastUsedOptions=null,this.wasPanned=!1,this.panningXAxisAllowed=eG(e.presenter.display,!0,"xAxis","panning"),this.updateConfigFromModel();let t=e.presenter.renderTo.id,i=eG(AM().config,null,"overrides","xAxis","tickProvider");eF(i)&&"function"==typeof i&&(this.overrideTickGetter=eh(i,t));let s=eG(AM().config,null,"overrides","xAxis","formatter");eF(s)&&"function"==typeof s&&(this.overrideFormatter=eh(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 yd({position:"bottom",fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:a,textColor:s,backgroundColor:iM(.15)(t),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();let e=this.view.presenter.display.period===tY.FIFTY_YEARS_MILLIS;eF(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!!eF(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=iB(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 G.Tick:return new hM(e);case G.Intraday:return new hx(e,e.agg.size);case G.Day:return new hI(e);case G.Week:return new hD(e);case G.Month:case G.Quarter:return new hO(e);case G.Year:return new hw(e);default:throw Error(`Aggregation unit ${G[e.agg.unit]} not supported.`)}}(e);return t?yP:e=>i.getTick(e)}getTicks(e){let t,i;if(eF(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&&eF(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(!eF(e)||Number.isNaN(e.getTime()))return null;let i=s(e);return eF(i)&&(i.index=r+t),i}).filter(e=>eF(e)),this.ticks}normalizeDuration(e){let t=function(){let e=Object.keys(hT);return 1===hT.Day.Multipliers[0]&&e.forEach(e=>{let t=hT[e],i=eQ(t.Period);t.One=+i,t.Multipliers=t.Multipliers.map(e=>e*i)}),hT}(),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<=(eC(n)+eb(a))/2){i=t[s[r]];break}}let r=i.Multipliers,n=r.findIndex(t=>e<t),a=-1===n?eC(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,A=iC(y);e.textAlign="center",e.font=`${l} ${u}px ${o}`,e.lineWidth=1,e.strokeStyle=g,e.fillStyle=i,e.setLineDash([]),iK(e,p,d,d+f);let S=this.xScale.extent(),T=e=>!eF(e)||!eF(e[0],e[1]);if(T(S))return;let v=t=>e.measureText(t).width,P=r>0?r:120,C=this.xScale.domain();if(T(C))return;let b=(C[1].getTime()-C[0].getTime())*P*.6/f,E=this.normalizeDuration(b),L=this.view.presenter.data.aggregation.isEndOfDay,_=d+f,M=({text:i,x:s,date:r,forced:n})=>{eF(r)&&(n||ij(e,s,p,p+h),e.fillText(i,s,p+h+c+.71*u),t.visible&&!n&&(e.save(),e.lineWidth=m,e.setLineDash(A),ij(e,s,0,p),e.restore()))},x={agg:this.view.presenter.data.aggregation,unitWidth:v("M"),barWidth:this.xScale.bar.width,extent:S,formatString:n,minTickInterval:s||0,duration:b},I=this.getTicks(x),D={date:tY.ZERO_DATE,priority:999,x:-999,text:"",index:-1,textWidth:0};I.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>_?_-s:r,e.forced=t!==r}else e.forced=!1;((e,t)=>{let i,r;if(e.date.valueOf()===tY.ZERO_DATE.valueOf())return!0;if(i=e.date,r=t.date,(eF(i)?uV(r,i):tY.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>P||!!L&&a>=E)})(D,e)?(M(D),D=e):e.priority<D.priority&&(D=e)}),M(D),this.drawTimeTransitions(e),this.drawTimeAdornments(e)}drawTransitionsFor(e,t,i,s,r){let n=this.xScale.domain(),a=this.view.presenter?.mainPlot?.timeSeries.container;if(!eH(a))return;let o=a.getTimeData(),l=null===t?o:a.getData(t);if(!eF(l))return;let u=e_(o,+n[0],Number),h=e_(o,+n[1],Number,eL,u);if(u<h){let t=this.viewBox.y,n=this.view.leftOffset,a=this.viewBox.x+this.viewBox.width;if(s.save(),r){s.fillStyle=e.fillColor;let c=l[u],d=Math.max(n,this.xScale.timeToX(o[u]));for(let e=u+1;e<=h;++e){let n=e<l.length?l[e]:null;if(e===h||i(n,c)){let i=e<o.length?o[e]:null,l=eH(i)?this.xScale.timeToX(i):a;l=Math.min(l,a),r(c)%2==0&&s.fillRect(d,0,l-d,t),c=n,d=l}}}let c=iJ();c.prolog(s),s.strokeStyle=e.color,s.lineWidth=e.width,s.setLineDash(iC(e.dashStyle));let d=null;for(let e=u;e<h;++e){let r=l[e];if(i(r,d)){let i=o[e],n=this.xScale.timeToX(i);eF(n,d)&&ij(s,n,0,t),d=r}}c.epilog(s),s.restore()}}drawTimeTransitions(e){let t=this.xScale.domain();if(!eH(t)||!eF(t[0],t[1]))return;let i=this.view.presenter,{xAxis:{contractTransition:s,cycleTransition:r}}=i.display,n=(e,t)=>e!==t;if(s.enabled&&i?.data?.aggregation.isMultiContract){let t=i?.mainPlot?.timeSeries.container,r=t?.getData(aL.Symbol);if(r&&r.length>0){let t=r[0];if(this.contractParityCacheKey!==t||!this.contractParityCache){let e=[...new Set(r)];e.sort((e,t)=>{let i=tI(e),s=tI(t);return(i?.getTime()??0)-(s?.getTime()??0)});let i=0;if(this.contractParityCache)for(let t=0;t<e.length;t++){let s=e[t],r=this.contractParityCache.get(s);if(void 0!==r){i=+((r-t)%2!=0);break}}this.contractParityCache=new Map,e.forEach((e,t)=>this.contractParityCache.set(e,t+i)),this.contractParityCacheKey=t}let i=e=>this.contractParityCache.get(e)??0;this.drawTransitionsFor(s,aL.Symbol,n,e,i)}}r.enabled&&(i?.data?.aggregation.isIntraday?this.drawTransitionsFor(r,aL.TradingDay,n,e,e=>e):i?.data?.aggregation.unit===G.Day?this.drawTransitionsFor(r,null,(e,t)=>!nb(e,t),e,e=>e.getMonth()):i?.data?.aggregation.unit===G.Week&&this.drawTransitionsFor(r,null,(e,t)=>!nI(e,t),e,e=>e.getFullYear()))}getAnnXScore(e,t){return[nC,nx,nb,nI].map((i,s)=>(4-s)*Number(i(e,t))).reduce((e,t)=>e+t,0)}annTimeToX(e){let t=this.xScale.timeToIndex(e);if(!eH(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 iR(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=hF(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=yf(t.x,e.halfWidth)),o<l)e.x=yf(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=yp(e.x,t-n),s=yp(e.x,e.halfWidth-2);e.x=Math.max(s,i,yf(l,a?.halfWidth??0))}}(({x:e,halfWidth:t})=>e+t+4)(e)>t.x+t.width&&(e.x=yp(t.x+t.width,e.halfWidth))})}(r,this.viewBox),r.forEach(t=>{let s=iD(t.color);new yd({position:"bottom",fontSize:this.config.fontSize,fontFamily:i,padding:this.config.indicatorPadding,strokeColor:tY.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(!(eF(u)&&ow(u)))return!1;if(!r)return!0;t=this.xScale.timeToX(u);let h=iC(o);e.strokeStyle=a,e.setLineDash(h);let c=iJ();if(c.prolog(e),ij(e,c.adjust(t),0,c.adjust(this.viewBox.y)),c.epilog(e),!n||!s.visible)return!0;let d=hF(i,u,eF(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 yb={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",dblclick:"onMouseDblClick",contextmenu:"onContextMenu",mouseover:"onMouseEnter",mouseout:"onMouseLeave",wheel:"onWheel",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",keydown:"onKeyDown"},yE={Shift:"shiftKey",Alt:"altKey",Control:"ctrlKey",Meta:"metaKey"};class yL{view;subscriptions;constructor(e){this.view=e,this.subscriptions=[]}init(e){let t=eO();Object.keys(yb).filter(e=>!e.startsWith("touch")||t).forEach(t=>{let i=e=>{let i=yb[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=eO()&&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:et.Left,offset:r,view:t.view,presenter:t,originalEvent:e,getModifier:t=>e[yE[ei[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(eF(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(ei[t])}}}let y_=ub.concat(aL.PercentChange);class yM{view;id;isOptionsChart;constructor(e){this.view=e,this.isOptionsChart=!1,this.id=`bc-legend-${e1()}`}getLegendElem(){let e=this.view.el;return tF(this.id,e,"div")}update(){let e=this.getLegendElem(),t=h3(this.presenter.mainPane);if(!eF(t))return;this.isOptionsChart=this.mainPlot.title.startsWith(tY.FAKE_SYMBOL_PREFIX);let{left:i,right:s,top:r,width:n}=t;m3(e,"row",i,s,r,n),tB(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=y_.map(t=>e.getValue(t));if(ey(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=y_[t],r=this.format(e,s),n=h6(s);return`${this.spanAsName(n)}${this.spanAsValue(r,i)}`}).join(" "),r=this.spanAsValue(`(${this.format(eC(t),eC(y_))})`,i);return`${s} ${r}`}return""}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries?.record?.isValid){let e=AM().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=AM().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?"":yg(e).filter(e=>eF(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)?h1(e.id):"",n="All"===t||e.isSeasonal?"":this.getLastValues(e);return this.div(`${r} ${i} ${s} ${n}`)}).join(" "):""}}class yx{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 yM(this),this.draw=this.draw.bind(this),this.notifyLayoutChanged=function(e,t=100){var i,s;let r;return i=t=>eN(e,t),s=t,r=!1,function(...e){r||(i.apply(this,e),r=!0,setTimeout(function(){r=!1},s))}}(a_.CH_CHTLAYOUTCHANGED,tY.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=>eF(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(eH(s))return void t.onMovePaneClicked(s);let r=this.findSvgParentWithClass(i,"delete-plot");if(eH(r))return void t.deletePlotClicked(r);let n=this.findSvgParentWithClass(i,"show-hide-plot");if(eH(n))return void t.showHidePlotClicked(n);let a=this.findSvgParentWithClass(i,"more-actions");if(eH(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),eF(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)),tV(this.el,{flex:1,display:"flex",position:"relative","flex-direction":"column","touch-action":"pan-x pan-y"}),this.tooltip=new m0(this);let s=AM().config.getCustomEventPopup;this.customEventPopup=s?s(this):null;let{clientHeight:r,clientWidth:n}=this.el;this.width=n,this.height=r,this.canvasContainer=tk(this.el,"div"),tH(this.canvasContainer,{class:"chart-canvas-container"}),tV(this.canvasContainer,{flex:1,display:"flex","flex-direction":"column",position:"relative",height:"100%"}),this.mainCanvas=tk(this.canvasContainer,"canvas");let a={height:`${r}px`,width:`${n}px`,"z-index":2,position:"absolute",top:0,left:0};tV(this.mainCanvas,a),this.mouseCanvas=tk(this.canvasContainer,"canvas"),tH(this.mouseCanvas,{tabIndex:0}),a["z-index"]=3,a.outline="none",tV(this.mouseCanvas,a),this.goToLatestButton=tk(this.el,"button"),tU(this.goToLatestButton,`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
20
|
-
<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>
|
|
21
|
-
</svg>`),tV(this.goToLatestButton,{position:"absolute",right:0,bottom:0,"z-index":3}),tH(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 yC(this),this.eventCapture=new yL(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(n,r);let o=tw(this.el);eF(tN(`.${tY.SVG_ICONS_DOM_NODE}`,o))||function(e){let t=tk(e,"div");tH(t,{class:tY.SVG_ICONS_DOM_NODE});let i=Object.keys(hz).map(e=>`<symbol id="${hq(e)}" viewBox="0 0 1024 1024">${hz[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&&tW(".bcharts-card",this.el).forEach(e=>e.remove()),this.customEventPopup?.hide(),this.drawCrosshair({ap:void 0}),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.resetZoomAndVisibleRange?this.xAxis=new yC(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`};tV(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=>{tH(e,r),tV(e,i)}),this.mainContext.scale(s,s),this.mouseContext.scale(s,s),this.recalculateLayout(),this.presenter&&m1(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=em(r.map(e=>e.height)),a=0,o=tY.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 iR(0,a,this.width,u);e.setViewBox(h);let c=new iR(this.width-this.rightOffset,a,t,u),d=new iR(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 iR(this.leftOffset,a,this.width-this.rightOffset-this.leftOffset,l);this.splitters.push(e),a+=l}});let h=new iR(this.leftOffset,a,this.width-this.rightOffset-this.leftOffset,e);this.xAxis.setViewBox(h),tV(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=AM().config.showGoToLatest,{showGoToLatest:t}=this.presenter.display.chart,i=eF(e)?e:t;this.goToLatestButton.style.display=i&&this.xAxis.canGoToLast()?"block":"none",this.mainContext.restore()}get isHostElementVisible(){return eF(this.el)&&eF(this.el.offsetParent)}redraw(e=!1){this.isHostElementVisible&&(e?this.draw():AM().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=ix(e);return iO(iL(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 ee.Arrow:default:return"default";case ee.Crosshair:return"crosshair";case ee.Hand:return"pointer";case ee.Move:return"move";case ee.ResizeVertical:return"ns-resize";case ee.Grabbing:return"grabbing";case ee.ResizeHorizontal:return"ew-resize"}}(e);tV(this.el,{cursor:t})}shutdown(){this.listeners.forEach(e=>e()),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&tW(".bcharts-card",this.el).forEach(e=>e.remove()),this.canvasContainer.remove()}getEventRadius(){return Math.max(this.xAxis.xScale.bar.width/2,tY.MIN_EVENT_RADIUS)}}class yI{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=tk(this.view.el,"div"),tH(this.popupElement,{id:`${this.view.presenter.elementId}-custom-event-host`}),tV(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=tk(this.popupElement,"a");tH(e,{class:"custom-event-close-button"}),tV(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()),tV(this.popupElement,{visibility:"visible",top:`${e.y}px`,left:`${e.x}px`,width:"310px"}),this.visible=!0}hideValue(){}hide(){this.visible&&(this.hideValue(),tV(this.popupElement,{visibility:"hidden"}),this.visible=!1)}}function yD(e,t){if(!(e.annotations&&e.annotations.length>0))return;let i=t.annotations||[];t.annotations=i.concat(e.annotations)}let yO='..axes{..plots{.type==="Study"}}';var cC=N("c15IW");let yw={ok:!1,change:void 0,toApply:void 0};class yR{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,mM(e,el.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&&eH(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(!eF(e))return!1;switch(t){case el.None:case el.Undo:case el.Redo:AP(`Unexpected tool change ${el[t]} for undo/redo`,"warn");break;case el.Created:i?this.delete(e):this.add(e);break;case el.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?el.Undo:el.Redo;return eF(s)&&this.presenter.onAnnotationModifiedByTool(s,r),!0}can(e){let t=e?this.undoStack:this.redoStack;if(t.length<1)return yw;let i=eC(t),s=i.toolChange;if(!(e&&s!==el.Deleted&&s!==el.Created))return{ok:!0,change:s,toApply:i};let r=eE(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)?yw:{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 yN{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 yV(e={}){let t=this.allPlots;if(!t.every(e=>eF(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(aL.DateTime,0),this.data.aggregation.isMultiContract&&!e.isExpression&&t.set(aL.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?tY.FMT_ISO_DATE_ONLY:tY.FMT_EXPORT_ALL_BUT_MILLIS,o=(e,t)=>e===aL.DateTime?ls(t,a):(eF(s,t)?eB(t,s):t)?.toString()??"",l={},u=this.timeline.lastSeriesIndex,h=eb(this.mainPlot.timeSeries.container.getTimeData()),c=e_(this.timeline,+h,Number,h$),d=(e,t)=>{let i=this.timeline.at(e),s=t.timeSeries.container,r=s.getTimeData(),u=e_(r,+i,Number,eL,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===aL.DateTime)return ls(i,a);else return"";{let i=this.timeline.at(e-n),a=e_(r,+i,Number,eL,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]=`"${Z[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(eh(d,e));null!==t&&f.push(t)}return f.join("\n")}function yH(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),eH(a)){let e=new yN(this);e.update(a),e.draw(l)}let h=this.mainPlot?.timeSeries.container?.getLastDataPoint(aL.DateTime);if(eH(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:tY.CARDS_X_OFFSET,y:tY.CARDS_Y_OFFSET},c=h2(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===Z[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(!(eH(r)&&eH(n)))return c(l.canvas);{let e=o(r,n);return e.drawImage(l.canvas,0,0,r,n),c(e.canvas)}}let yF=Symbol.for("__ias__");class yB{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=g8("Default"),this._activeTool=this.defaultTool,this.timeline=new hG(this),this.undoRedoManager=new yR(this),this.title=new yN(this),this.notifySelectionChanged=eV(a_.CH_ANNSELECTIONCHANGED),this.notifyRecreated=eV(a_.CH_RECREATED),this.notifyDefinitionChanged=eV(a_.CH_DEFINITION_CHANGED)}getModel(){return this.model}get isEmpty(){return!eF(this.model)}notifyHost(e,t){eN(e,t)}async fromModel(e,t){if(this._isShutdown)return;eF(this.model)&&this.allPlots.forEach(e=>e.shutdown()),this.sentInitialLoadNotification=!1,this.clearSelection(),this.model=e;let i=ez(e);this.data=i.data,this.data.aggregation=nO(i.data.aggregation),this.display=i.display,eF(this.display.period)&&(this.display.period=eQ(this.display.period)),this.panes=i.panes.map(e=>{let t=new yS(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),eF(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(yU(nD(Ah(s,t,i)),nD(Ah(s,e,i)))||!yk(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!yk(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=as(t),n=as(e);if(function(e,t){let i=e=>e.curves[0],s=i(e),r=i(t),n=yW.includes(s.style),a=yW.includes(r.style);if(n!==a)return!0;if(!a)return!1;if(s.style!==r.style)return!0;if(t.inputs&&yU(eK(e.inputs),eK(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(){eF(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(eF(this.view)?this.view.reinitialize():(this.view=new yx,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){eF(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,eF(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(a_.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(!eF(r))return;let n=eF(r)&&r.main,a=!1,o=!1;if(e===a_.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;a=!0}let l=eF(t.index)?i.container.getTimeData()[t.index]:null,u=e===a_.TS_EVENTSCHANGED,h=this.view.xAxis,c=h.xScale;if(e===a_.TS_MANYCHANGED||u){if(n&&this.data.checkRange)if(eF(this.display.xAxis.visibleRange)){let e={id:"Period",context:{range:this.display.xAxis.visibleRange}};e[yF]=!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===en.Tail){let e=e_(this.timeline,l,Number,h$);h.shouldScrollIntoView(e)&&c.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach(e=>e.invalidatePriceMappingCache()),a=!0}else if(e===a_.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===a_.TS_DATAPOINTCHANGED&&(o=!0,r.isStudy&&r.invalidateAssociatedAnnotations("DataPointChanged"));if(!u&&s(this.mainPlot)&&i.hasData&&0===i.container.size&&this.notifyHost(a_.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),a&&this.view.recalculateLayout(),o&&(a&&AP("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(),eF(l)&&e.updateFullDomain(l)})),!this.sentInitialLoadNotification&&e===a_.TS_MANYCHANGED&&this.allPlots.every(e=>e.timeSeries&&e.timeSeries.hasData)){this.sentInitialLoadNotification=!0,this.notifyHost(a_.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),m1(this);let e=this.display.period===tY.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(c.fitAllData=!0,c.adjustDomain())}this.view.redraw()}onMetaChanged(e,t){e===a_.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(a_.CH_AXISSCALECHANGED,s)}get previousMask(){return eF(this._previousMask)||(this._previousMask=ax(aL.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some(e=>e.updated&&t)}get hasLegend(){return eF(this._hasLegend)||(this._hasLegend=AM().config.mode===er[er.cmdtyView]),this._hasLegend}onStreamingUpdates(e){eF(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 eF(this._ohlcMask)||(this._ohlcMask=ax(aL.Open,aL.High,aL.Low,aL.Close,aL.PreviousClose)),this._ohlcMask}updateMatches(e,t){if((e&this.ohlcMask)==0)return!1;let i=(e,t)=>eH(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 AM().getRecordSource().subject.pipe(uR(e=>e.filter(e=>this.updateMatches(e.updated,e.data.symbol))),oD(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return eF(this._hostElement)?this._hostElement.id:null}initialize(t){if(this._hostElement=t instanceof HTMLElement?t:tN(`#${t}`),!this._hostElement)throw Error(`There is no element ${t} in the DOM`);this.renderTo=t,this.seriesChangedToken=e(cC).subscribe(a_.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=e(cC).subscribe(a_.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return e(cC).unsubscribe(this.seriesChangedToken),e(cC).unsubscribe(this.metaChangedToken),eF(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach(e=>e.shutdown()),this.model=void 0,this.closeView(),this.notifyHost(a_.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(){eF(this.selectedAnnotation)&&(this.selectedAnnotation.isSelected=!1,this.selectedAnnotation.requestRedraw(),this.selectedAnnotation=void 0),this.notifySelectionChanged({chart:this.accessor})}resetActiveTool(){this.activeTool=this.defaultTool,this.view.setCursor(ee.Arrow)}print(e={}){let t=tk(document.body,"iframe");t.src="",t.style.display="none",t.onload=()=>{let{title:i}=e,s=yH.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),eF(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;let t=this.display.tooltip.mode===tY.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){let t=this.display.tooltip,i=eO();!e&&t.visible&&t.mode===tY.TOOLTIP_CARDS&&tW(".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 sY(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,el.Deleted);return}}throw Error(`Unknown sub-action ${e.id} for action ${tY.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:Z[i[s].type],index:s}}getSimplePlot(e,t){return this.accessor.change({id:"Plot",context:{id:tY.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(a_.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(a_.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(a_.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(a_.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(a_.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},sj(i,`..axes[${s.axisIndex}]`,e=>(e.annotations=s.annotations,e)));try{this.model=aT(a,tY.CHART_SCHEMA)}catch(e){AP(`Cannot update annotation (corrupts definition), error is: ${e.message}`,"error")}t&&this.view.draw(),this.notifyHost(a_.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,i=!0){if(t!==el.None){if(i&&t!==el.Undo&&t!==el.Redo){let i=mM(e,t);this.undoRedoManager.done(i)}let s=mx(e);s.toolChange=el[t],this.notifyHost(a_.CH_ANNMODIFIEDBYTOOL,s)}}onAnnotationDone(e,t){let i={id:e,chart:this.accessor,toolChange:el[t]};this.notifyHost(a_.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=sj(i,(t=e.index,`..panes[${t}]`),t=>(t.height=e.relativeHeight,t))}),i),this.notifyHost(a_.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){let e=this.mainPlot.timeSeries.container;if(!eF(e)||0===e.size)return null;let t=e.getTimeData();return{dataRange:{from:eb(t).getTime(),to:eC(t).getTime()},barCount:e.size}}}function yk(e,t){return e?.from===t?.from&&e?.to===t?.to}let yW=["Renko","Range","LineBreak","Kagi","PointAndFigure"];function yU(e,t){for(let i of Object.keys(e))if(e[i]!==t[i])return!0}let y$="MARKED_FOR_DELETION";function yG(e,t){if(0===t.plots.length)return e;let i=e;return t.plots.forEach(e=>{let t=yj(e.index),s=yK(i,t);eF(s)&&s.type===e.type&&(i=sj(i,t,e=>(e[y$]=!0,e)))}),av(i=sj(i,`..plots{.${y$} === true}`,e=>tY.NULL_OBJECT))}function yz(e,{main:t,type:i,index:s},r){let n="..plots{.main === true}",a=sY(e,"..panes").map((e,t)=>{let i=1===sY(e,n).length;return sY(e,"..axes").map((e,s)=>{let a=1===sY(e,n).length;return sY(e,"..plots").map(e=>{let n=function(e,t,i,s){let r=Z[e.type],n={curves:ez(e.curves),type:e.type};n.precision=e.precision,n.visible=e.visible;let a=(e,t)=>{eF(e[t])?n[t]=e[t].map(e=>ez(e)):n[t]=[]},o=(e,t,i=!1)=>{!0===t.main&&(e.main=!0,e.showPrevious=t.showPrevious,i&&null!=t.events&&(e.events=ez(t.events)))},l=(e,t=e=>!0)=>{eF(s)&&(e.subtitles=s.allPlots.filter(e=>e.type===r).filter(t).map(e=>e.title))};switch(r){case Z.Symbol:{n.title=e.symbol;let t=n.curves[0].style,i=t=>{a(e,"inputs"),0===n.inputs.length&&(n.inputs=ez(t))};switch(t){case"Renko":i(tY.DEFAULT_RENKO_INPUTS);break;case"Kagi":i(tY.DEFAULT_KAGI_INPUTS);break;case"PointAndFigure":i(tY.DEFAULT_PNF_INPUTS);break;case"LineBreak":i(tY.DEFAULT_LINEBREAK_INPUTS);break;case"Baseline":i(tY.DEFAULT_BASELINE_INPUTS)}o(n,e,!0);break}case Z.Study:{a(e,"inputs");let s=sN(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 Z.BalanceSheet:case Z.IncomeStatement:{let t=aL[e.curves[0].fields[0]];n.title=`${t.name} (${e.fundamental.substring(0,1)})`,n.fundamentalId=t.id,n.frequency=e.fundamental;break}case Z.Expression:n.title=e.expression,o(n,e);break;case Z.Forward:n.title=e.forward,a(e,"offsets"),l(n),o(n,e);break;case Z.Seasonal:n.title=e.seasonal,l(n,e=>e.refSeasonal===n.title),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(!eF(i))return a;{let e=a.filter(e=>e.type===i);return eF(s)?e.filter(e=>e.index===s):e}}function yY(e,t){"Study"===e.type&&t.curves?.forEach(e=>delete e.varyColorPerBar),function(e){let t=Z[e.type];return t===Z.Forward||t===Z.Seasonal}(e)?eF(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(eY(r,s),["shift","dashStyle","lineSmoothing","lineMarker"])){let t=s[e];eF(t)&&(r[e]=t)}}}(e.curves,t.curves);let i=Z[t.type];eF(t.precision)?e.precision=t.precision:delete e.precision,i===Z.Symbol?e.symbol=t.symbol:i===Z.Study?(function(e,t,i){let s=eK(e),r=eK(t);eY(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===Z.BalanceSheet||i===Z.IncomeStatement)&&t.frequency?e.fundamental=t.frequency:i===Z.Expression?eF(t.expression)&&(e.expression=t.expression):i===Z.Forward?(eF(t.offsets)&&(e.offsets=t.offsets),eF(t.forward)&&(e.forward=t.forward)):i===Z.Seasonal&&(eF(t.offsets)&&(e.offsets=t.offsets),eF(t.seasonal)&&(e.seasonal=t.seasonal),eF(t.usesInAverage)&&(e.usesInAverage=t.usesInAverage),rr(e))}let yj=e=>`..plots[${e}]`;function yK(e,t){let i=sY(e,t);return 1!==i.length?null:i[0]}let yq=["withMain","overlay","standalone","clone"];function yX(){return{plots:[]}}function yZ(e){let t=e.display.chart.newPaneHeight??1;return{axes:[yX()],height:t}}function yJ(e){let t=yZ(e);return e.panes.push(t),t}function yQ(e,t){let i=eH(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:yJ(e),s=i.axes[0];return t.oppositeScale?y9(i,s):s}function y0(e,t,i){let s=null,{mainPane:r,mainAxis:n}=ar(e);switch(t){case"withMain":s=y9(r,n);break;case"overlay":s=n;break;case"standalone":s=yJ(e).axes[0];break;case"clone":if("number"==typeof i){let t={main:!1,index:i,type:Z[Z.Study]},r=yz(e,t).find(e=>e.index===t.index);s=sY(e,`..panes[${r.paneIndex}]..axes[${r.axisIndex}]`)[0]}}return s}let y1=[{fields:[aL.Close.id],colors:["#888"],style:"Line",lineWidth:2,varyColorPerBar:!1,visible:!0}];function y2(e){return"Symbol"===e.type}let y3={attributes:["OpenVsClose"],colors:["#b63400","#007f3e","#1664db"],fields:["Open","High","Low","Close","Change"],style:"Candlestick",varyColorPerBar:!0,lineWidth:1},y4=0,y5=["#0d223a","#8abc21","#910000","#2f7ed8","#42ccdc","#bf95df","#860262","#e5daa3","#4682e8","#aaa9c1","#fcccdc","#f66b00","#d875be","#e84b46"],y6="Symbol";function y7(e,t){let i={curves:[{attributes:[],colors:y5.slice(y4,y4+1),fields:e?[aL.Last.id]:[aL.Close.id],style:"Line",dashStyle:"Solid",varyColorPerBar:!1,lineWidth:2,lineMarker:void 0,lineSmoothing:void 0}]};return delete t.oppositeScale,ej(i,t),eF(t.curves)&&eY(i.curves,t.curves),y4=(y4+1)%y5.length,i}let y8='..plots{(.type === "Symbol" || .type === "Expression") && .main !== true}';function y9(e,t){let i=e.axes.find(e=>e!==t);return eF(i)||(i=yX(),e.axes.push(i)),i}let Ae=()=>tY.NULL_OBJECT;function At(e){return sj(e,"..axes.annotations",Ae)}function Ai(e){return av(sj(e,'..plots{.type === "Symbol" && .main !== true}',Ae))}let As=".display.chart.previous";function Ar(e,t,i){let s=[],r=i.allPlots[t.index];if(r?.type!==Z[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 An(e,t,i){let s=[],r=i.allPlots[t.index];if(r?.type!==Z[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 Aa(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 Ao(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 Al={MainPlot:ac,Aggregation:{Update:af,Get:function(e,t,i){return ez(e.data.aggregation)}},Period:{Update:function(e,t,i){let s=eF(t.period),r=eF(t.range),n=eF(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,nk(e),nU(e)),r)if((!eF(e.display.period)||ay(e.display.period))&&(e.display.xAxis.visibleRange=t.range),nW(e),nU(e),eF(i)){let s=function(e){let t=e.getDataStats();return null===t?null:t.dataRange}(i),r=nO(e.data.aggregation),n=i.data.aggregation,a=r.unit!==n.unit||r.size!==n.size||r.spec!==n.spec||!eF(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,nk(e),nW(e)),(s||r||n)&&(nB(e),i&&(i.forceResetVisibleRange=!0)),e},Delete:function(e,t,i){return eF(t.period)&&t.period&&(delete e.display.period,ad(e),i&&(i.forceResetVisibleRange=!0)),e}},Crosshair:{Update:function(e,t){let[i,s]=eW(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=sj(e,".display.xAxis.crosshair",e=>(e.enabled=i,l(e,a,o),e));return u=sj(u,".display.yAxis.crosshair",e=>(e.enabled=s,l(e,r,n),e)),eF(t.haloTracking)&&"boolean"==typeof t.haloTracking&&(u=sj(u,".display.chart",e=>(e.plotHover=t.haloTracking,e))),u},Get:function(e,t,i){let s=t=>sY(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 sj(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=sY(e,".display.tooltip")[0];return{visible:s.visible,mode:s.mode,showMainTitle:s.showMainTitle,mainTitle:s.mainTitle}}},Events:function(e,t){let i=ez(t);return Object.keys(t).forEach(e=>{tY.EVENTS.includes(e)||delete i[e];let s=t[e];"boolean"==typeof s?s={show:t[e]}:Object.keys(s).forEach(e=>{tY.EVENT_PROPERTIES.includes(e)||delete s[e]}),i[e]=s}),sj(e,ai,e=>("Symbol"===e.type&&(e.events=e.events||{},Object.keys(i).forEach(t=>{e.events[t]=e.events[t]||{},eY(e.events[t],i[t],!1)})),e))},Scale:{Update:function(e,t){let i=sj(e,"..panes[0]..axes",e=>(eH(t.scale)&&(e.scale=t.scale),e));return i=sj(i,".display.xAxis",e=>(eH(t.marginBars)&&(e.marginBars=t.marginBars),eH(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),eH(t.ordinalName)&&(e.ordinalName=t.ordinalName),eH(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e)),i=sj(i,".display.yAxis",e=>{(eF(t.minPadding)||eF(t.maxPadding))&&AP("The 'minPadding' and 'maxPadding' are deprecated (ignored)","warn");let i=eH(t.preventLabelOverlap)&&!eH(t.preventVerticalLabelOverlap);i&&AP("The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'","warn");let s=i?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return eH(s)&&(e.preventLabelOverlap=s),eF(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),eF(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),e}),eF(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach(e=>{let{axis:t,text:s,index:r,paneIndex:n}=e;eF(t,s,r)&&"vertical"===t&&Number.isInteger(r)&&(i=sj(i,`..panes[${n??0}]..axes[${r}]`,e=>eF(e)?(e.label=s,e):tY.NULL_OBJECT))}),eH(t.contractTransition)&&(i=sj(i,".display.xAxis",e=>(eY(e.contractTransition,t.contractTransition),e))),eH(t.cycleTransition)&&(i=sj(i,".display.xAxis",e=>(eY(e.cycleTransition,t.cycleTransition),e))),i},Get:function(e,t,i){let{mainAxis:s}=ar(e),r=sY(e,".display.xAxis")[0],n=sY(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(eF(t.comparisonMode)&&"string"==typeof t.comparisonMode&&e$(q,t.comparisonMode)&&(s=sj(s,`..panes{${ai}}.axes`,e=>(e.comparison=t.comparisonMode,e))),eF(t.gridLines)){let[e,i]=eW(t.gridLines);s=sj(s,".display.xAxis.gridLines",t=>(t.visible=e,t)),s=sj(s,".display.yAxis.gridLines",e=>(e.visible=i,e))}if(eF(t.minorGridLines)){let[,e]=eW(t.minorGridLines);s=sj(s,".display.yAxis.minorGridLines",t=>(t.visible=e,t))}eF(t.newPaneHeight)&&"number"==typeof t.newPaneHeight&&(s=sj(s,".display.chart{.newPaneHeight > 0}",e=>(e.newPaneHeight=t.newPaneHeight,e))),eF(t.showNavigator)&&"boolean"==typeof t.showNavigator&&(s=sj(s,".display.scrollbar",e=>(e.visible=t.showNavigator,e))),eF(t.plotHover)&&"boolean"==typeof t.plotHover&&(s=sj(s,".display.chart",e=>(e.plotHover=t.plotHover,e))),eF(t.showLastValue)&&"string"==typeof t.showLastValue&&(s=sj(s,".display.yAxis",e=>(e.showLastValue=t.showLastValue,e))),eF(t.showMinMaxArc)&&"boolean"==typeof t.showMinMaxArc&&(s=sj(s,".display.chart",e=>(e.showMinMaxArc=t.showMinMaxArc,e))),eF(t.showGoToLatest)&&"boolean"==typeof t.showGoToLatest&&(s=sj(s,".display.chart",e=>(e.showGoToLatest=t.showGoToLatest,e))),eF(t.showLegend)&&"boolean"==typeof t.showLegend&&(s=sj(s,".display.chart",e=>(e.showLegend=t.showLegend,e)),t.showLegend||i.view.removeLegend()),eF(t.allAnnotationsLocked)&&"boolean"==typeof t.allAnnotationsLocked&&(s=sj(s,".display",e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e))),eF(t.exprSkipLeadingEmpty)&&"boolean"==typeof t.exprSkipLeadingEmpty&&(s=sj(s,".data",e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e)));let r=[];if(eF(t.extendedHours)&&"boolean"==typeof t.extendedHours&&(s=sj(s,".data",e=>(e.extendedHours=t.extendedHours,e))),eF(t.realTimeCboeBzx)&&"boolean"==typeof t.realTimeCboeBzx&&(s=sj(s,".data",e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&r.push("realTimeCboeBzx"),e.realTimeCboeBzx=t.realTimeCboeBzx,e))),eF(t.buildContinuation)&&"boolean"==typeof t.buildContinuation&&(s=sj(s,".data",e=>(e.buildContinuation=t.buildContinuation,e))),r.length>0){let e={chart:i.accessor,hostPropsChanged:r};i.notifyHost(a_.CH_HOST_PROPS_CHANGED,e)}return s},Get:function(e,t,i){let s=sY(e,`..panes{${ai}}.axes.comparison`)[0],r=e.display,n=(e,t)=>eG(e,!1,t,"visible"),a=e=>(function(e,t){let i=e=>eF(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=eG(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=sN(t.studyId);if(!eH(i))return AP(`Unknown or unavailable study with the id '${t.studyId}'`,"error"),e;let s=as(e),r=sB(i);if(s.type===Z[Z.Expression]&&r)return AP(`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),yY(a,t);let o=y0(e,n,t.cloneIndex);eF(o)&&o.plots.push(a);let l=e.data.aggregation;return ap(e,"Tick"===l.unit&&"None"===l.spec)}(e,t);case"IncomeStatement":case"BalanceSheet":return function(e,t){let i=as(e);if(i.type!==Z[Z.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:K[aL[t.fundamentalId].category],visible:!0};return yY(r,t),e.panes.push({axes:[{plots:[r]}]}),e}(e,t);case"Expression":let i=as(e),s={curves:ez(y2(i)?i.curves:y1),expression:"",type:"Expression",visible:!0};return yY(s,t),yQ(e,t).plots.push(s),e;case"Symbol":return function(e,t){let i=as(e),s=AM().getDefaultMultiFieldCurve(),r=eF(s)?s:y3,n=i.curves?.length,a={curves:n===t.curves.length&&1===n?ez(y2(i)?i.curves:[r]):t.curves,symbol:"",type:"Symbol",visible:!0};return yY(a,t),yQ(e,t).plots.push(a),e}(e,t);case"Seasonal":let r={curves:ez(y1),offsets:[0],seasonal:"",type:"Seasonal",visible:!0,main:!1};return yY(r,t),t.paneIndex=t.paneIndex??0,yQ(e,t).plots.push(r),e;default:throw Error("Unexpected plot type '${type}', not supported currently")}},Get:yz,Delete:yG,Update:function(e,t,i){if(eF(t.placement)&&!yq.includes(t.placement))throw Error(`Unknown placement: ${t.placement}`);let s=t.main?ai:yj(t.index),r=yK(e,s);if(!eH(r)||eH(t.type)&&r.type!==t.type)return e;if(eH(t.visible))return r.visible=t.visible,e;if(r.main&&function(e){let t=Z[e.type];return t===Z.Symbol||t===Z.Expression}(r)){if(t.curves){let i=e=>e.curves[0].style===$[$.Range],[s,n]=[i(r),i(t)];s&&!n?e=af(e,{unit:"Day",size:1,spec:"None"}):!s&&n&&(e=af(e,{unit:"Intraday",size:100,spec:"PerRange"}))}return t.type||(t.type=r.type),eF(t.precision)?r.precision=t.precision:delete r.precision,eF(t.showPrevious)&&(e=sj(e,ai,e=>(e.showPrevious=t.showPrevious,e))),t.curves?nY(e,t):e}{let r=sj(e,s,e=>(yY(e,t),e)),n=yz(r,t,i).find(e=>e.index===t.index);if(!eF(n))return e;if(!(t.type===Z[Z.Study]&&eF(t.placement)&&t.placement!==n.placement))return r;let a=yK(r,s),o=y0(r=yG(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}=eS((eF(t.symbols)&&(AP("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=y6,e))),t.plots?.some(e=>eF(e.leftScale)))?(AP("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}=ar(e);r.alignOnExpirations=t.alignOnExpirations||!1;let a=y9(r,n),o=e=>![y6,"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;y4=0;let h=eh(y7,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),av(e)},Get:function(e,t){let i=sY(e,y8),{mainPane:s,mainAxis:r}=ar(e),n=[];for(let e of i){let t=r.plots.includes(e),i=e.type.toLowerCase(),s={curves:ez(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=sY(e,"..panes").map((e,t)=>sY(e,"..axes").map((e,i)=>sY(e,".annotations").map(e=>({...e,paneIndex:t,axisIndex:i})))).flat(2).map((e,t)=>({...e,index:t}));return eF(t.index)&&Number.isFinite(t.index)?t.index<s.length?[s[t.index]]:tY.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=ez(e);if(t.strip.main){let e=as(i),t=e.type.toLowerCase();e[t]=tY.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(i=At(i)),t.strip.compare&&(i=Ai(i)),i=sj(i,".data",e=>(e.range&&(delete e.range,e.checkRange=!0),e))},Outline:function(e,t,i){let s=yz(e,{main:!0},i)[0],r=s.title===tY.PLACEHOLDER_SYMBOL_NAME,n="Symbol"===s.type,a="Expression"===s.type,o=n4(s.title),l=[];return a&&!n3(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:sY(e,y8).map(e=>e.symbol),annotations:sY(e,"..annotations").map(e=>e.id),studies:yz(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=sj(e,".display.chart",e=>(s&&(e.backgroundColor=s),u&&(e.fontSize=u),e))),r){let e=e=>(e.color=r,e);i=sj(i,".display.xAxis.gridLines",e),i=sj(i,".display.yAxis.gridLines",e),i=sj(i,".display.yAxis.minorGridLines",e)}if(o){let e=e=>(e.dashStyle=o,e);i=sj(i,".display.xAxis.gridLines",e),i=sj(i,".display.yAxis.gridLines",e),i=sj(i,".display.yAxis.minorGridLines",e)}if(n){let e=e=>(e.textColor=n,e);i=sj(i,".display.xAxis",e),i=sj(i,".display.yAxis",e)}if(a){let e=e=>(e.color=a,e);i=sj(i,".display.xAxis.crosshair",e),i=sj(i,".display.yAxis.crosshair",e)}if(h||c){let e=e=>t=>(t.fontSize=e,t);h&&(i=sj(i,".display.xAxis",e(h))),c&&(i=sj(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=>tY.NULL_OBJECT;return!0===r&&(i.allAnnotations.forEach(e=>i.onAnnotationModifiedByTool(e,el.Deleted,!1)),l=sj(l,`${o}..annotations`,u)),!0===n&&(l=sj(l,`${o}..plots{.type=="Study"}`,u)),l=av(l)},Previous:{Update:function(e,t,i){return sj(e,As,e=>(eY(e,t),e))},Get:function(e,t,i){return sY(e,As)[0]}},MovePlot:{Update:function(e,t,i){if(!Ar(e,t,i).includes(t.targetPane))return e;let s=Ao(i,t.index),r=yK(e,yj(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,yZ(e)),a=!1;break;case"ExistingBelow":n++;break;case"NewBelow":n++,a=!1,e.panes.splice(n,0,yZ(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(yX());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=Aa(e,s.pane);return av(h=Aa(h,n))},Get:Ar},PinPlot:{Update:function(e,t,i){if(!An(e,t,i).includes(t.targetAxis))return e;let s=Ao(i,t.index),r=e.panes[s.pane],n=yK(e,yj(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(yX()),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 av(Aa(e,s.pane))},Get:An}};function Au(e){return"function"==typeof e}function Ah(e,t,i){return(function(e,t){let i=Al[e];if(Au(i))return i;{let e=void 0!==t?i[t]:void 0;if(!Au(e)&&!Au(e=i[tY.DEFAULT_ACCESSOR_SUBACTION]))throw Error("Invalid accesor id and/or sub id");return e}})(e.id,e.context.id)(t,e.context,i)}function Ac(e){return{id:"MainPlot",context:e}}let Ad={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},Ap=Symbol.for("__ias__");class Af{headless;presenter;_model;constructor(e=!1){this.headless=e,this.presenter=e?null:new yB(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),eH(t)){let e="string"==typeof t;e?AP("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(Ac(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(eF(e)){re(e,t),s9(e,t);let s=g8(e,!1,t,i,this.presenter);s.isDrawingAnnotation&&this.presenter.view.setCursor(ee.Crosshair),this.presenter.activeTool=s,eO()||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 Ax()}get model(){return(this.headless?this._model:this.presenter.getModel())||Ax()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:tY.ACTION_TEMPLATE,context:{strip:e}})}change(...e){let t={chart:this,actions:e.filter(e=>!e[Ap])};t.actions.length>0&&this.presenter?.notifyHost(a_.CH_API_ACTIONS_RECEIVED,t);let i=AM().config.validateInput,s=e.map(e=>i?aT(e,tY.ACCESSOR_SCHEMA):e);if(1===s.length){let e=s[0];if(e.id===tY.ACTION_TEMPLATE||e.context.id===tY.ACTION_GET)return Ah(e,this.model,this.presenter);if(!this.headless&&e.id===tY.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}let{yes:r,no:n}=eS(s,e=>e.id===tY.ACTION_PLOT&&eF(e.context)&&e.context.id===tY.ACTION_DELETE),a=ez(this.model),o=ez(this.model);r.length>0&&n.push({id:tY.ACTION_PLOT,context:{id:tY.ACTION_DELETE,plots:r.map(e=>e.context)}}),n.forEach(e=>{if(!eF(o=Ah(e,o,this.presenter)))throw Error("Forgot to return model from accessor")}),this.fromModel(o,a)}async fromModel(e,t){let i=aT(e,tY.CHART_SCHEMA);this.headless?this._model=i:await this.presenter?.fromModel(i,t)}async load(e,t){let i={...Ad,...t},s=aT(JSON.parse(e),tY.CHART_SCHEMA),r=this.model,n=ez(r);if(eF(r)){if(s=function(e,t,i){let s=as(t),r=s.type.toLowerCase();if(s[r]===tY.PLACEHOLDER_SYMBOL_NAME){let s=as(e),{mainAxis:r}=ar(t),n=r.annotations,a=ac(t,s);if(i){let{mainAxis:e}=ar(a);e.annotations=n}return a}return t}(r,s,i.keepNewAnnotations),i.keepNewAnnotations||(s=At(s)),i.keepOldAnnotations&&(s=function(e,t){let{mainAxis:i}=ar(e),{mainAxis:s}=ar(t);yD(i,s);let r=e=>sY(e,'..plots{.type==="Study"}.study')[0],n=sY(e,yO).filter(e=>e!==i),a=sY(t,yO).filter(e=>e!==s);return n.forEach(e=>{let t=r(e),i=a.find(e=>t===r(e));eF(i)&&yD(e,i)}),t}(r,s)),i.keepNewCompare||(s=Ai(s)),i.keepOldCompare&&(s=function(e,t){let i=sY(e,y8),s=sY(t,y8),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}=ar(t),{mainAxis:l}=ar(e);return n.forEach(e=>{l.plots.includes(e)?o.plots.push(e):y9(a,o).plots.push(e)}),t}(r,s)),i.keepOldAggregation){let e={id:tY.ACTION_AGGREGATION,context:r.data.aggregation},t=s.display.density;s=Ah(e,s,this.presenter),i.keepNewBarWidth&&eF(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=Ax();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}),eF(s)){let i=Ah({id:"Theme",context:{id:"Get"}},this.model,this.presenter),r=Ah(Ac(s),t,this.presenter);e&&(r=Ah({id:"Theme",context:i},r,this.presenter)),this.presenter?.fromModel(r)}}this.clearUndoRedo(),this.presenter?.notifyHost(a_.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){AP("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:yV.call(this.presenter,e)}exportImage(e={}){return this.headless?null:yH.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(eF(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(a_.CH_DIDBECOMEACTIVE,{chart:this})}}var cC=N("c15IW");function Am(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 Ag(e,t){return e+Math.random()*(t-e)}let Ay=Function(atob("Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg")),AA=Function("f",atob("Zi5yZW1vdmVBbGxDaGFydHMoKTsg")),AS=Function("m",atob("cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiOw=="));async function AT(e,t){if(t&&!AS(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=>!eF(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(Ay,Ag(2e3,3e3)),setTimeout(()=>AA(AM()),Ag(4e3,5e3)))}var Av={};function AP(e,t="info",i=""){let s=globalThis.console,r=void 0!==s[t];s[r?t:"log"](e,i)}Av=JSON.parse('{"major":2,"minor":365,"patch":2,"prerelease":false}');let AC={environment:"Browser",validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${tY.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(AS(this.mode)&&this.knownSite){let{username:r,password:n}=this.credentials||{},a=eF(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 Ab(e,t){let i=AM()?.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 AE=!1,AL=null;function A_(t,i={}){if(AE)throw Error("You should only call initFeed once during page's lifetime");AE=!0;let s=Object.assign(AC);return eY(s,i),eH(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(eH(s)&&eH(r)){let e=s.split(" ").map(Number);4===e.length&&e.every(Number.isFinite)&&(m8={path:new Path2D(r),width:e[2],height:e[3],rect:new iR(0,0,0,0),logoClickable:t})}}(s.logo,s.logoClickable??!1),!function(e){var t;let i=e.extensions?.studyProvider;if(!eF(i))return;let s=i.getFields(),r=i.getStudies(),n=ez(sM(tY.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=tY.CHART_SCHEMA,aS.addSchema(t,n),aE(s),sO(r)}(s),(AL=new t(s)).version=function(){let t=e(Av),i=t.prerelease?`-${t.prerelease.identifier}.${t.prerelease.ordinal}`:"";return`${t.major}.${t.minor}.${t.patch}${i}`}(),AP(`%cBarchart Chart version ${AL.version}`,"info","font-size: larger"),AL.cachesData&&(AL.subject?.subscribe(AL.onPerformInternalGc.bind(AL)),e(cC).subscribe(a_.CH_ALL,AL.onChartChanged.bind(AL))),AL}function AM(){return AL}function Ax(){return ez(AM()?.template)}function AI(){eH(AL)&&(AL.shutdown(),AE=!1,AL=null)}function AD(e){let t=new Af(!0);return t.load(e),t.change({id:"Outline",context:{id:"Get"}})}function AO(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 Aw{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=e1()}get subject(){return this.isAuxiliary||eH(this._subject)||(this._subject=new ob().pipe(function(e){for(var t,i,s=[],r=1;r<arguments.length;r++)s[r-1]=arguments[r];var n=null!=(t=ov(s[s.length-1])?s.pop():void 0)?t:ot,a=null!=(i=s[0])?i:null,o=s[1]||1/0;return oL(function(t,i){var s=[],r=!1,l=function(e){var t=e.buffer;e.subs.unsubscribe(),a1(s,e),i.next(t),r&&u()},u=function(){if(s){var t=new a2;i.add(t);var r={buffer:[],subs:t};s.push(r),Am(t,n,function(){return l(r)},e)}};null!==a&&a>=0?Am(i,n,u,a,!0):r=!0,u();var h=o_(i,function(e){var t,i,r=s.slice();try{for(var n=aK(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)})}(tY.INTERNAL_GC_MILLIS),oD(e=>e.length>0))),this._subject}get isAuxiliary(){return null!==window.opener}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=AO(this.timeSeriesSource,"getTimeSeries",e,"symbol"),this.metaDataSource=AO(this.metaDataSource,"getMetaData",e),this.recordSource=AO(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(!eH(this.timeSeriesSource))throw Error("No time series source defined");return this.timeSeriesSource}getMetaDataSource(){if(!eH(this.metaDataSource))throw Error("No metadata source defined");return this.metaDataSource}getRecordSource(){if(!eH(this.recordSource))throw Error("No record source defined");return this.recordSource}async ready(){return t$.call(this,async()=>{await AT(this.config,this instanceof AF||this instanceof AR||this instanceof AW);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=aT(e,tY.CHART_SCHEMA),!0})}getHeadlessChart(){return new Af(!0)}fixupRenderTo(e){if(!eH(e))return null;if(e instanceof HTMLElement)return e;let t=tN(`#${e}`);if(eH(t))return t;let i=[...this.charts.keys()].find(t=>t.id===e);return eH(i)?i:null}checkChart(e,t){let i=this.fixupRenderTo(e),s=eH(i)&&this.charts.has(i);return eH(t)&&t!==s&&AP(`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 Af;return this.charts.set(i,s),s.initialize(e,t),s}removeChart(e){let t=this.checkChart(e,!0);eH(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 eH(t)?this.charts.get(t):null}redraw(e){let t=this.checkChart(e,!0);eH(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),eH(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach(e=>{let t=this.getChart(e);if(!eH(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=>{eH(t)&&(eH(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(),eN(a_.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===a_.CH_RECREATED||e===a_.CH_SHUTDOWN)&&(this.isAuxiliary?this._mainFeed?.triggerGc():this.triggerGc())}getDefaultMultiFieldCurve(){if(!eH(this.template))return null;if(!this.knowDefaultCurve){let e=as(this.template);1===e.curves.length&&function(e){switch($[e]){case $.OHLC:case $.HLC:case $.Candlestick:case $.HollowCandles:case $.HeikinAshi:case $.ElderImpulseSystem:case $.Range:case $.MultiColumn:return!0;default:return!1}}(e.curves[0].style)?this.defaultOhlcCurve=ez(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=ez(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 AR extends Aw{constructor(e){super(e),this.timeSeriesSource=new hl(!1),this.metaDataSource=new il,this.recordSource=new l$}}class AN extends Aw{constructor(e){super(e),this.timeSeriesSource=new hl(!0),this.metaDataSource=new il,this.recordSource=new lG}}class AV extends Aw{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new hl(!0),this.metaDataSource=new il,this.recordSource=new l$}}let AH=["drazen.dotlic@barchart.com","princec","b.hebert24@barchart.com"];class AF extends Aw{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;_connection;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new hl(!0),this.metaDataSource=new iu,this.recordSource=new lz,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,eH(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){eH(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&&AH.includes(this.connection._username)&&AP(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===tY.BC_EVENT_DISCONNECTED||e===tY.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):(e===tY.BC_EVENT_LOGGED_IN||e===tY.BC_EVENT_FEED_RESUMED)&&(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),eH(this._connection)&&(this.connection.off("timestamp",this.onTimestamp),this.connection.off("events",this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}}function AB(e,t){return new Ak(e,t)}class Ak{_client;_subscriptions=new Map;_listeners=new Set;constructor(e,t){this._client=e;let i=e=>e.find(e=>this._subscriptions.has(e))??null;t.onConnected=()=>{this._listeners.forEach(e=>e?.onConnected())},t.onMessageWithMetadata=(e,t)=>{let s=e.marketSnapshot;if(eH(s)){let e=i(t);null!==e&&this._listeners.forEach(t=>t.onSnapshot?.(s,e))}let r=e.marketUpdate;if(eH(r)){let e=i(t);null!==e&&this._listeners.forEach(t=>t.onUpdate?.(r,e))}},t.onDisconnected=()=>{this._listeners.forEach(e=>e?.onDisconnected())},t.onHeartBeat=e=>{this._listeners.forEach(t=>t.onHeartBeat?.(e))}}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}async ready(){return eH(await this._client.connection)}shutdown(){eH(this._client)&&(this._client.dispose(),this._subscriptions.clear(),this._listeners.clear())}subscribeToRealTime(e){if(this._subscriptions.has(e)||!eH(this._client))return;let t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribeFromRealTime(e){if(!this._subscriptions.has(e)||!eH(this._client))return;let t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e)}async getInstrument(e){let t=await this._client.connection;return await t?.getInstrument(e)??[]}}class AW extends Aw{_adapter=null;_auxFeeds=[];constructor(t){super(t),this.cachesData=!0,this.isAuxiliary||(this.timeSeriesSource=new hl(!0),this.metaDataSource=new ih,this.recordSource=new lY,e(cC).subscribe(a_.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&&eN(e,t)}getAdapter(){return this.isAuxiliary?this._mainFeed?._adapter:this._adapter}setAdapter(e){if(this.isAuxiliary)throw Error("Cannot set adapter on auxiliary feed");this._adapter=e,this._adapter.addListener(this)}async ready(){if(this.isAuxiliary){let e=await this._mainFeed?.ready()??!1;return e&&(this.template=this._mainFeed.template),e}return await super.ready(),await this._adapter?.ready()??!1}subscribe(e){this.getAdapter()?.subscribeToRealTime(e)}unsubscribe(e){this.getAdapter()?.unsubscribeFromRealTime(e)}shutdown(){super.shutdown(),this.isAuxiliary?(this._mainFeed?.removeAuxFeed(this),this._mainFeed=null):this._adapter?.shutdown()}onConnected(){this.refreshCaches()}onDisconnected(){}onHeartBeat(){}onUpdate(e,t){this.ofRecordSource.onUpdate(e,t)}onSnapshot(e,t){this.ofRecordSource.onSnapshot(e,t)}get ofRecordSource(){return this.recordSource}replaceDataSources(e){super.replaceDataSources(e),this._mainFeed=e}addAuxFeed(e){e.replaceDataSources(this),this._auxFeeds.push(e),this._adapter?.addListener(e)}removeAuxFeed(e){let t=this._auxFeeds.findIndex(t=>t.id==e.id);-1!==t&&(this._auxFeeds.splice(t,1),this._adapter?.removeListener(e),this.triggerGc())}getAllCacheableEntities(e){if(super.getAllCacheableEntities(e),!this.isAuxiliary)for(let t of this._auxFeeds)t.getAllCacheableEntities(e)}}var cC=N("c15IW");let AU=e(cC);export{AU as PubSub,A_ as initFeed,AM as getFeed,AI as shutdownFeed,AD as getChartOutline,Aw as BaseDataFeed,AR as BarchartSiteDataFeed,AV as MiniWidgetDataFeed,AF as MarketDataFeed,AW as OpenFeed,AN as SnapshotDataFeed,AB as adaptOpenFeedClient,ua as OHLCDataPointBuilder,n4 as parseExpression,n5 as evaluateExpression,n7 as formatExpression,n8 as getExpressionSymbols,ae as replaceExpressionSymbols,n9 as doesExpressionHaveComputation,pL as ExpressionSeries,pE as makeExpression,u9 as ContainerWrapperTimeSeries,t5 as formatPriceWithDecimals,t6 as getCombinedMetaData,lU as BaseRecordSource,aw as EmptyRecord,aC as Field,aL as Fields,ul as TimeSeriesContainer,cP as TimeSeriesQuery,nF as Aggregation,t$ as asyncReady,tL as hasOpenInterest,ut as optionValueToDate,e1 as generateUid,sG as getTaxonomies,sF as doesStudyExist,sV as getAnnotationTraits,ys as getStudyOptions,cL as StudySeries,cE as makeHelperField,fN as makeStudy,f0 as convertSeries,f1 as mapSeries,fF as movAvg,fB as movExp,fk as movSmo,fW as movWei,fU as movHul,fQ as linReg,fY as trueRange,fK as typical,fq as roc,fJ as stdDev,a_ as Topics,iI as getLightness,en as ChunkPart,J as SeriesKind,z as AggregationSpec,G as AggregationUnit,B as ExpressionRecompute,k as ExpressionNoDataApproach,F as ExpressionMissingBar,Y as FieldValueType,K as FieldCategory,j as FieldFormat,yI as CustomEventPopup,tk as appendDOMElement,tV as styleDOMElement,tH as setAttributesDOMElement};
|
|
22
|
-
//# sourceMappingURL=barchart.chart.js.map
|
|
1
|
+
var e=/* @__PURE__ */(e=>(e[e.Browser=0]="Browser",e[e.NodeJs=1]="NodeJs",e))(e||{}),t=/* @__PURE__ */(e=>(e[e.UsePrevious=0]="UsePrevious",e[e.UseNext=1]="UseNext",e[e.UseNone=2]="UseNone",e))(t||{}),i=/* @__PURE__ */(e=>(e[e.Minimum=0]="Minimum",e[e.Everything=1]="Everything",e[e.Manual=2]="Manual",e))(i||{}),s=/* @__PURE__ */(e=>(e[e.NoAction=0]="NoAction",e[e.IgnoreTimelineOnly=1]="IgnoreTimelineOnly",e[e.ModelTransformRequired=2]="ModelTransformRequired",e))(s||{}),n=/* @__PURE__ */(e=>(e[e.Down=0]="Down",e[e.Up=1]="Up",e[e.Same=2]="Same",e))(n||{}),r=/* @__PURE__ */(e=>(e[e.ChangeBased=0]="ChangeBased",e[e.OpenVsClose=1]="OpenVsClose",e))(r||{}),o=/* @__PURE__ */(e=>(e[e.OHLC=0]="OHLC",e[e.Line=1]="Line",e[e.Candlestick=2]="Candlestick",e[e.Area=3]="Area",e[e.Column=4]="Column",e[e.Dots=5]="Dots",e[e.HLC=6]="HLC",e[e.HL=7]="HL",e[e.Ribbon=8]="Ribbon",e[e.Step=9]="Step",e[e.HollowCandles=10]="HollowCandles",e[e.HeikinAshi=11]="HeikinAshi",e[e.ElderImpulseSystem=12]="ElderImpulseSystem",e[e.Renko=13]="Renko",e[e.Range=14]="Range",e[e.LineBreak=15]="LineBreak",e[e.Kagi=16]="Kagi",e[e.PointAndFigure=17]="PointAndFigure",e[e.Baseline=18]="Baseline",e[e.PercentChange=19]="PercentChange",e[e.MultiColumn=20]="MultiColumn",e[e.StackedColumn=21]="StackedColumn",e))(o||{}),a=/* @__PURE__ */(e=>(e[e.Tick=0]="Tick",e[e.Intraday=1]="Intraday",e[e.Day=2]="Day",e[e.Week=3]="Week",e[e.Month=4]="Month",e[e.Quarter=5]="Quarter",e[e.Year=6]="Year",e))(a||{}),l=/* @__PURE__ */(e=>(e[e.None=0]="None",e[e.Nearest=1]="Nearest",e[e.Continue=2]="Continue",e[e.PerCount=3]="PerCount",e[e.PerVolume=4]="PerVolume",e[e.PerRange=5]="PerRange",e[e.PerSeconds=6]="PerSeconds",e))(l||{}),c=/* @__PURE__ */(e=>(e[e.Number=0]="Number",e[e.String=1]="String",e[e.Date=2]="Date",e))(c||{}),u=/* @__PURE__ */(e=>(e[e.FromMetaData=0]="FromMetaData",e[e.AsInteger=1]="AsInteger",e[e.UseMetricUnit=2]="UseMetricUnit",e[e.AsPercent=3]="AsPercent",e))(u||{}),h=/* @__PURE__ */(e=>(e[e.Common=0]="Common",e[e.Study=1]="Study",e[e.BalanceSheet=2]="BalanceSheet",e[e.IncomeStatement=3]="IncomeStatement",e[e.Forward=4]="Forward",e[e.Seasonal=5]="Seasonal",e[e.Event=6]="Event",e[e.Option=7]="Option",e))(h||{}),d=/* @__PURE__ */(e=>(e[e.None=0]="None",e[e.Value=1]="Value",e[e.Percent=2]="Percent",e))(d||{}),p=/* @__PURE__ */(e=>(e[e.Linear=0]="Linear",e[e.Logarithmic=1]="Logarithmic",e))(p||{}),f=/* @__PURE__ */(e=>(e[e.Symbol=0]="Symbol",e[e.Expression=1]="Expression",e[e.Study=2]="Study",e[e.Forward=3]="Forward",e[e.BalanceSheet=4]="BalanceSheet",e[e.IncomeStatement=5]="IncomeStatement",e[e.Seasonal=6]="Seasonal",e))(f||{}),m=/* @__PURE__ */(e=>(e[e.Normal=0]="Normal",e[e.Forward=1]="Forward",e[e.HistoricalForward=2]="HistoricalForward",e[e.Study=3]="Study",e[e.BalanceSheet=4]="BalanceSheet",e[e.IncomeStatement=5]="IncomeStatement",e[e.Events=6]="Events",e[e.Options=7]="Options",e))(m||{}),g=/* @__PURE__ */(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))(g||{}),y=/* @__PURE__ */(e=>(e[e.Arrow=0]="Arrow",e[e.Crosshair=1]="Crosshair",e[e.Move=2]="Move",e[e.Hand=3]="Hand",e[e.ResizeVertical=4]="ResizeVertical",e[e.Grabbing=5]="Grabbing",e[e.ResizeHorizontal=6]="ResizeHorizontal",e))(y||{}),A=/* @__PURE__ */(e=>(e[e.NotApplicable=0]="NotApplicable",e[e.Left=1]="Left",e[e.Middle=2]="Middle",e[e.Right=3]="Right",e))(A||{}),S=/* @__PURE__ */(e=>(e[e.Shift=0]="Shift",e[e.Alt=1]="Alt",e[e.Control=2]="Control",e[e.Meta=3]="Meta",e))(S||{}),T=/* @__PURE__ */(e=>(e[e.None=0]="None",e[e.Horizontal=1]="Horizontal",e[e.Vertical=2]="Vertical",e[e.Both=3]="Both",e))(T||{}),v=/* @__PURE__ */(e=>(e[e.Unspecified=0]="Unspecified",e[e.GBE=1]="GBE",e[e.cmdtyView=2]="cmdtyView",e[e.DemoSite=3]="DemoSite",e[e.InternalFeed=4]="InternalFeed",e[e.Widget=5]="Widget",e[e.FreeWidget=6]="FreeWidget",e))(v||{}),P=/* @__PURE__ */(e=>(e[e.Unspecified=0]="Unspecified",e[e.Head=1]="Head",e[e.Tail=2]="Tail",e))(P||{}),C=/* @__PURE__ */(e=>(e[e.wheel=0]="wheel",e[e["wheel+shift"]=1]="wheel+shift",e[e.none=2]="none",e))(C||{}),b=/* @__PURE__ */(e=>(e[e.Page=0]="Page",e[e.Application=1]="Application",e))(b||{}),E=/* @__PURE__ */(e=>(e[e.None=0]="None",e[e.Created=1]="Created",e[e.Deleted=2]="Deleted",e[e.Moved=3]="Moved",e[e.PointMoved=4]="PointMoved",e[e.TextChanged=5]="TextChanged",e[e.Undo=6]="Undo",e[e.Redo=7]="Redo",e[e.Cancelled=8]="Cancelled",e[e.Executed=9]="Executed",e))(E||{}),L=/* @__PURE__ */(e=>(e[e.None=0]="None",e[e.Min=1]="Min",e[e.Max=2]="Max",e))(L||{});function M(e,t){return function(...i){return e.apply(this,[t,...i])}}function _(e,t,i){return function(...s){return e.apply(this,[t,i,...s])}}function x(...e){const t=e?e.length:0,i=this;return function(...s){let n=0,r=t?e[n].apply(i,s):s[0];for(;++n<t;)r=e[n].call(i,r);return r}}function I(e){return e}function D(e){return null!==e}function O(e){return e.reduce((e,t)=>e+t,0)}function w(e){const t=e.length;return t>0?O(e)/t:0}function R(e){return e.every(e=>null!==e)}function N(e,t){return Array.from(Array(t)).map((t,i)=>i+e)}function V(e,t){const i=[],s=[];return e.forEach(e=>{t(e)?i.push(e):s.push(e)}),{yes:i,no:s}}function H(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 B(e,t){return e.filter(e=>!t.includes(e))}function F(e,t,i=I){const s=[];return e.forEach(e=>{const n=i(e);!s.map(i).includes(n)&&t.map(i).includes(n)&&s.push(e)}),s}function k(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function W(e){if(!(e.length<1))return e[0]}function U(e,t,i=null){if(e.length<1)return-1;for(let s=Number.isFinite(i)&&i<e.length?i:e.length-1;s>=0;--s)if(t(e[s]))return s;return-1}const $=(e,t)=>e[t];function G(e,t,i=e=>e,s=$,n=0,r=e.length-1){const o=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN;for(;n<r;){const a=n+r>>>1;o(i(s(e,a)),t)<0?n=a+1:r=a}return n}function z(e,t=0,i=e.length-1,s=(e,t)=>e){if(t<0||i>=e.length)return[null,null];let n=null,r=null;for(let o=t;o<=i;o++){const t=s(e[o],o);null!=t&&t>=t&&(null==n?n=r=t:(n>t&&(n=t),r<t&&(r=t)))}return[n,r]}function Y(e,t){return Array.from({length:e},(e,i)=>t(i))}function j(e,t){const i=ie;if(!i(e)||!i(t))return;const[s,n]=e,[r,o]=t;(i(r,s)&&s<r||i(s)&&!i(r))&&(t[0]=s),(i(o,n)&&n>o||i(n)&&!i(o))&&(t[1]=n)}let K=null;function q(){return null===K&&(K="ontouchstart"in globalThis),K}function X(e,t){return"Escape"===e||27===t}function Z(e,t){return"ArrowLeft"===e||37===t}function J(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function Q(e,t=100){return function(e,t){let i=null;return function(...s){const n=this;clearTimeout(i),i=setTimeout(function(){e.apply(n,s)},t)}}(t=>J(e,t),t)}function ee(e,t=100){return function(e,t){let i=!1;return function(...s){if(!i){const n=this;e.apply(n,s),i=!0,setTimeout(function(){i=!1},t)}}}(t=>J(e,t),t)}function te(e){return null!=e}function ie(...e){return e.every(e=>null!=e)}function se(e,t){return function(e,t,i){if(void 0===i||0===+i)return Math[e](t);if(t=+t,i=+i,isNaN(t)||"number"!=typeof i||i%1!=0)return NaN;const s=t.toString().split("e"),n=Math[e](+(s[0]+"e"+(s[1]?+s[1]-i:-i))).toString().split("e");return+(n[0]+"e"+(n[1]?+n[1]+i:i))}("round",e,-t)}function ne(e){return ie(e)&&Number.isFinite(e)}function re(e){const t="both"===e;return[t||"vertical"===e,t||"horizontal"===e]}function oe(e,t,i){return t.includes(e)?e:i}function ae(e,t){return ie(e)?e:t}function le(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function ce(e,t,...i){if(!ie(e))return t;let s=e;for(const n of i){if(!ie(s)||!le(s,n))return t;s=s[n]}return s}function ue(e){return null==e?e:JSON.parse(JSON.stringify(e))}function he(e,t,i=!0){const s=Object.keys(t),n=Object.keys(e),r=e=>!i||n.includes(e);for(const o of s)if(r(o)){const i=e[o];void 0===i||"object"!=typeof i||Array.isArray(i)?e[o]=t[o]:de(e[o],t[o])}}function de(e,t){he(e,t)}function pe(e,t){const i=Object.keys(t);for(const s of i)e[s]=e[s]||t[s]}function fe(e=[]){return e.reduce((e,t)=>(e[t.name]=t.value,e),{})}function me(e){return e?new Date(e):null}function ge(e){let t="";for(const i in e){const s=`${i}=${encodeURIComponent(e[i])}`;t+=(t.length>0?"&":"")+s}return t}function ye(e,t){he(e,t,!1)}const Ae=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,Se=[1e3,60,60,24,7,30/7,12];function Te(e){const t=Ae.exec(e);if(!ie(t))return null;const i=t.slice(2,9).map(e=>ie(e)?parseFloat(e):0).reverse();return Se.forEach((e,t)=>{for(let s=t;s<i.length;s++)i[s]=i[s]*e}),Math.floor(O(i))}function ve(e,t,i,s){let n=e,r=t;return 0===n||0===r?(n=i,r=n/2):n>s?(r*=s/n,n=s):n<i&&(r*=i/n,n=i),[n,r]}function Pe(){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 Ce(e,t,i){return Math.min(Math.max(i,e),t)}var be,Ee,Le,Me,_e,xe,Ie,De,Oe,we,Re,Ne,Ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function He(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Be(){return Ee?be:(Ee=1,be=/* @__PURE__ */(()=>({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}}))())}function Fe(){if(Me)return Le;Me=1;const e=Be();return Le=/* @__PURE__ */(()=>{function t(t,s,n,r,o){n===String?e.string(t)||i(s,"string",o):n===Number?e.number(t)||i(s,"number",o):n===Function?e.fn(t)||i(s,"function",o):n===Boolean?e.boolean(t)||i(s,"boolean",o):n===Date?e.date(t)||i(s,"date",o):n===Array?e.array(t)||i(s,"array",o):t instanceof(n||Object)||i(s,r,o)}function i(e,t,i){let s;throw s="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"} ]`,new Error(s)}function s(e,t){throw new Error(`The argument [ ${e||"unspecified"} ] failed a validation check [ ${t||"No description available"} ]`)}return{argumentIsRequired(e,i,s,n){t(e,i,s,n)},argumentIsOptional(i,n,r,o,a,l){null!=i&&(t(i,n,r,o),e.fn(a)&&!a(i)&&s(n,l))},argumentIsArray(e,i,s,n){if(this.argumentIsRequired(e,i,Array),s){let r;r="function"==typeof s&&s!==Function?(e,t)=>void 0!==s.prototype&&e instanceof s||s(e,`${i}[${t}]`):(e,r)=>t(e,i,s,n,r),e.forEach((e,t)=>{r(e,t)})}},argumentIsValid(e,t,i,n){i(e)||s(t,n)},areEqual(e,t,i,s){if(e!==t)throw new Error(`The objects must be equal [${i||e.toString()}] and [${s||t.toString()}]`)},areNotEqual(e,t,i,s){if(e===t)throw new Error(`The objects cannot be equal [${i||e.toString()}] and [${s||t.toString()}]`)}}})()}function ke(){if(De)return Ie;De=1;const e=Fe(),t=Be();return Ie=/* @__PURE__ */(()=>{const i=/* @__PURE__ */new Map;class s{constructor(n,r,o){e.argumentIsRequired(n,"code",String),e.argumentIsRequired(r,"description",String),e.argumentIsOptional(o,"mapping",Number),t.number(o)&&e.argumentIsValid(o,"mapping",t.integer,"must be an integer"),this._code=n,this._description=r,t.number(o)?this._mapping=o:this._mapping=null;const a=this.constructor;i.has(a)||i.set(a,[]);null===s.fromCode(a,this._code)&&(null===this._mapping||null===s.fromMapping(a,this._mapping))&&i.get(a).push(this)}get code(){return this._code}get description(){return this._description}get mapping(){return this._mapping}equals(e){return e===this||e instanceof s&&e.constructor===this.constructor&&e.code===this.code}toJSON(){return this.code}static fromCode(e,t){return s.getItems(e).find(e=>e.code===t)||null}static fromMapping(e,t){return null===t?null:s.getItems(e).find(e=>e.mapping===t)||null}static getItems(e){return i.get(e)||[]}toString(){return"[Enum]"}}return s})()}function We(){if(we)return Oe;we=1;const e=ke();return Oe=(()=>{class t extends e{constructor(e,t,i){super(e,t),this._id=i}get id(){return this._id}toJSON(){return this._id}static parse(i){return e.fromCode(t,i)}static fromId(i){return e.getItems(t).find(e=>e.id===i)||null}static get STOCK(){return i}static get STOCK_OPTION(){return s}static get FUTURE(){return n}static get FUTURE_OPTION(){return r}static get FOREX(){return o}static get CMDTY_STATS(){return a}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}const i=new t("STK","U.S. Equity",1),s=new t("STKOPT","Equity Option",34),n=new t("FUT","Future",2),r=new t("FUTOPT","Future Option",12),o=new t("FOREX","FOREX",10),a=new t("CMDTY","cmdtyStats",24);return t})()}const Ue=/* @__PURE__ */He(function(){if(Ne)return Re;Ne=1;const e=Be(),t=function(){if(xe)return _e;xe=1;const e=Fe(),t=Be();return _e=(()=>{const i={camel:{}};return i.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=>(e.argumentIsRequired(t,"s",String),t.replace(i.camel.violations,e=>e.toLocaleLowerCase())),truncate:(e,i)=>t.string(e)&&e.length>i?e.substring(0,i)+" ...":e,padLeft(t,i,s){if(e.argumentIsRequired(t,"s",String),e.argumentIsRequired(i,"length",Number),e.argumentIsRequired(s,"character",String),1!==s.length)throw new Error('The "character" argument must be one character in length.');return s.repeat(i-t.length)+t},mask(i,s,n,r){if(e.argumentIsRequired(i,"s",String),e.argumentIsRequired(s,"mask",String),e.argumentIsRequired(n,"show",Number),e.argumentIsOptional(r,"length",Number),t.number(r)&&!(r>0))return"";const o=Math.min(i.length,Math.max(n,0)),a=Math.max(i.length,Math.max(r||0),0)-o;let l=`${s.slice(-1).repeat(a)}${o>0?i.slice(1+~o):""}`;return t.number(r)&&!(r<0)&&r<i.length&&(l=l.slice(1+~r)),l},format:(i,...s)=>(e.argumentIsRequired(i,"s",String),i.replace(/{(\d+)}/g,(e,i)=>{let n;if(i<s.length){const r=s[i];n=t.undefined(r)||t.null(r)?e:r.toString()}else n=e;return n}))}})()}(),i=We();return Re=(()=>{class s{constructor(){}static getIsConcrete(t){return e.string(t)&&!this.getIsReference(t)}static getIsReference(t){return e.string(t)&&l.futures.alias.test(t)}static getIsFuture(t){return e.string(t)&&(l.futures.concrete.test(t)||l.futures.alias.test(t))}static getIsCash(e){return s.getIsFuture(e)&&l.futures.cash.test(e)}static getIsFutureSpread(t){return e.string(t)&&l.futures.spread.test(t)}static getIsFutureOption(t){return e.string(t)&&(l.futures.options.short.test(t)||l.futures.options.long.test(t)||l.futures.options.historical.test(t))}static getIsForex(t){return e.string(t)&&l.forex.test(t)}static getIsCrypto(t){return e.string(t)&&l.crypto.test(t)}static getIsIndex(t){return e.string(t)&&l.indicies.external.test(t)}static getIsSector(t){return e.string(t)&&l.indicies.sector.test(t)}static getIsCanadianFund(t){return e.string(t)&&l.funds.canadian.test(t)}static getIsCmdty(t){return e.string(t)&&(l.cmdty.stats.test(t)||l.cmdty.internal.test(t)||l.cmdty.external.test(t))}static getIsCmdtyStats(t){return e.string(t)&&l.cmdty.stats.test(t)}static getIsBats(t){return e.string(t)&&a.bats.test(t)}static getIsEquityOption(t){return e.string(t)&&l.equities.options.test(t)}static getIsExpired(e){const t=s.parseInstrumentType(e);let i=!1;if(null!==t&&t.year&&t.month){const e=h();if(t.year<e)i=!0;else if(t.year===e&&o.hasOwnProperty(t.month)){(/* @__PURE__ */new Date).getMonth()+1>o[t.month]&&(i=!0)}}return i}static getIsC3(t){return e.string(t)&&(l.c3.concrete.test(t)||l.c3.alias.test(t))}static getIsPlatts(t){return e.string(t)&&(l.platts.concrete.test(t)||l.platts.alias.test(t))}static getIsPit(t,i){return e.string(t)&&e.string(i)&&a.pit.test(i)}static getIsGrainBid(t){return e.string(t)&&l.bids.test(t)}static parseInstrumentType(t){if(!e.string(t))return null;let i=null;for(let e=0;e<c.length&&null===i;e++){i=(0,c[e])(t)}return i}static getProducerSymbol(t){if(!e.string(t))return null;let i=null;for(let e=0;e<u.length&&null===i;e++){i=(0,u[e])(t)}return i}static getFuturesOptionPipelineFormat(e){const t=s.parseInstrumentType(e);let i=null;if("future_option"===t.type){const e=f(t.option_type);i=`${t.root}${t.month}${d(t.year,1)}|${t.strike}${e}`}return i}static getFuturesExplicitFormat(e){let i=null;if(s.getIsFuture(e)&&s.getIsConcrete(e)){const n=s.parseInstrumentType(e);i=`${n.root}${n.month}${t.padLeft(Math.floor(n.year%100).toString(),2,"0")}`}return i}static getFuturesYear(e,t){return p(e,t)}static displayUsingPercent(t){return e.string(t)&&a.percent.test(t)}toString(){return"[SymbolParser]"}}const n={F:"A",G:"B",H:"C",J:"D",K:"E",M:"I",N:"L",Q:"O",U:"P",V:"R",X:"S",Z:"T"},r={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},o={F:1,G:2,H:3,J:4,K:5,M:6,N:7,Q:8,U:9,V:10,X:11,Z:12},a={bats:/^(.*)\.BZ$/i,percent:/(\.RT)$/,pit:/\(P(it)?\)/},l={bids:/^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i,c3:{}};l.c3.alias=/^(C3:)(.*)$/i,l.c3.concrete=/(\.C3)$/i,l.cmdty={},l.cmdty.stats=/(\.CS)$/i,l.cmdty.internal=/(\.CM)$/i,l.cmdty.external=/(\.CP)$/i,l.crypto=/^\^([A-Z]{3})([A-Z]{3,4})$/i,l.equities={},l.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,l.forex=/^\^([A-Z]{3})([A-Z]{3})$/i,l.funds={},l.funds.canadian=/(.*)(\.CF)$/i,l.futures={},l.futures.alias=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1,2})$/i,l.futures.concrete=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,l.futures.spread=/^_S_/i,l.futures.cash=/(.*)(Y00)$/,l.futures.options={},l.futures.options.historical=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,l.futures.options.long=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,l.futures.options.short=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,l.indicies={},l.indicies.external=/^\$(.*)$/i,l.indicies.sector=/^\-(.*)$/i,l.platts={},l.platts.alias=/^(PLATTS:)(.*)$/i,l.platts.concrete=/^(.*)(\.PT)$/i;const c=[];c.push(e=>{let t=null;return l.futures.spread.test(e)&&(t={},t.symbol=e,t.type="future_spread"),t}),c.push(e=>{let t=null;const s=e.match(l.futures.concrete);return null!==s&&(t={},t.symbol=e,t.type="future",t.asset=i.FUTURE,t.dynamic=!1,t.root=s[1],t.month=s[2],t.year=p(s[3],s[2])),t}),c.push(e=>{let t=null;const s=e.match(l.futures.alias);return null!==s&&(t={},t.symbol=e,t.type="future",t.asset=i.FUTURE,t.dynamic=!0,t.root=s[1],t.dynamicCode=s[3]),t}),c.push(e=>{let t=null;return l.forex.test(e)&&(t={},t.symbol=e,t.type="forex",t.asset=i.FOREX),t}),c.push(e=>{let t=null;const s=e.match(l.equities.options);if(null!==s){const n=void 0!==s[4]?s[4]:"";t={},t.symbol=e,t.type="equity_option",t.asset=i.STOCK_OPTION,t.option_type="C"===s[9]?"call":"put",t.strike=parseFloat(s[8]),t.root=`${s[1]}${n}`,t.month=parseInt(s[6]),t.day=parseInt(s[7]),t.year=parseInt(s[5]),t.adjusted=""!==s[3]}return t}),c.push(e=>{let t=null;return l.indicies.external.test(e)&&(t={},t.symbol=e,t.type="index"),t}),c.push(e=>{let t=null;return l.indicies.sector.test(e)&&(t={},t.symbol=e,t.type="sector"),t}),c.push(e=>{let t=null;const s=e.match(l.futures.options.short);if(null!==s){t={};const n=s[4].charCodeAt(0),r=80;let o,a;n<r?(o="call",a=n-67):(o="put",a=n-r),t.symbol=e,t.type="future_option",t.asset=i.FUTURE_OPTION,t.option_type=o,t.strike=parseInt(s[3]),t.root=s[1],t.month=s[2],t.year=h()+a}return t}),c.push(e=>{let t=null;const s=e.match(l.futures.options.long)||e.match(l.futures.options.historical);var n;return null!==s&&(t={},t.symbol=e,t.type="future_option",t.asset=i.FUTURE_OPTION,t.option_type="C"===s[5]?"call":"put",t.strike=parseInt(s[4]),t.root=s[1],t.month=(n=s[2],r[n]||n),t.year=p(s[3])),t}),c.push(e=>{let t=null;return null!==e.match(l.cmdty.stats)&&(t={},t.symbol=e,t.type="cmdtyStats",t.asset=i.CMDTY_STATS),t});const u=[];function h(){/* @__PURE__ */
|
|
2
|
+
return(new Date).getFullYear()}function d(e,t){const i=e.toString();return i.substring(i.length-t,i.length)}function p(e,t){const i=h();let s=parseInt(e);if(0===s&&"Y"===t)s=100*Math.floor(i/100)+100;else if(s<10&&1===e.length){const e=s<i%10?1:0;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 f(e){return"call"===e?"C":"put"===e?"P":null}return u.push(e=>{let t=null;if(s.getIsFuture(e)&&s.getIsConcrete(e)){const i=e.match(l.futures.concrete);if(null!==i){const e=i[1],s=i[2],r=p(i[3],s);if(r>h()+9){const i=n[s];i&&(t=`${e}${i}${d(r,1)}`)}}}return t}),u.push(e=>{let t=null;return s.getIsFuture(e)&&s.getIsConcrete(e)&&(t=e.replace(/(.{1,3})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,"$1$2$4")||null),t}),u.push(e=>{let t=null;if(s.getIsFutureOption(e)){const i=s.parseInstrumentType(e),n=f(i.option_type);if(i.root.length<3){const e=n.charCodeAt(0);t=`${i.root}${i.month}${i.strike}${String.fromCharCode(e+i.year-h())}`}else t=`${i.root}${i.month}${d(i.year,1)}|${i.strike}${n}`}return t}),u.push(e=>{let t=null;return l.c3.alias.test(e)&&(t=e.replace(l.c3.alias,"$2.C3")),t}),u.push(e=>{let t=null;return l.platts.alias.test(e)&&(t=e.replace(l.platts.alias,"$2.PT")),t}),u.push(e=>e),s})()}());var $e,Ge;const ze=/* @__PURE__ */He(Ge?$e:(Ge=1,$e=(()=>{const e={},t={};function i(i,s,n){e[i]=s,t[i]=n}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)}})()));function Ye(e){return(Ye="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 je(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 Ke(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function qe(e){Ke(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Ye(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((new Error).stack)),/* @__PURE__ */new Date(NaN))}function Xe(e,t){Ke(2,arguments);var i=qe(e),s=je(t);return isNaN(s)?/* @__PURE__ */new Date(NaN):s?(i.setDate(i.getDate()+s),i):i}function Ze(e,t){Ke(2,arguments);var i=qe(e),s=je(t);if(isNaN(s))/* @__PURE__ */
|
|
3
|
+
return new Date(NaN);if(!s)return i;var n=i.getDate(),r=new Date(i.getTime());return r.setMonth(i.getMonth()+s+1,0),n>=r.getDate()?r:(i.setFullYear(r.getFullYear(),r.getMonth(),n),i)}function Je(e,t){if(Ke(2,arguments),!t||"object"!==Ye(t))/* @__PURE__ */return new Date(NaN);var i=t.years?je(t.years):0,s=t.months?je(t.months):0,n=t.weeks?je(t.weeks):0,r=t.days?je(t.days):0,o=t.hours?je(t.hours):0,a=t.minutes?je(t.minutes):0,l=t.seconds?je(t.seconds):0,c=qe(e),u=s||i?Ze(c,s+12*i):c,h=r||n?Xe(u,r+7*n):u,d=1e3*(l+60*(a+60*o));return new Date(h.getTime()+d)}function Qe(e,t){Ke(2,arguments);var i=qe(e).getTime(),s=je(t);return new Date(i+s)}var et={};function tt(){return et}function it(e,t){var i,s,n,r,o,a,l,c;Ke(1,arguments);var u=tt(),h=je(null!==(i=null!==(s=null!==(n=null!==(r=null==t?void 0:t.weekStartsOn)&&void 0!==r?r:null==t||null===(o=t.locale)||void 0===o||null===(a=o.options)||void 0===a?void 0:a.weekStartsOn)&&void 0!==n?n:u.weekStartsOn)&&void 0!==s?s:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==i?i:0);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=qe(e),p=d.getDay(),f=(p<h?7:0)+p-h;return d.setDate(d.getDate()-f),d.setHours(0,0,0,0),d}function st(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 nt(e){Ke(1,arguments);var t=qe(e);return t.setHours(0,0,0,0),t}function rt(e,t){Ke(2,arguments);var i=nt(e),s=nt(t),n=i.getTime()-st(i),r=s.getTime()-st(s);return Math.round((n-r)/864e5)}function ot(e,t){return Ke(2,arguments),Qe(e,6e4*je(t))}function at(e,t){return Ke(2,arguments),Qe(e,1e3*je(t))}function lt(e,t){return Ke(2,arguments),Ze(e,12*je(t))}function ct(e,t){Ke(2,arguments);var i=qe(e),s=qe(t),n=i.getTime()-s.getTime();return n<0?-1:n>0?1:n}function ut(e,t){Ke(2,arguments);var i=nt(e),s=nt(t);return i.getTime()===s.getTime()}function ht(e){if(Ke(1,arguments),!function(e){return Ke(1,arguments),e instanceof Date||"object"===Ye(e)&&"[object Date]"===Object.prototype.toString.call(e)}(e)&&"number"!=typeof e)return!1;var t=qe(e);return!isNaN(Number(t))}function dt(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 pt(e,t){Ke(2,arguments);var i=qe(e),s=qe(t),n=dt(i,s),r=Math.abs(rt(i,s));i.setDate(i.getDate()-n*r);var o=n*(r-Number(dt(i,s)===-n));return 0===o?0:o}function ft(e,t){return Ke(2,arguments),qe(e).getTime()-qe(t).getTime()}var mt={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function gt(e){return mt.trunc}function yt(e,t,i){Ke(2,arguments);var s=ft(e,t)/6e4;return gt()(s)}function At(e){Ke(1,arguments);var t=qe(e);return t.setHours(23,59,59,999),t}function St(e){Ke(1,arguments);var t=qe(e);return At(t).getTime()===function(e){Ke(1,arguments);var t=qe(e),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}(t).getTime()}function Tt(e,t){Ke(2,arguments);var i,s=qe(e),n=qe(t),r=ct(s,n),o=Math.abs(function(e,t){Ke(2,arguments);var i=qe(e),s=qe(t);return 12*(i.getFullYear()-s.getFullYear())+(i.getMonth()-s.getMonth())}(s,n));if(o<1)i=0;else{1===s.getMonth()&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-r*o);var a=ct(s,n)===-r;St(qe(e))&&1===o&&1===ct(e,n)&&(a=!1),i=r*(o-Number(a))}return 0===i?0:i}function vt(e,t,i){Ke(2,arguments);var s=ft(e,t)/1e3;return gt()(s)}function Pt(e,t){Ke(2,arguments);var i=qe(e),s=qe(t),n=ct(i,s),r=Math.abs(function(e,t){Ke(2,arguments);var i=qe(e),s=qe(t);return i.getFullYear()-s.getFullYear()}(i,s));i.setFullYear(1584),s.setFullYear(1584);var o=ct(i,s)===-n,a=n*(r-Number(o));return 0===a?0:a}function Ct(e){Ke(1,arguments);var t=qe(e);return t.setSeconds(0,0),t}function bt(e){Ke(1,arguments);var t=qe(e),i=t.getMonth(),s=i-i%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}function Et(e){Ke(1,arguments);var t=qe(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Lt(e){Ke(1,arguments);var t=qe(e),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}function Mt(e){Ke(1,arguments);var t=qe(e),i=/* @__PURE__ */new Date(0);return i.setFullYear(t.getFullYear(),0,1),i.setHours(0,0,0,0),i}function _t(e,t){return Ke(2,arguments),Qe(e,-je(t))}function xt(e){Ke(1,arguments);var t=qe(e),i=t.getUTCDay(),s=(i<1?7:0)+i-1;return t.setUTCDate(t.getUTCDate()-s),t.setUTCHours(0,0,0,0),t}function It(e){Ke(1,arguments);var t=qe(e),i=t.getUTCFullYear(),s=/* @__PURE__ */new Date(0);s.setUTCFullYear(i+1,0,4),s.setUTCHours(0,0,0,0);var n=xt(s),r=/* @__PURE__ */new Date(0);r.setUTCFullYear(i,0,4),r.setUTCHours(0,0,0,0);var o=xt(r);return t.getTime()>=n.getTime()?i+1:t.getTime()>=o.getTime()?i:i-1}function Dt(e){Ke(1,arguments);var t=qe(e),i=xt(t).getTime()-function(e){Ke(1,arguments);var t=It(e),i=/* @__PURE__ */new Date(0);return i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0),xt(i)}(t).getTime();return Math.round(i/6048e5)+1}function Ot(e,t){var i,s,n,r,o,a,l,c;Ke(1,arguments);var u=tt(),h=je(null!==(i=null!==(s=null!==(n=null!==(r=null==t?void 0:t.weekStartsOn)&&void 0!==r?r:null==t||null===(o=t.locale)||void 0===o||null===(a=o.options)||void 0===a?void 0:a.weekStartsOn)&&void 0!==n?n:u.weekStartsOn)&&void 0!==s?s:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==i?i:0);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=qe(e),p=d.getUTCDay(),f=(p<h?7:0)+p-h;return d.setUTCDate(d.getUTCDate()-f),d.setUTCHours(0,0,0,0),d}function wt(e,t){var i,s,n,r,o,a,l,c;Ke(1,arguments);var u=qe(e),h=u.getUTCFullYear(),d=tt(),p=je(null!==(i=null!==(s=null!==(n=null!==(r=null==t?void 0:t.firstWeekContainsDate)&&void 0!==r?r:null==t||null===(o=t.locale)||void 0===o||null===(a=o.options)||void 0===a?void 0:a.firstWeekContainsDate)&&void 0!==n?n:d.firstWeekContainsDate)&&void 0!==s?s:null===(l=d.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==i?i:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var f=/* @__PURE__ */new Date(0);f.setUTCFullYear(h+1,0,p),f.setUTCHours(0,0,0,0);var m=Ot(f,t),g=/* @__PURE__ */new Date(0);g.setUTCFullYear(h,0,p),g.setUTCHours(0,0,0,0);var y=Ot(g,t);return u.getTime()>=m.getTime()?h+1:u.getTime()>=y.getTime()?h:h-1}function Rt(e,t){Ke(1,arguments);var i=qe(e),s=Ot(i,t).getTime()-function(e,t){var i,s,n,r,o,a,l,c;Ke(1,arguments);var u=tt(),h=je(null!==(i=null!==(s=null!==(n=null!==(r=null==t?void 0:t.firstWeekContainsDate)&&void 0!==r?r:null==t||null===(o=t.locale)||void 0===o||null===(a=o.options)||void 0===a?void 0:a.firstWeekContainsDate)&&void 0!==n?n:u.firstWeekContainsDate)&&void 0!==s?s:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==i?i:1),d=wt(e,t),p=/* @__PURE__ */new Date(0);return p.setUTCFullYear(d,0,h),p.setUTCHours(0,0,0,0),Ot(p,t)}(i,t).getTime();return Math.round(s/6048e5)+1}function Nt(e,t){for(var i=e<0?"-":"",s=Math.abs(e).toString();s.length<t;)s="0"+s;return i+s}var Vt=function(e,t){var i=e.getUTCFullYear(),s=i>0?i:1-i;return Nt("yy"===t?s%100:s,t.length)},Ht=function(e,t){var i=e.getUTCMonth();return"M"===t?String(i+1):Nt(i+1,2)},Bt=function(e,t){return Nt(e.getUTCDate(),t.length)},Ft=function(e,t){return Nt(e.getUTCHours()%12||12,t.length)},kt=function(e,t){return Nt(e.getUTCHours(),t.length)},Wt=function(e,t){return Nt(e.getUTCMinutes(),t.length)},Ut=function(e,t){return Nt(e.getUTCSeconds(),t.length)},$t=function(e,t){var i=t.length,s=e.getUTCMilliseconds();return Nt(Math.floor(s*Math.pow(10,i-3)),t.length)},Gt="midnight",zt="noon",Yt="morning",jt="afternoon",Kt="evening",qt="night",Xt={G:function(e,t,i){var s=e.getUTCFullYear()>0?1: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(),n=s>0?s:1-s;return i.ordinalNumber(n,{unit:"year"})}return Vt(e,t)},Y:function(e,t,i,s){var n=wt(e,s),r=n>0?n:1-n;return"YY"===t?Nt(r%100,2):"Yo"===t?i.ordinalNumber(r,{unit:"year"}):Nt(r,t.length)},R:function(e,t){return Nt(It(e),t.length)},u:function(e,t){return Nt(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 Nt(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 Nt(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 Ht(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 Nt(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 n=Rt(e,s);return"wo"===t?i.ordinalNumber(n,{unit:"week"}):Nt(n,t.length)},I:function(e,t,i){var s=Dt(e);return"Io"===t?i.ordinalNumber(s,{unit:"week"}):Nt(s,t.length)},d:function(e,t,i){return"do"===t?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):Bt(e,t)},D:function(e,t,i){var s=function(e){Ke(1,arguments);var t=qe(e),i=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var s=i-t.getTime();return Math.floor(s/864e5)+1}(e);return"Do"===t?i.ordinalNumber(s,{unit:"dayOfYear"}):Nt(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 n=e.getUTCDay(),r=(n-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return Nt(r,2);case"eo":return i.ordinalNumber(r,{unit:"day"});case"eee":return i.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(n,{width:"short",context:"formatting"});default:return i.day(n,{width:"wide",context:"formatting"})}},c:function(e,t,i,s){var n=e.getUTCDay(),r=(n-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return Nt(r,t.length);case"co":return i.ordinalNumber(r,{unit:"day"});case"ccc":return i.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(n,{width:"narrow",context:"standalone"});case"cccccc":return i.day(n,{width:"short",context:"standalone"});default:return i.day(n,{width:"wide",context:"standalone"})}},i:function(e,t,i){var s=e.getUTCDay(),n=0===s?7:s;switch(t){case"i":return String(n);case"ii":return Nt(n,t.length);case"io":return i.ordinalNumber(n,{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,n=e.getUTCHours();switch(s=12===n?zt:0===n?Gt:n/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,n=e.getUTCHours();switch(s=n>=17?Kt:n>=12?jt:n>=4?Yt:qt,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=e.getUTCHours()%12;return 0===s&&(s=12),i.ordinalNumber(s,{unit:"hour"})}return Ft(e,t)},H:function(e,t,i){return"Ho"===t?i.ordinalNumber(e.getUTCHours(),{unit:"hour"}):kt(e,t)},K:function(e,t,i){var s=e.getUTCHours()%12;return"Ko"===t?i.ordinalNumber(s,{unit:"hour"}):Nt(s,t.length)},k:function(e,t,i){var s=e.getUTCHours();return 0===s&&(s=24),"ko"===t?i.ordinalNumber(s,{unit:"hour"}):Nt(s,t.length)},m:function(e,t,i){return"mo"===t?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Wt(e,t)},s:function(e,t,i){return"so"===t?i.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Ut(e,t)},S:function(e,t){return $t(e,t)},X:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return Jt(n);case"XXXX":case"XX":return Qt(n);default:return Qt(n,":")}},x:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"x":return Jt(n);case"xxxx":case"xx":return Qt(n);default:return Qt(n,":")}},O:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Zt(n,":");default:return"GMT"+Qt(n,":")}},z:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Zt(n,":");default:return"GMT"+Qt(n,":")}},t:function(e,t,i,s){var n=s._originalDate||e;return Nt(Math.floor(n.getTime()/1e3),t.length)},T:function(e,t,i,s){return Nt((s._originalDate||e).getTime(),t.length)}};function Zt(e,t){var i=e>0?"-":"+",s=Math.abs(e),n=Math.floor(s/60),r=s%60;if(0===r)return i+String(n);var o=t;return i+String(n)+o+Nt(r,2)}function Jt(e,t){return e%60==0?(e>0?"-":"+")+Nt(Math.abs(e)/60,2):Qt(e,t)}function Qt(e,t){var i=t||"",s=e>0?"-":"+",n=Math.abs(e);return s+Nt(Math.floor(n/60),2)+i+Nt(n%60,2)}var ei=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"})}},ti=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"})}},ii={p:ti,P:function(e,t){var i,s=e.match(/(P+)(p+)?/)||[],n=s[1],r=s[2];if(!r)return ei(e,t);switch(n){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}}",ei(n,t)).replace("{{time}}",ti(r,t))}},si=["D","DD"],ni=["YY","YYYY"];function ri(e,t,i){if("YYYY"===e)throw new 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 new 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 new 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 new 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 oi={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 ai(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 li={date:ai({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:ai({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:ai({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ci={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function ui(e){return function(t,i){var s;if("formatting"===(null!=i&&i.context?String(i.context):"standalone")&&e.formattingValues){var n=e.defaultFormattingWidth||e.defaultWidth,r=null!=i&&i.width?String(i.width):n;s=e.formattingValues[r]||e.formattingValues[n]}else{var o=e.defaultWidth,a=null!=i&&i.width?String(i.width):e.defaultWidth;s=e.values[a]||e.values[o]}return s[e.argumentCallback?e.argumentCallback(t):t]}}function hi(e){return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=i.width,n=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],r=t.match(n);if(!r)return null;var o,a=r[0],l=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?function(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i;return}(l,function(e){return e.test(a)}):function(e,t){for(var i in e)if(e.hasOwnProperty(i)&&t(e[i]))return i;return}(l,function(e){return e.test(a)});return o=e.valueCallback?e.valueCallback(c):c,{value:o=i.valueCallback?i.valueCallback(o):o,rest:t.slice(a.length)}}}function di(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 n=s[0],r=t.match(e.parsePattern);if(!r)return null;var o=e.valueCallback?e.valueCallback(r[0]):r[0];return{value:o=i.valueCallback?i.valueCallback(o):o,rest:t.slice(n.length)}}}var pi={code:"en-US",formatDistance:function(e,t,i){var s,n=oi[e];return s="string"==typeof n?n:1===t?n.one:n.other.replace("{{count}}",t.toString()),null!=i&&i.addSuffix?i.comparison&&i.comparison>0?"in "+s:s+" ago":s},formatLong:li,formatRelative:function(e,t,i,s){return ci[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:ui({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:ui({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:ui({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:ui({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:ui({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:di({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:hi({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:hi({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:hi({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:hi({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:hi({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}},fi=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,mi=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,gi=/^'([^]*?)'?$/,yi=/''/g,Ai=/[a-zA-Z]/;function Si(e,t,i){var s,n,r,o,a,l,c,u,h,d,p,f,m,g,y,A,S,T;Ke(2,arguments);var v=String(t),P=tt(),C=null!==(s=null!==(n=null==i?void 0:i.locale)&&void 0!==n?n:P.locale)&&void 0!==s?s:pi,b=je(null!==(r=null!==(o=null!==(a=null!==(l=null==i?void 0:i.firstWeekContainsDate)&&void 0!==l?l:null==i||null===(c=i.locale)||void 0===c||null===(u=c.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==a?a:P.firstWeekContainsDate)&&void 0!==o?o:null===(h=P.locale)||void 0===h||null===(d=h.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==r?r:1);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var E=je(null!==(p=null!==(f=null!==(m=null!==(g=null==i?void 0:i.weekStartsOn)&&void 0!==g?g:null==i||null===(y=i.locale)||void 0===y||null===(A=y.options)||void 0===A?void 0:A.weekStartsOn)&&void 0!==m?m:P.weekStartsOn)&&void 0!==f?f:null===(S=P.locale)||void 0===S||null===(T=S.options)||void 0===T?void 0:T.weekStartsOn)&&void 0!==p?p:0);if(!(E>=0&&E<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!C.localize)throw new RangeError("locale must contain localize property");if(!C.formatLong)throw new RangeError("locale must contain formatLong property");var L=qe(e);if(!ht(L))throw new RangeError("Invalid time value");var M=_t(L,st(L)),_={firstWeekContainsDate:b,weekStartsOn:E,locale:C,_originalDate:L};return v.match(mi).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,ii[t])(e,C.formatLong):e}).join("").match(fi).map(function(s){if("''"===s)return"'";var n=s[0];if("'"===n)return function(e){var t=e.match(gi);if(!t)return e;return t[1].replace(yi,"'")}(s);var r,o=Xt[n];if(o)return null!=i&&i.useAdditionalWeekYearTokens||(r=s,-1===ni.indexOf(r))||ri(s,t,String(e)),null!=i&&i.useAdditionalDayOfYearTokens||!function(e){return-1!==si.indexOf(e)}(s)||ri(s,t,String(e)),o(M,s,C.localize,_);if(n.match(Ai))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return s}).join("")}var Ti=["years","months","weeks","days","hours","minutes","seconds"];function vi(e){return Ke(1,arguments),qe(e).getDay()}function Pi(e){return Ke(1,arguments),qe(e).getFullYear()}function Ci(e){Ke(1,arguments);var t=qe(e.start),i=qe(e.end);if(isNaN(t.getTime()))throw new RangeError("Start Date is invalid");if(isNaN(i.getTime()))throw new RangeError("End Date is invalid");var s={};s.years=Math.abs(Pt(i,t));var n=ct(i,t),r=Je(t,{years:n*s.years});s.months=Math.abs(Tt(i,r));var o=Je(r,{months:n*s.months});s.days=Math.abs(pt(i,o));var a=Je(o,{days:n*s.days});s.hours=Math.abs(function(e,t,i){Ke(2,arguments);var s=ft(e,t)/36e5;return gt()(s)}(i,a));var l=Je(a,{hours:n*s.hours});s.minutes=Math.abs(yt(i,l));var c=Je(l,{minutes:n*s.minutes});return s.seconds=Math.abs(vt(i,c)),s}function bi(e,t){Ke(2,arguments);var i=qe(e),s=qe(t);return i.getTime()<s.getTime()}function Ei(e){Ke(1,arguments);var t=qe(e);return t.setMinutes(0,0,0),t}function Li(e,t){Ke(2,arguments);var i=Ei(e),s=Ei(t);return i.getTime()===s.getTime()}function Mi(e,t,i){Ke(2,arguments);var s=it(e,i),n=it(t,i);return s.getTime()===n.getTime()}function _i(e,t){Ke(2,arguments);var i=qe(e),s=qe(t);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function xi(e,t){Ke(2,arguments);var i=bt(e),s=bt(t);return i.getTime()===s.getTime()}function Ii(e,t){Ke(2,arguments);var i=qe(e),s=qe(t);return i.getFullYear()===s.getFullYear()}function Di(e,t){return Ke(2,arguments),Xe(e,-je(t))}function Oi(e,t){return Ke(2,arguments),Ze(e,-je(t))}function wi(e){return Ue.parseInstrumentType(e)}const Ri=()=>function(e){Ke(1,arguments);var t=qe(e);return rt(t,Mt(t))+1}(Date.now()),Ni=function(e){const t=/* @__PURE__ */new Map;return(...i)=>{const 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,t){const i=await Xi(e);if(!Array.isArray(i))throw new Error("Invalid server response");const s=i.find(e=>e.isNearest)?.name||"";return{symbols:i.map(e=>e.name),nearest:s}}),Vi=e=>Ni(e,Ri());async function Hi(e){if(!ji(e))return e;const{root:t,dynamic:i,dynamicCode:s}=wi(e);if(!ie(t,i,s))return null;const n=await Vi(t),{symbols:r,nearest:o}=n,a=parseInt(s);if(0===a)return o;const l=a-1;return l<r.length?r[l]:null}function Bi(e){return Ue.getIsFutureOption(e)}function Fi(e){return Ue.getIsFuture(e)}const ki=/^_S_SP_([^_]+)_([^_]+)$/;function Wi(e){const t=e.match(ki);return!(!t||3!==t.length)&&(Fi(t[1])&&Fi(t[2]))}const Ui=/^([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 $i(e){return Ui.test(e)}function Gi(e){return Ue.getIsEquityOption(e)}function zi(e){return String(e%100).padStart(2,"0")}function Yi(e,t=!1){if(!Fi(e))return e;const i=wi(e);return function(e,t,i,s=!1){return`${e}${t}${s?i:zi(i)}`}(i.root,i.month,i.year,t)}function ji(e){const t=wi(e);return ie(t)&&!0===t.dynamic}function Ki(e){const t=Fi(e)||Bi(e),i="_S_"===e.substring(0,2);return(t||Gi(e))&&!i}function qi(e){return Fi(e)?"America/Chicago":"America/New_York"}async function Xi(e){const t=await Fv("futures",`?root=${e}`),i=JSON.parse(t);return i[e]?i[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 Zi(e){if(!Fi(e))return null;return wi(e).root}function Ji(e){if(!Fi(e))return null;const t=wi(e),i=ze.getCodeToNumberMap()[t.month];return Et(new Date(t.year,i-1))}function Qi(e,t){const i=wi(e),s=(i.year+t)%100;return`${i.root}${i.month}${zi(s)}`}function es(e,t){const i=Fi(e),s=$i(e),n=Wi(e);return i?Qi(e,t):s?function(e,t){const i=Ui.exec(e),s=Number.parseInt(i[2]),n=Pi(lt(new Date(s+(s>79?1900:2e3),0,1),t));return`${i[1]}${zi(n)}${i[3]}`}(e,t):n?function(e,t){const i=e.match(ki);return`_S_SP_${Qi(i[1],t)}_${Qi(i[2],t)}`}(e,t):null}async function ts(e){const t=e=>[e,!1,!1],i=Fi(e),s=$i(e),n=function(e){return!!Fi(e)&&"Y"===wi(e).month}(e);if(!i&&!s||n)return t(e);if(i){const{root:t,month:i}=wi(e),s=await Hi(`${t}*1`);if(!ji(e)){const s=(await Vi(t))?.symbols??[];if(s.includes(e))return[e,!0,!1];for(let e of s){if(wi(e).month===i)return[e,!0,!0]}}return[s,!0,!0]}if(s){const i=Ui.exec(e);return t(`${i[1]}${zi(Pi(/* @__PURE__ */new Date))}${i[3]}`)}return t(e)}function is(e){const t=e.getRootNode();return t===document?document.body:t}function ss(e,t=document){const i=rs(e,t);return ie(i)?i.innerHTML:null}function ns(e){e.remove()}function rs(e,t=document){return hs(e,t)[0]}function os(e,t){for(const i in t)e.style[i]=t[i]}function as(e,t){for(const i in t)e.setAttribute(i,t[i])}function ls(e,t,i){const s=rs(`#${e}`,t);if(ie(s))return s;const n=us(t,i);return n.id=e,n}function cs(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 us(e,t){return e.appendChild(document.createElement(t))}function hs(e,t=document){return t.querySelectorAll(e)}function ds(e,t){e&&(e.innerHTML=t)}async function ps(e,t="asyncReadyWork"){ie(this[t])||(this[t]={});const i=this[t];return ie(i.result)?Promise.resolve(i.result):(ie(i.promise)||(i.promise=e.call(this),i.promise.then(e=>{i.result=e})),i.promise)}class fs{_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}}const ms=globalThis.devicePixelRatio||1,gs={EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:q()?20*ms:5*ms,HALF_ANN_POINT_DIMENSION:q()?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_LINE_3:"line3",AT_FILL:"fill",AT_FILL2:"fill2",AT_FILL3:"fill3",AT_FILL4:"fill4",AT_FILL5:"fill5",AT_FILL6:"fill6",AT_FILL7:"fill7",AT_FILL_TEXT:"fillText",AT_SINGLE_STYLE:"singleStyle",AT_SHOW_BACKGROUND:"showBackground",AT_BACKGROUND_OPACITY:"backgroundOpacity",AT_COMPACT:"compact",AT_SHOWN:"shown",AT_VALUE:"value",AT_ACCOUNT_SIZE:"accountSize",AT_RISK:"risk",AT_REWARD:"reward",AT_RATIO:"ratio",AT_KIND:"kind",AT_ARROW:"arrow",AT_VERTEX:"vertex",AT_VERTEX_START:"start",AT_VERTEX_END:"end",AT_VERTEX_BOTH:"both",AT_VERTEX_NONE:"none",AT_TEXT_ITEM:"textItem",AT_RISK_IS_PERCENT:"riskIsPercent",AT_SHOW_PRICES:"showPrices",AT_USE_52WEEK_PRICES:"use52WeekPrices",AT_SHOW_LEVELS:"showLevels",AT_LEVELS_KIND:"levelsKind",AT_LEVELS_VALUES:"Values",AT_LEVELS_PERCENTS:"Percents",AT_LABELS:"labels",AT_LABELS_LEFT:"Left",AT_LABELS_CENTER:"Center",AT_LABELS_RIGHT:"Right",AT_SHOW_BARCOUNT:"showBarCount",AT_EXTEND_PT_1:"extendPoint1",AT_EXTEND_PT_2:"extendPoint2",AT_EXTEND_LEFT:"extendLeft",AT_EXTEND_RIGHT:"extendRight",AT_TEXT_LINES:"textLines",AT_SHOW_TIMESTAMPS:"showTimestamps",AT_SHOW_TRENDLINE:"showTrendline",AT_SHOW_PERCENTDIFF:"showPercentDiff",AT_FACTORS:"factors",AT_FACTOR_ITEM:"factorItem",AT_MARKER:"marker",AT_DRAW_LINES:"drawLines",AT_DRAW_BORDER:"drawBorder",AT_ALLOW_PRICES_CHANGE_UI:"allowPricesChangeUI",AT_PRICES_ON_SCALE:"pricesOnScale",AT_PRICE_LEVELS:"priceLevels",AT_TIME_LEVELS:"timeLevels",AT_SHOW_LABELS:"showLabels",AT_SHOW_LEFT_LABELS:"showLeftLabels",AT_SHOW_RIGHT_LABELS:"showRightLabels",AT_SHOW_TOP_LABELS:"showTopLabels",AT_SHOW_BOTTOM_LABELS:"showBottomLabels",AT_SHOW_ANGLES:"showAngles",AT_REVERSE:"reverse",AT_LEVELS:"levels",AT_FANS:"fans",AT_ARCS:"arcs",AT_SHOW_RANGES_RATIO:"showRangesRatio",AT_PRICE_BAR_RATIO:"priceBarRatio",AT_ANGLES:"angles",AT_NUM_CONTRACTS:"numContracts",AT_POSITION:"position",AT_POSITION_SHORT:"Short",AT_POSITION_LONG:"Long",AT_PROFIT_LOSS:"profitLoss",AT_LEVELS_RESPECT_LOG_SCALE:"levelsRespectLogScale",ANN_ACTION_ID:"Annotation",ANN_DUPLICATE_OFFSET:20,DEFAULT_ADORN_OFFSET:{x:-5,y:-10},LAYOUT_THROTTLE_DELAY:100,MINIMUM_PANE_HEIGHT:10,DEBUG_TIME_FORMAT:"yyyy-LL-dd HH:mm:ss.SSS",DEBUG_SYMBOL:"NOTASYMBOL",DEBUG_CHART_ID:"root",COLOR_DEFAULT_OHLC:"#808080",COLOR_DEFAULT_VARY:["#d33e32","#19ab52"],COLOR_DEFAULT_AREA:"#2d76b3",TOOLTIP_STD:"standard",TOOLTIP_CARDS:"cards",TOOLTIP_BUBBLE:"bubble",TOOLTIP_EXTERNAL:"external",NS_SVG:"http://www.w3.org/2000/svg",NS_XLINK:"http://www.w3.org/1999/xlink",NULL_OBJECT:{magic:8247764655136229},CROSSHAIR_ID:"crosshair_elem_id",ZOOM_X_AXIS_PERCENT:.02,DEFAULT_MAX_RECORDS:640,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:[o.Renko,o.LineBreak,o.Kagi,o.PointAndFigure],INTRA_THRESHOLD:Te("P30D"),ONE_DAY_MILLIS:Te("P1D"),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:Te("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:/* @__PURE__ */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 ys,As,Ss,Ts;function vs(){if(As)return ys;As=1;const e=Be();return ys=/* @__PURE__ */(()=>function(t,i,s,n){if(!e.number(t))return"";(!e.string(s)||s.length>1)&&(s="");const r=t<0&&!0===n;r&&(t=0-t);let o=t.toFixed(i);if(s&&(t<-999||t>999)){const e=t<0;let n=0===i,a=0;const l=[];for(let t=o.length-1;!(t<0);t--){3!==a||e&&0===t||(l.unshift(s),a=0);const i=o.charAt(t);l.unshift(i),n?a+=1:"."===i&&(n=!0)}r&&(l.unshift("("),l.push(")")),o=l.join("")}else r&&(o="("+o+")");return o})()}function Ps(){if(Ts)return Ss;Ts=1;const e=Be();return Ss=/* @__PURE__ */(()=>function(t,i,s,n,r){if(!e.number(t))return"";if(!e.number(i))return"";if(!e.number(s))return"";(!e.string(n)||n.length>1)&&(n=".");const o=Math.abs(t),a=function(e,t){const i=Math.floor(e);return 0===i&&""===t?"":i}(o,n),l=function(e){return e-Math.floor(e)}(o)*i,c=function(e,t){return["000",Math.floor(e)].join("").substr(-1*t)}(Math.floor(parseFloat(l.toFixed(1))),s);let u,h;return t<0?(r=e.boolean(r)&&r)?(u="(",h=")"):(u="-",h=""):(u="",h=""),[u,a,n,c,h].join("")})()}var Cs,bs,Es,Ls,Ms,_s,xs,Is={exports:{}},Ds=Is.exports;function Os(){return Cs||(Cs=1,e=Is,function(t){var i,s=1e6,n=1e6,r="[big.js] ",o=r+"Invalid ",a=o+"decimal places",l=o+"rounding mode",c=r+"Division by zero",u={},h=void 0,d=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function p(e,t,i,s){var n=e.c;if(i===h&&(i=e.constructor.RM),0!==i&&1!==i&&2!==i&&3!==i)throw Error(l);if(t<1)s=3===i&&(s||!!n[0])||0===t&&(1===i&&n[0]>=5||2===i&&(n[0]>5||5===n[0]&&(s||n[1]!==h))),n.length=1,s?(e.e=e.e-t+1,n[0]=1):n[0]=e.e=0;else if(t<n.length){if(s=1===i&&n[t]>=5||2===i&&(n[t]>5||5===n[t]&&(s||n[t+1]!==h||1&n[t-1]))||3===i&&(s||!!n[0]),n.length=t,s)for(;++n[--t]>9;)if(n[t]=0,0===t){++e.e,n.unshift(1);break}for(t=n.length;!n[--t];)n.pop()}return e}function f(e,t,i){var s=e.e,n=e.c.join(""),r=n.length;if(t)n=n.charAt(0)+(r>1?"."+n.slice(1):"")+(s<0?"e":"e+")+s;else if(s<0){for(;++s;)n="0"+n;n="0."+n}else if(s>0)if(++s>r)for(s-=r;s--;)n+="0";else s<r&&(n=n.slice(0,s)+"."+n.slice(s));else r>1&&(n=n.charAt(0)+"."+n.slice(1));return e.s<0&&i?"-"+n:n}u.abs=function(){var e=new this.constructor(this);return e.s=1,e},u.cmp=function(e){var t,i=this,s=i.c,n=(e=new i.constructor(e)).c,r=i.s,o=e.s,a=i.e,l=e.e;if(!s[0]||!n[0])return s[0]?r:n[0]?-o:0;if(r!=o)return r;if(t=r<0,a!=l)return a>l^t?1:-1;for(o=(a=s.length)<(l=n.length)?a:l,r=-1;++r<o;)if(s[r]!=n[r])return s[r]>n[r]^t?1:-1;return a==l?0:a>l^t?1:-1},u.div=function(e){var t=this,i=t.constructor,n=t.c,r=(e=new i(e)).c,o=t.s==e.s?1:-1,l=i.DP;if(l!==~~l||l<0||l>s)throw Error(a);if(!r[0])throw Error(c);if(!n[0])return e.s=o,e.c=[e.e=0],e;var u,d,f,m,g,y=r.slice(),A=u=r.length,S=n.length,T=n.slice(0,u),v=T.length,P=e,C=P.c=[],b=0,E=l+(P.e=t.e-e.e)+1;for(P.s=o,o=E<0?0:E,y.unshift(0);v++<u;)T.push(0);do{for(f=0;f<10;f++){if(u!=(v=T.length))m=u>v?1:-1;else for(g=-1,m=0;++g<u;)if(r[g]!=T[g]){m=r[g]>T[g]?1:-1;break}if(!(m<0))break;for(d=v==u?r:y;v;){if(T[--v]<d[v]){for(g=v;g&&!T[--g];)T[g]=9;--T[g],T[v]+=10}T[v]-=d[v]}for(;!T[0];)T.shift()}C[b++]=m?f:++f,T[0]&&m?T[v]=n[A]||0:T=[n[A]]}while((A++<S||T[0]!==h)&&o--);return C[0]||1==b||(C.shift(),P.e--,E--),b>E&&p(P,E,i.RM,T[0]!==h),P},u.eq=function(e){return 0===this.cmp(e)},u.gt=function(e){return this.cmp(e)>0},u.gte=function(e){return this.cmp(e)>-1},u.lt=function(e){return this.cmp(e)<0},u.lte=function(e){return this.cmp(e)<1},u.minus=u.sub=function(e){var t,i,s,n,r=this,o=r.constructor,a=r.s,l=(e=new o(e)).s;if(a!=l)return e.s=-l,r.plus(e);var c=r.c.slice(),u=r.e,h=e.c,d=e.e;if(!c[0]||!h[0])return h[0]?e.s=-l:c[0]?e=new o(r):e.s=1,e;if(a=u-d){for((n=a<0)?(a=-a,s=c):(d=u,s=h),s.reverse(),l=a;l--;)s.push(0);s.reverse()}else for(i=((n=c.length<h.length)?c:h).length,a=l=0;l<i;l++)if(c[l]!=h[l]){n=c[l]<h[l];break}if(n&&(s=c,c=h,h=s,e.s=-e.s),(l=(i=h.length)-(t=c.length))>0)for(;l--;)c[t++]=0;for(l=t;i>a;){if(c[--i]<h[i]){for(t=i;t&&!c[--t];)c[t]=9;--c[t],c[i]+=10}c[i]-=h[i]}for(;0===c[--l];)c.pop();for(;0===c[0];)c.shift(),--d;return c[0]||(e.s=1,c=[d=0]),e.c=c,e.e=d,e},u.mod=function(e){var t,i=this,s=i.constructor,n=i.s,r=(e=new s(e)).s;if(!e.c[0])throw Error(c);return i.s=e.s=1,t=1==e.cmp(i),i.s=n,e.s=r,t?new s(i):(n=s.DP,r=s.RM,s.DP=s.RM=0,i=i.div(e),s.DP=n,s.RM=r,this.minus(i.times(e)))},u.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},u.plus=u.add=function(e){var t,i,s,n=this,r=n.constructor;if(e=new r(e),n.s!=e.s)return e.s=-e.s,n.minus(e);var o=n.e,a=n.c,l=e.e,c=e.c;if(!a[0]||!c[0])return c[0]||(a[0]?e=new r(n):e.s=n.s),e;if(a=a.slice(),t=o-l){for(t>0?(l=o,s=c):(t=-t,s=a),s.reverse();t--;)s.push(0);s.reverse()}for(a.length-c.length<0&&(s=c,c=a,a=s),t=c.length,i=0;t;a[t]%=10)i=(a[--t]=a[t]+c[t]+i)/10|0;for(i&&(a.unshift(i),++l),t=a.length;0===a[--t];)a.pop();return e.c=a,e.e=l,e},u.pow=function(e){var t=this,i=new t.constructor("1"),s=i,r=e<0;if(e!==~~e||e<-1e6||e>n)throw Error(o+"exponent");for(r&&(e=-e);1&e&&(s=s.times(t)),e>>=1;)t=t.times(t);return r?i.div(s):s},u.prec=function(e,t){if(e!==~~e||e<1||e>s)throw Error(o+"precision");return p(new this.constructor(this),e,t)},u.round=function(e,t){if(e===h)e=0;else if(e!==~~e||e<-s||e>s)throw Error(a);return p(new this.constructor(this),e+this.e+1,t)},u.sqrt=function(){var e,t,i,s=this,n=s.constructor,o=s.s,a=s.e,l=new n("0.5");if(!s.c[0])return new n(s);if(o<0)throw Error(r+"No square root");0===(o=Math.sqrt(+f(s,!0,!0)))||o===1/0?((t=s.c.join("")).length+a&1||(t+="0"),a=((a+1)/2|0)-(a<0||1&a),e=new n(((o=Math.sqrt(t))==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+a)):e=new n(o+""),a=e.e+(n.DP+=4);do{i=e,e=l.times(i.plus(s.div(i)))}while(i.c.slice(0,a).join("")!==e.c.slice(0,a).join(""));return p(e,(n.DP-=4)+e.e+1,n.RM)},u.times=u.mul=function(e){var t,i=this,s=i.constructor,n=i.c,r=(e=new s(e)).c,o=n.length,a=r.length,l=i.e,c=e.e;if(e.s=i.s==e.s?1:-1,!n[0]||!r[0])return e.c=[e.e=0],e;for(e.e=l+c,o<a&&(t=n,n=r,r=t,c=o,o=a,a=c),t=new Array(c=o+a);c--;)t[c]=0;for(l=a;l--;){for(a=0,c=o+l;c>l;)a=t[c]+r[l]*n[c-l-1]+a,t[c--]=a%10,a=a/10|0;t[c]=a}for(a?++e.e:t.shift(),l=t.length;!t[--l];)t.pop();return e.c=t,e},u.toExponential=function(e,t){var i=this,n=i.c[0];if(e!==h){if(e!==~~e||e<0||e>s)throw Error(a);for(i=p(new i.constructor(i),++e,t);i.c.length<e;)i.c.push(0)}return f(i,!0,!!n)},u.toFixed=function(e,t){var i=this,n=i.c[0];if(e!==h){if(e!==~~e||e<0||e>s)throw Error(a);for(e=e+(i=p(new i.constructor(i),e+i.e+1,t)).e+1;i.c.length<e;)i.c.push(0)}return f(i,!1,!!n)},u.toJSON=u.toString=function(){var e=this,t=e.constructor;return f(e,e.e<=t.NE||e.e>=t.PE,!!e.c[0])},u.toNumber=function(){var e=+f(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(r+"Imprecise conversion");return e},u.toPrecision=function(e,t){var i=this,n=i.constructor,r=i.c[0];if(e!==h){if(e!==~~e||e<1||e>s)throw Error(o+"precision");for(i=p(new n(i),e,t);i.c.length<e;)i.c.push(0)}return f(i,e<=i.e||i.e<=n.NE||i.e>=n.PE,!!r)},u.valueOf=function(){var e=this,t=e.constructor;if(!0===t.strict)throw Error(r+"valueOf disallowed");return f(e,e.e<=t.NE||e.e>=t.PE,!0)},i=function e(){function t(i){var s=this;if(!(s instanceof t))return i===h?e():new t(i);if(i instanceof t)s.s=i.s,s.e=i.e,s.c=i.c.slice();else{if("string"!=typeof i){if(!0===t.strict&&"bigint"!=typeof i)throw TypeError(o+"value");i=0===i&&1/i<0?"-0":String(i)}!function(e,t){var i,s,n;if(!d.test(t))throw Error(o+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(i=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(i<0&&(i=s),i+=+t.slice(s+1),t=t.substring(0,s)):i<0&&(i=t.length),n=t.length,s=0;s<n&&"0"==t.charAt(s);)++s;if(s==n)e.c=[e.e=0];else{for(;n>0&&"0"==t.charAt(--n););for(e.e=i-s-1,e.c=[],i=0;s<=n;)e.c[i++]=+t.charAt(s++)}}(s,i)}s.constructor=t}return t.prototype=u,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}(),i.default=i.Big=i,e.exports?e.exports=i:t.Big=i}(Ds)),Is.exports;var e}function ws(){if(Ms)return Ls;Ms=1;const e=Fe(),t=function(){if(Es)return bs;Es=1;const e=Fe(),t=ke(),i=Be(),s=Os();return bs=(()=>{class n{constructor(e){this._big=h(e)}add(e){return new n(this._big.plus(h(e)))}subtract(e){return new n(this._big.minus(h(e)))}multiply(e){return new n(this._big.times(h(e)))}divide(e){return new n(this._big.div(h(e)))}raise(t){return e.argumentIsRequired(t,"exponent",Number),new n(this._big.pow(t))}round(t,i){e.argumentIsRequired(t,"places",Number),e.argumentIsOptional(i,"mode",d,"RoundingMode");const s=i||d.NORMAL;return new n(this._big.round(t,s.value))}mod(e){return new n(this._big.mod(h(e)))}absolute(){return new n(this._big.abs())}opposite(){return this.multiply(-1)}getIsZero(t,n){return e.argumentIsOptional(t,"approximate",Boolean),e.argumentIsOptional(n,"places",Number),this._big.eq(r)||i.boolean(t)&&t&&this.round(n||s.DP,d.NORMAL).getIsZero()}getIsPositive(){return this._big.gt(r)}getIsNegative(){return this._big.lt(r)}getIsGreaterThan(e){return this._big.gt(h(e))}getIsGreaterThanOrEqual(e){return this._big.gte(h(e))}getIsLessThan(e){return this._big.lt(h(e))}getIsLessThanOrEqual(e){return this._big.lte(h(e))}getIsBetween(t,s,n){return e.argumentIsOptional(n,"exclusive",Boolean),i.boolean(n)&&n?this.getIsGreaterThan(t)&&this.getIsLessThan(s):this.getIsGreaterThanOrEqual(t)&&this.getIsLessThanOrEqual(s)}getIsEqual(e){return this._big.eq(h(e))}getIsApproximate(e,t){if(0===t)return this.getIsEqual(e);const i=this.subtract(e).absolute(),s=n.ONE.divide(new n(10).raise(t));return i.getIsLessThan(s)}getIsInteger(){return this.getIsEqual(this.round(0))}getDecimalPlaces(){const e=this.toFixed().match(/-?\d*\.(\d*)/);let t;return t=null===e?0:e[1].length,t}toFloat(t){return e.argumentIsOptional(t,"places",Number),parseFloat(this._big.toFixed(t||16))}toFixed(){return this._big.toFixed()}toNumber(){return this._big.toNumber()}toJSON(){return this.toFixed()}static clone(t){return e.argumentIsRequired(t,"value",n,"Decimal"),new n(t._big)}static parse(e){return new n(e)}static get ZERO(){return l}static get ONE(){return c}static get NEGATIVE_ONE(){return u}static get ROUNDING_MODE(){return d}static getIsZero(t){return e.argumentIsRequired(t,"instance",n,"Decimal"),t.getIsZero()}static getIsNotZero(t){return e.argumentIsRequired(t,"instance",n,"Decimal"),!t.getIsZero()}static getIsPositive(t){return e.argumentIsRequired(t,"instance",n,"Decimal"),t.getIsPositive()}static getIsNotPositive(t){return e.argumentIsRequired(t,"instance",n,"Decimal"),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return e.argumentIsRequired(t,"instance",n,"Decimal"),t.getIsNegative()}static getIsNotNegative(t){return e.argumentIsRequired(t,"instance",n,"Decimal"),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,i){return e.argumentIsRequired(t,"a",n,"Decimal"),e.argumentIsRequired(i,"b",n,"Decimal"),t._big.gt(i._big)?1:t._big.lt(i._big)?-1:0}toString(){return"[Decimal]"}}const r=new s(0),o=new s(1),a=new s(-1),l=new n(r),c=new n(o),u=new n(a);function h(e){return e instanceof s?e:e instanceof n?e._big:new s(e)}class d extends t{constructor(e,t){super(e.toString(),t),this._value=e}get value(){return this._value}static get UP(){return p}static get DOWN(){return f}static get NORMAL(){return m}toString(){return"[RoundingMode]"}}const p=new d(3,"up"),f=new d(0,"down"),m=new d(1,"normal");return n})()}(),i=Be(),s=ke();return Ls=(()=>{class n extends s{constructor(e,t,i,s,n,r,o,a){super(e,e),this._baseCode=t,this._decimalDigits=i,this._supportsFractions=s,s?(this._fractionFactor=n,this._fractionDigits=r,this._fractionFactorSpecial=o||n,this._fractionDigitsSpecial=a||r):(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(s){e.argumentIsValid(s,"tickIncrement",i.integer,"must be an integer");const n=new t(1),r=new t(10);let o;o=this.supportsFractions?n.divide(this._fractionFactor):n.divide(r.raise(this._decimalDigits));return o.multiply(s).toFloat()}getMinimumTickValue(s,n){e.argumentIsValid(s,"tickIncrement",i.integer,"must be an integer"),e.argumentIsValid(n,"pointValue",i.number,"must be a number");return new t(this.getMinimumTick(s)).multiply(n).toFloat()}roundToNearestTick(s,n,r){let o;e.argumentIsValid(s,"value",e=>i.number(e)||e instanceof t,"must be a number primitive or a Decimal instance"),e.argumentIsValid(n,"minimumTick",e=>i.number(e)||e instanceof t,"must be a number primitive or a Decimal instance"),e.argumentIsOptional(r,"roundToZero",Boolean),o=s instanceof t?s:new t(s);let a=o.divide(n);return o.mod(n).getIsZero()||(a=a.round(0,i.boolean(r)&&r?t.ROUNDING_MODE.DOWN:t.ROUNDING_MODE.NORMAL)),a.multiply(n).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(e){return s.fromCode(n,e)}static fromBaseCode(e){return s.getItems(n).find(t=>t.baseCode===e)||null}}return new n("2",-1,3,!0,8,1),new n("3",-2,4,!0,16,2),new n("4",-3,5,!0,32,2),new n("5",-4,6,!0,64,2,320,3),new n("6",-5,7,!0,128,3,320,3),new n("7",-6,8,!0,256,3,320,3),new n("8",0,0,!1),new n("9",1,1,!1),new n("A",2,2,!1),new n("B",3,3,!1),new n("C",4,4,!1),new n("D",5,5,!1),new n("E",6,6,!1),new n("F",7,7,!1),n})()}function Rs(){if(xs)return _s;xs=1;const e=Be(),t=vs(),i=Ps(),s=ws();return _s=/* @__PURE__ */(()=>function(n,r,o,a,l,c){if(!e.number(n))return"";const u=s.parse(r);if(null===u)return"";if((!e.string(o)||o.length>1)&&(o="."),a=e.boolean(a)&&a,c=e.boolean(c)&&c,u.supportsFractions&&"."!==o){const e=u.getFractionFactor(a),t=u.getFractionDigits(a);return i(n,e,t,o,c)}return t(n,u.decimalDigits,l,c)})()}const Ns=/* @__PURE__ */He(Rs());const Vs=/* @__PURE__ */He(vs());var Hs,Bs;const Fs=/* @__PURE__ */He(function(){if(Bs)return Hs;Bs=1;const e=We(),t=Ps(),i=Rs();return Hs=(()=>{const s={};return s.ZB=/^BB\d$/,s.ZT=/^BT\d$/,s.ZF=/^BF\d$/,s.ZN=/^BN\d$/,function(n,r,o){if(o.asset===e.FUTURE_OPTION){const e=o.root;if("ZB"===e||"ZN"===e||s.ZB.test(e)||s.ZN.test(e))return t(n,64,2,"-",!1);if("ZT"===e||"ZF"===e||s.ZT.test(e)||s.ZF.test(e))return t(n,640,3,"-",!1)}return i(n,r,"-",!0,",")}})()}()),ks=[{min:0,divider:1,suffix:"",decimals:0},{min:1e5,divider:1e3,suffix:"K",decimals:0},{min:1e6,divider:1e6,suffix:"M",decimals:2},{min:1e9,divider:1e9,suffix:"B",decimals:3},{min:1e12,divider:1e12,suffix:"T",decimals:3}];function Ws(e){if(ie(e)){const i=ce(Gv().config,null,"overrides","symbology","translateSymbol");if(ie(i)&&"function"==typeof i)try{const t=i(e);if(ie(t))return t}catch(t){Hv(`Failed translating the symbol '${e}', error is ${t.message}`,"warn")}}return e}function Us(e,t,i){if(null==e)return"";if(!this.isReady)return e.toFixed(0);if(t.format===u.FromMetaData)return function(e,t,i){const s=Gv().config;return s.mode===v[v.cmdtyView]&&null!=i?Fs(e,t,i):Ns(e,t,"-",s.isAlt64,",",!1)}(e,this.unitCode,this._profile);switch(t.format){case u.AsInteger:return e.toFixed();case u.UseMetricUnit:{i=i||{};const t=Object.assign({},{range:[e,e],allDigits:!1},i);if(i.allDigits)return zs(e,0);Array.isArray(t.range)&&t.range.length||(t.range=[e,e]);const s=Math.max(Math.abs(t.range[0]),Math.abs(t.range[1])),n=function(e,t){const i=H(e,t);return-1===i?null:e[i]}(ks,e=>s>e.min)||ks[0];return`${(e/n.divider).toFixed(n.decimals)}${n.suffix}`}case u.AsPercent:return`${(100*e).toFixed(2)}%`;default:return""}}function $s(e,t,i){const s=i?.overridePrecision;return Number.isFinite(s)&&s>=0?zs(e,s):null}class Gs{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=qi(Ws(this.symbol)),this._profile=null}initialize(e){Ks(e)||de(this,e),this._profile=e}get isReady(){return this.unitCode.length>0}get minMovement(){if(!this.isReady)return 0;if(null==this._minMovement){const e=Number.parseInt(this.unitCode,16),t=1/(e<8?2<<e:10**(e-8));this._minMovement=this.tickIncrement*t}return this._minMovement}format(e,t,i){const s=$s(e,0,i);return null!==s?s:Us.call(this,e,t,i)}parse(e){throw new Error("Not implemented yet")}getInlineMetadata(e){if("undefined"==typeof document)return null;const t=ss(`#${gs.INLINE_DATA_ELEMENT_ID}`);if(!ie(t))return null;const i=JSON.parse(t);let s=e;const n=e=>e in i;return n(s)||(s=function(e,t){if(!Fi(e))return e;const i=wi(e);return t.find(e=>wi(e).root===i.root)||e}(e,Object.keys(i)),n(s))?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{const t=encodeURIComponent(e),i=await Fv("ondemand",`/${this.getFallbackApi()}.json?symbols=${t}`),s=JSON.parse(i);if(200===s.status.code&&1===s.results.length){const e=s.results[0];return this.processFallback(e)}}catch(t){Hv(`Failed fetching the metadata for ${e}, error is ${t.message}`,"warn")}return{name:"",exchange:"",unitCode:"A",pointValue:1,tickIncrement:1}}}function zs(e,t){return Vs(e,t,",",!1)}function Ys(e,t=!1){return new tn(e,t)}class js extends Gs{shutdown(){}async ready(){return ps.call(this,async()=>{const e=Ws(this.symbol);let t=this.getInlineMetadata(e);return Ks(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0})}getCacheableEntities(e){e.add(this)}}function Ks(e){return!te(e)||!ie(e.unitCode,e.name,e.exchange)||0===e.unitCode.length}class qs extends Gs{shutdown(){}equityOptionProfile(){return{name:this.symbol,exchange:"",unitCode:"A",pointValue:1,tickIncrement:1,symbolType:"EquityOption"}}async ready(){return ps.call(this,async()=>{const e=Ws(this.symbol);if(Gi(e))return this.initialize(this.equityOptionProfile()),!0;const t=ji(e),i=await(t?Hi(e):e);this.resolved=Yi(i);const[s,n]=await ts(this.resolved),r=new Promise(e=>{setTimeout(()=>e(null),gs.META_DATA_GET_TIMETOUT)});let o=await Promise.race([r,this.getProfile(s)]);return Ks(o)&&(o=this.getInlineMetadata(s)),Ks(o)&&(o=await this.getFallbackMetadata(s)),"Unknown"===o?.symbolType&&n&&(o.symbolType="Future"),this.initialize(o),!0})}async getProfile(e){return Promise.reject(new Error("Method shold be implemented in the derived class."))}getCacheableEntities(e){e.add(this)}}class Xs extends qs{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){const t=Gv(),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 Zs=/* @__PURE__ */(e=>(e[e.UNKNOWN_INSTRUMENT_TYPE=0]="UNKNOWN_INSTRUMENT_TYPE",e[e.FOREX=1]="FOREX",e[e.INDEX=2]="INDEX",e[e.EQUITY=3]="EQUITY",e[e.FUTURE=4]="FUTURE",e[e.OPTION=5]="OPTION",e[e.SPREAD=6]="SPREAD",e[e.MUTUAL_FUND=7]="MUTUAL_FUND",e[e.MONEY_MARKET_FUND=8]="MONEY_MARKET_FUND",e[e.USER_DEFINED_SPREAD=9]="USER_DEFINED_SPREAD",e[e.EQUITY_OPTION=10]="EQUITY_OPTION",e[e.OTHER=99]="OTHER",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Zs||{});class Js extends qs{_profileSource=new fs;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){const t=e.definition;return t.instrumentType=Zs[t.instrumentType],this.getProfileFromInstrumentDefinition(t)}getProfileFromInstrumentDefinition(e){this.expirationDate=e.symbolExpiration;const{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){const t=Gv(),i=await(t.getAdapter()?.getInstrument(this.getRequest(e)))??[];return i.length<1?null:this.getProfileFromInstrumentDefinition(i[0])}}class Qs{_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 new Error("Method not implemented.")}get isReady(){return!0}async ready(){return!0}format(e,t,i){if(null==e)return"";const s=$s(e,0,i);return null!==s?s:zs(e,this._decimals)}getCacheableEntities(e){}}class en{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?"":ie(e)?e.toFixed(0):""}getCacheableEntities(e){}}class tn{inner;forceDecimals;unitCode="";pointValue=1;tickIncrement=1;minMovement=0;symbol="";symbolType="Unknown";resolved="";name="";exchange="";constructor(e,t=!1){const i=Gv().getMetaDataSource();this.inner=e.map(e=>i.getMetaData(e)),this.forceDecimals=t}get isReady(){return null!=this.unitCode}async ready(){return ps.call(this,async()=>{const e=(await Promise.all(this.inner.map(e=>e.ready()))).every(I);if(e){const e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:i,no:s}=V(this.inner,e=>t(e)>=8),n=this.inner.length,r=e=>Math.max(...e).toString(16).toUpperCase();if(this.forceDecimals||i.length!==n&&s.length!==n){const n="B".charCodeAt(0),o=i.map(t).concat(s.map(t).map(e=>String.fromCharCode(e-2+n)).map(e));this.unitCode=r(o)}else this.unitCode=r(this.inner.map(t));this.minMovement=Math.min(...this.inner.map(e=>e.minMovement))}return e})}format(e,t,i){const s=$s(e,0,i);return null!==s?s:Us.call(this,e,t,i)}getCacheableEntities(e){this.inner.forEach(t=>e.add(t))}shutdown(){}}class sn{metaDataCache;constructor(){this.metaDataCache=/* @__PURE__ */new Map}getMetaData(e){if(e===gs.PLACEHOLDER_SYMBOL_NAME)return new en;if(this.metaDataCache.has(e))return this.metaDataCache.get(e);{const t=this.metaDataCreator(e);return this.metaDataCache.set(e,t),t}}evictUnused(e){for(const[t,i]of this.metaDataCache)e.has(i)||(i.shutdown(),this.metaDataCache.delete(t))}}class nn extends sn{metaDataCreator(e){return new js(e)}}class rn extends sn{metaDataCreator(e){return new Xs(e)}}class on extends sn{metaDataCreator(e){return new Js(e)}}const an=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,ln=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,cn=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,un={r:255,g:255,b:255,a:1},hn={r:0,g:0,b:0,a:1};function dn(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function pn(e,t){const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)}function fn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function mn(e,t){return{x:e.x+t.x,y:e.y+t.y}}function gn(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function yn(e,t,i){const[s,n]=e,r=n.x-s.x,o=n.y-s.y,a=t.x-s.x,l=t.y-s.y;if(0===r&&0===o)return Math.abs(a)<=i&&Math.abs(l)<=i;const c=Math.atan2(o,r),u=Math.sqrt(r*r+o*o),h=Math.atan2(l,a),d=Math.sqrt(a*a+l*l),p=d*Math.cos(h-c),f=d*Math.sin(h-c);return Math.abs(f)<=i&&-i<=p&&p<=u+i}function An(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(I)}function Sn(e){return function(e){const t=e=>{const t=e.toString(16);return 2===t.length?t:"0"+t};return`#${t(e.r)}${t(e.g)}${t(e.b)}`}(bn(e))}function Tn(e,t){const i=bn(e);return i.a=t,Mn(i)}function vn(e,t,i,s=!1){const n=e.a,r=s=>Math.floor(e[s]+(t[s]-e[s])*i);return{r:r("r"),g:r("g"),b:r("b"),a:Math.min(1,(1+(s?i:0))*n)}}const Pn=(e,t=!1)=>x(bn,i=>vn(i,hn,e,t),Mn);function Cn(e,t=!1){return x(bn,i=>vn(i,un,e,t),Mn)}function bn(e){if(["r","g","b","a"].map(t=>e[t]).every(e=>ie(e)))return e;const t=ie(e.linearGradient)?e._refColor:e,i=an.exec(t);if(null!==i){const e=ie(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}}{const e=cn.exec(t),i=ln.exec(t),s=(e,t)=>ie(e)&&e.length===t,n=s(e,5),r=s(i,4);if(!n&&!r)throw new Error("Color is neither a hex color nor a rgba one.");const o=n?e:i,a=e=>parseInt(o[e]),l=parseFloat(o[4]);return{r:a(1),g:a(2),b:a(3),a:n?l:1}}}function En(e){const{r:t,g:i,b:s}=bn(e),[n,r,o]=[t,i,s].map(e=>{const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)});return function(e){return e<=.008856?903.3*e:116*Math.pow(e,1/3)-16}(.2126*n+.7152*r+.0722*o)}function Ln(e){return En(e)>66.66?"#000":"#fff"}function Mn(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function _n(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}class xn{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 xn(this.x,this.y,this.width,this.height)}}class In{constructor(e,t,i,s){this.cx=e,this.cy=t,this.radiusX=i,this.radiusY=s}contains(e){const t=Math.abs(e.x-this.cx)/this.radiusX,i=Math.abs(e.y-this.cy)/this.radiusY;return Math.sqrt(t*t+i*i)<=1}}function Dn(e,t){e.moveTo(t.x,t.y)}function On(e,t){e.lineTo(t.x,t.y)}function wn(e,t,i){e.rect(t.x,t.y,i.x-t.x,i.y-t.y)}function Rn(e,t=gs.LINE_HEIGHT_MULTIPLIER){return t*e.measureText("M").width}function Nn(e,t=!1,i=1){const s=Vn(e,t,i).y;return s-Math.sign(s)*gs.DEFAULT_ADORN_OFFSET.y}function Vn(e,t=!1,i=1){const s={...gs.DEFAULT_ADORN_OFFSET};return t&&(s.y=-(i*Rn(e,1)+s.y)),s}function Hn(e,t,i,s=g.Left){const n=Array.isArray(t)?t:[t],r=Rn(e,1),o=Math.max(...n.map(t=>e.measureText(t).width)),a=r*n.length;let l=i.x;s===g.Right&&(l-=o),s===g.Center&&(l-=o/2);const c=i.y-r;return u=new xn(l,c,o,a),h=4,d=4,u.x-=h,u.y-=d,u.width+=2*h,u.height+=2*d,u;var u,h,d}function Bn(e,t,i,s=g.Left,n,r){e.save();const o=Array.isArray(t)?t:[t],a=Rn(e,1);if(ie(r)){const n=Hn(e,t,i,s);e.fillStyle=r,Fn(e,n,!1)}ie(n)&&(e.fillStyle=n);const l=i.x;let c=i.y;o.forEach(t=>{e.textAlign=g[s].toLowerCase(),e.fillText(t,l,c),c+=a}),e.restore()}function Fn(e,t,i=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),i&&e.stroke(),e.fill()}function kn(e,t,i,s=0,n=Math.PI,r=!1,o=!1){e.beginPath(),o&&e.moveTo(t.x,t.y),e.arc(t.x,t.y,Math.abs(i),s,n,r),e.stroke(),o&&e.fill()}function Wn(e,{x:t,y:i},{x:s,y:n}){e.beginPath(),e.moveTo(t,i),e.lineTo(s,n),e.stroke()}function Un(e,t,i,s){Wn(e,{x:t,y:i},{x:t,y:s})}function $n(e,t,i,s){Wn(e,{x:i,y:t},{x:s,y:t})}function Gn(e,t,i){switch(t){case"zero":zn(e,i,"0");break;case"one":zn(e,i,"1");break;case"two":zn(e,i,"2");break;case"three":zn(e,i,"3");break;case"four":zn(e,i,"4");break;case"five":zn(e,i,"5");break;case"six":zn(e,i,"6");break;case"seven":zn(e,i,"7");break;case"eight":zn(e,i,"8");break;case"nine":zn(e,i,"9");break;case"question":zn(e,i,"?");break;case"fish_hook":!function(e,t){e.save(),e.translate(t.x,t.y);const i=Math.min(t.width,t.height),s=i/560;e.scale(s,s),e.lineCap="butt",e.lineJoin="miter",e.miterLimit=4,e.save(),e.save(),e.miterLimit=10,e.beginPath(),e.moveTo(377.8,354.8),e.bezierCurveTo(377.8,354.8,401.8,517.8,290.6,507),e.bezierCurveTo(173.2,495.5,171.5,50.39,171.5,50.39),e.bezierCurveTo(171.5,50.39,191.7,252.59,212.3,351),e.bezierCurveTo(212.3,351,230.9,472.8,286.7,488.7),e.bezierCurveTo(350.4,507,369.5,452.7,377.8,354.79),e.closePath(),e.fill(),e.restore(),e.save(),e.miterLimit=10,e.beginPath(),e.moveTo(378.3,351.1),e.lineTo(341.1,446.6),e.lineTo(371.2,436.7),e.lineTo(378.3,351.1),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}(e,i);break;case"arrow_up":!function(e,t){e.save();const{cx:i,cy:s,left:n,right:r,top:o,bottom:a,halfBaseSize:l}=Yn(t);e.beginPath(),e.moveTo(r,s),e.lineTo(i,o),e.lineTo(n,s),e.lineTo(Math.floor(i-l),s),e.lineTo(Math.floor(i-l),a),e.lineTo(Math.floor(i+l),a),e.lineTo(Math.floor(i+l),s),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arrow_down":!function(e,t){e.save();const{cx:i,cy:s,left:n,right:r,top:o,bottom:a,halfBaseSize:l}=Yn(t);e.beginPath(),e.moveTo(r,s),e.lineTo(i,a),e.lineTo(n,s),e.lineTo(Math.floor(i-l),s),e.lineTo(Math.floor(i-l),o),e.lineTo(Math.floor(i+l),o),e.lineTo(Math.floor(i+l),s),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arrow_right":!function(e,t){e.save();const{cx:i,cy:s,left:n,right:r,top:o,bottom:a,halfBaseSize:l}=Yn(t);e.beginPath(),e.moveTo(i,o),e.lineTo(r,s),e.lineTo(i,a),e.lineTo(i,Math.floor(s+l)),e.lineTo(n,Math.floor(s+l)),e.lineTo(n,Math.floor(s-l)),e.lineTo(i,Math.floor(s-l)),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arrow_left":!function(e,t){e.save();const{cx:i,cy:s,left:n,right:r,top:o,bottom:a,halfBaseSize:l}=Yn(t);e.beginPath(),e.moveTo(i,o),e.lineTo(n,s),e.lineTo(i,a),e.lineTo(i,Math.floor(s+l)),e.lineTo(r,Math.floor(s+l)),e.lineTo(r,Math.floor(s-l)),e.lineTo(i,Math.floor(s-l)),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arrow_horizontal":!function(e,t){e.save();const{cx:i,cy:s,left:n,right:r,top:o,bottom:a,halfBaseSize:l}=Yn(t,1.5),c=Math.floor(i-(i-n)/3),u=Math.floor(i+(i-n)/3);e.beginPath(),e.moveTo(c,o),e.lineTo(n,s),e.lineTo(c,a),e.lineTo(c,Math.floor(s+l)),e.lineTo(u,Math.floor(s+l)),e.lineTo(u,a),e.lineTo(r,s),e.lineTo(u,o),e.lineTo(u,Math.floor(s-l)),e.lineTo(c,Math.floor(s-l)),e.lineTo(c,o),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arrow_vertical":!function(e,t){e.save();const{cx:i,cy:s,left:n,right:r,top:o,bottom:a,halfBaseSize:l}=Yn(t,2/3),c=Math.floor(s-(s-o)/3),u=Math.floor(s+(s-o)/3);e.beginPath(),e.moveTo(r,c),e.lineTo(i,o),e.lineTo(n,c),e.lineTo(Math.floor(i-l),c),e.lineTo(Math.floor(i-l),u),e.lineTo(n,u),e.lineTo(i,a),e.lineTo(r,u),e.lineTo(Math.floor(i+l),u),e.lineTo(Math.floor(i+l),c),e.lineTo(r,c),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arc_down":!function(e,t){const{cx:i,cy:s,left:n,right:r,deflection:o,arcWidth:a}=jn(t);e.save(),e.beginPath(),e.moveTo(r,s);const l=i+o,c=s+o,u=i-o,h=s+o;e.bezierCurveTo(l,c,u,h,n,s),e.lineTo(n,s+a),e.bezierCurveTo(u,h+a,l,c+a,r,s+a),e.closePath(),e.fill(),e.restore()}(e,i);break;case"arc_up":!function(e,t){const{cx:i,cy:s,left:n,right:r,deflection:o,arcWidth:a}=jn(t);e.save(),e.beginPath(),e.moveTo(r,s);const l=i+o,c=s-o,u=i-o,h=s-o;e.bezierCurveTo(l,c,u,h,n,s),e.lineTo(n,s-a),e.bezierCurveTo(u,h-a,l,c-a,r,s-a),e.closePath(),e.fill(),e.restore()}(e,i);break;case"thumbs_up":!function(e,t){e.save(),e.translate(t.x,t.y),e.lineWidth=.05;const i=Math.min(t.width,t.height),s=i/18;e.scale(s,s),e.lineCap="butt",e.save(),e.save(),e.beginPath(),e.moveTo(3.23,8.96),e.lineTo(4.17,8.96),e.bezierCurveTo(4.73,8.81,5.91,6.45,6.45,5.82),e.bezierCurveTo(6.88,5.33,7.66,5.09,8.48,3.7),e.bezierCurveTo(9.11,2.78,8.38,1.49,10.06,1.17),e.bezierCurveTo(10.9,1.01,11.86,2.61,11.58,4.11),e.bezierCurveTo(11.49,4.6,11.25,5.14,11.07,5.54),e.bezierCurveTo(10.63,6.5,10.05,6.58,10.17,7.23),e.bezierCurveTo(10.98,7.25,11.79,7.32,12.67,7.27),e.bezierCurveTo(14.33,7.17,15.55,9.08,14.43,10.38),e.bezierCurveTo(14.9,11.12,14.79,12.33,14.14,12.81),e.bezierCurveTo(14.42,13.58,14.25,14.45,13.67,14.8),e.bezierCurveTo(14.13,16.77,12.36,16.87,11.77,16.84),e.lineTo(4.65,16.84),e.bezierCurveTo(3.87,16.77,3.95,16.28,3.5,16.27),e.bezierCurveTo(3.39,16.26,3.3,16.26,3.3,16.26),e.bezierCurveTo(3.18,16.26,3.19,15.7,3.28,15.7),e.bezierCurveTo(3.36,15.69,3.61,15.68,3.87,15.71),e.bezierCurveTo(4.03,15.79,4.4,16.26,4.75,16.27),e.lineTo(12.12,16.26),e.bezierCurveTo(13.13,16.27,13.67,15.11,12.8,14.56),e.bezierCurveTo(13.85,14.53,13.98,12.98,13.19,12.6),e.bezierCurveTo(14.35,12.49,14.5,10.65,13.44,10.41),e.bezierCurveTo(14.8,9.97,14.39,7.59,12.35,7.83),e.bezierCurveTo(11.42,7.77,9.87,7.94,9.68,7.62),e.bezierCurveTo(9.41,6.82,9.684,6.45,10.17,5.88),e.bezierCurveTo(10.5,5.46,11.02,4.6,11.04,3.64),e.bezierCurveTo(11.05,2.5,10.41,1.23,9.58,1.98),e.bezierCurveTo(9.38,2.21,9.36,3.47,8.94,4.02),e.bezierCurveTo(8.09,5.52,7.3,5.66,6.95,6.15),e.bezierCurveTo(6.27,6.86,4.93,9.52,4.36,9.52),e.bezierCurveTo(3.98,9.52,3.243,9.52,3.24,9.52),e.bezierCurveTo(3.12,9.52,3.08,8.98,3.22,8.95),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}(e,i);break;case"thumbs_down":!function(e,t){e.save(),e.translate(t.x,t.y),e.lineWidth=.05;const i=Math.min(t.width,t.height),s=i/18;e.scale(s,s),e.lineCap="butt",e.save(),e.save(),e.beginPath(),e.moveTo(14.77,9.04),e.lineTo(13.82,9.04),e.bezierCurveTo(13.27,9.18,12.09,11.55,11.54,12.17),e.bezierCurveTo(11.12,12.66,10.34,12.9,9.52,14.29),e.bezierCurveTo(8.88,15.21,9.62,16.51,7.93,16.82),e.bezierCurveTo(7.1,16.98,6.13,15.39,6.42,13.88),e.bezierCurveTo(6.51,13.4,6.75,12.855,6.93,12.46),e.bezierCurveTo(7.37,11.49,7.95,11.41,7.82,10.76),e.bezierCurveTo(7.02,10.75,6.21,10.68,5.33,10.73),e.bezierCurveTo(3.66,10.83,2.44,8.91,3.57,7.62),e.bezierCurveTo(3.09,6.88,3.2,5.67,3.85,5.19),e.bezierCurveTo(3.57,4.42,3.74,3.55,4.33,3.2),e.bezierCurveTo(3.87,1.22,5.64,1.13,6.22,1.16),e.lineTo(13.35,1.16),e.bezierCurveTo(14.12,1.22,14.04,1.71,14.49,1.73),e.bezierCurveTo(14.6,1.73,14.7,1.73,14.7,1.73),e.bezierCurveTo(14.82,1.74,14.8,2.29,14.72,2.3),e.bezierCurveTo(14.63,2.31,14.39,2.32,14.12,2.28),e.bezierCurveTo(13.96,2.21,13.6,1.74,13.25,1.73),e.lineTo(5.88,1.73),e.bezierCurveTo(4.86,1.73,4.33,2.88,5.19,3.44),e.bezierCurveTo(4.14,3.47,4.01,5.02,4.8,5.39),e.bezierCurveTo(3.64,5.5,3.49,7.35,4.55,7.58),e.bezierCurveTo(3.19,8.02,3.6,10.4,5.64,10.16),e.bezierCurveTo(6.57,10.23,8.12,10.05,8.32,10.37),e.bezierCurveTo(8.58,11.17,8.32,11.54,7.82,12.11),e.bezierCurveTo(7.49,12.54,6.97,13.39,6.96,14.36),e.bezierCurveTo(6.94,15.49,7.59,16.76,8.41,16.01),e.bezierCurveTo(8.62,15.78,8.63,14.52,9.05,13.97),e.bezierCurveTo(9.9,12.47,10.69,12.33,11.04,11.84),e.bezierCurveTo(11.72,11.13,13.06,8.47,13.637,8.47),e.bezierCurveTo(14.01,8.47,14.75,8.47,14.75,8.47),e.bezierCurveTo(14.87,8.47,14.91,9.01,14.77,9.04),e.closePath(),e.fill(),e.restore(),e.restore(),e.restore()}(e,i);break;case"buy":zn(e,i,"B");break;case"sell":zn(e,i,"S")}}function zn(e,t,i){e.save();const s=t.centerX,n=t.centerY,r=Math.floor(Math.min(t.width/2,t.height/2));e.strokeStyle=e.fillStyle,e.lineWidth=Math.max(1,.1*r),kn(e,{x:s,y:n},r,0,2*Math.PI),e.textAlign="center",e.font=2*r+"px Arial",e.textBaseline="middle",e.fillText(i,s,n+.15*r),e.restore()}function Yn(e,t=1){const i=Math.floor(e.centerX),s=Math.floor(e.centerY);let{width:n,height:r}=e;n=.9*Math.min(n,r*t),r=n/t;return{cx:i,cy:s,left:Math.floor(i-n/2),right:Math.floor(i+n/2),top:Math.floor(s-r/2),bottom:Math.floor(s+r/2),halfBaseSize:.21*Math.min(n,r)}}function jn(e){const t=Math.floor(e.centerX),i=Math.floor(e.centerY),{width:s,height:n}=e;let r=Math.floor(Math.min(s,n));r*=.9;return{cx:t,cy:i,left:Math.floor(t-r/2),right:Math.floor(t+r/2),arcWidth:.075*r,deflection:.3*r}}function Kn(){const e=Gv().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?se(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}const qn=(e,t)=>!0,Xn=(e,t)=>e.map((e,i)=>({shown:t(e,i),value:e,line:{width:1,color:Zn(i),dashStyle:"Solid"}})),Zn=e=>function(e,t){return e[t%e.length]}(or,e),Jn=e=>e.filter(e=>e.shown),Qn={width:1,color:"#000",dashStyle:"Solid"},er={width:1,color:"rgba(136,136,136,0.75)",dashStyle:"Dash"},tr={color:gs.COLOR_TRANSPARENT},ir={[gs.AT_SINGLE_STYLE]:!0,[gs.AT_SHOW_BACKGROUND]:!1};function sr(e,t){const i=ue(ce(e,Qn,"annotationTraits","line")),s=ue(ce(e,er,"annotationTraits","line2")),n=ue(ce(e,tr,"annotationTraits","fill")),r=Mr[t],o=r?.defaults||{};Gv().config.colorfulAnnotations||(de(o,ir),"GannBox"!==t&&"GannSquare"!==t||(o[gs.AT_SHOW_BACKGROUND]=!0));const a=r?.editable.includes(gs.AT_LINE_2),l=ie(o[gs.AT_LINE_2]),c={line:i,fill:n,...o};return a&&!l&&(c.line2=s),c}function nr(e,t){Object.keys(t).forEach(i=>{i===gs.LINE_DASH_PROP_NAME?e.setLineDash(t[i]):e[i]=t[i]})}function rr(e){const t=x(bn,Mn);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:An(e.line.dashStyle)}}const or=["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)"],ar=[gs.AT_LINE,gs.AT_ALLOW_PRICES_CHANGE_UI],lr=[gs.AT_FILL,gs.AT_ALLOW_PRICES_CHANGE_UI],cr=[gs.AT_LINE,gs.AT_FILL,gs.AT_ALLOW_PRICES_CHANGE_UI],ur=[...cr,gs.AT_FILL_TEXT],hr=[gs.AT_TEXT_LINES,gs.AT_FILL,gs.AT_ALLOW_PRICES_CHANGE_UI],dr=[...ar,gs.AT_LINE_2,gs.AT_SHOW_PRICES,gs.AT_SHOW_LEVELS,gs.AT_LEVELS_KIND,gs.AT_LABELS,gs.AT_EXTEND_LEFT,gs.AT_EXTEND_RIGHT,gs.AT_SHOW_TRENDLINE,gs.AT_FACTORS,gs.AT_PRICES_ON_SCALE,gs.AT_REVERSE,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY,gs.AT_LEVELS_RESPECT_LOG_SCALE],pr=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],fr=e=>({[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_SHOW_PRICES]:!0,[gs.AT_SHOW_LEVELS]:!0,[gs.AT_LEVELS_KIND]:gs.AT_LEVELS_PERCENTS,[gs.AT_LABELS]:gs.AT_LABELS_RIGHT,[gs.AT_EXTEND_LEFT]:!1,[gs.AT_EXTEND_RIGHT]:!1,[gs.AT_SHOW_TRENDLINE]:!0,[gs.AT_FACTORS]:Xn(pr.slice(2),(t,i)=>0<=t&&t<=e),[gs.AT_PRICES_ON_SCALE]:!1,[gs.AT_REVERSE]:!1,[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2,[gs.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),mr=[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_SHOW_TRENDLINE,type:"bool"},{id:gs.AT_LINE_2,type:"line",enabledIf:gs.AT_SHOW_TRENDLINE},{id:gs.AT_EXTEND_LEFT,type:"bool"},{id:gs.AT_EXTEND_RIGHT,type:"bool"},{id:gs.AT_FACTORS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"number",editable:!0,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_REVERSE,type:"bool"},{id:gs.AT_SHOW_PRICES,type:"bool"},{id:gs.AT_PRICES_ON_SCALE,type:"bool"},{id:gs.AT_SHOW_LEVELS,type:"bool"},{id:gs.AT_LEVELS_KIND,type:"string",enum:[gs.AT_LEVELS_PERCENTS,gs.AT_LEVELS_VALUES],enabledIf:gs.AT_SHOW_LEVELS},{id:gs.AT_LABELS,type:"string",enum:[gs.AT_LABELS_LEFT,gs.AT_LABELS_CENTER,gs.AT_LABELS_RIGHT]},{id:gs.AT_LEVELS_RESPECT_LOG_SCALE,type:"bool"}],gr={[gs.AT_LINE]:{color:"#3861f6",width:1,dashStyle:"Solid"},[gs.AT_FILL]:{color:"rgba(56, 97, 246, 0.2)"},[gs.AT_FILL_TEXT]:{color:"#f0f0f0"},[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},yr=[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_LINE,type:"line"},{id:gs.AT_FILL,type:"color"},{id:gs.AT_FILL_TEXT,type:"color"}],Ar=[0,.25,.382,.5,.618,.75,1],Sr=[8,4,3,2,1].map(e=>`1/${e}`).concat([2,3,4,8].map(e=>`${e}/1`)),Tr=[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_LINE,type:"line"},{id:gs.AT_SHOW_PRICES,type:"bool"},{id:gs.AT_RATIO,type:"bool"},{id:gs.AT_SHOW_PERCENTDIFF,type:"bool"},{id:gs.AT_SHOW_BARCOUNT,type:"bool"},{id:gs.AT_EXTEND_PT_1,type:"bool"},{id:gs.AT_EXTEND_PT_2,type:"bool"},{id:gs.AT_MARKER,type:"object",properties:[{id:gs.AT_KIND,type:"string",enum:[gs.AT_ARROW]},{id:gs.AT_VERTEX,type:"string",enum:[gs.AT_VERTEX_NONE,gs.AT_VERTEX_START,gs.AT_VERTEX_END,gs.AT_VERTEX_BOTH]}]}],vr=[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_LINE,type:"line"}],Pr=[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_LINE,type:"line"},{id:gs.AT_FILL,type:"color"}],Cr=[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_LINE,type:"line"},{id:gs.AT_FILL,type:"color"},{id:gs.AT_FILL2,type:"color"},{id:gs.AT_FILL_TEXT,type:"color"},{id:gs.AT_COMPACT,type:"bool"},{id:gs.AT_ACCOUNT_SIZE,type:"number"},{id:gs.AT_RISK,type:"number"},{id:gs.AT_RISK_IS_PERCENT,type:"bool"}],br=[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_FILL,type:"color"}],Er={[gs.AT_KIND]:gs.AT_ARROW,[gs.AT_VERTEX]:gs.AT_VERTEX_NONE},Lr=[gs.AT_LINE,gs.AT_RATIO,gs.AT_SHOW_PRICES,gs.AT_ALLOW_PRICES_CHANGE_UI,gs.AT_SHOW_BARCOUNT,gs.AT_SHOW_PERCENTDIFF,gs.AT_EXTEND_PT_1,gs.AT_EXTEND_PT_2,gs.AT_MARKER],Mr={Line:{editable:Lr,defaults:{[gs.AT_SHOW_PRICES]:!1,[gs.AT_SHOW_BARCOUNT]:!1,[gs.AT_SHOW_PERCENTDIFF]:!1,[gs.AT_EXTEND_PT_1]:!1,[gs.AT_EXTEND_PT_2]:!1,[gs.AT_MARKER]:Er,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Tr,numPoints:2},Ray:{editable:Lr,defaults:{[gs.AT_SHOW_PRICES]:!1,[gs.AT_SHOW_BARCOUNT]:!1,[gs.AT_SHOW_PERCENTDIFF]:!1,[gs.AT_EXTEND_PT_1]:!1,[gs.AT_EXTEND_PT_2]:!0,[gs.AT_MARKER]:Er,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Tr,numPoints:2},VerticalLine:{editable:[gs.AT_LINE,gs.AT_SHOW_TIMESTAMPS,gs.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[gs.AT_SHOW_TIMESTAMPS]:!0,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_LINE,type:"line"},{id:gs.AT_SHOW_TIMESTAMPS,type:"bool"}],numPoints:1},HorizontalLine:{editable:[gs.AT_LINE,gs.AT_SHOW_PRICES,gs.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[gs.AT_SHOW_PRICES]:!0,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_LINE,type:"line"},{id:gs.AT_SHOW_PRICES,type:"bool"}],numPoints:1},TrendChannel:{editable:[...ar,gs.AT_EXTEND_PT_1,gs.AT_EXTEND_PT_2],defaults:{[gs.AT_EXTEND_PT_1]:!1,[gs.AT_EXTEND_PT_2]:!1,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...vr,{id:gs.AT_EXTEND_PT_1,type:"bool"},{id:gs.AT_EXTEND_PT_2,type:"bool"}],numPoints:3},GannLine:{editable:Lr,defaults:{[gs.AT_SHOW_PRICES]:!1,[gs.AT_SHOW_BARCOUNT]:!1,[gs.AT_SHOW_PERCENTDIFF]:!1,[gs.AT_EXTEND_PT_1]:!1,[gs.AT_EXTEND_PT_2]:!0,[gs.AT_MARKER]:Er,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Tr,numPoints:2},SpeedResistanceArcs:{editable:ar,types:vr,numPoints:2},SpeedResistanceFan:{editable:ar,types:vr,numPoints:2},AndrewsPitchfork:{editable:ar,types:vr,numPoints:3},Rectangle:{editable:cr,types:Pr,numPoints:2},Ellipse:{editable:cr,types:Pr,numPoints:2},DateRange:{editable:ur,defaults:gr,types:yr,numPoints:2},PriceRange:{editable:ur,defaults:gr,types:yr,numPoints:2},DatePriceRange:{editable:[...ur,gs.AT_DRAW_BORDER],defaults:{...gr,[gs.AT_DRAW_BORDER]:!1},types:[...yr,{id:gs.AT_DRAW_BORDER,type:"bool"}],numPoints:2},GannBox:{editable:[gs.AT_LINE,gs.AT_LINE_2,gs.AT_ALLOW_PRICES_CHANGE_UI,gs.AT_PRICE_LEVELS,gs.AT_TIME_LEVELS,gs.AT_SHOW_LEFT_LABELS,gs.AT_SHOW_RIGHT_LABELS,gs.AT_SHOW_TOP_LABELS,gs.AT_SHOW_BOTTOM_LABELS,gs.AT_SHOW_ANGLES,gs.AT_REVERSE,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_LINE]:{color:"#33776b",width:1,dashStyle:"Solid"},[gs.AT_LINE_2]:{color:"#33776b",width:1,dashStyle:"Solid"},[gs.AT_PRICE_LEVELS]:Xn(Ar,qn),[gs.AT_TIME_LEVELS]:Xn(Ar,qn),[gs.AT_SHOW_LEFT_LABELS]:!0,[gs.AT_SHOW_RIGHT_LABELS]:!0,[gs.AT_SHOW_TOP_LABELS]:!0,[gs.AT_SHOW_BOTTOM_LABELS]:!0,[gs.AT_SHOW_ANGLES]:!1,[gs.AT_REVERSE]:!1,[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_PRICE_LEVELS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"number",editable:!0,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_LEFT_LABELS,type:"bool"},{id:gs.AT_SHOW_RIGHT_LABELS,type:"bool"},{id:gs.AT_TIME_LEVELS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"number",editable:!0,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_TOP_LABELS,type:"bool"},{id:gs.AT_SHOW_BOTTOM_LABELS,type:"bool"},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_REVERSE,type:"bool"},{id:gs.AT_SHOW_ANGLES,type:"bool"},{id:gs.AT_LINE_2,type:"line",enabledIf:gs.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[...ar,gs.AT_LEVELS,gs.AT_FANS,gs.AT_ARCS,gs.AT_REVERSE,gs.AT_SHOW_RANGES_RATIO,gs.AT_PRICE_BAR_RATIO,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_LINE]:{color:"#712b9c",width:1,dashStyle:"Solid"},[gs.AT_LEVELS]:Xn([0,1,2,3,4,5],qn),[gs.AT_FANS]:Xn(["8x1","5x1","4x1","3x1","2x1","1x1","1x2","1x3","1x4","1x5","1x8"],(e,t)=>t>3&&t<7),[gs.AT_ARCS]:Xn(["1x0","1x1","1.5x0","2x0","2x1","3x0","3x1","4x0","4x1","5x0","5x1"],qn),[gs.AT_REVERSE]:!1,[gs.AT_SHOW_RANGES_RATIO]:!0,[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_LEVELS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"string",editable:!1,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_FANS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"string",editable:!1,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_ARCS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"string",editable:!1,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_REVERSE,type:"bool"},{id:gs.AT_PRICE_BAR_RATIO,type:"number",editable:!0},{id:gs.AT_SHOW_RANGES_RATIO,type:"bool"}],numPoints:2},LongPosition:{editable:[gs.AT_LINE,gs.AT_FILL,gs.AT_FILL2,gs.AT_FILL_TEXT,gs.AT_COMPACT,gs.AT_ACCOUNT_SIZE,gs.AT_RISK,gs.AT_RISK_IS_PERCENT,gs.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[gs.AT_FILL]:{color:"rgba(0, 160, 0, 0.2)"},[gs.AT_FILL2]:{color:"rgba(205, 0, 0, 0.2)"},[gs.AT_FILL_TEXT]:{color:"#fff"},[gs.AT_COMPACT]:!1,[gs.AT_ACCOUNT_SIZE]:1e3,[gs.AT_RISK]:25,[gs.AT_RISK_IS_PERCENT]:!0,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Cr,numPoints:4},ShortPosition:{editable:[gs.AT_LINE,gs.AT_FILL,gs.AT_FILL2,gs.AT_FILL_TEXT,gs.AT_COMPACT,gs.AT_ACCOUNT_SIZE,gs.AT_RISK,gs.AT_RISK_IS_PERCENT,gs.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[gs.AT_FILL]:{color:"rgba(205, 0, 0, 0.2)"},[gs.AT_FILL2]:{color:"rgba(0, 160, 0, 0.2)"},[gs.AT_FILL_TEXT]:{color:"#fff"},[gs.AT_COMPACT]:!1,[gs.AT_ACCOUNT_SIZE]:1e3,[gs.AT_RISK]:25,[gs.AT_RISK_IS_PERCENT]:!0,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:Cr,numPoints:4},FiftyPercentLine:{editable:[gs.AT_USE_52WEEK_PRICES,gs.AT_LINE,gs.AT_LINE_2,gs.AT_SHOW_PRICES,gs.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[gs.AT_USE_52WEEK_PRICES]:!1,[gs.AT_SHOW_PRICES]:!0,[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_USE_52WEEK_PRICES,type:"bool"},{id:gs.AT_LINE,type:"line"},{id:gs.AT_LINE_2,type:"line"},{id:gs.AT_SHOW_PRICES,type:"bool"}],numPoints:2},FibonacciRetracement:{editable:dr,defaults:fr(1),types:mr,numPoints:2},TrendBasedFibExtension:{editable:dr,defaults:fr(5),types:mr,numPoints:3},FibonacciFan:{editable:[...ar,gs.AT_SHOW_LEVELS,gs.AT_LABELS,gs.AT_FACTORS,gs.AT_REVERSE,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_SHOW_LEVELS]:!0,[gs.AT_LABELS]:gs.AT_LABELS_RIGHT,[gs.AT_REVERSE]:!1,[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2,[gs.AT_FACTORS]:Xn(pr.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_FACTORS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"number",editable:!0,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_LEVELS,type:"bool"},{id:gs.AT_LABELS,type:"string",enum:[gs.AT_LABELS_LEFT,gs.AT_LABELS_CENTER,gs.AT_LABELS_RIGHT]},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_REVERSE,type:"bool"}],numPoints:2},FibonacciArcs:{editable:[...ar,gs.AT_LINE_2,gs.AT_SHOW_TRENDLINE,gs.AT_FACTORS,gs.AT_SHOW_LEVELS,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_SHOW_TRENDLINE]:!0,[gs.AT_SHOW_LEVELS]:!0,[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2,[gs.AT_FACTORS]:Xn(pr.slice(2),(e,t)=>t>=0&&t<=6)},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_SHOW_TRENDLINE,type:"bool"},{id:gs.AT_LINE_2,type:"line",enabledIf:gs.AT_SHOW_TRENDLINE},{id:gs.AT_FACTORS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"number",editable:!0,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},FibonacciChannel:{editable:[...ar,gs.AT_SHOW_PRICES,gs.AT_SHOW_LEVELS,gs.AT_LEVELS_KIND,gs.AT_LABELS,gs.AT_EXTEND_PT_1,gs.AT_EXTEND_PT_2,gs.AT_FACTORS,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_SHOW_PRICES]:!0,[gs.AT_SHOW_LEVELS]:!0,[gs.AT_LEVELS_KIND]:gs.AT_LEVELS_PERCENTS,[gs.AT_LABELS]:gs.AT_LABELS_RIGHT,[gs.AT_EXTEND_PT_1]:!1,[gs.AT_EXTEND_PT_2]:!1,[gs.AT_FACTORS]:Xn(pr.slice(2),qn),[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_EXTEND_PT_1,type:"bool"},{id:gs.AT_EXTEND_PT_2,type:"bool"},{id:gs.AT_FACTORS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"number",editable:!0,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_SHOW_PRICES,type:"bool"},{id:gs.AT_SHOW_LEVELS,type:"bool"},{id:gs.AT_LEVELS_KIND,type:"string",enum:[gs.AT_LEVELS_PERCENTS,gs.AT_LEVELS_VALUES],enabledIf:gs.AT_SHOW_LEVELS},{id:gs.AT_LABELS,type:"string",enum:[gs.AT_LABELS_LEFT,gs.AT_LABELS_CENTER,gs.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[...ar,gs.AT_ANGLES,gs.AT_SHOW_LEVELS,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_SHOW_LEVELS]:!0,[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2,[gs.AT_ANGLES]:Xn(Sr,qn)},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_ANGLES,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"string",editable:!1,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},SymbolArrowUp:{editable:lr,types:br,numPoints:1},SymbolArrowDown:{editable:lr,types:br,numPoints:1},SymbolArrowRight:{editable:lr,types:br,numPoints:1},SymbolArrowLeft:{editable:lr,types:br,numPoints:1},SymbolArrowHorizontal:{editable:lr,types:br,numPoints:1},SymbolArrowVertical:{editable:lr,types:br,numPoints:1},SymbolArcDown:{editable:lr,types:br,numPoints:1},SymbolArcUp:{editable:lr,types:br,numPoints:1},SymbolThumbsUp:{editable:lr,types:br,numPoints:1},SymbolThumbsDown:{editable:lr,types:br,numPoints:1},SymbolZero:{editable:lr,types:br,numPoints:1},SymbolOne:{editable:lr,types:br,numPoints:1},SymbolTwo:{editable:lr,types:br,numPoints:1},SymbolThree:{editable:lr,types:br,numPoints:1},SymbolFour:{editable:lr,types:br,numPoints:1},SymbolFive:{editable:lr,types:br,numPoints:1},SymbolSix:{editable:lr,types:br,numPoints:1},SymbolSeven:{editable:lr,types:br,numPoints:1},SymbolEight:{editable:lr,types:br,numPoints:1},SymbolNine:{editable:lr,types:br,numPoints:1},SymbolQuestion:{editable:lr,types:br,numPoints:1},SymbolFishHook:{editable:lr,types:br,numPoints:1},SymbolBuy:{editable:lr,types:br,numPoints:1},SymbolSell:{editable:lr,types:br,numPoints:1},FibonacciTimeZones:{editable:[...ar,gs.AT_FACTORS,gs.AT_SHOW_LEVELS,gs.AT_LABELS,gs.AT_SINGLE_STYLE,gs.AT_SHOW_BACKGROUND,gs.AT_BACKGROUND_OPACITY],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!0,[gs.AT_FACTORS]:Xn([0,1,2,3,5,8,13,21,34,55,89,144],qn),[gs.AT_SHOW_LEVELS]:!0,[gs.AT_LABELS]:gs.AT_LABELS_RIGHT,[gs.AT_SINGLE_STYLE]:!1,[gs.AT_SHOW_BACKGROUND]:!0,[gs.AT_BACKGROUND_OPACITY]:.2},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_SINGLE_STYLE,type:"bool"},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SINGLE_STYLE},{id:gs.AT_FACTORS,type:"array",items:{ref:gs.AT_FACTOR_ITEM}},{id:gs.AT_FACTOR_ITEM,type:"object",properties:[{id:gs.AT_SHOWN,type:"bool",label:!1},{id:gs.AT_VALUE,type:"number",editable:!0,enabledIf:gs.AT_SHOWN},{id:gs.AT_LINE,type:"line",enabledIf:gs.AT_SHOWN}]},{id:gs.AT_SHOW_BACKGROUND,type:"bool"},{id:gs.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:gs.AT_SHOW_BACKGROUND},{id:gs.AT_SHOW_LEVELS,type:"bool"},{id:gs.AT_LABELS,type:"string",enum:[gs.AT_LABELS_LEFT,gs.AT_LABELS_CENTER,gs.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:hr,types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_TEXT_LINES,type:"array",items:{ref:gs.AT_TEXT_ITEM}},{id:gs.AT_TEXT_ITEM,type:"string"},{id:gs.AT_FILL,type:"color"}],numPoints:2},ProfitLoss:{editable:[...cr,gs.AT_SHOW_PRICES,gs.AT_NUM_CONTRACTS,gs.AT_POSITION,gs.AT_PROFIT_LOSS],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!1,[gs.AT_SHOW_PRICES]:!0,[gs.AT_NUM_CONTRACTS]:1,[gs.AT_POSITION]:gs.AT_POSITION_LONG,[gs.AT_PROFIT_LOSS]:void 0},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_PROFIT_LOSS,type:"number",editable:!1},{id:gs.AT_NUM_CONTRACTS,type:"number"},{id:gs.AT_POSITION,type:"string",enum:[gs.AT_POSITION_SHORT,gs.AT_POSITION_LONG]},...Pr,{id:gs.AT_SHOW_PRICES,type:"bool"}],numPoints:2},RewardRisk:{editable:[...cr,gs.AT_SHOW_PRICES,gs.AT_NUM_CONTRACTS,gs.AT_POSITION,gs.AT_RISK,gs.AT_REWARD,gs.AT_RATIO],defaults:{[gs.AT_ALLOW_PRICES_CHANGE_UI]:!1,[gs.AT_SHOW_PRICES]:!0,[gs.AT_NUM_CONTRACTS]:1,[gs.AT_POSITION]:gs.AT_POSITION_LONG,[gs.AT_RISK]:void 0,[gs.AT_REWARD]:void 0,[gs.AT_RATIO]:void 0},types:[{id:gs.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:gs.AT_REWARD,type:"number",editable:!1},{id:gs.AT_RISK,type:"number",editable:!1},{id:gs.AT_RATIO,type:"number",editable:!1},{id:gs.AT_NUM_CONTRACTS,type:"number"},{id:gs.AT_POSITION,type:"string",enum:[gs.AT_POSITION_SHORT,gs.AT_POSITION_LONG]},...Pr,{id:gs.AT_SHOW_PRICES,type:"bool"}],numPoints:2}};function _r(e){return e?Mr[e].editable:Mr}const xr={$schema:"http://json-schema.org/draft-04/schema#",title:"JSON schema for Barchart HTML5 Charts",definitions:/* @__PURE__ */JSON.parse('{"color":{"type":"string","pattern":"^(#([0-9a-fA-F]{3}){1,2})|(rgba\\\\((\\\\s*\\\\d{1,3}\\\\s*,){3}\\\\s*[01]+(\\\\.\\\\d+)?\\\\))|(rgb\\\\((\\\\s*\\\\d{1,3}\\\\s*)(,\\\\s*\\\\d{1,3}\\\\s*){2}\\\\))$"},"orientationChoice":{"type":"string","enum":["vertical","horizontal","both","none"]},"dashStyle":{"type":"string","enum":["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","SparseDot","Dot","Dash","LongDash","DashDot","LongDashDot","LongDashDotDot"]},"aggUnit":{"type":"string","enum":["Tick","Intraday","Day","Week","Month","Quarter","Year"]},"aggSpec":{"type":"string","enum":["None","Nearest","Continue","PerCount","PerVolume","PerRange","PerSeconds"]},"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","SharesOutstanding","DeferredIncomeTax","DeferredLongRevenues","EquityOtherInvestments","IncomeTaxPayable","Intangibles","Inventories","LongTermDebt","MarketableSec","OtherCurrentAssets","OtherCurrentLiabilities","OtherEquity","OtherNonCurrentAssets","OtherNonCurrentLiabilities","PpeNet","PrepaidExpenses","Receivables","RetainedEarnings","ShorttermDebt","TotalAssets","TotalCurrentAssets","TotalCurrentLiabilities","TotalLiabilities","TotalLiabilitiesAndEquity","TotalNonCurrentAssets","TotalNonCurrentLiabilities","TotalShareholdersEquity","BasicEpsContOp","BasicEpsTotalOp","CostGoods","DilutedEpsContOp","DilutedEpsTotalOp","Ebitda","GrossProfit","IncomeTax","InterestExpense","NetIncome","OperatingExpenses","OperatingIncome","OtherIncomeExpenses","PreTaxIncome","Sales"]},"studyField":{"type":"string","enum":["HL/2","OC/2","HLC/3","OHLC/4","HLCC/4","AVG","MA","MA1","MA2","MA3","MA4","MA5","MA6","MA7","MA8","MA9","MA10","MAS","MAL","EMA","MAHI","MALO","MACD","MACDS","MACDH","MACDV","MACDVS","MACDVH","ENVU","ENVD","ENVEXPU","ENVEXPD","ENVSMOU","ENVSMOD","SMA","TMA","WMA","VOLMA","OSC","VOSC","RSI","RSIAVG","RSA","RSAAVG","STORSI","STORSIAVG","HH","LL","PercK","PercD","PercR","WGCL","BOLLBU","BOLLBL","BOLLBM","BOLLW","BOLLP","BOLLBW","BOLLBWA","OBVOL","OBVOLAVG","ATR","ADR","ADRP","ATRP","PDI","MDI","ADX","ADXM","ADL","ADWM","ADWMMA","CHAOSC","TP","KCUP","KCMID","KCLOW","KBUP","KBMID","KBLOW","DONUP","DONMID","DONLOW","DONW","PVT","ROC","TRIX","PVPT","PVPTR","PVPTS","ARNUP","ARNLOW","ARNOSC","TCHNUP","TCHNLOW","ALJAW","ALTEETH","ALLIPS","PLTLN","AWOS","AWOSMA","MFMUL","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","EMVMA","ERBLPOW","ERBRPOW","FI","MI","MOM","MOMMA","MFI","MSD","NVI","NVIEMA","PVI","PVIEMA","PPO","PPOS","PPOH","PVO","PVOS","PVOH","HV","PERF","WASI","WWVSARU","WWVSARD","PARSARS","PARSARL","MOVLR","TRSP1","TRSP2","PPTPIV","PPTR1","PPTR2","PPTR3","PPTS1","PPTS2","PPTS3","COTLCCMSP","COTLCLGSP","COTLCSMSP","COTDAGPRO","COTDAGSPD","COTDAGMNM","COTDAGOTH","COTFTRDLI","COTFTRASM","COTFTRLVF","COTFTROTH","TR","IMPVOL","CTM","CPMI","CTLTM","CTLTMF","DEMA","EOSC","TEMA","TSI","TSISIG","ADJATR","COTR","GMMA3","GMMA5","GMMA8","GMMA10","GMMA12","GMMA15","GMMA30","GMMA35","GMMA40","GMMA45","GMMA50","GMMA60","MCGD","HMA","COPP","CPPH4","CPPH3","CPPH2","CPPH1","CPPL1","CPPL2","CPPL3","CPPL4","REATRS","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","ATRMA","STOMOMIX","CHDMOMOSC","CHDMOMOSCAVG","VSTOPUP","VSTOPLOW","SUPTR","BARCOLIX","BARKIND","CONVLN","BASELN","LEADSP1","LEADSP2","LAGGSP","VWAP","VWAPSD1U","VWAPSD1L","VWAPSD2U","VWAPSD2L","PLVI","MNVI","DIFA","DOSCH","DOSCS","TTMSQZON","TTMSQZOFF","TTMSQZOSC","CRS","CRSAVG","JPIB","JPIS","DRS","MRS","PMO","PMOS","RVOL","WGALPH","UPVOL","DNVOL","TOTVOL","POC","VAREA","BARBACK","AVWAP","KST","KSTSIG","STC","MCCLO","NHLAI","CMBCI","CMBCIF","CMBCIS","COTI","CHEXL","CHEXS","MBBUO","MBBUI","MBBM","MBBLI","MBBLO","CHOP","MACLD1","MACLD2","BTI","PCUP1","PCDN1","PCUP2","PCDN2","PCUP3","PCDN3","PCTD","PCTP","TDIPRC","TDITSL","TDIMBL","TDIUPR","TDILWR","PPS","FRAMA","FISHER","FISHTRG","RCI","RCISIG","ZZPIVOT"]},"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","BBANDW","OBVOL","ATR","ADR","ADRP","ATRP","ADX","ADXMOD","ADL","ADWM","CHAOSC","TP","KELCHN","KELBND","DONCHN","DONWIDTH","PVT","ROC","TRIX","PPMOV","ARNUPDW","ARNOSC","TCHN","ALLG","PLTLN","AWEOSC","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","ERBLPOW","ERBRPOW","FI","MI","MOM","MFI","MSD","NVI","PVI","PPO","PVO","HV","PERF","WASI","WWVOL","PARTP","MOVLR","TRSP","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","EOSC","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRS","LINRCHN","CSHO","CSHB","MKTCAP","CTPI","TCHRE","PCTCHG","OPINT","STOMOMIX","CHDMOMOSC","VSTOP","SUPTR","ICHCLD","VWAP","VOIN","DIFA","DOSC","MARIB","HASMO","TTMSQZ","CRS","JPI","CTTP","CTTI","DRS","MRS","PMO","RVOL","WGALPH","VOLAP","AVWAP","KST","STC","MCCLO","NHLAI","CMBCI","COTI","CHEXI","MBBANDS","OPTIV","IVRANK","IVPCTL","OPTVOLPC","OPTOIPC","OPTVOL","OPTOI","CHOP","MACLD","BTI","PC","GREEKS","PVACP","TDI","PPS","FRAMA","FISHER","RCI","ZIGZAG"]},"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","fillColor":"rgba(119,119,119,0.1)","dashStyle":"LongDashDot"}},"cycleTransition":{"$ref":"#/definitions/transitionLine","default":{"enabled":false,"width":2,"color":"#777","fillColor":"rgba(119,119,119,0.1)","dashStyle":"ShortDashDot"}}}}]},"annotationTraits":{"$ref":"#/definitions/annTraits"},"curveTraits":{"type":"array","items":{"$ref":"#/definitions/curveTrait"}},"allAnnotationsLocked":{"type":"boolean","default":false}}},"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"},"fillColor":{"$ref":"#/definitions/color"},"dashStyle":{"$ref":"#/definitions/dashStyle"}}},"fillTrait":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color"}}},"markerTrait":{"type":"object","additionalProperties":false,"properties":{"vertex":{"enum":["start","end","both","none"]},"kind":{"enum":["arrow"],"default":"arrow"}},"required":["vertex"]},"curveTrait":{"type":"object","additionalProperties":false,"properties":{"curveStyle":{"$ref":"#/definitions/curveStyle"},"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["curveStyle"]},"annTraits":{"type":"object","additionalProperties":true,"properties":{"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"},"marker":{"$ref":"#/definitions/markerTrait"},"zIndex":{"type":"number","minimum":1}}},"annotation":{"type":"object","additionalProperties":false,"properties":{"id":{"$ref":"#/definitions/annId"},"uid":{"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:!1,properties:{data:{$ref:"#/definitions/data"},display:{$ref:"#/definitions/display"},panes:{type:"array",minItems:1,items:{$ref:"#/definitions/pane"}},version:{type:"integer",minimum:166,multipleOf:1}},required:["panes","version"]},Ir={$schema:"http://json-schema.org/draft-04/schema#",title:"JSON schema for Barchart studies for HTML5 Charts",definitions:{studyMetadata:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},overlay:{type:"boolean",default:!0},decimals:{type:"number"},shiftable:{type:"boolean"},range:{type:"object",additionalProperties:!1,properties:{min:{type:"number"},max:{type:"number"}}},enumerations:{type:"array",minItems:1,items:{$ref:"#/definitions/enumeration"}}},required:["title"]},enumeration:{type:"object",additionalProperties:!1,properties:{input:{type:"string"},values:{type:"array",items:{type:"string"}}}},studyDefaults:{type:"object",additionalProperties:!1,properties:{curves:{$ref:"chart.schema.json#/definitions/curves"},source:{$ref:"chart.schema.json#/definitions/curveField"},inputs:{$ref:"chart.schema.json#/definitions/inputs"},levels:{$ref:"chart.schema.json#/definitions/studyLevels"},bands:{$ref:"chart.schema.json#/definitions/studyBands"}},required:["curves"]},studyDefinition:{type:"object",additionalProperties:!1,properties:{id:{$ref:"chart.schema.json#/definitions/study"},meta:{$ref:"#/definitions/studyMetadata"},defaults:{$ref:"#/definitions/studyDefaults"}},required:["id","meta","defaults"]}},type:"array",minItems:1,items:{$ref:"#/definitions/studyDefinition"}},Dr={$schema:"http://json-schema.org/draft-04/schema#",title:"JSON schema for Barchart fields for HTML5 Charts",definitions:{valueType:{type:"string",enum:["Number","String","Date"],default:"Number"},fieldCategory:{type:"string",enum:["Common","Study","BalanceSheet","IncomeStatement","Event","Option"],default:"Common"},fieldFormat:{type:"string",enum:["FromMetaData","AsInteger","UseMetricUnit","AsPercent"],default:"FromMetaData"},fieldDefinition:{type:"object",additionalProperties:!1,properties:{id:{anyOf:[{$ref:"chart.schema.json#/definitions/curveField"},{$ref:"chart.schema.json#/definitions/eventField"}]},type:{$ref:"#/definitions/valueType"},category:{$ref:"#/definitions/fieldCategory"},name:{type:"string",default:null},shortName:{type:"string",default:null},format:{$ref:"#/definitions/fieldFormat"}},required:["id"]}},type:"array",minItems:1,items:{$ref:"#/definitions/fieldDefinition"}},Or={$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:!1,properties:{symbol:{type:"string"}},required:["symbol"]},mainPlotExpressionContext:{type:"object",additionalProperties:!1,properties:{expression:{type:"string"}},required:["expression"]},mainPlotForwardContext:{type:"object",additionalProperties:!1,properties:{forward:{type:"string"}},required:["forward"]},mainPlotSeasonalContext:{type:"object",additionalProperties:!1,properties:{seasonal:{type:"string"}},required:["seasonal"]},mainPlotAccessor:{type:"object",additionalProperties:!1,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:!1,properties:{id:{type:"string",pattern:"Aggregation"},context:{$ref:"chart.schema.json#/definitions/aggregation"}},required:["id","context"]},periodContext:{type:"object",additionalProperties:!1,properties:{period:{$ref:"chart.schema.json#/definitions/period"}},required:["period"]},rangeContext:{type:"object",additionalProperties:!1,properties:{range:{$ref:"chart.schema.json#/definitions/range"}},required:["range"]},densityContext:{type:"object",additionalProperties:!1,properties:{density:{$ref:"chart.schema.json#/definitions/density"}},required:["density"]},periodAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Period"},context:{oneOf:[{$ref:"#/definitions/periodContext"},{$ref:"#/definitions/rangeContext"},{$ref:"#/definitions/densityContext"}]}},required:["id","context"]},crosshairProperties:{type:"object",additionalProperties:!1,properties:{color:{$ref:"chart.schema.json#/definitions/color"},dashStyle:{$ref:"chart.schema.json#/definitions/dashStyle"}},required:["color"]},crosshairAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Crosshair"},context:{type:"object",additionalProperties:!1,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:!1,properties:{id:{type:"string",pattern:"Tooltip"},context:{type:"object",additionalProperties:!1,properties:{visible:{type:"boolean"},mode:{type:"string",enum:["standard","cards","external"]}},required:["visible"]}},required:["id","context"]},eventsAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Events"},context:{type:"object",additionalProperties:!1,properties:{dividends:{type:"boolean"},earnings:{type:"boolean"},splits:{type:"boolean"},custom:{type:"boolean"}}}},required:["id","context"]},axisPadding:{type:"number",minimum:.001,maximum:1},scaleAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Scale"},context:{type:"object",additionalProperties:!1,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:!1,properties:{id:{type:"string",pattern:"Other"},context:{type:"object",additionalProperties:!1,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:.01},showNavigator:{type:"boolean"},plotHover:{type:"boolean"}}}},required:["id","context"]},placement:{type:"string",enum:["overlay","standalone","withMain","clone"]},plotAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Plot"},context:{type:"object",additionalProperties:!1,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:!1,properties:{symbol:{type:"string"},leftScale:{type:"boolean",default:!1},curves:{$ref:"#/definitions/curvesNonStrict"}},required:["symbol"]},compareAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Compare"},context:{type:"object",additionalProperties:!1,properties:{symbols:{type:"array",minItems:1,items:{$ref:"#/definitions/compareSymbol"}}}}},required:["id","context"]},annotationAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Annotation"},context:{type:"object",additionalProperties:!1,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:!0},points:{type:"array",items:{$ref:"chart.schema.json#/definitions/annPoint"}}},required:["id"]}},required:["id","context"]},movePaneAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"MovePane"},context:{type:"object",additionalProperties:!1,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:!1,properties:{id:{type:"string",pattern:"Template"},context:{type:"object",additionalProperties:!1,properties:{strip:{type:"object",additionalProperties:!1,properties:{main:{type:"boolean",default:!0},annotations:{type:"boolean",default:!1},compare:{type:"boolean",default:!1}}}},required:["strip"]}},required:["id","context"]},outlineAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Outline"},context:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Get"}},required:["id"]}},required:["id","context"]},themeAccessor:{type:"object",additionalProperties:!1,properties:{id:{type:"string",pattern:"Theme"},context:{type:"object",additionalProperties:!1,properties:{id:{type:"string",enum:["Get","Update"],default:"Update"},backgroundColor:{$ref:"chart.schema.json#/definitions/color"},axis:{type:"object",additionalProperties:!1,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:!1,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"}]},wr=/* @__PURE__ */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":"MKTCAP","meta":{"title":"Market Capitalization","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#3498db"],"fields":["MKTCAP"]}]}},{"id":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10},{"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,"enumerations":[{"input":"ExtendLines","values":["None","Left","Right","Both"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Width","value":2},{"name":"ExtendLines","value":"None"}],"curves":[{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRUP"]},{"colors":["rgba(255, 0, 0, 0.3)"],"fields":["LINRMID"]},{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRLOW"]},{"colors":["rgba(0, 0, 255, 0.1)"],"fields":["LINRUP","LINRMID"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 0, 0, 0.1)"],"fields":["LINRMID","LINRLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVEXP","meta":{"title":"Moving Average Envelope Exponential","overlay":true},"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":"Bollinger Bands Modified","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"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":["BOLLW"]}]}},{"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":["BOLLP"]}],"levels":[{"value":0,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":1,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(19, 132, 132, 0.1)"},"range":{"from":0,"to":1}}]}},{"id":"OBVOL","meta":{"title":"On Balance Volume","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":20}],"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":"ADR","meta":{"title":"Average Daily Range (ADR)","overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#ffaf1c"],"fields":["ADR"]}]}},{"id":"ADRP","meta":{"title":"Average Daily Range Percent (ADRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#fb1cff"],"fields":["ADRP"]}]}},{"id":"ATRP","meta":{"title":"Average True Range Percent (ATRP)","decimals":2,"overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"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":"EOSC","meta":{"title":"Exponential Oscillator","overlay":false,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10},{"name":"Source","value":"Close"}],"curves":[{"colors":["#ff6f00"],"fields":["EOSC"]}]}},{"id":"TEMA","meta":{"title":"Moving Average Exponential TEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"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":"REATRS","meta":{"title":"Retracement ATR Stop","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]}]},"defaults":{"source":"Close","inputs":[{"name":"Direction","value":"Long"},{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"High/Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#981e7a"],"fields":["REATRS"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true},"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":"ATR 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},{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["DIFA"],"style":"Area","visible":false,"zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false},"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":"BBANDW","meta":{"title":"Bollinger BandWidth","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2},{"name":"Average","value":"MA"},{"name":"PeriodAvg","value":5}],"curves":[{"colors":["#3d8283"],"fields":["BOLLBW"]},{"colors":["#f08f4c"],"fields":["BOLLBWA"]}]}},{"id":"MARIB","meta":{"title":"Moving Average Ribbon","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"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"]}]}},{"id":"TDI","meta":{"title":"Traders Dynamic Index","overlay":false,"range":{"min":0,"max":100},"decimals":2,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodRSI","value":13},{"name":"PeriodTradeSignal","value":7},{"name":"PeriodMarketBase","value":34},{"name":"PeriodBB","value":34},{"name":"MultiplierBB","value":1.6185},{"name":"Source","value":"Close"}],"curves":[{"colors":["#0088ff"],"fields":["TDIUPR"]},{"colors":["#0088ff"],"fields":["TDILWR"]},{"colors":["rgba(0, 136, 255, 0.1)"],"fields":["TDIUPR","TDILWR"],"style":"Ribbon","lineWidth":0},{"colors":["#00c853"],"fields":["TDIPRC"],"lineWidth":2},{"colors":["#ff1744"],"fields":["TDITSL"],"lineWidth":2},{"colors":["#ff9100"],"fields":["TDIMBL"],"lineWidth":2}],"levels":[{"value":70,"name":"Overbought","line":{"color":"#808080","dashStyle":"Dash"}},{"value":30,"name":"Oversold","line":{"color":"#808080","dashStyle":"Dash"}}]}},{"id":"PPS","meta":{"title":"Price Percent Stop","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]},{"input":"Direction","values":["Long","Short"]},{"input":"Type","values":["Percent","Price"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Range","value":"High/Low"},{"name":"Direction","value":"Long"},{"name":"Type","value":"Percent"},{"name":"StopValue","value":10}],"curves":[{"colors":["#fc0d1b","#00b04b"],"fields":["PPS"],"varyColorPerBar":true}]}},{"id":"FRAMA","meta":{"title":"Fractal Adaptive Moving Average","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":16},{"name":"Source","value":"HL/2"}],"curves":[{"colors":["#ef4226"],"fields":["FRAMA"]}]}},{"id":"FISHER","meta":{"title":"Fisher Transform","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":9}],"curves":[{"colors":["#2962FF"],"fields":["FISHER"]},{"colors":["#FF6D00"],"fields":["FISHTRG"]}],"levels":[{"value":1.5,"name":"1.5","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":0.75,"name":"0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":0,"name":"0","line":{"color":"#E91E63","dashStyle":"Dash"}},{"value":-0.75,"name":"-0.75","line":{"color":"#787B86","dashStyle":"Dash"}},{"value":-1.5,"name":"-1.5","line":{"color":"#E91E63","dashStyle":"Dash"}}]}},{"id":"RCI","meta":{"title":"Spearman Rank Correlation Index","overlay":false,"decimals":2,"range":{"min":-100,"max":100},"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"Smoothing","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":10},{"name":"PeriodSignal","value":3},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#2196F3"],"fields":["RCI"],"lineWidth":2},{"colors":["#FF9800"],"fields":["RCISIG"]}],"levels":[{"value":80,"name":"+80","line":{"color":"#808080","dashStyle":"Dash"}},{"value":0,"name":"Zero","line":{"color":"#808080","dashStyle":"DashDot"}},{"value":-80,"name":"-80","line":{"color":"#808080","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":-80,"to":80}}]}},{"id":"ZIGZAG","meta":{"title":"ZigZag","overlay":true,"enumerations":[{"input":"PercentMode","values":["Fixed","ATR"]},{"input":"Method","values":["High/Low","Source"]},{"input":"Source","values":["Open","High","Low","Close","HL/2","OC/2","HLC/3","OHLC/4","HLCC/4"]},{"input":"ReversalChange","values":["None","Absolute","Percent"]}]},"defaults":{"inputs":[{"name":"PercentMode","value":"ATR"},{"name":"Method","value":"High/Low"},{"name":"Source","value":"Close"},{"name":"ReversalChange","value":"None"},{"name":"Percent","value":5},{"name":"PeriodAtr","value":14},{"name":"MultiplierAtr","value":2.5}],"curves":[{"colors":["#2962FF"],"fields":["ZZPIVOT"]}]}}]');function Rr(e){switch(e){case gs.CHART_SCHEMA:return xr;case gs.STUDIES_SCHEMA:return Ir;case gs.FIELDS_SCHEMA:return Dr;case gs.ACCESSOR_SCHEMA:return Or;default:throw new Error(`Unknown schema name: ${e}`)}}let Nr=[],Vr=!1,Hr=!0;function Br(e){Hr=e}function Fr(e){Nr=Nr.concat(Wa(e,gs.STUDIES_SCHEMA))}const kr=/* @__PURE__ */new Map;function Wr(){Vr||(Fr(wr),Vr=!0);const e=v[Gv()?.config.mode??"Unspecified"];if(!Hr)return Nr;if(!kr.has(e)){const t=M(Kr,e);kr.set(e,Nr.filter(t))}return kr.get(e)}function Ur(e){return ue(Gr(e))}function $r(e){return sr(zv().display,e)}function Gr(e){return Wr().find(t=>t.id===e)}function zr(e){return void 0!==Gr(e)}function Yr(e){const t=[Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.Volume].map(e=>e.id);return e.defaults.source&&!t.includes(e.defaults.source)}function jr(e){return[v.DemoSite,v.cmdtyView].includes(e)}function Kr(e,t){const i=t.id;if("PVACP"===i)return[v.cmdtyView,v.DemoSite].includes(e);const s=[v.GBE,v.cmdtyView];return!(["CPMI","CTPI","CTM","JPI","CTTP","CTTI"].includes(i)&&!s.includes(e))}let qr=null,Xr=!1;function Zr(){if(!Xr){const e=[h.Study,h.BalanceSheet,h.IncomeStatement],t=e.reduce((e,t)=>(e[t]=[],e),{});Object.values(Ka).filter(t=>e.includes(t.category)).map(e=>{t[e.category].push({id:e.id,name:e.name,shortName:e.shortName})});const i=Object.keys(o).filter(e=>{const t=parseInt(e);if(Number.isFinite(t))return o[t]}),s=ue(Wr()).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),n=_r(),r=Object.entries(n).map(([e,t])=>({id:e,options:t.editable,types:t.types,numPoints:t.numPoints}));qr={studies:s,incomeStatements:t[h.IncomeStatement],balanceSheets:t[h.BalanceSheet],studyFields:t[h.Study],curveStyles:i,annotations:r},Xr=!0}return qr}var Jr,Qr,eo,to={exports:{}};function io(){return Jr||(Jr=1,e=to,function(){var t=1,i=2,s=3,n=4,r=5,o=6,a=7,l=8,c=9,u=10,h=11,d=/* @__PURE__ */function(){var e,d,p,f,m=1,g=2,y=3,A=4,S=5,T=6,v=7,P='Unexpected token "%0"',C="Unexpected end of path";function b(){for(var e,t=E();V("|");)$(),(e||(e=[t])).push(E());return e?{type:l,args:e}:t}function E(){return V("(")?L():_()}function L(){k("(");var e=b();k(")");for(var i,s=[];i=M();)s.push(i);return s.length?e.type===t?(e.parts=e.parts.concat(s),e):(s.unshift(e),{type:t,parts:s}):e}function M(){return V("[")?function(){k("[");var e=function(){if(V(":"))return $(),{type:u,toIdx:N()};var e=N();return V(":")?($(),V("]")?{type:u,fromIdx:e}:{type:u,fromIdx:e,toIdx:N()}):{type:u,idx:e}}();return k("]"),{type:n,arg:e}}():V("{")?function(){k("{");var e=I();return k("}"),{type:s,arg:e}}():V("(")?L():void 0}function _(){H()||K($());var e,i=!1;V("^")?($(),i=!0):F()&&(e=$().val.substr(1));for(var s,n=[];s=x();)n.push(s);return{type:t,fromRoot:i,subst:e,parts:n}}function x(){return B()?(t=$().val,s=W(),(V("*")||s.type===m||s.type===y)&&(e=$().val),{type:i,selector:t,prop:e}):M();var e,t,s}function I(){for(var e,t=D();V("||");)$(),(e||(e=[t])).push(D());return e?{type:r,op:"||",args:e}:t}function D(){for(var e,t=O();V("&&");)$(),(e||(e=[t])).push(O());return e?{type:r,op:"&&",args:e}:t}function O(){for(var e=w();V("==")||V("!=")||V("===")||V("!==")||V("^==")||V("==^")||V("^=")||V("=^")||V("$==")||V("==$")||V("$=")||V("=$")||V("*==")||V("==*")||V("*=")||V("=*");)e={type:o,op:$().val,args:[e,O()]};return e}function w(){for(var e=function(){for(var e=R();V("+")||V("-");)e={type:a,op:$().val,args:[e,R()]};return e}();V("<")||V(">")||V("<=")||V(">=");)e={type:o,op:$().val,args:[e,w()]};return e}function R(){for(var e=N();V("*")||V("/")||V("%");)e={type:a,op:$().val,args:[e,R()]};return e}function N(){return V("!")||V("-")?{type:c,op:$().val,arg:N()}:(e=W().type)===y||e===g||e===A||e===S?{type:h,val:$().val}:H()?_():V("(")?function(){k("(");var e=I();return k(")"),e}():K($());var e}function V(e){var t=W();return t.type===T&&t.val===e}function H(){return B()||F()||V("^")}function B(){var e=W();if(e.type===T){var t=e.val;return"."===t||".."===t}return!1}function F(){var e=W();return e.type===m&&"$"===e.val[0]}function k(e){var t=$();t.type===T&&t.val===e||K(t)}function W(){if(null!==p)return p;var e=d;return p=U(),d=e,p}function U(){for(;z(e[d]);)++d;if(d>=f)return{type:v,range:[d,d]};var t=function(){var t=d,i=e[d],s=e[d+1];if("."===i){if(G(s))return;return"."===e[++d]?{type:T,val:"..",range:[t,++d]}:{type:T,val:".",range:[t,d]}}if("="===s){var n=e[d+2];if("="===n){if("=!^$*".indexOf(i)>=0)return{type:T,val:i+s+n,range:[t,d+=3]}}else if("^$*".indexOf(n)>=0){if("="===i)return{type:T,val:i+s+n,range:[t,d+=3]}}else if("=!^$*><".indexOf(i)>=0)return{type:T,val:i+s,range:[t,d+=2]}}else if("="===i&&"^$*".indexOf(s)>=0)return{type:T,val:i+s,range:[t,d+=2]};return i!==s||"|"!==i&&"&"!==i?":{}()[]^+-*/%!><|".indexOf(i)>=0?{type:T,val:i,range:[t,++d]}:void 0:{type:T,val:i+s,range:[t,d+=2]}}();if(t||(t=function(){var t=e[d];if(Y(t)){for(var i=d,s=t;++d<f&&j(t=e[d]);)s+=t;switch(s){case"true":case"false":return{type:A,val:"true"===s,range:[i,d]};case"null":return{type:S,val:null,range:[i,d]};default:return{type:m,val:s,range:[i,d]}}}}())||(t=function(){if('"'===e[d]||"'"===e[d]){for(var t,i=e[d],s=++d,n="",r=!1;d<f;){if("\\"===(t=e[d++]))t=e[d++];else if(('"'===t||"'"===t)&&t===i){r=!0;break}n+=t}return r?{type:y,val:n,range:[s,d]}:void 0}}())||(t=function(){var t=d,i=e[d],s="."===i;if(s||G(i)){for(var n=i;++d<f;){if("."===(i=e[d])){if(s)return;s=!0}else if(!G(i))break;n+=i}return{type:g,val:s?parseFloat(n):parseInt(n,10),range:[t,d]}}}()))return t;t={range:[d,d]},d>=f?t.type=v:t.val=e[d],K(t)}function $(){var e;return p?(d=p.range[1],e=p,p=null,e):U()}function G(e){return"0123456789".indexOf(e)>=0}function z(e){return" \r\n\t".indexOf(e)>-1}function Y(e){return"$"===e||"@"===e||"_"===e||e>="a"&&e<="z"||e>="A"&&e<="Z"}function j(e){return Y(e)||e>="0"&&e<="9"}function K(e){e.type===v&&q(e,C),q(e,P,e.val)}function q(e,t){var i=Array.prototype.slice.call(arguments,2),s=t.replace(/%(\d)/g,function(e,t){return i[t]||""}),n=new Error(s);throw n.column=e.range[0],n}return function(t){e=t.split(""),d=0,p=null,f=e.length;var i=b(),s=$();return s.type!==v&&K(s),i}}(),p=/* @__PURE__ */function(){var e,u,d,p;function f(){if(p.length)return p.shift();var e="v"+ ++d;return u.push(e),e}function m(){for(var e=arguments,t=e.length;t--;)p.push(e[t])}function g(t,i,s){if(t.prop){var n=C(t.prop),r=f(),o=f(),a=f(),l=f(),c=f(),u=f(),h=f();e.push(r,"= [];",o,"= 0;",a,"=",s,".length;",h,"= [];","while(",o,"<",a,") {",l,"=",s,"[",o,"++];","if(",l,"!= null) {"),"*"===t.prop?(e.push("if(typeof ",l,'=== "object") {',"if(isArr(",l,")) {",r,"=",r,".concat(",l,");","}","else {","for(",c," in ",l,") {","if(",l,".hasOwnProperty(",c,")) {",u,"=",l,"[",c,"];"),b(r,u),e.push("}","}","}","}")):(e.push(u,"=",l,"[",n,"];"),b(r,u,h,a)),e.push("}","}",i,"=",a,"> 1 &&",h,".length?",h,".length > 1?","concat.apply(",r,",",h,") :",r,".concat(",h,"[0]) :",r,";"),m(r,o,a,l,c,u,h)}}function y(t,i,s){var n=t.prop,r=f(),o=f(),a=f(),l=f(),c=f(),u=f(),h=f(),d=f();e.push(r,"=",s,".slice(),",d,"= [];","while(",r,".length) {",o,"=",r,".shift();"),n?e.push("if(typeof ",o,'=== "object" &&',o,") {"):e.push("if(typeof ",o,"!= null) {"),e.push(a,"= [];","if(isArr(",o,")) {",l,"= 0,",h,"=",o,".length;","while(",l,"<",h,") {",u,"=",o,"[",l,"++];"),n&&e.push("if(typeof ",u,'=== "object") {'),b(a,u),n&&e.push("}"),e.push("}","}","else {"),n?"*"!==n&&(e.push(u,"=",o,'["'+n+'"];'),b(d,u)):(b(d,o),e.push("if(typeof ",o,'=== "object") {')),e.push("for(",c," in ",o,") {","if(",o,".hasOwnProperty(",c,")) {",u,"=",o,"[",c,"];"),b(a,u),"*"===n&&b(d,u),e.push("}","}"),n||e.push("}"),e.push("}",a,".length &&",r,".unshift.apply(",r,",",a,");","}","}",i,"=",d,";"),m(r,o,a,l,c,u,h,d)}function A(t,i,s){var n=f(),r=f(),o=f(),a=f(),l=f();e.push(n,"= [];",r,"= 0;",o,"=",s,".length;","while(",r,"<",o,") {",l,"=",s,"[",r,"++];"),T(t.arg,a,l),e.push(L(t.arg,a),"&&",n,".push(",l,");","}",i,"=",n,";"),m(n,r,o,l,a)}function S(t,i,s){var n,r,o=t.arg;if(o.idx){var a=f();return T(o.idx,a,s),e.push(a,"< 0 && (",a,"=",s,".length +",a,");",i,"=",s,"[",a,"] == null? [] : [",s,"[",a,"]];"),m(a),!1}o.fromIdx?o.toIdx?(T(o.fromIdx,n=f(),s),T(o.toIdx,r=f(),s),e.push(i,"=",s,".slice(",n,",",r,");"),m(n,r)):(T(o.fromIdx,n=f(),s),e.push(i,"=",s,".slice(",n,");"),m(n)):(T(o.toIdx,r=f(),s),e.push(i,"=",s,".slice(0,",r,");"),m(r))}function T(u,d,p){switch(u.type){case t:!function(t,r,o){var a=t.parts,c=0,u=a.length;for(e.push(r,"=",t.fromRoot?"data":t.subst?"subst."+t.subst:o,";","isArr("+r+") || ("+r+" = ["+r+"]);");c<u;){var h=a[c++];switch(h.type){case i:".."===h.selector?y(h,r,r):g(h,r,r);break;case s:A(h,r,r);break;case n:S(h,r,r);break;case l:P(h,r,r)}}}(u,d,p);break;case l:P(u,d,p);break;case o:!function(i,s,n){var r=f(),o=f(),a=f(),l=f(),c=f(),u=f(),d=f(),p=f(),g=i.args[0],y=i.args[1];e.push(s,"= false;"),T(g,r,n),T(y,o,n);var A=g.type===t,S=y.type===h;e.push(a,"="),A?e.push("true;"):e.push("isArr(",r,");"),e.push(l,"="),S?e.push("false;"):e.push("isArr(",o,");"),e.push("if("),A||e.push(a,"&&"),e.push(r,".length === 1) {",r,"=",r,"[0];",a,"= false;","}"),S||e.push("if(",l,"&&",o,".length === 1) {",o,"=",o,"[0];",l,"= false;","}"),e.push(c,"= 0;","if(",a,") {",d,"=",r,".length;"),S||(e.push("if(",l,") {",p,"=",o,".length;","while(",c,"<",d,"&& !",s,") {",u,"= 0;","while(",u,"<",p,") {"),v(i.op,[r,"[",c,"]"].join(""),[o,"[",u,"]"].join("")),e.push(s,"= true;","break;","}","++",u,";","}","++",c,";","}","}","else {")),e.push("while(",c,"<",d,") {"),v(i.op,[r,"[",c,"]"].join(""),o),e.push(s,"= true;","break;","}","++",c,";","}"),S||e.push("}"),e.push("}"),S||(e.push("else if(",l,") {",p,"=",o,".length;","while(",c,"<",p,") {"),v(i.op,r,[o,"[",c,"]"].join("")),e.push(s,"= true;","break;","}","++",c,";","}","}")),e.push("else {",s,"=",R[i.op](r,o),";","}"),m(r,o,a,l,c,u,d,p)}(u,d,p);break;case a:!function(t,i,s){var n=f(),r=f(),o=t.args;T(o[0],n,s),T(o[1],r,s),e.push(i,"=",R[t.op](M(o[0],n),M(o[1],r)),";"),m(n,r)}(u,d,p);break;case r:!function(t,i,s){var n,r=[],o=t.args,a=o.length,l=0;switch(e.push(i,"= false;"),t.op){case"&&":for(;l<a;)r.push(n=f()),T(o[l],n,s),e.push("if(",L(o[l++],n),") {");e.push(i,"= true;");break;case"||":for(;l<a;)r.push(n=f()),T(o[l],n,s),e.push("if(",L(o[l],n),") {",i,"= true;","}"),1+l++<a&&e.push("else {");--a}for(;a--;)e.push("}");m.apply(null,r)}(u,d,p);break;case c:!function(t,i,s){var n=f(),r=t.arg;switch(T(r,n,s),t.op){case"!":e.push(i,"= !",L(r,n)+";");break;case"-":e.push(i,"= -",M(r,n)+";")}m(n)}(u,d,p);break;case h:e.push(d,"="),b=u.val,e.push("string"==typeof b?C(b):null===b?"null":b),e.push(";")}var b}function v(t,i,s){e.push("if(",R[t](i,s),") {")}function P(t,i,s){for(var n=[],r=t.args,o=r.length,a=0;a<o;)n.push(f()),T(r[a],n[a++],s);e.push(i,"= concat.call(",n.join(","),");"),m.apply(null,n)}function C(e){return"'"+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"}function b(t,i,s,n){e.push("if(typeof ",i,'!== "undefined") {',"if(isArr(",i,")) {"),s&&(e.push(n,"> 1?"),E(s,i),e.push(":")),e.push(t,"=",t,".length?",t,".concat(",i,") :",i,".slice()",";","}","else {"),s&&e.push("if(",s,".length) {",t,"= concat.apply(",t,",",s,");",s,"= [];","}"),E(t,i),e.push(";","}","}")}function E(t,i){e.push(t,".length?",t,".push(",i,") :",t,"[0] =",i)}function L(e,i){switch(e.type){case r:return i;case h:return"!!"+i;case t:return i+".length > 0";default:return["(typeof ",i,'=== "boolean"?',i,":","isArr(",i,")?",i,".length > 0 : !!",i,")"].join("")}}function M(e,i){switch(e.type){case h:return i;case t:return i+"[0]";default:return["(isArr(",i,")?",i,"[0] : ",i,")"].join("")}}function _(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".indexOf(",t,") === 0"].join("")}function x(e,t){return[e,"!= null &&",t,"!= null &&",e,".toString().toLowerCase().indexOf(",t,".toString().toLowerCase()) === 0"].join("")}function I(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".length >=",t,".length &&",e,".lastIndexOf(",t,") ===",e,".length -",t,".length"].join("")}function D(e,t){return[e,"!= null &&",t,"!= null &&","(",e,"=",e,".toString()).length >=","(",t,"=",t,".toString()).length &&","(",e,".toLowerCase()).lastIndexOf(","(",t,".toLowerCase())) ===",e,".length -",t,".length"].join("")}function O(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".indexOf(",t,") > -1"].join("")}function w(e,t){return[e,"!= null && ",t,"!= null &&",e,".toString().toLowerCase().indexOf(",t,".toString().toLowerCase()) > -1"].join("")}var R={"===":function(e,t){return e+"==="+t},"==":function(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string"?',e,".toLowerCase() ===",t,".toLowerCase() :"+e,"==",t].join("")},">=":function(e,t){return e+">="+t},">":function(e,t){return e+">"+t},"<=":function(e,t){return e+"<="+t},"<":function(e,t){return e+"<"+t},"!==":function(e,t){return e+"!=="+t},"!=":function(e,t){return e+"!="+t},"^==":_,"==^":function(e,t){return _(t,e)},"^=":x,"=^":function(e,t){return x(t,e)},"$==":I,"==$":function(e,t){return I(t,e)},"$=":D,"=$":function(e,t){return D(t,e)},"*==":O,"==*":function(e,t){return O(t,e)},"=*":function(e,t){return w(t,e)},"*=":w,"+":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(i){if(e=[],u=["res"],d=0,p=[],T(i,"res","data"),e.unshift("var ",Array.isArray?"isArr = Array.isArray":'toStr = Object.prototype.toString, isArr = function(o) { return toStr.call(o) === "[object Array]"; }',", concat = Array.prototype.concat",",",u.join(","),";"),i.type===t){var s=i.parts[i.parts.length-1];s&&s.type===n&&"idx"in s.arg&&e.push("res = res[0];")}return e.push("return res;"),e.join("")}}();function f(e){return Function("data,subst",p(d(e)))}var m={},g=[],y={cacheSize:100},A={cacheSize:function(e,t){if(t<e&&g.length>t)for(var i=g.splice(0,g.length-t),s=i.length;s--;)delete m[i[s]]}},S=function(e,t,i){return m[e]||(m[e]=f(e),g.push(e)>y.cacheSize&&delete m[g.shift()]),m[e](t,i||{})};S.version="0.3.4",S.params=function(e){if(!arguments.length)return y;for(var t in e)e.hasOwnProperty(t)&&(A[t]&&A[t](y[t],e[t]),y[t]=e[t])},S.compile=f,S.apply=S,e.exports=S}()),to.exports;var e}var so=eo?Qr:(eo=1,Qr=io());function no(e,t,i){if(function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e}(e))return e;if(Array.isArray(e))return e.map(e=>no(e,t,i)).filter(e=>e!==gs.NULL_OBJECT);{let s=t.indexOf(e);if(-1!==s)return i[s];let n={};for(let r in e){const s=e[r];n[r]=no(s,t,i)}return n}}function ro(e,t,i){return[].concat(so.apply(t,e,i))}function oo(e,t,i){let s=ue(e),n=ro(s,t),r=n.map(i);if(r.some(e=>void 0===e))throw new Error(`Forgot to return transformed value from accessor ${i}`);return no(s,n,r)}const ao=["1D","5D","1M","3M","6M","1Y","5Y","Max"];function lo(e){return 1===e.length}function co(e){return 1===e.length}const uo={ATRLTR:"REATRHI",ATRSTR:"REATRLO",PeriodMARng:"PeriodAdjATR",PeriodAdjATR:"FactorAdjATR"};const ho={BBANDS:{colors:["#89211e"],fields:["BOLLBM"],visible:!1},DONCHN:{colors:["#ff6a00"],fields:["DONMID"],visible:!1}};const po={[gs.AT_SINGLE_STYLE]:!0,[gs.AT_SHOW_BACKGROUND]:!1,[gs.AT_BACKGROUND_OPACITY]:.2},fo={[gs.AT_SHOW_PRICES]:!0,[gs.AT_SHOW_LEVELS]:!0,[gs.AT_LEVELS_KIND]:gs.AT_LEVELS_PERCENTS,[gs.AT_LABELS]:gs.AT_LABELS_LEFT,[gs.AT_EXTEND_LEFT]:!1,[gs.AT_EXTEND_RIGHT]:!0,[gs.AT_REVERSE]:!1,...po},mo={FibonacciFan:{[gs.AT_SHOW_LEVELS]:!1,[gs.AT_LABELS]:gs.AT_LABELS_RIGHT,[gs.AT_REVERSE]:!1,...po},FibonacciArcs:{[gs.AT_SHOW_LEVELS]:!1,...po},FibonacciRetracement:{...fo},TrendBasedFibExtension:{...fo},FibonacciChannel:{[gs.AT_SHOW_LEVELS]:!0,[gs.AT_LEVELS_KIND]:gs.AT_LEVELS_PERCENTS,[gs.AT_LABELS]:gs.AT_LABELS_LEFT,...po},FibonacciTimeZones:{[gs.AT_SHOW_LEVELS]:!0,[gs.AT_LABELS]:gs.AT_LABELS_RIGHT,...po},GannFan:{[gs.AT_SHOW_LEVELS]:!1,...po},GannBox:{...po,[gs.AT_SHOW_BACKGROUND]:!0},GannSquare:{...po,[gs.AT_SHOW_BACKGROUND]:!0}},go=()=>({width:1,color:Zn(Math.floor(100*Math.random())),dashStyle:"Solid"}),yo=["FibonacciFan","FibonacciArcs","FibonacciChannel","FibonacciTimeZones","FibonacciRetracement","TrendBasedFibExtension"],Ao=[...yo,"GannFan","GannBox","GannSquare"],So=["Line","Ray","GannLine"],To=["ComputedText","ProfitLoss","RewardRisk"];function vo(e){return yo.includes(e)?["factors"]:"GannFan"===e?["angles"]:"GannBox"===e?["priceLevels","timeLevels"]:"GannSquare"===e?["levels","fans","arcs"]:[]}function Po(e,t,i){const s=!le(e,t)||!Array.isArray(e[t]),n=!s&&e[t].some(e=>!ie(e.value));if(s||n)return e[t]=i[t],!0}function Co(e,t){if(!ie(t))return;const i=vo(e),s=sr(null,e);for(const n of i)if(!Po(t,n,s))for(const e of t[n])Number.isFinite(e.value)&&(e.value=se(e.value,6))}function bo(e,t,i=!1){const s="FibonacciFan"===e,n=ie(t);if(Ao.includes(e)&&n){if(i){pe(t,mo[e])}const n=vo(e),r=sr(null,e);for(const e of n)if(!Po(t,e,r))for(const i of t[e]){const t=r[e].find(e=>e.value===i.value)||r[e].find(e=>e.value===Math.abs(i.value));ie(i.line)||(i.line=t?t.line:go()),s&&0===i.value&&!ie(i.shown)&&(i.shown=!0)}"FibonacciChannel"===e&&t[gs.AT_SHOW_LABELS]?(t[gs.AT_SHOW_LEVELS]=t[gs.AT_SHOW_LABELS],delete t[gs.AT_SHOW_LABELS]):"FibonacciArcs"!==e||t[gs.AT_SHOW_TRENDLINE]||(t[gs.AT_SHOW_TRENDLINE]=!0)}So.includes(e)&&n&&!ie(t[gs.AT_MARKER])&&(t[gs.AT_MARKER]={...Er}),n&&(t[gs.AT_ALLOW_PRICES_CHANGE_UI]=!To.includes(e))}const Eo=[3,4,5,6,7,8,9,10,11],Lo=[12,13,14,15,16,17,18,19,20];const Mo=[{name:"Source",value:"Close"},{name:"Average",value:"MA"}];function _o(e){const t=e.curves?.length??0,i=e.offsets?.length??0;if(0!==t&&0!==i&&t===i+1){const 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 xo(e,t){const i=e.find(e=>"TurtleChnField"===e.name&&e.value===t);te(i)&&(i.value="High/Low")}const Io={colors:["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],fields:["DIFA"],style:"Area",visible:!1,zones:[{value:0,colors:1},{colors:1}]};function Do(e){return function(t){return t.version=e,t}}const Oo={_3to4:function(e){const t=e.data.period;if(null!==t){const i="Max"===t?gs.AUTOFIT_PERIOD:`P${t}`,s=ao.findIndex(e=>e===t);let n={unit:"Day"};s<2?n={unit:"Intraday",size:15}:s>5&&(n={unit:"Month"}),delete e.data.period,e.display.period=i,e.data.aggregation=n,e.version=4}return e},_4to5:function(e){const t=ro(e,'..panes[0]..plots{.type === "Symbol"}[0].curves{.style === "Candlestick" && .attributes === "Hollow" }');if(1===t.length){const e=t[0];e.attributes.splice(e.attributes.indexOf("Hollow"),1),0===e.attributes.length&&delete e.attributes,e.style="HollowCandles",e.colors=ue(gs.COLOR_DEFAULT_VARY)}return e.version=5,e},_5to6:function(e){const t=ro(e,'..panes[0]..plots{.type === "Symbol"}[0]');if(1===t.length){t[0].main=!0}return e.version=6,e},_6to7:function(e){const t=ro(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){const t=e.curves.length-1,i=bn(e.curves[t].colors[0]);i.a=.1,e.curves.push({colors:[Mn(i)],fields:e.curves[0].fields.concat(e.curves[t].fields),lineWidth:0,style:"Ribbon"})}}),e.version=7,e},_7to8:function(e){const t=ro(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===gs.INPUT_PERIOD){const t=e.inputs[0].value;e.inputs=[{name:"AdxSmoothing",value:t},{name:"DiLength",value:t}]}}),e.version=8,e},_8to9:function(e){const t=".display.yAxis",i=".minorGridLines",s=ro(e,t);if(lo(s)){if(!lo(ro(s,i))){const e=ro(Gv().template,t+i);lo(e)&&(s[0].minorGridLines=e[0])}}return e.version=9,e},_9to10:function(e){const t=".display.navigator",i=".enabled",s=ro(e,t);if(co(s)){if(!co(ro(s,i))){const e=ro(Gv().template,t+i);co(e)&&(s[0].enabled=e[0])}}return e.version=10,e},_10to11:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "TCHN"}');return t.length>0&&t.forEach(e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===gs.INPUT_PERIOD){const 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){const t=ro(e,".display.navigator");if(1===t.length){const e=t[0];e.visible=e.enabled&&e.visible||!1,delete e.enabled}return e.version=12,e},_12to13:function(e){return ro(e,"..annotations").forEach(e=>{if("AndrewsPitchfork"===e.id){const[t,i,s]=e.points;e.points=[i,t,s]}}),e.version=13,e},_13to14:function(e){const t=ro(e,".display");if(1===t.length){const e=t[0];e.scrollbar.visible=e.navigator.visible||!1,delete e.navigator}return e.version=14,e},_14to15:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ATRLTR","ATRSTR"]}),i=e=>le(uo,e)?uo[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){const t=ro(e,"..annotations"),i="FibonacciRetracement",s=e=>({shown:!1,value:e}),n=[-.618,-.236].map(s),r=[1.272,1.618,2.618].map(s);return t.forEach(e=>{if(e.id===i){const t=e.traits;if(ie(t)&&ie(t.factors)){const e=sr(null,i).factors,s=t.factors.map((t,i)=>{const s=!ie(t);return{shown:!s,value:s?e[i+2].value:t}});t.factors=n.concat(s).concat(r)}}}),e.version=16,e},_16to17:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHM","STOCHS"]});return t.length>0&&t.forEach(e=>{const t="STOCHM"===e.study,i=Ur(t?"STOCHS":e.study);ie(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){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["BBANDS","DONCHN"]});return t.length>0&&t.forEach(e=>{if(ie(e.curves)&&3===e.curves?.length){const t=ue(ho[e.study]);e.curves.push(t)}}),e.version=18,e},_18to19:function(e){const t=ro(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){const t=ro(e,".display.yAxis");if(1===t.length){const e=t[0];ie(e.showLastValue)&&(e.showLastValue=e.showLastValue?"All":"None")}return e.version=20,e},_20to21:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CTMF","TPI"]});return t.length>0&&t.forEach(e=>{const 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){const t=ro(e,'..plots{.type === "Study" && .study === "AWEOSC"}');return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>0&&e.curves[0].zones){const t=e.curves[0];delete t.zones,t.varyColorPerBar=!0}}),e.version=22,e},_22to23:function(e){const t=e.display.yAxis;return delete t.minPadding,delete t.maxPadding,e.version=23,e},_23to24:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "GTPI"}');return t.length>0&&t.forEach(e=>{if(e.curves&&e.curves.length>0){const 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){const t=ro(e,'..plots{.type === "Study" && .study === "MOM"}');if(t.length>0){const e=Ur("MOM");t.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&t.curves.push(e.defaults.curves[1]),1===t.inputs?.length&&2===e.defaults.inputs?.length&&t.inputs.push(e.defaults.inputs[1])})}return e.version=25,e},_25to26:function(e){const t=ro(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=Ur(e.study).defaults.inputs}),e.version=26,e},_26to27:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "ATR"}');if(t.length>0){const e=Ur("ATR");t.forEach(t=>{t.curves&&1===t.curves.length&&2===e.defaults.curves.length&&t.curves.push(e.defaults.curves[1]),2===t.inputs?.length&&3===e.defaults.inputs?.length&&t.inputs.push(e.defaults.inputs[2])})}return e.version=27,e},_27to28:function(e){const t=ro(e,'..plots{.type === "Study"}'),i=Ur("ALLG");return t.length>0&&t.forEach(e=>{delete e.shift,"ALLG"===e.study&&e.curves&&e.curves.forEach(e=>{const t=(e=>{const t=i.defaults.curves.find(t=>t.fields[0]===e.fields[0]);if(ie(t))return t.shift})(e);ie(t)&&(e.shift=t)})}),e.version=28,e},_28to29:function(e){const t=Ua(oo(e,'..plots{.type === "Study" && .study === "DEMARK"}',e=>gs.NULL_OBJECT));return t.version=29,t},_29to30:function(e){const t=Ua(oo(e,'..plots{.type === "Study" && .study === "ULTOSC"}',e=>gs.NULL_OBJECT));return t.version=30,t},_30to31:function(e){const t=ro(e,"..annotations"),i="FibonacciRetracement";return t.forEach(e=>{if(e.id===i){const[t,s]=e.points;t.time>s.time&&(e.points=[s,t]);const n=e.traits;if(ie(n)){const e=sr(null,i);n.line2=e.line2}}}),e.version=31,e},_31to32:function(e){return e.version=32,e},_32to33:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:Wr().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){const t=ro(e,'..plots{.type === "Study" && .study === "VWAP"}'),i=Ur("VWAP");return t.length>0&&t.forEach(e=>{ie(e.inputs)||(e.inputs=i.defaults.inputs.slice()),1===e.curves?.length&&e.curves.push(...i.defaults.curves.slice(1))}),e.version=34,e},_34to35:function(e){const t="OBVOL",i=ro(e,`..plots{.type === "Study" && .study === "${t}"}`);if(i.length>0){const e=Ur(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 ro(e,"..annotations").forEach(e=>{e.uid=Pe()}),e.version=36,e},_36to37:function(e){return e.version=37,e},_37to38:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "CRS"}'),i=Ur("CRS");return t.length>0&&t.forEach(e=>{3===e.inputs?.length&&e.inputs.push(i.defaults.inputs[3])}),e.version=38,e},_38to39:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "PERF"}'),i=Ur("PERF");return t.length>0&&t.forEach(e=>{0===e.inputs?.length&&(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){const t=ro(e,"..annotations"),i=["FibonacciTimeZones","FibonacciFan","FibonacciArcs"],s=_r();return t.forEach(e=>{const t=e.id;i.includes(t)?e.traits.factors=ue(s[t].defaults.factors):"GannFan"===t&&(e.traits.angles=ue(s[t].defaults.angles))}),e.version=43,e},_43to44:Do(44),_44to45:Do(45),_45to46:Do(46),_46to47:Do(47),_47to48:Do(48),_48to49:Do(49),_49to50:Do(50),_50to51:Do(51),_51to52:Do(52),_52to53:Do(53),_53to54:Do(54),_54to55:Do(55),_55to56:Do(56),_56to57:function(e){const t=ro(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:Do(58),_58to59:Do(59),_59to60:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["VOL","MAVOL"]}),i=Ur("MAVOL"),s=e=>{if(!ie(e)||e.length<1)return"LikeMain";switch(e[0]){case"ChangeBased":return"CloseToClose";case"OpenVsClose":return"OpenToClose";default:return"LikeMain"}};return t.length>0&&t.forEach(e=>{if(!ie(e.curves))return;const t="VOL"===e.study?0:1;var n;ie(e.inputs)||(e.inputs=[]),1===t&&1===e.curves?.length&&e.curves.push(ue(i.defaults.curves[1])),e.inputs.push((n=e.curves[t].attributes,{name:"BarColoring",value:s(n)})),delete e.curves[t].attributes}),e.version=60,e},_60to61:Do(61),_61to62:Do(62),_62to63:Do(63),_63to64:Do(64),_64to65:function(e){const t="DIFA",i=ro(e,`..plots{.type === "Study" && .study === "${t}"}`),s=Ur(t);return i.length>0&&i.forEach(e=>{2===e.inputs?.length&&e.inputs.push(s.defaults.inputs[2])}),e.version=65,e},_65to66:function(e){return ro(e,"..annotations").forEach(e=>{if("FibonacciTimeZones"===e.id){const t=e.points;if(1===t.length){const e=ue(t[0]);e.time+=1,t.push(e)}}}),e.version=66,e},_66to67:Do(67),_67to68:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "DPO"}'),i=Ur("DPO");return t.length>0&&t.forEach(e=>{if(ie(e.curves)&&1===e.curves?.length&&!ie(e.levels)){const t=e.curves[0];if(1===t.colors?.length&&!ie(t.zones)){e.levels=i.defaults.levels,t.zones=i.defaults.curves[0].zones;const s=Tn(t.colors[0],.3);t.colors=[s,s]}}}),e.version=68,e},_68to69:Do(69),_69to70:function(e){const t="RSISTO",i=ro(e,`..plots{.type === "Study" && .study === "${t}"}`),s=Ur(t);return i.length>0&&i.forEach(e=>{1===e.curves?.length&&2===e.inputs?.length&&(e.curves.push(s.defaults.curves[1]),e.inputs.push(...s.defaults.inputs.slice(2)))}),e.version=70,e},_70to71:function(e){return ro(e,"..annotations").forEach(e=>bo(e.id,e.traits,!0)),e.version=71,e},_71to72:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["GTPI","GPMI","CBMI"]}),i=Ur("JPI");return t.length>0&&t.forEach(e=>{const t=t=>e.study===t,s=(t,i)=>{e.study=t,e.curves?.length&&e.curves.forEach(e=>{for(const t of i){const[i,s]=t;1===e.fields?.length&&e.fields[0]===i&&(e.fields[0]=s)}})};t("GTPI")?s("CTPI",[["GTPI","CTPI"]]):t("GPMI")?s("CPMI",[["GPMI","CPMI"]]):t("CBMI")&&(s("JPI",[["CBMB","JPIB"],["CBMS","JPIS"]]),3===e.inputs?.length&&(e.inputs=e.inputs.map(e=>"FastNumber"===e.name?{name:"FastPeriod",value:Eo[Number(e.value)-1]}:"SlowNumber"===e.name?{name:"SlowPeriod",value:Lo[Number(e.value)-1]}:e),e.inputs.splice(2,0,i.defaults.inputs[2])))}),e.version=72,e},_72to73:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["JPI"]}),i=Ur("JPI").defaults.inputs.find(e=>"HandbrakePeriod"===e.name);return t.length>0&&t.forEach(e=>{4===e.inputs?.length&&e.inputs.push(i)}),e.version=73,e},_73to74:Do(74),_74to75:Do(75),_75to76:Do(76),_76to77:function(e){const t="COPP",i=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[`${t}`]}),s=Ur(t);return i.length>0&&i.forEach(e=>{ie(e.inputs)&&(e.curves=s.defaults.curves,e.levels=s.defaults.levels)}),e.version=77,e},_77to78:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MFI"]}),i=Ur("MFI");return t.length>0&&t.forEach(e=>{ie(e.inputs)&&(e.levels=i.defaults.levels,e.bands=i.defaults.bands)}),e.version=78,e},_78to79:function(e){const t="RSI",i="RSIMOD",s=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i]}),n=Ur(t),r=Ur(i);return s.length>0&&s.forEach(e=>{if(ie(e.inputs)){const i=e.study===t?n.defaults:r.defaults;e.inputs.push(...i.inputs.slice(1)),e.curves.push(...i.curves.slice(1))}}),e.version=79,e},_79to80:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CCI"]}),i=Ur("CCI");return t.length>0&&t.forEach(e=>{if(te(e.inputs)){const t=e.curves[0].colors[0],s=Tn(t,.3);e.curves=i.defaults.curves;const n=e.curves[0].colors;n[0]=n[3]=s,n[2]=t,te(e.levels)?e.levels.splice(1,0,i.defaults.levels[1]):e.levels=i.defaults.levels,te(e.bands)||(e.bands=i.defaults.bands)}}),e.version=80,e},_80to81:Do(81),_81to82:Do(82),_82to83:Do(83),_83to84:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP"]}),i=Ur("MACD");return t.length>0&&t.forEach(e=>{ie(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=84,e},_84to85:Do(85),_85to86:Do(86),_86to87:function(e){const t="BBANDS",i=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Ur(t);return i.length>0&&i.forEach(e=>{3===e.inputs?.length&&e.inputs.push(s.defaults.inputs[3])}),e.version=87,e},_87to88:Do(88),_88to89:Do(89),_89to90:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "EHLAI" }');return t.length>0&&t.forEach(e=>{e.study="NHLAI",1===e.curves?.length&&1===e.curves[0].fields?.length&&(e.curves[0].fields[0]="NHLAI")}),e.version=90,e},_90to91:function(e){const t="MCCLO",i=ro(e,`..plots{.type === "Study" && .study === "${t}" }`),s=Ur(t);return i.length>0&&i.forEach(e=>{3===e.inputs?.length&&e.inputs.push(s.defaults.inputs[3])}),e.version=91,e},_91to92:Do(92),_92to93:Do(93),_93to94:Do(94),_94to95:Do(95),_95to96:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PMO"]}),i=Ur("PMO");return t.length>0&&t.forEach(e=>{ie(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=96,e},_96to97:Do(97),_97to98:Do(98),_98to99:Do(99),_99to100:Do(100),_100to101:Do(101),_101to102:function(e){return ro(e,"..annotations").forEach(e=>{if("ComputedText"===e.id){e.points.splice(2);const[t,i]=["ProfitLoss","RewardRisk"];e.traits.kind===t?e.id=t:e.traits.kind===i&&(e.id=i),e.traits[gs.AT_SHOW_PRICES]=e.traits[gs.AT_DRAW_LINES]??!0,delete e.traits[gs.AT_DRAW_LINES],e.traits[gs.AT_POSITION]=e.traits.pos??"Long",delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[gs.AT_ALLOW_PRICES_CHANGE_UI]=!1}}),e.version=102,e},_102to103:Do(103),_103to104:function(e){const t="UseAllFields";return ro(e,`..curves{.attributes === "${t}"}`).forEach(e=>{const i=e.attributes.indexOf(t);e.attributes.splice(i,1),"Column"===e.style&&(e.style="MultiColumn",e.varyColorPerBar=!1)}),e.version=104,e},_104to105:Do(105),_105to106:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MASMO","MATRI","MAWEI","DEMA","TEMA","HMA","MARIB","MA","MAEXP"]});return t.length>0&&t.forEach(e=>{const t=e.inputs;if(te(t)){const e=e=>t.findIndex(t=>t.name===e),i=(i,s,n)=>{if(e(i)>=0)return;const r={name:i,value:s};n<0?t.push(r):t.splice(n,0,r)};i("Source","Close",e("Offset")),i("Offset",0,-1)}}),e.version=106,e},_106to107:Do(107),_107to108:Do(108),_108to109:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MASIG","MACDSIG"]});return t.length>0&&t.forEach(e=>{const t="MASIG"===e.study;e.study=t?"PACROSS":"MACROSS";const i=e.inputs;te(i)&&i.splice(0,0,...Mo);const s=e.curves;te(s)&&t&&(s[0].fields[0]="AVG")}),e.version=109,e},_109to110:Do(110),_110to111:function(e){return ro(e,"..annotations").forEach(e=>{"LongPosition"!==e.id&&"ShortPosition"!==e.id||(e.traits[gs.AT_ALLOW_PRICES_CHANGE_UI]=!0)}),e.version=111,e},_111to112:Do(112),_112to113:function(e){const t="CHEXI",i=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Ur(t).defaults;return i.length>0&&i.forEach(e=>{te(e.inputs)&&e.inputs.length===s.inputs?.length&&e.inputs.forEach((e,t)=>{const i=Number(e.value),n=Number.isInteger(i);e.value=n?i:s.inputs[t].value})}),e.version=113,e},_113to114:function(e){const t=ro(e,"..plots{.detachedScale}");return t.length>0&&t.forEach(e=>{e.detachedScale=!0}),e.version=114,e},_114to115:Do(115),_115to116:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHS"]});return t.length>0&&t.forEach(e=>{const t=Ur(e.study).defaults;te(e.inputs)&&te(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){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHAMF"]});return t.length>0&&t.forEach(e=>{const t=Ur(e.study).defaults;te(e.inputs)&&te(e.curves)&&(e.curves[0]=t.curves[0])}),e.version=117,e},_117to118:Do(118),_118to119:Do(119),_119to120:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHDMOMOSC","TSI","DIFA"]});return t.length>0&&t.forEach(e=>{const t=Ur(e.study).defaults;if(te(e.inputs)&&te(e.curves))switch(e.study){case"CHDMOMOSC":case"TSI":{const i=e.levels?.[0];e.levels=t.levels,te(i)&&(e.levels[1]=i);break}case"DIFA":{const[i,s]=e.curves[0].colors;e.curves=[t.curves[0]],e.curves[0].colors=[i,Sn(i),s,Sn(s)];break}}}),e.version=120,e},_120to121:Do(121),_121to122:Do(122),_122to123:Do(123),_123to124:Do(124),_124to125:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP","PPO"]});return t.length>0&&t.forEach(e=>{const t=Ur(e.study).defaults;if(te(e.inputs)&&te(e.curves))switch(e.study){case"MACD":case"MACDEXP":{const i=e.curves[2],s=i.colors;if(delete i.zones,2===s.length){const e=s.map(e=>Tn(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:Do(126),_126to127:Do(127),_127to128:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CRS"]}),i=Ur("CRS");return t.length>0&&t.forEach(e=>{ie(e.inputs)&&(e.levels=i.defaults.levels)}),e.version=128,e},_128to129:Do(129),_129to130:Do(130),_130to131:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PC"]}),i=Ur("PC");return t.length>0&&t.forEach(e=>{if(te(e.inputs)&&6===e.inputs.length){const 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:Do(132),_132to133:Do(133),_133to134:Do(134),_134to135:Do(135),_135to136:Do(136),_136to137:function(e){const t="VOLAP",i=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Ur(t);return i.length>0&&i.forEach(e=>{if(te(e.inputs)&&5===e.inputs.length){const t=e.inputs.find(e=>"Bars"===e.name);te(t)&&(t.name="LevelSize"),e.inputs=[{name:"LevelMode",value:"Count"},...e.inputs,{name:"ValueRangePercent",value:70}]}if(te(e.curves)&&1===e.curves.length){const 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=>Tn(e,.6))}}),e.version=137,e},_137to138:Do(138),_138to139:Do(139),_139to140:function(e){const t="ADX",i="ADXMOD",s=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i]}),n=Ur(t),r=Ur(i);return s.length>0&&s.forEach(e=>{if(ie(e.inputs)){const i=e.study===t?n.defaults:r.defaults;e.levels=[...i.levels]}}),e.version=140,e},_140to141:Do(141),_141to142:function(e){const t="CHDMOMOSC",i=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Ur(t);return i.length>0&&i.forEach(e=>{if(ie(e.inputs)){const t=s.defaults;e.inputs.push(...t.inputs.slice(1,3)),e.curves.push(...t.curves.slice(1,2))}}),e.version=142,e},_142to143:Do(143),_143to144:function(e){const t="MACDV",i=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Ur(t);return i.length>0&&i.forEach(e=>{if(te(e.inputs)){const t=s.defaults,i=e.levels[0];e.levels=[...t.levels],e.levels[2]=i}}),e.version=144,e},_144to145:function(e){const t="KELCHN",i="KELEXP",s="KELBND",n=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i,s]}),r=Ur(t),o=Ur(s);return n.length>0&&n.forEach(e=>{if(te(e.inputs))switch(e.study){case t:e.inputs.push(r.defaults.inputs[1]);break;case i:e.study=t,e.inputs.push(o.defaults.inputs[2]);for(let t=0;t<4;t++)e.curves[t].fields=r.defaults.curves[t].fields;break;case s:e.inputs.push(o.defaults.inputs[2])}}),e.version=145,e},_145to146:Do(146),_146to147:Do(147),_147to148:Do(148),_148to149:function(e){const t=ro(e,'..plots{.type === "Seasonal"}');return t.length>0&&t.forEach(e=>{_o(e)}),e.version=149,e},_149to150:Do(150),_150to151:function(e){const t="REATRHI",i="REATRLO",s=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i]});return s.length>0&&s.forEach(e=>{if(te(e.inputs)){switch(e.study){case t:e.inputs.unshift({name:"Direction",value:"Long"}),xo(e.inputs,"High");break;case i:e.inputs.unshift({name:"Direction",value:"Short"}),xo(e.inputs,"Low")}e.study="REATRS",e.curves[0].fields[0]="REATRS"}}),e.version=151,e},_151to152:function(e){const t=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:["DIFA"]});return t.length>0&&t.forEach(e=>{te(e.curves)&&e.curves.push(Io)}),e.version=152,e},_152to153:Do(153),_153to154:function(e){const t=["BPERC","BSQUEEZE","BWIDTH"],i=["BOLLP","BOLLBW","BOLLW"],s=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:t});return s.length>0&&s.forEach(e=>{const s=t.indexOf(e.study),n="BSQUEEZE"===e.study;n&&(e.study="BBANDW"),te(e.curves)&&(e.curves[0].fields[0]=i[s],n&&e.curves.push({colors:["#f08f4c"],fields:["BOLLBWA"]})),te(e.inputs)&&n&&e.inputs.push({name:"Average",value:"MA"},{name:"PeriodAvg",value:5})}),e.version=154,e},_154to155:Do(155),_155to156:Do(156),_156to157:Do(157),_157to158:Do(158),_158to159:Do(159),_159to160:Do(160),_160to161:function(e){const t=ro(e,'..plots{.type === "Study" && .study === "LINRCHN"}');return t.length>0&&t.forEach(e=>{te(e.inputs)&&e.inputs.push({name:"ExtendLines",value:"None"})}),e.version=161,e},_161to162:function(e){const t=e.display?.xAxis?.cycleTransition,i=e.display?.xAxis?.contractTransition,s=e=>{ie(e)&&!ie(e.fillColor)&&(e.fillColor="rgba(119,119,119,0.1)")};return s(t),s(i),e.version=162,e},_162to163:Do(163),_163to164:Do(164),_164to165:Do(165),_165to166:function(e){const t="ZIGZAG",i=ro(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Ur(t).defaults.inputs??[],n=s.find(e=>"ReversalChange"===e.name),r=s.findIndex(e=>"ReversalChange"===e.name);return i.length>0&&te(n)&&i.forEach(e=>{if(te(e.inputs)){if(!e.inputs.some(e=>"ReversalChange"===e.name)){const t=r>=0?Math.min(r,e.inputs.length):e.inputs.length;e.inputs.splice(t,0,{...n})}}}),e.version=166,e}};function wo(e,t){if(t===gs.CHART_SCHEMA){const i=ro(Rr(t),".properties.version.minimum")[0],s=e.version;if(s<i)return function(e,t,i){let s=e;try{for(Br(!1);t<i;)s=(0,Oo[`_${t}to${t+1}`])(s),t+=1}finally{Br(!0)}return s}(e,s,i)}return e}function Ro(e){return{unit:ce(e,"Day","unit"),size:ce(e,1,"size"),spec:ce(e,"None","spec"),isContractVolume:ce(e,!1,"isContractVolume"),dividendsAdjust:ce(e,!1,"dividendsAdjust"),backAdjust:ce(e,!1,"backAdjust"),daysToExpiration:ce(e,1,"daysToExpiration"),contractRoll:ce(e,"combined","contractRoll")}}function No(e){const t=Ro(e);return new Wo(a[t.unit],t.size,l[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function Vo(e,t){return ut(e,t)&&Bo(e,t)}function Ho(e,t){return Mi(e,t)&&Bo(e,t)}function Bo(e,t){return _i(e,t)&&Ii(e,t)}function Fo(e,t){return xi(e,t)&&Ii(e,t)}function ko(e,t){return+e===+t}class Wo{constructor(e=a.Day,t=1,i=l.None,s=!1,n=!1,r=!1,o=1,c="combined"){this.unit=e,this.size=t,this.spec=i,this.isContractVolume=s,this.dividendsAdjust=n,this.backAdjust=r,this.daysToExpiration=o,this.contractRoll=c}duplicate(){return new Wo(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===a.Tick){let e="T",t=!0;switch(this.spec){case l.PerCount:e="Tpb";break;case l.PerVolume:e="Vpb";break;case l.PerRange:e="Rpb";break;case l.PerSeconds:e="Spb";break;default:t=!1}return`${t?this.size:""}${e}`}if(this.unit===a.Intraday)return this.size%60==0?this.size/60+"h":`${this.size}`;{let e="";return this.spec===l.Nearest?e="n":this.spec===l.Continue&&(e="c"),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e="";switch(this.unit){case a.Tick:e="Tick";break;case a.Intraday:if(this.size%60==0){const t=this.size/60;e=`${t} hour${t>1?"s":""}`}else e=`${this.size<10?" ":""}${this.size} minute${this.size>1?"s":""}`;break;case a.Day:e="Daily";break;case a.Week:e="Weekly";break;case a.Month:e="Monthly";break;case a.Quarter:e="Quarterly";break;case a.Year:e="Yearly"}return e}describe(){let e=this.unitToString();switch(this.spec){case l.Nearest:e+=" Nearest";break;case l.Continue:e+=" Continue";break;case l.PerCount:e="Ticks Per Bar";break;case l.PerVolume:e="Volume Per Bar";break;case l.PerRange:e="Range Per Bar";break;case l.PerSeconds:e="Seconds Per Bar";case l.None:}return e}get hasSpec(){return this.spec!==l.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===a.Tick}get isIntraday(){return this.unit===a.Intraday}get isMultiContract(){const e=this.spec===l.Nearest,t=this.spec===l.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}}function Uo(e){delete e.display.chart.bar}function $o(e){ie(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,ie(e.data.range)&&delete e.data.range,delete e.data.checkRange}function Go(e){Da(e.display.period)&&delete e.display.period}function zo(e){ie(e.display.density)&&delete e.display.density}function Yo(e){switch(o[e]){case o.Candlestick:case o.HollowCandles:case o.HeikinAshi:case o.ElderImpulseSystem:case o.Column:case o.Renko:case o.Range:case o.Kagi:case o.PointAndFigure:case o.LineBreak:case o.HLC:return!0;default:return!1}}function jo(e,t){const i=Gv().getDefaultMultiFieldCurve();if(null!==i&&i.style===e)return i;const s=e=>e.id,n=[Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.Change].map(s);o[e]===o.HLC&&n.splice(0,1);const r=[Ka.Close].map(s),a=ue(gs.COLOR_DEFAULT_AREA),l=ue(gs.COLOR_DEFAULT_OHLC),c=ue(gs.COLOR_DEFAULT_VARY),u={fields:n,colors:c,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch(o[e]){case o.OHLC:case o.HLC:case o.Renko:case o.LineBreak:case o.Range:case o.Kagi:case o.PointAndFigure:u.colors=t?c:[l];break;case o.Candlestick:case o.HollowCandles:case o.HeikinAshi:case o.MultiColumn:break;case o.ElderImpulseSystem:u.colors=c.concat(a);break;case o.Line:case o.PercentChange:u.fields=r,u.colors=[l];break;case o.Area:u.fields=r,u.colors=[Tn(a,.5),a];break;case o.Baseline:u.fields=r,u.colors=c.map(e=>Tn(e,.5)),u.zones=[{value:0,colors:1},{colors:1}];break;case o.Column:u.fields=r;break;default:throw new Error(`Curve style "${e}" is not supported here.`)}return u}function Ko(e,t){var i;Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||Yo(e.style)||void 0!==(i=e.attributes)&&i.length>0&&i.some(e=>e===r[r.ChangeBased]||e===r[r.OpenVsClose]));const s=function(e,t){switch(e){case f.Symbol:case f.Expression:{const e=t.style||"Candlestick";return jo(e,t.varyColorPerBar||Yo(e))}case f.Forward:case f.Seasonal:return{fields:["Close"],style:"Line",lineWidth:2,visible:!0,colors:["#888"],varyColorPerBar:!1};default:throw new Error(`Unexpected plot type '${f[e]}', don't know its default curve.`)}}(f[t],e);return ye(s,e),s}const qo=["Renko","Kagi","PointAndFigure","LineBreak","Baseline"];function Xo(e,t){const i=t.curves[0],s=Sa(e),n=Ko(i,t.type);if(s.curves=[n],t.isMultiCurveMain&&t.curves.length>1&&s.curves.push(...t.curves.slice(1)),"Symbol"===t.type&&ie(i)&&qo.includes(i.style)){const e=s;ie(t.inputs)?e.inputs=t.inputs:delete e.inputs}return e}function Zo(e,t,i){return i=i||" ",e.length>t?e:(t-=e.length,e+(i+=i.repeat(t)).slice(0,t))}class Jo 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 n(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 r(e){switch(e.type){case"literal":return'"'+s(e.text)+'"';case"class":const t=e.parts.map(e=>Array.isArray(e)?n(e[0])+"-"+n(e[1]):n(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){const t=e.map(r);let i,s;if(t.sort(),t.length>0){for(i=1,s=1;i<t.length;i++)t[i-1]!==t[i]&&(t[s]=t[i],s++);t.length=s}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+(((o=t)?'"'+s(o)+'"':"end of input")+" found.");var o}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,Jo.prototype):this.__proto__=Jo.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Jo)}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 n=this.location.start,r=this.location.source+":"+n.line+":"+n.column;if(s){let e=this.location.end,i=Zo("",n.line.toString().length," "),o=s[n.line-1],a=n.line===e.line?e.column:o.length+1;t+="\n --\x3e "+r+"\n"+i+" |\n"+n.line+" | "+o+"\n"+i+" | "+Zo("",n.column-1," ")+Zo("",a-n.column,"^")}else t+="\n at "+r}return t}}const Qo=function(e,t){const i={},s=(t=void 0!==t?t:{}).grammarSource,n={expr:Ae};let r=Ae;const o=function(e,t,i){return function(e,t){t.length>0&&(e.leadingComments=t);return e}(_e(t,i),e)},a="//",l=de("//",!1),c=/^[^\r\n]/,u=pe(["\r","\n"],!0,!1),h=/^[\r\n]/,d=pe(["\r","\n"],!1,!1),p=function(e){return e.trim()},f=function(e){return e.filter(e=>e.length>0)},m=function(e,t,i){return{op:t.op,opLoc:t.loc,right:i}},g=function(e,t,i){return _e(t.reduce((e,t)=>xe({op:t.op,left:e,right:t.right},t.opLoc),e),i)},y="+",A=de("+",!1),S="-",T=de("-",!1),v=function(e){return{op:e,loc:he()}},P="*",C=de("*",!1),b="/",E=de("/",!1),L=function(e,t){return xe(_e({op:"-",left:e},t),he())},M=function(e,t,i,s){return xe(_e({op:"^",left:e,right:i},s),t.loc)},_="^",x=de("^",!1),I="(",D=de("(",!1),O=")",w=de(")",!1),R=function(e,t){return xe(_e({op:"grp",left:e},t),he())},N=/^[0-9]/,V=pe([["0","9"]],!1,!1),H=".",B=de(".",!1),F=function(e,t){return xe(_e({op:"num",left:parseFloat(e)},t),he())},k="{",W=de("{",!1),U=/^[A-Za-z0-9\^*$\-.|:_]/,$=pe([["A","Z"],["a","z"],["0","9"],"^","*","$","-",".","|",":","_"],!1,!1),G="}",z=de("}",!1),Y=/^[A-Za-z]/,j=pe([["A","Z"],["a","z"]],!1,!1),K=function(e,t){return t},q=function(e,t,i){return xe(_e({op:"sym",left:e,right:t},i),he())},X=fe("trailing comment"),Z=/^[ \t]/,J=pe([" ","\t"],!1,!1),Q="",ee=function(){return null},te=fe("whitespace"),ie=/^[ \t\r\n]/,se=pe([" ","\t","\r","\n"],!1,!1);let ne=0,re=0;const oe=[{line:1,column:1}];let ae,le=0,ce=[],ue=0;if(void 0!==t.startRule){if(!(t.startRule in n))throw new Error("Can't start parsing from rule \""+t.startRule+'".');r=n[t.startRule]}function he(){return ge(re,ne)}function de(e,t){return{type:"literal",text:e,ignoreCase:t}}function pe(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function fe(e){return{type:"other",description:e}}function me(t){let i,s=oe[t];if(s)return s;for(i=t-1;!oe[i];)i--;for(s=oe[i],s={line:s.line,column:s.column};i<t;)10===e.charCodeAt(i)?(s.line++,s.column=1):s.column++,i++;return oe[t]=s,s}function ge(e,t){const i=me(e),n=me(t);return{source:s,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:n.line,column:n.column}}}function ye(e){ne<le||(ne>le&&(le=ne,ce=[]),ce.push(e))}function Ae(){let t,s,n,r,m;return t=ne,s=function(){let t,s,n,r,o,m,g,y;if(t=ne,s=[],n=ne,r=Me(),r!==i)if(e.substr(ne,2)===a?(o=a,ne+=2):(o=i,0===ue&&ye(l)),o!==i){for(m=ne,g=[],c.test(e.charAt(ne))?(y=e.charAt(ne),ne++):(y=i,0===ue&&ye(u));y!==i;)g.push(y),c.test(e.charAt(ne))?(y=e.charAt(ne),ne++):(y=i,0===ue&&ye(u));m=g!==i?e.substring(m,ne):g,m!==i?(h.test(e.charAt(ne))?(g=e.charAt(ne),ne++):(g=i,0===ue&&ye(d)),g!==i?(re=n,r=p(m),n=r):(ne=n,n=i)):(ne=n,n=i)}else ne=n,n=i;else ne=n,n=i;for(;n!==i;)if(s.push(n),n=ne,r=Me(),r!==i)if(e.substr(ne,2)===a?(o=a,ne+=2):(o=i,0===ue&&ye(l)),o!==i){for(m=ne,g=[],c.test(e.charAt(ne))?(y=e.charAt(ne),ne++):(y=i,0===ue&&ye(u));y!==i;)g.push(y),c.test(e.charAt(ne))?(y=e.charAt(ne),ne++):(y=i,0===ue&&ye(u));m=g!==i?e.substring(m,ne):g,m!==i?(h.test(e.charAt(ne))?(g=e.charAt(ne),ne++):(g=i,0===ue&&ye(d)),g!==i?(re=n,r=p(m),n=r):(ne=n,n=i)):(ne=n,n=i)}else ne=n,n=i;else ne=n,n=i;s!==i&&(re=t,s=f(s));return t=s,t}(),s!==i?(n=Se(),n!==i?(r=Le(),r!==i?(m=Me(),m!==i?(re=t,s=o(s,n,r),t=s):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i),t}function Se(){let e,t,s,n,r,o,a,l;if(e=ne,t=ve(),t!==i){for(s=[],n=ne,r=Me(),r!==i?(o=Te(),o!==i?(a=Me(),a!==i?(l=ve(),l!==i?(re=n,r=m(t,o,l),n=r):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i);n!==i;)s.push(n),n=ne,r=Me(),r!==i?(o=Te(),o!==i?(a=Me(),a!==i?(l=ve(),l!==i?(re=n,r=m(t,o,l),n=r):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i);s!==i?(n=Le(),n!==i?(re=e,t=g(t,s,n),e=t):(ne=e,e=i)):(ne=e,e=i)}else ne=e,e=i;return e}function Te(){let t,s;return t=ne,43===e.charCodeAt(ne)?(s=y,ne++):(s=i,0===ue&&ye(A)),s===i&&(45===e.charCodeAt(ne)?(s=S,ne++):(s=i,0===ue&&ye(T))),s!==i&&(re=t,s=v(s)),t=s,t}function ve(){let e,t,s,n,r,o,a,l;if(e=ne,t=Ce(),t!==i){for(s=[],n=ne,r=Me(),r!==i?(o=Pe(),o!==i?(a=Me(),a!==i?(l=Ce(),l!==i?(re=n,r=m(t,o,l),n=r):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i);n!==i;)s.push(n),n=ne,r=Me(),r!==i?(o=Pe(),o!==i?(a=Me(),a!==i?(l=Ce(),l!==i?(re=n,r=m(t,o,l),n=r):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i)):(ne=n,n=i);s!==i?(n=Le(),n!==i?(re=e,t=g(t,s,n),e=t):(ne=e,e=i)):(ne=e,e=i)}else ne=e,e=i;return e}function Pe(){let t,s;return t=ne,42===e.charCodeAt(ne)?(s=P,ne++):(s=i,0===ue&&ye(C)),s===i&&(47===e.charCodeAt(ne)?(s=b,ne++):(s=i,0===ue&&ye(E))),s!==i&&(re=t,s=v(s)),t=s,t}function Ce(){let t,s,n,r,o,a;return t=ne,s=Me(),s!==i?(45===e.charCodeAt(ne)?(n=S,ne++):(n=i,0===ue&&ye(T)),n!==i?(r=Me(),r!==i?(o=be(),o!==i?(a=Le(),a!==i?(re=t,s=L(o,a),t=s):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i),t===i&&(t=be()),t}function be(){let t,s,n,r,o,a,l;return t=ne,s=Ee(),s!==i?(n=Me(),n!==i?(r=function(){let t,s;t=ne,94===e.charCodeAt(ne)?(s=_,ne++):(s=i,0===ue&&ye(x));s!==i&&(re=t,s=v(s));return t=s,t}(),r!==i?(o=Me(),o!==i?(a=Ee(),a!==i?(l=Le(),l!==i?(re=t,s=M(s,r,a,l),t=s):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i),t===i&&(t=Ee()),t}function Ee(){let t,s,n,r,o,a,l,c;return t=function(){let t,s,n,r,o,a,l,c,u;if(t=ne,s=Me(),s!==i){if(n=ne,r=ne,o=[],N.test(e.charAt(ne))?(a=e.charAt(ne),ne++):(a=i,0===ue&&ye(V)),a!==i)for(;a!==i;)o.push(a),N.test(e.charAt(ne))?(a=e.charAt(ne),ne++):(a=i,0===ue&&ye(V));else o=i;if(o!==i){if(a=ne,46===e.charCodeAt(ne)?(l=H,ne++):(l=i,0===ue&&ye(B)),l!==i){for(c=[],N.test(e.charAt(ne))?(u=e.charAt(ne),ne++):(u=i,0===ue&&ye(V));u!==i;)c.push(u),N.test(e.charAt(ne))?(u=e.charAt(ne),ne++):(u=i,0===ue&&ye(V));c!==i?(l=[l,c],a=l):(ne=a,a=i)}else ne=a,a=i;a===i&&(a=null),a!==i?(o=[o,a],r=o):(ne=r,r=i)}else ne=r,r=i;n=r!==i?e.substring(n,ne):r,n!==i?(r=Le(),r!==i?(re=t,s=F(n,r),t=s):(ne=t,t=i)):(ne=t,t=i)}else ne=t,t=i;return t}(),t===i&&(t=function(){let t,s,n,r,o,a,l,c,u,h;if(t=ne,s=Me(),s!==i)if(123===e.charCodeAt(ne)?(n=k,ne++):(n=i,0===ue&&ye(W)),n!==i){if(r=ne,o=[],U.test(e.charAt(ne))?(a=e.charAt(ne),ne++):(a=i,0===ue&&ye($)),a!==i)for(;a!==i;)o.push(a),U.test(e.charAt(ne))?(a=e.charAt(ne),ne++):(a=i,0===ue&&ye($));else o=i;if(r=o!==i?e.substring(r,ne):o,r!==i)if(125===e.charCodeAt(ne)?(o=G,ne++):(o=i,0===ue&&ye(z)),o!==i){if(a=ne,46===e.charCodeAt(ne)?(l=H,ne++):(l=i,0===ue&&ye(B)),l!==i){if(c=ne,u=[],Y.test(e.charAt(ne))?(h=e.charAt(ne),ne++):(h=i,0===ue&&ye(j)),h!==i)for(;h!==i;)u.push(h),Y.test(e.charAt(ne))?(h=e.charAt(ne),ne++):(h=i,0===ue&&ye(j));else u=i;c=u!==i?e.substring(c,ne):u,c!==i?(re=a,l=K(r,c),a=l):(ne=a,a=i)}else ne=a,a=i;a===i&&(a=null),a!==i?(l=Le(),l!==i?(re=t,s=q(r,a,l),t=s):(ne=t,t=i)):(ne=t,t=i)}else ne=t,t=i;else ne=t,t=i}else ne=t,t=i;else ne=t,t=i;return t}(),t===i&&(t=ne,s=Me(),s!==i?(40===e.charCodeAt(ne)?(n=I,ne++):(n=i,0===ue&&ye(D)),n!==i?(r=Me(),r!==i?(o=Se(),o!==i?(a=Me(),a!==i?(41===e.charCodeAt(ne)?(l=O,ne++):(l=i,0===ue&&ye(w)),l!==i?(c=Le(),c!==i?(re=t,s=R(o,c),t=s):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i)):(ne=t,t=i))),t}function Le(){let t,s,n,r,o,h;for(ue++,t=ne,s=[],Z.test(e.charAt(ne))?(n=e.charAt(ne),ne++):(n=i,0===ue&&ye(J));n!==i;)s.push(n),Z.test(e.charAt(ne))?(n=e.charAt(ne),ne++):(n=i,0===ue&&ye(J));if(s!==i)if(e.substr(ne,2)===a?(n=a,ne+=2):(n=i,0===ue&&ye(l)),n!==i){for(r=ne,o=[],c.test(e.charAt(ne))?(h=e.charAt(ne),ne++):(h=i,0===ue&&ye(u));h!==i;)o.push(h),c.test(e.charAt(ne))?(h=e.charAt(ne),ne++):(h=i,0===ue&&ye(u));r=o!==i?e.substring(r,ne):o,r!==i?(re=t,s=p(r),t=s):(ne=t,t=i)}else ne=t,t=i;else ne=t,t=i;return t===i&&(t=ne,s=Q,s!==i&&(re=t,s=ee()),t=s),ue--,t===i&&(s=i,0===ue&&ye(X)),t}function Me(){let t,s;for(ue++,t=[],ie.test(e.charAt(ne))?(s=e.charAt(ne),ne++):(s=i,0===ue&&ye(se));s!==i;)t.push(s),ie.test(e.charAt(ne))?(s=e.charAt(ne),ne++):(s=i,0===ue&&ye(se));return ue--,t===i&&(s=i,0===ue&&ye(te)),t}function _e(e,t){return null!==t&&(e.trailingComment=t),e}function xe(e,t){return e.loc={start:{offset:t.start.offset,line:t.start.line,column:t.start.column},end:{offset:t.end.offset,line:t.end.line,column:t.end.column}},e}if(ae=r(),ae!==i&&ne===e.length)return ae;throw ae!==i&&ne<e.length&&ye({type:"end"}),Ie=ce,De=le<e.length?e.charAt(le):null,Oe=le<e.length?ge(le,le+1):ge(le,le),new Jo(Jo.buildMessage(Ie,De),Ie,De,Oe);var Ie,De,Oe},ea=JSON.stringify([["0","9"]]),ta=JSON.stringify([["A","Z"],["a","z"]]),ia=JSON.stringify([["A","Z"],["a","z"],["0","9"],"^","*","$","-",".","|",":","_"]);function sa(e){if(null===e)return"end of expression";switch(e){case" ":return"a space";case"\t":return"a tab";case"\n":return"a newline";case"\r":return"a carriage return";default:return`"${e}"`}}function na(e){const t={expectsValue:!1,expectsOperator:!1,expectsCloseParen:!1,expectsCloseBrace:!1,expectsFieldName:!1,expectsEnd:!1};for(const i of e)switch(i.type){case"literal":switch(i.text){case"(":case"{":case"-":case"//":t.expectsValue=!0;break;case"+":case"*":case"/":case"^":t.expectsOperator=!0;break;case")":t.expectsCloseParen=!0;break;case"}":t.expectsCloseBrace=!0}break;case"class":{if(i.inverted)break;const e=JSON.stringify(i.parts);e===ea?t.expectsValue=!0:e===ta?t.expectsFieldName=!0:e===ia&&(t.expectsCloseBrace=!0);break}case"end":t.expectsEnd=!0}return t}function ra(e,t){if(!(e instanceof Jo))return;if(!e.location)return;const i=Array.isArray(e.expected)?e.expected:[],s=e.found??null,n=na(i);if(null!==s||!n.expectsCloseParen)return e.location;const r=function(e){const t=Math.max(e.lastIndexOf("\n"),e.lastIndexOf("\r"))+1,i=e.indexOf("//",t);return i>=0?i:void 0}(t);if(void 0===r)return e.location;const o=Math.max(t.lastIndexOf("\n"),t.lastIndexOf("\r"))+1;let a=r-1;for(;a>=o&&/\s/.test(t[a]);)a--;if(a<o)return e.location;const l=a+1,c=function(e,t){let i=1,s=1;for(let n=0;n<t&&n<e.length;n++){const t=e[n];"\n"===t?(i++,s=1):"\r"===t?"\n"!==e[n+1]&&(i++,s=1):s++}return{line:i,column:s}}(t,l);return{...e.location,start:{...e.location.start,offset:l,line:c.line,column:c.column},end:{...e.location.end,offset:l,line:c.line,column:c.column}}}const oa=/* @__PURE__ */new Map,aa=/\w:\w/;function la(e){return"error"in e}function ca(e,t=!1,i=!0){const s=e.trim();if(t&&oa.has(s))return ue(oa.get(s));try{const n=Qo(s);ma(n,e=>e.toUpperCase(),!0,!0);let r=pa(n);i&&function(e,t){if(e.some(e=>e.includes(":")))return ha(t,(e,t,i)=>{const s=(e,t=null,i="sym")=>({op:i,left:e,right:t}),n=e;if("sym"!==n.op||!aa.test(t))return null;const r=t.split(":");return n.op="grp",n.left=s(s(r[0]),s(r[1]),"-"),null}),!0;return!1}(r,n)&&(r=pa(n));const o=da(n,!1),a={text:e,model:n,clean:o,verbose:da(n,!0),symbols:r};return t&&oa.set(s,a),a}catch(n){const t=function(e,t){if(!(e instanceof Jo))return e instanceof Error?e.message:"Invalid expression.";const i=Array.isArray(e.expected)?e.expected:[],s=e.found??null,n=na(i),r=e.location?.start?.offset??0,o=r>0?t[r-1]:"";return null===s?function(e){const t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0&&t.every(e=>e.startsWith("//"))}(t)?"Expression contains only comments. Add a value (for example {AAPL} or 1).":n.expectsFieldName&&"."===o?"Missing field name after '.'.":n.expectsCloseBrace?"Missing closing brace '}' in symbol.":n.expectsCloseParen?"Missing closing parenthesis ')'.":n.expectsValue?"Expression ended unexpectedly; expected a value.":"Expression ended unexpectedly.":n.expectsFieldName&&"."===o?`Expected a field name (letters only) after '.', but found ${sa(s)}.`:n.expectsCloseBrace&&"{"===o&&"}"===s?"Symbol name cannot be empty inside '{}'.":n.expectsOperator&&n.expectsEnd?`Expected an operator (+, -, *, /, or ^) or end of expression, but found ${sa(s)}.`:n.expectsOperator&&n.expectsCloseParen?`Expected an operator or closing parenthesis ')' but found ${sa(s)}.`:n.expectsValue?`Expected a value (number, symbol, or parenthesized expression), but found ${sa(s)}.`:n.expectsCloseParen?`Expected a closing parenthesis ')', but found ${sa(s)}.`:n.expectsCloseBrace?`Expected a closing brace '}', but found ${sa(s)}.`:`Invalid expression near ${sa(s)}.`}(n,s);return{text:e,error:t,loc:ra(n,s)??n?.location}}}function ua(e,t){const i=function(e){const t=(t,i,s)=>{const n=t;if(ga(n)){if(null===i)return null;switch(n.op){case"-":return-i;case"grp":case"num":return i;case"sym":return e(i);default:throw new Error(`Unrecognized unary operator ${n.op}`)}}else{if(null===i||null===s)return null;const t=i,r=s;switch(n.op){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"^":return Math.pow(t,r);case"sym":return e(i,s);default:throw new Error(`Unrecognized binary operator ${n.op}`)}}};return t}(t);return ha(e,i)}function ha(e,t,i){if(!ie(e))return null;const s=typeof e;if("number"===s||"string"===s)return e;const n=e;return t(n,ha(n.left,t,i),ha(n.right,t,i),i)}function da(e,t=!1){const i={preserveComments:t};if(t){const t=e.leadingComments;return((t?t.map(e=>`// ${e}\n`).join(""):"")+ha(e,ya,i)).trimEnd()}return ha(e,ya,i)}function pa(e){const t=/* @__PURE__ */new Set;return ha(e,(e,i,s)=>("sym"===e.op&&t.add(i),null)),Array.from(t)}function fa(e){let t=0;const i=["+","-","*","/","^"];return ha(e,(e,s,n)=>(i.includes(e.op)&&t++,null)),t>0}function ma(e,t,i=!1,s=!1){const n=i?e:ue(e);return ha(n,(e,i,n)=>{const r=e;return"sym"===r.op&&(r.left=t(i),s&&r.right&&(r.right=t(r.right))),null}),n}function ga(e){return!ie(e.right)}function ya(e,t,i,s){const n=e,r=s?.preserveComments??!1;let o;if(ga(n))switch(n.op){case"-":o=`${n.op}${t}`;break;case"grp":o=`(${t})`;break;case"sym":o=`{${t}}`;break;case"num":o=t.toString();break;default:throw new Error(`Unrecognized unary operator ${n.op}`)}else{const e=String(t),s=String(i);switch(n.op){case"+":case"-":case"*":case"/":case"^":o=r&&e.endsWith("\n")?`${e}${n.op} ${s}`:`${e} ${n.op} ${s}`;break;case"sym":o=`{${t}}.${i}`;break;default:throw new Error(`Unrecognized binary operator ${n.op}`)}}return r&&void 0!==n.trailingComment?`${o} // ${n.trailingComment}\n`:o}const Aa="..plots{.main === true}";function Sa(e){return ro(e,Aa)[0]}function Ta(e){const t=ro(e,`..panes{${Aa}}`)[0];return{mainPane:t,mainAxis:ro(t,`..axes{${Aa}}`)[0]}}const va="Symbol",Pa="Expression",Ca="Forward",ba="Seasonal",Ea=[va,Pa,Ca,ba];function La(e){const t=ca(e),i=la(t),s=i?0:t.symbols.length,n=!i&&s>0?t.symbols[0]:null;return{clean:i?void 0:t.clean,hasErrors:i,symbolCount:s,firstSymbol:n,error:i?t.error:void 0}}function Ma(e,t){const i=Sa(e),s=e=>i.type===e,n=e=>ie(t[e.toLowerCase()]),r=Ea.find(e=>n(e)),o=r.toLowerCase();let a=t[o];const l=a===gs.PLACEHOLDER_SYMBOL_NAME,c=n(Pa)||n(Ca)||n(ba),u=Ea.some(e=>n(e)&&!s(e)),h=Gv().config.cachedAnnotationsCount||0,d=h>0,{mainAxis:p}=Ta(e);u&&(p.comparison="None");const f=La(a),m=e=>{throw new Error(e)};l||(c?(f.hasErrors&&m(`[Main Plot] "${a}" is an invalid expression.\n${f.error}`),a=f.clean):f.hasErrors||m(`[Main Plot] "${a}" is an expression, unsupported for ${o}.`));const g=(e,t)=>e.findIndex(e=>e.symbol===t),y=(e,t)=>{if(e===gs.PLACEHOLDER_SYMBOL_NAME)return;const i=t.annotations||[],s=t.annCache||[],n=g(s,e);if(-1!==n&&s.splice(n,1),i.length>0){const t={symbol:e,annotations:i};s.length+1>h&&s.splice(0,s.length+1-h),s.push(t)}t.annCache=s},A=(e,t)=>{const i=t.annCache||[],s=g(i,e);-1!==s&&(t.annotations=i[s].annotations)},S=e=>{const r=i;if(s(va))y(r.symbol,e);else if(s(Pa))y(r.expression,e);else if(s(ba)){const t=La(r.seasonal);1===t.symbolCount&&y(t.firstSymbol,e)}delete e.annotations,n(va)?A(t.symbol,e):n(Pa)?A(t.expression,e):n(ba)&&1===f.symbolCount&&A(t.seasonal,e)};if(d){const t=ro(e,"..axes");for(const e of t)S(e)}const T=n(Pa)&&s(va)||n(va)&&s(Pa);let v=oo(e,Aa,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=[{}]),(n(Ca)||n(ba))&&(e.offsets=[0])),e[o]=a,e));if(u)if(n(Ca))v.data.aggregation={unit:"Month"},v.display.period="P10Y";else if(n(ba)&&!v.data.aggregation.isEndOfDay)v.data.aggregation={unit:"Day"},v.display.period=n(ba)?"P9M":"P1Y10D";else if(s(Ca)||s(ba)){v.data.aggregation=Gv().getDefaultAggregation(),v.data.maxDataPoints=gs.DEFAULT_MAX_RECORDS;const e=Gv().getDefaultPeriod();ie(e)&&(v.display.period=e)}else n(Pa)&&s(va)&&(qo.includes(i.curves[0].style)&&(v=oo(v,Aa,e=>(delete e.inputs,e))),"PerRange"===v.data.aggregation.spec&&(v.data.aggregation={unit:"Day"}));const P=/* @__PURE__ */new Map([['..plots{.type === "Study"}',e=>{const t=Ur(e.study);if(!te(t))return gs.NULL_OBJECT;const i=Yr(t);return n(Ca)||n(ba)||n(Pa)&&i?gs.NULL_OBJECT:e}],['..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}',e=>n(va)?(e.symbol=a,e):gs.NULL_OBJECT],["..plots{..events}",e=>(n(va)||delete e.events,e)]]);for(const[C,b]of P)v=oo(v,C,b);return u&&!T&&(v=Xo(v,{type:r,curves:[{}]})),v=Ua(v),v}function _a(e){const t=Gv().getDefaultDensity();ie(t)&&(e.display.density=t)}function xa(e,t){return oo(e,'..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}',e=>(e.fields=t?[Ka.TradeSize.id]:[Ka.Volume.id],e))}function Ia(e,t){const i=No(e.data.aggregation),s=i.isTick&&!i.hasSpec,n=No(t),r=n.isTick&&!n.hasSpec,o=e=>e.isIntraday&&e.hasSpec&&e.spec===l.PerRange,a=o(i),c=o(n);let u=oo(e,`${Aa}.curves[0]`,e=>{const t=[Ka.Open.id,Ka.High.id,Ka.Low.id,Ka.Close.id,Ka.Change.id].slice();if(!a&&c)return jo("Range",!0);if(a&&!c&&(e.style="OHLC"),!r&&s){const i=Gv().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 r&&!s&&(e.fields=[Ka.Last.id,Ka.Change.id],e.style="Line",e.colors=["#0055cc"],e.varyColorPerBar=!1);return e});return u=xa(u,r),ye(u.data.aggregation,t),i.unit===n.unit&&i.size===n.size||(Go(u),$o(u),_a(u),Uo(u)),u}function Da(e){return ie(e)&&e!==gs.AUTOFIT_PERIOD}function Oa(e){const t=ro(e,"..axes{.annotations{.points{!.price || !.time}}}");t.length>0&&t.forEach(e=>{const t=e.annotations.map(e=>{const t=e.points.find(e=>ie(e.price)),i=e.points.find(e=>ie(e.time));return ie(t)&&ie(i)?(e.points.forEach(e=>{ie(e.price)||(e.price=t.price),ie(e.time)||(e.time=i.time)}),e):null}).filter(e=>ie(e));t.length>0?e.annotations=t:delete e.annotations});const i=ro(e,"..panes"),s=e=>ie(e.height)?e.height:1,n=i.map(e=>s(e)),r=Math.min(...n),a=r<.01?5/r:1;i.forEach(e=>e.height=se(a*s(e),4));const c=Gv().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=c;const u="wheel+shift";let h=Gv().config.scrollBehavior||u;Object.values(C).filter(e=>"string"==typeof e).includes(h)||(h=u),e.display.scrollBehavior=h;const d=ro(e,'..plots{.type === "Study" && .study === "RSI"}');var p;return d.length>0&&d.forEach(e=>{if(ie(e.bands)&&e.bands.length>0){const t=e.inputs&&1===e.inputs.length&&e.inputs[0].name===gs.INPUT_PERIOD?e.inputs[0].value:null,i=Ur("RSI").defaults;e.curves=i.curves,e.inputs=i.inputs,ie(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=i.levels}}),p=e,p.display?.density?(Go(p),$o(p)):Da(p.display?.period)&&$o(p),function(e){const t=ce(e.display,null,"chart","bar");if(ie(t)){const[e,i]=ve(t.width||0,t.spacing||0,gs.MINIMUM_BAR_WIDTH,gs.MAXIMUM_BAR_WIDTH);t.width=e,t.spacing=i}}(e),function(e){e.display?.period&&"YTD"===e.display.period&&delete e.display.period}(e),function(e){const t=ro(e,"..annotations{.traits.fill.color === null}");t.length>0&&t.forEach(e=>{e.traits.fill.color="rgba(0, 0, 0, 0)"})}(e),function(e){const{from:t,to:i}=e.display?.xAxis?.visibleRange||{},s=null===t,n=null===i;s&&delete e.display.xAxis.visibleRange.from,n&&delete e.display.xAxis.visibleRange.to,s&&n&&delete e.display.xAxis.visibleRange}(e),function(e){const t=ro(e,"..panes[0].axes[0].scale");if(1===t.length){const i=t[0],s=ro(e,"..panes[0]..axes");s.length>0&&s.forEach(e=>e.scale=i)}}(e),function(e){const[t]=ro(e,Aa);ie(t)&&t.type===f[f.Symbol]&&!qo.includes(t.curves[0].style)&&ie(t.inputs)&&delete t.inputs}(e),function(e){const[t]=ro(e,Aa);ie(t)&&t.type===f[f.Symbol]&&t.curves[0].style===o[o.Renko]&&ie(t.inputs)&&t.inputs.map(e=>e.value).some(e=>void 0===e)&&(t.inputs=ue(gs.DEFAULT_RENKO_INPUTS))}(e),function(e){const[t]=ro(e,Aa);if(ie(t)&&t.type===f[f.Expression]){const i=t.curves[0].style,s=i===o[o.Range],n=i===o[o.Baseline],r=qo.includes(i);s&&e.data?.aggregation.spec===l[l.PerRange]&&(e.data.aggregation={unit:"Day"}),n||!r&&!s||(delete t.inputs,t.curves[0]=jo("Candlestick",!0))}}(e),function(e){ro(e,"..annotations").forEach(e=>{const{id:t,traits:i}=e;bo(t,i),Co(t,i)})}(e),function(e){try{Br(!1),ro(e,'..plots{.type === "Study" && .curves.zones}').forEach(e=>{const t=Ur(e.study).defaults;for(let i=0;i<(e.curves?.length??0);i++){const s=e.curves[i];if(s.zones&&(s.colors?.length??0)<(t.curves[i].colors?.length??0)){const e=t.curves[i].colors.slice(s.colors?.length??0);s.colors?.length?s.colors.push(...e):s.colors=e}}})}finally{Br(!0)}}(e),function(e){const[t]=ro(e,Aa);if("Symbol"===t.type&&1===t.curves?.length){const e=t.curves[0];if("HLC"===e.style){const t=e.colors?.length;if(1===t){const t=e.colors[0];e.colors=[t,t],e.varyColorPerBar=!0,e.attributes=["OpenVsClose"]}else 2!==t||e.attributes||(e.attributes=["OpenVsClose"])}}}(e),function(e){const t=ro(e,"..annotations{.id === 'RewardRisk' || .id === 'ProfitLoss' }");t.length>0&&t.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))})}(e),function(e){"cmdtyView"===Gv()?.config?.mode&&(delete e.data?.extendedHours,delete e.data?.buildContinuation)}(e),function(e){const t=e.data?.aggregation,i=e.data?.extendedHours,s=te(i);t&&"FormT"===t.spec&&(t.spec="None",s||(e.data.extendedHours=!0))}(e),function(e){const t=e.data?.buildContinuation,i=te(t),s=e.data?.aggregation;i&&s&&("Continue"!==s.spec||t||(s.spec="None"),t&&(s.spec="Continue"))}(e),function(e){try{Br(!1),ro(e,'..plots{.type === "Study" && .curves.varyColorPerBar}').forEach(e=>{const t=Ur(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{Br(!0)}}(e),function(e){try{Br(!1),ro(e,'..plots{.type === "Study"}').forEach(e=>{const t=Ur(e.study).defaults;te(e.inputs)&&e.inputs.forEach((e,i)=>{const s=t.inputs?.[i]?.value;!te(e.value)&&te(s)&&(e.value=s)}),te(e.levels)&&e.levels.forEach((e,i)=>{const s=t.levels?.[i]?.value;!te(e.value)&&te(s)&&(e.value=s)}),te(e.bands)&&e.bands.forEach((e,i)=>{const s=t.bands?.[i]?.range;!te(e.range.from)&&te(s?.from)&&(e.range.from=s.from),!te(e.range.to)&&te(s?.to)&&(e.range.to=s.to)})})}finally{Br(!0)}}(e),function(e){let t=oo(e,"..annCache{!.annotations}",e=>gs.NULL_OBJECT);t=oo(t,"..annCache",e=>{const t=Ji(e.symbol);return null===t?e:bi(t,Oi(/* @__PURE__ */new Date,3))?gs.NULL_OBJECT:e}),t=oo(t,"..annotations{.id === 'ComputedText' && !.traits.textLines}",e=>gs.NULL_OBJECT);const i=t.data.aggregation;return xa(t,"Tick"===i.unit&&"None"===i.spec)}(e)}var wa,Ra,Na,Va,Ha={exports:{}},Ba=Ha.exports;const Fa=/* @__PURE__ */He(Na?Ra:(Na=1,wa||(wa=1,Va=Ha,function(){var e=function(t){if(null===t||"object"!=typeof t)return t;var i;if(t instanceof Date)return(i=/* @__PURE__ */new Date).setTime(t.getTime()),i;if(t instanceof RegExp)return new RegExp(t);if(t instanceof Array){i=[];for(var s=0,n=t.length;s<n;s++)i[s]=e(t[s]);return i}if(t instanceof Object){for(var r in i={},t)t.hasOwnProperty(r)&&(i[r]=e(t[r]));return i}throw new Error("Unable to clone object!")},t=function(t){for(var i=[e(t[0])],s=i[0].key,n=i[0].object,r=1,o=t.length;r<o;r++)n=n[s],s=t[r].key,i.push({object:n,key:s});return i},i=function(e,t){var i=e.length-1,s=e[i].key;t[i].object[s]=e[i].object[s]},s={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}},r={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)},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){return"string"!=typeof e||("string"==typeof t?i=t:(i=t[0],s=t[1]),new RegExp(i,s).test(e));var i,s},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={},n=0,r=e.length;n<r;n++){if(i=JSON.stringify(e[n]),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,n;if("object"==typeof e){for(n=JSON.stringify(e),i=0,s=t.length;i<s;i++)if(n===JSON.stringify(t[i]))return!0}else for(i=0,s=t.length;i<s;i++)if(e===t[i])return!0;return!1}},a=function(e){return-1===e.indexOf("://")?e:e.split("#")[0]},l=function(e,t,i){var s,n,r,o;if(-1===(r=i.indexOf("#")))return e.schema.hasOwnProperty(i)?[e.schema[i]]:null;if(r>0)if(o=i.substr(0,r),i=i.substr(r+1),e.schema.hasOwnProperty(o))t=[e.schema[o]];else{if(!t||t[0].id!==o)return null;t=[t[0]]}else{if(!t)return null;i=i.substr(1)}if(""===i)return[t[0]];if("/"===i.charAt(0)){for(i=i.substr(1),s=t[0],n=i.split("/");n.length>0;){if(!s.hasOwnProperty(n[0]))return null;s=s[n[0]],t.push(s),n.shift()}return t}return null},c=function(e,t){var i,s,n,r,o=e.length-1,a=/^(\d+)/.exec(t);if(a){if(t=t.substr(a[0].length),(n=parseInt(a[1],10))<0||n>o)return;if(r=e[o-n],"#"===t)return r.key}else r=e[0];if(s=r.object[r.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}},u=function(e,n,r,o){var a,h,d,p,f,m,g,y,A,S,T,v,P,C=!1,b={},E=n[n.length-1],L=r.length-1,M=r[L].object,_=r[L].key,x=M[_];if(E.hasOwnProperty("$ref"))return(n=l(e,n,E.$ref))?u(e,n,r,o):{$ref:E.$ref};if(E.hasOwnProperty("type"))if("string"==typeof E.type){if(o.useCoerce&&e.coerceType.hasOwnProperty(E.type)&&(x=M[_]=e.coerceType[E.type](x)),!e.fieldType[E.type](x))return{type:E.type}}else{for(C=!0,a=0,h=E.type.length;a<h&&C;a++)e.fieldType[E.type[a]](x)&&(C=!1);if(C)return{type:E.type}}if(E.hasOwnProperty("allOf"))for(a=0,h=E.allOf.length;a<h;a++)if(y=u(e,n.concat(E.allOf[a]),r,o))return y;if(o.useCoerce||o.useDefault||o.removeAdditional){if(E.hasOwnProperty("oneOf")){for(P=1/0,a=0,h=E.oneOf.length,d=0;a<h;a++)if(T=t(r),y=u(e,n.concat(E.oneOf[a]),T,o))(v=y.schema?Object.keys(y.schema).length:1)<P&&(P=v,b=y);else{if((d+=1)>1)break;i(T,r)}if(d>1)return{oneOf:!0};if(d<1)return b;b={}}if(E.hasOwnProperty("anyOf")){for(b=null,P=1/0,a=0,h=E.anyOf.length;a<h;a++){if(T=t(r),!(y=u(e,n.concat(E.anyOf[a]),T,o))){i(T,r),b=null;break}(v=y.schema?Object.keys(y.schema).length:1)<P&&(P=v,b=y)}if(b)return b}if(E.hasOwnProperty("not")&&(T=t(r),!(y=u(e,n.concat(E.not),T,o))))return{not:!0}}else{if(E.hasOwnProperty("oneOf")){for(P=1/0,a=0,h=E.oneOf.length,d=0;a<h;a++)if(y=u(e,n.concat(E.oneOf[a]),r,o))(v=y.schema?Object.keys(y.schema).length:1)<P&&(P=v,b=y);else if((d+=1)>1)break;if(d>1)return{oneOf:!0};if(d<1)return b;b={}}if(E.hasOwnProperty("anyOf")){for(b=null,P=1/0,a=0,h=E.anyOf.length;a<h;a++){if(!(y=u(e,n.concat(E.anyOf[a]),r,o))){b=null;break}(v=y.schema?Object.keys(y.schema).length:1)<P&&(P=v,b=y)}if(b)return b}if(E.hasOwnProperty("not")&&!(y=u(e,n.concat(E.not),r,o)))return{not:!0}}if(E.hasOwnProperty("dependencies"))for(m in E.dependencies)if(E.dependencies.hasOwnProperty(m)&&x.hasOwnProperty(m))if(Array.isArray(E.dependencies[m])){for(a=0,h=E.dependencies[m].length;a<h;a++)if(!x.hasOwnProperty(E.dependencies[m][a]))return{dependencies:!0}}else if(y=u(e,n.concat(E.dependencies[m]),r,o))return y;if(Array.isArray(x)){if(E.hasOwnProperty("items"))if(Array.isArray(E.items)){for(a=0,h=E.items.length;a<h;a++)null!==(y=u(e,n.concat(E.items[a]),r.concat({object:x,key:a}),o))&&(b[a]=y,C=!0);if(x.length>h&&E.hasOwnProperty("additionalItems"))if("boolean"==typeof E.additionalItems){if(!E.additionalItems)return{additionalItems:!0}}else for(a=h,h=x.length;a<h;a++)null!==(y=u(e,n.concat(E.additionalItems),r.concat({object:x,key:a}),o))&&(b[a]=y,C=!0)}else for(a=0,h=x.length;a<h;a++)null!==(y=u(e,n.concat(E.items),r.concat({object:x,key:a}),o))&&(b[a]=y,C=!0);else if(E.hasOwnProperty("additionalItems")&&"boolean"!=typeof E.additionalItems)for(a=0,h=x.length;a<h;a++)null!==(y=u(e,n.concat(E.additionalItems),r.concat({object:x,key:a}),o))&&(b[a]=y,C=!0);if(C)return{schema:b}}else{for(m in A=[],b={},x)x.hasOwnProperty(m)&&A.push(m);if(o.checkRequired&&E.required)for(a=0,h=E.required.length;a<h;a++)x.hasOwnProperty(E.required[a])||(b[E.required[a]]={required:!0},C=!0);if(p=E.hasOwnProperty("properties"),f=E.hasOwnProperty("patternProperties"),p||f)for(a=A.length;a--;){if(S=!1,p&&E.properties.hasOwnProperty(A[a])&&(S=!0,null!==(y=u(e,n.concat(E.properties[A[a]]),r.concat({object:x,key:A[a]}),o))&&(b[A[a]]=y,C=!0)),f)for(m in E.patternProperties)E.patternProperties.hasOwnProperty(m)&&A[a].match(m)&&(S=!0,null!==(y=u(e,n.concat(E.patternProperties[m]),r.concat({object:x,key:A[a]}),o))&&(b[A[a]]=y,C=!0));S&&A.splice(a,1)}if(o.useDefault&&p&&!C)for(m in E.properties)E.properties.hasOwnProperty(m)&&!x.hasOwnProperty(m)&&E.properties[m].hasOwnProperty("default")&&(x[m]=E.properties[m].default);if(o.removeAdditional&&p&&!0!==E.additionalProperties&&"object"!=typeof E.additionalProperties)for(a=0,h=A.length;a<h;a++)delete x[A[a]];else if(E.hasOwnProperty("additionalProperties"))if("boolean"==typeof E.additionalProperties){if(!E.additionalProperties)for(a=0,h=A.length;a<h;a++)b[A[a]]={additional:!0},C=!0}else for(a=0,h=A.length;a<h;a++)null!==(y=u(e,n.concat(E.additionalProperties),r.concat({object:x,key:A[a]}),o))&&(b[A[a]]=y,C=!0);if(C)return{schema:b}}for(g in E)E.hasOwnProperty(g)&&!s.hasOwnProperty(g)&&("format"===g?e.fieldFormat.hasOwnProperty(E[g])&&!e.fieldFormat[E[g]](x,E,r,o)&&(b[g]=!0,C=!0):e.fieldValidate.hasOwnProperty(g)&&!e.fieldValidate[g](x,E[g].hasOwnProperty("$data")?c(r,E[g].$data):E[g],E,r,o)&&(b[g]=!0,C=!0));return C?b:null},h={useDefault:!1,useCoerce:!1,checkRequired:!0,removeAdditional:!1};function d(){if(!(this instanceof d))return new d;this.coerceType={},this.fieldType=e(n),this.fieldValidate=e(o),this.fieldFormat=e(r),this.defaultOptions=e(h),this.schema={}}d.prototype={validate:function(e,t,i){var s=[e],n=null,r=[{object:{__root__:t},key:"__root__"}];if("string"==typeof e&&!(s=l(this,null,e)))throw new Error("jjv: could not find schema '"+e+"'.");if(i)for(var o in this.defaultOptions)this.defaultOptions.hasOwnProperty(o)&&!i.hasOwnProperty(o)&&(i[o]=this.defaultOptions[o]);else i=this.defaultOptions;return(n=u(this,s,r,i))?{validation:n.hasOwnProperty("schema")?n.schema:n}:null},resolveRef:function(e,t){return l(this,e,t)},addType:function(e,t){this.fieldType[e]=t},addTypeCoercion:function(e,t){this.coerceType[e]=t},addCheck:function(e,t){this.fieldValidate[e]=t},addFormat:function(e,t){this.fieldFormat[e]=t},addSchema:function(e,t){if(!t&&e&&(t=e,e=void 0),t.hasOwnProperty("id")&&"string"==typeof t.id&&t.id!==e){if("/"===t.id.charAt(0))throw new Error("jjv: schema id's starting with / are invalid.");this.schema[a(t.id)]=t}else if(!e)throw new Error("jjv: schema needs either a name or id attribute.");e&&(this.schema[a(e)]=t)}},Va.exports=d}.call(Ba)),Ra=Ha.exports));let ka=null;function Wa(e,t){null===ka&&(ka=Fa(),ka.defaultOptions.useDefault=!0,[gs.CHART_SCHEMA,gs.STUDIES_SCHEMA,gs.FIELDS_SCHEMA,gs.ACCESSOR_SCHEMA].forEach(e=>{ka.addSchema(e,Rr(e))}));let i=wo(e,t);(function(e){return e===gs.CHART_SCHEMA})(t)&&(ro(i,`..plots{.type==="${f[f.Study]}"}`).forEach(e=>{const t=Ur(e.study);ie(t)&&pe(e,t.defaults)}),i=Oa(i));const s=ka.validate(t,i);if(!!s){const e=JSON.stringify(s,null,4);throw new Error(`Document not valid according to schema ${t}; error is ${e}`)}return function(e){return e===gs.ACCESSOR_SCHEMA}(t)&&function(e){const{id:t,context:i}=e,s=e=>ie(i[e]),n=(e,t)=>{if(!ie(i[e]))throw new Error(`${t} plot accessor: you must provide '${e}'`)},r=e=>{if(s("placement")&&"clone"===i.placement&&!s("cloneIndex"))throw new Error(`${e} plot accessor: when placement is 'clone', you must provide 'cloneIndex'.`)};if("Plot"===t)switch(i.id){case"Add":switch(n("type","Add"),i.type){case"Study":n("studyId","Add"),r("Add");break;case"IncomeStatement":case"BalanceSheet":n("fundamentalId","Add");break;case"Expression":n("expression","Add")}break;case"Get":if(!s("main")&&!s("type"))throw new Error("Get plot accessor: you must provide either 'main' or 'type'");break;case"Delete":n("type","Delete"),n("index","Delete");break;case"Update":switch(n("type","Update"),s("main")||n("index","Update"),r("Update"),i.type){case"Forward":if(!ie(i.forward)){if(!ie(i.curves)||!ie(i.offsets))throw new Error("Update forward plot accessor: you must provide either 'forward' or 'curves' and 'offsets'");if(i.curves.length!==i.offsets.length)throw new Error("Update forward plot accessor: you must provide same number of elements for 'curves' and 'offsets'")}break;case"Seasonal":if(!ie(i.seasonal)){if(!ie(i.curves)||!ie(i.offsets))throw new 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 new Error("Update seasonal plot accessor: you must provide either same number of elements for 'curves' and 'offsets' or one curve more")}break;case"Study":{n("studyId","Update"),r("Update");const e=e=>e.reduce((e,t)=>e.concat(t.fields),[]),t=Ur(i.studyId),s=e=>`Update study plot accessor: you must provide same number of elements for '${e}' of the study as defined in the taxonomy`,o=e=>`Update study plot accessor: incoming list of ${e} is different from the ${e} as defined in the taxonomy`;if(!ie(i.curves)||i.curves.length!==t.defaults.curves.length)throw new Error(s("curves"));const a=e(i.curves);if(0!==B(e(t.defaults.curves),a).length)throw new Error(o("fields"));break}}}}(i),i}function Ua(e){const t=oo(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 oo(t,"..panes{!.axes}",e=>gs.NULL_OBJECT)}const $a=/* @__PURE__ */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":"FRAMA","category":"Study","name":"FRAMA","shortName":"FRAMA"},{"id":"MA","category":"Study","name":"MA-Simple","shortName":"MA"},{"id":"MACLD1","category":"Study","name":"MA-Cloud-Fast","shortName":"MACLD1"},{"id":"MACLD2","category":"Study","name":"MA-Cloud-Slow","shortName":"MACLD2"},{"id":"MA1","category":"Study","name":"MA1-Simple","shortName":"MA1"},{"id":"MA2","category":"Study","name":"MA2-Simple","shortName":"MA2"},{"id":"MA3","category":"Study","name":"MA3-Simple","shortName":"MA3"},{"id":"MA4","category":"Study","name":"MA4-Simple","shortName":"MA4"},{"id":"MA5","category":"Study","name":"MA5-Simple","shortName":"MA5"},{"id":"MA6","category":"Study","name":"MA6-Simple","shortName":"MA6"},{"id":"MA7","category":"Study","name":"MA7-Simple","shortName":"MA7"},{"id":"MA8","category":"Study","name":"MA8-Simple","shortName":"MA8"},{"id":"MA9","category":"Study","name":"MA9-Simple","shortName":"MA9"},{"id":"MA10","category":"Study","name":"MA10-Simple","shortName":"MA10"},{"id":"MAS","category":"Study","name":"MA-Shorter","shortName":"MAS"},{"id":"MAL","category":"Study","name":"MA-Longer","shortName":"MAL"},{"id":"CMBCI","category":"Study","name":"Composite Index","shortName":"CMBCI"},{"id":"CMBCIF","category":"Study","name":"Fast Ma","shortName":"CMBCIF"},{"id":"CMBCIS","category":"Study","name":"Slow Ma","shortName":"CMBCIS"},{"id":"COTI","category":"Study","name":"COT Index","shortName":"COTI"},{"id":"CHEXL","category":"Study","name":"ChandelierExitLong","shortName":"CHEXL"},{"id":"CHEXS","category":"Study","name":"ChandelierExitShort","shortName":"CHEXS"},{"id":"SUPTR","category":"Study","name":"Supertrend","shortName":"SUPTR"},{"id":"BARCOLIX","category":"Study","name":"BarColorIndex","shortName":"BARCOLIX"},{"id":"BARKIND","category":"Study","name":"BarKind","shortName":"BARKIND"},{"id":"BREL","category":"Study","name":"BarRelation","shortName":"BREL"},{"id":"EMA","category":"Study","name":"MA-Exp","shortName":"MA(EXP)"},{"id":"MAHI","category":"Study","name":"MA-High","shortName":"MA(HI)"},{"id":"MALO","category":"Study","name":"MA-Low","shortName":"MA(LO)"},{"id":"MACD","category":"Study","name":"MACD","shortName":"MACD"},{"id":"MACDS","category":"Study","name":"MACD-Signal","shortName":"MACD(S)"},{"id":"MACDH","category":"Study","name":"MACD-Histogram","shortName":"MACD(H)"},{"id":"MACDV","category":"Study","name":"MACD-V","shortName":"MACD-V"},{"id":"MACDVS","category":"Study","name":"MACD-V-Signal","shortName":"MACD-V(S)"},{"id":"MACDVH","category":"Study","name":"MACD-V-Histogram","shortName":"MACD-V(H)"},{"id":"ENVU","category":"Study","name":"Envelope-Up","shortName":"ENV(UP)"},{"id":"ENVD","category":"Study","name":"Envelope-Down","shortName":"ENV(DN)"},{"id":"ENVEXPU","category":"Study","name":"Envelope-Exponential-Up","shortName":"ENVEXP(UP)"},{"id":"ENVEXPD","category":"Study","name":"Envelope-Exponential-Down","shortName":"ENVEXP(DN)"},{"id":"ENVSMOU","category":"Study","name":"Envelope-Smoothed-Up","shortName":"ENVSMO(UP)"},{"id":"ENVSMOD","category":"Study","name":"Envelope-Smoothed-Down","shortName":"ENVSMO(DN)"},{"id":"SMA","category":"Study","name":"MA-Smoothed","shortName":"MA(S)"},{"id":"CSHO","category":"Study","name":"Cash-Overlay","shortName":"CSHO"},{"id":"CSHB","category":"Study","name":"Cash-Basis","shortName":"CSHB"},{"id":"MKTCAP","category":"Study","name":"Market-Cap","format":"UseMetricUnit","shortName":"MktCap"},{"id":"TMA","category":"Study","name":"MA-Triangular","shortName":"MA(TRI)"},{"id":"WMA","category":"Study","name":"MA-Weighted","shortName":"MA(W)"},{"id":"VOLMA","category":"Study","format":"UseMetricUnit","name":"MA-Volume","shortName":"VOLMA"},{"id":"OSC","category":"Study","name":"OSC","shortName":"OSC"},{"id":"VOSC","category":"Study","format":"UseMetricUnit","name":"OSC-Volume","shortName":"VOLOSC"},{"id":"RSI","category":"Study","name":"RSI","shortName":"RSI"},{"id":"RSIAVG","category":"Study","name":"RSI-Average","shortName":"RSIAVG"},{"id":"RSA","category":"Study","name":"RSA","shortName":"RSA"},{"id":"RSAAVG","category":"Study","name":"RSA-Average","shortName":"RSIAVG"},{"id":"STORSI","category":"Study","name":"StochRSI","shortName":"STOCHRSI"},{"id":"STORSIAVG","category":"Study","name":"StochRSIAvg","shortName":"STOCHRSIAVG"},{"id":"HH","category":"Study","name":"HighestHigh","shortName":"HHIGH"},{"id":"LL","category":"Study","name":"LowestLow","shortName":"LLOW"},{"id":"PercK","category":"Study","name":"%K","shortName":"PCNTK"},{"id":"PercD","category":"Study","name":"%D","shortName":"PCNTD"},{"id":"PercR","category":"Study","name":"%R","shortName":"PCNTR"},{"id":"WGCL","category":"Study","name":"WeightedClose","shortName":"WTCL"},{"id":"WGALPH","category":"Study","name":"WeightedAlpha","shortName":"WGALPH"},{"id":"UPVOL","category":"Study","format":"UseMetricUnit","name":"UpVol","shortName":"UPVOL"},{"id":"DNVOL","category":"Study","format":"UseMetricUnit","name":"DownVol","shortName":"DNVOL"},{"id":"TOTVOL","category":"Study","format":"UseMetricUnit","name":"TotVol","shortName":"TOTVOL"},{"id":"POC","category":"Study","name":"PointOfControl","shortName":"POC"},{"id":"VAREA","category":"Study","name":"ValueArea","shortName":"VAREA"},{"id":"BARBACK","category":"Study","name":"Background","shortName":"BARBACK"},{"id":"BOLLBU","category":"Study","name":"Bollinger-Upper","shortName":"BOLL(U)"},{"id":"BOLLBL","category":"Study","name":"Bollinger-Lower","shortName":"BOLL(L)"},{"id":"BOLLBM","category":"Study","name":"Bollinger-Mid","shortName":"BOLL(M)"},{"id":"BOLLW","category":"Study","name":"Bollinger-Width","shortName":"BOLL(W)"},{"id":"BOLLP","category":"Study","name":"Bollinger-Percent","shortName":"BOLL(%B)"},{"id":"BOLLBW","category":"Study","name":"Bollinger-BandWidth","shortName":"BOLL(BW)"},{"id":"BOLLBWA","category":"Study","name":"Bollinger-BandWidthAvg","shortName":"BOLL(BWA)"},{"id":"PCUP1","category":"Study","name":"ProbCone-Up1","shortName":"PCUP1"},{"id":"PCDN1","category":"Study","name":"ProbCone-Down1","shortName":"PCDN1"},{"id":"PCUP2","category":"Study","name":"ProbCone-Up2","shortName":"PCUP2"},{"id":"PCDN2","category":"Study","name":"ProbCone-Down2","shortName":"PCDN2"},{"id":"PCUP3","category":"Study","name":"ProbCone-Up3","shortName":"PCUP3"},{"id":"PCDN3","category":"Study","name":"ProbCone-Down3","shortName":"PCDN3"},{"id":"PCTD","category":"Study","name":"ProbCone-TgtDate","shortName":"PCTD"},{"id":"PCTP","category":"Study","name":"ProbCone-TgtPrice","shortName":"PCTP"},{"id":"MBBUO","category":"Study","name":"ModifiedBoll-UppOut","shortName":"MBOLL(UO)"},{"id":"MBBUI","category":"Study","name":"ModifiedBoll-UppIn","shortName":"MBOLL(UI)"},{"id":"MBBM","category":"Study","name":"ModifiedBoll-Mid","shortName":"MBOLL(M)"},{"id":"MBBLI","category":"Study","name":"ModifiedBoll-LowIn","shortName":"MBOLL(LI)"},{"id":"MBBLO","category":"Study","name":"ModifiedBoll-LowOut","shortName":"MBOLL(LO)"},{"id":"OBVOL","category":"Study","format":"UseMetricUnit","name":"OnBalanceVol","shortName":"OBVOL"},{"id":"OBVOLAVG","category":"Study","format":"UseMetricUnit","name":"OnBalanceVolAvg","shortName":"OBVOL"},{"id":"TR","category":"Study","name":"TrueRange","shortName":"TR"},{"id":"ATR","category":"Study","name":"AvgTrueRange","shortName":"ATR"},{"id":"ATRMA","category":"Study","name":"MA-ATR","shortName":"MA(ATR)"},{"id":"ADJATR","category":"Study","name":"AdjAvgTrueRange","shortName":"ADJATR"},{"id":"COTR","category":"Study","name":"ChgOverTrueRange","shortName":"COTR"},{"id":"ATRP","category":"Study","name":"AvgTrueRangePerc","shortName":"ATRP"},{"id":"STOMOMIX","category":"Study","name":"StochMomIndex","shortName":"STOMOMIX"},{"id":"CHDMOMOSC","category":"Study","name":"ChandeMomOsc","shortName":"CHDMOMOSC"},{"id":"CHDMOMOSCAVG","category":"Study","name":"ChandeMomOsc-Avg","shortName":"CHDMOMOSCAVG"},{"id":"PDI","category":"Study","name":"+DI","shortName":"+DI"},{"id":"MDI","category":"Study","name":"-DI","shortName":"-DI"},{"id":"PLVI","category":"Study","name":"+VI","shortName":"+VI"},{"id":"MNVI","category":"Study","name":"-VI","shortName":"-VI"},{"id":"ADX","category":"Study","name":"ADX","shortName":"ADX"},{"id":"ADXM","category":"Study","name":"ADX-Modified","shortName":"ADXM"},{"id":"ADL","category":"Study","format":"UseMetricUnit","name":"AccDist","shortName":"ACCDIS"},{"id":"ADWM","category":"Study","name":"AccDistWill","shortName":"ACCDISWIL"},{"id":"ADWMMA","category":"Study","name":"AccDistWillMovAvg","shortName":"ACCDISWILMA"},{"id":"MCGD","category":"Study","name":"McGinleyDyn","shortName":"MCGD"},{"id":"HMA","category":"Study","name":"HullMovAvg","shortName":"HMA"},{"id":"COPP","category":"Study","name":"CoppCurve","shortName":"COPP"},{"id":"CHAOSC","category":"Study","format":"UseMetricUnit","name":"ChaikinOsc","shortName":"CHAIKOSC"},{"id":"TP","category":"Study","name":"TypicalPrice","shortName":"TP"},{"id":"KCUP","category":"Study","name":"KeltChan-Up","shortName":"KELT(UP)"},{"id":"KCMID","category":"Study","name":"KeltChan-Mid","shortName":"KELT(MID)"},{"id":"KCLOW","category":"Study","name":"KeltChan-Low","shortName":"KELT(LO)"},{"id":"KBUP","category":"Study","name":"KeltBands-Up","shortName":"KELB(UP)"},{"id":"KBMID","category":"Study","name":"KeltBands-Mid","shortName":"KELB(MID)"},{"id":"KBLOW","category":"Study","name":"KeltBands-Low","shortName":"KELB(LO)"},{"id":"DONUP","category":"Study","name":"Donchian-Up","shortName":"DON(U)"},{"id":"DONMID","category":"Study","name":"Donchian-Mid","shortName":"DON(M)"},{"id":"DONLOW","category":"Study","name":"Donchian-Low","shortName":"DON(L)"},{"id":"DONW","category":"Study","name":"Donchian-Width","shortName":"DON(W)"},{"id":"PVT","category":"Study","format":"UseMetricUnit","name":"PriceVolChange","shortName":"PVOL"},{"id":"TRIX","category":"Study","name":"Triple-MA-Exp","shortName":"TRIX"},{"id":"ROC","category":"Study","name":"RateOfChange","shortName":"ROC"},{"id":"PVPT","category":"Study","name":"PivotPoint","shortName":"PVMOV"},{"id":"PVPTR","category":"Study","name":"PvtPt-Resistance","shortName":"PVMOV(R)"},{"id":"PVPTS","category":"Study","name":"PvtPt-Support","shortName":"PVMOV(S)"},{"id":"FISHER","category":"Study","name":"Fisher","shortName":"Fisher"},{"id":"FISHTRG","category":"Study","name":"Fisher-Trigger","shortName":"Trigger"},{"id":"ARNUP","category":"Study","name":"Aroon-Up","shortName":"ARN(UP)"},{"id":"ARNLOW","category":"Study","name":"Aroon-Down","shortName":"ARN(DN)"},{"id":"VSTOPUP","category":"Study","name":"VolaStop-Up","shortName":"VSTOP(UP)"},{"id":"VSTOPLOW","category":"Study","name":"VolaStop-Down","shortName":"VSTOP(DN)"},{"id":"ARNOSC","category":"Study","name":"Aroon-Osci","shortName":"ARNOSC"},{"id":"TCHNUP","category":"Study","name":"TurtleChn-Up","shortName":"TCH(UP)"},{"id":"TCHNLOW","category":"Study","name":"TurtleChn-Low","shortName":"TCH(LO)"},{"id":"TCHRE","category":"Study","name":"TurtleChnRetrace","shortName":"TCHRE"},{"id":"ALJAW","category":"Study","name":"Alligator-Jaw","shortName":"AL(J)"},{"id":"ALTEETH","category":"Study","name":"Alligator-Teeth","shortName":"AL(T)"},{"id":"ALLIPS","category":"Study","name":"Alligator-Lips","shortName":"AL(L)"},{"id":"PLTLN","category":"Study","name":"PlotLine","shortName":"LINE"},{"id":"AWOS","category":"Study","name":"AwesomeOsc","shortName":"AWOSC"},{"id":"AWOSMA","category":"Study","name":"AwesomeOsc-MA","shortName":"AWOSC(MA)"},{"id":"MFMUL","category":"Study","name":"MoneyFlowMul"},{"id":"CLV","category":"Study","name":"CloseLocationValue","shortName":"CLV"},{"id":"CHOP","category":"Study","name":"ChoppinessIndex","shortName":"ChopIx"},{"id":"CHAMF","category":"Study","name":"ChaikinMoneyFlow","shortName":"CHAIKMF"},{"id":"CHAVOL","category":"Study","name":"ChaikinVolatility","shortName":"CHAIKVOL"},{"id":"DPO","category":"Study","name":"DetrendedPriceOsc","shortName":"DPO"},{"id":"CCI","category":"Study","name":"CommodityChannelIndex","shortName":"CCI"},{"id":"EMV","category":"Study","name":"EaseOfMovement","shortName":"EOM"},{"id":"EMVMA","category":"Study","name":"EaseOfMovementMA","shortName":"EOM(MA)"},{"id":"ERBLPOW","category":"Study","name":"ElderRayBullPow","shortName":"ER(BULL)"},{"id":"ERBRPOW","category":"Study","name":"ElderRayBearPow","shortName":"ER(BEAR)"},{"id":"FI","category":"Study","format":"UseMetricUnit","name":"ForceIndex","shortName":"FORCE"},{"id":"MI","category":"Study","name":"MassIndex","shortName":"MASS"},{"id":"MOM","category":"Study","name":"Momentum","shortName":"MOM"},{"id":"MOMMA","category":"Study","name":"MA-Momentum","shortName":"MA(MOM)"},{"id":"MFI","category":"Study","name":"MoneyFlowIndex","shortName":"MFI"},{"id":"MSD","category":"Study","name":"MovingStdDev","shortName":"MSD"},{"id":"PCTCHG","category":"Study","name":"PercentChange","shortName":"PCTCHG"},{"id":"LINRUP","category":"Study","name":"LinRegUpper","shortName":"LINRUP"},{"id":"LINRMID","category":"Study","name":"LinRegMiddle","shortName":"LINRMID"},{"id":"LINRLOW","category":"Study","name":"LinRegLower","shortName":"LINRLOW"},{"id":"NVI","category":"Study","name":"NegativeVolIndex","shortName":"NVI"},{"id":"NVIEMA","category":"Study","name":"NegativeVolIndexEMA","shortName":"NVI(EMA)"},{"id":"PVI","category":"Study","name":"PositiveVolIndex","shortName":"PVI"},{"id":"PVIEMA","category":"Study","name":"PositiveVolIndexEMA","shortName":"PVI(EMA)"},{"id":"PPO","category":"Study","name":"PercPriceOsc","shortName":"PPO"},{"id":"PPOS","category":"Study","name":"PPO-Signal","shortName":"PPO(S)"},{"id":"PPOH","category":"Study","name":"PPO-Histogram","shortName":"PPO(H)"},{"id":"PVO","category":"Study","name":"PercVolOsc","shortName":"PVO"},{"id":"PVOS","category":"Study","name":"PVO-Signal","shortName":"PVO(S)"},{"id":"PVOH","category":"Study","name":"PVO-Histogram","shortName":"PVO(H)"},{"id":"HV","category":"Study","name":"HistVolatility","shortName":"HISTVOL"},{"id":"PERF","category":"Study","name":"Performance","shortName":"PERF"},{"id":"STC","category":"Study","name":"SchaffTrendCycle","shortName":"STC"},{"id":"MCCLO","category":"Study","name":"McClellanOsc","shortName":"MCCLO"},{"id":"BTI","category":"Study","name":"BreadthThrust","shortName":"BTI"},{"id":"NHLAI","category":"Study","name":"NewHiLoAccIx","shortName":"NHLAI"},{"id":"KST","category":"Study","name":"KnowSureThing","shortName":"KST"},{"id":"KSTSIG","category":"Study","name":"KST-Signal","shortName":"KSTSIG"},{"id":"WASI","category":"Study","name":"WilderAccSwingIndex","shortName":"WACCSW"},{"id":"WWVSARU","category":"Study","name":"WilderVolSarUp","shortName":"WVOL-UP"},{"id":"WWVSARD","category":"Study","name":"WilderVolSarDown","shortName":"WVOL-DN"},{"id":"PARSARS","category":"Study","name":"ParabolicSarShort","shortName":"SHORT"},{"id":"PARSARL","category":"Study","name":"ParabolicSarLong","shortName":"LONG"},{"id":"REATRS","category":"Study","name":"RetraceATRStop","shortName":"REATRS"},{"id":"MOVLR","category":"Study","name":"MovingLinRegression","shortName":"MOVLINREG"},{"id":"TRSP1","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TRSP2","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"COTLCCMSP","category":"Study","name":"Comm Spec","shortName":"COT(C)"},{"id":"COTLCLGSP","category":"Study","name":"Large Spec","shortName":"COT(L)"},{"id":"COTLCSMSP","category":"Study","name":"Small Spec","shortName":"COT(S)"},{"id":"COTDAGPRO","category":"Study","name":"Producers","shortName":"COTDIS(P)"},{"id":"COTDAGSPD","category":"Study","name":"Swap Dealers","shortName":"COTDIS(S)"},{"id":"COTDAGMNM","category":"Study","name":"Managed Money","shortName":"COTDIS(M)"},{"id":"COTDAGOTH","category":"Study","name":"Other Report","shortName":"COTDIS(O)"},{"id":"COTFTRDLI","category":"Study","name":"Dealer Intermediary","shortName":"COTFIN(D)"},{"id":"COTFTRASM","category":"Study","name":"Asset Manager","shortName":"COTFIN(A)"},{"id":"COTFTRLVF","category":"Study","name":"Leveraged Funds","shortName":"COTFIN(L)"},{"id":"COTFTROTH","category":"Study","name":"Other Report","shortName":"COTFIN(O)"},{"id":"PPTPIV","category":"Study","name":"Pivot Point","shortName":"PPT(P)"},{"id":"PPTR1","category":"Study","name":"1st Resistance","shortName":"PPT(R1)"},{"id":"PPTR2","category":"Study","name":"2nd Resistance","shortName":"PPT(R2)"},{"id":"PPTR3","category":"Study","name":"3rd Resistance","shortName":"PPT(R3)"},{"id":"PPTS1","category":"Study","name":"1st Support","shortName":"PPT(S1)"},{"id":"PPTS2","category":"Study","name":"2nd Support","shortName":"PPT(S2)"},{"id":"PPTS3","category":"Study","name":"3rd Support","shortName":"PPT(S3)"},{"id":"CPPH4","category":"Study","name":"4th Camarilla Res","shortName":"CPP(H4)"},{"id":"CPPH3","category":"Study","name":"3rd Camarilla Res","shortName":"CPP(H3)"},{"id":"CPPH2","category":"Study","name":"2nd Camarilla Res","shortName":"CPP(H2)"},{"id":"CPPH1","category":"Study","name":"1st Camarilla Res","shortName":"CPP(H1)"},{"id":"CPPL1","category":"Study","name":"1st Camarilla Supp","shortName":"CPP(L1)"},{"id":"CPPL2","category":"Study","name":"2nd Camarilla Supp","shortName":"CPP(L2)"},{"id":"CPPL3","category":"Study","name":"3rd Camarilla Supp","shortName":"CPP(L3)"},{"id":"CPPL4","category":"Study","name":"4th Camarilla Supp","shortName":"CPP(L4)"},{"id":"IMPVOL","category":"Study","name":"Implied Volatility","shortName":"IV"},{"id":"CTM","category":"Study","name":"Cycle Trading Momentum","shortName":"CTM"},{"id":"CPMI","category":"Study","name":"Principal Momentum","shortName":"CPMI"},{"id":"CTPI","category":"Study","name":"Turning Point","shortName":"CTPI"},{"id":"CTLTM","category":"Study","name":"Long-Term Momentum","shortName":"LTM"},{"id":"CTLTMF","category":"Study","name":"Long-Term Momentum, Fast","shortName":"LTM(F)"},{"id":"DEMA","category":"Study","name":"Double EMA","shortName":"DEMA"},{"id":"EOSC","category":"Study","name":"Exponential Oscillator","shortName":"EOSC"},{"id":"TEMA","category":"Study","name":"Triple EMA","shortName":"TEMA"},{"id":"TSI","category":"Study","name":"True Strength Index","shortName":"Tsi"},{"id":"TSISIG","category":"Study","name":"True Strength Index Signal","shortName":"TsiSig"},{"id":"GMMA3","category":"Study","name":"GMMA-EMA3","shortName":"GMMA(3)"},{"id":"GMMA5","category":"Study","name":"GMMA-EMA5","shortName":"GMMA(5)"},{"id":"GMMA8","category":"Study","name":"GMMA-EMA8","shortName":"GMMA(8)"},{"id":"GMMA10","category":"Study","name":"GMMA-EMA10","shortName":"GMMA(10)"},{"id":"GMMA12","category":"Study","name":"GMMA-EMA12","shortName":"GMMA(12)"},{"id":"GMMA15","category":"Study","name":"GMMA-EMA15","shortName":"GMMA(15)"},{"id":"GMMA30","category":"Study","name":"GMMA-EMA30","shortName":"GMMA(30)"},{"id":"GMMA35","category":"Study","name":"GMMA-EMA35","shortName":"GMMA(35)"},{"id":"GMMA40","category":"Study","name":"GMMA-EMA40","shortName":"GMMA(40)"},{"id":"GMMA45","category":"Study","name":"GMMA-EMA45","shortName":"GMMA(45)"},{"id":"GMMA50","category":"Study","name":"GMMA-EMA50","shortName":"GMMA(50)"},{"id":"GMMA60","category":"Study","name":"GMMA-EMA60","shortName":"GMMA(60)"},{"id":"CONVLN","category":"Study","name":"ConversionLine","shortName":"ConvLn"},{"id":"BASELN","category":"Study","name":"BaseLine","shortName":"BaseLn"},{"id":"LEADSP1","category":"Study","name":"LeadingSpanA","shortName":"LeadSpA"},{"id":"LEADSP2","category":"Study","name":"LeadingSpanB","shortName":"LeadSpB"},{"id":"LAGGSP","category":"Study","name":"LaggingSpan","shortName":"LaggSp"},{"id":"VWAP","category":"Study","name":"VWAP","shortName":"VWAP"},{"id":"AVWAP","category":"Study","name":"Anchored VWAP","shortName":"Anch-VWAP"},{"id":"VWAPSD1U","category":"Study","name":"VWAP Stdev1 Upper","shortName":"VWAP-Std1-Up"},{"id":"VWAPSD1L","category":"Study","name":"VWAP Stdev1 Lower","shortName":"VWAP-Std1-Lo"},{"id":"VWAPSD2U","category":"Study","name":"VWAP Stdev2 Upper","shortName":"VWAP-Std2-Up"},{"id":"VWAPSD2L","category":"Study","name":"VWAP Stdev2 Lower","shortName":"VWAP-Std2-Lo"},{"id":"DIFA","category":"Study","name":"Distance From Average","shortName":"DistAvg"},{"id":"DOSCH","category":"Study","name":"Derivative Oscillator","shortName":"DerOsc"},{"id":"DOSCS","category":"Study","name":"Derivative Oscillator Signal","shortName":"DerOscSig"},{"id":"TTMSQZON","category":"Study","name":"TTM Squeeze On","shortName":"TtmSqzOn"},{"id":"TTMSQZOFF","category":"Study","name":"TTM Squeeze Off","shortName":"TtmSqzOff"},{"id":"TTMSQZOSC","category":"Study","name":"TTM Squeeze Osc","shortName":"TtmSqzOsc"},{"id":"CRS","category":"Study","name":"CompRelStrength","shortName":"CRS"},{"id":"CRSAVG","category":"Study","name":"CompRelStrengthAvg","shortName":"CRS-Avg"},{"id":"DRS","category":"Study","name":"DorseyRelStrength","shortName":"DRS"},{"id":"MRS","category":"Study","name":"MansfieldRelStrength","shortName":"MRS"},{"id":"PMO","category":"Study","name":"PriceMomOsc","shortName":"PMO"},{"id":"PMOS","category":"Study","name":"PriceMomOscSig","shortName":"PMOS"},{"id":"RVOL","category":"Study","name":"Relative Volume","shortName":"RVOL"},{"id":"AccountsPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Accounts Payable","shortName":"AcctsPay"},{"id":"AccruedExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Accrued Expenses","shortName":"AccrdExp"},{"id":"Cash","category":"BalanceSheet","format":"UseMetricUnit","name":"Cash & Cash Equivalents","shortName":"Cash&CashEqv"},{"id":"CommonShares","category":"BalanceSheet","format":"UseMetricUnit","name":"Common Shares","shortName":"CommonShares"},{"id":"SharesOutstanding","category":"BalanceSheet","format":"UseMetricUnit","name":"Shares Outstanding","shortName":"SharesOutstanding"},{"id":"DeferredIncomeTax","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Income Tax","shortName":"DefIncTax"},{"id":"DeferredLongRevenues","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Revenues","shortName":"DefRev"},{"id":"EquityOtherInvestments","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity Investments","shortName":"OthEquityInvest"},{"id":"IncomeTaxPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Income Tax Payable","shortName":"IncTaxPayble"},{"id":"Intangibles","category":"BalanceSheet","format":"UseMetricUnit","name":"Intangibles","shortName":"Intangibles"},{"id":"Inventories","category":"BalanceSheet","format":"UseMetricUnit","name":"Inventories","shortName":"Inventory"},{"id":"LongTermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Long Term Debt","shortName":"LTDebt"},{"id":"MarketableSec","category":"BalanceSheet","format":"UseMetricUnit","name":"Liquid Securities","shortName":"LiqSecurities"},{"id":"OtherCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Miscellaneous Current Assets","shortName":"MiscCurrAssets"},{"id":"OtherCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Current Liabilities","shortName":"OthCurrLiab"},{"id":"OtherEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity","shortName":"OthEquity"},{"id":"OtherNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Assets","shortName":"OthNonCurrAssets"},{"id":"OtherNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Liabilities","shortName":"OthNonCurrLiab"},{"id":"PpeNet","category":"BalanceSheet","format":"UseMetricUnit","name":"PPE Net","shortName":"PPENet"},{"id":"PrepaidExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Prepaid Expenses","shortName":"PpdExp"},{"id":"Receivables","category":"BalanceSheet","format":"UseMetricUnit","name":"Receivables","shortName":"Receivables"},{"id":"RetainedEarnings","category":"BalanceSheet","format":"UseMetricUnit","name":"Retained Earnings","shortName":"RetEarnings"},{"id":"ShorttermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Short-Term Debt","shortName":"ShortTermDebt"},{"id":"TotalAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Assets","shortName":"TotAssets"},{"id":"TotalCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Assets","shortName":"TotCurrAssets"},{"id":"TotalCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Liabilities","shortName":"TotCurrLiab"},{"id":"TotalLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities","shortName":"TotalLiab"},{"id":"TotalLiabilitiesAndEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities & Equity","shortName":"TotLiab&Equity"},{"id":"TotalNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Assets","shortName":"TotNonCurrAssets"},{"id":"TotalNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Liabilities","shortName":"TotNonCurrLiabs"},{"id":"TotalShareholdersEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Shareholders Equity","shortName":"TotShareEquity"},{"id":"BasicEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Continued Operations","shortName":"EPSContOps"},{"id":"BasicEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Total Operations","shortName":"EPSTotOps"},{"id":"CostGoods","category":"IncomeStatement","format":"UseMetricUnit","name":"Cost of Goods","shortName":"COGS"},{"id":"DilutedEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Continued Operations","shortName":"DilutedEPSContOps"},{"id":"DilutedEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Total Operations","shortName":"DilutedEPSTotOps"},{"id":"Ebitda","category":"IncomeStatement","format":"UseMetricUnit","name":"EBITDA","shortName":"EBITDA"},{"id":"GrossProfit","category":"IncomeStatement","format":"UseMetricUnit","name":"Gross Profit","shortName":"GrProfit"},{"id":"IncomeTax","category":"IncomeStatement","format":"UseMetricUnit","name":"Income Tax","shortName":"IncomeTax"},{"id":"InterestExpense","category":"IncomeStatement","format":"UseMetricUnit","name":"Interest Expense","shortName":"IntExp"},{"id":"NetIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Net Income Less Expenses & Tax","shortName":"NetIncome"},{"id":"OperatingExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Expenses","shortName":"OpExpense"},{"id":"OperatingIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Income","shortName":"OpIncome"},{"id":"OtherIncomeExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Other Income","shortName":"OthInc"},{"id":"PreTaxIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Pretax Income","shortName":"PretaxInc"},{"id":"Sales","category":"IncomeStatement","format":"UseMetricUnit","name":"Sales","shortName":"Sales"},{"id":"JPIB","category":"Study","name":"JPI-Buy","shortName":"Buy"},{"id":"JPIS","category":"Study","name":"JPI-Sell","shortName":"Sell"},{"id":"TDIPRC","category":"Study","name":"TDI Price Line","shortName":"PriceLn"},{"id":"TDITSL","category":"Study","name":"TDI Trade Signal","shortName":"TradeSig"},{"id":"TDIMBL","category":"Study","name":"TDI Market Base","shortName":"MktBase"},{"id":"TDIUPR","category":"Study","name":"TDI Upper Band","shortName":"UpperBnd"},{"id":"TDILWR","category":"Study","name":"TDI Lower Band","shortName":"LowerBnd"},{"id":"PPS","category":"Study","name":"PricePercentStop","shortName":"PPS"},{"id":"RCI","category":"Study","name":"RankCorrelationIndex","shortName":"RCI"},{"id":"RCISIG","category":"Study","name":"RCI Signal","shortName":"RCISig"},{"id":"ZZPIVOT","category":"Study","name":"ZigZag Pivot","shortName":"ZZPivot"},{"id":"ADR","category":"Study","name":"AvgDailyRange","shortName":"ADR"},{"id":"ADRP","category":"Study","name":"AvgDailyRangePerc","shortName":"ADRP"}]');class Ga{constructor(e,t=c.Number,i=h.Common,s,n=u.FromMetaData,r){this.id=e,this.type=t,this.category=i,this.name=s,this.format=n,this.shortName=r;const o="_"===e.charAt(0);null==s&&(this.name=o?e:this.id.replace(/([A-Z])/g," $1").trim()),this.shortName=r??this.name}}const za={};let Ya=!1;function ja(e){Wa(e,gs.FIELDS_SCHEMA).map(e=>{za[e.id]=new Ga(e.id,c[e.type],h[e.category],e.name,u[e.format],e.shortName)})}const Ka=(Ya||(ja($a),Ya=!0),za),qa={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"},Xa=[Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.Volume,Ka.Change,Ka.PercentChange,Ka.PreviousClose].reduce((e,t,i)=>(e.set(t.id,1<<i),e),/* @__PURE__ */new Map);function Za(...e){return e.reduce((e,t)=>Xa.has(t.id)?e|Xa.get(t.id):e,0)}class Ja{constructor(e=""){this.symbol=e,this.storage=/* @__PURE__ */new Map,this.isValid=!1,this.resetUpdated()}storage;fields=[];_updated=0;isValid=!1;get updated(){return this._updated}resetUpdated(){this._updated=0}addFields(...e){this.fields=function(e,t){const 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)){const i=e.id,s=this.storage.get(i);this.storage.set(i,t);const n=s!==t;return n&&Xa.has(i)&&(this._updated=this._updated|Xa.get(i)),n}}computeWellKnown(){const e=this.getValue(Ka.Close),t=this.getValue(Ka.PreviousClose);ie(e,t)&&(this.hasField(Ka.Change)&&this.update(Ka.Change,e-t),this.hasField(Ka.PercentChange)&&this.update(Ka.PercentChange,(e-t)/t))}hasField(e){return ie(this.fields)&&this.fields.some(t=>t.id===e.id)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}}class Qa extends Ja{translated;constructor(e){super(),this.symbol=e,this.translated=Ws(this.symbol)}hasSymbol(e){return this.symbol===e}}class el extends Ja{actual;constructor(e){super(gs.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}}class tl extends Ja{constructor(e){super(),this.symbol=e}hasSymbol(e){return this.symbol===e}async ready(){return!0}hasField(e){return!1}getValue(e){return null}}const il={previousOpen:Ka.PreviousOpen,previousClose:Ka.PreviousClose,previousHigh:Ka.PreviousHigh,previousLow:Ka.PreviousLow,weeklyPreviousClose:Ka.WeekPreviousClose,weeklyPreviousHigh:Ka.WeekPreviousHigh,weeklyPreviousLow:Ka.WeekPreviousLow,monthlyPreviousClose:Ka.MonthPreviousClose,monthlyPreviousHigh:Ka.MonthPreviousHigh,monthlyPreviousLow:Ka.MonthPreviousLow,fiftyTwoWkHigh:Ka.YearHigh,fiftyTwoWkLow:Ka.YearLow},sl={open:Ka.Open,high:Ka.High,low:Ka.Low,close:Ka.Close,lastPrice:Ka.Last,volume:Ka.Volume,netChange:Ka.Change,percentChange:Ka.PercentChange},nl=Object.values(il),rl=Object.keys(il),ol=Object.keys(sl);class al extends Qa{triedFetchingExtraValues=!1;includeBaseFields=!1;async ready(){return ps.call(this,async()=>{const e=Gv().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid})}shutdown(){}getValue(e){return this.hasField(e)&&nl.some(t=>t.id===e.id)&&null===super.getValue(e)&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,Fv("ondemand",`/getQuote.json?symbols=${this.translated}&fields=${rl.join(",")}`).then(e=>{try{const t=JSON.parse(e);if(200===t.status.code&&1===t.results.length){const e=t.results[0];rl.forEach(t=>this.update(il[t],e[t])),this.includeBaseFields&&ol.forEach(t=>this.update(sl[t],e[t])),Gv().getRecordSource().subject.next({topic:qa.RT_QUOTE,data:{symbol:this.symbol}})}}catch(t){Hv(`Failed to fetch extra values for ${this.translated}`,"error")}})}}class ll extends al{constructor(e){super(e),this.includeBaseFields=!0,this.supplementPreviousValues()}async ready(){return Promise.resolve(!0)}}class cl extends Qa{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){ie(t)&&(this.addFields(e),this.update(e,t))}async ready(){return ps.call(this,async()=>{const t=Gv().config.environment===e[e.NodeJs]?null:ss(`#${gs.INLINE_DATA_ELEMENT_ID}`);if(ie(t)){const e=JSON.parse(t);if(this.translated in e){const t=e[this.translated].quote;this.update(Ka.Open,t.open),this.update(Ka.High,t.high),this.update(Ka.Low,t.low),this.update(Ka.Close,t.close),this.update(Ka.PreviousClose,t.previousClose),this.update(Ka.Volume,t.volume),rl.filter(e=>"previousClose"!==e).forEach(e=>{this.addOptionalField(il[e],t[e])}),this.isValid=!0}else this.isValid=!1}else this.isValid=!1;return this.isValid})}}const ul=[Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.PreviousClose];class hl extends Ja{mapping;resolved;model;constructor(e,t){super();this.resolved=e.map(([e,t])=>t),this.mapping=new Map(e.map(([e,t])=>{return[e,(i=t,Gv().getRecordSource().getRecord(i))];var i})),this.model=t;const i=ul.concat(Ka.Change,Ka.PercentChange);this.addFields(...i.filter(e=>e!==Ka.Volume))}async ready(){return ps.call(this,async()=>{const 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(){ul.forEach(e=>{const t=ua(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)}),this.computeWellKnown()}}function dl(e,t){return i=>i.topic===e&&i.data.symbol===t}var pl=function(e,t){return(pl=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 fl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}pl(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function ml(e,t,i,s){return new(i||(i=Promise))(function(n,r){function o(e){try{l(s.next(e))}catch(t){r(t)}}function a(e){try{l(s.throw(e))}catch(t){r(t)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})}function gl(e,t){var i,s,n,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(r=0)),r;)try{if(i=1,s&&(n=2&a[0]?s.return:a[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,a[1])).done)return n;switch(s=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,s=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(n=r.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(6===a[0]&&r.label<n[1]){r.label=n[1],n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break}n[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(l){a=[6,l],s=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function yl(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 new 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,n,r=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return o}function Sl(e,t,i){if(i||2===arguments.length)for(var s,n=0,r=t.length;n<r;n++)!s&&n in t||(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}function Tl(e){return this instanceof Tl?(this.v=e,this):new Tl(e)}function vl(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s,n=i.apply(e,t||[]),r=[];return s=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),s[Symbol.asyncIterator]=function(){return this},s;function o(e,t){n[e]&&(s[e]=function(t){return new Promise(function(i,s){r.push([e,t,i,s])>1||a(e,t)})},t&&(s[e]=t(s[e])))}function a(e,t){try{(i=n[e](t)).value instanceof Tl?Promise.resolve(i.value.v).then(l,c):u(r[0][2],i)}catch(s){u(r[0][3],s)}var i}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),r.shift(),r.length&&a(r[0][0],r[0][1])}}function Pl(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=yl(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,n){(function(e,t,i,s){Promise.resolve(s).then(function(t){e({value:t,done:i})},t)})(s,n,(t=e[i](t)).done,t.value)})}}}function Cl(e){return"function"==typeof e}function bl(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var El=bl(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 Ll(e,t){if(e){var i=e.indexOf(t);0<=i&&e.splice(i,1)}}var Ml=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,i,s,n;if(!this.closed){this.closed=!0;var r=this._parentage;if(r)if(this._parentage=null,Array.isArray(r))try{for(var o=yl(r),a=o.next();!a.done;a=o.next()){a.value.remove(this)}}catch(p){e={error:p}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else r.remove(this);var l=this.initialTeardown;if(Cl(l))try{l()}catch(f){n=f instanceof El?f.errors:[f]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=yl(c),h=u.next();!h.done;h=u.next()){var d=h.value;try{Il(d)}catch(m){n=null!=n?n:[],m instanceof El?n=Sl(Sl([],Al(n)),Al(m.errors)):n.push(m)}}}catch(g){i={error:g}}finally{try{h&&!h.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}if(n)throw new El(n)}},e.prototype.add=function(t){var i;if(t&&t!==this)if(this.closed)Il(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(i=this._finalizers)&&void 0!==i?i:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ll(t,e)},e.prototype.remove=function(t){var i=this._finalizers;i&&Ll(i,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),_l=Ml.EMPTY;function xl(e){return e instanceof Ml||e&&"closed"in e&&Cl(e.remove)&&Cl(e.add)&&Cl(e.unsubscribe)}function Il(e){Cl(e)?e():e.unsubscribe()}var Dl=void 0,Ol=function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];return setTimeout.apply(void 0,Sl([e,t],Al(i)))};function wl(e){Ol(function(){throw e})}function Rl(){}function Nl(e){e()}var Vl=function(e){function t(t){var i=e.call(this)||this;return i.isStopped=!1,t?(i.destination=t,xl(t)&&t.add(i)):i.destination=kl,i}return fl(t,e),t.create=function(e,t,i){return new Bl(e,t,i)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(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}(Ml),Hl=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(i){Fl(i)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(i){Fl(i)}else Fl(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Fl(t)}},e}(),Bl=function(e){function t(t,i,s){var n,r=e.call(this)||this;return n=Cl(t)||!t?{next:null!=t?t:void 0,error:null!=i?i:void 0,complete:null!=s?s:void 0}:t,r.destination=new Hl(n),r}return fl(t,e),t}(Vl);function Fl(e){wl(e)}var kl={closed:!0,next:Rl,error:function(e){throw e},complete:Rl},Wl="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ul(e){return e}var $l=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,n=this,r=(s=e)&&s instanceof Vl||function(e){return e&&Cl(e.next)&&Cl(e.error)&&Cl(e.complete)}(s)&&xl(s)?e:new Bl(e,t,i);return Nl(function(){var e=n,t=e.operator,i=e.source;r.add(t?t.call(r,i):i?n._subscribe(r):n._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=Gl(t))(function(t,s){var n=new Bl({next:function(t){try{e(t)}catch(i){s(i),n.unsubscribe()}},error:s,complete:t});i.subscribe(n)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Wl]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return(0===(e=t).length?Ul: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=Gl(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 Gl(e){var t;return null!==(t=null!=e?e:Dl)&&void 0!==t?t:Promise}function zl(e){return function(t){if(function(e){return Cl(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(i){this.error(i)}});throw new TypeError("Unable to lift unknown Observable type")}}function Yl(e,t,i,s,n){return new jl(e,t,i,s,n)}var jl=function(e){function t(t,i,s,n,r,o){var a=e.call(this,t)||this;return a.onFinalize=r,a.shouldUnsubscribe=o,a._next=i?function(e){try{i(e)}catch(s){t.error(s)}}:e.prototype._next,a._error=n?function(e){try{n(e)}catch(i){t.error(i)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=s?function(){try{s()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return fl(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)||void 0===t||t.call(this))}},t}(Vl),Kl=bl(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ql=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 fl(t,e),t.prototype.lift=function(e){var t=new Xl(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Kl},t.prototype.next=function(e){var t=this;Nl(function(){var i,s;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var n=yl(t.currentObservers),r=n.next();!r.done;r=n.next()){r.value.next(e)}}catch(o){i={error:o}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}}}})},t.prototype.error=function(e){var t=this;Nl(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;Nl(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?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,s=i.hasError,n=i.isStopped,r=i.observers;return s||n?_l:(this.currentObservers=null,r.push(e),new Ml(function(){t.currentObservers=null,Ll(r,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,i=t.hasError,s=t.thrownError,n=t.isStopped;i?e.error(s):n&&e.complete()},t.prototype.asObservable=function(){var e=new $l;return e.source=this,e},t.create=function(e,t){return new Xl(e,t)},t}($l),Xl=function(e){function t(t,i){var s=e.call(this)||this;return s.destination=t,s.source=i,s}return fl(t,e),t.prototype.next=function(e){var t,i;null===(i=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===i||i.call(t,e)},t.prototype.error=function(e){var t,i;null===(i=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===i||i.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,i;return null!==(i=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==i?i:_l},t}(ql),Zl=function(){return Date.now()},Jl=function(e){function t(t,i){return e.call(this)||this}return fl(t,e),t.prototype.schedule=function(e,t){return this},t}(Ml),Ql=function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];return setInterval.apply(void 0,Sl([e,t],Al(i)))},ec=function(e){return clearInterval(e)},tc=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 fl(t,e),t.prototype.schedule=function(e,t){var i;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var s=this.id,n=this.scheduler;return null!=s&&(this.id=this.recycleAsyncId(n,s,t)),this.pending=!0,this.delay=t,this.id=null!==(i=this.id)&&void 0!==i?i:this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,i){return void 0===i&&(i=0),Ql(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&&ec(t)},t.prototype.execute=function(e,t){if(this.closed)return new 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(n){s=!0,i=n||new 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,Ll(s,this),null!=t&&(this.id=this.recycleAsyncId(i,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Jl),ic=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=Zl,e}(),sc=new(function(e){function t(t,i){void 0===i&&(i=ic.now);var s=e.call(this,t,i)||this;return s.actions=[],s._active=!1,s}return fl(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var i;this._active=!0;do{if(i=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,i){for(;e=t.shift();)e.unsubscribe();throw i}}},t}(ic))(tc),nc=sc;function rc(e){return e&&Cl(e.schedule)}var oc="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function ac(e){if(e instanceof $l)return e;if(null!=e){if(function(e){return Cl(e[Wl])}(e))return o=e,new $l(function(e){var t=o[Wl]();if(Cl(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if((r=e)&&"number"==typeof r.length&&"function"!=typeof r)return n=e,new $l(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(Cl(null==(s=e)?void 0:s.then))return i=e,new $l(function(e){i.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,wl)});if(function(e){return Symbol.asyncIterator&&Cl(null==e?void 0:e[Symbol.asyncIterator])}(e))return lc(e);if(function(e){return Cl(null==e?void 0:e[oc])}(e))return t=e,new $l(function(e){var i,s;try{for(var n=yl(t),r=n.next();!r.done;r=n.next()){var o=r.value;if(e.next(o),e.closed)return}}catch(a){i={error:a}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}}e.complete()});if(function(e){return Cl(null==e?void 0:e.getReader)}(e))return lc(function(e){return vl(this,arguments,function(){var t,i,s;return gl(this,function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,Tl(t.read())];case 3:return i=n.sent(),s=i.value,i.done?[4,Tl(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,Tl(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}(e))}var t,i,s,n,r,o;throw function(e){return new 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)}function lc(e){return new $l(function(t){(function(e,t){var i,s,n,r;return ml(this,void 0,void 0,function(){var o,a;return gl(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),i=Pl(e),l.label=1;case 1:return[4,i.next()];case 2:if((s=l.sent()).done)return[3,4];if(o=s.value,t.next(o),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),n={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),s&&!s.done&&(r=i.return)?[4,r.call(i)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function cc(e,t,i,s,n){void 0===s&&(s=0),void 0===n&&(n=!1);var r=t.schedule(function(){i(),n?e.add(this.schedule(null,s)):this.unsubscribe()},s);if(e.add(r),!n)return r}function uc(e,t){return zl(function(i,s){var n=0;i.subscribe(Yl(s,function(i){s.next(e.call(t,i,n++))}))})}function hc(e,t,i){void 0===e&&(e=0),void 0===i&&(i=nc);var s=-1;return null!=t&&(rc(t)?i=t:s=t),new $l(function(t){var n,r=(n=e)instanceof Date&&!isNaN(n)?+e-i.now():e;r<0&&(r=0);var o=0;return i.schedule(function(){t.closed||(t.next(o++),0<=s?this.schedule(void 0,s):t.complete())},r)})}function dc(e,t){return void 0===e&&(e=0),void 0===t&&(t=sc),e<0&&(e=0),hc(e,e,t)}function pc(e,t){return zl(function(i,s){var n=0;i.subscribe(Yl(s,function(i){return e.call(t,i,n++)&&s.next(i)}))})}function fc(e){for(var t,i,s=[],n=1;n<arguments.length;n++)s[n-1]=arguments[n];var r,o,a=null!==(t=rc((o=r=s)[o.length-1])?r.pop():void 0)&&void 0!==t?t:sc,l=null!==(i=s[0])&&void 0!==i?i:null,c=s[1]||1/0;return zl(function(t,i){var s=[],n=!1,r=function(e){var t=e.buffer;e.subs.unsubscribe(),Ll(s,e),i.next(t),n&&o()},o=function(){if(s){var t=new Ml;i.add(t);var n={buffer:[],subs:t};s.push(n),cc(t,a,function(){return r(n)},e)}};null!==l&&l>=0?cc(i,a,o,l,!0):n=!0,o();var u=Yl(i,function(e){var t,i,n=s.slice();try{for(var o=yl(n),a=o.next();!a.done;a=o.next()){var l=a.value,u=l.buffer;u.push(e),c<=u.length&&r(l)}}catch(h){t={error:h}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}},function(){for(;null==s?void 0:s.length;)i.next(s.shift().buffer);null==u||u.unsubscribe(),i.complete(),i.unsubscribe()},void 0,function(){return s=null});t.subscribe(u)})}var mc,gc={exports:{}};var yc,Ac={exports:{}};function Sc(){return yc||(yc=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);if(isNaN(t))return t;return t<0?Math.ceil(t):Math.floor(t)},e.exports=t.default}(Ac,Ac.exports)),Ac.exports}var Tc,vc={exports:{}};function Pc(){return Tc||(Tc=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.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=t.default}(vc,vc.exports)),vc.exports}function Cc(e,t){var i=function(e){if(!Ec[e]){var t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(/* @__PURE__ */new Date("2014-06-25T04:00:00.123Z")),i="06/25/2014, 00:00:00"===t||"06/25/2014 00:00:00"===t;Ec[e]=i?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return Ec[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),s=[],n=0;n<i.length;n++){var r=bc[i[n].type];r>=0&&(s[r]=parseInt(i[n].value,10))}return s}catch(o){if(o instanceof RangeError)return[NaN];throw o}}(i,e):function(e,t){var i=e.format(t),s=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[s[3],s[1],s[2],s[4],s[5],s[6]]}(i,e)}var bc={year:0,month:1,day:2,hour:3,minute:4,second:5};var Ec={};function Lc(e,t,i,s,n,r,o){var a=/* @__PURE__ */new Date(0);return a.setUTCFullYear(e,t,i),a.setUTCHours(s,n,r,o),a}var Mc=36e5,_c={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function xc(e,t,i){var s,n,r;if(!e)return 0;if(s=_c.timezoneZ.exec(e))return 0;if(s=_c.timezoneHH.exec(e))return Dc(r=parseInt(s[1],10))?-r*Mc:NaN;if(s=_c.timezoneHHMM.exec(e)){r=parseInt(s[2],10);var o=parseInt(s[3],10);return Dc(r,o)?(n=Math.abs(r)*Mc+6e4*o,"+"===s[1]?-n:n):NaN}if(function(e){if(Oc[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Oc[e]=!0,!0}catch(t){return!1}}(e)){t=new Date(t||Date.now());var a=i?t:function(e){return Lc(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=Ic(a,e),c=i?l:function(e,t,i){var s=e.getTime(),n=s-t,r=Ic(new Date(n),i);if(t===r)return t;n-=r-t;var o=Ic(new Date(n),i);if(r===o)return r;return Math.max(r,o)}(t,l,e);return-c}return NaN}function Ic(e,t){var i=Cc(e,t),s=Lc(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),n=e.getTime(),r=n%1e3;return s-(n-=r>=0?r:1e3+r)}function Dc(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Oc={};const wc=/* @__PURE__ */He(/* @__PURE__ */Sc());const Rc=/* @__PURE__ */He(/* @__PURE__ */Pc());var Nc=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Vc=36e5,Hc=6e4,Bc={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Nc};function Fc(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)/* @__PURE__ */
|
|
4
|
+
return new Date(NaN);var i=t||{},s=null==i.additionalDigits?2:wc(i.additionalDigits);if(2!==s&&1!==s&&0!==s)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))/* @__PURE__ */
|
|
5
|
+
return new Date(NaN);var n=function(e){var t,i={},s=Bc.dateTimePattern.exec(e);s?(i.date=s[1],t=s[3]):(s=Bc.datePattern.exec(e))?(i.date=s[1],t=s[2]):(i.date=null,t=e);if(t){var n=Bc.timeZone.exec(t);n?(i.time=t.replace(n[1],""),i.timeZone=n[1].trim()):i.time=t}return i}(e),r=function(e,t){var i,s=Bc.YYY[t],n=Bc.YYYYY[t];if(i=Bc.YYYY.exec(e)||n.exec(e)){var r=i[1];return{year:parseInt(r,10),restDateString:e.slice(r.length)}}if(i=Bc.YY.exec(e)||s.exec(e)){var o=i[1];return{year:100*parseInt(o,10),restDateString:e.slice(o.length)}}return{year:null}}(n.date,s),o=r.year,a=function(e,t){if(null===t)return null;var i,s,n,r;if(0===e.length)return(s=/* @__PURE__ */new Date(0)).setUTCFullYear(t),s;if(i=Bc.MM.exec(e))return s=/* @__PURE__ */new Date(0),Gc(t,n=parseInt(i[1],10)-1)?(s.setUTCFullYear(t,n),s):/* @__PURE__ */new Date(NaN);if(i=Bc.DDD.exec(e)){s=/* @__PURE__ */new Date(0);var o=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=$c(e);if(i&&t>366)return!1;if(!i&&t>365)return!1;return!0}(t,o)?(s.setUTCFullYear(t,0,o),s):/* @__PURE__ */new Date(NaN)}if(i=Bc.MMDD.exec(e)){s=/* @__PURE__ */new Date(0),n=parseInt(i[1],10)-1;var a=parseInt(i[2],10);return Gc(t,n,a)?(s.setUTCFullYear(t,n,a),s):/* @__PURE__ */new Date(NaN)}if(i=Bc.Www.exec(e))return zc(t,r=parseInt(i[1],10)-1)?kc(t,r):/* @__PURE__ */new Date(NaN);if(i=Bc.WwwD.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return zc(t,r,l)?kc(t,r,l):/* @__PURE__ */new Date(NaN)}return null}(r.restDateString,o);if(isNaN(a))/* @__PURE__ */
|
|
6
|
+
return new Date(NaN);if(a){var l,c=a.getTime(),u=0;if(n.time&&(u=function(e){var t,i,s;if(t=Bc.HH.exec(e))return Yc(i=parseFloat(t[1].replace(",",".")))?i%24*Vc:NaN;if(t=Bc.HHMM.exec(e))return Yc(i=parseInt(t[1],10),s=parseFloat(t[2].replace(",",".")))?i%24*Vc+s*Hc:NaN;if(t=Bc.HHMMSS.exec(e)){i=parseInt(t[1],10),s=parseInt(t[2],10);var n=parseFloat(t[3].replace(",","."));return Yc(i,s,n)?i%24*Vc+s*Hc+1e3*n:NaN}return null}(n.time),isNaN(u)))/* @__PURE__ */
|
|
7
|
+
return new Date(NaN);if(n.timeZone||i.timeZone){if(l=xc(n.timeZone||i.timeZone,new Date(c+u)),isNaN(l))/* @__PURE__ */
|
|
8
|
+
return new Date(NaN)}else l=Rc(new Date(c+u)),l=Rc(new Date(c+u+l));return new Date(c+u+l)}/* @__PURE__ */
|
|
9
|
+
return new Date(NaN)}function kc(e,t,i){t=t||0,i=i||0;var s=/* @__PURE__ */new Date(0);s.setUTCFullYear(e,0,4);var n=7*t+i+1-(s.getUTCDay()||7);return s.setUTCDate(s.getUTCDate()+n),s}var Wc=[31,28,31,30,31,30,31,31,30,31,30,31],Uc=[31,29,31,30,31,30,31,31,30,31,30,31];function $c(e){return e%400==0||e%4==0&&e%100!=0}function Gc(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var s=$c(e);if(s&&i>Uc[t])return!1;if(!s&&i>Wc[t])return!1}return!0}function zc(e,t,i){return!(t<0||t>52)&&(null==i||!(i<0||i>6))}function Yc(e,t,i){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==i||!(i<0||i>=60)))}var jc,Kc,qc={exports:{}},Xc={exports:{}};function Zc(){return jc||(jc=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(null==e)throw new 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=t.default}(Xc,Xc.exports)),Xc.exports}function Jc(){return Kc||(Kc=1,function(e,t){var i=(mc||(mc=1,function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}(gc)),gc.exports).default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,s.default)({},e)};var s=i(/* @__PURE__ */Zc());e.exports=t.default}(qc,qc.exports)),qc.exports}const Qc=/* @__PURE__ */He(/* @__PURE__ */Jc());const eu=[Ka.Open,Ka.High,Ka.Low,Ka.Last,Ka.Close,Ka.TradingDay,Ka.PreviousClose,Ka.PreviousHigh,Ka.PreviousLow,Ka.PreviousOpen,Ka.Volume,Ka.Change,Ka.PercentChange,Ka.YearHigh,Ka.YearLow,Ka.WeekPreviousClose,Ka.WeekPreviousHigh,Ka.WeekPreviousLow,Ka.MonthPreviousClose,Ka.MonthPreviousHigh,Ka.MonthPreviousLow];class tu{recordCache;translateSymbolBack;_subject;constructor(){this.recordCache=/* @__PURE__ */new Map,this.translateSymbolBack=/* @__PURE__ */new Map}get subject(){if(!ie(this._subject)){const t=dc(Math.max(gs.MINIMUM_THROTTLE,Gv().config.throttleMillis||0)),i=dc(gs.BACKGROUND_TAB_THROTTLE),s=()=>globalThis.document?.hidden?i:t;this._subject=(new ql).pipe((e=s,zl(function(t,i){var s=null,n=null,r=function(){null==n||n.unsubscribe();var t=s;s=[],t&&i.next(t),ac(e()).subscribe(n=Yl(i,r,Rl))};r(),t.subscribe(Yl(i,function(e){return null==s?void 0:s.push(e)},function(){s&&i.next(s),i.complete()},void 0,function(){return s=n=null}))})),pc(e=>e.length>0))}var e;return this._subject}addRecordForSymbol(e,t){const i=Ws(e);i!==e&&this.translateSymbolBack.set(i,e),this.recordCache.set(e,t)}removeRecordForSymbol(e){this.recordCache.delete(e);const t=Ws(e);this.translateSymbolBack.has(t)&&this.translateSymbolBack.delete(t)}findRecordForSymbol(e){const t=this.translateSymbolBack.has(e)?this.translateSymbolBack.get(e):e;return this.recordCache.get(t)}getSupportedFields(){return eu}makeAndCacheRecord(e,t){if(e===gs.PLACEHOLDER_SYMBOL_NAME)return new el(gs.PLACEHOLDER_SYMBOL_NAME);if(this.recordCache.has(e))return this.recordCache.get(e);const 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(const[i,s]of this.recordCache)e.has(s)||(t(s),this.removeRecordForSymbol(i))}postInit(e,t){}}class iu extends tu{getRecord(e){return this.makeAndCacheRecord(e,()=>new cl(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class su extends tu{getRecord(e){return this.makeAndCacheRecord(e,()=>new ll(e))}evictUnused(e){super.evictUnused(e,e=>e.shutdown())}}class nu extends tu{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),Gv().connection.off("marketUpdate",this.onMarketUpdate,e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new al(e))}postInit(e,t){e&&Gv().connection.on("marketUpdate",this.onMarketUpdate,t.translated)}onMarketUpdate(e){if(e.type===gs.REALTIME_INITIAL_QUOTE){const t=this.updateFromQuote(e,!0);this.subject.next({topic:qa.RT_QUOTE,data:e,updated:t})}else if(e.type===gs.REALTIME_TRADE){const t=Gv().connection.getMarketState().getQuote(e.symbol),i=this.updateFromQuote(t);this.subject.next({topic:qa.RT_TRADE,data:e,updated:i}),e.symbol===gs.DEBUG_SYMBOL&&console.log(`Trade\nSymbol: ${e.symbol} \t%cPrice: ${e.tradePrice} \t%cSize: ${e.tradeSize} \t%cTime: ${Si(e.time,gs.DEBUG_TIME_FORMAT)} \t%cSession: ${e.session}`,"color:#0f0","color:#a7a","color:#f96","color:#bee")}else if(e.type===gs.REALTIME_VOLUME){const t=this.updateFromVolume(e);0!==t&&(this.subject.next({topic:qa.RT_VOLUME,data:e,updated:t}),e.symbol===gs.DEBUG_SYMBOL&&console.log(`Volume\n Symbol: ${e.symbol} \t%cValue: ${e.value} \t%cSession: ${e.session}`,"color:#a7a","color:#bee"))}}updateFromQuote(e,t=!1){const i=this.findRecordForSymbol(e.symbol);i.resetUpdated(),i.update(Ka.Open,e.openPrice),i.update(Ka.High,e.highPrice),i.update(Ka.Low,e.lowPrice),i.update(Ka.Last,e.lastPrice),i.update(Ka.Close,e.lastPrice);const s=(e,t)=>{ie(t)&&i.update(e,t)};return s(Ka.Volume,e.volume),i.update(Ka.PreviousClose,e.previousPrice),t&&(s(Ka.PreviousOpen,e.previousOpenPrice),s(Ka.PreviousHigh,e.previousHighPrice),s(Ka.PreviousLow,e.previousLowPrice)),i.computeWellKnown(),i.updated}updateFromVolume(e){const t=this.findRecordForSymbol(e.symbol);return t.resetUpdated(),t.update(Ka.Volume,e.value),t.updated}}class ru extends tu{localTimeZone;constructor(){super(),this.localTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone}get feed(){return Gv()}evictUnused(e){super.evictUnused(e,e=>{e.shutdown(),this.feed.unsubscribe(e.translated)})}getRecord(e){return this.makeAndCacheRecord(e,()=>new al(e))}postInit(e,t){e&&this.feed.subscribe(t.translated)}onSnapshot(e,t){const i=this.findRecordForSymbol(t),s=Gv().metaDataSource.getMetaData(t);if(!s.isReady)return;const n=(e,t)=>{if(te(t)){const n=s.asPrice(t);return i.update(e,n),n}};i.resetUpdated();const r=n(Ka.Open,e.open?.price),o=n(Ka.High,e.high?.price),a=n(Ka.Low,e.low?.price),l=n(Ka.Last,e.last?.price);if(te(n(Ka.Close,e.close?.price))||te(n(Ka.Close,e.settlement?.price))||n(Ka.Close,e.last?.price),te(e.instrumentStatus?.tradeDate)){const t=e.instrumentStatus.tradeDate%100;i.update(Ka.TradingDay,t)}te(e.volume?.volume)&&i.update(Ka.Volume,s.asQuantity(e.volume.volume));const c=this.toExchangeTime(e.transactionTime,s.timeZone);te(n(Ka.PreviousClose,e.prevClose?.price))||n(Ka.PreviousClose,e.previousSession?.settlement?.price),n(Ka.PreviousOpen,e.previousSession?.open?.price),n(Ka.PreviousHigh,e.previousSession?.high?.price),n(Ka.PreviousLow,e.previousSession?.low?.price),n(Ka.YearHigh,e.yearHigh?.price),n(Ka.YearLow,e.yearLow?.price),i.computeWellKnown();const u={topic:"rt.quote",data:{symbol:t,openPrice:r,highPrice:o,lowPrice:a,lastPrice:l,tradeTime:c},updated:i.updated};this.subject.next(u)}skip(e){return void 0===e||e.blockTrade||e.doesNotUpdateLast||e.doesNotUpdateVolume}asDate(e){return!te(e)||e.isZero()?null:new Date(e.div(1e6).toNumber())}toExchangeTime(e,t){const i=this.asDate(e);if(null===i)return null;const s=function(e,t,i){if("string"==typeof e&&!e.match(Nc)){var s=Qc(i);return s.timeZone=t,Fc(e,s)}var n=Fc(e,i),r=Lc(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()).getTime(),o=xc(t,new Date(r));return new Date(r+o)}(i,this.localTimeZone);return function(e,t,i){var s=Fc(e,i),n=xc(t,s,!0),r=new Date(s.getTime()-n),o=/* @__PURE__ */new Date(0);return o.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),o.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),o}(s,t)}onUpdate(e,t){if(!this.recordCache.has(t))return void Hv(`[OpenFeed] update for unsubscribed symbol: ${t}`,"warn");const i=Gv().metaDataSource.getMetaData(t);if(!i.isReady)return;const s=this.toExchangeTime(e.transactionTime,i.timeZone);if(e.trades?.trades)for(const{trade:n}of e.trades.trades){if(this.skip(n))continue;const e=i.asPrice(n.price);if(null===e)continue;const r=i.asQuantity(n.quantity),o=this.toExchangeTime(n.transactionTime,i.timeZone),a=this.findRecordForSymbol(t),l=["High","Low","Volume","TradingDay"].map(e=>Ka[e]),[c,u,h,d]=l.map(e=>a.getValue(e));(!te(u)||e<u)&&a.update(Ka.Low,e),(!te(c)||e>c)&&a.update(Ka.High,e),a.update(Ka.Last,e),a.update(Ka.Close,e),a.update(Ka.Volume,(te(h)?h:0)+r),a.computeWellKnown();const p={data:{symbol:t,tradePrice:e,tradeSize:r,session:n.session,time:o??s,tradingDay:d},topic:"rt.trade",updated:a.updated};this.subject.next(p)}}}function ou(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,n=new Array(s),r=0;r<s;r++)n[r]=arguments[r];return ou(e,t,i.concat(n))}}const au=ou(Xe,2),lu=ou(ot,2),cu=ou(Ze,2),uu=ou(function(e,t){return Ke(2,arguments),Ze(e,3*je(t))},2),hu=ou(at,2),du=ou(function(e,t){return Ke(2,arguments),Xe(e,7*je(t))},2),pu=ou(lt,2),fu=ou(Si,2),mu=ou(Di,2);function gu(e,t){switch(e){case a.Tick:return hu(t);case a.Intraday:return lu(t);case a.Day:return au(t);case a.Week:return du(t);case a.Month:return cu(t);case a.Quarter:return uu(t);case a.Year:return pu(t);default:throw new Error(`Unexpected aggregation unit ${a[e]}`)}}function yu(e,t){return t.getFullYear()-1-(t.getFullYear()-1)%e}function Au(e){return yu(10,e)}function Su(e,t){return yu(100,e)===Au(t)}function Tu(e){return new Date(e*gs.OPTIONS_DATA_INCREMENT+gs.OPTIONS_DATA_BASE)}function vu(e,t=gs.ZERO_DATE){const i=/* @__PURE__ */new Date(`${e}T00:00:00`);return ht(i)?i:t}function Pu(e){return e.size-1}class Cu{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(Ka.DateTime)}prepend(e){this.base.prepend(e),this.processRetrieved()}append(e){this.base.append(e),this.processRetrieved()}}class bu extends Cu{constructor(e){super(),this.container=e,this.retryCountForChunk=gs.FETCH_TICK_CHUNK_RETRY_COUNT}getFirstDate(e){const t=super.getFirstDate(0);return e>0&&e<this.retryCountForChunk?At(Di(t,e)):t}process(e){const t=this.container,i=t.size>0?t.getLastDataPoint(Ka.Last):null,s=t.getLastDataPoint(Ka.DateTime);let n=e.time;return void 0!==s&&n<=s&&(n=Qe(s,1)),t.addDataPoint(Ka.DateTime,n),t.addDataPoint(Ka.Last,e.tradePrice),t.addDataPoint(Ka.TradeSize,e.tradeSize),t.addDataPoint(Ka.Change,ie(i)?e.tradePrice-i:null),t.hasField(Ka.TradingDay)&&t.addDataPoint(Ka.TradingDay,e.tradingDay),{isUpdate:!1,time:n.getTime(),index:Pu(t)}}}class Eu extends Cu{agg;durationAdd;constructor(e,t){super(),this.agg=t,this.container=e,this.durationAdd=function(e){switch(e.unit){case a.Tick:case a.Intraday:case a.Day:return gu(e.unit,e.size);case a.Week:case a.Month:case a.Quarter:case a.Year:return gu(e.unit,1);default:throw new Error(`Unexpected aggregation unit ${a[e.unit]}`)}}(t)}isSameBar(e,t){switch(this.agg.unit){case a.Tick:case a.Intraday:case a.Day:return bi(t,this.durationAdd(e));case a.Week:return Mi(e,t);case a.Month:return _i(e,t);case a.Quarter:return xi(e,t);case a.Year:return Ii(e,t);default:throw new Error(`Unexpected aggregation unit ${a[this.agg.unit]}`)}}fixupTimeBasedAggregationTimestamp(e){return e}isCorrection(e,t){const i=bi(t,e);return i&&Hv("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){Ke(2,arguments);var i=qe(e),s=qe(t);return i.getTime()===s.getTime()}(i,e)}getPosition(e){if(0===this.container.size){const t=this.fixupTimeBasedAggregationTimestamp(e.time);return{lastTimestamp:null,newTimestamp:t,nextTimestamp:t,isUpdate:!1}}const t=this.container.getLastDataPoint(Ka.DateTime),i=e.time,s=this.computeNextStamp(t,i);if(null===s)return null;const n=this.isUpdate(t,i,s,e);return null===n?null:{lastTimestamp:t,newTimestamp:i,nextTimestamp:s,isUpdate:n}}createBar(e,t,i,s,n,r,o){const a=this.container,l=a.size>0?a.getLastDataPoint(Ka.Close):null;a.addDataPoint(Ka.DateTime,r),a.addDataPoint(Ka.Open,e),a.addDataPoint(Ka.High,t),a.addDataPoint(Ka.Low,i),a.addDataPoint(Ka.Close,s),a.addDataPoint(Ka.Change,ie(l)?s-l:null),a.addDataPoint(Ka.Volume,n),a.hasField(Ka.OpenInterest)&&a.addDataPoint(Ka.OpenInterest,null),a.hasField(Ka.TradingDay)&&a.addDataPoint(Ka.TradingDay,o??null)}addBar(e,t){const{nextTimestamp:i}=t,{tradePrice:s,tradingDay:n}=e;return this.createBar(s,s,s,s,e.tradeSize,i,n),{isUpdate:!1,time:i.getTime(),index:Pu(this.container)}}updateLastBar(e,t,i,s){const n=this.container,r=e=>n.getLastDataPoint(e);if(ie(e)&&e>r(Ka.High)&&n.setLastDataPoint(Ka.High,e),ie(t)&&t<r(Ka.Low)&&n.setLastDataPoint(Ka.Low,t),ie(i)){n.setLastDataPoint(Ka.Close,i);const e=n.getData(Ka.Close)[n.size-2];n.setLastDataPoint(Ka.Change,i-e)}if(ie(s)){const e=n.getLastDataPoint(Ka.Volume)+s;n.setLastDataPoint(Ka.Volume,e)}}changeLastBar(e,t){const{lastTimestamp:i}=t,s=e.tradePrice;return this.updateLastBar(s,s,s,e.tradeSize),{isUpdate:!0,time:i.getTime(),index:Pu(this.container)}}process(e){const t=this.getPosition(e);if(null===t)return null;const i=fu(gs.DEBUG_TIME_FORMAT);return t.isUpdate?(e.symbol===gs.DEBUG_SYMBOL&&console.log(`Adding ${this.agg.describe()} Bar\nBars %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)):ie(e.tradePrice)?(e.symbol===gs.DEBUG_SYMBOL&&console.log(`Updating ${this.agg.describe()} Bar\nBars %csame %c${i(t.lastTimestamp)} == ${i(t.newTimestamp)}`,"color:#0f0","color:#f96"),this.addBar(e,t)):null}alignToQuote(e){if(ie(e.lastPrice,e.time))return this.updateLastBar(e.highPrice,e.lowPrice,e.lastPrice,void 0),{isUpdate:!0,time:e.time.getTime(),index:Pu(this.container)}}}class Lu extends Eu{innerBuilder;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.processRetrieved()}get base(){return this.innerBuilder.container}fixupTimeBasedAggregationTimestamp(e){return Di(e,pt(e,gs.START_OF_LAST_CENTURY)%this.agg.size)}processRetrieved(){this.container.clear();for(let e=0;e<this.base.size;e++){const t={isTrade:!0,time:this.base.getData(Ka.DateTime)[e],tradeSize:0,tradePrice:0,tradingDay:0};[Ka.Open,Ka.High,Ka.Low].forEach(i=>{t.tradePrice=this.base.getData(i)[e],super.process(t)}),t.tradePrice=this.base.getData(Ka.Close)[e],t.tradeSize=this.base.getData(Ka.Volume)[e],super.process(t)}}process(e){return this.innerBuilder.process(e),super.process(e)}}class Mu{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!==Ka.Change||!this.hasField(Ka.Close)||t<1)return;const i=this.storage[e.id],s=this.storage[Ka.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){const t=e.getLastDataPoint(Ka.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){const t=e.getTimeData()[0].getTime()===this.getLastDataPoint(Ka.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?1:0)}getTimeData(){return this.getData(Ka.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 new Error(`This container does not store values for field ${e.id}`)}addDataPoint(e,t){this.checkField(e);this.getData(e).push(t)}getLastDataPoint(e){this.checkField(e);return k(this.getData(e))}setLastDataPoint(e,t){this.checkField(e);const i=this.getData(e);i[i.length-1]=t}keepOnlyLast(e){if(this.size<=e)return;const t=this.size-e;this.fields.forEach(e=>this.getData(e).splice(0,t))}}class _u extends Mu{constructor(){super([])}get size(){return 0}}class xu extends Mu{wrapper;constructor(e,t){super(e),this.wrapper=t}isWrapped(e){return le(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)}}const Iu=gs.RENKO_KAGI_NAMES;function Du(e){const{Method:t,Period:i,Source:s,BrickSize:n}=fe(e);return{method:oe(t,[Iu.ATR,Iu.TRD,Iu.PCT],Iu.ATR),period:Number.isFinite(i)?i:14,source:oe(s,[Iu.CLS,Iu.HL],Iu.CLS),brickSize:Number.isFinite(n)?n:10}}function Ou(e,t,i){return e.getData(t)[i]}function wu(e,t){const[i,s]=[Ka.High,Ka.Low].map(i=>Ou(e,i,t)),n=Ou(e,Ka.Close,t-1);return Math.max(i-s,Math.abs(i-n),Math.abs(s-n))}function Ru(e,t){if(e.size<t)return null;const i=t-1,s=[];s.push(Ou(e,Ka.High,0)-Ou(e,Ka.Low,0));for(let r=1;r<t;++r)s.push(wu(e,r));let n=w(s);for(let r=t;r<e.size;++r){n=(n*i+wu(e,r))/t}return n}const Nu=e=>Ka[e],Vu=["DateTime","Open","High","Low","Close","Volume"].map(Nu),Hu=Vu.concat(["Change","Projection","BarIndex"].map(Nu));class Bu extends Cu{innerBuilder;inputs;brickSize;lastFinalBrick;projectionCount;refPrices;constructor(e,t){super(),this.supportsChunks=!1,this.innerBuilder=e,this.inputs=ue(t.inputs),this.brickSize=null,this.container=new Mu(Hu),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){const[i,s,n,r,o,a]=Vu.map(i=>t.getData(i)[e]);return{date:i,open:s,high:n,low:r,close:o,volume:a}}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){const[s,n]=this.refPrices(t.close,t.high,t.low),r=s-e.high,o=e.low-n;return{climbing:(i&&r>0||r>=this.brickSize)&&r>=o,falling:(i&&o>0||o>=this.brickSize)&&o>r,moveUp:r,moveDown:o}}initFirstBrick(e,t){const i=Math.max(this.brickSize,se(t.close-t.close%this.brickSize,4));e.open=e.high=e.low=e.close=i,e.date=t.date,e.volume=e.change=0}findSafeStartIndex(){let e=0,t=this.base.size-1;const i=2*gs.RENKO_MAX_BARS;for(;t>0&&e<i;){const i=wu(this.base,t);e+=Math.floor(i/this.brickSize),t--}return t}processRetrieved(){const e=Du(this.inputs),{method:t,period:i,source:s}=e;if(this.brickSize=e.brickSize,t===Iu.ATR)this.brickSize=Ru(this.base,i);else if(t===Iu.PCT)if((this.base?.size??0)>0){const e=this.base.getLastDataPoint(Ka.Close);this.brickSize=e*this.brickSize/100}else this.brickSize=null;if(!ie(this.brickSize))return;this.refPrices=s===Iu.HL?(e,t,i)=>[t,i]:(e,t,i)=>[e,e];const n={},r=this.findSafeStartIndex();for(let o=r;o<this.base.size;o++){const e=this.getBarAt(o);if(o===r){this.initFirstBrick(n,e);continue}const t=this.isLastBase(o),{climbing:i,falling:s,moveUp:a,moveDown:l}=this.getMove(n,e,t);if(!i&&!s){n.volume+=e.volume;continue}n.proj=Number(t),n.barIndex=o;const c=e.date.getTime();if(i){const e=this.getBricksCount(a);for(let t=0;t<e;++t)this.constructClimbing(n,c,t,this.brickSize);t&&(this.constructClimbing(n,c,e,a%this.brickSize),this.projectionCount=e+1)}else if(s){const e=this.getBricksCount(l);for(let t=0;t<e;++t)this.constructFalling(n,c,t,this.brickSize);t&&(this.constructFalling(n,c,e,l%this.brickSize),this.projectionCount=e+1)}t||(this.lastFinalBrick=this.container.size-1,n.volume=0)}this.container.keepOnlyLast(gs.RENKO_MAX_BARS)}constructClimbing(e,t,i,s,n=!0){const r=e.high,o=e.close;e.open=e.low=r,e.high=e.close=r+s,e.date=new Date(t+i),e.change=e.close-o,n?this.addToContainer(e):this.updateLastDataPoint(e)}constructFalling(e,t,i,s,n=!0){const r=e.low,o=e.close;e.open=e.high=r,e.low=e.close=r-s,e.date=new Date(t+i),e.change=e.close-o,n?this.addToContainer(e):this.updateLastDataPoint(e)}process(e){const t=this.innerBuilder.process(e);return this.processUpdate(t)}alignToQuote(e){const 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;const t=this.base.size-1,i=this.getBarAt(t),s=this.getBrickAt(this.lastFinalBrick),{climbing:n,falling:r,moveUp:o,moveDown:a}=this.getMove(s,i,!0),l=1===this.container.getLastDataPoint(Ka.Projection);if(!n&&!r)return l?this.rebuild():null;const c=n?o:a,u=this.getBricksCount(c)+1;if(l&&this.projectionCount===u){const 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}}return this.rebuild()}addToContainer(e){const t=this.container;t.addDataPoint(Ka.DateTime,e.date),t.addDataPoint(Ka.Open,e.open),t.addDataPoint(Ka.Close,e.close),t.addDataPoint(Ka.High,e.high),t.addDataPoint(Ka.Low,e.low),t.addDataPoint(Ka.Change,e.change),t.addDataPoint(Ka.Volume,e.volume),t.addDataPoint(Ka.Projection,e.proj),t.addDataPoint(Ka.BarIndex,e.barIndex)}updateLastDataPoint(e){const t=this.container;t.setLastDataPoint(Ka.DateTime,e.date),t.setLastDataPoint(Ka.Open,e.open),t.setLastDataPoint(Ka.Close,e.close),t.setLastDataPoint(Ka.High,e.high),t.setLastDataPoint(Ka.Low,e.low),t.setLastDataPoint(Ka.Change,e.change),t.setLastDataPoint(Ka.Volume,e.volume),t.setLastDataPoint(Ka.Projection,e.proj),t.setLastDataPoint(Ka.BarIndex,e.barIndex)}}const Fu=[Ka.DateTime,Ka.TradingDay,Ka.Last,Ka.TradeSize,Ka.Change],ku=[Ka.DateTime,Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.Volume,Ka.Change],Wu=[...ku,Ka.OpenInterest],Uu=[...Wu,Ka.Symbol],$u=[Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.Change];function Gu(e,t){const i=Ki(e);if(t.isTick)return Fu;{let e=ku;return t.isMultiContract?e=Uu:(i||t.isEndOfDay)&&(e=Wu),t.isIntraday?[...e,Ka.TradingDay]:e}}class zu{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=/* @__PURE__ */new Date(0),this.timeZone=this.getTimeZone(),this.isFuture=Fi(e),this.padded=s,this.needsResolution=ji(e),this.hasOpenInterest=Ki(e)}makeContainer(){return new Mu(Gu(this.symbol,this.aggregation))}parse(e){this.container=this.makeContainer();const t=e.split("\n"),i=this.getParseFunc();if(null!==i){const e=i.bind(this);t.forEach(t=>{const i=t.trim();if(i){const t=i.split(",");e(t)}})}return this.container}getParseFunc(){return this.aggregation.isTick?this.parseTick:this.aggregation.isIntraday?this.parseMinutes:this.parseEod}parseTick(e){const t=e.length-5;0!==t&&1!==t||(this.container.addDataPoint(Ka.DateTime,this.parseDate(e[0+t])),this.container.addDataPoint(Ka.TradingDay,parseInt(e[1+t])),this.container.addDataPoint(Ka.Last,parseFloat(e[3+t])),this.container.addDataPoint(Ka.TradeSize,parseInt(e[4+t])),this.container.addDataPoint(Ka.Change,this.calculateChange(Ka.Last)))}nullify(e){return null==e||0===e?null:e}parseMinutes(e){const t=this.aggregation.isMultiContract&&this.isFuture||this.needsResolution,i=t?1:0;e.length===7+i&&(this.container.hasField(Ka.Symbol)&&this.container.addDataPoint(Ka.Symbol,t?e[0]:this.symbol),this.container.addDataPoint(Ka.DateTime,this.parseDate(e[0+i])),this.container.addDataPoint(Ka.TradingDay,parseInt(e[1+i])),this.container.addDataPoint(Ka.Open,parseFloat(e[2+i])),this.container.addDataPoint(Ka.High,parseFloat(e[3+i])),this.container.addDataPoint(Ka.Low,parseFloat(e[4+i])),this.container.addDataPoint(Ka.Close,parseFloat(e[5+i])),this.container.addDataPoint(Ka.Volume,this.nullify(parseInt(e[6+i]))),this.container.addDataPoint(Ka.Change,this.calculateChange()))}parseFloatOrNull(e){const t=parseFloat(e);return isNaN(t)&&this.padded?null:t}parseIntOrNull(e){const t=parseInt(e);return isNaN(t)&&this.padded?null:t}parseEod(e){const t=this.aggregation.isMultiContract,i=7+(this.hasOpenInterest?1:0);e.length===i&&(t&&this.container.addDataPoint(Ka.Symbol,e[0]),this.container.addDataPoint(Ka.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Ka.Open,this.parseFloatOrNull(e[2])),this.container.addDataPoint(Ka.High,parseFloat(e[3])),this.container.addDataPoint(Ka.Low,parseFloat(e[4])),this.container.addDataPoint(Ka.Close,parseFloat(e[5])),this.container.addDataPoint(Ka.Volume,this.nullify(this.parseIntOrNull(e[6]))),this.hasOpenInterest&&this.container.addDataPoint(Ka.OpenInterest,this.nullify(this.parseIntOrNull(e[7]))),this.container.addDataPoint(Ka.Change,this.calculateChange()))}calculateChange(e=Ka.Close){const t=this.container.size;if(t>1){const i=this.container.getData(e);return i[t-1]-i[t-2]}return 0}parseTimestamp(e){switch(this.aggregation.unit){case a.Tick:case a.Intraday:return function(e,t=gs.ZERO_DATE){const i=new Date(e.replace(" ","T"));return ht(i)?i:t}(e);default:return vu(e)}}parseDate(e){const t=this.parseTimestamp(e);return this.aggregation.isEndOfDay?lt(t,this.offset):(!function(e,t){Ke(2,arguments);var i=qe(e),s=qe(t);return i.getTime()>s.getTime()}(t,this.previousTime)?this.previousTime=Qe(this.previousTime,1):this.previousTime=t,this.previousTime)}getTimeZone(){return qi(this.symbol)}}const{BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:Yu,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:ju}=gs;class Ku{supportsChunks;constructor(){this.supportsChunks=!0}getPageNameFor(e,t){switch(e.unit){case a.Tick:return gs.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case a.Intraday:return t&&e.spec===l.Nearest?Yu:ju;case a.Day:case a.Week:case a.Month:case a.Quarter:case a.Year:return gs.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return""}}addExtraParams(e){}makeUrl(e){const t={},i=Ws(e.symbol);t.symbol=i;const s=e.aggregation,n=this.getDataParam(s);if(n.length>0&&(t.data=n),s.size>1&&s.unit===a.Intraday){const e=s.spec===l.PerRange?1:s.size;t.interval=e.toString()}const[r,o]=e.range,c=null!==r,u=null!==o;if(c&&(t.start=this.toHistoricalFeedDate(r,s)),!c||e.alwaysUseBarsToFetch){let i=e.barsToFetch||gs.DEFAULT_MAX_RECORDS;s.unit===a.Tick&&s.spec!==l.None&&(i*=gs.TICK_CUSTOM_AGG_MULTIPLIER),t.maxrecords=i.toString()}u&&(t.end=this.toHistoricalFeedDate(o,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);const h=ge(t),d=Fi(i);return`/${this.getPageNameFor(s,d)}?${h}`}toHistoricalFeedDate(e,t){return Si(e,t.isTick||t.isIntraday?gs.FMT_HIST_FEED_PARAM_DATE_TIME:gs.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(e){let t="";const i=this.getSpecPart(e);switch(e.unit){case a.Tick:case a.Intraday:break;case a.Day:t=`daily${i}`;break;case a.Week:t=`weekly${i}`;break;case a.Month:t=`monthly${i}`;break;case a.Quarter:t=`quarterly${i}`;break;case a.Year:t=`yearly${i}`}return t}getSpecPart(e){return e.isMultiContract?e.spec===l.Continue?"continue":"nearest":""}getParser(e){const t=Ws(e.symbol);return new zu(t,e.aggregation,e.offset,e.padded)}async retrieve(e){const t=this.makeUrl(e),i=e.aggregation.unit===a.Tick?"timeseriesNew":"timeseries",s=await Fv(i,t);return this.getParser(e).parse(s)}}class qu{supportsChunks;constructor(){this.supportsChunks=!1}addExtraParams(e){}async retrieve(e){const t=Ws(e.symbol),i=this.emptyContainer(t,e.aggregation);if(e.aggregation.unit!==a.Day)return i;const s={symbol:t};this.addExtraParams(s);const n=`/${this.getPageName()}.json?${ge(s)}`,r=await Fv("ondemand",n);try{const e=JSON.parse(r);if(200===e.status.code){const 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);return i}}catch(o){Hv(`Failed parsing the JSON result from OnDemand, error is ${o.message}`)}return i}}class Xu extends qu{emptyContainer(e,t){return new Mu(Gu(e,t))}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){const s=i.hasField(Ka.Symbol),n=t>0?i.getLastDataPoint(Ka.Close):null;i.addDataPoint(Ka.DateTime,vu(e.date)),s&&i.addDataPoint(Ka.Symbol,e.symbol),i.addDataPoint(Ka.Open,e.open),i.addDataPoint(Ka.High,e.high),i.addDataPoint(Ka.Low,e.low),i.addDataPoint(Ka.Close,e.close),i.addDataPoint(Ka.Volume,e.volume),i.addDataPoint(Ka.OpenInterest,e.openInterest);const r=null===n?null:se(e.close-n,2);i.addDataPoint(Ka.Change,r)}}const Zu={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 Ju{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){const t=Ws(e.symbol).replace(/\.bz$/i,""),i=e.fields.concat(Ka.DateTime),s=()=>new Mu(i);if(e.aggregation.unit!==a.Day)return s();const n=`/get?${ge({symbol:t,apiKey:"default",fields:i.map(e=>Zu[e.id]).join(",")})}`,r=await Fv("options",n);try{const e=JSON.parse(r).data,t=s(),n=e=>Number.parseFloat(e.replace(/,/g,""));return e.forEach(e=>{i.forEach(i=>{i===Ka.DateTime?t.addDataPoint(Ka.DateTime,vu(e.date)):t.addDataPoint(i,n(e[Zu[i.id]]))})}),t}catch(o){Hv(`Failed parsing options JSON historical data result, error is ${o.message}`)}return s()}}class Qu extends Eu{innerBuilder;isBuildingBars;constructor(e,t,i){super(t,i),this.innerBuilder=e,this.isBuildingBars=!1,this.retryCountForChunk=gs.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;const e=[Ka.DateTime,Ka.TradeSize,Ka.Last,Ka.TradingDay],[t,i,s,n]=e.map(e=>this.base.getData(e));for(let r=this.startFromIndex;r<this.base.size;r++){const e={isTrade:!0,time:t[r],tradeSize:i[r],tradePrice:s[r],tradingDay:n[r]};super.process(e)}this.isBuildingBars=!1}process(e){const t=this.innerBuilder.process(e);return e.time=new Date(t.time),super.process(e)}}class eh extends Qu{constructor(e,t,i){super(e,t,i)}fixupTimeBasedAggregationTimestamp(e){return function(e,t){return Ke(2,arguments),at(e,-je(t))}(e,vt(e,Et(Oi(e,1)))%this.agg.size)}}class th extends Qu{series;constructor(e,t,i,s){super(e,i,s),this.series=t}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}}const ih=new Ga("_TICK_COUNT");class sh extends th{anchorTimestamp=null;constructor(e,t,i,s){super(e,t,i,s)}get startFromIndex(){let e=0;const t=this.base.getTimeData();if(ie(this.anchorTimestamp))e=U(t,e=>e===this.anchorTimestamp);else{const i=this.base.size;if(i>2)for(let s=i-2;s>2;--s){const 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){const i=super.addBar(e,t);return this.container.addDataPoint(ih,1),i}changeLastBar(e,t){const i=super.changeLastBar(e,t),s=this.container.getLastDataPoint(ih);return this.container.setLastDataPoint(ih,s+1),i}isUpdate(e,t,i,s){return this.container.getLastDataPoint(ih)<this.agg.size}}const nh=new Ga("_VOLUME_TALLY");class rh extends th{constructor(e,t,i,s){super(e,t,i,s)}addBar(e,t){const i=this.container,s=(i.getLastDataPoint(nh)||0)+e.tradeSize,n=Math.floor(s/this.agg.size),r=s%this.agg.size,o=s<this.agg.size;i.size>0&&(i.setLastDataPoint(Ka.Volume,o?1:n),i.setLastDataPoint(nh,s));const a=super.addBar(e,t);return i.setLastDataPoint(Ka.Volume,1),i.addDataPoint(nh,o?0:r),a}changeLastBar(e,t){const i=this.container,s=super.changeLastBar(e,t);i.setLastDataPoint(Ka.Volume,1);const n=i.getLastDataPoint(nh)??0;return i.setLastDataPoint(nh,n+e.tradeSize),s}isUpdate(e,t,i,s){if(!ut(e,t))return!1;const n=this.container.getLastDataPoint(nh)??0;return s.tradeSize+n<this.agg.size}}class oh extends Eu{innerBuilder;metadata;range;step;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.range=i.size,this.step=1;const n=Gv().getMetaDataSource();this.metadata=n.getMetaData(s)}get priceRange(){return this.step*this.range}get base(){return this.innerBuilder.container}ready(){return ps.call(this,async()=>{const 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++){const t=this.base.getData(Ka.Volume)[e],i=this.useHighOrLow(e);if(!ie(i)){this.updateLastBar(void 0,void 0,void 0,t);continue}const s={isTrade:!0,time:this.base.getData(Ka.DateTime)[e],tradeSize:t,tradePrice:i,tradingDay:0};super.process(s)}}useHighOrLow(e){const t=this.base.getData(Ka.Close)[e];if(0==this.container.size)return t;const i=this.container.getLastDataPoint(Ka.High),s=this.container.getLastDataPoint(Ka.High),n=this.base.getData(Ka.High)[e],r=this.base.getData(Ka.Low)[e],o=n>i,a=r<s;return o&&a?n-t<t-r?n:r:o?n:a?r: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){const i=e.tradePrice,s=this.container.getLastDataPoint(Ka.Low)+this.priceRange;if(i>s)return this.changeAndAddBar(s,e,t);const n=this.container.getLastDataPoint(Ka.High)-this.priceRange;return i<n?this.changeAndAddBar(n,e,t):super.changeLastBar(e,t)}changeAndAddBar(e,t,i){return this.updateLastBar(e,e,e,0),this.container.setLastDataPoint(Ka.Projection,0),this.addBar(t,i)}addBar(e,t){return this.container.addDataPoint(Ka.Projection,1),super.addBar(e,t)}}const ah=[Ka.Open,Ka.High,Ka.Low,Ka.Close],lh=[Ka.BARCOLIX,Ka.High,Ka.Low],ch=gs.RENKO_KAGI_NAMES;function uh(e){const{BoxSizeMethod:t,Period:i,ReversalAmount:s}=fe(e);return{method:oe(t,[ch.ATR,ch.TRD],ch.ATR),period:Number.isFinite(i)?i:14,reversal:Number.isFinite(s)?s:30}}class hh extends Eu{innerBuilder;inputs;reversal;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=ue(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(Ka.BARCOLIX,null),this.container.size>1){const e=this.dataAt(Ka.Close,this.container.size-2);this.setLast(Ka.Open,e),this.updateLastBar(e,e)}return null}isUpdate(e,t,i,s){const n=s.tradePrice,r=e=>e>=0,o=n-this.getLast(Ka.Close),a=r(o),l=Math.abs(o)>=this.reversal,[c,u,h,d]=ah.map(e=>this.getLast(e)),p=d-c,f=r(p)!==a||0===p;return f&&!l||!f&&(a?n<u:n>h)?null:Math.abs(p)<this.reversal||!f||!l}computeBarColor(){const e=e=>this.dataAt(Ka.Close,e)>this.dataAt(Ka.Open,e),t=this.container.size;if(t>1){const i=e(t-1),[s,n,r]=lh.map(e=>this.dataAt(e,t-2)),[,o,a]=lh.map(e=>this.dataAt(e,t-1));let l=s;0===s&&i&&o>n?l=1:1===s&&!i&&a<r&&(l=0),this.setLast(Ka.BARCOLIX,l)}else this.setLast(Ka.BARCOLIX,e(0)?1:0)}process(e){this.isProcessingRetrieved||this.innerBuilder.process(e);const t=super.process(e);return this.computeBarColor(),t}processRetrieved(){const e=uh(this.inputs),{method:t,period:i,reversal:s}=e;if(this.reversal=s,t===ch.ATR&&(this.reversal=Ru(this.base,i)),ie(this.reversal)){this.container.clear(),this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){const t={isTrade:!0,time:this.baseAt(Ka.DateTime,e),tradePrice:this.baseAt(Ka.Close,e),tradeSize:this.baseAt(Ka.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}function dh(e){const{LineCount:t}=fe(e);return{lineBreak:Number.isFinite(t)?t:3}}class ph extends Eu{innerBuilder;lineBreak;currentVolume;inputs;constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.inputs=ue(s.inputs);const n=dh(this.inputs);this.lineBreak=n.lineBreak,this.currentVolume=0,this.processRetrieved()}get base(){return this.innerBuilder.container}readTrade(e){return{isTrade:!0,time:this.base.getData(Ka.DateTime)[e],tradeSize:this.base.getData(Ka.Volume)[e],tradePrice:this.base.getData(Ka.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++){const 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){const n=this.findOpen(i,0,1);this.currentVolume+=s,null!==n?(super.updateLastBar(void 0,void 0,i,void 0),this.container.setLastDataPoint(Ka.Open,n),this.container.setLastDataPoint(Ka.Low,Math.min(n,i)),this.container.setLastDataPoint(Ka.High,Math.max(n,i))):this.resetProjection()}resetProjection(){const e=this.container;e.setLastDataPoint(Ka.High,null),e.setLastDataPoint(Ka.Low,null),e.setLastDataPoint(Ka.Open,null),e.setLastDataPoint(Ka.Close,null),e.setLastDataPoint(Ka.Change,null)}isProjection(e){return this.agg.isIntraday||this.durationAdd(e).getTime()>Date.now()}updateProjection(e,t){this.container.setLastDataPoint(Ka.DateTime,t.nextTimestamp);const i=this.changeLastBar(e,t);return i.timeCorrection={from:t.lastTimestamp,to:t.nextTimestamp},i}addBar(e,t){const i=this.container,{nextTimestamp:s}=t;if(1===i.getLastDataPoint(Ka.Projection)){const s=i.getLastDataPoint(Ka.Close);if(null===this.findOpen(s,this.lineBreak,1))return this.updateProjection(e,t);i.setLastDataPoint(Ka.Projection,0),i.setLastDataPoint(Ka.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;const 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(Ka.Projection,0),this.currentVolume=0,!0)}addProjection(e,t){this.currentVolume+=e.tradeSize;const 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(Ka.Projection,1),!0)}findOpen(e,t,i=0){if(!ie(e))return null;const s=this.container,n=s.size-1-i,r=s.getData(Ka.Close)[n],o=s.getData(Ka.Open)[n];if(r>o){if(e<=r){if(e>=o)return null;for(let i=0;i<Math.min(s.size,t);i++){if(e>=s.getData(Ka.Low)[n-i])return null}return o}return r}if(e>=r){if(e<=o)return null;for(let i=0;i<Math.min(s.size,t);i++){if(e<=s.getData(Ka.High)[n-i])return null}return o}return r}startLine(e){this.container.addDataPoint(Ka.Projection,0);const 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)}}const fh=gs.RENKO_KAGI_NAMES,mh=1,gh=2,yh=3;function Ah(e){switch(e){case gs.BARKIND_O:case gs.BARKIND_XO:return!0;default:return!1}}function Sh(e){switch(e){case gs.BARKIND_X:case gs.BARKIND_OX:return!0;default:return!1}}function Th(e){const t=fe(e),{Source:i,BoxSizeMethod:s,Period:n}=t,{ReversalAmount:r,BoxSize:o,OneStepBack:a}=t,l=oe(i,[fh.CLS,fh.HL],fh.CLS),c=oe(s,[fh.ATR,fh.TRD],fh.ATR),u=Number.isFinite(n)?o:14,h=Number.isFinite(r)?r:3;return{method:c,period:u,source:l,boxSize:Number.isFinite(o)?o:20,reversal:h,oneStepBack:"Yes"===a}}class vh extends Eu{innerBuilder;inputs;boxSize;reversal;source;firstTrend;oneStepBack;isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=ue(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){const s=Math.abs(t-e);return e+i*this.roundToBox(s)}get closeBased(){return this.source===fh.CLS}get currentKind(){return this.getLast(Ka.BARKIND)}getTrendField(e){return this.closeBased?Ka.Close:e?Ka.Low:Ka.High}getTrendPrice(e,t){if(this.closeBased)return e.tradePrice;const i=e;return t?i._lowPrice:i._highPrice}changeLastBar(e,t){const i=Ah(this.currentKind),s=i?-1:1,n=this.getLast(this.getTrendField(i)),r=this.getTrendPrice(e,i);return e.tradePrice=this.roundedDiff(n,r,s),super.changeLastBar(e,t),null}addBar(e,t){const i=0===this.container.size,s=Ah(this.currentKind),n=s?1:-1,r=i?null:this.getLast(Ka.Close),o=this.getTrendPrice(e,!s),a=i?this.roundToBox(this.baseAt(Ka.Open,0)):r;if(e.tradePrice=a+n*(i?0:this.boxSize),super.addBar(e,t),!i){const e=this.roundedDiff(r,o,n);this.updateLastBar(e,e,e)}return this.container.addDataPoint(Ka.BARKIND,null),this.computeBarColor(),null}inplaceReverse(){const e=Ah(this.currentKind)?gs.BARKIND_OX:gs.BARKIND_XO;this.setLast(Ka.BARKIND,e)}canInplaceReverse(){return!function(e){switch(e){case gs.BARKIND_OX:case gs.BARKIND_XO:return!0;default:return!1}}(this.currentKind)&&this.getLast(Ka.High)===this.getLast(Ka.Low)}isUpdate(e,t,i,s){const n=Ah(this.currentKind),r=this.getTrendPrice(s,n),o=this.getTrendPrice(s,!n),a=e=>e>=0,l=r-this.getLast(Ka.Close),c=a(l),u=Math.abs(l)>=this.boxSize,h=o-this.getLast(Ka.Close),d=a(h),p=Math.abs(h)>=this.reversal*this.boxSize;return n?!(c||!u)||(d&&p?!(!this.oneStepBack||!this.canInplaceReverse())&&(this.inplaceReverse(),!0):null):!(!c||!u)||(!d&&p?!(!this.oneStepBack||!this.canInplaceReverse())&&(this.inplaceReverse(),!0):null)}findFirstDiffLargerThanBox(e,t){const i=this.baseAt(Ka.Open,0),s=this.innerBuilder.container.size;for(let n=1;n<s;++n){const s=this.baseAt(e,n)-i;if(Math.abs(s)>this.boxSize){if(t===mh&&s>0)return[n,gs.BARKIND_X];if(t===gh&&s<0)return[n,gs.BARKIND_O];if(t===yh)return[n,s>0?gs.BARKIND_X:gs.BARKIND_O]}}return[null,null]}findFirstBarTrend(){if(this.innerBuilder.container.size<2)return null;if(this.closeBased){const[,e]=this.findFirstDiffLargerThanBox(Ka.Close,yh);return e}{const[e,t]=this.findFirstDiffLargerThanBox(Ka.High,mh),[i,s]=this.findFirstDiffLargerThanBox(Ka.Low,gh);return null===t&&null===s?null:null===s?t:null===t?s:e<i?t:s}}computeBarColor(){const e=this.container.size;let t=this.firstTrend;if(e>1){t=Ah(this.dataAt(Ka.BARKIND,e-2))?gs.BARKIND_X:gs.BARKIND_O}this.setLast(Ka.BARKIND,t)}process(e){return this.isProcessingRetrieved||this.innerBuilder.process(e),null===this.firstTrend?null:super.process(e)}processRetrieved(){const e=Th(this.inputs),{method:t,period:i,reversal:s,source:n,boxSize:r,oneStepBack:o}=e;if(this.reversal=s,this.source=n,t===fh.ATR?this.boxSize=Ru(this.base,i):this.boxSize=r,ie(this.reversal,this.boxSize)&&(this.oneStepBack=o&&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++){const t={isTrade:!0,time:this.baseAt(Ka.DateTime,e),tradePrice:this.baseAt(Ka.Close,e),_highPrice:this.baseAt(Ka.High,e),_lowPrice:this.baseAt(Ka.Low,e),tradeSize:this.baseAt(Ka.Volume,e),tradingDay:0};this.process(t)}this.isProcessingRetrieved=!1}}}const Ph=new Wo(a.Intraday,0);class Ch{constructor(e){this.query=e,this.container=null,this.canLoadMoreData=!0,this.alignToQuote=!1,this.record=new el(e.symbol)}container;canLoadMoreData=!0;alignToQuote=!1;record;isLoading=!1;serverComputedSeries;builder;retriever;streamingSubscription;records;get isTotalVolumeMode(){const e=this.query.symbol,t=this.query.aggregation;return Fi(e)&&!t.isContractVolume&&t.isEndOfDay}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){const t=this.query.aggregation;if(!t.isTick)return new Eu(e,t);switch(t.spec){case l.None:case l.PerSeconds:case l.PerCount:case l.PerVolume:return new bu(e);default:throw new Error(`Custom tick aggregation ${t.describe()} has not been implemented yet`)}}makeBuilder(e){const t=this.makeInnerBuilder(e),i=this.query.aggregation,s=(e,t=[])=>new Mu(Gu(this.query.symbol,e).concat(t)),n=t;switch(this.query.curveStyle){case o.Renko:return new Bu(n,this.query);case o.Kagi:{const e=s(Ph,[Ka.BARCOLIX]);return new hh(n,e,this.query)}case o.PointAndFigure:{const e=s(Ph,[Ka.BARKIND]);return new vh(n,e,this.query)}case o.LineBreak:{const e=s(i,[Ka.Projection]);return new ph(n,e,i,this.query)}}if(i.isIntraday&&i.spec===l.PerRange){const e=s(Ph,[Ka.Projection]);return new oh(n,e,i,this.query.symbol)}const r=t;if(i.isTick)switch(i.spec){case l.PerSeconds:return new eh(r,s(Ph),i);case l.PerCount:{const e=s(Ph,[ih]);return new sh(r,this,e,i)}case l.PerVolume:{const e=s(Ph,[nh]);return new rh(r,this,e,i)}}return i.unit===a.Day&&i.size>1?new Lu(n,s(i),i):t}onStreamingUpdates(e){if(this.isLoading)return;e.map(e=>{if("isTrade"in e)return this.builder.process(e);if("isQuote"in e&&(J(qa.TS_QUOTEMARKER,{series:this}),this.alignToQuote)){const t=this.builder.alignToQuote(e);return this.alignToQuote=!1,t}return null}).filter(e=>ie(e)).filter((e,t,i)=>{if(0===t)return!0;const s=i[t-1];return s.isUpdate!==e.isUpdate||s.time!==e.time||e.timeCorrection}).forEach(e=>{if(-1===e.index)J(qa.TS_MANYCHANGED,{series:this,part:P.Unspecified});else{const t={series:this,index:e.index};J(e.isUpdate?qa.TS_DATAPOINTCHANGED:qa.TS_DATAPOINTADDED,t)}e.timeCorrection&&J(qa.TS_TIMELINECORRECTION,{...e.timeCorrection,series:this})})}get hasData(){return null!==this.container}getRetriever(){return Gi(this.query.symbol)&&this.query.aggregation.isEndOfDay?new Xu:new Ku}getStreamingSubscription(){return Gv().getRecordSource().subject.pipe(uc(e=>{const t=this.query.aggregation.isEndOfDay,i=dl(qa.RT_TRADE,this.record.symbol),s=e.filter(i).filter(e=>ie(e.data.time)).filter(e=>"T"!==e.data.session||this.query.extendedHours&&!t).map(e=>({isTrade:!0,tradePrice:e.data.tradePrice,tradeSize:e.data.tradeSize,time:e.data.time,tradingDay:e.data.tradingDay}));if(this.isTotalVolumeMode&&this.records){const t=this.getSiblingVolume(e);if(t>0&&s.length>0)s[0].tradeSize+=t;else if(t>0&&0===s.length){const e=this.record.getValue(Ka.Last)??this.record.getValue(Ka.Close);if(ie(e)){const i=/* @__PURE__ */new Date;s.push({isTrade:!0,tradePrice:e,tradeSize:t,time:i,tradingDay:this.record.getValue(Ka.TradingDay)})}}}const n=s.reduce((e,t)=>{const i=k(e);var s;return ie(i)&&ie(i.tradePrice)&&ie(t.tradePrice)&&i.tradePrice===t.tradePrice&&i.time.getTime()===t.time.getTime()&&i.tradingDay===t.tradingDay?i.tradeSize+=t.tradeSize:e.push((s=t,Object.assign({},s))),e},[]),r=dl(qa.RT_QUOTE,this.record.symbol);return n.concat(e.filter(r).map(e=>({isQuote:!0,openPrice:e.data.openPrice,highPrice:e.data.highPrice,lowPrice:e.data.lowPrice,lastPrice:e.data.lastPrice,time:e.data.tradeTime})))}),pc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}getSiblingVolume(e){if(!this.records)return 0;return e.filter(e=>e.topic===qa.RT_TRADE&&e.data.symbol in this.records).filter(e=>ie(e.data.time)).filter(e=>"T"!==e.data.session).reduce((e,t)=>e+t.data.tradeSize,0)}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(){const e=this.query.duplicate();let t=this.builder.getLastDate();ie(e.offset)&&0!==e.offset&&(t=lt(t,-e.offset)),e.range=[t,null];const i=await this.retriever.retrieve(e),s=this.container.size;this.builder.append(i);const n=this.container.size-s;J(qa.TS_MANYCHANGED,{series:this,part:P.Tail,count:n,index:s})}async loadHeadChunk(){let e=!1,t=null;for(let i=0;i<this.builder.retryCountForChunk&&!e;++i){const s=this.query.duplicate();let n=this.builder.getFirstDate(i);ie(s.offset)&&0!==s.offset&&(n=lt(n,-s.offset)),s.range=[null,n],t=await this.retriever.retrieve(s),e=t.size>1}this.canLoadMoreData=e,e&&null!==t&&(this.builder.prepend(t),J(qa.TS_MANYCHANGED,{series:this,part:P.Head}))}async applyNearbyFixup(e){const t=this.query.aggregation,i=t.spec===l.Nearest,s=this.query.symbol,n=Fi(s);return!n||!t.isMultiContract||!i||e.size<1||this.serverComputedSeries?n&&ji(s)?await Hi(s):s:e.getLastDataPoint(Ka.Symbol)}async ready(){return ps.call(this,async()=>{this.retriever=this.getRetriever();const e=await this.retriever.retrieve(this.query),t=await this.applyNearbyFixup(e);return this.hasVisibleTo||(this.record=Gv().getRecordSource().getRecord(t)),this.canLoadMoreData=!this.hasVisibleFrom&&e.size>0,this.isTotalVolumeMode&&await this.setupTotalVolumeSubscriptions(),this.builder=this.makeBuilder(e),await this.builder.ready(),this.container=this.builder.container,this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0})}async setupTotalVolumeSubscriptions(){const e=Zi(this.query.symbol);if(e)try{const t=(await Xi(e)).map(e=>e.name).filter(e=>e!==this.record.symbol),i=Gv().getRecordSource();this.records={};for(const e of t)this.records[e]=i.getRecord(e);await Promise.all(Object.values(this.records).map(e=>e.ready()))}catch(t){this.records=void 0}}getCacheableEntities(e){e.add(this)}shutdown(){ie(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.records=void 0}}class bh{query;container;_pretendEmpty;constructor(e,t=!1){this._pretendEmpty=t,this.query=e,this.container=new _u}refresh(){}canLoadMoreData=!1;isLoading=!1;calculable=!1;loadMoreData(e){throw new Error("Should not be called.")}get hasData(){return this._pretendEmpty}async ready(){return this._pretendEmpty}getCacheableEntities(e){}shutdown(){}}class Eh{query;container;canLoadMoreData=!1;isLoading=!1;constructor(e,t){this.query=e,this.container=t}get hasData(){return null!==this.container}loadMoreData(e){throw new Error("Should not be called.")}refresh(){}async ready(){return!0}getCacheableEntities(e){}shutdown(){}}class Lh{constructor(e){this.query=e,this.container=null,this.supplyCustomDemoData="DemoSite"===Gv().config.mode}container;supplyCustomDemoData;canLoadMoreData=!0;isLoading=!0;refresh(){}loadMoreData(e){throw new Error("Should not be called.")}get hasData(){return null!==this.container}shutdown(){}parseEvents(e){const t=new Mu([Ka.DateTime,Ka.Dividends,Ka.Earnings,Ka.Splits,Ka.Custom]),i=e.split("\n"),s=(e,i,s,n)=>{const r=i===s?n:null;t.addDataPoint(e,r)};return i.forEach(e=>{if(""===e.trim())return;const i=e.split(",");if(4!==i.length)return;const n=vu(i[1]);t.addDataPoint(Ka.DateTime,n),s(Ka.Dividends,"Dividend",i[2],i[3]),s(Ka.Earnings,"Earnings",i[2],i[3]),s(Ka.Splits,"Split",i[2],i[3]),this.supplyCustomDemoData?s(Ka.Custom,"Custom","Custom",gs.FAKE_CUSTOM_EVENT):s(Ka.Custom,"Custom",i[2],i[3])}),t}makeUrl(){const e={};e.symbols=this.query.symbol,e.start="19700102",e.end="20501230",gs.EVENTS_BUILT_IN.forEach(t=>e[t]=this.query[t]);return`/queryevents.ashx?${ge(e)}`}async retrieve(){const e=this.makeUrl(),t=await Fv("timeseries",e);return this.parseEvents(t)}async ready(){return ps.call(this,async()=>(this.container=await this.retrieve(),this.isLoading=this.canLoadMoreData=!1,!0))}getCacheableEntities(e){e.add(this)}}class Mh{constructor(e){this.query=e,this.query=e,this.container=null}container;canLoadMoreData=!1;isLoading=!0;get hasData(){return null!==this.container}refresh(){}loadMoreData(e){throw new Error("Should not be called.")}shutdown(){}parseFundamental(e){const t=JSON.parse(e),i=t.status.code,s=204===i;if(200!==i&&!s)return null;const n=new Mu(this.query.fields.concat(Ka.DateTime));if(s)return n;const r=this.query.fields[0],o=r.id.substring(0,1).toLowerCase()+r.id.substring(1);return t.results.reverse().forEach(e=>{n.addDataPoint(Ka.DateTime,vu(e.date)),n.addDataPoint(r,parseFloat(e[o]))}),this.isLoading=!1,n}makeUrl(){const e={count:0,rawData:1};e.symbols=this.query.symbol,e.frequency=this.query.aggregation.unit===a.Quarter?"Quarter":"Annual";const t=ge(e);return`/${this.query.seriesKind===m.BalanceSheet?"getBalanceSheets":"getIncomeStatements"}.json?${t}`}async retrieve(){const e=this.makeUrl(),t=await Fv("ondemand",e);return this.parseFundamental(t)}async ready(){return ps.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}function _h(e,t){const i=e.findIndex(e=>e>t);return Math.max(i<0?e.length:i,0)}class xh{records;streamingSubscription;setSymbols(e){const t=Gv().getRecordSource();this.records=e.reduce((e,i)=>{const s=t.getRecord(i);return this.addFieldsToRecord(s,i),e[i]=s,e},{})}getStreamingSubscription(){return Gv().getRecordSource().subject.pipe(pc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}onStreamingUpdates(e){e.forEach(e=>{const t=e.data,i=this.records[t.symbol];ie(i)&&this.process(i)}),this.notifyAboutUpdates()}async retrieve(){const e=Object.values(this.records);return(await Promise.all(e.map(e=>e.ready()))).every(I)&&(this.onRecordsReady(),e.forEach(e=>this.process(e)),this.streamingSubscription=this.getStreamingSubscription()),this.hasData}async ready(){return ps.call(this,async()=>await this.retrieve())}shutdown(){ie(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class Ih extends xh{symbols=[];constructor(e){super(),this.symbols=e,this.setSymbols(e)}addFieldsToRecord(e,t){e.addFields(Ka.Symbol),e.update(Ka.Symbol,t)}notifyAboutUpdates(){J(qa.RT_QUOTEGROUP,{source:this})}process(e){}onRecordsReady(){}get hasData(){return!0}getValue(e){const t=this.records[e];return void 0===t?null:t.getValue(Ka.Close)}}class Dh extends xh{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=[Ka.DateTime,Ka.Close,Ka.Symbol]}addFieldsToRecord(e,t){e.addFields(Ka.DateTime,Ka.Symbol),e.update(Ka.DateTime,Ji(t)),e.update(Ka.Symbol,t)}refresh(){}loadMoreData(e){throw new Error("Should not be called.")}get hasData(){return null!==this.container&&this.container.size===this.dataPoints}notifyAboutUpdates(){J(qa.TS_MANYCHANGED,{series:this,part:P.Unspecified})}onRecordsReady(){this.container=new Mu(this.fields)}findOrAddIndex(e){let t=this.container.getData(Ka.Symbol).indexOf(e.symbol);if(t<0){const i=this.container.getData(Ka.DateTime),s=Ji(e.symbol);t=_h(i,s),this.fields.forEach(e=>this.container.getData(e).splice(t,0,null))}return t}process(e){const t=this.fields.map(t=>{const i=e.getValue(t);if("Close"!==t.id)return i;return e.getValue(Ka.Last)??i});if(!R(t))return;const i=this.findOrAddIndex(e);this.fields.forEach((e,s)=>this.container.getData(e)[i]=t[s])}getCacheableEntities(e){e.add(this)}}class Oh{query;container;fields;canLoadMoreData=!1;isLoading=!1;constructor(e){this.query=e,this.fields=[Ka.DateTime,Ka.Close,Ka.Symbol],this.container=null}get hasData(){return null!==this.container}refresh(){}loadMoreData(e){throw new Error("Should not be called.")}shutdown(){}insertValues(e,t,i){const s=(t,i,s)=>e.getData(i).splice(t,0,s),n=e.getData(Ka.DateTime),r=Ji(t),o=_h(n,r);s(o,Ka.DateTime,r),s(o,Ka.Close,i),s(o,Ka.Symbol,t)}parseHistoricalForward(e){const t=new Mu(this.fields);return e.split("\n").filter(e=>e.trim().length>0).forEach(e=>{const i=e.split(","),s=i[0];this.insertValues(t,s,parseFloat(i[5]))}),t}makeUrl(){const e={};e.symbols=this.query.symbols.join(","),e.maxrecords=1,e.data="daily",e.end=x(mu(this.query.offset),fu(gs.FMT_HIST_FEED_PARAM_DATE_ONLY))(/* @__PURE__ */new Date);return`/querylatesteod.ashx?${ge(e)}`}async retrieve(){const e=this.makeUrl(),t=await Fv("timeseries",e);return this.parseHistoricalForward(t)}async ready(){return ps.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(e){e.add(this)}}class wh extends Ch{constructor(e){super(e)}getRetriever(){return new Ju}onStreamingUpdates(e){}}class Rh{cacheSeries;seriesCache;constructor(e=!1){this.cacheSeries=e,this.seriesCache=/* @__PURE__ */new Map}getTimeSeries(e){return ie(e.symbol)&&e.symbol===gs.PLACEHOLDER_SYMBOL_NAME?new bh(e):this.getSeries(e)}evictUnused(e){for(const[t,i]of this.seriesCache)!e.has(i)&&i.isCached&&(i.isCached=!1,i.shutdown(),this.seriesCache.delete(t))}refresh(){for(const e of this.seriesCache.values())"function"==typeof e.refresh&&e.refresh()}getSeries(e){const t=(e.cacheMe||this.cacheSeries)&&!e?.alwaysUseBarsToFetch,i=e.getHashKey();if(t&&this.seriesCache.has(i))return this.seriesCache.get(i);{const s=this.makeSeries(e);return s.isCached=t,t&&this.seriesCache.set(i,s),s}}makeSeries(e){switch(e.seriesKind){case m.Normal:return new Ch(e);case m.BalanceSheet:case m.IncomeStatement:return new Mh(e);case m.Events:return new Lh(e);case m.Forward:return new Dh(e);case m.HistoricalForward:return new Oh(e);default:case m.Options:return new wh(e);case m.Study:throw new Error(`The series kind '${m[e.seriesKind]}' is not supported yet.`)}}}var Nh={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"}},Vh={date:ai({formats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:ai({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:ai({formats:{full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Hh={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},Bh={code:"fr",formatDistance:function(e,t,i){var s,n=Nh[e];return s="string"==typeof n?n:1===t?n.one:n.other.replace("{{count}}",String(t)),null!=i&&i.addSuffix?i.comparison&&i.comparison>0?"dans "+s:"il y a "+s:s},formatLong:Vh,formatRelative:function(e,t,i,s){return Hh[e]},localize:{ordinalNumber:function(e,t){var i=Number(e),s=null==t?void 0:t.unit;if(0===i)return"0";return i+(1===i?s&&["year","week","hour","minute","second"].includes(s)?"ère":"er":"ème")},era:ui({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:ui({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:ui({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:ui({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:ui({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:di({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e)}}),era:hi({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:hi({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:hi({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:hi({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:hi({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}};const Fh=/{value:([^}]+)}/,kh=/%([aAdewbBmyYHkIlMpPSL])+/g,Wh={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]}};const Uh=/* @__PURE__ */new Map;function $h(e){if(!ie(e))return null;if(!Uh.has(e)){const i=ie(t=e)?t.replace(Fh,(e,t)=>t.replace(kh,(e,t)=>gs.PHP_TO_UNICODE_TS_35_MAP[t])):t;Uh.set(e,i)}var t;return Uh.get(e)}class Gh{barWidth;unitWidth;minTickInterval;duration;format;prevDate;size;constructor({barWidth:e,unitWidth:t,formatString:i,minTickInterval:s,duration:n},r){this.size=r,this.barWidth=e,this.unitWidth=t,this.minTickInterval=s,this.duration=n,this.format=$h(i),this.prevDate=null}get noPrevDate(){return!ie(this.prevDate)}formatDate(e,t){return ad(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)}}const zh="yyyy",Yh="LLL ''yy",jh=()=>function(){if("fr"===od())return!0;return!1}()?"d LLL":"LLL d",Kh="HH:mm";class qh extends Gh{repeatEach;repeatCounter;constructor(e){super(e),this.repeatEach=gs.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(!ut(this.prevDate,e))return this.asTick(e,1,"EEE");if(!Li(this.prevDate,e))return this.asTick(e,2,Kh);this.repeatCounter++;const t=this.repeatCounter===this.repeatEach;return!function(e,t){Ke(2,arguments);var i=Ct(e),s=Ct(t);return i.getTime()===s.getTime()}(this.prevDate,e)||t?this.asTick(e,t?4:3,Kh):null}}class Xh extends Gh{getTick(e){const t=this.checkPrev(e),i=0===this.minTickInterval||0==(e=>vt(e,nt(e)))(e)%(this.minTickInterval/1e3),s=!ut(this.prevDate,e),n=function(e){return Ke(1,arguments),qe(e).getMinutes()}(e),r=!Li(this.prevDate,e)||t&&0===n;if(i){if(s)return this.asTick(e,1,jh());if(r)return this.asTick(e,2,Kh);if(0==n%30&&this.size<15)return this.asTick(e,3,Kh);if(0==n%15&&this.size<=5)return this.asTick(e,4,Kh)}return null}}class Zh extends Gh{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<22*Wh.Day.One,this.monthYear=this.duration>22*Wh.Day.One&&this.duration<7*Wh.Month.One,this.year=this.duration>7*Wh.Month.One}useTuesday(e){return!!this.noPrevDate||2===vi(e)&&ft(e,this.prevDate)>1728e5}getTick(e){this.checkPrev(e);const t=!_i(e,this.prevDate),i=!Ii(e,this.prevDate);return this.monthDay?1===vi(e)||this.useTuesday(e)?this.asTick(e,1,jh()):null:this.monthYear?t?this.asTick(e,1,Yh):null:this.year&&i?this.asTick(e,1,zh):null}}class Jh extends Gh{monthDay;monthYear;year;constructor(e){super(e),this.monthDay=this.duration<4*Wh.Week.One,this.monthYear=this.duration>4*Wh.Week.One&&this.duration<6*Wh.Month.One,this.year=this.duration>6*Wh.Month.One}getTick(e){this.checkPrev(e);const t=!_i(e,this.prevDate),i=!Ii(e,this.prevDate);return this.monthDay?this.asTick(e,1,jh()):this.monthYear?t?this.asTick(e,1,Yh):null:this.year&&i?this.asTick(e,1,zh):null}}class Qh extends Gh{showMonths;constructor(e){super(e),this.showMonths=this.duration<7*Wh.Month.One}getTick(e){this.checkPrev(e);const t=!Ii(e,this.prevDate);return this.showMonths?this.asTick(e,1,Yh):t?this.asTick(e,1,zh):null}}class ed extends Gh{constructor(e){super(e)}getTick(e){this.checkPrev(e);return!Ii(e,this.prevDate)?this.asTick(e,1,zh):null}}function td(e){const t=function(e){return(e.valueOf()-gs.OPTIONS_DATA_BASE)/gs.OPTIONS_DATA_INCREMENT}(e);return t.toString()}function id(e){return ie(e)?`${e.toFixed(2)}%`:""}function sd(e,t,i=!1){const s=e.plots[0],n=s.curves[0],r=ie(n)&&n.fields.length>0?n.fields[0]:null;if(!ie(r))return"";const o={range:e.fullDomain,allDigits:!1,forceTrailingZeros:i};return Md(s,e.pane.presenter,o),s.metaData.format(t,r,o)}function nd(e,t,i=!1){return e.comparison===d.Percent?id(t):sd(e,t,i)}function rd(e,t,i){const s=e.view?.xAxis?.overrideFormatter;if(s)return s(t);if(ie(e.display.xAxis.isOrdinal))return td(t);const n=i||e.display.xAxis.format;if(ie(n)){return ad(t,$h(n))}const r=e.data.aggregation,o=e.display?.xAxis?.nonEodLabelWithDate??!1;return r.isEndOfDay?ld(r,t):cd(r,t,o)}function od(){const e=ce(Gv().config,null,"overrides","xAxis","getLocaleName");if(ie(e)&&"function"==typeof e)try{return e()}catch(t){Hv(`Failed retrieving the locale name, error is ${t.message}`,"warn")}}function ad(e,t){return Si(e,t,function(){if("fr"===od())return{locale:Bh}}())}function ld(e,t){if(!ht(t))return"";switch(e.unit){case a.Tick:case a.Intraday:case a.Day:case a.Week:default:return ad(t,"P");case a.Month:return ad(t,"LLL yyyy");case a.Quarter:return ad(t,"qqq yyyy");case a.Year:return ad(t,"yyyy")}}function cd(e,t,i){if(!ht(t))return"";return ad(t,`${i?"P ":""} ${e.isTick?"pp":"p"}`)}const ud=(e,t)=>e.at(t);class hd{constructor(e){this.presenter=e,this._dates=[],this.invalidate()}_dates=[];pendingRebuild=!1;checkRebuild(){this.pendingRebuild&&this.rebuild()}get withPrologLength(){return this.checkRebuild(),this._dates.length+gs.TIMELINE_PROLOG_PADDING_BARS}get withPrologEpilogLength(){return this.withPrologLength+gs.TIMELINE_EPILOG_PADDING_BARS}get firstSeriesIndex(){return gs.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<gs.TIMELINE_PROLOG_PADDING_BARS){const t=W(this._dates),i=e-gs.TIMELINE_PROLOG_PADDING_BARS;return this.applyDateShift(t,i)}if(e>=this.withPrologLength){const t=k(this._dates),i=e-this.withPrologLength+1;return this.applyDateShift(t,i)}return this._dates[e-gs.TIMELINE_PROLOG_PADDING_BARS]}get length(){return this.checkRebuild(),this._dates.length>0?this.withPrologEpilogLength:0}slice(e,t){this.checkRebuild();const i=[];for(let s=e;s<t;++s)i.push(this.at(s));return i}tryToCorrectLastBar(e,t,i=!0){i&&this.checkRebuild();const s=+e,n=G(this._dates,s,Number),r=+this._dates[n];return n===this._dates.length-1&&r===s&&(this._dates[n]=t,!0)}mergeDateIntoTimeline(e,t=!0){t&&this.checkRebuild();const i=+e,s=G(this._dates,i,Number),n=+this._dates[s];if(n!==i){const t=s+(i>n?1:0);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;const e=this.presenter.mainPlot.timeSeries;if(!e.hasData)return;const t=e.container.getTimeData();for(let i=t.length-1;i>=0;i--)this._dates[i]=t[i];this.presenter.allPlots.forEach(t=>{if(t.timeSeries===e)return;if(!t.timeSeries.hasData)return;t.timeSeries.container.getTimeData().forEach(e=>this.mergeDateIntoTimeline(e,!1))}),this.pendingRebuild=!1}applyDateShift(e,t){const{unit:i,size:s}=this.presenter.data.aggregation;switch(i){case a.Year:return Ze(e,12*t);case a.Quarter:return Ze(e,3*t);case a.Month:return Ze(e,t);case a.Week:return Xe(e,7*t);case a.Day:return this.addTradingDays(e,t);case a.Intraday:return Qe(e,s*t*gs.ONE_MINUTE_MILLIS);case a.Tick:return Qe(e,1e3*t)}}addTradingDays(e,t){const i=this.presenter.display?.xAxis?.isOrdinal;if(i)return Xe(e,t);if(!e||!Number.isFinite(t)||!Number.isInteger(t))return Xe(e,t);const s=t>0?1:-1;if(0===t){const t=e.getDay();return 0===t?Xe(e,1):6===t?Xe(e,2):e}let n=Math.abs(t),r=e,o=r.getDay();if(s>0?0===o?(r=Xe(r,1),n--):6===o&&(r=Xe(r,2),n--):0===o?(r=Xe(r,-2),n--):6===o&&(r=Xe(r,-1),n--),n<=0)return r;const a=Math.trunc(n/5);a>0&&(r=Xe(r,7*a*s),n-=5*a);let l=14;for(;n>0;){if(--l<0)return Xe(e,t);r=Xe(r,s),o=r.getDay(),0!==o&&6!==o&&n--}return r}}const dd={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 pd(e){return!0===Gv().config.useAllFieldsForComparison&&e.mainPlot.mainCurve.isOhlc&&e.mainAxis.comparison===d.None&&e.mainPane.axes.map(e=>e.plots).flat().reduce((e,t)=>e+(t.isSymbol?1:0),0)>1}const fd=new Wo;function md({plots:e,isMultiSymbol:t,isMultiContract:i,date:s,time:n,dateFieldName:r,hideSymbols:o,revealingClose:a}){const l=o&&a,c=[Td(r,s,null,"heading"),n?Td("Time",n,null,"heading"):""],u=e.map(e=>{if(0===e.values.length)return null;const s=(e=>{const s=e.name.startsWith(gs.FAKE_SYMBOL_PREFIX);switch(e.type){case f.Expression:return!0;case f.Symbol:return!(!t&&!i||s)||!o;default:return!1}})(e)?vd(f[e.type],e.name,e.values[0].color):"",n=e.values.map(t=>Td(t.id===Ka.Close.id&&l?e.description:t.longName,t.value,t.color));if(e.events&&e.events.length){const t=e.events.map(e=>vd(`${e.field.name} (${ld(fd,e.date)})`,e.value,e.color));n.push(...t)}return n.unshift(s),ie(e.unalignedDate)&&n.unshift(Td("Date",e.unalignedDate,e.values[0].color,"heading")),n}).filter(e=>null!=e).flat();return`<table class="values-table">${c.concat(u).filter(e=>""!==e).join("")}</table>`}function gd(e,{panes:t,date:i,time:s,isMultiSymbol:n},r=!1,o=!1,a=!1,l=!1,c=!1,u=!1){return t.map((h,d)=>{const p=r?h.plots:h.plots.filter(e=>!e.isMain),m=e.mainPlot.axis.pane.id===h.id,g=a&&m?`<span class="field-name" style="padding-right:5px">${i} ${s||""}</span>`:"",y=p.map(t=>function(e,t,i,s,n,r,o,a){const{id:l,name:c,type:u,error:h,description:d,values:p,events:m,isMain:g}=e,y=a.display.tooltip,A=h||d,S="value-title"+(g?" value-main":""),T=f[u],v=["Study","BalanceSheet","IncomeStatement"].includes(T)||"Expression"===T&&!i,P=!v||a.hasLegend&&i?"":Cd(l),C=function(e,t){const i=Ad(t?"eye":"eyeSlash"),s=t?"Hide":"Show",n=`${s} plot`;return`<a class="show-hide-plot" data-plot-id="${e}" data-act="${s}" title="${n}">${i}</a>`}(l,e.visible),b=o?function(e){const t=Ad("moreActions");return`<a class="more-actions" data-plot-id="${e}" data-act="Menu" title="Actions">${t}</a>`}(l):"",E=pd(a)&&e.type===f.Symbol,L=(g||E)&&(!s||e.values.length>1),M=e=>L?e.abbreviation:"Close"===e.id&&r?d+" ":null,_=t?p.map(e=>Pd(M(e),e.value,e.color)).join(" ")+function(e){if(e&&e.length){return`Event ${e.map(e=>Pd(`${e.field.name} (${ld(fd,e.date)})`,e.value,e.color)).join(" ")}`}return""}(m):"",x=e=>`<div class="box" style="background-color:${e.color}"></div>`,I=!g&&"Expression"!==T,D=p.slice(0,I?p.length:1).map(x).join(""),O=t?"":D,w="Name"===y.mainTitle?c:d,R=n?e.visible&&t?"":`${d}`:`${w}`;let N=s&&E?`${d} (${R})`:R;y.showMainTitle||(N="");const V=()=>{const e=a.data?.aggregation.toShortString(),t=a.data?.aggregation.describe();return`<span class="value-main" title="${t}">·${e}·</span>`},H=e.isMain?V():"";return`\n <div class="plot">\n ${P} ${C} ${b} ${O}\n <a class="${S}" ${A?`title="${A}" `:""}data-plot-id="${l}">${N}</a>\n ${H} ${_}\n </div>\n `.trim()}(t,o,m,n,l,c,u,e)),A=`${g}${y.join("")}`,S=function(e,t){const i=e>0,s=e<t-1;return[`${i?Sd(!0,e):""}`,`${s?Sd(!1,e):""}`].join(" ").trim()}(d,t.length);return{id:`bc-tip-${h.id.substring(0,8)}`,isMainPane:m,content:A,moveContent:S,bounds:h.bounds}})}function yd(e){return`bchart-icon-${e}`}function Ad(e,t=null,i=10){return`<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="${i}px" height="${i}px" ${ie(t)?`style="fill:${t}"`:""}><use xlink:href="#${yd(e)}"></use></svg>`}function Sd(e,t){const i=e?"Up":"Down";return`<span data-pane="${t}" data-dir="${i}" title="Move ${i}" class="move-pane">${Ad(`chevron${i}`)}</span>`}function Td(e,t,i=null,s=[]){"string"==typeof s&&(s=s.split(" "));const n="string"==typeof i?` style="color: ${i}"`:"";return`\n <tr class="${["value-row",...s].join(" ")}">\n <td class="field-name">${e}</td>\n <td${n} class="field-value">${t}</td>\n </tr>\n `}function vd(e,t,i=null){return Td(e,t,i,"value-title")}function Pd(e,t,i){const s="string"==typeof i?` style="color: ${i}"`:"";return`${ie(e)?`<span class="field-name">${e}</span>`:""}<span${s} class="field-value">${t}</span>`}function Cd(e){return`<a class="delete-plot" data-plot-id="${e}" title="Delete plot">${Ad("delete")}</a>`}function bd(e,t,i,s,n,r){const a=function(e,t){const i=e.data.aggregation,s=e.display.xAxis,n=s.isOrdinal,r=te(n)&&n,o=r?s.ordinalName??"Value":"Date";return{date:r?td(t):ld(i,t),time:i.isEndOfDay||r?null:cd(i,t,!1),isMultiSymbol:_d(e),isMultiContract:i.isMultiContract,dateFieldName:o}}(e,t);a.offset=i,a.lastBarRefresh=!1,a.chartId=e.elementId;const l=i=>i.axes.map(e=>e.plots).flat().filter(t=>!n||t===e.mainPlot).map(i=>function(e,t,i,{isMultiContract:s},n){const r=n.isStudy;if(!n.timeSeries.hasData)return null;const a=n.timeSeries.container;n.type,f.Expression;const l=n.axis.comparison!==d.None,c=n.axis.comparison===d.Percent,u=(e,s)=>n.customPlotValues&&s!==Ka.DateTime?[n.getValueAt(s,t,i),0]:Ld(e,s,t,l),h=n,p=r?`${Gr(h.model.study).meta.title} ${h.fullParams}`:n.metaData.name||"",m={isMain:n.main,type:n.type,typeName:f[n.type],name:n.title,description:p,exchange:n.metaData.exchange||"",error:h.errorText,id:n.id,visible:n.visible};if(ie(h.yearOffset)&&0!=h.yearOffset){const i=e.data.aggregation,s=function(e,t){return Ke(2,arguments),lt(e,-je(t))}(t,h.yearOffset);m.unalignedDate=ld(i,s)}const g=n.curves[0];s&&n.type===f.Symbol&&a.hasField(Ka.Symbol)&&(t.valueOf()===gs.ZERO_DATE.valueOf()?m.name=n.timeSeries.container?.getLastDataPoint(Ka.Symbol):m.name=u(g,Ka.Symbol)[0]);const y={},A={range:n.axis.yScale.domain(),allDigits:!0};Md(n,e,A);const S=(e,t)=>{const i=(t===Ka.Change||t===Ka.PercentChange)&&e>0?"+":"";return c?i+id(e):i+n.metaData.format(e,t,A)},T=pd(e),v=/* @__PURE__ */new Set;return m.values=n.curves.filter(e=>e.visible).map(e=>(!n.main&&n.isSymbol&&T?$u:e.fields).map(t=>{if(v.has(t))return null;v.add(t);const[i,s]=u(e,t),a=n.axis.yScale.priceToY(i);y[t.id]=!0;const l=n.customPlotValues?h.getColorOf(t):e.getColor(s,e.style!==o.HollowCandles,t);let c=S(i,t).trim();if(ie(i)&&t===Ka.Change){const[t]=u(e,Ka.PercentChange);ie(t)&&(c+=` (${S(t,Ka.PercentChange)})`)}return{abbreviation:xd(t),shortName:t.shortName,id:t.id,name:t.name,longName:`${t.shortName} ${r?h.params:""}`.trim(),color:Sn(l),val:i,y:a,value:c}}).filter(e=>null!==e)).flat(),m.events=n.findEvents(u(g,Ka.DateTime)).filter(e=>e.field!==Ka.Custom),m}(e,t,r,a,i)).filter(e=>null!==e);return a.panes=e.panes.map(e=>({bounds:Ed(e),id:e.id,plots:l(e)})),a}function Ed(e){const t=e.getBounds();if(!ie(t))return;const{x:i,y:s,width:n,height:r}=t,{leftOffset:o,rightOffset:a}=e.presenter.view;return{top:s,left:i+o,right:a,bottom:s+r,width:n,height:r}}function Ld(e,t,i,s=!1){const n=e.plot,r=n.timeSeries.container,o=n.axis.pane.presenter.timeline,a=G(o,+i,Number,ud),l=o.at(a-e.shift);if(null===l)return[null,0];const c=r.getTimeData(),u=G(c,+l,Number);return[!c[u]||c[u].getTime()!==l.getTime()?null:e.dataAt(t,u,!s),u]}function Md(e,t,i){ie(e.precision)?i.overridePrecision=e.precision:e.isStudy&&ie(t.mainPlot?.precision)&&!ie(Gr(e.model.study).meta.decimals)&&(i.overridePrecision=t.mainPlot.precision)}function _d(e){const t=e.mainPlot.symbol;return e.allPlots.some(e=>e.type===f.Symbol&&e.symbol!==t)}function xd(e){return e.id===Ka.Change.id?"Δ":e.id.substring(0,1)}class Id{plot;id;fields=[];colors=[];style=o.Line;attributes=[];zones;_shift=0;lineWidth=1;lineMarker;lineSmoothing;dashStyle="Solid";varyColorPerBar=!1;visible=!0;_zoneColors;constructor(){this.id=Pe(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=ie(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(Ka.Close)}get name(){return this.isOhlc?"":this.fields[0].name}get isHeikinAshiStyle(){return this.style===o.HeikinAshi}get isCandle(){return this.style===o.Candlestick||this.style===o.HollowCandles||this.style===o.HeikinAshi}get isHollowCandles(){return this.style===o.HollowCandles}get isElderImpulseSystemStyle(){return this.style===o.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===o.PercentChange}get isOhlcStyle(){return this.style===o.OHLC}get isHlcStyle(){return this.style===o.HLC}get isRangeStyle(){return this.style===o.Range}get isRenko(){return this.style===o.Renko}get isKagi(){return this.style===o.Kagi}get isPointAndFigure(){return this.style===o.PointAndFigure}get isLineBreak(){return this.style===o.LineBreak}get isBaseline(){return this.style===o.Baseline}get isLineLike(){return[o.Line,o.Area,o.Baseline,o.PercentChange].includes(this.style)}get isColumn(){return this.style===o.Column}get isMultiColumn(){return this.style===o.MultiColumn}get isStackedColumn(){return this.style===o.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=>r[e])),this.colors=e.colors,this.fields=e.fields.map(e=>Ka[e]),this.style=o[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){const s=!this.plot.isComparison(d.None),n=e===Ka.PercentChange,r=e===Ka.Change,o=n||(!i||s)&&r,a=this.timeSeries.container.hasField(Ka.Last)?Ka.Last:Ka.Close,l=o?a:e,u=(e,t)=>{const i=this.timeSeries.container.getData(e)[t];return e.type!==c.Number?i:this.plot.priceMapper(i,t,e)},h=u(l,t);if(!o)return h;if(t<=1)return 0;const p=u(l,t-1),f=h-p;return n?0===p?0:f/p:f}timeSeriesAt(e){const 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(){const e=this.view.xAxis.xScale;if(!ie(e.extent()))return null;return 0!==this.shift?e.extent().map(t=>e.timeline.at(t-this.shift)):e.domain()}get yScale(){return this.plot?.yScale??this.axis.yScale}getCore(){const e=this.timeSeries;if(!e.hasData||!this.visible)return null;const t=this.view.xAxis.xScale.extent();if(!ie(t))return null;const i=this.yScale.domain();if(!ie(i))return null;return{ts:e,extent:t,domain:i,range:this.yScale.range()}}drawHover(e,t,i){if(!this.isLineLike)return;if(null===this.getCore())return;const[s,n]=Ld(this,this.pickMainField(),t);if(!ie(s))return;e.save(),_n(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=Sn(this.getColor(n)),e.beginPath();Yd(e,i,this.priceToY(s),this.lineMarker??"Circle",1.3333),e.fill(),e.restore()}draw(e){const t=this.getCore();if(null===t)return;const{ts:i,extent:s,domain:n,range:r}=t;e.save(),e.setLineDash([]);const a=i.container.getTimeData(),l=this.shiftedTimeDomain[0],c={bar:this.view.xAxis.xScale.bar,domain:n,range:r,slice:s,start:G(a,+l,Number)||0},u=ie(this.zones);this.isOhlc?Gd.call(this,e,c):this.isRenko||this.isLineBreak?Bd.call(this,e,c):this.style===o.Ribbon?this.varyColorPerBar?ep.call(this,e,c):Qd.call(this,e,c,this.colors[0]):this.style===o.Area?u?Nd.call(this,e,c,Od,!0):Od.call(this,e,c,this.colors,!0):this.isColumn||this.isMultiColumn?u?Nd.call(this,e,c,kd,!0):kd.call(this,e,{...c,range:[null,null]}):this.isStackedColumn?Fd.call(this,e,c):this.isBaseline?Hd.call(this,e,c):this.style===o.Step?u?Nd.call(this,e,c,Ud):Ud.call(this,e,c,this.colors[0]):this.isKagi?Zd.call(this,e,c):this.isPointAndFigure?Jd.call(this,e,c):this.style===o.Dots?Wd.call(this,e,c):this.style===o.Line||this.isPercentChangeStyle?u?Nd.call(this,e,c,jd):this.varyColorPerBar?qd.call(this,e,c):jd.call(this,e,c):Hv(`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(Ka.Last)?Ka.Last:this.fields.includes(Ka.Close)?Ka.Close:this.fields[0]}get zoneColors(){if(!ie(this._zoneColors)){const 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?Sn(e[0]):e[1]}getComputedColor(e){if(!this.timeSeries.container.hasField(Ka.BARCOLIX))return null;const t=this.dataAt(Ka.BARCOLIX,e);return t>=0&&t<this.colors.length?this.colors[t]:null}getColor(e,t=!0,i=null){if(this.varyColorPerBar){const i={};if(this.isOhlc||this.isRenko||this.isLineBreak){const t=this.dataAt(Ka.Open,e),s=this.dataAt(Ka.High,e),n=this.dataAt(Ka.Low,e),r=this.dataAt(Ka.Close,e),o=this.dataAt(Ka.Change,e);i.open=t,i.high=s,i.low=n,i.close=r,i.change=o}else if(this.plot.isStudy&&!["VOL","MAVOL"].includes(this.plot.model.study)){const t=this.pickMainField(),s=this.dataAt(t,e-1),n=this.dataAt(t,e),r=ie(s),o=ie(n);i.change=r?o?n-s:-1:o?1:0}else{const t=this.plot.axis.pane.presenter.data.aggregation;t.isTick&&t.spec===l.None||(i.open=this.dataAt(Ka.Open,e),i.close=this.dataAt(Ka.Close,e)),i.change=this.dataAt(Ka.Change,e)}let s;const n=function(e,{open:t,close:i,change:s},n){const r=n.length>2&&e!==o.HLC,a=ie(t,i),l=a&&i>t,c=a&&i===t,u=s>0,h=0===s;return{useSame:r,isUp:l,isSame:c,isUpPrev:u,isSamePrev:h,isDown:!l&&!c,isDownPrev:!u&&!h}}(this.style,i,this.colors),a=this.getComputedColor(e);switch(this.style){case o.Candlestick:case o.Renko:case o.LineBreak:case o.Range:case o.HeikinAshi:case o.OHLC:case o.HLC:case o.Column:{if(ie(a)){s=a;break}let t=n.useSame?n.isUp:n.isUp||n.isSame,i=n.isSame;const o=this.attributes||[],l=this.plot.isStudy&&!["HASMO","VOL","MAVOL"].includes(this.plot.model.study);if((o.includes(r.ChangeBased)||l)&&(t=n.useSame?n.isUpPrev:n.isUpPrev||n.isSamePrev,i=n.isSamePrev),s=this.colors[t?1:0],n.useSame&&i&&(s=this.colors[2]),this.isRenko||this.isLineBreak||this.isRangeStyle){1===this.dataAt(Ka.Projection,e)&&(s=Pn(.5,!0)(s))}break}case o.ElderImpulseSystem:s=this.colors[this.dataAt(Ka.BREL,e)];break;case o.HollowCandles:{const e=this.colors[n.isUpPrev||n.isSamePrev?1:0];s=t&&(n.isUp||n.isSame)?gs.COLOR_TRANSPARENT:e;break}case o.Line:case o.PercentChange:case o.Ribbon:case o.Kagi:if(ie(a)){s=a;break}s=this.colors[0];break;case o.PointAndFigure:{const t=Sh(this.dataAt(Ka.BARKIND,e))?1:0;s=this.colors[t];break}default:throw new Error(`Unexpected style ${o[this.style]} for a curve with varying colors`)}return ie(s)||(s=this.colors[0]),s}if(this.zones){const t=this.pickMainField(),i=this.dataAt(t,e),s=this.getColorsFromZone(i);return this.style===o.Area?this.pickAreaStroke(s):s.length>0?s[0]:this.colors[0]}{const e=e=>e===i;return(this.isMultiColumn||this.isStackedColumn)&&ie(i)?this.colors[function(e,t){return Math.min(Math.max(t,0),e.length-1)}(this.colors,this.fields.findIndex(e))]:this.colors[0]}}}function Dd([e,t],i,s){let n=i;const r=this.timeSeries.container.size;for(let o=e;o<=t;o++){for(;this.timeSeriesAt(n)<this.timelineAt(o-this.shift)&&n<r;)++n;if(n===r)break;const e=this.timeSeriesAt(n)>this.timelineAt(o-this.shift);s.call(this,n,e)}}function Od(e,t,i,s=!1){jd.call(this,e,t,this.pickAreaStroke(i)),tp.call(this,e,t,i[0],s)}function wd(e,t){const i=ie(e),s=ie(t);let n,r;const o=this.pane.getBounds();if(i)if(s){const i=this.priceToY(e),s=this.priceToY(t);n=(i+s)/2,r=new xn(o.x,s,o.width,i-s)}else n=this.priceToY(e),r=new xn(o.x,o.y,o.width,n-o.y);else n=this.priceToY(t),r=new xn(o.x,n,o.width,o.y+o.height-n);return[n,r]}const Rd=(e,t)=>{const i=Pn(.6)(e),s=Cn(.6)(e),n="linLighten"===t;return[n?s:i,e,n?i:s]};function Nd(e,t,i,s=!1,n){let r;this.zones.forEach((o,a)=>{const l=o.value,[c,u]=wd.call(this,r,l);e.save(),_n(e,u),s&&(t.range=[null,c]);let h=this.zoneColors[a];if(o.gradient){const t=Rd(h,o.gradient),i=e.createLinearGradient(0,u.y,0,u.y+u.height);i.addColorStop(0,t[0]),i.addColorStop(.5,t[1]),i.addColorStop(1,t[2]),h=i}else ie(n)&&(h=n(a,h));i.call(this,e,t,h),e.restore(),r=l})}function Vd(e,t){const{x:i,width:s}=this.pane.getBoundsWithoutScales();e.save(),e.lineWidth=1,e.strokeStyle="#888",e.setLineDash(An("dot")),$n(e,t,i,i+s),e.restore()}function Hd(e,t){const[i,s]=t.range,{baseLevel:n}=function(e){const{BaseLevel:t}=fe(e);return{baseLevel:Number.isFinite(t)?Ce(0,100,t):50}}(this.plot.inputs),r=(i-s)*n/100+s;this.zones[0].value=this.yToPrice(r),Vd.call(this,e,r);Nd.call(this,e,t,Od,!0,(t,n)=>{const o=1===t,a=Tn(n,0),l=e.createLinearGradient(0,o?i:s,0,r);return l.addColorStop(0,n),l.addColorStop(1,a),[l,Tn(n,1)]})}function Bd(e,{bar:t,slice:i,start:s}){let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;Dd.call(this,i,s,(i,s)=>{if(!s){const[s,r]=[Ka.Open,Ka.Close].map(e=>this.dataAt(e,i)).map(this.priceToY,this),o=Math.floor(t.totalWidth/2);e.fillStyle=this.getColor(i),e.beginPath(),e.rect(n-o,s,t.totalWidth,r-s),e.fill()}n+=t.totalWidth})}function Fd(e,{bar:t,slice:i,start:s}){if(!this.isFirstVisibleOfStyle())return!1;let n=this.view.xAxis.xScale.range()[0]+t.offset;const r=Kn();r.prolog(e);const o=this.plot.curves.filter(e=>e.isStackedColumn);Dd.call(this,i,s,(i,s)=>{if(!s){let s=this.priceToY(0),a=0;o.forEach(o=>{if(!o.visible)return;const l=o.fields[0];if(a+=this.dataAt(l,i),ie(a)){const c=this.priceToY(a);e.fillStyle=o.getColor(i,!1,l),e.beginPath(),e.rect(r.adjust(n),r.adjust(c),r.adjust(t.width),r.adjust(s-c)),e.fill(),s=c}})}n+=t.totalWidth}),r.epilog(e)}function kd(e,{bar:t,slice:i,start:s,range:[n,r]}){let o=this.view.xAxis.xScale.range()[0]+t.offset;const a=this.isMultiColumn,l=a?this.fields:[this.pickMainField()],c=t.width/(a?l.length:1),u=Kn();u.prolog(e),Dd.call(this,i,s,(i,s)=>{s||l.forEach((t,s)=>{const n=this.dataAt(t,i);if(ie(n)){ie(r)||(r=this.priceToY(0));const a=this.priceToY(n);e.fillStyle=this.getColor(i,!1,t),e.beginPath(),e.rect(u.adjust(o+s*c),u.adjust(a),u.adjust(c),u.adjust(r-a)),e.fill()}}),o+=t.totalWidth}),u.epilog(e)}function Wd(e,{bar:t,slice:i,start:s}){let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;e.fillStyle=this.getColor(0);const r=Math.max(1,this.lineWidth||gs.CURVE_STYLE_DOTS_RADIUS),o=2*Math.PI;e.beginPath(),Dd.call(this,i,s,(i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(ie(s)){const t=this.priceToY(s);e.moveTo(n+r,t),e.arc(n,t,r,0,o)}}n+=t.totalWidth}),e.fill()}function Ud(e,{bar:t,slice:i,start:s},n){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;const o=Kn();o.prolog(e),e.strokeStyle=n,e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(An(this.dashStyle)),e.beginPath();let a=!1,l=null;Dd.call(this,i,s,(i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(ie(s)){const n=this.priceToY(s);if(a)e.lineTo(r,l),e.lineTo(r,n);else{const s=this.dataAt(t,i-1);if(ie(s)){const t=this.priceToY(s);e.moveTo(-1,t),e.lineTo(r,t),e.lineTo(r,n)}else e.moveTo(r,n);a=!0}l=n}}r+=t.totalWidth}),e.stroke(),o.epilog(e)}const $d=[Ka.Open,Ka.High,Ka.Low,Ka.Close];function Gd(e,{bar:t,slice:i,start:s}){const n=this.presenter.display.chart.showMinMaxArc;let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;const o=Kn();o.prolog(e);let a=null,l=null,c=null,u=null;const h=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:[n,r,o,a],color:l,outlineColor:c,wickColor:u,isMin:h,isMax:d},p){const f=s/2;e.lineWidth=p,e.fillStyle=l,e.strokeStyle=c||l,e.beginPath(),e.rect(i(t-f),n,s,i(a-n)),e.fill(),e.stroke(),e.strokeStyle=u||c||l,e.beginPath(),e.moveTo(t,Math.min(a,n)),e.lineTo(t,r),e.moveTo(t,Math.max(a,n)),e.lineTo(t,o),e.stroke();const m=0===bn(l).a;e.strokeStyle=m?c:l,zd(e,h,d,t,o,r,f)}(e,t,this.lineWidth)):(this.isOhlcStyle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&function(e,{x:t,adjust:i,width:s,y:[n,r,o,a],color:l,isMin:c,isMax:u},h,d){const p=s/2;e.lineWidth=h,e.strokeStyle=l,e.beginPath(),e.moveTo(t,o),e.lineTo(t,r),d&&(e.moveTo(i(t-p),n),e.lineTo(t,n));e.moveTo(i(t+p),a),e.lineTo(t,a),e.stroke(),zd(e,c,u,t,o,r,p)}(e,t,this.lineWidth,!this.isHlcStyle)};Dd.call(this,i,s,(e,i)=>{if(!i){const i=$d.map(t=>this.dataAt(t,e)),[s,n,d,p]=i;if(ie(s,n,d,p)){const f={x:o.adjust(r),adjust:o.adjust,width:t.width,y:[s,n,d,p].map(this.priceToY,this).map(o.adjust),isMin:!1,isMax:!1,ix:e,color:this.getColor(e)},m=Math.min(...i),g=Math.max(...i);(!ie(a)||m<a)&&(a=m,c=f),(!ie(l)||g>l)&&(l=g,u=f),h(f)}}r+=t.totalWidth}),n&&(ie(c)&&(c.isMin=!0,h(c)),ie(u)&&(u.isMax=!0,h(u))),o.epilog(e)}function zd(e,t,i,s,n,r,o,a=3){t&&kn(e,{x:s,y:n+a},o,0,Math.PI),i&&kn(e,{x:s,y:r-a},o,0,Math.PI,!0)}function Yd(e,t,i,s,n=1){const r=gs.MARKER_SIZE*n,o=1.25*r;switch(s){case"Circle":e.moveTo(t+r,i),e.arc(t,i,r,0,2*Math.PI);break;case"Square":e.rect(t-r,i-r,2*r,2*r);break;case"TriangleUp":e.moveTo(t-o,i+o),e.lineTo(t+o,i+o),e.lineTo(t,i-o),e.lineTo(t-o,i+o);break;case"TriangleDown":e.moveTo(t-o,i-o),e.lineTo(t+o,i-o),e.lineTo(t,i+o),e.lineTo(t-o,i-o);break;case"Diamond":e.moveTo(t,i-o),e.lineTo(t+o,i),e.lineTo(t,i+o),e.lineTo(t-o,i),e.lineTo(t,i-o)}}function jd(e,{bar:t,slice:i,start:s},n=null){const r=n||this.getColor(0),o=te(this.lineMarker);o&&(e.fillStyle=r,e.beginPath());let a=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;const l=[],c=this.pickMainField();Dd.call(this,i,s,(i,s)=>{if(!s){const t=this.dataAt(c,i);if(ie(t)){const i=this.priceToY(t);o&&Yd(e,a,i,this.lineMarker),l.push({x:a,y:i})}}a+=t.totalWidth}),o&&e.fill(),e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(An(this.dashStyle)),te(this.lineSmoothing)?function(e,t,i,s){if(t.length<2)return;const n=function(e,t){const i=[];for(let s=0;s<e.length-1;s++){const n=e[s-1]||e[s],r=e[s],o=e[s+1],a=e[s+2]||o,l=r.x+(o.x-n.x)/t,c=r.y+(o.y-n.y)/t,u=o.x-(a.x-r.x)/t,h=o.y-(a.y-r.y)/t;i.push({cp1x:l,cp1y:c,cp2x:u,cp2y:h,x:o.x,y:o.y})}return i}(t,s);e.beginPath(),e.strokeStyle=i,e.moveTo(t[0].x,t[0].y);for(const r of n)e.bezierCurveTo(r.cp1x,r.cp1y,r.cp2x,r.cp2y,r.x,r.y);e.stroke()}(e,l,r,this.lineSmoothing):Kd(e,l,r)}function Kd(e,t,i){if(t.length>1){e.beginPath(),e.strokeStyle=i;const s=t[0];e.moveTo(s.x,s.y);for(let i=1;i<t.length;i++){const s=t[i];e.lineTo(s.x,s.y)}e.stroke()}}function qd(e,{bar:t,slice:i,start:s}){e.lineWidth=this.lineWidth,e.lineCap="square",this.dashStyle&&e.setLineDash(An(this.dashStyle));let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,r=null,o=null,a=[];Dd.call(this,i,s,(i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(ie(s)){const t=this.priceToY(s);o=this.getColor(i),r!==o&&(Kd(e,a,r),a.length>0&&(a=[a.pop()]),r=o),a.push({x:n,y:t})}}n+=t.totalWidth}),Kd(e,a,o)}const Xd=[null,null,null,null];function Zd(e,{bar:t,slice:i,start:s}){e.lineWidth=Math.max(1,.5*t.width),e.lineJoin="miter",e.miterLimit=1.5;let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;const r=Kn();r.prolog(e);let o=null,a=null,l=[];Dd.call(this,i,s,(i,s)=>{if(!s){const s=e=>$d.map(t=>this.dataAt(t,e)),[c,u,h,d]=s(i),[,p,f]=i<0?Xd:s(i-1);if(ie(c,u,h,d)){const s=r.adjust(n),m=r.adjust(n-t.totalWidth),g=[c,u,h,d].map(this.priceToY,this).map(r.adjust),y=r.adjust(this.priceToY(u>p?p:f));a=this.getColor(i);const A=ie(o)&&o!==a,S=c===u?1:2,T=c===u?2:1;l.push({x:m,y:g[0]}),l.push({x:s,y:g[S]}),A&&(l.push({x:s,y:y}),Kd(e,l,o),l=[]),A&&l.push({x:s,y:y}),l.push({x:s,y:g[T]}),o=a}}n+=t.totalWidth}),Kd(e,l,a),r.epilog(e)}function Jd(e,{bar:t,slice:i,start:s}){const n=this.view.xAxis.xScale.range()[0],r=t.totalWidth/2;let o=n+t.offset+t.width/2;const a=Kn();a.prolog(e);const l=this.plot.timeSeries.builder.boxSize,c=l/2;Dd.call(this,i,s,(i,s)=>{if(!s){const[t,s]=[Ka.High,Ka.Low].map(e=>this.dataAt(e,i)),n=this.colors[0],u=this.colors[1],h=this.dataAt(Ka.BARKIND,i),d=Sh(h),p=h===gs.BARKIND_XO,f=h===gs.BARKIND_OX;if(ie(t,s))for(let i=t;i>=s;i-=l){const l=a.adjust(o),[h,m]=[l-r,l+r],[g,y,A]=[i,i-c,i+c].map(e=>this.priceToY(e)),S=i===t&&p||i===s&&f?!d:d;e.beginPath(),S?(e.strokeStyle=u,e.moveTo(h,y),e.lineTo(m,A),e.moveTo(h,A),e.lineTo(m,y)):(e.strokeStyle=n,e.ellipse(l,g,r,y-g,0,0,2*Math.PI)),e.stroke()}}o+=t.totalWidth}),a.epilog(e)}function Qd(e,{bar:t,slice:i,start:s},n){e.fillStyle=n;const[r,o]=this.fields;let a=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;const l=[];if(Dd.call(this,i,s,(e,i)=>{if(!i){const t=this.dataAt(r,e),i=this.dataAt(o,e);ie(t,i)&&l.push({x:a,upY:this.priceToY(t),downY:this.priceToY(i)})}a+=t.totalWidth}),l.length>0){e.beginPath(),e.moveTo(l[0].x,l[0].upY);for(let i=1;i<l.length;++i)e.lineTo(l[i].x,l[i].upY);const 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 ep(e,{bar:t,slice:i,start:s}){const[n,r]=this.fields;let o=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,a=[];const l=t=>{if(a.length>1){e.beginPath(),e.fillStyle=t,e.moveTo(a[0].x,a[0].upY);for(let t=1;t<a.length;++t)e.lineTo(a[t].x,a[t].upY);const i=a.length-1;e.lineTo(a[i].x,a[i].downY);for(let t=i-1;t>=0;--t)e.lineTo(a[t].x,a[t].downY);e.closePath(),e.fill()}};let c=null,u=null;Dd.call(this,i,s,(e,i)=>{if(!i){const t=this.dataAt(n,e),i=this.dataAt(r,e);if(ie(t,i)){const s=this.priceToY(t),n=this.priceToY(i);u=this.getColor(e),c!==u&&(l(c),a.length>0&&(a=[a.pop()]),c=u),a.push({x:o,upY:s,downY:n})}}o+=t.totalWidth}),l(u)}function tp(e,{bar:t,slice:i,start:s,range:[n,r]},o,a){if(a){const t=e.createLinearGradient(0,n,0,r);t.addColorStop(0,o),t.addColorStop(1,Tn(o,0)),e.fillStyle=t}else e.fillStyle=o;e.beginPath();let l=null;const c=this.pickMainField();let u=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,h=!1,d=null;Dd.call(this,i,s,(i,s)=>{if(!s){const t=this.dataAt(c,i);if(ie(t)){const i=this.priceToY(t);h?e.lineTo(u,i):(e.moveTo(l=u,i),h=!0),d=u}}u+=t.totalWidth}),e.lineTo(d,r),e.lineTo(l,r),e.closePath(),e.fill()}class ip{symbol;aggregation;range;seriesKind;cacheMe;barsToFetch;offset;chartId;curveStyle;extendedHours;fields=[];alwaysUseBarsToFetch;inputs=[];splits;padded;constructor(e,t,i=m.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(!ie(this.curveStyle)||!gs.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return"Standard";switch(this.curveStyle){case o.Renko:{const{method:e,period:t,source:i,brickSize:s}=Du(this.inputs);return`Renko;${"ATR"===e?`ATR;${t}`:`${e};${s}`};${i}`}case o.Kagi:{const{method:e,period:t,reversal:i}=uh(this.inputs);return`Kagi;${"ATR"===e?`ATR;${t}`:`User;${i}`}`}case o.PointAndFigure:{const e=Th(this.inputs),{method:t,period:i,reversal:s,boxSize:n,source:r,oneStepBack:o}=e;return`PointAndFigure;${"ATR"===t?`ATR;${i}`:`User;${n}`};${r};${s};${o}`}case o.LineBreak:{const{lineBreak:e}=dh(this.inputs);return`LineBreak;${e}`}default:return o[this.curveStyle]}}get needsExtraKey(){return[m.Options,m.BalanceSheet,m.IncomeStatement].includes(this.seriesKind)}getExtraKey(){return this.needsExtraKey&&this.fields.length>0?`${this.fields.map(e=>e.id).join(";")}`:""}getHashKey(){const 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(){const e=new ip(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=ue(this.fields),e.splits=this.splits,e.padded=this.padded,e}}var sp,np={exports:{}},rp=np.exports;var op=(sp||(sp=1,function(e,t){var i,s;i="object"==typeof window&&window||rp||Ve,s={},i.PubSub?(s=i.PubSub,console.warn("PubSub already loaded, using existing version")):(i.PubSub=s,function(e){var t={},i=-1,s="*";function n(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function r(e){return function(){throw e}}function o(e,t,i){try{e(t,i)}catch(s){setTimeout(r(s),0)}}function a(e,t,i){e(t,i)}function l(e,i,s,n){var r,l=t[i],c=n?a:o;if(Object.prototype.hasOwnProperty.call(t,i))for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&c(l[r],e,s)}function c(e,t,i){return function(){var n=String(e),r=n.lastIndexOf(".");for(l(e,e,t,i);-1!==r;)r=(n=n.substr(0,r)).lastIndexOf("."),l(e,n,t,i);l(e,s,t,i)}}function u(e){var i=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,i)&&n(t[i]))}function h(e){for(var t=String(e),i=u(t)||u(s),n=t.lastIndexOf(".");!i&&-1!==n;)n=(t=t.substr(0,n)).lastIndexOf("."),i=u(t);return i}function d(e,t,i,s){var n=c(e="symbol"==typeof e?e.toString():e,t,s);return!!h(e)&&(!0===i?n():setTimeout(n,0),!0)}e.publish=function(t,i){return d(t,i,!1,e.immediateExceptions)},e.publishSync=function(t,i){return d(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 n="uid_"+String(++i);return t[e][n]=s,n},e.subscribeAll=function(t){return e.subscribe(s,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,n=0;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)){for(s in t[i])n++;break}return n},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,n,r,o=function(e){var i;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e))return!0;return!1},a="string"==typeof i&&(Object.prototype.hasOwnProperty.call(t,i)||o(i)),l=!a&&"string"==typeof i,c="function"==typeof i,u=!1;if(!a){for(s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(n=t[s],l&&n[i]){delete n[i],u=i;break}if(c)for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&n[r]===i&&(delete n[r],u=!0)}return u}e.clearSubscriptions(i)}}(s)),void 0!==e&&e.exports&&(t=e.exports=s),t.PubSub=s,e.exports=t=s}(np,np.exports)),np.exports);const ap=/* @__PURE__ */He(op);function lp(e,t){const i=e.query?.duplicate();if(ie(i)&&i.symbol!==gs.PLACEHOLDER_SYMBOL_NAME&&"Standard"===i.getBuilderKey()){0!==i.barsToFetch&&(i.barsToFetch=i.barsToFetch*gs.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);const e=t(i);return e.serverComputedSeries=!0,e}return new bh}function cp(e){return new Ga(e,c.Number,h.Study,e)}class up{calcCtx;container;_source;target;inputs;outFields;studyFields={};innerSeries;calculable=!0;useNotifications=!1;initialNotification=!1;computedServerSide=!1;id;usedAsStyle=!1;recalcTriggers=/* @__PURE__ */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=Pe(),this.addRecalcTrigger(...t)}refresh(){}get canLoadMoreData(){return this._canLoadMoreData}set canLoadMoreData(e){this._canLoadMoreData=e}loadMoreData(e){throw new Error("Should not be called.")}addInner(...e){this.innerSeries.push(...e),this.addRecalcTrigger(...e)}isCalculable(e){return e.calculable??!1}addRecalcTrigger(...e){for(const t of e)this.isCalculable(t)?t.recalcTriggers.forEach(e=>this.recalcTriggers.add(e)):this.recalcTriggers.add(t)}setOptions(e){pe(this,e);const t=e.outFields??[e.target];this.studyFields=this.helpers.concat(t).reduce((e,t)=>(e[t.id]=t,e),{})}get helpers(){return gs.EMPTY_ARRAY}get hasData(){return null!==this.container}get source(){if(ie(this._source))return this._source;const e=ie(this.inputs)?this.inputs[gs.INPUT_SOURCE]:null;return ie(e)?Ka[e]:null}set source(e){this._source=e}async ready(){return ps.call(this,async()=>{this.basisChangedToken=this.useNotifications?ap.subscribe(qa.TS_ALL,this.onBasisChanged.bind(this)):null;const e={tag:Pe(),src:null},t=(await Promise.all(this.innerSeries.map(e=>e.ready()))).every(I);return t&&this.calculate(e),t})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===qa.TS_EVENTSCHANGED||e===qa.TS_LOADING||this.innerSeries.some(e=>!e.hasData))return;if(!this.shouldTriggerOurRecalc(t.series)||null===this.base||this===t.series)return;const i={tag:Pe(),src:t.series};switch(e){case qa.TS_MANYCHANGED:this.calculate(i);break;case qa.TS_DATAPOINTCHANGED:case qa.TS_DATAPOINTADDED:{const s=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(i,s,e===qa.TS_DATAPOINTADDED);break}case qa.TS_TIMELINECORRECTION:case qa.TS_QUOTEMARKER:break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.useNotifications&&this.basisChangedToken&&ap.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){const i=this.calculateAt(e);if(null!==i){Object.keys(i).forEach(e=>{const s=i[e],n=this.studyFields[e];t?this.container.addDataPoint(n,s):this.container.setLastDataPoint(n,s)})}}notify(e,t){J(e,{series:this,index:t})}calculateCommon(e,t=null,i=-1,s=!0){const n=-1===i,r=n?t=>{!ie(e.src)&&ie(t.calcCtx)||t.calculate(e)}:t=>t.recalculateAt(e,i,s);if(null===this.base)return;if(this.calcCtx&&this.calcCtx.tag===e.tag||this===e.src)return;this.calcCtx=e;if(this.innerSeries.filter(e=>this.isCalculable(e)&&!e.usedAsStyle).forEach(e=>r(e)),n&&(this.container=this.makeContainer()),void 0!==this.calculateAt)if(n){const e=this.base.size;for(let t=0;t<e;++t)this.calculateDataPoint(t,!0)}else this.calculateDataPoint(i,s);t&&(ie(e.src)||this.initialNotification)&&this.notify(t,i)}calculate(e){this.calculateCommon(e,qa.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,i){this.computedServerSide||(!i&&te(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,i?qa.TS_DATAPOINTADDED:qa.TS_DATAPOINTCHANGED,t,i))}baseVal(e,t){return this.base.getData(e)[t]}innCont(e){return this.innerSeries[e].container}innVal(e,t,i){const s=this.innCont(e),n=s.size;return i<0||i>n-1?null:s.getData(t)[i]}innHasData(e){const t=this.innCont(e);return ie(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(Ka.DateTime,Ka.Symbol)}makeContainer(){const e=this.defaultWrappers.concat(this.getWrappers()),t=Object.keys(this.studyFields).map(e=>this.studyFields[e],this);return new xu(t,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 hp extends up{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 dp extends hp{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){const[t,i,s,n]=[Ka.Open,Ka.High,Ka.Low,Ka.Close].map(t=>this.baseVal(t,e),this);let r=null,o=null,a=null,l=null;const c=w([t,i,s,n]);if(e<1)r=w([t,n]),o=i,a=s,l=0;else{const[t,n]=[Ka.Open,Ka.Close].map(t=>this.container.getData(t)[e-1],this);r=w([t,n]),o=Math.max(i,r,c),a=Math.min(s,r,c),l=c-n}return{[Ka.Open.id]:r,[Ka.High.id]:o,[Ka.Low.id]:a,[Ka.Close.id]:c,[Ka.Change.id]:l}}getWrappers(){return this.wrapBaseFields(Ka.Volume,Ka.OpenInterest,Ka.TradingDay)}}class pp extends up{constructor(e,t){super(e,t),My(this)}calculateAt(e){let t=null;const i=this.period,[,s]=_y(this);if(this.atLeast(e,i)&&s.hasField(this.source)){const n=this.past(e,i,this.source,s);this.allowEmptyValues?t=w(n.filter(D)):R(n)&&(t=w(n))}return{[this.target.id]:t}}getWrappers(){return this.source===Ka.Volume?this.wrapBaseFields(Ka.Volume,Ka.TradeSize,Ka.Change,Ka.Open,Ka.Close):[]}}class fp extends up{multiplier;constructor(e,t,i){super(e,t),this.multiplier=i(this.period),My(this)}calculateAt(e){let t=null;const[i,s]=_y(this);if(this.atLeast(e,2)&&s.hasField(this.source)){const n=this.container.getData(this.target)[e-1];if(null!==n){t=(this.innVal(i,this.source,e)-n)*this.multiplier+n}else{const i=this.period;if(this.atLeast(e,i)){const n=this.past(e,i,this.source,s);this.allowEmptyValues?t=w(n.filter(D)):R(n)&&(t=w(n))}}}return{[this.target.id]:t}}}class mp extends up{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=Ka.OpenInterest;return this.base.hasField(i)&&(t=this.baseVal(i,e)),{[i.id]:t}}}const gp={inField:Ka.MA,outFields:[Ka.ENVU,Ka.ENVD],func:ay},yp={inField:Ka.EMA,outFields:[Ka.ENVEXPU,Ka.ENVEXPD],func:ly},Ap={inField:Ka.SMA,outFields:[Ka.ENVSMOU,Ka.ENVSMOD],func:cy};class Sp extends up{kind;perc;constructor(e,t,i){super(e,i),this.kind=t,this.perc=this.inputs.Percent/100;const s=t.func(i,this.inputs.Period,e.source);this.addInner(s)}calculateAt(e){let t=null,i=null;const s=this.innVal(1,this.kind.inField,e);if(null!==s){const e=s*this.perc;t=s+e,i=s-e}return{[this.kind.outFields[0].id]:t,[this.kind.outFields[1].id]:i}}}class Tp extends up{constructor(e,t){super(e,t);const i=ay(t,this.inputs.Period1,this.source),s=ay(t,this.inputs.Period2,this.source),n=by(this.target,(e,t,i)=>t-i,i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}}const vp={fields:[Ka.MACD,Ka.MACDS,Ka.MACDH],avgFunc:ay,mapFunc:Ey,histogramVaryColor:!0},Pp={fields:[Ka.MACD,Ka.MACDS,Ka.MACDH],avgFunc:ly,mapFunc:Ey,histogramVaryColor:!0},Cp={fields:[Ka.MACD,Ka.CTLTM,Ka.CTM],avgFunc:ly,mapFunc:Ey,histogramVaryColor:!1},bp={fields:[Ka.MACD,Ka.CTLTMF,Ka.CPMI],avgFunc:ly,mapFunc:Ey,histogramVaryColor:!1},Ep={fields:[Ka.PPO,Ka.PPOS,Ka.PPOH],avgFunc:ly,mapFunc:Ly,histogramVaryColor:!0},Lp={fields:[Ka.PVO,Ka.PVOS,Ka.PVOH],avgFunc:ly,mapFunc:Ly,histogramVaryColor:!1};class Mp extends up{histogramVaryColor=!1;histogramField;get helpers(){return[Ka.BARCOLIX]}calculateAt(e){let t=-1;if(this.histogramVaryColor&&e>0){const i=this.container.getData(this.histogramField)[e],s=this.container.getData(this.histogramField)[e-1];if(ie(i,s)){const n=i<=0;t=n?1:3,e>0&&(n&&i>s&&(t=0),!n&&i<s&&(t=2))}}return{[Ka.BARCOLIX.id]:t}}}class _p extends Mp{fields;constructor(e,t,i){super(e,i),this.fields=t.fields,this.histogramVaryColor=t.histogramVaryColor,this.histogramField=this.fields[2];const s=t.avgFunc(i,e.inputs.Period1,e.source,void 0),n=t.avgFunc(i,e.inputs.Period2,e.source,void 0),r=by(this.fields[0],t.mapFunc,s,n),o=t.avgFunc(r,e.inputs.Period3,r.target,this.fields[1]),a=by(this.fields[2],Ey,r,o);this.addInner(r,o,a)}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}}const xp=cp("_AVG_GAIN"),Ip=cp("_AVG_LOSS");class Dp extends up{constructor(e,t,i){super(e,i);const s=Sy(i,this.inputs.Period,this.source,Ka.RSI,t),n=Oy(e,"MA","Average")(s,this.inputs.PeriodAvg,Ka.RSI,Ka.RSIAVG);this.addInner(s,n)}getWrappers(){return[this.wrapInner(Ka.RSI,1),this.wrapInner(Ka.RSIAVG,2)]}}class Op extends up{highest;index;constructor(e,t,i,s){super(e,s),this.highest=t,this.index=i}calculateAt(e){let t=null;const i=this.inputs.Period;if(this.atLeast(e,i)){const s=this.past(e,i,this.source);R(s)&&(t=this.highest?Math.max(...s):Math.min(...s),this.index&&(t=i-s.indexOf(t)-1))}return{[this.target.id]:t}}}class wp extends up{toHighest;field;highField;lowField;constructor(e,t,i){super(e,i),this.toHighest=t;const s=ie(e.source),n=e.source,r=s?n:Ka.Close;this.field=r;const o=s?n:Ka.High;this.highField=o;const a=s?n:Ka.Low;this.lowField=a;const l=dy(i,e.inputs.Period,this.highField,Ka.HH,!0),c=dy(i,e.inputs.Period,this.lowField,Ka.LL,!1);this.addInner(l,c)}calculateAt(e){let t=null;const i=this.baseVal(this.field,e),s=this.innVal(1,Ka.HH,e),n=this.innVal(2,Ka.LL,e);if(R([i,s,n])){const e=this.toHighest?s:n,r=s-n;0!==r&&(t=(i-e)/r*100)}return{[this.target.id]:t}}}const Rp=cp("RawPercK");class Np extends up{kField;constructor(e,t,i,s){super(e,s);const n=py(s,this.inputs.Period1,t?Rp:i,!1),r=Oy(e,"MA"),o=r(n,this.inputs.Period2,n.target,t?i:Ka.PercD),a=t?r(o,this.inputs.Period3,o.target,Ka.PercD):o;this.kField=i,t?this.addInner(o,a):this.addInner(n,o)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(Ka.PercD,2)]}}function Vp(e,t,i,s,n){if(null===n)return null;const r=e*n,o=s+r,a=s-r;switch(t){case Ka.BOLLBU:return o;case Ka.BOLLBL:return a;case Ka.BOLLBW:return(o-a)/s*100;default:return null}}class Hp extends up{kind;constructor(e,t,i){super(e,i),this.kind=t;const s=this.inputs.Period,n=this.source,r=ay(i,s,n,Ka.BOLLBM),o="Modified"===t,a=vy(o?function(e,t,i=Ka.PCTCHG){return ny("PCTCHG",{source:t,target:i,inputs:fy},e)}(i,n):i,s,o?Ka.PCTCHG:n),l=this.inputs.Width,c=e=>_(Vp,l,e),u=by(Ka.BOLLBU,c(Ka.BOLLBU),r,a),h=by(Ka.BOLLBL,c(Ka.BOLLBL),r,a),d=by(Ka.BOLLBW,c(Ka.BOLLBW),r,a),p=Oy(e,"MA","Average")(d,this.inputs.PeriodAvg,Ka.BOLLBW,Ka.BOLLBWA);this.addInner(r,a,u,h,d,p)}calculateAt(e){const t=this.innVal(3,Ka.BOLLBU,e),i=this.innVal(4,Ka.BOLLBL,e),s=this.innVal(1,Ka.BOLLBM,e),n=this.innVal(5,Ka.BOLLBW,e),r=this.innVal(6,Ka.BOLLBWA,e);let o=null;switch(ie(t,i)&&(o=(this.baseVal(Ka.Close,e)-i)/(t-i)),this.kind){case"Regular":return{[Ka.BOLLBU.id]:t,[Ka.BOLLBL.id]:i,[Ka.BOLLBM.id]:s};case"Width":return{[Ka.BOLLW.id]:t-i};case"Percent":return{[Ka.BOLLP.id]:o};case"BandWidth":return{[Ka.BOLLBW.id]:n,[Ka.BOLLBWA.id]:r};case"Modified":{let t=null,i=null,n=null,r=null;const o=this.innVal(2,Ka.MSD,e);if(ie(o)){const e=this.inputs.MultInside,a=this.inputs.MultOutside;t=s+e*o,n=s-e*o,i=s+a*o,r=s-a*o}return{[Ka.MBBUI.id]:t,[Ka.MBBLI.id]:n,[Ka.MBBUO.id]:i,[Ka.MBBLO.id]:r,[Ka.MBBM.id]:s}}default:return null}}}const Bp=cp("_ABS_CHG"),Fp=cp("_MA_ABS_CHG"),kp=cp("_CHG");const Wp=cp("_PDM"),Up=cp("_MDM"),$p=cp("_TRS"),Gp=cp("_PDS"),zp=cp("_MDS"),Yp=cp("_DX");class jp extends up{useEma;adxField;multiplier;constructor(e,t,i,s){super(e,s),this.useEma=t,this.adxField=i,this.multiplier=2/(this.inputs.AdxSmoothing+1);const n=my(s,Ka.TR);this.addInner(n)}get helpers(){return[Wp,Up,$p,Gp,zp,Yp]}sum(e,t,i,s){let n=null;if(this.atLeast(e-1,s-1)){let r=this.past(e-1,s-1,t,this.container);r.push(i),R(r)&&(n=r.reduce((e,t,i)=>e+t,0))}return n}smooth1(e,t,i,s){let n=null;const r=this.inputs.DiLength,o=this.container.getData(i)[e-1];return n=null!==o?o-o/r+s:this.sum(e,t,s,r),n}smooth2(e,t,i,s){const n=this.container.getData(i)[e-1],r=this.inputs.AdxSmoothing;if(null!==n)return this.useEma?(s-n)*this.multiplier+n:(n*(r-1)+s)/r;{const i=this.sum(e,t,s,r);if(null!==i)return i/r}return null}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null,a=null,l=null,c=null;if(e>0){const u=this.past(e,2,Ka.High),h=this.past(e,2,Ka.Low),d=Math.max(u[1]-u[0],0),p=Math.max(h[0]-h[1],0);t=d>p?d:0,i=p>d?p:0;const f=this.container.getData(Ka.TR)[e];n=this.smooth1(e,Wp,Gp,t),r=this.smooth1(e,Up,zp,i),s=this.smooth1(e,Ka.TR,$p,f),(n>0||r>0)&&0!==s&&(o=n/s*100,a=r/s*100,l=100*Math.abs(o-a)/(o+a),c=this.smooth2(e,Yp,this.adxField,l))}return{[Wp.id]:t,[Up.id]:i,[$p.id]:s,[Gp.id]:n,[zp.id]:r,[Ka.PDI.id]:o,[Ka.MDI.id]:a,[Yp.id]:l,[this.adxField.id]:c}}getWrappers(){return[this.wrapInner(Ka.TR,1)]}}class Kp extends up{calculateAtFunc;constructor(e,t,...i){super(e,...i),this.calculateAtFunc=t}calculateAt(e){let t=this.innerSeries.map((t,i)=>{const s=t;let n=s.target;if(!ie(n)){n=s.container.hasField(Ka.Close)?Ka.Close:s.container.fields[0]}return this.innVal(i,n,e)}),i=null;return R(t)&&(i=this.calculateAtFunc(e,...t)),{[this.target.id]:i}}}function qp(e,t){const i=this.baseVal(Ka.High,t),s=this.baseVal(Ka.Low,t);return{[e.id]:(i+s)/2}}function Xp(e,t){const i=this.baseVal(Ka.High,t),s=this.baseVal(Ka.Low,t);return{[e.id]:i-s}}class Zp extends up{calculateAtFunc;constructor(e,t,i){super(e,i),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}}const Jp=cp("_RANGE"),Qp=cp("_MOV_RANGE"),ef={fields:[Ka.KCUP,Ka.KCLOW,Ka.KCMID],midSeries:e=>yy(e,Ka.TP),midTarget:Ka.TP,rangeSeries:e=>Cy(Jp,M(Xp,Jp),e),rangeTarget:Jp,func:"MA",useMultiplier:!1},tf={fields:[Ka.KBUP,Ka.KBLOW,Ka.KBMID],midSeries:e=>e,midTarget:Ka.Close,rangeSeries:e=>my(e,Ka.TR),rangeTarget:Ka.TR,func:"EMA",useMultiplier:!0};class sf extends up{kind;constructor(e,t,i){super(e,i),this.kind=t;const s=t.midSeries(i),n=Oy(e,t.func,"Average"),r=n(s,this.inputs.Period,t.midTarget,t.fields[2]),o=n(t.rangeSeries(i),this.inputs.Period,t.rangeTarget,Qp);this.addInner(r,o)}calculateAt(e){const t=this.innVal(1,this.kind.fields[2],e),i=this.innVal(2,Qp,e),s=null!==t&&null!==i,n=this.kind.useMultiplier?this.inputs.Multiplier:1;return{[this.kind.fields[0].id]:s?t+i*n:null,[this.kind.fields[1].id]:s?t-i*n:null}}getWrappers(){return[this.wrapInner(this.kind.fields[2],1)]}}class nf extends up{isWidth;constructor(e,t,i){super(e,i),this.isWidth=t;const s=dy(i,this.inputs.Period,Ka.High,Ka.DONUP,!0),n=dy(i,this.inputs.Period,Ka.Low,Ka.DONLOW,!1);this.addInner(s,n)}calculateAt(e){const t=this.innVal(1,Ka.DONUP,e),i=this.innVal(2,Ka.DONLOW,e),s=null===t&&null===i;return this.isWidth?{[Ka.DONW.id]:s?null:t-i}:{[Ka.DONMID.id]:s?null:(t+i)/2}}getWrappers(){return[this.wrapInner(Ka.DONUP,1),this.wrapInner(Ka.DONLOW,2)]}}const rf=cp("_HIND"),of=cp("_LIND");class af extends up{constructor(e,t,i){super(e,i),this.justWidth=t,this.justWidth=t;const s=this.inputs.Period,n=dy(i,s,Ka.High,rf,!0,!0),r=dy(i,s,Ka.Low,of,!1,!0);this.addInner(n,r)}calculateAt(e){let t=null,i=null,s=null;const n=this.innVal(1,rf,e),r=this.innVal(2,of,e);if(null!==n&&null!==r){const e=this.period;t=(e-n)/e*100,i=(e-r)/e*100,s=t-i}return this.justWidth?{[Ka.ARNOSC.id]:s}:{[Ka.ARNUP.id]:t,[Ka.ARNLOW.id]:i}}}const lf=cp("_MIDPOINT");const cf=cp("_MIDPOINT");class uf extends up{multiplyVol;constructor(e,t,i){super(e,i),this.multiplyVol=t}calculateAt(e){const t=[Ka.High,Ka.Low,Ka.Close,Ka.Volume],[i,s,n,r]=t.map(t=>this.baseVal(t,e));let o=i===s?0:(n-s-(i-n))/(i-s);return this.multiplyVol&&(o*=r),{[this.target.id]:o}}}const hf=cp("_RANGE");const df=cp("_MATP");class pf extends up{isBull;constructor(e,t,i){super(e,i),this.isBull=t;const s=ly(i,this.inputs.Period,this.source);this.addInner(s)}calculateAt(e){let t=null;const i=this.innVal(1,Ka.EMA,e);return null!==i&&(t=this.isBull?this.baseVal(Ka.High,e)-i:this.baseVal(Ka.Low,e)-i),{[this.isBull?Ka.ERBLPOW.id:Ka.ERBRPOW.id]:t}}}const ff=cp("_FORCE");const mf=cp("_RANGE"),gf=cp("_EMA1"),yf=cp("_EMA2"),Af=cp("_RATIO");const Sf={isNegative:!1,fields:[Ka.PVI,Ka.PVIEMA]},Tf={isNegative:!0,fields:[Ka.NVI,Ka.NVIEMA]};class vf extends up{kind;constructor(e,t,i){super(e,i),this.kind=t;const s=Cy(this.kind.fields[0],M(function(e,t){let i=1e3;if(t>0){const s=[Ka.Close,Ka.Volume],[n,r]=s.map(e=>this.baseVal(e,t)),[o,a]=s.map(e=>this.baseVal(e,t-1)),l=this.container.getData(this.target)[t-1];if(e?r<a:r>a){i=l*((n-o)/o+1)}else i=l}return{[this.target.id]:i}},this.kind.isNegative),i),n=ly(s,this.inputs.Period,this.kind.fields[0],this.kind.fields[1]);this.addInner(s,n)}getWrappers(){return[this.wrapInner(this.kind.fields[0],1),this.wrapInner(this.kind.fields[1],2)]}}const Pf=cp("_LOGPC");const Cf=cp("_SWING_INDEX");const bf=cp("_MIN_CLOSE"),Ef=cp("_MAX_CLOSE");const Lf=cp("_EP"),Mf=cp("_AF"),_f=cp("_POS");const xf=cp("_IDY"),If=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],Df=e=>Array(e).fill(0);function Of(e,t,i){let s=e[i-1];return 0===t&&(s=e[i]),t<0&&(s=e[i+1]),s}function wf(e,t,i,s,n){const r=n[18];let o=s+1,a=0;for(let l=0;l<r;++l){let i=0,s=0;for(let n=1;n<6;++n){if(o--,e[o]<=0)continue;const r=e[o]-t[o];1==n&&(i=s=r),r>i&&(i=r),r<s&&(s=r)}a=a+i-s}return a=a/r*function(e,t){return Of(e,t,4)}(n,i[s]),a}function Rf(e,t,i,s,n){let r=s;const o=function(e,t){return Of(e,t,7)}(n,i[s]);let a=0;do{r--,e[r]>0&&a++}while(a<o&&r>0);return t[s]-t[r]}function Nf(e,t,i,s,n,r,o,a,l,c){const u=function(e,t){return Of(e,t,10)}(n,i[s]),h=function(e,t){return Of(e,t,13)}(n,i[s]),d=function(e,t){return Of(e,t,16)}(n,i[s]),p=l+c+t[s]-e[s];let f=100;n[20]>0&&(f=n[20]);let m=u*a/f;a>h&&(m=u*h/f);const g=2*c,y=e[s]+(p-g)-(p-g)*m,A=e[s]+(p-p*m),S=[r,o];return(1===a||1!==d||y>r)&&(S[0]=y),(1===a||1!==d||A<o)&&(S[1]=A),S}function Vf(e,t,i){let s=0,n=-1,r=0,o=1;for(let a=0;a<i;++a){if(t[a]=0,null==e[a])continue;if(s++,21==s&&(o=2),31==s&&(o=3),r+=e[a]*o,s<40)continue;t[a]=r/70;let l=0;for(let t=n+1;t<i&&(null==e[t]||(l++,1==l&&(n=t),1!=l&&21!=l&&31!=l||(r-=e[t]),31!=l));++t);}}const Hf=1,Bf=2,Ff=3,kf={[Hf]:{param:"cot",func:"parseCotLineChart",fields:[Ka.DateTime,Ka.COTLCCMSP,Ka.COTLCLGSP,Ka.COTLCSMSP]},[Bf]:{param:"cotadv",func:"parseDisaggregated",fields:[Ka.DateTime,Ka.COTDAGPRO,Ka.COTDAGSPD,Ka.COTDAGMNM,Ka.COTDAGOTH]},[Ff]:{param:"cotfin",func:"parseFinancialTradersReport",fields:[Ka.DateTime,Ka.COTFTRDLI,Ka.COTFTRASM,Ka.COTFTRLVF,Ka.COTFTROTH]}};class Wf extends up{wrappers;constructor(e,t,i){super(e,lp(i,e=>new Uf(t,e))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=kf[t].fields.slice(1).map(e=>this.wrapInner(e,0))}getWrappers(){return this.wrappers}}class Uf extends Ch{kind;constructor(e,t){super(t),this.kind=e}getRetriever(){return new $f(this.kind)}onStreamingUpdates(e){}}class $f extends Ku{kind;constructor(e){super(),this.kind=e}addExtraParams(e){e[kf[this.kind].param]="y"}getParser(e){return new Gf(e.symbol,e.aggregation,this.kind)}}class Gf extends zu{kind;constructor(e,t,i){super(e,t,0),this.kind=i}makeContainer(){return new Mu(kf[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[kf[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(Ka.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Ka.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(Ka.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(Ka.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(Ka.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Ka.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(Ka.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(Ka.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(Ka.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(Ka.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Ka.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(Ka.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(Ka.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(Ka.COTFTROTH,parseInt(e[5]))}}class zf extends Wf{constructor(e,t){super(e,1,t)}}const Yf={Day:[Ka.PreviousHigh,Ka.PreviousLow,Ka.PreviousClose],Week:[Ka.WeekPreviousHigh,Ka.WeekPreviousLow,Ka.WeekPreviousClose],Month:[Ka.MonthPreviousHigh,Ka.MonthPreviousLow,Ka.MonthPreviousClose]};class jf extends up{disabled;record;streamingSubscription;constructor(e,t,i){if(super(e,i),this.disabled=!ie(i.query)||!ie(i.query.symbol),!this.disabled){let e=i.query.symbol;e.endsWith(".BZ")&&(e=e.slice(0,-3)),this.record=Gv().getRecordSource().getRecord(e),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()}this.initialNotification=!0}getStreamingSubscription(){return Gv().getRecordSource().subject.pipe(uc(e=>{const t=dl(qa.RT_QUOTE,this.record.symbol);return e.filter(t)}),pc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return ps.call(this,async()=>ie(this.record)?await this.record.ready()&&await super.ready():await super.ready(),"asyncReadyWork2")}onStreamingUpdates(e){if(this.record){const e={tag:Pe(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return Yf[e].map(e=>this.record.getValue(e))}}class Kf extends Ch{constructor(e){super(e)}getRetriever(){return Bi(this.query.symbol)?new Jf:new qf}onStreamingUpdates(e){}}class qf extends Ku{addExtraParams(e){e.impl="y"}getParser(e){return new Zf(e.symbol,e.aggregation)}}function Xf(){return new Mu([Ka.DateTime,Ka.IMPVOL])}class Zf extends zu{constructor(e,t){super(e,t)}makeContainer(){return Xf()}getParseFunc(){return this.parseImpVol}parseImpVol(e){!this.aggregation.isEndOfDay||e.length<9||(this.container.addDataPoint(Ka.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Ka.IMPVOL,parseFloat(e[8])))}}class Jf extends qu{emptyContainer(e,t){return Xf()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(Ka.DateTime,vu(e.date.substring(0,10)));const s=te(e.impliedVolatility);i.addDataPoint(Ka.IMPVOL,s?100*e.impliedVolatility:null)}}const Qf=cp("_ABS_CHG"),em=cp("_DS1_EMA1"),tm=cp("_DS1_EMA2"),im=cp("_DS2_EMA1"),sm=cp("_DS2_EMA2");const nm=cp("_DIFF");const rm=cp("_SUM");const om=cp("_ABS_CHG"),am=cp("_HH_LL"),lm=cp("_MULMA");class cm extends hp{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){const i=(e,t)=>this.baseVal(e,t),s=[Ka.Open,Ka.High,Ka.Low,Ka.Close],n=s.map(t=>i(t,e));if(R(n)){const r=s.map(t=>i(t,e-1));if(R(r)){t=n.map((e,t)=>100*(e-r[t])/r[t]);const[i,s]=z(t);if(t[1]=s,t[2]=i,e>1){const i=this.container.getData(Ka.Close)[e-1];t[4]=t[3]-i}}}}return{[Ka.Open.id]:t[0],[Ka.High.id]:t[1],[Ka.Low.id]:t[2],[Ka.Close.id]:t[3],[Ka.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(Ka.Volume,Ka.OpenInterest,Ka.TradingDay)}}const um=cp("_DIST"),hm=cp("_EMA_DIST1"),dm=cp("_EMA_DIST2"),pm=cp("_DIFF"),fm=cp("_EMA_DIFF1"),mm=cp("_EMA_DIFF2");const gm=cp("_CHG"),ym=cp("_M1"),Am=cp("_M2");class Sm extends up{constructor(e,t){super(e,t);const i=Cy(gm,function(e){const t=Ka.Close,i=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[gm.id]:i}},t),s=by(ym,(e,t)=>t>=0?t:0,i),n=by(Am,(e,t)=>t>=0?0:-t,i);this.addInner(s,n)}perc(e,t){return 100*e/t}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i+1)){const s=this.past(e,i,ym,this.innCont(1)),n=this.past(e,i,Am,this.innCont(2));if(R(s)&&R(n)){const e=O(s),i=O(n);t=this.perc(e-i,e+i)}}return{[Ka.CHDMOMOSC.id]:t}}}const Tm=cp("_MAX"),vm=cp("_MIN"),Pm=cp("_ISUPTREND");const Cm=cp("_TRENDUP"),bm=cp("_TRENDDOWN"),Em=cp("_TREND");const Lm=cp("_CUM_PRICE"),Mm=cp("_CUM_VOL"),_m=cp("_PER_CHG");class xm extends up{constructor(e,t){super(e,t);const i=this.source,s=Cy(i,M(xy,i),t);this.addInner(s)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}}const Im=cp("_DIFF"),Dm=[Im,Ka.Buy,Ka.Sell];function Om(e,t,i,s){let n=null,r=null,o=null;ie(i,s)&&(o=i-s);const a=t>0?e.getData(Im)[t-1]:null;return ie(o,a)&&(n=o>0&&a<=0?1:null,r=o<0&&a>=0?-1:null),{[Im.id]:o,[Ka.Buy.id]:n,[Ka.Sell.id]:r}}const wm=cp("_PVM"),Rm=cp("_NVM");function Nm(e,t,i){return new Vm(e,t,i)}class Vm{constructor(e,t,i){this.exprModel=e,this.innerSeries=t,this.container=null,this.innerLookup=t.reduce((e,t)=>(e[i.mapper(t)]=t,e),{}),this.policy=i,this.exprSymbols=pa(e),this.valueSymbols=this.exprSymbols.filter(e=>void 0===this.innerLookup[e]),this.onlyForTimeline=B(this.symbols,this.exprSymbols),this.recalcTriggers=new Set(t)}calculable=!0;container;innerLookup;policy;exprSymbols;valueSymbols=[];onlyForTimeline;recalcTriggers;crashedComputationReported=!1;isLoading=!1;_sourceFields;_targetFields;basisChangedToken=null;quoteGroupToken=null;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;const t=this.innerSeries.filter(e=>e.canLoadMoreData).map(t=>t.loadMoreData(e));await Promise.all(t),this.isLoading=!1}get isExprInError(){return!ie(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 ps.call(this,async()=>{this.basisChangedToken=ap.subscribe(qa.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=ap.subscribe(qa.RT_QUOTEGROUP,this.onQuoteGroup.bind(this));const e=this.innerSeries.map(e=>e.ready());void 0!==this.policy.valueProvider&&e.push(this.policy.valueProvider.ready());const t=(await Promise.all(e)).every(I);return t&&this.calculate(),t})}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every(e=>ie(e.container))&&this.calculateCommon(qa.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===i.Manual)return;if(e===qa.TS_EVENTSCHANGED||e===qa.TS_LOADING)return;if(!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some(e=>!ie(e.container)))return;const s=this.policy.mapper(t.series);if(e===qa.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(s))return;switch(this.policy.recompute===i.Everything?qa.TS_MANYCHANGED:e){case qa.TS_MANYCHANGED:this.calculate();break;case qa.TS_DATAPOINTCHANGED:case qa.TS_DATAPOINTADDED:this.recalculate(e===qa.TS_DATAPOINTADDED);break;case qa.TS_TIMELINECORRECTION:case qa.TS_QUOTEMARKER:break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.basisChangedToken&&ap.unsubscribe(this.basisChangedToken),this.quoteGroupToken&&(ap.unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map((t,i)=>{if(t===Ka.Volume)return O(this.exprSymbols.map(t=>e.inn[t].values[i]??0));return ua(this.exprModel,t=>e.oneValue[t]??e.inn[t]?.values[i]??null)})}pickMainField(){let e=null;for(const t of this.policy.fieldMap.values())if(null==e)e=t;else if(t===Ka.Close){e=t;break}return e}calculateLastChange(){const e=this.container,t=e.size;if(t<=1)return;const i=this.pickMainField(),s=e.getData(i)[t-2],n=e.getData(i)[t-1];ie(s,n)&&e.setLastDataPoint(Ka.Change,n-s)}calculateDataPoint(e,t){const i=this.calculateAt(e);if(null===i)return;e.atLeastOne=!0;const[s,n]=z(i,0,3);i[1]=n,i[2]=s,this.targetFields.forEach((e,s)=>{const n=i[s];t?this.container.addDataPoint(e,n):this.container.setLastDataPoint(e,n)}),t&&(this.container.addDataPoint(Ka.Change,null),this.container.addDataPoint(Ka.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){J(e,{series:this,index:this.container.size-1})}fieldValueAt(e,t,i){const s=this.innerLookup[e].container.getData(i);return t<0||t>=s.length?null:s[t]}timeStampAt(e,t){return this.fieldValueAt(e,t,Ka.DateTime)}timeline(e){return e.container.getData(Ka.DateTime)}getRangeHelper(){switch(this.policy.missing){case t.UseNext:case t.UseNone:return Math.min;case t.UsePrevious:return Math.max;default:throw new Error("Unknow missing bar policy, likely forgot to implement it.")}}getRange(){const e=this.getRangeHelper();return{begin:new Date(e(...this.symbols.map(e=>W(this.timeline(this.innerLookup[e]))))),end:new Date(e(...this.symbols.map(e=>k(this.timeline(this.innerLookup[e])))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(e,i){const s=this.timeline(this.innerLookup[e]);switch(this.policy.missing){case t.UseNext:case t.UseNone:return s.findIndex(e=>e.valueOf()>=i.valueOf());case t.UsePrevious:return U(s,e=>e.valueOf()<=i.valueOf());default:throw new Error("Unknow missing bar policy, likely forgot to implement it.")}}checkPos(e){const t=Object.keys(e.inn).length;e.isNull=Object.values(e.inn).some(e=>!(ie(e.timeStamp)||this.policy.stretch(e.symbol)&&1!==t))}fillPosSymbolAt(e,i,s){e.index=i,e.timeStamp=this.timeStampAt(e.symbol,i);const n=(this.policy.missing===t.UseNone||this.policy.skipLeadingEmpty&&!s.atLeastOne)&&e.timeStamp&&e.timeStamp.valueOf()!==s.timeStamp.valueOf();return e.values=this.sourceFields.map(t=>n?null:this.fieldValueAt(e.symbol,i,t)),e}skippable(e){return!!this.innerLookup[e].container.isEmpty&&(this.policy.noDataApproach===s.IgnoreTimelineOnly&&this.onlyForTimeline.includes(e)||this.policy.noDataApproach===s.ModelTransformRequired)}get symbols(){const e=Object.keys(this.innerLookup);return ie(this.onlyForTimeline)?e.filter(e=>!this.skippable(e)):e}getPos(e){const t={isNull:!0,inn:{},timeStamp:e,atLeastOne:!1,oneValue:{}};return 0===this.symbols.length||(this.symbols.forEach(i=>{const s=this.findIndex(i,e),n={symbol:i,index:-1,timeStamp:/* @__PURE__ */new Date(0),values:[]};t.inn[i]=this.fillPosSymbolAt(n,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(;ie(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===t.UsePrevious?this.getInner(e).forEach(t=>{const i=ie(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===t.UseNone&&this.getInner(e).forEach(t=>this.fillPosSymbolAt(t,t.index,e))))}shouldAdd(e){return this.container.getLastDataPoint(Ka.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){const e=this.getFirstPos();for(;!e.isNull;)this.calculateDataPoint(e,!0),this.moveNext(e)}e&&this.notify(e)}catch(s){this.crashedComputationReported||(Hv(s,"error"),this.crashedComputationReported=!0)}}calculate(){const{yes:e,no:t}=V(this.innerSeries,e=>!e.container.isEmpty);if(t.length>0&&this.policy.noDataApproach===s.ModelTransformRequired){const i=e=>e.map(this.policy.mapper),s=this.policy.modelTransform(i(e),i(t));null!==s&&(this.exprModel=s)}this.calculateCommon(qa.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;const t=this.getLastPos(),i=this.shouldAdd(t);this.calculateCommon(i?qa.TS_DATAPOINTADDED:qa.TS_DATAPOINTCHANGED,t,i)}recalculateAt(e,t,i){return this.recalculate(i)}makeContainer(){const e=[Ka.DateTime,Ka.Change].concat(this.targetFields);return new Mu(e)}getCacheableEntities(e){this.innerSeries.forEach(t=>{t.getCacheableEntities(e)})}}const Hm=cp("_AVG");const Bm=cp("_HAO"),Fm=cp("_HAH"),km=cp("_HAL"),Wm=cp("_HAC");const Um=cp("_DELTA");const $m=cp("_DIFF"),Gm=cp("_RANK"),zm=cp("_CHG"),Ym=cp("_AVG"),jm=cp("_HBRAKE_CHG"),Km=cp("_HEIGHT_DELTA"),qm=cp("_ACTION"),Xm=cp("_REVERSAL"),Zm=10,Jm=e=>[e>0,e<0],Qm=[null,null,null],eg=0,tg=1,ig=2;function sg([e,t],i){let s=null;if(i>0){const t=this.baseVal(e,i-1);ie(t)&&(s=this.baseVal(e,i)-t)}return{[t.id]:s}}class ng extends up{useHandbrake;constructor(e,t){super(e,t);const i=Oy(e,"MA","Average"),s=i(t,Ce(1,999,this.inputs.FastPeriod),Ka.Close),n=Ce(0,999,this.inputs.SlowPeriod),r=n>0,o=r?i(t,n,Ka.Close):t,a=by($m,r?(e,t,i)=>t-i:(e,t,i)=>i-t,s,o),l=Cy(zm,M(sg,[Ka.Close,zm]),t),c=Cy(Gm,function(e){const t=Math.abs(this.baseVal($m,e));let i=null,s=0,n=0;for(let r=e-1;r>=0&&s<200;--r){s++,Math.abs(this.baseVal($m,r))<t&&n++}return s>0&&(i=Math.floor(n/s*Zm)),i===Zm&&i--,{[Gm.id]:i}},a),u=Ce(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=u>0;const h=i(t,u,Ka.Close,Ym),d=Cy(jm,M(sg,[Ym,jm]),h);this.addInner(l,a,c,d)}get helpers(){return[Km,Ka.BARCOLIX,qm,Xm]}getStateAt(e){const t=this.innVal(2,$m,e);return ie(t)?Jm(t):Qm}findPreviousKnownState(e){for(let t=e-1;t>0;t--){const e=this.getStateAt(t);if(e===Qm)return Qm;const[i,s]=e;if(i||s)return e}return Qm}getBuySell(e){const t=this.getStateAt(e);if(t===Qm)return Qm;const[i,s]=t,n=this.findPreviousKnownState(e),[r,o]=n;if(!i&&!s)return n===Qm?Qm:[r,o,!1];const a=i!==r||s!==o;return a?[r,o,a]:[i,s,a]}getPrev(e,t){return t>0?this.container.getData(e)[t-1]:null}calculateAt(e){let t=null,i=null,s=0,n=-1,r=eg;const[o,a,l]=this.getBuySell(e),[c,u]=[Xm,qm].map(t=>this.getPrev(t,e)),[h,d]=[0,-1].map(t=>this.innVal(4,jm,e+t));if(n=l?Zm:this.innVal(3,Gm,e),this.useHandbrake&&ie(h,d)){const t=!o&&h>0||!a&&h<0;l?(n=t?Zm:12,r=u):!0!==c&&u!==tg||(o&&d>0||a&&d<0?(n=this.innVal(3,Gm,e),r=ig):(n=t?11:13,r=tg))}if(ie(this.innVal(2,$m,e))){const t=this.innVal(1,zm,e),[i,n]=Jm(t),r=Math.abs(t);(o&&i||a&&n)&&(s=r),(o&&n||a&&i)&&(s=-r)}return o?t=1:a&&(i=1),{[Ka.JPIB.id]:t,[Ka.JPIS.id]:i,[Ka.BARCOLIX.id]:n,[Km.id]:s,[qm.id]:r,[Xm.id]:l}}}const rg={FastPeriod:8,SlowPeriod:21,HandbrakePeriod:13,Average:"EMA",Height:"Fixed"};const og=cp("_SMTH_ROC"),ag=cp("_TEN_SMTH_ROC");function lg(e,t,i,s,n){return new fp({source:s,target:n,outFields:[n],aggregation:i,inputs:ty(t)},e,e=>2/e)}const cg=cp("_VOL_AVG");const ug=(()=>{const e=(t=51,se(Math.pow(.5,1/t),6));var t;const i=Y(52,t=>Math.pow(e,t)),s=52/O(i);return i.map(e=>e*s)})(),hg=["Renko","Kagi","PointAndFigure","LineBreak"];function dg(e){return e===l.Continue||e===l.Nearest}class pg extends up{additionalChunksCounter=1;noData=!1;isPeriodic=!1;constructor(e,t,i){super(e,i,lp(i,e=>{if(!jr(v[Gv()?.config.mode??"Unspecified"]))return i;const t=e.duplicate(),s=e.aggregation;if(s.hasSpec)return dg(s.spec)?i:new bh(t,!0);const n=s.unit===a.Intraday&&s.size<=5,r=function(e,t){switch(e){case a.Intraday:return t>=240?3:t>=120?2:1;case a.Day:default:return 5;case a.Week:return 15;case a.Month:return 60;case a.Quarter:case a.Year:return 240}}(s.unit,s.size);t.aggregation=n?new Wo(a.Tick,s.size,l.PerSeconds):new Wo(a.Intraday,r);const o=n?1:3;t.barsToFetch=Math.min(gs.MAX_INTRADAY_BARS,o*e.barsToFetch);return new Ch(t)})),this.isPeriodic=t,this.noData=this.innerSeries[1]instanceof bh,this.computedServerSide=!0,this.initialNotification=!0}get canLoadMoreData(){return!1}loadMoreData(){const 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;const s=i?qa.TS_DATAPOINTADDED:qa.TS_DATAPOINTCHANGED;this.notify(s,this.innerSeries[0].container.size-1)}getWrappers(){return[this.wrapInner(Ka.Change,1),this.wrapInner(Ka.Open,1),this.wrapInner(Ka.Close,1)]}}const fg=cp("_DR");class mg extends up{constructor(e,t,i){super(e,i);const s=Cy(fg,e=>{const t=this.baseVal(Ka.High,e),i=this.baseVal(Ka.Low,e);return{[fg.id]:ie(t,i)?t-i:null}},i),n=Oy(e,"MA")(s,this.inputs.Period,fg,Ka.ADR);if(t){const e=(e,t,i)=>ie(t,i)&&0!==i?t/i*100:null,t=by(this.target,e,n,i);this.addInner(t)}else this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}}const gg=cp("_EMA1"),yg=cp("_EMA2"),Ag=cp("_MACD"),Sg=cp("_PCTK"),Tg=cp("_PCTD"),vg=cp("_PCTK2");const Pg=cp("_EMA1"),Cg=cp("_EMA2"),bg=cp("_CORE");class Eg extends up{isEmpty=!1;constructor(e,t){if(super(e,t),Hy(t)&&e.aggregation?.isEndOfDay){let i=["$ADVT","$DECT"];switch(this.inputs.Source){case"TotalStocks":default:break;case"NYSEStocks":i=["$ADVN","$DECN"];break;case"NasdaqStocks":i=["$AVDQ","$DECQ"]}const s=this.getSeries(t.query,i[0]),n=this.getSeries(t.query,i[1]),r=this.getTargetSeries(e,s,n);this.addInner(s,n,r),this.canLoadMoreData=!0,this.initialNotification=!0}else{this.isEmpty=!0;const e=Cy(Ka.Close,(e,t)=>null,t),i=Cy(Ka.Close,(e,t)=>null,t),s=Cy(this.target,(e,t)=>null,t);this.addInner(e,i,s),this.canLoadMoreData=!1}}get baseIndex(){return this.isEmpty?0:1}getSeries(e,t){const i=e.duplicate();i.symbol=t;return Gv().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)]}}const Lg=cp("_INN_HL_ACC_IX"),Mg=new Wo;class _g extends up{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof bh)this.canLoadMoreData=!1;else{const r="PriceIndex"===this.inputs.Source?"$MADX":"$FADX",o=this.getSeries(t.query,r);if(this.addInner(o),this.isWeekly=e.aggregation.unit===a.Week,this.isWeekly){const e=this.getSeries(t.query,r,Mg),o=(i=e,s=this.inputs,new _g({aggregation:Mg,source:null,target:n=Lg,outFields:[n],inputs:{...s}},i));this.addInner(o)}this.canLoadMoreData=!0,this.initialNotification=!0}var i,s,n}getSeries(e,t,i){const s=e.duplicate();s.symbol=t,i&&(s.aggregation=i,s.barsToFetch=15*gs.US_TRADING_DAYS_PER_YEAR);return Gv().getTimeSeriesDataSource().getTimeSeries(s)}get baseIndex(){return 1}calculateAt(e){if(this.isWeekly)return this.calculateAtWeekly(e);let t=null;const i=this.period;if(this.atLeast(e,i)){const s=this.past(e,i,Ka.Close);R(s)&&(t=O(s))}return{[this.target.id]:t}}calculateAtWeekly(e){const t=this.container?.size??-1;let i=null;const s=this.innCont(2);if(t>0&&e===t-1)i=s.getLastDataPoint(Lg);else{const t=this.container.getTimeData()[e],n=s.getTimeData();let r=G(n,t),o=n[r],a=null;for(;r<s.size&&Mi(t,o);)a=r,r+=1,o=n[r];null!==a&&(i=s.getData(Lg)[a])}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}}const xg=cp("_RSI1"),Ig=cp("_RSI1_MOM"),Dg=cp("_RSI2"),Og=cp("_RSI2_MA");const wg=cp("_MUL_ATR");class Rg extends up{constructor(e,t){super(e,lp(t,t=>{const i=Gv().getTimeSeriesDataSource();return t.seriesKind=m.Options,t.fields=e.outFields,i.getTimeSeries(t)})),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return this.outFields.map(e=>this.wrapInner(e,0))}}const Ng=cp("_CORE");class Vg extends Ch{constructor(e){super(e)}getRetriever(){return Bi(this.query.symbol)?new Fg:Gi(this.query.symbol)?new kg:new Bg}}function Hg(){const e=[Ka.DateTime,Ka.Delta,Ka.Gamma,Ka.Theta,Ka.Vega];return new Mu(e)}class Bg{supportsChunks;constructor(){this.supportsChunks=!1}async retrieve(e){return Hg()}}class Fg extends qu{emptyContainer(e,t){return Hg()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(Ka.DateTime,vu(e.date.substring(0,10))),i.addDataPoint(Ka.Delta,e.delta),i.addDataPoint(Ka.Gamma,e.gamma),i.addDataPoint(Ka.Theta,e.theta),i.addDataPoint(Ka.Vega,e.vega)}}class kg extends qu{emptyContainer(e,t){return Hg()}addExtraParams(e){e.fields="delta,gamma,theta,vega"}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){i.addDataPoint(Ka.DateTime,vu(e.date)),i.addDataPoint(Ka.Delta,e.delta),i.addDataPoint(Ka.Gamma,e.gamma),i.addDataPoint(Ka.Theta,e.theta),i.addDataPoint(Ka.Vega,e.vega)}}const Wg=cp("_RSI1"),Ug=cp("_RSI2");const $g=cp("_ANCHR");const Gg=cp("_HH_N"),zg=cp("_LL_N"),Yg=cp("_HH_H1"),jg=cp("_LL_H1"),Kg=cp("_HH_H2"),qg=cp("_LL_H2");const Xg=cp("_MIDPOINT"),Zg=cp("_VALUE");class Jg extends up{constructor(e,t){super(e,t),My(this)}computeMidranks(e){const t=e.length,i=e.map((e,t)=>({v:e,i:t}));i.sort((e,t)=>e.v-t.v);const s=new Array(t);let n=0;for(;n<t;){let e=n;const r=i[n].v;for(;e+1<t&&i[e+1].v===r;)e++;const o=(n+1+(e+1))/2;for(let t=n;t<=e;t++)s[i[t].i]=o;n=e+1}return s}pearsonCorrelation(e){const t=e.length;if(t<2)return null;const i=(t+1)/2;let s=0;for(let c=0;c<t;c++)s+=e[c];const n=s/t;let r=0,o=0,a=0;for(let c=0;c<t;c++){const t=c+1-i,s=e[c]-n;r+=t*s,o+=t*t,a+=s*s}const l=Math.sqrt(o*a);return 0===l?null:r/l}calculateAt(e){let t=null;const i=this.period,[,s]=_y(this);if(this.atLeast(e,i)){const n=this.past(e,i,this.source,s);if(n.every(e=>null!==e)){const e=this.computeMidranks(n),i=this.pearsonCorrelation(e);null!==i&&(t=100*i)}}return{[Ka.RCI.id]:t}}}const Qg=cp("_ATR");const ey={_TR:class extends up{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=this.baseVal(Ka.High,e),s=this.baseVal(Ka.Low,e);if(e>0){const n=this.baseVal(Ka.Close,e-1);t=Math.max(i-s,Math.abs(i-n),Math.abs(s-n))}else t=i-s;return{[this.target.id]:t}}},_RSI:class extends up{isModified;constructor(e,t){super(e,t);const i=e.inputs.Modified;this.isModified=i}get helpers(){return[xp,Ip]}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;const n=this.period;if(this.atLeast(e,n+1)){if(null===this.container.getData(this.target)[e-1]||this.isModified){const t=this.past(e,n+1,this.source);if(R(t)){const e=N(1,n),r=e.map(e=>this.gain(e,t)),o=e.map(e=>this.loss(e,t));i=w(r),s=w(o)}}else{const t=this.container.getData(xp)[e-1],r=this.container.getData(Ip)[e-1],o=this.past(e,2,this.source);i=(t*(n-1)+this.gain(1,o))/n,s=(r*(n-1)+this.loss(1,o))/n}null!==i&&null!==s&&(t=100-100/(1+i/s))}return{[xp.id]:i,[Ip.id]:s,[this.target.id]:t}}},MA:pp,MAEXP:class extends fp{constructor(e,t){super(e,t,e=>2/(e+1))}},MAHLC:class extends up{constructor(e,t){super(e,t);const i=ay(t,this.inputs.Period1,Ka.High,Ka.MAHI),s=ay(t,this.inputs.Period2,Ka.Low,Ka.MALO);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Ka.MAHI,1),this.wrapInner(Ka.MALO,2)]}},VOL:class extends mp{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(Ka.Volume,Ka.TradeSize,Ka.Change,Ka.Open,Ka.Close)}},MAENV:class extends Sp{constructor(e,t){super(e,gp,t)}},MAENVEXP:class extends Sp{constructor(e,t){super(e,yp,t)}},MAENVSMO:class extends Sp{constructor(e,t){super(e,Ap,t)}},MATRI:class extends up{constructor(e,t){super(e,t);const i=ay(t,this.inputs.Period,this.source),s=ay(i,this.inputs.Period,Ka.MA,Ka.TMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Ka.TMA,2)]}},MAWEI:class extends up{triangle;constructor(e,t){super(e,t);const i=this.period;this.triangle=i*(i+1)/2,My(this)}weightedAverage(e){const t=e.length;if(0===t)return null;const 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;const i=this.period,[,s]=_y(this);if(this.atLeast(e,i)){const n=this.past(e,i,this.source,s);this.allowEmptyValues?t=this.weightedAverage(n.filter(D)):R(n)&&(t=this.weightedAverage(n))}return{[this.target.id]:t}}},MAVOL:pp,MASMO:class extends fp{constructor(e,t){super(e,t,e=>1/e)}},MACD:class extends _p{constructor(e,t){super(e,vp,t)}},MACDEXP:class extends _p{constructor(e,t){super(e,Pp,t)}},MACDV:class extends Mp{constructor(e,t){super(e,t),this.histogramVaryColor=!0,this.histogramField=Ka.MACDVH;const i=Oy(e,"EMA","Average"),s=i(t,e.inputs.Period1,e.source,void 0),n=i(t,e.inputs.Period2,e.source,void 0),r=gy(t,e.inputs.Period2,e.inputs.Average),o=by(Ka.MACDV,(e,t,i,s)=>(t-i)/s*100,s,n,r),a=i(o,e.inputs.Period3,o.target,Ka.MACDVS),l=by(Ka.MACDVH,Ey,o,a);this.addInner(o,a,l)}getWrappers(){return[this.wrapInner(Ka.MACDV,1),this.wrapInner(Ka.MACDVS,2),this.wrapInner(Ka.MACDVH,3)]}},GMMA:class extends up{constructor(e,t){super(e,t);for(let i=1;i<=12;++i){const s=Vy(e.inputs,i);this.addInner(ly(t,s,Ka.Close,e.outFields[i-1]))}}getWrappers(){return N(1,12).map(e=>this.wrapInner(this.outFields[e-1],e))}},OSCI:Tp,OSCIVOL:Tp,RSI:class extends Dp{constructor(e,t){super(e,!1,t)}},RSIMOD:class extends Dp{constructor(e,t){super(e,!0,t)}},RSISTO:class extends up{constructor(e,t){super(e,t);const i=Sy(t,this.inputs.Period,this.source),s=this.inputs.Range,n=Cy(Ka.STORSI,function(e){let t=null;if(this.atLeast(e,s)){const i=this.past(e,s,Ka.RSI,this.base),n=z(i),r=n[0],o=n[1];t=(k(i)-r)/(o-r)}return{[Ka.STORSI.id]:t}},i),r=Oy(e,"MA","Average")(n,this.inputs.PeriodAvg,Ka.STORSI,Ka.STORSIAVG);this.addInner(n,r)}getWrappers(){return[this.wrapInner(Ka.STORSI,1),this.wrapInner(Ka.STORSIAVG,2)]}},RSA:class extends up{constructor(e,t){super(e,t);const i=Sy(t,this.inputs.Period1,this.source,Wg),s=Sy(t,this.inputs.Period2,this.source,Ug),n=by(Ka.RSA,(e,t,i)=>(t+i)/2,i,s),r=Oy(e,"MA","Average")(n,this.inputs.PeriodAvg,Ka.RSA,Ka.RSAAVG);this.addInner(n,r)}getWrappers(){return[this.wrapInner(Ka.RSA,1),this.wrapInner(Ka.RSAAVG,2)]}},WPERCR:class extends wp{constructor(e,t){super(e,!0,t)}},HHLL:class extends up{constructor(e,t){super(e,t);const i=dy(t,this.inputs.Period1,Ka.High,Ka.HH,!0),s=dy(t,this.inputs.Period2,Ka.Low,Ka.LL,!1);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Ka.HH,1),this.wrapInner(Ka.LL,2)]}},WGCL:class extends up{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=[Ka.Close,Ka.High,Ka.Low],[s,n,r]=i.map(t=>this.baseVal(t,e));return t=(2*s+n+r)/4,{[this.target.id]:t}}},STOCHF:class extends Np{constructor(e,t){super(e,!1,Ka.PercK,t)}},STOCHS:class extends Np{constructor(e,t){super(e,!0,Ka.PercK,t)}},BBANDS:class extends Hp{constructor(e,t){super(e,"Regular",t)}},BWIDTH:class extends Hp{constructor(e,t){super(e,"Width",t)}},BPERC:class extends Hp{constructor(e,t){super(e,"Percent",t)}},OBVOL:class extends up{constructor(e,t){super(e,t);const i=Cy(Ka.OBVOL,function(e){let t=null;if(e>0){const i=this.baseVal(Ka.Close,e),s=this.baseVal(Ka.Volume,e),n=this.baseVal(Ka.Close,e-1);let r=this.container.getData(this.target)[e-1];ie(r)||(r=0),t=i>n?r+s:i<n?r-s:r}return{[this.target.id]:t}},t),s=Oy(e,"MA","Average")(i,this.period,Ka.OBVOL,Ka.OBVOLAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Ka.OBVOL,1),this.wrapInner(Ka.OBVOLAVG,2)]}},ATR:class extends up{constructor(e,t){super(e,t);const i=my(t,Ka.TR),s=Oy(e,"SMA")(i,this.inputs.Period,Ka.TR,this.target),n=ay(s,this.inputs.Period2,Ka.ATR,Ka.ATRMA);this.addInner(s,n)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(Ka.ATRMA,2)]}},ADR:class extends mg{constructor(e,t){super(e,!1,t)}},ATRP:class extends up{constructor(e,t){super(e,t);const i=gy(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(1,Ka.ATR,e),s=this.baseVal(Ka.Close,e);return ie(i,s)&&s>0&&(t=i/s*100),{[Ka.ATRP.id]:t}}},ADRP:class extends mg{constructor(e,t){super(e,!0,t)}},ADX:class extends jp{constructor(e,t){super(e,!1,Ka.ADX,t)}},ADXMOD:class extends jp{constructor(e,t){super(e,!0,Ka.ADXM,t)}},ADL:class extends up{constructor(e,t){super(e,t);const i=Ty(t);this.addInner(i)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,Ka.MFMUL,e),{[this.target.id]:t}}},ADWM:class extends up{constructor(e,t){super(e,t);const i=Cy(Ka.ADWM,function(e){let t=null,i=null;if(e>0){const s=this.baseVal(Ka.Close,e-1),n=Math.max(s,this.baseVal(Ka.High,e)),r=Math.min(s,this.baseVal(Ka.Low,e)),o=this.baseVal(Ka.Close,e);if(t=o>s?o-r:o<s?o-n:0,e>1){i=(e>2?this.container.getData(Ka.ADWM)[e-1]:0)+t}}return{[Ka.ADWM.id]:i}},t),s=ay(i,this.inputs.Period,Ka.ADWM,Ka.ADWMMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Ka.ADWM,1),this.wrapInner(Ka.ADWMMA,2)]}},CHAOSC:class extends up{constructor(e,t){super(e,t);const i=Ka.ADL;let s=function(e,t=Ka.ADL){return ny("ADL",sy(t),e)}(t,i),n=ly(s,3,i),r=ly(s,10,i),o=by(e.target,(e,t,i)=>t-i,n,r);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},TP:class extends up{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=w([Ka.Close,Ka.High,Ka.Low].map(t=>this.baseVal(t,e))),{[this.target.id]:t}}},KELCHN:class extends sf{constructor(e,t){super(e,ef,t)}},KELBND:class extends sf{constructor(e,t){super(e,tf,t)}},DONCHN:class extends nf{constructor(e,t){super(e,!1,t)}},DONWIDTH:class extends nf{constructor(e,t){super(e,!0,t)}},PVT:class extends up{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){const i=this.baseVal(Ka.Close,e),s=this.baseVal(Ka.Volume,e),n=this.baseVal(Ka.Close,e-1);let r=this.container.getData(this.target)[e-1];ie(r)||(r=0);t=r+(i-n)/n*s}return{[this.target.id]:t}}},ROC:class extends up{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i+1)){const s=this.baseVal(this.source,e-i);if(null!==s&&0!==s){t=(this.baseVal(this.source,e)-s)/s*100}}return{[this.target.id]:t}}},TRIX:class extends up{constructor(e,t){super(e,t);const i=ly(t,this.inputs.Period,this.source),s=ly(i,this.inputs.Period,i.target),n=ly(s,this.inputs.Period,s.target),r=Ay(n,1,n.target,this.target);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}},PPMOV:class extends up{constructor(e,t){super(e,t);const i=yy(t,Ka.PVPT);this.addInner(i)}calculateAt(e){const t=this.innVal(1,Ka.PVPT,e),i=this.baseVal(Ka.High,e),s=this.baseVal(Ka.Low,e);return{[Ka.PVPTR.id]:t+i-s,[Ka.PVPTS.id]:t-i+s}}getWrappers(){return[this.wrapInner(Ka.PVPT,1)]}},PIVPTS:class extends jf{constructor(e,t){super(e,Yf[e.inputs.Previous],t)}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null,a=null;if(!this.disabled){const e=this.getValues(this.inputs.Previous);if(R(e)){const[l,c,u]=e;t=(l+c+u)/3;const h=2*t;i=h-c,s=h-l;const d=l-c;n=t+d,r=t-d,o=l+2*(t-c),a=c-2*(l-t)}}return{[Ka.PPTPIV.id]:t,[Ka.PPTR1.id]:i,[Ka.PPTR2.id]:n,[Ka.PPTR3.id]:o,[Ka.PPTS1.id]:s,[Ka.PPTS2.id]:r,[Ka.PPTS3.id]:a}}},CPP:class extends jf{constructor(e,t){super(e,Yf.Day,t)}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null,a=null,l=null;if(!this.disabled){const e=this.getValues("Day");if(R(e)){const[c,u,h]=e,d=c-u,[p,f,m,g]=[2,4,6,12].map(e=>1.1/e*d);a=h+p,r=h+f,s=h+m,t=h+g,i=h-g,n=h-m,o=h-f,l=h-p}}return{[Ka.CPPH4.id]:a,[Ka.CPPH3.id]:r,[Ka.CPPH2.id]:s,[Ka.CPPH1.id]:t,[Ka.CPPL1.id]:i,[Ka.CPPL2.id]:n,[Ka.CPPL3.id]:o,[Ka.CPPL4.id]:l}}},ARNUPDW:class extends af{constructor(e,t){super(e,!1,t)}},ARNOSC:class extends af{constructor(e,t){super(e,!0,t)}},TCHN:class extends up{constructor(e,t){super(e,t);const i="Close"===e.inputs.Range,s=Ny(t);if(!i&&s){const e=Cy(Ka.TCHNUP,(e,t)=>null,t),i=Cy(Ka.TCHNLOW,(e,t)=>null,t);this.addInner(e,i)}else{let s=dy(t,e.inputs.PeriodUpper,i?Ka.Close:Ka.High,Ka.TCHNUP,!0),n=dy(t,e.inputs.PeriodLower,i?Ka.Close:Ka.Low,Ka.TCHNLOW,!1);this.addInner(s,n)}}getWrappers(){return[this.wrapInner(Ka.TCHNUP,1),this.wrapInner(Ka.TCHNLOW,2)]}},TCHRE:class extends up{constructor(e,t){super(e,t);const i=function(e,t,i){const s="TCHN",n={PeriodUpper:t,PeriodLower:t,Range:i},r=ry(s);return ny(s,{inputs:n,outFields:r,source:null},e)}(t,e.inputs.Period,e.inputs.Range);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(1,Ka.TCHNUP,e),s=this.innVal(1,Ka.TCHNLOW,e),n=this.inputs.Adjustment,r=this.inputs.Retracement;return"Long"===r?t=ie(i)?i-n:null:"Short"===r&&(t=ie(s)?s+n:null),{[this.target.id]:t}}},ALLG:class extends up{constructor(e,t){super(e,t);const i=Cy(lf,M(qp,lf),t),s=cy(i,e.inputs.Period1,lf,Ka.ALJAW),n=cy(i,e.inputs.Period2,lf,Ka.ALTEETH),r=cy(i,e.inputs.Period3,lf,Ka.ALLIPS);this.addInner(s,n,r)}calculateAt(e){return{[Ka.ALJAW.id]:this.innVal(1,Ka.ALJAW,e),[Ka.ALTEETH.id]:this.innVal(2,Ka.ALTEETH,e),[Ka.ALLIPS.id]:this.innVal(3,Ka.ALLIPS,e)}}},PLTLN:class extends up{constructor(e,t){super(e,t)}calculateAt(e){return{[Ka.PLTLN.id]:this.inputs.Position}}},AWEOSC:class extends up{constructor(e,t){super(e,t);const i=Cy(cf,M(qp,cf),t),s=ay(i,this.inputs.Period1,cf),n=ay(i,this.inputs.Period2,cf),r=by(Ka.AWOS,(e,t,i)=>t-i,s,n),o=ay(r,this.inputs.Period3,r.target,Ka.AWOSMA);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Ka.AWOS,1),this.wrapInner(Ka.AWOSMA,2)]}},MFV:class extends uf{constructor(e,t){super(e,!0,t)}},CLV:class extends uf{constructor(e,t){super(e,!1,t)}},CHAMF:class extends up{constructor(e,t){super(e,t);const i=Ty(t);this.addInner(i)}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i)){const s=this.past(e,i,Ka.Volume),n=this.past(e,i,Ka.MFMUL,this.innCont(1));if(R(s)&&R(n)){const e=O(s);0!==e&&(t=O(n)/e)}}return{[this.target.id]:t}}},CHAVOL:class extends up{constructor(e,t){super(e,t);const i=Ay(ly(Cy(hf,M(Xp,hf),t),this.inputs.Period1,hf),this.inputs.Period2,Ka.EMA,this.target);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},DPO:class extends up{shift;constructor(e,t){super(e,t);const i=this.inputs.Period;this.shift=Math.floor(i/2)+1;const s=ay(t,i,e.source);this.addInner(s)}calculateAt(e){let t=null;const i=this.shift,s=this.innVal(1,Ka.MA,e-i);return null!==s&&(t=this.baseVal(this.source,e)-s),{[this.target.id]:t}}},CCI:class extends up{constructor(e,t){super(e,t);const i=yy(t),s=ay(i,this.inputs.Period,i.target,df);this.addInner(i,s)}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,Ka.TP,this.innCont(1));if(R(s)){const i=this.innVal(2,df,e);if(null!==i){const n=s.reduce((e,t,s)=>e+Math.abs(i-t),0)/this.period;t=(this.innVal(1,Ka.TP,e)-i)/(.015*n)}}}return{[this.target.id]:t}}},EMV:class extends up{constructor(e,t){super(e,t);const i=Cy(Ka.EMV,function(e){let t=null;if(e>0){const i=[Ka.High,Ka.Low,Ka.Volume],[s,n,r]=i.map(t=>this.baseVal(t,e)),o=[Ka.High,Ka.Low],[a,l]=o.map(t=>this.baseVal(t,e-1));t=((s+n)/2-(a+l)/2)/(r/1e6/(s-n))}return{[this.target.id]:t}},t),s=ay(i,this.inputs.Period,Ka.EMV,Ka.EMVMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Ka.EMV,1),this.wrapInner(Ka.EMVMA,2)]}},ERBRPOW:class extends pf{constructor(e,t){super(e,!1,t)}},ERBLPOW:class extends pf{constructor(e,t){super(e,!0,t)}},FI:class extends up{constructor(e,t){super(e,t);const i=ly(Cy(ff,function(e){let t=null;if(e>0){const i=this.baseVal(Ka.Close,e),s=this.baseVal(Ka.Volume,e);t=(i-this.baseVal(Ka.Close,e-1))*s}return{[this.target.id]:t}},t),this.inputs.Period,ff,Ka.FI);this.addInner(i)}getWrappers(){return[this.wrapInner(Ka.FI,1)]}},MI:class extends up{constructor(e,t){super(e,t);const i=ly(Cy(mf,M(Xp,mf),t),9,mf,gf),s=ly(i,9,gf,yf),n=by(Af,(e,t,i)=>t/i,i,s);this.addInner(n)}calculateAt(e){let t=null;if(this.atLeast(e,25)){const i=this.past(e,25,Af,this.innCont(1));R(i)&&(t=O(i))}return{[this.target.id]:t}}},MOM:class extends up{constructor(e,t){super(e,t);const i=this.inputs.Period,s=Cy(Ka.MOM,_(Iy,i,Ka.Close),t),n=ay(s,this.inputs.Movement,Ka.MOM,Ka.MOMMA);this.addInner(s,n)}getWrappers(){return[this.wrapInner(Ka.MOM,1),this.wrapInner(Ka.MOMMA,2)]}},MFI:class extends up{constructor(e,t){super(e,t);const i=yy(t);this.addInner(i)}calculateAt(e){let t=null;const i=this.period+1;if(this.atLeast(e,i)){const s=this.past(e,i,Ka.TP,this.innCont(1)),n=this.past(e,i,Ka.Volume).map(e=>null!=e?e:0);if(R(s)&&R(n)){let e=0,r=0;for(let t=1;t<i;++t){const i=s[t]*n[t];s[t]>s[t-1]?e+=i:r+=i}t=100-100/(1+e/r)}}return{[this.target.id]:t}}},MSD:class extends up{constructor(e,t){super(e,t),My(this);const i=ay(t,this.inputs.Period,this.source);this.addInner(i)}calculateAt(e){let t=null;const[i,s]=_y(this),n=this.innVal(i+1,Ka.MA,e);if(null!==n){const i=this.inputs.Period;let r=this.past(e,i,this.source,s);r=r.map(e=>(e-n)*(e-n)),t=Math.sqrt(w(r))}return{[this.target.id]:t}}getWrappers(){const[e]=_y(this);return[this.wrapInner(Ka.MA,e+1)]}},NVI:class extends vf{constructor(e,t){super(e,Tf,t)}},PVI:class extends vf{constructor(e,t){super(e,Sf,t)}},PPO:class extends _p{constructor(e,t){super(e,Ep,t)}},PVO:class extends _p{constructor(e,t){super(e,Lp,t)}},HV:class extends up{constructor(e,t){super(e,t);const i=Math.sqrt(Ry(e.aggregation));if(0===i){const e=Cy(this.target,(e,t)=>null,t);this.addInner(e)}else{const s=function(e,t){let i=null;const s=this.baseVal(Ka.MSD,t);return null!==s&&(i=100*s*e),{[Ka.HV.id]:i}},n=vy(Cy(Pf,M(function(e,t){let i=null;if(t>0){const s=this.baseVal(e,t),n=this.baseVal(e,t-1);null!==s&&null!==n&&(i=Math.log(s/n))}return{[Pf.id]:i}},Ka.Close),t),e.inputs.Period,Pf,Ka.MSD),r=Cy(Ka.HV,M(s,i),n);this.addInner(r)}}getWrappers(){return[this.wrapInner(this.target,1)]}},PERF:class extends up{noOp;constructor(e,t){super(e,t);const i="VisibleStart"===this.inputs.Anchor;this.noOp=i}calculateAt(e){let t=null;const 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 up{constructor(e,t){super(e,t)}get helpers(){return[Cf]}ohlcVals(e){return[Ka.Open,Ka.High,Ka.Low,Ka.Close].map(t=>this.baseVal(t,e))}obtainR(e,t,i,s){const n=Math.abs(e-s),r=Math.abs(t-s),o=Math.abs(e-t),a=Math.max(n,r,o),l=.25*Math.abs(s-i);return a===n?n-.5*r+l:a===r?r-.5*n+l:o+l}calculateAt(e){let t=null,i=null;if(e>0){let s=this.container.getData(Cf)[e-1];ie(s)||(s=0);const[n,r,o,a]=this.ohlcVals(e),[l,c,u,h]=this.ohlcVals(e-1);if(R([n,r,o,a,l,h])){const e=Math.max(Math.abs(r-h),Math.abs(o-h)),c=this.inputs.Limit;t=(a-h+.5*(a-n)+.25*(h-l))/this.obtainR(r,o,l,h)*50*(e/c),i=s+t}}return{[Cf.id]:t,[this.target.id]:i}}},WWVOL:class extends up{constructor(e,t){super(e,t);const i=gy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[Ef,bf]}calculateAt(e){let t=null,i=null,s=null,n=null,r=this.innVal(1,Ka.ATR,e);if(null!==r){const o=this.baseVal(Ka.Close,e),a=this.baseVal(Ka.Close,e-1),l=this.period;s=Math.max(...this.past(e,l,Ka.Close)),n=Math.min(...this.past(e,l,Ka.Close));const c=r*this.inputs.Constant;if(null===this.innVal(1,Ka.ATR,e-1)){o>a?t=s-c:i=n+c}else{const r=[Ka.WWVSARU,Ka.WWVSARD,Ef,bf],[a,l,u,h]=r.map(t=>this.container.getData(t)[e-1]);s=u,n=h;null!==a?o<a?(n=o,i=o+c):(s=Math.max(o,s),t=s-c):o>l?(s=o,t=o-c):(n=Math.min(o,n),i=n+c)}}return{[Ef.id]:s,[bf.id]:n,[Ka.WWVSARU.id]:t,[Ka.WWVSARD.id]:i}}},PARTP:class extends up{constructor(e,t){super(e,t)}get helpers(){return[Lf,Mf,_f]}hlcVals(e){return[Ka.High,Ka.Low,Ka.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,n=null,r=null,o=null;if(e>0){const[a,l,c]=this.hlcVals(e),[u,h,d]=this.hlcVals(e-1),p=this.reciprocal(this.inputs.Acceleration),f=this.reciprocal(this.inputs.Limit);if(1===e){r=c>d?1:-1;const e=1===r;o=e?h:u,s=e?Math.max(a,u):Math.min(l,h),n=p,e?t=o:i=o}else{const c=[_f,Ka.PARSARS,Ka.PARSARL,Lf,Mf],[d,m,g,y,A]=c.map(t=>this.me(t,e-1)),S=1===d,T=S?g:m,v=A*Math.abs(y-T);r=S?T+v>l?-1:1:T-v<a?1:-1;const P=d===r;if(o=P?S?Math.min(T+v,h,this.baseVal(Ka.Low,e-2)):Math.max(T-v,u,this.baseVal(Ka.High,e-2)):y,s=P?S?Math.max(a,y):Math.min(l,y):1===r?a:l,n=A,P){(S?s>y:s<y)&&A<f&&(n=A+p)}else n=p;1===r?t=o:i=o}}return{[Lf.id]:s,[Mf.id]:n,[_f.id]:r,[Ka.PARSARS.id]:i,[Ka.PARSARL.id]:t}}},MOVLR:class extends up{xSum;xSum2;x2Sum;constructor(e,t){super(e,t);const 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;const i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,this.source);if(R(s)){const e=O(s),n=(i*O(s.map((e,t)=>e*(t+1)))-this.xSum*e)/(i*this.x2Sum-this.xSum2);t=(e-n*this.xSum)/i+n*i}}return{[this.target.id]:t}}},TRSP:class extends up{haveEnoughData=!1;firstUsefulIndex=0;s3;itr;constructor(e,t){super(e,t),this.s3=this.itr=[];const i=["VelocityUpTrend","VelocitySideTrend","VelocityDownTrend"].map(t=>e.inputs[t]||"3").map(Number);If.splice(6,3,...i)}get helpers(){return[xf]}prepareComputation(){const e=this.base.getData(Ka.Close);let t=0,i=0;const s=e.length;for(;i<72&&t<s;)null!=e[t]&&i++,t++;this.haveEnoughData=t<s,this.firstUsefulIndex=t,this.s3=Df(s),this.itr=Df(s),this.haveEnoughData&&Vf(e,this.s3,s)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,i){const s=this.base.getData(Ka.Close),n=s.length;this.haveEnoughData&&Vf(s,this.s3,n),super.recalculateAt(e,t,i)}calculateAt(e){let t=null,i=null,s=null;const n=t=>this.us(t,e-1);if(0===e)this.prepareComputation();else if(this.haveEnoughData&&e>=this.firstUsefulIndex&&null!==this.baseVal(Ka.Close,e)){let r=n(Ka.TRSP1),o=n(Ka.TRSP2);s=n(xf),null===r&&null===o&&(r=o=this.baseVal(Ka.Close,this.firstUsefulIndex)),null===s&&(s=1);const a=this.base.getData(Ka.Close);s=function(e,t,i,s,n,r){let o=i;do{o--}while(e[o]<=0);return t[i]=t[o],e[i]>n&&t[o]<=0&&(t[i]=t[o]+1),e[i]<s&&t[o]>=0&&(t[i]=t[o]-1),r++,t[i]!==t[o]&&(r=1),r}(a,this.itr,e,r,o,s);const l=Rf(a,this.s3,this.itr,e,If),c=wf(a,this.s3,this.itr,e,If);[r,o]=Nf(a,this.s3,this.itr,e,If,r,o,s,l,c),this.itr[e]>=0&&(t=r),this.itr[e]<=0&&(i=o)}return{[xf.id]:s,[Ka.TRSP1.id]:t,[Ka.TRSP2.id]:i}}},COTLC:zf,COTDAG:class extends Wf{constructor(e,t){super(e,2,t)}},COTFTR:class extends Wf{constructor(e,t){super(e,3,t)}},IMPVOL:class extends up{constructor(e,t){super(e,lp(t,e=>new Kf(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(Ka.IMPVOL,0)]}},CTM:class extends _p{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,Cp,t)}},CPMI:class extends _p{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,bp,t)}},DEMA:class extends up{constructor(e,t){super(e,t);const i=ly(t,this.inputs.Period,this.source),s=ly(i,this.inputs.Period,i.target),n=by(Ka.DEMA,(e,t,i)=>2*t-i,i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(Ka.DEMA,1)]}},EOSC:class extends up{constructor(e,t){super(e,t);const i=ly(t,this.inputs.Period1,this.source),s=ly(t,this.inputs.Period2,this.source),n=by(Ka.EOSC,(e,t,i)=>t-i,i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(Ka.EOSC,1)]}},TEMA:class extends up{constructor(e,t){super(e,t);const i=ly(t,this.inputs.Period,this.source),s=ly(i,this.inputs.Period,i.target),n=ly(s,this.inputs.Period,s.target),r=by(Ka.TEMA,(e,t,i,s)=>3*(t-i)+s,i,s,n);this.addInner(r)}getWrappers(){return[this.wrapInner(Ka.TEMA,1)]}},TSI:class extends up{constructor(e,t){super(e,t);const i=(e,t,i,s,n,r)=>{const o=ly(e,t,i,s);return ly(o,n,s,r)},s=Cy(Qf,M((e,t)=>({[e.id]:Math.abs(this.baseVal(Ka.Change,t))}),Qf),t),n=i(t,e.inputs.Period1,Ka.Change,em,e.inputs.Period2,tm),r=i(s,e.inputs.Period1,Qf,im,e.inputs.Period2,sm),o=by(Ka.TSI,(e,t,i)=>100*t/i,n,r),a=ly(o,e.inputs.Period3,Ka.TSI,Ka.TSISIG);this.addInner(o,a)}getWrappers(){return[this.wrapInner(Ka.TSI,1),this.wrapInner(Ka.TSISIG,2)]}},ADJATR:class extends up{constructor(e,t){super(e,t);const i=Cy(Bp,M((e,t)=>{let i=0;return t>0&&(i=this.baseVal(e,t)-this.baseVal(e,t-1)),{[Bp.id]:Math.abs(i)}},this.source),t),s=Oy(e,"MA")(i,this.inputs.Period,Bp,Fp),n=by(Ka.ADJATR,(e,t)=>2*t,s);this.addInner(n)}getWrappers(){return[this.wrapInner(Ka.ADJATR,1)]}},COTR:class extends up{constructor(e,t){super(e,t);const i=Cy(kp,e=>{let t=0;return e>0&&(t=this.baseVal(Ka.Close,e)-this.baseVal(Ka.Close,e-1)),{[kp.id]:t}},t),s=function(e){const t=e.inputs.TypeOfATR.toLowerCase();return wy[t]}(e),n=s(t,this.inputs.Period,this.inputs.Smoothing),r=by(this.target,(e,t,i)=>ie(t)&&ie(i)?t/i:null,i,n);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCGD:class extends up{constructor(e,t){super(e,t);const i=ly(t,this.inputs.Period,Ka.Close);this.addInner(i)}calculateAt(e){let t=null;const i=e>0?this.container.getData(this.target)[e-1]:null,s=this.innVal(1,Ka.EMA,e);if(te(i)){const n=this.baseVal(this.source,e),r=Math.pow(n/i,4);t=i+(n-i)/(.6*this.period*r);const o=e=>Math.log10(Math.abs(e-t))>1,a=o(i)||o(s);Number.isFinite(t)&&!a||(t=null)}else t=s;return{[this.target.id]:t}}},HMA:class extends up{constructor(e,t){super(e,t);const i=this.inputs.Period,s=Math.floor(i/2),n=this.allowEmptyValues,r=uy(t,s,this.source,Ka.WMA,n),o=uy(t,i,this.source,Ka.WMA,n),a=uy(by(nm,(e,t,i)=>2*t-i,r,o),Math.floor(Math.sqrt(i)),nm,this.target,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},COPP:class extends up{constructor(e,t){super(e,t);const i=Ay(t,this.inputs.PeriodRocLong),s=Ay(t,this.inputs.PeriodRocShort),n=uy(by(rm,(e,t,i)=>t+i,i,s),this.inputs.PeriodWma,rm,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},REATRS:class extends up{constructor(e,t){super(e,t);const i="Close"===e.inputs.TurtleChnField,s="Long"===e.inputs.Direction,n=Ny(t);if(!i&&n){const e=Cy(this.target,(e,t)=>null,t);this.addInner(e)}else{const e=ay(Cy(om,M((e,t)=>({[om.id]:t>0?e*Math.abs(this.baseVal(Ka.Change,t)):null}),this.inputs.FactorATR),t),this.inputs.PeriodAdjATR,om,Ka.MA),n=s?Ka.High:Ka.Low,r=dy(t,this.inputs.PeriodTurtleChn,i?Ka.Close:n,am,s),o=by(lm,(e,t)=>this.inputs.FactorAdjATR*t,e),a=s?-1:1,l=(e,t,i)=>t+a*i,c=by(this.target,l,r,o);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}},LINRCHN:class extends up{state;constructor(e,t){super(e,t),this.resetState()}resetState(){const e=this.inputs.ExtendLines??"None";this.state={startIndex:null,endIndex:null,slope:null,intercept:null,stdDevWidth:null,extendLeft:"Left"===e||"Both"===e,extendRight:"Right"===e||"Both"===e}}calculateAt(e){const t=this.inputs.Period,i=this.inputs.Width;if(e===this.base.size-1&&this.base.size>=t){this.resetState();const e=t*(t+1)/2,s=e*e,n=t*(t+1)*(2*t+1)/6;let r=0,o=0,a=1;const l=this.base.size-t;for(let i=0;i<t;++i){const e=this.baseVal(Ka.Close,l+i);r+=e,o+=a*e,a+=1}const c=(t*o-e*r)/(t*n-s),u=r/t-c*e/t;let h=0;for(let i=0;i<t;++i){const e=this.baseVal(Ka.Close,l+i)-(u+c*(i+1));h+=e*e}const d=Math.sqrt(h/t);this.state.startIndex=l,this.state.endIndex=this.base.size-1,this.state.slope=c,this.state.intercept=u,this.state.stdDevWidth=ie(d)?i*d:null}return{}}getCurrentState(){return this.state}},CSHO:class extends up{computeDone;constructor(e,t){super(e,t,lp(t,e=>{const t=ue(e);var i;t.symbol=Fi(i=e.symbol)?`${Zi(i)}Y00`:null;return ie(t.symbol)?new Ch(t):new bh(t,!0)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){const e=this.innCont(0);if(!ie(e)||0===e.size)return;const t=this.innCont(1),i=e.getTimeData(),s=t.getTimeData(),n=t.getData(Ka.Close),r=Array(i.length).fill(null);if(!(this.innerSeries[1]instanceof bh)){let o=0;const a=e.size,l=t.size;for(let e=0;e<a;++e){for(;o<l&&s[o].getTime()<i[e].getTime();)o++;o<l&&s[o].getTime()===i[e].getTime()&&(r[e]=n[o])}}this.container.setData(this.target,r)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignCashTimelineWithUnderlying(),this.computeDone=!0,this.notify(qa.TS_MANYCHANGED,-1))}},CSHB:class extends up{constructor(e,t){super(e,t,function(e,t=Ka.CSHO){return ny("CSHO",sy(t),e)}(t))}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e===this.innerSeries[1]&&this.innHasData(0)&&this.innHasData(1)}calculateAt(e){const t=(t,i)=>ie(this.innCont(t))?this.innVal(t,i,e):null,i=t(0,Ka.Close),s=t(1,Ka.CSHO);return{[this.target.id]:ie(s)&&ie(i)?s-i:null}}},MKTCAP:class extends up{computeDone;constructor(e,t){super(e,t,lp(t,e=>{const t=new ip(e.symbol,new Wo(e.aggregation.unit===a.Year?a.Year:a.Quarter,1),m.BalanceSheet);return t.fields=[Ka.SharesOutstanding],t.cacheMe=!0,new Mh(t)})),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignFundamentalTimelineWithUnderlying(){const e=this.innCont(0);if(!ie(e)||0===e.size)return;const t=this.innCont(1);if(!ie(t)||0===t.size)return;const i=e.getTimeData(),s=t.getTimeData(),n=t.getData(Ka.SharesOutstanding),r=e.getData(Ka.Close),o=Array(i.length);let a=0;const l=e.size,c=t.size;for(let u=0;u<l;++u){const e=i[u].getTime();for(;a<c-1&&s[a+1].getTime()<=e;)a++;if(a<c&&s[a].getTime()<=e){const e=n[a],t=r[u];o[u]=ie(e,t)?e*t:null}}this.container.setData(this.target,o)}calculate(e){this.computeDone||(this.container=this.makeContainer(),this.alignFundamentalTimelineWithUnderlying(),this.computeDone=!0,this.notify(qa.TS_MANYCHANGED,-1))}},CTPI:class extends Np{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,Ka.CTPI,t)}},PCTCHG:class extends up{constructor(e,t){super(e,t),My(this)}calculateAt(e){let t=null;const[i]=_y(this);if(e>0){const s=this.innVal(i,this.source,e-1);if(null!==s){t=100*(this.innVal(i,this.source,e)-s)/s}}return{[this.target.id]:t}}},OPINT:class extends mp{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(Ka.TradeSize,Ka.Change)}},STOMOMIX:class extends up{constructor(e,t){super(e,t);const i=dy(t,e.inputs.Period1,Ka.High,Ka.HH,!0),s=dy(t,e.inputs.Period1,Ka.Low,Ka.LL,!1),n=ly(by(um,(e,t,i)=>this.baseVal(Ka.Close,e)-(t+i)/2,i,s),e.inputs.Period2,um,hm),r=ly(n,e.inputs.Period2,hm,dm),o=ly(by(pm,(e,t,i)=>t-i,i,s),e.inputs.Period2,pm,fm),a=ly(o,e.inputs.Period2,fm,mm),l=by(Ka.STOMOMIX,(e,t,i)=>100*t/i,r,a);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},CHDMOMOSC:class extends up{constructor(e,t){super(e,t);const i=new Sm(e,t),s=Oy(e,"MA","Average")(i,this.inputs.PeriodAvg,Ka.CHDMOMOSC,Ka.CHDMOMOSCAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Ka.CHDMOMOSC,1),this.wrapInner(Ka.CHDMOMOSCAVG,2)]}},VSTOP:class extends up{constructor(e,t){super(e,t);const i=gy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[Tm,vm,Pm]}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null,a=1;const l=this.baseVal(Ka.Close,e),c=e=>((e,t)=>ie(e)?e:t)(e,0),u=(e,t)=>this.container.getData(e)[t];e>0&&(s=Math.max(c(u(Tm,e-1)),l),r=Math.min(c(u(vm,e-1)),l),a=u(Pm,e-1));const h=this.inputs.Multiplier,d=this.innVal(1,Ka.ATR,e);if(ie(d)){const c=1===a,p=c?s-h*d:r+h*d;let f=u(c?Ka.VSTOPUP:Ka.VSTOPLOW,e-1);ie(f)||(f=0);const m=c?Math.max(f,p):Math.min(f,p);o=l-m>=0?1:0;const g=o!=a;i=g?l:s,n=g?l:r,t=g?1===o?i-h*d:n+h*d:m}return{[Ka.VSTOPUP.id]:1===o?t:null,[Ka.VSTOPLOW.id]:1===o?null:t,[Tm.id]:i,[vm.id]:n,[Pm.id]:o}}},SUPTR:class extends up{constructor(e,t){super(e,t);const i=gy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[Cm,bm,Em,Ka.BARCOLIX]}calculateAt(e){let t=0,i=0,s=0,n=null,r=0;const o=this.innVal(1,Ka.ATR,e);if(ie(o)){const a=(e,t)=>ie(e)?e:t,l=[Ka.Close,Ka.High,Ka.Low],[c,u,h]=l.map(t=>this.baseVal(t,e)),d=(u+h)/2,p=this.baseVal(Ka.Close,e-1),f=this.inputs.Multiplier,m=d-f*o,g=d+f*o,y=[Cm,bm,Em],[A,S,T]=y.map(t=>this.container.getData(t)[e-1]);t=p>A?Math.max(m,A):m,i=p<S?Math.min(g,S):g,s=c>S?1:c<A?-1:a(T,1);const v=1===s;n=v?t:i,r=v?1:0}return{[Cm.id]:t,[bm.id]:i,[Em.id]:s,[Ka.SUPTR.id]:n,[Ka.BARCOLIX.id]:r}}},ICHCLD:class extends up{constructor(e,t){super(e,t);const i=(e,t,i)=>by(i,(e,t,i)=>(t+i)/2,e,t),s=(e,s)=>i((e=>dy(t,e,Ka.Low,Ka.LL,!1))(e),(e=>dy(t,e,Ka.High,Ka.HH,!0))(e),s),n=s(e.inputs.PeriodConversionLine,Ka.CONVLN),r=s(e.inputs.PeriodBaseLine,Ka.BASELN),o=i(n,r,Ka.LEADSP1),a=s(e.inputs.PeriodLaggingSpan2,Ka.LEADSP2);this.addInner(n,r,o,a)}get helpers(){return[Ka.BARCOLIX]}calculateAt(e){const t=this.innVal(3,Ka.LEADSP1,e)>this.innVal(4,Ka.LEADSP2,e)?1:0;return{[Ka.LAGGSP.id]:this.baseVal(Ka.Close,e),[Ka.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(Ka.CONVLN,1),this.wrapInner(Ka.BASELN,2),this.wrapInner(Ka.LEADSP1,3),this.wrapInner(Ka.LEADSP2,4)]}},VWAP:class extends xm{constructor(e,t){super(e,t)}get helpers(){return[Lm,Mm,_m]}isSame(e,t){switch(this.inputs.AnchorPeriod){case"Session":default:return ut(e,t);case"Week":return Mi(e,t);case"Month":return _i(e,t);case"Quarter":return xi(e,t);case"Year":return Ii(e,t);case"Decade":return function(e,t){return Au(e)===Au(t)}(e,t);case"Century":return Su(e,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(1===this.valueAt(_m,t))return t;return 0}calculateAt(e){let t=null,i=null,s=null,n=null,r=null;const o=e>0,a=o?this.dateAt(e-1):gs.ZERO_DATE,l=this.dateAt(e),c=o&&this.isSame(a,l),u=c?this.valueAt(Lm,e-1):0,h=c?this.valueAt(Mm,e-1):0,d=this.innVal(0,Ka.Volume,e),p=u+this.innVal(1,this.source,e)*d,f=h+d;if(t=p/f,c){const o=this.findPrevPeriodChange(e-1),a=this.container.getData(Ka.VWAP).slice(o,e);a.push(t);const l=w(a),c=a.map(e=>(e-l)*(e-l)),u=Math.sqrt(w(c)),h=this.inputs.Stdev1stMultiplier*u;i=t+h,s=t-h;const d=this.inputs.Stdev2ndMultiplier*u;n=t+d,r=t-d}else i=t,s=t,n=t,r=t;return{[Lm.id]:p,[Mm.id]:f,[_m.id]:c?0:1,[Ka.VWAP.id]:t,[Ka.VWAPSD1U.id]:i,[Ka.VWAPSD1L.id]:s,[Ka.VWAPSD2U.id]:n,[Ka.VWAPSD2L.id]:r}}},MACROSS:class extends up{constructor(e,t){super(e,t);const i=Oy(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,Ka.MAS),n=i(t,e.inputs.Period2,this.source,Ka.MAL);this.addInner(s,n)}get helpers(){return Dm}calculateAt(e){const t=this.innVal(1,Ka.MAS,e),i=this.innVal(2,Ka.MAL,e);return Om(this.container,e,t,i)}getWrappers(){return[this.wrapInner(Ka.MAS,1),this.wrapInner(Ka.MAL,2)]}},PACROSS:class extends up{_maIndex;_maTarget;constructor(e,t){super(e,t),My(this);const i=Oy(e,"MA","Average")(t,e.inputs.Period,this.source);this.addInner(i);const[s]=_y(this);this._maIndex=s+1,this._maTarget=i.target}get helpers(){return Dm}calculateAt(e){const t=this.innVal(this._maIndex,this._maTarget,e),[,i]=_y(this),s=i.getData(this.source)[e],n=Om(this.container,e,s,t);return n[this.target.id]=t,n}},VOIN:class extends up{constructor(e,t){super(e,t);const i=Cy(wm,function(e){return{[wm.id]:e>0?Math.abs(this.baseVal(Ka.High,e)-this.baseVal(Ka.Low,e-1)):null}},t),s=Cy(Rm,function(e){return{[Rm.id]:e>0?Math.abs(this.baseVal(Ka.Low,e)-this.baseVal(Ka.High,e-1)):null}},t),n=my(t,Ka.TR);this.addInner(i,s,n)}calculateAt(e){let t=null,i=null;const s=this.period;if(this.atLeast(e,s)){const n=this.past(e,s,wm,this.innCont(1)),r=this.past(e,s,Rm,this.innCont(2)),o=this.past(e,s,Ka.TR,this.innCont(3));if(R(n)&&R(r)&&R(o)){const e=O(n),s=O(r),a=O(o);t=e/a,i=s/a}}return{[Ka.PLVI.id]:t,[Ka.MNVI.id]:i}}},DIFA:class extends up{isPercent;constructor(e,t){super(e,t);const i=Oy(e,"MA","Average")(t,this.period,this.source,Hm);this.isPercent="Percentage"===e.inputs.Distance,this.addInner(i)}get helpers(){return[Ka.BARCOLIX]}calculateAt(e){let t=null,i=null;const s=this.innVal(1,Hm,e),n=this.baseVal(this.source,e);if(null!=s&&0!==s){t=n-s,this.isPercent&&(t=100*t/s);const r=t<=0;if(i=r?1:3,e>0){const s=this.container.getData(this.target)[e-1];null!==s&&(r&&t>s&&(i=0),!r&&t<s&&(i=2))}}return{[this.target.id]:t,[Ka.BARCOLIX.id]:i}}},DOSC:class extends up{constructor(e,t){super(e,t);const i=ly(Sy(t,this.inputs.PeriodRsi,this.source,Ka.RSI),this.inputs.PeriodEma1,Ka.RSI,Ka.EMA),s=ly(i,this.inputs.PeriodEma2,Ka.EMA,Ka.EMA),n=ay(s,this.inputs.PeriodMa,Ka.EMA,Ka.MA);const r=by(Ka.DOSCH,(e,t,i)=>t-i,s,n),o=ay(r,this.inputs.PeriodSig,Ka.DOSCH,Ka.DOSCS);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Ka.DOSCH,1),this.wrapInner(Ka.DOSCS,2)]}},BBANDW:class extends Hp{constructor(e,t){super(e,"BandWidth",t)}},MARIB:class extends up{constructor(e,t){super(e,t);const i=this.inputs.Period,s=this.inputs.Increment,n=Math.min(Math.max(0,this.inputs.Count),10);for(let r=0;r<n;++r){const e=ay(t,i+r*s,this.source,this.outFields[r]);this.addInner(e)}}getWrappers(){const 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 up{constructor(e,t){super(e,t);const i=Oy(e,"EMA","Smoothing1"),s=e.inputs.Period1,n=i(t,s,Ka.Open),r=i(t,s,Ka.High),o=i(t,s,Ka.Low),a=i(t,s,Ka.Close),l=by(Wm,(e,t,i,s,n)=>(t+i+s+n)/4,n,r,o,a);const c=by(Bm,function(e,t,i,s){let n=null;if(e>0){const s=this.container.getData(Bm)[e-1],r=this.innVal(2,Wm,e-1);ie(s,r)?n=(s+r)/2:ie(t,i)&&(n=(t+i)/2)}return n},n,a,l),u=by(Fm,(e,t,i,s)=>ie(t,i,s)?Math.max(t,Math.max(i,s)):null,r,c,l),h=by(km,(e,t,i,s)=>ie(t,i,s)?Math.min(t,Math.min(i,s)):null,o,c,l),d=Oy(e,"EMA","Smoothing2"),p=e.inputs.Period2,f=d(c,p,Bm,Ka.Open),m=d(u,p,Fm,Ka.High),g=d(h,p,km,Ka.Low),y=d(l,p,Wm,Ka.Close),A=Cy(Ka.Change,function(e){let t=null;if(e>0){const i=this.baseVal(Ka.Close,e),s=this.baseVal(Ka.Close,e-1);ie(i,s)?t=i-s:ie(i)&&!ie(s)&&(t=0)}return{[Ka.Change.id]:t}},y);this.addInner(f,m,g,y,A)}getWrappers(){return[this.wrapInner(Ka.Open,1),this.wrapInner(Ka.High,2),this.wrapInner(Ka.Low,3),this.wrapInner(Ka.Close,4),this.wrapInner(Ka.Change,5)]}},TTMSQZ:class extends up{constructor(e,t){super(e,t);const i=e.inputs,s=ly(t,i.PeriodEmaKeltner,Ka.Close),n=gy(t,i.PeriodAtrKeltner);function r(e,t,i,s){return ie(i,s)?i+e*s:null}const o=i.MultiplierKeltner,a=by(Ka.KCUP,M(r,o),s,n),l=by(Ka.KCLOW,M(r,-o),s,n),c=function(e,t,i,s=Ka.Close){const n="BBANDS",r=ry(n),o={[gs.INPUT_PERIOD]:t,[gs.INPUT_WIDTH]:i};return ny(n,{source:s,inputs:o,outFields:r},e)}(t,i.PeriodBollinger,i.WidthBollinger),u=function(e,t){const i="DONCHN",s=ry(i);return ny(i,{inputs:ty(t),outFields:s,source:null},e)}(t,i.PeriodMomentum),h=ay(t,i.PeriodMomentum,Ka.Close);const d=Py(by(Um,function(e,t,i,s){let n=null;const r=this.innVal(1,Ka.DONMID,e);return ie(r,s)&&(n=t-(r+s)/2),n},t,u,h),i.PeriodMomentum,Um,Ka.TTMSQZOSC);this.addInner(a,l,c,d)}get helpers(){return[Ka.BARCOLIX]}calculateAt(e){let t=null,i=null,s=-1;const n=this.innVal(1,Ka.KCUP,e),r=this.innVal(2,Ka.KCLOW,e),[o,a]=[Ka.BOLLBU,Ka.BOLLBL].map(t=>this.innVal(3,t,e));o<n&&a>r?t=0:i=0;const l=this.innVal(4,Ka.TTMSQZOSC,e),c=e>0?this.innVal(4,Ka.TTMSQZOSC,e-1):null;if(ie(l))if(ie(c)){const e=c<l;s=l>=0?e?3:2:e?1:0}else s=2;return{[Ka.TTMSQZON.id]:t,[Ka.TTMSQZOFF.id]:i,[Ka.BARCOLIX.id]:s}}getWrappers(){return[this.wrapInner(Ka.TTMSQZOSC,4)]}},CRS:class extends up{constructor(e,n){if(super(e,n),Hy(n)){const r=Gv().getTimeSeriesDataSource(),o=n.query.duplicate();o.symbol=this.inputs.Symbol.toUpperCase();const l=r.getTimeSeries(o),c=e=>e.query?.symbol,u=(e,t)=>`{${c(e)}} / {${c(t)}}`,{model:h}=ca(u(n,l),!1),d=(e=>{const n=e.unit===a.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:i.Manual,missing:n?t.UseNext:t.UsePrevious,stretch:e=>!1,fieldMap:/* @__PURE__ */new Map([[Ka.Close,Ka.CRS]]),noDataApproach:s.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation),p=new Vm(h,[n,l],d),f=Oy(e,"MA","Average")(p,this.period,Ka.CRS,Ka.CRSAVG);this.addInner(l,p,f),this.canLoadMoreData=!0,this.initialNotification=!0}else{const e=Cy(Ka.Close,(e,t)=>null,n),t=Cy(Ka.CRS,(e,t)=>null,n),i=Cy(Ka.CRSAVG,(e,t)=>null,n);this.addInner(e,t,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(Ka.CRS,2),this.wrapInner(Ka.CRSAVG,3)]}},JPI:ng,CTTP:class extends ng{constructor(e,t){const i=Ur("JPI");e.inputs=fe(i.defaults.inputs.filter(e=>"HandbrakePeriod"!==e.name)),super(e,t)}},CTTI:class extends ng{constructor(e,t){e.inputs=structuredClone(rg),super(e,t)}},DRS:class extends up{get indexSymbol(){return this.inputs[gs.INPUT_SYMBOL]}constructor(e,n){if(super(e,n),Hy(n)){const r=Gv().getTimeSeriesDataSource(),o=n.query.duplicate();o.symbol=this.indexSymbol;const l=r.getTimeSeries(o),c=`{${n.query.symbol}} / {${l.query.symbol}} * 100`,{model:u}=ca(c,!1),h=(e=>{const n=e.unit===a.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:i.Manual,missing:n?t.UseNext:t.UsePrevious,stretch:e=>!1,fieldMap:/* @__PURE__ */new Map([[Ka.Close,Ka.DRS]]),noDataApproach:s.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation),d=new Vm(u,[n,l],h);this.addInner(l,d),this.canLoadMoreData=!0,this.initialNotification=!0}else{const e=Cy(Ka.Close,(e,t)=>null,n),t=Cy(Ka.DRS,(e,t)=>null,n);this.addInner(e,t),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(Ka.DRS,2)]}},MRS:class extends up{get indexSymbol(){return this.inputs[gs.INPUT_SYMBOL]}constructor(e,t){super(e,t);const i=function(e,t,i,s=Ka.DRS){return ny("DRS",{target:s,inputs:iy(t),aggregation:i,source:null},e)}(t,this.indexSymbol,e.aggregation),s=ay(i,this.period,Ka.DRS);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){const t=this.innVal(1,Ka.DRS,e),i=this.innVal(2,Ka.MA,e);let s=null;return ie(t,i)&&0!==i&&(s=100*(t/i-1)),{[Ka.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 up{constructor(e,t){super(e,t);const i=Ay(t,1),s=e.aggregation,n=lg(i,this.inputs.Period1,s,Ka.ROC,og),r=lg(by(ag,(e,t)=>10*t,n),this.inputs.Period2,s,ag,Ka.PMO),o=ly(r,this.inputs.Period3,Ka.PMO,Ka.PMOS);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Ka.PMO,1),this.wrapInner(Ka.PMOS,2)]}},RVOL:class extends up{constructor(e,t){super(e,t);const i=Oy(e,"MA")(t,this.period,Ka.Volume,cg,!0);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(0,Ka.Volume,e),s=this.innVal(1,cg,e);return ie(i,s)&&0!==s&&(t=i/s),{[this.target.id]:t}}},WGALPH:class extends up{isDaily;isFeasible=!0;constructor(e,t){super(e,t),this.isFeasible=!(t instanceof bh||hg.includes(o[t.query.curveStyle])),this.isDaily=e.aggregation.unit===a.Day}acceptable(e,t,i,s){if(!this.isDaily)return e>0&&i-t>=5;if(0===s)return!0;return!Mi(this.baseVal(Ka.DateTime,t),this.baseVal(Ka.DateTime,i))}pluckValues(e){let t=0;const i=[];let s=e+5;for(let n=0;t<53&&e-n>0;n++){const r=e-n,o=this.baseVal(this.source,r);this.acceptable(o,r,s,t)&&(i.push(o),s=r,t++)}return i}calculateAt(e){let t=null;if(this.isFeasible&&e>=131){let i=1;const s=this.pluckValues(e),n=s.length;if(n>=27)for(let e=0;e<n-1;e++){let t=s[e]/s[e+1]-1;t<0?t=Math.max(t,-.2):t>=0&&(t=Math.min(t,.2)),t=t*ug[e]+1,i*=t}t=100*(i-1)}return{[this.target.id]:t}}},VOLAP:class extends pg{constructor(e,t){super(e,!1,t)}},AVWAP:class extends xm{constructor(e,t){super(e,t)}get helpers(){return[Lm,Mm]}isSameOhlcBar(e,t){const{unit:i,size:s}=this.aggregation;switch(i){case a.Tick:return e===t;case a.Intraday:return bi(t,ot(e,s));case a.Day:return bi(t,Xe(e,s));case a.Week:return Mi(e,t);case a.Month:return _i(e,t);case a.Quarter:return xi(e,t);case a.Year:return Ii(e,t);default:throw new Error(`Unexpected aggregation unit ${a[i]}`)}}calculateAt(e){let t=null,i=null,s=null;const n=this.inputs.Anchor,r=this.dateAt(e);if(bi(n,r)||this.isSameOhlcBar(r,n)){const n=e>0,r=n?this.valueAt(Lm,e-1):0,o=n?this.valueAt(Mm,e-1):0,a=this.innVal(0,Ka.Volume,e);i=r+this.innVal(1,this.source,e)*a,s=o+a,t=i/s}return{[Lm.id]:i,[Mm.id]:s,[Ka.AVWAP.id]:t}}},KST:class extends up{constructor(e,t){super(e,t);const i=this.source,s=Cy(i,M(xy,i),t),n=Ay(s,this.inputs.PeriodRoc1,i),r=Ay(s,this.inputs.PeriodRoc2,i),o=Ay(s,this.inputs.PeriodRoc3,i),a=Ay(s,this.inputs.PeriodRoc4,i),l=ay(n,this.inputs.PeriodMa1,Ka.ROC,Ka.MA1),c=ay(r,this.inputs.PeriodMa2,Ka.ROC,Ka.MA2),u=ay(o,this.inputs.PeriodMa3,Ka.ROC,Ka.MA3),h=ay(a,this.inputs.PeriodMa4,Ka.ROC,Ka.MA4),d=by(Ka.KST,(e,t,i,s,n)=>t+2*i+3*s+4*n,l,c,u,h),p=ay(d,this.inputs.PeriodSig,Ka.KST,Ka.KSTSIG);this.addInner(d,p)}getWrappers(){return[this.wrapInner(Ka.KST,1),this.wrapInner(Ka.KSTSIG,2)]}},STC:class extends up{constructor(e,t){super(e,t);const i=ly(t,this.inputs.PeriodShort,Ka.Close,gg),s=ly(t,this.inputs.PeriodLong,Ka.Close,yg),n=by(Ag,(e,t,i)=>t-i,i,s),r=this.inputs.PeriodStoch1,o=this.inputs.PeriodStoch2,a=Oy(e,"EMA"),l=a(py(n,r,Sg,!1,Ag),o,Sg,Tg),c=a(py(l,r,vg,!1,Tg),o,vg,this.target);this.addInner(c)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCCLO:class extends Eg{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){const s=(e,t,i)=>t-i,n="Yes"===this.inputs.RatioAdjusted,r=by(bg,n?(e,t,i)=>(t-i)/(t+i)*1e3:s,t,i),o=ly(r,this.inputs.Period1,bg,Pg),a=ly(r,this.inputs.Period2,bg,Cg);return by(this.target,s,o,a)}},NHLAI:_g,CMBCI:class extends up{constructor(e,t){super(e,t);const i=Sy(t,this.inputs.Period1Rsi,Ka.Close,xg),s=Cy(Ig,_(Iy,this.inputs.Period1Mom,xg),i),n=ay(Sy(t,this.inputs.Period2Rsi,Ka.Close,Dg),this.inputs.Period2Ma,Dg,Og),r=by(Ka.CMBCI,(e,t,i)=>t+i,s,n),o=ay(r,this.inputs.PeriodFastMa,Ka.CMBCI,Ka.CMBCIF),a=ay(r,this.inputs.PeriodSlowMa,Ka.CMBCI,Ka.CMBCIS);this.addInner(r,o,a)}getWrappers(){return[this.wrapInner(Ka.CMBCI,1),this.wrapInner(Ka.CMBCIF,2),this.wrapInner(Ka.CMBCIS,3)]}},COTI:class extends up{constructor(e,t){super(e,function(e){return new zf({source:Ka.Close,inputs:{},outFields:ry("COTLC")},e)}(t));const i=Number.parseInt(this.inputs.History),s=6===i?26:52*i,n=py(this.innerSeries[0],s,Ka.COTI,!1,Ka.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(n)}getWrappers(){return[this.wrapInner(Ka.COTI,1)]}},CHEXI:class extends up{isLong;constructor(e,t){super(e,t),this.isLong="Long"===this.inputs.Direction;const i=this.period,s=gy(t,i),n=this.inputs.Multiplier,r=by(wg,(e,t)=>null===t?null:n*t,s),o=dy(t,i,Ka.High,Ka.HH,!0),a=dy(t,i,Ka.Low,Ka.LL,!1);this.addInner(r,o,a)}calculateAt(e){let t=null,i=null;const s=this.innVal(1,wg,e);if(null!==s)if(this.isLong){t=this.innVal(2,Ka.HH,e)-s}else{i=this.innVal(3,Ka.LL,e)+s}return{[Ka.CHEXL.id]:t,[Ka.CHEXS.id]:i}}},MBBANDS:class extends Hp{constructor(e,t){super(e,"Modified",t)}},OPTIV:class extends Rg{},IVRANK:class extends Rg{},IVPCTL:class extends Rg{},OPTVOLPC:class extends Rg{},OPTOIPC:class extends Rg{},OPTVOL:class extends Rg{},OPTOI:class extends Rg{},CHOP:class extends up{constructor(e,t){super(e,t);const i=gy(t,1),s=this.inputs.Period,n=dy(t,s,Ka.High,Ka.HH,!0),r=dy(t,s,Ka.Low,Ka.LL,!1);this.addInner(i,n,r)}calculateAt(e){let t=null;const i=this.period;if(e>i){const s=this.past(e,i,Ka.ATR,this.innCont(1));if(R(s)){const n=O(s)/(this.innVal(2,Ka.HH,e)-this.innVal(3,Ka.LL,e));t=100*Math.log10(n)/Math.log10(i)}}return{[this.target.id]:t}}},MACLD:class extends up{constructor(e,t){super(e,t);const i=Oy(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,Ka.MACLD1),n=i(t,e.inputs.Period2,this.source,Ka.MACLD2);this.addInner(s,n)}get helpers(){return[Ka.BARCOLIX]}calculateAt(e){const t=this.innVal(1,Ka.MACLD1,e)>this.innVal(2,Ka.MACLD2,e)?1:0;return{[Ka.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(Ka.MACLD1,1),this.wrapInner(Ka.MACLD2,2)]}},BTI:class extends Eg{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){const s=by(Ng,(e,t,i)=>t/(t+i),t,i);return Oy(e,"MA","Average")(s,this.inputs.Period,Ng,this.target)}},FRAMA:class extends up{constructor(e,t){super(e,t),My(this);const i=e.inputs.Period,s=Math.floor(i/2),n=dy(t,i,Ka.High,Gg,!0),r=dy(t,i,Ka.Low,zg,!1),o=dy(t,s,Ka.High,Yg,!0),a=dy(t,s,Ka.Low,jg,!1),l=dy(t,s,Ka.High,Kg,!0),c=dy(t,s,Ka.Low,qg,!1);this.addInner(n,r,o,a,l,c)}calculateAt(e){const t=this.period,i=Math.floor(t/2),[,s]=_y(this),n=s.getData(this.source)[e];if(!this.atLeast(e,t))return{[this.target.id]:n};const r=this.sourceNeedsCompute?1:0,o=this.innVal(1+r,Gg,e),a=this.innVal(2+r,zg,e),l=this.innVal(3+r,Yg,e),c=this.innVal(4+r,jg,e),u=this.innVal(5+r,Kg,e-i),h=this.innVal(6+r,qg,e-i);if(!ie(o,a,l,c,u,h))return{[this.target.id]:n};const d=(o-a)/t,p=(l-c)/i,f=(u-h)/i;let m=0;p>0&&f>0&&d>0&&(m=(Math.log(p+f)-Math.log(d))/Math.log(2));let g=Math.exp(-4.6*(m-1));g=Math.max(.01,Math.min(1,g));const y=e>0?this.container.getData(this.target)[e-1]:n,A=null!==y?g*n+(1-g)*y:n;return{[this.target.id]:A}}},FISHER:class extends up{constructor(e,t){super(e,t);const i=e.inputs.Period,s=Cy(Xg,M(qp,Xg),t),n=dy(s,i,Xg,Ka.HH,!0),r=dy(s,i,Xg,Ka.LL,!1);this.addInner(s,n,r)}get helpers(){return[Zg]}calculateAt(e){const t=this.innVal(1,Xg,e),i=this.innVal(2,Ka.HH,e),s=this.innVal(3,Ka.LL,e);if(!ie(i,s,t))return{[Ka.FISHER.id]:null,[Ka.FISHTRG.id]:null,[Zg.id]:null};const n=i-s,r=t=>this.container.getData(t)[e-1];let o=.66*((0!==n?(t-s)/n:.5)-.5)+.67*((e>0?r(Zg):null)??0);o>.99?o=.999:o<-.99&&(o=-.999);const a=e>0?r(Ka.FISHER):null,l=.5*Math.log((1+o)/(1-o))+.5*(a??0);return{[Ka.FISHER.id]:l,[Ka.FISHTRG.id]:a,[Zg.id]:o}}},PC:class extends up{stdDevs;periodForecast;unitsPerYear;constructor(e,t){super(e,t),this.unitsPerYear=Ry(e.aggregation),this.stdDevs=this.toInt("StandardDeviations"),this.periodForecast=this.toInt("PeriodForecast");const i=this.getHistVolPeriod();if(null!==i){const s=function(e,t,i,s=Ka.Close,n=Ka.HV){return ny("HV",{source:s,target:n,aggregation:i,inputs:ty(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(Ka.HV))/100}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null;if(this.haveVolatility){const a=this.base.size-this.periodForecast;if(e>=a){const l=this.base.getLastDataPoint(Ka.Close),c=e-a+1,u=l*this.getVolatilityPercent()*Math.sqrt(c/this.unitsPerYear);if(t=l+u,i=l-u,this.stdDevs>1){const e=2*u;if(s=l+e,n=l-e,this.stdDevs>2){const e=3*u;r=l+e,o=l-e}}}}return{[Ka.PCUP1.id]:t,[Ka.PCDN1.id]:i,[Ka.PCUP2.id]:s,[Ka.PCDN2.id]:n,[Ka.PCUP3.id]:r,[Ka.PCDN3.id]:o}}recalculateAt(e,t,i){const s={tag:Pe(),src:this.innerSeries[0]};i&&this.calculate(s)}},GREEKS:class extends up{constructor(e,t){super(e,lp(t,e=>new Vg(e))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(Ka.Delta,0),this.wrapInner(Ka.Gamma,0),this.wrapInner(Ka.Theta,0),this.wrapInner(Ka.Vega,0)]}},PVACP:class extends pg{constructor(e,t){super(e,!0,t)}},TDI:class extends up{constructor(e,t){super(e,t),My(this);const i=e.inputs.PeriodRSI,s=e.inputs.PeriodTradeSignal,n=e.inputs.PeriodMarketBase,r=e.inputs.PeriodBB,[o]=_y(this),a=Sy(this.innerSeries[o],i,this.source,Ka.TDIPRC),l=ay(a,s,Ka.TDIPRC,Ka.TDITSL),c=ay(a,n,Ka.TDIPRC,Ka.TDIMBL),u=vy(a,r,Ka.TDIPRC,Ka.MSD);this.addInner(a,l,c,u)}calculateAt(e){const t=this.inputs.MultiplierBB,i=this.sourceNeedsCompute?1:0,s=this.innVal(1+i,Ka.TDIPRC,e),n=this.innVal(2+i,Ka.TDITSL,e),r=this.innVal(3+i,Ka.TDIMBL,e),o=this.innVal(4+i,Ka.MSD,e);let a=null,l=null;if(ie(r,o)){const e=t*o;a=r+e,l=r-e}return{[Ka.TDIPRC.id]:s,[Ka.TDITSL.id]:n,[Ka.TDIMBL.id]:r,[Ka.TDIUPR.id]:a,[Ka.TDILWR.id]:l}}},PPS:class extends up{isLong;isPercent;constructor(e,t){super(e,t);const i=e.inputs.Period,s=e.inputs.Range,n=e.inputs.Direction;this.isLong="Long"===n,this.isPercent="Percent"===e.inputs.Type;const r="Close"===s;let o=Ka.Close;r||(o=this.isLong?Ka.High:Ka.Low);const a=dy(t,i,o,$g,this.isLong);this.addInner(a)}get helpers(){return[Ka.BARCOLIX]}calculateAt(e){let t=null;const i=this.innVal(1,$g,e),s=this.inputs.StopValue;if(null!==i){const e=this.isPercent?i*s/100:s;t=this.isLong?i-e:i+e}const n=this.isLong?1:0;return{[Ka.PPS.id]:t,[Ka.BARCOLIX.id]:n}}},RCI:class extends up{constructor(e,t){super(e,t);const i=this.source,s=new Jg({source:i,target:Ka.RCI,inputs:{Period:e.inputs.Period}},t),n=e.inputs.PeriodSignal,r=Oy(e,"MA","Smoothing")(s,n,Ka.RCI,Ka.RCISIG);this.addInner(s,r)}getWrappers(){return[this.wrapInner(Ka.RCI,1),this.wrapInner(Ka.RCISIG,2)]}},ZIGZAG:class extends up{state;useHighLow;isAtrMode;atrMult;percent;constructor(e,t){if(super(e,t),this.useHighLow="High/Low"===e.inputs.Method,this.isAtrMode="ATR"===e.inputs.PercentMode,this.percent=e.inputs.Percent,this.atrMult=e.inputs.MultiplierAtr,this.useHighLow||My(this),this.isAtrMode){const t=e.inputs.PeriodAtr,[i]=this.useHighLow?[0]:_y(this),s=gy(this.innerSeries[i],t,"SMA",Qg);this.addInner(s)}this.resetState()}getHigh(e){if(this.useHighLow)return this.baseVal(Ka.High,e);const[,t]=_y(this);return t.getData(this.source)[e]}getLow(e){if(this.useHighLow)return this.baseVal(Ka.Low,e);const[,t]=_y(this);return t.getData(this.source)[e]}getAtrDenom(e){if(this.useHighLow)return this.baseVal(Ka.Close,e);const[,t]=_y(this);return t.getData(this.source)[e]}setPivot(e,t){this.state.pivotPrice=e,this.state.pivotIndex=t}setCandidate(e,t){this.state.candPrice=e,this.state.candIndex=t}getDevPct(e){if(this.isAtrMode){const t=!this.useHighLow&&this.sourceNeedsCompute?1:0,i=this.innVal(1+t,Qg,e),s=this.getAtrDenom(e);if(null===i||null===s||0===s)return 0;const n=i/s*100;return this.atrMult*n}return this.percent}pct(e,t){return 0===e?0:(t-e)/e*100}resetState(){this.state={mode:0,pivotPrice:null,pivotIndex:null,candPrice:null,candIndex:null,confirmedPivots:/* @__PURE__ */new Map}}calculateAt(e){const t=this.getHigh(e),i=this.getLow(e),s=this.getDevPct(e);if(null===t||null===i)return{};if(0===e){this.resetState();const i=this.useHighLow?this.baseVal(Ka.Close,e):t;return this.setPivot(i,e),this.setCandidate(i,e),{}}if(0===this.state.mode)this.pct(this.state.pivotPrice,t)>=s?(this.state.mode=1,this.setCandidate(t,e)):-this.pct(this.state.pivotPrice,i)>=s&&(this.state.mode=-1,this.setCandidate(i,e));else if(1===this.state.mode){const n=t>=this.state.candPrice;n&&this.setCandidate(t,e);const r=(this.state.candPrice-i)/this.state.candPrice*100;if(!n&&r>=s){const t=this.state.candIndex,s=this.state.candPrice;this.state.confirmedPivots.set(t,s),this.setPivot(s,t),this.setCandidate(i,e),this.state.mode=-1}}else if(-1===this.state.mode){const n=i<=this.state.candPrice;n&&this.setCandidate(i,e);const r=(t-this.state.candPrice)/this.state.candPrice*100;if(!n&&r>=s){const i=this.state.candIndex,s=this.state.candPrice;this.state.confirmedPivots.set(i,s),this.setPivot(s,i),this.setCandidate(t,e),this.state.mode=1}}return{}}getCurrentState(){return this.state}}};function ty(e){return{[gs.INPUT_PERIOD]:e}}function iy(e){return{[gs.INPUT_SYMBOL]:e}}function sy(e){return{target:e,source:null,inputs:fy}}function ny(e,t,i){if(le(ey,e))return new ey[e](t,i);const s=Gv()?.config.extensions?.studyProvider;if(s){const n=s.factory(e,t,i);if(n)return n}throw new Error(`Study ${e} has not been implemented yet.`)}function ry(e){return Ur(e).defaults.curves.reduce((e,t)=>e.concat(t.fields.filter(t=>!e.includes(t))),[]).map(e=>Ka[e])}function oy(e,t,i,s){return{source:t,target:i,inputs:ty(e),allowEmptyValues:s}}function ay(e,t,i,s=Ka.MA,n=!1){return ny("MA",oy(t,i,s,n),e)}function ly(e,t,i,s=Ka.EMA,n=!1){return ny("MAEXP",oy(t,i,s,n),e)}function cy(e,t,i,s=Ka.SMA,n=!1){return ny("MASMO",oy(t,i,s,n),e)}function uy(e,t,i,s=Ka.WMA,n=!1){return ny("MAWEI",oy(t,i,s,n),e)}function hy(e,t,i,s=Ka.HMA,n=!1){return ny("HMA",oy(t,i,s,n),e)}function dy(e,t,i,s,n,r=!1){return new Op({source:i,target:s,inputs:ty(t)},n,r,e)}function py(e,t,i,s,n=null){return new wp({source:n,target:i,inputs:ty(t)},s,e)}const fy={};function my(e,t=Ka.TR){return ny("_TR",sy(t),e)}function gy(e,t,i="SMA",s=Ka.ATR){return ny("ATR",{target:s,inputs:{[gs.INPUT_PERIOD]:t,[gs.INPUT_SMOOTHING]:i},source:null},e)}function yy(e,t=Ka.TP){return ny("TP",sy(t),e)}function Ay(e,t,i=Ka.Close,s=Ka.ROC){return ny("ROC",{source:i,target:s,inputs:ty(t)},e)}function Sy(e,t,i,s=Ka.RSI,n=!1){return ny("_RSI",{source:i,target:s,inputs:{...ty(t),Modified:n}},e)}function Ty(e,t=Ka.MFMUL){return ny("MFV",sy(t),e)}function vy(e,t,i,s=Ka.MSD){return ny("MSD",{source:i,target:s,inputs:ty(t)},e)}function Py(e,t,i,s=Ka.MOVLR){return ny("MOVLR",{source:i,inputs:ty(t),target:s},e)}function Cy(e,t,i){return new Zp(sy(e),t,i)}function by(e,t,...i){return new Kp(sy(e),t,...i)}function Ey(e,t,i){return t-i}function Ly(e,t,i){return(t-i)/i*100}function My(e){const 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){const i=Cy(t,M(xy,t),e.innerSeries[0]);e.addInner(i)}}function _y(e){const t=e.sourceNeedsCompute?1:0;return[t,e.innCont(t)]}const xy=function(e,t){const i=[Ka.Open,Ka.High,Ka.Low,Ka.Close],[s,n,r,o]=i.map(e=>this.baseVal(e,t));let a=null;const l=e.id;switch(l){case"Open":a=s;break;case"High":a=n;break;case"Low":a=r;break;case"Close":a=o;break;case"HL/2":a=(n+r)/2;break;case"OC/2":a=(s+o)/2;break;case"HLC/3":a=(n+r+o)/3;break;case"OHLC/4":a=(s+n+r+o)/4;break;case"HLCC/4":a=(n+r+o+o)/4}return{[l]:a}},Iy=function(e,t,i){let s=null;if(this.atLeast(i,e+1)){const n=this.baseVal(t,i-e);if(null!==n){s=this.baseVal(t,i)-n}}return{[this.target.id]:s}},Dy={sma:cy,ma:ay,ema:ly,wma:uy,hma:hy};function Oy(e,t,i="Smoothing"){const s=(e.inputs[i]??t).toLowerCase();return Dy[s]}const wy={atr:gy,adjatr:function(e,t,i="MA",s=Ka.Close,n=Ka.ADJATR){return ny("ADJATR",{source:s,target:n,inputs:{[gs.INPUT_PERIOD]:t,[gs.INPUT_SMOOTHING]:i}},e)}};function Ry(e){switch(e.unit){case a.Day:return 252;case a.Week:return 52;case a.Month:return 12;default:return 0}}function Ny(e){const t=[Ka.High,Ka.Low];return e instanceof Vm&&2!==F(e.targetFields,t).length}function Vy(e,t){return e[`Period${t}`]}function Hy(e){return!(e instanceof bh)&&e.query instanceof ip}class By extends hp{constructor(e,t){super(e,t,ly(t,13,Ka.Close),function(e,t,i,s,n=Ka.Close){return ny("MACDEXP",{source:n,inputs:{Period1:t,Period2:i,Period3:s},outFields:[Ka.MACD,Ka.MACDS,Ka.MACDH]},e)}(t,12,26,9,Ka.Close)),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=n.Same;const i=this.innVal(1,Ka.EMA,e),s=this.innVal(1,Ka.EMA,e-1),r=this.innVal(2,Ka.MACDH,e),o=this.innVal(2,Ka.MACDH,e-1);return ie(i,s,r,o)&&(i>s&&r>o?t=n.Up:i<s&&r<o&&(t=n.Down)),{[Ka.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.Change,Ka.Volume,Ka.OpenInterest,Ka.TradingDay)}}function Fy(e,t){return ie(t)?(this[e]=t,null):this[e]}class ky{_domain;_range;_extent;_padding;constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return Fy.call(this,"_domain",e)}range(e){return Fy.call(this,"_range",e)}padding(e){return Fy.call(this,"_padding",e)}get ready(){return ie(this._domain,this._range)}}const Wy=1/Math.log2(10);function Uy(e,t){const i=(s=e[0],n=e[1],(n-=s)>0?e=>(e-s)/n:e=>isNaN(n)?NaN:.5);var s,n;const r=((e,t)=>i=>e*(1-i)+t*i)(t[0],t[1]);return e=>r(i(e))}function $y(e){return Math.sign(e)*Math.log10(1+Math.abs(e/Wy))}function Gy(e){return Math.sign(e)*Wy*(-1+Math.pow(10,Math.abs(e)))}const zy=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]];class Yy extends ky{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=I,s=I;switch(this.scaleType){case p.Linear:break;case p.Logarithmic:i=$y,s=Gy;break;default:throw new Error("Unexpected scale type (neither linear nor log)")}const n=this._domain.map(i),r=this.rangeWithPadding(),o=e=>r[1]-e+r[0];return(t?s:o)((t?Uy(r,n):Uy(n,r))((t?o:i)(e)))}priceToY(e){return this.mapValue(e,!1)}getTicks(e){if(!this.ready)return[];const[t,i]=this._range.map(e=>this.mapValue(e,!0));if(t===i&&e>0)return[t];const[s,n]=this._domain;if(this.scaleType===p.Linear||s<0||n>1e5)return jy(t,i,e);const r=this.findLogBand(s),o=this.findLogBand(n),a=2*e;return o-r===0?jy(t,i,a):this.getLogTicks(r,o,a,i<t)}findLogBand(e){return zy.findIndex(([t,i])=>e>=t&&e<i)}getLogTicks(e,t,i,s){const n=[...this._domain];let r=[];try{for(let o=e;o<=t;o++){let[a,l]=zy[o];o===e?a=n[0]:o===t&&(l=n[1]),this.domain([a,l]);const[c,u]=this._range.map(e=>this.mapValue(e,!0)),h=jy(c,u,i);r=s?h.concat(r):r.concat(h)}}finally{this.domain(n)}return function(e,t){const i=e.length;for(let s=1;s<i;++s){const i=e[s];let n=s-1;for(;n>=0&&t(e[n],i);)e[n+1]=e[n],n-=1;e[n+1]=i}}(r,s?(e,t)=>e>t:(e,t)=>e<t),r}checkTicks(){return this.scaleType===p.Logarithmic}}function jy(e,t,i){let s,n,r,o,a=-1;if(i=+i,(e=+e)===(t=+t)&&i>0)return[e];if((s=t<e)&&(n=e,e=t,t=n),0===(o=function(e,t,i){const s=Math.sqrt(50),n=Math.sqrt(10),r=Math.sqrt(2),o=(t-e)/Math.max(0,i),a=Math.floor(Math.log(o)/Math.LN10),l=o/Math.pow(10,a);return a>=0?(l>=s?10:l>=n?5:l>=r?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(l>=s?10:l>=n?5:l>=r?2:1)}(e,t,i))||!isFinite(o))return[];if(o>0)for(e=Math.ceil(e/o),t=Math.floor(t/o),r=new Array(n=Math.ceil(t-e+1));++a<n;)r[a]=(e+a)*o;else for(e=Math.floor(e*o),t=Math.ceil(t*o),r=new Array(n=Math.ceil(e-t+1));++a<n;)r[a]=(e-a)/o;return s&&r.reverse(),r}const Ky={color:gs.COLOR_TRANSPARENT},qy={color:gs.COLOR_TRANSPARENT,width:0,dashStyle:"Solid"},Xy=[Ka.Open,Ka.High,Ka.Low,Ka.Close],Zy=new Set(Xy.map(e=>e.id)),Jy=new xn(0,0,0,0);class Qy{axis;id;record;metaData;timeSeries;notifyAboutPriceDomains=!1;customPlotValues=!1;_priceMapFirstIndex;priceMapper;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=f.Symbol;isShutDown=!1;targetFields=[];detachedScale;yScale=null;levels;bands;annotations;visFromIndex;visToIndex;_eventsData;precision;visible=!0;constructor(){this.axis=null,this.id=Pe(),this.record=new el(""),this.metaData=new en,this.timeSeries=new bh,this.priceMapper=this._priceMapper.bind(this),this._priceMapFirstIndex=/* @__PURE__ */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&&ie(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(f.Symbol)}get isExpression(){return this.is(f.Expression)}get isStudy(){return this.is(f.Study)}get isForward(){return this.is(f.Forward)}get isSeasonal(){return this.is(f.Seasonal)}getValueAt(e,t,i){return null}wrapIfAdvancedStyle(e){let t=e;const i=e=>({outFields:e,inputs:{},source:null});if(this.mainCurve.isHeikinAshiStyle)t=new dp(i($u.slice()),e);else if(this.mainCurve.isElderImpulseSystemStyle){const s=$u.slice().concat(Ka.BREL);t=new By(i(s),e)}else this.mainCurve.isPercentChangeStyle&&(t=new cm(i($u.slice()),e));return t}is(e){return this.type===e}getCacheableEntities(e){this.metaData.getCacheableEntities(e.metaData),this.timeSeries.getCacheableEntities(e.timeSeries)}fromModel(e){this.type=f[e.type];const t=e;this.main=t.main,t.levels&&(this.levels=t.levels),t.bands&&(this.bands=t.bands),ie(t.precision)&&(this.precision=t.precision),this.curves=e.curves.map(e=>{const t=new Id;return t.plot=this,t.fromModel(e),t}),t.detachedScale&&(this.detachedScale=t.detachedScale,this.yScale=new Yy(p.Linear,null)),this.visible=t.visible??!0}initialize(){}shutdown(){ie(this.timeSeries)&&ie(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){const e=this.axis.pane.presenter,t=new ip(null,e.data.aggregation,m.Normal,[me(ce(e.data,null,"range","from")),me(ce(e.data,null,"range","to"))]);return t.barsToFetch=e.data.maxDataPoints||gs.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=ce(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 ie(this.detachedScale,this.yScale)&&this.detachedScale}getDetachedScaleMargins(){return gs.DEFAULT_DETACHED_SCALE_MARGINS}setViewBox(e){if(!this.hasDetachedScale)return;const{y:t,height:i}=e,{top:s,bottom:n}=this.getDetachedScaleMargins();this.yScale.range([Math.floor(t+s*i),Math.floor(t+i-n*i)])}drawLevels(e){e.save();const t=gs.OUT_OF_SCREEN;for(const i of this.levels.filter(e=>e.visible)){const s=this.priceToY(i.value);nr(e,rr({line:i.line,fill:Ky})),Wn(e,{x:-1,y:s},{x:t,y:s})}e.restore()}drawBands(e){e.save();const t=gs.OUT_OF_SCREEN;for(const i of this.bands){const s=this.priceToY(i.range.to),n=this.priceToY(i.range.from);nr(e,rr({fill:i.fill,line:qy}));Fn(e,new xn(-1,s,t,n-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!==Ka.DateTime):[]}getEventsAt(e){const t=this.eventsSeries.container,i=i=>t.getData(i)[e];return this.getEventFields().map(t=>{const s=i(t);if(!ie(s))return null;const n=this.getEventFor(t);if(!ie(n))return null;const r={field:t,value:s,date:i(Ka.DateTime),text:n.title,color:n.color};if(t===Ka.Custom&&s===gs.FAKE_CUSTOM_EVENT){const t=e%2==0;return{...r,value:t?"___news":"___video",text:t?"N":"V"}}return r}).filter(e=>null!=e)}getRefEventField(e,t,i){return t?e.isOhlc?Ka.High:i.isTick?Ka.Last:Ka.Close:e.fields[0]}getRefPlot(e){return this.axis.pane.isMain?e.mainPlot:this}drawEvents(e,t){const i=this.axis.pane.presenter,s=i.view.xAxis.xScale,n=s.domain();if(!ie(n)||!ie(n[0],n[1]))return;const r=(e,t=Ka.DateTime)=>e.container.getData(t),o=r(this.eventsSeries),l=this.getRefPlot(i),c=l.timeSeries,u=r(c),h=i.data.aggregation,d=l===i.mainPlot,p=r(c,this.getRefEventField(l.mainCurve,d,h)),{chart:{fontFamily:f}}=this.axis.pane.presenter.display,m=o.map((e,r)=>{if(!(e=>e.valueOf()>=n[0].valueOf()&&e.valueOf()<=n[1].valueOf())(e))return[];return this.getEventsAt(r).map(e=>{const n=function(e,t){const{unit:i}=e;return i===a.Year?Mt(t):i===a.Quarter?bt(t):i===a.Month?Et(t):i===a.Week?it(t):i===a.Day?nt(t):t}(h,e.date),r=G(u,+n,Number),o=p[r];t.has(r)||t.set(r,-1);let l=t.get(r);t.set(r,++l);const c=s.timeToX(n),d=i.view.getEventRadius(),f=this.axis.yScale.priceToY(o)-l*(d+d+d);return{visible:!0,...e,x:c,y:f,r:d,rect:Jy}})}).flat();e.save();let g=!0;m.forEach(t=>{t.rect=function(e,{x:t,y:i,r:s,color:n,text:r},o){const a=s;e.fillStyle=n,e.beginPath();const l=s+s,c=l,u=new xn(t-s,i-a-c,l,c);e.fillRect(u.x,u.y,u.width,u.height);const h=(1.6*s).toFixed(0);return e.font=`700 ${h}px "${o}"`,e.fillStyle="#fff",e.textAlign="center",e.textBaseline="middle",e.beginPath(),e.fillText(r,t,i-.9*c),u}(e,t,f),this.customEventPopup?.visible&&t.date===this.customEventPopup.date&&(this.showCustomEventPopup(t),g=!1)}),e.restore(),this._eventsData=m,this.customEventPopup?.visible&&g&&this.hideCustomEventPopup()}get customEventPopup(){return this.axis.pane.presenter.view.customEventPopup}hideCustomEventPopup(){this.customEventPopup?.hide()}showCustomEventPopup(e){const{x:t,y:i,r:s,date:n,value:r}=e;this.customEventPopup?.show({x:t+2*s,y:i-2*s},n,r)}getCustomEventDataAt(e){if(!this._eventsData)return null;const t=this._eventsData.find(t=>t.rect.contains(e));return t?.field===Ka.Custom?t:null}hitTestCustomEvent(e){return null!==this.getCustomEventDataAt(e)}tryHandleCustomEventClick(e){const t=this.getCustomEventDataAt(e);return!!ie(t)&&(this.showCustomEventPopup(t),!0)}isEmpty(){const e=this.timeSeries;return ie(e)&&e.hasData&&e.container.isEmpty}draw(e){if(this.visible){ie(this.levels)&&this.drawLevels(e),ie(this.bands)&&this.drawBands(e);for(const t of 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(!ie(e)||!this.timeSeries.hasData)return e;if(!this.shouldPriceMap(i,s))return e;const[n,r]=this.axis.pane.presenter.view.xAxis.xScale.domain()||[];if(!ie(n)||!ht(n))return e;if(this._firstVisibleDate!==n){this._firstVisibleDate=n;const e=this.timeSeries.container.getTimeData(),t=t=>G(e,+t,Number);this.visFromIndex=t(n),this.visToIndex=t(r),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&&(t=e,Zy.has(t.id));var t}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===Ka.PreviousClose?Ka.Close:e}dataOf(e){return this.timeSeries.container.getData(e)}canPriceMap(e,t){const i=this.getRefPriceMapField(t),s=this.dataOf(i);let n=null,r=this.visFromIndex;for(;null===n&&r<=this.visToIndex;)n=s[r++];this._priceMapFirstIndex.set(i,null!==n?r-1:Number.NaN)}priceMap(e,t,i,s=!1,n=d.None){const r=this.getRefPriceMapField(i),o=this._priceMapFirstIndex.get(r);if(!Number.isFinite(o))return e;const a=this.dataOf(r)[o];if(this.isComparison(d.Percent)||n===d.Percent){return s?a+a*e/100:(e>=a?1:-1)*(100*Math.abs(e-a))/Math.abs(a)}return s?a+e:e-a}shouldPriceMap(e,t){return ie(t)?t!==d.None:this.isComparison(d.Percent)||this.isComparison(d.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}}class eA extends Qy{_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(!ie(this.timeSeries)||!ie(this.timeSeries.record))return null;const e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(Ka[e])}getTimeSeries(){const e=Gv().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.resolved,this.mainCurve.style){case o.Renko:case o.Kagi:case o.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case o.Range:t.barsToFetch=4e3;break;case o.LineBreak:t.inputs=this.inputs}const i=this.axis.pane;if(ie(i.alignedToYear)){const e=Ji(t.symbol);null!==e&&(this.yearOffset=i.alignedToYear-e.getFullYear(),t.offset=this.yearOffset)}const s=e.getTimeSeries(t);this.timeSeries=this.wrapIfAdvancedStyle(s),this.timeSeries.ready().then(e=>{if(e){const e={series:this.timeSeries,part:P.Unspecified};this.presenter?.notifyHost(qa.TS_MANYCHANGED,e),this.getEvents()}})}getMetaData(){const e=Gv().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(qa.MD_CHANGED,{plot:this})})}getEvents(){if(!this.hasEvents)return;const e=Gv().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:m.Events,getHashKey:function(){return Object.values(this).filter(e=>"function"!=typeof e).join("|")}};gs.EVENTS.forEach(e=>{t[e]=ce(this.events,!1,e,"show")}),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then(e=>{e&&this.presenter?.notifyHost(qa.TS_EVENTSCHANGED,{series:this.eventsSeries})})}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return!!ie(this.events)&&gs.EVENTS.some(e=>ce(this.events,!1,e,"show"))}findEvents(e){if(!this.hasEventsData||null===e[0]||null===e[1])return[];const t=e[0],i=e[1];if(i>0&&this.axis?.pane?.presenter?.data?.aggregation?.isIntraday){const 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);const t=e;this._showPrevious=t.showPrevious,this.events=t.events,this.inputs=t.inputs||[],this.compare=function(e){switch(e.unit){case a.Tick:return ko;case a.Intraday:case a.Day:return Vo;case a.Week:return Ho;case a.Month:return Bo;case a.Quarter:return Fo;case a.Year:return Ii;default:return ko}}(this.axis.pane.presenter.data.aggregation),this._symbol=t.symbol}getEventFor(e){const t=this.events[e.id.toLowerCase()];return ie(t)&&t.show?t:null}async initialize(){return ps.call(this,async()=>(this.resolved=await Hi(this.symbol),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class tA extends eA{seriesKind;fundamental;constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${a[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=a[e.fundamental],super.fromModel(e)}makeQuery(){let e=new ip(this.symbol,new Wo(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}}class iA{longPressTimeout;constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){const e=Gv().config.touchCrosshairDelayMillis;return ie(e)&&Number.isFinite(e)?e:gs.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,i){q()&&(this.longPressTimeout=setTimeout(()=>this.longPressTriggered(e,t,i),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,i){this.cancelLongPress(),this.performLongPress(e,t,i)}cancelLongPress(){q()&&ie(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,i){}}function sA(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}class nA extends iA{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)}cursorSet;moved;snapToSupported;performLongPress(e,t,i){qA(this.annotation,i)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),sA(this.annotation))return;const{point:t,view:i,offset:s}=e;if(!te(t)||t.axis!==this.annotation.axis)return;i.drawCrosshair({ap:t,offset:s}),this.cursorSet||(this.previous.axis.pane.presenter.view.setCursor(y.Move),this.cursorSet=!0);const n=fn(t.point,this.previous.point);this.annotation.offset(n),this.annotation.wasModifiedByTool(),this.annotation.requestRedraw(),this.previous=t,this.moved=!0}onMouseUp(e){this.cancelLongPress(),JS(this.annotation,this.moved,E.Moved)}}class rA{constructor(e,t){this.annotation=e,this.pointIndex=e.points.indexOf(t)}pointIndex;snapToSupported=!0;moved=!1;alignPointsMode=!1;onMouseMove(e){if(this.alignPointsMode=e.getModifier(S.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),sA(this.annotation))return;const{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),ie(t)){const e=this.annotation.points[this.pointIndex],i=fn(t.point,e.point);switch(e.moveDirection){case T.Both:e.update(t.price,t.time);break;case T.Horizontal:e.update(e.price,t.time);break;case T.Vertical:e.update(t.price,e.time)}this.moved=e.moveDirection!==T.None,this.moved&&this.annotation.wasPointMovedByTool(e,i)}this.annotation.requestRedraw()}onMouseUp(e){JS(this.annotation,this.moved,E.PointMoved)}}class oA{constructor(e,t,i){this.anchor=e,this.isVertical=t,this.axis=i}hitTest(e){return!!ie(this.anchor)&&(this.isVertical?Math.abs(e.x-this.anchor.x)<=gs.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=gs.HIT_TEST_TOLERANCE)}draw(e){const t=gs.OUT_OF_SCREEN;this.isVertical?Un(e,this.anchor.x,-t,t):$n(e,this.anchor.y,-t,t)}}class aA{id;axis;_price;_time;passive=!1;moveDirection=T.Both;visible=!0;point;constructor(e,t,i){this.id=Pe(),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!==T.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){const e=this.axis.toPoint(this);ie(e)&&ne(e.x)&&ne(e.y)&&(this.point=e)}update(e,t){this.price=e,this.time="number"==typeof t?new Date(t):t,this.toPoint()}updateFromPoint(e){const t=this.axis.toAnnotationPoint(e);this.price=t.price,this.time=t.time,this.point=e}hitTest(e){if(!this.visible)return!1;return this.distance(e)<=gs.HIT_TEST_TOLERANCE}distance(e){const t=e.x-this.point.x,i=e.y-this.point.y;return Math.abs(Math.sqrt(t*t+i*i)-gs.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(ie(this.point)){let i=gs.HALF_ANN_POINT_DIMENSION;ie(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 lA(e){return 0===bn(e.fill.color).a?e.line.color:e.fill.color}function cA(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 uA(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 hA{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=Pe()}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 gs.EMPTY_ARRAY}getTimeScaleAdornments(){return gs.EMPTY_ARRAY}extractTraits(e=!0){const t=ue(this.traits),i=_r(this.name);return Object.keys(t).forEach(s=>{const n=i.includes(s);(e&&!n||!e&&n)&&delete t[s]}),e||["line","fill","zIndex"].forEach(e=>delete t[e]),t}extractPoints(){return this.activePoints.map(e=>({price:e.price,time:se(+e.time,4)}))}offset(e){this.points.filter(e=>e.movable).forEach(t=>{t.updateFromPoint(mn(t.point,e))})}get traits(){return this._traits||(this._traits=ue(this.defaultTraits)),this.adjustFill&&(this._traits.fill.color=lA(this._traits),this.adjustFill=!1),this._traits}set traits(e){void 0!==e&&ye(this.traits,e)}get activePoints(){return this.points.filter(e=>!e.passive)}get style(){return rr(this.traits)}get defaultTraits(){return sr(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return rr(this.defaultTraits)}get adornStyle(){const e=ue(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=gs.COLOR_TRANSPARENT,rr(e)}get pointsStyle(){const e=ue(this.defaultTraits);return e.line.dashStyle="Solid",rr(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=>{const s=this.isPointDrawn(i),n=ie(e);!t||!s&&n||i.toPoint(),n&&s&&(this.isSelected||this.drawn)&&(nr(e,this.pointsStyle),i.draw(e,this))})}addPoints(e){for(let t=0;t<e;t++)this.points.push(new aA(this.axis))}toModel(){const e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:ue(this.traits)}}canMove(e){return!0}updatePoints(e){}updateActivePoints(e){const t=this.activePoints;t.length===e.length&&t.forEach((t,i)=>{const s=e[i];t.update(s.price,s.time)})}updateFrom(e,t,i,s,n){"boolean"==typeof s&&(this.visible=s),"boolean"==typeof n&&(this.locked=n);const r=ie(e)?ue(e):{};ie(t)&&ye(r,t),this.traits=r,ie(i)&&this.updatePoints(i)}priceMap(e){return this.axis.priceMap(e)}flip(e){const t=this.getFlipAnchorIndices();if(!te(t))return;const i=this.points[t[0]],s=this.points[t[1]];if(e){const e=s.time;s.update(s.price,i.time),i.update(i.price,e)}else{const e=s.price;s.update(i.price,s.time),i.update(e,i.time)}this.wasModifiedByTool()}getFlipAnchorIndices(){return null}}function dA(e,t,i,s){return function(n,r=!0){const o=new t(n,e,i);return r?n.appendAnnotation(o):o.drawn=!1,ie(s)&&(o.traits=s),o}}class pA{axis;angle;extent;anchor1;anchor2;p1;p2;style;extended;_data;isTrend;constructor(e,t,i,s,n){this.axis=n,ie(e,t)&&(this.angle=gn(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){const 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)+gs.OUT_OF_SCREEN}hitTest(e){return!!ie(this.p1,this.p2)&&yn([this.p1,this.p2],e,gs.HIT_TEST_TOLERANCE)}draw(e){ie(this.p1,this.p2)&&(Wn(e,this.p1,this.p2),this.extended)}getAdornOffset(e){const t=Vn(e),i=Rn(e,1);var s,n;return(s=this.p1,n=this.p2,-(s.y-n.y)/(s.x-n.x))<0&&(t.y=i+5),t}}class fA{style;axis;rect;constructor(e,t,i,s){this.axis=s,this.rect=new xn(e.x,e.y,t,i)}hitTest(e){return this.rect.contains(e)}draw(e,t){Fn(e,this.rect)}}class mA extends hA{countCache;constructor(e,t){super(e,t)}draw(e,t){if(this.prepareDraw(e,t)&&!this.drawn){const t=this.getElements();nr(e,this.style),t.forEach((t,i)=>{nr(e,this.getStyleForElement(t,i)),t.draw(e)}),nr(e,this.adornStyle),this.adornElements(t,e);const i=this.getMarkers();nr(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){const 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){const t=this.getElements(),i=this.getMarkers();if(t.some(t=>t.hitTest(e)))return!0;return!!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(){return ae(this.traits?.singleStyle,!0)}get showBackground(){return ae(this.traits?.showBackground,!1)}get backgroundOpacity(){return ae(this.traits?.backgroundOpacity,0)}fillOnlyStyle(e){return rr({line:{color:gs.COLOR_TRANSPARENT,dashStyle:"Solid",width:0},fill:this.traits[e]})}lineOnlyStyle(e){return rr({fill:{color:gs.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new pA(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return Tn(Sn(e),this.backgroundOpacity)}getTraitsFor(e){const t={fill:{color:gs.COLOR_TRANSPARENT},line:{...e.line}};return this.showBackground?(t.fill.color=this.applyBackgroundOpacity(t.line.color),t):t}getFlipAnchorIndices(){return 2===this.points.length?[0,1]:null}}class gA extends mA{_factors;constructor(e,t){super(e,t)}get factorsPropName(){return gs.AT_FACTORS}get factors(){return Jn(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[gs.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[gs.AT_LEVELS_KIND]}get labels(){return this.traits[gs.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[gs.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){const i=this.levelsKind===gs.AT_LEVELS_PERCENTS;let s="";if(this.showLevels&&(s=i?`${(100*e).toFixed(1)}%`:e.toString()),this.showPrices){const e=this.priceMap(this.axis.toPrice(t));s=(s+` (${nd(this.axis,e)})`).trim()}return s}getAdornPointAndAlign(e,t){const i=this.labels,s=e instanceof pA,n=(e,t,i)=>({pt:e,align:t,offset:i});switch(i){case gs.AT_LABELS_LEFT:return n(s?e.anchor1:e,g.Right,-t);default:case gs.AT_LABELS_RIGHT:return n(s?e.anchor2:e,g.Left,t);case gs.AT_LABELS_CENTER:return n(s?dn(e.anchor1,e.anchor2):e,g.Center,0)}}getColoredElements(e){const t=this.singleStyle;return this.factors.map(i=>{const s=e(i);return null===s?null:(t||(s.style=rr(this.getTraitsFor(i))),s._data={factor:i.value},s)}).filter(e=>null!==e)}hitTestAdornments(e,t){const i=this.showLevels,s=this.getTextRef();if(!i||null===s)return!1;const n=this.axis.pane.presenter,r=n.view?.mainContext;if(!r)return!1;let o=null,a=!1;r.save();const{chart:{fontFamily:l},yAxis:{fontSize:c}}=n.display;r.font=`${c??12}px ${l}`;for(const u of e){if(!ie(u._data))continue;const{factor:e}=u._data,{ref:i,spacing:n,offsetY:l,text:c}=s(o,u,e),{pt:h,align:d,offset:p}=this.getAdornPointAndAlign(i,n);if(Hn(r,c,this.getAdornTextPoint(r,l,h,p),d).contains(t)){a=!0;break}o=u}return r.restore(),a}adornElementsForColoredFactors(e,t,i,s){const n=this.singleStyle,r=this.showBackground,o=this.showLevels,a=this.applyBackgroundOpacity(this.traits.line.color),l=s.fillStyle;let c=null;e.forEach(e=>{if(!ie(e._data))return;const{factor:u}=e._data;if(r){const i=t(c,e);s.fillStyle=n?a:e.style.fillStyle,s.fill(i)}if(o){const{ref:t,spacing:r,offsetY:o,text:a}=i(c,e,u),{pt:h,align:d,offset:p}=this.getAdornPointAndAlign(t,r),f=this.getAdornTextPoint(s,o,h,p),m=n?l:e.style.strokeStyle;Bn(s,a,f,d,m)}c=e})}getAdornTextPoint(e,t,i,s){const n=Rn(e,.75);return mn(i,{x:s,y:!0===t?n/2:t})}}class yA extends mA{lines;constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(gs.AT_FILL)}get rect(){const[e,t,,]=this.getScreenPoints(),i={x:e.x,y:Math.min(e.y,t.y)},s=new fA(i,t.x-e.x,Math.abs(e.y-t.y),this.axis);return s.style=this.rectStyle,s}get reverse(){return!1}getLinesDataAtLevels(e,t){let[i,s]=this.points;if(this.reverse&&([i,s]=[s,i]),null==this.lines){const n=(e,t=!1)=>i=>({level:i.value,domain:e(i.value),traits:this.getTraitsFor(i),isPrice:t}),r=s.price-i.price,o=n(e=>i.price+e*r,!0),a=e?.map(o)??[],l=this.axis.pane.presenter.timeline,c=G(l,+i.time,Number,ud),u=G(l,+s.time,Number,ud)-c,h=n(e=>+l.at(c+Math.floor(e*u))),d=t?.map(h)||[];this.lines={prices:a,times:d,barsDiff:u,priceDiff:r}}return this.lines}makeColoredLine(e,t,i){const s=this.makeLine(e,t);return this.singleStyle||(s.style=rr(i.traits)),s._data={level:i.level,isPrice:i.isPrice},s}getLineElements(e){const[t,i]=this.getScreenPoints();return{priceLines:e.prices.map(e=>{const 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=>{const 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 AA extends aA{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 SA{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 ie(this.points[0].point,this.points[1].point)?new xn(this.left,this.top,this.width,this.height):null}}function TA(e){const t=new aA(e),i=new aA(e);return[t,i,new AA(e,t,i),new AA(e,i,t)]}class vA extends hA{helper;constructor(e,t){super(e,t),this.points=TA(e),this.helper=new SA(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)&&(nr(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&2===e.length&&e.forEach((e,t)=>this.points[t].update(e.price,e.time))}}class PA{constructor(e,t,i){this.points=e,this.lines=t,this.axis=i,this.helper=new SA(this.points)}helper;_actualWidth=0;_fontSizeForWidth=0;hitTest(e){const t=this.getRect();return!!te(t)&&(t.width=this._actualWidth,t.contains(e))}getRect(){return this.helper.getRect()}get fontSize(){if(0===this.lines.length)return 0;const{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();const{x:t,y:i}=this.getRect(),{chart:{fontFamily:s}}=this.axis.pane.presenter.display,n=this.fontSize;e.textAlign="left",e.textBaseline="top",e.font=`${n}px ${s}`,this.lines.forEach((s,r)=>{const o=i+n*r;e.fillText(s,t,o)}),this.computeActualWidth(e),e.restore()}}class CA extends mA{textEditable;_textAnnElement;constructor(e,t){super(e,t),this.textEditable=!0,this.points=TA(e),this.adjustFill=!0}get textLines(){return this.traits[gs.AT_TEXT_LINES]}set textLines(e){this.traits[gs.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!ie(this._textAnnElement)&&this.visible&&(this._textAnnElement=new PA(this.points,this.textLines,this.axis)),this._textAnnElement}updateFrom(e,t,i,s,n){super.updateFrom(e,t,i,s,n),this._textAnnElement=void 0}getElements(){return this.visible?[this.textElement]:[]}}class bA extends CA{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(){const e=this.points[0].time;return this.prices.map(t=>new aA(this.axis,t,e))}updateFrom(e,t,i,s,n){super.updateFrom(e,t,i,s,n),ie(e?.textLines)&&(this.textLines=e.textLines)}getElements(){const e=super.getElements(),t=this.pricesPoints.map(e=>new oA(e.point,!1,this.axis));return e.concat(t)}getPriceScaleAdornments(){if(!this.showPrices)return super.getPriceScaleAdornments();const e=this.traits.line;return this.prices.map(t=>({price:t,color:e.color}))}get defaultFont(){const{chart:{fontSize:e,fontFamily:t}}=this.axis.pane.presenter.display;return[e??13,t]}updateOtherPoints(e){const[t,i]=this.defaultFont;e.save(),e.font=`${t}px ${i}`;const s=Math.max(...this.textLines.map(t=>e.measureText(t).width)),{x:n,y:r}=this.points[0].point;this.points[1].updateFromPoint({x:n+s,y:r+this.textLines.length*t}),e.restore()}}class EA{constructor(e){this.annId=e}annotation;onKeyDown(e){if(null==this.annId)return;const{key:t,code:i,presenter:s}=e;if(X(t,i)){if(ie(this.annotation)){this.annotation.axis.deleteAnnotation(this.annotation,!1),s.view.redraw()}ZS(s,{toolChange:E.Cancelled,annId:this.annId})}}}class LA extends EA{constructor(e,t=!1){super(e.annName),this.factory=e,this.thirdPoint=t,this.indices=t?[0,1,2]:[0,1]}dragged=!1;snapToSupported=!0;isDrawingAnnotation=!0;forceAlignPoints=!1;indices;alignPointsMode=!1;signalChange(){this.annotation.wasModifiedByTool(),this.annotation.requestRedraw()}onMouseDown(e){const{point:t,button:i}=e;if(void 0===t)return;const s=te(this.annotation);if(i===A.Left)if(s){const 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){const{point:t,view:i,offset:s}=e;return i.drawCrosshair({ap:t,offset:s}),ie(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(S.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(){JS(this.annotation,!0,E.Created)}isAccidentalMouseUp(e){const{point:t}=e,i=this.annotation.points[0].point;return pn(t.point,i)<gs.HIT_TEST_TOLERANCE}onMouseUp(e){void 0!==this.annotation?this.isAccidentalMouseUp(e)?this.dragged=!0:(this.dragged=!1,this.thirdPoint||this.finish()):eT(e)}}class MA extends LA{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}}class _A extends LA{constructor(e){super(e,!1),this.snapToSupported=!1}onMouseMove(e){const{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),ie(this.annotation)&&this.dragged){const[e,i]=this.annotation.points;i.update(t.price,t.time);const s=fn(i.point,e.point),n=e.point.y+s.x*Math.sign(s.y)*Math.sign(s.x),r=this.annotation.axis.toPrice(n);i.update(r,t.time),this.signalChange()}return!0}}class xA extends EA{constructor(e,t){super(e?e.annName:null),this.factory=e,this.existing=t,this.isNew=!ie(t),this.isNew||(this.anchor=this.existing.points[0]),this.isDrawingAnnotation=this.isNew}isNew;anchor;clicks=0;snapToSupported=!1;isDrawingAnnotation;textArea;getChartParent(){return this.anchor.axis.pane.presenter.view.canvasContainer}styleProps(){if(this.isNew){return{height:100,fontSize:"100%",color:lA(sr(this.anchor.axis.pane.presenter.display,"Text"))}}{const e=this.existing.textElement;return{height:1.05*e.getRect().height,fontSize:`${Math.round(e.fontSize)}px`,color:this.existing.traits[gs.AT_FILL].color}}}onMouseDown(e){const{point:t}=e;if(this.isNew)if(0===this.clicks){if(void 0===t)return void eT(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");const{x:e,y:t}=this.anchor.point,i=this.anchor.axis.pane.getBounds(),s=i.x+i.width-this.anchor.point.x,{height:n,fontSize:r,color:o}=this.styleProps();os(this.textArea,{position:"absolute",top:`${t}px`,left:`${e}px`,border:"none",outline:"none",overflow:"hidden",height:`${n}px`,width:`${s}px`,resize:"none",backgroundColor:"rgba(255, 255, 255, 0.05)",zIndex:"5",fontSize:r,color:o}),this.getChartParent().appendChild(this.textArea),this.textArea.onblur=this.onEndEditing.bind(this),this.textArea.onkeydown=e=>e.stopImmediatePropagation(),this.isNew||(this.textArea.value=this.existing.textLines.join("\n"),this.existing.textLines=[""],this.existing.requestRedraw()),setTimeout(()=>this.textArea.focus(),100)}onEndEditing(){const e=this.anchor,t=this.isNew?this.factory(e.axis):this.existing,i=this.textArea.value.split("\n");if(this.isNew){const{actualWidth:s,actualHeight:n}=this.getTextDimensions(i);t.points[0].update(e.price,e.time);const{x:r,y:o}=t.points[0].point;t.points[1].updateFromPoint({x:r+s,y:o+n}),t.drawn=!1}t.textLines=i,this.textArea.onblur=null,this.getChartParent().removeChild(this.textArea),t.requestRedraw(),this.isNew||t.requestRedraw(),JS(t,!0,this.isNew?E.Created:E.TextChanged)}getTextDimensions(e){const t=globalThis.getComputedStyle(this.textArea).getPropertyValue("font-size"),i=parseFloat(t)*e.length;let s=0;const n=this.anchor.axis.pane.presenter,r=n.view.mainContext;r.save();const{chart:{fontFamily:o}}=n.display;r.font=`${t} ${o}`;for(let a=0;a<e.length;a++){const t=r.measureText(e[a]).width;t>s&&(s=t)}return r.restore(),{actualWidth:s,actualHeight:i}}}function IA(e){return Gv().config.tooltipMovement===e}function DA(){return IA("Draggable")}function OA(){return IA("Auto")}const wA=gs.TOOLTIP_STD_LEGACY_CLASS,RA=gs.TOOLTIP_STD_CLASS,NA=gs.TOOLTIP_BUBBLE_CLASS;class VA{constructor(e){this.view=e,this.tooltipElem=us(e.el,"div"),as(this.tooltipElem,{id:`${e.presenter.elementId}-global-tooltip`,class:`${RA} ${wA}`}),this.leftSide=!0,os(this.tooltipElem,{visibility:"hidden",position:"absolute",cursor:DA()?"move":"default",zIndex:20,top:`${gs.TOOLTIP_Y_OFFSET}px`,left:`${gs.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)}tooltipElem;leftSide;mode;isDrag=!1;canDrag;isToggling;startDrag(){this.isDrag=!0}stopDrag(){this.isDrag=!1}setMode(e){if(this.mode!==e)if(this.mode=e,e===gs.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition="none",this.tooltipElem.classList.remove(RA,wA),this.tooltipElem.classList.add(NA),os(this.tooltipElem,{pointerEvents:"none"});else if(e===gs.TOOLTIP_STD){this.canDrag=DA(),this.tooltipElem.classList.remove(NA),this.tooltipElem.classList.add(RA,wA);const e=gs.TOOLTIP_TOGGLE_SIDE_ANIM_MS;os(this.tooltipElem,{pointerEvents:"all",top:`${gs.TOOLTIP_Y_OFFSET}px`,left:`${gs.TOOLTIP_X_OFFSET}px`,transition:OA()?`left ${e}ms ease-out`:null})}}show(e,t){const i=this.tooltipElem;if(t){const{width:e,height:s,leftOffset:n,rightOffset:r}=this.view,o=i.getBoundingClientRect(),a=o.width/2,l=i.style,c=s*gs.TOOLTIP_BUBBLE_OFFSET,u=t.yMin-o.height-c,h=t.x-a,d=t.yMax+c,p=d+o.height,f=u<0?p<s?d:0:u;let m=h;const g=e-r;m<n?m=n:m+o.width>g&&(m=g-o.width),l.top=`${f}px`,l.left=`${m}px`}"hidden"===i.style.visibility&&(i.style.visibility="visible"),ds(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),ns(this.tooltipElem)}reposition(e,t){os(this.tooltipElem,{left:`${e}px`,top:`${t}px`})}isAutoMove(){return this.mode===gs.TOOLTIP_STD&&OA()}handleMouseMove(e){if(this.isDrag&&this.canDrag){const{movementX:t,movementY:i}=e,{top:s,left:n}=this.tooltipElem.style,r=parseInt(s)+i,o=parseInt(n)+t;this.reposition(o,r)}else if(this.isAutoMove()){const t=this.tooltipElem.getBoundingClientRect(),i=this.view.el.getBoundingClientRect(),s=e.pageX,n=gs.TOOLTIP_TOGGLE_DISTANCE_TOLERANCE,r=i.width>2*t.width,o=s>t.x&&s<=t.right+n,a=s<t.x&&s>=t.x-n;r&&(o||a)&&this.toggleSide()}}repositionAuto(){if(this.isAutoMove()){const e=this.view.presenter.mainPane.getBoundsWithoutScales(),t=this.tooltipElem.offsetY,i=e.x+(this.leftSide?gs.TOOLTIP_X_OFFSET:e.width-this.tooltipElem.offsetWidth-gs.TOOLTIP_X_OFFSET);this.reposition(i,t)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout(()=>this.isToggling=!1,gs.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}}function HA(e){e.showTooltip&&BA(e,{time:gs.ZERO_DATE,offset:gs.OFFSCREEN_OFFSET,price:0,lastBarRefresh:void 0,justMain:void 0})}function BA(e,{time:t,lastBarRefresh:i,justMain:s,offset:n,price:r}){const o=bd(e,t,n,0,s,r),{mode:a,showMainPlot:l,hideSymbols:c,revealingClose:u}=e.display.tooltip,{includeTimestamp:h,showMainPlot:d,showPlotActions:p}=Gv().config.tooltipHeaders||{},f=ie(d)?d:l,m=!!ie(h)&&h,g=!!ie(c)&&c,y=!!ie(u)&&u,A=!!ie(p)&&p,S=t.valueOf()===gs.ZERO_DATE.valueOf();switch(a){case gs.TOOLTIP_CARDS:kA(e,o,f,!S,m&&!S,!1,g,y,A,e.hasLegend?e.view?.legend?.getLegendElem().clientHeight:0);break;case gs.TOOLTIP_BUBBLE:if(!S){const t=o.panes.find(e=>{const{top:t,left:i,width:s,height:r}=e.bounds;return new xn(i,t,s,r).contains(n)}),i=t.plots.find(e=>e.isMain)||t.plots[0],s=i.values.find(e=>["Close","Last"].includes(e.id)),r=s?s.y:i.values[0].y,a=t.plots.map(e=>e.values.filter(e=>"Change"!==e.id&&e.y>0).map(e=>e.y)).flat(),l=`<div class="bubble-box">${md({...o,hideSymbols:g,revealingClose:y,plots:t.plots})}</div>`;e.view.tooltip.show(l,{x:n.x,y:r,yMin:Math.min(...a),yMax:Math.max(...a)})}kA(e,o,f,!1,!1,e.hasLegend,g,y,A);break;case gs.TOOLTIP_STD:if(!S){const t=md({...o,hideSymbols:g,revealingClose:y,plots:o.panes.map(e=>e.plots).flat()});e.view.tooltip.show(t)}kA(e,o,f,!1,!1,e.hasLegend,g,y,A);break;case gs.TOOLTIP_EXTERNAL:e.notifyHost(qa.CH_TOOLTIPCHANGED,o);break;default:console.warn(`Unknown tooltip mode requested: ${a}`)}}function FA(e,t,i,s,n,r){os(e,{position:"absolute",display:"flex","flex-direction":t,"flex-wrap":"wrap",left:`${i+gs.CARDS_X_OFFSET}px`,top:`${n+gs.CARDS_Y_OFFSET}px`,maxWidth:r-s-2*gs.CARDS_X_OFFSET+"px"})}function kA(e,t,i=!1,s=!1,n=!1,r=!1,o=!1,a=!1,l=!1,c=0){const u=e.view.el,h=gd(e,t,i,s,n,o,a,l);h.some(e=>!ie(e.bounds))||h.forEach(({id:t,isMainPane:i,content:s,moveContent:n,bounds:{left:o,right:a,top:l,width:h}},d)=>{if(!(""===s||r&&i)){const n=ls(t,u,"div");FA(n,i&&pd(e)?"column":"row",o,a,l+c,h),cs(n,{"bcharts-card":!0,"bcharts-card-main":i,"bcharts-card-first":0===d}),n.innerHTML=s}let p=rs(`#right-${t}`,u);ie(p)||(p=document.createElement("div"),p.id=`right-${t}`,u.appendChild(p),cs(p,"bcharts-card bcharts-card-move")),os(p,{position:"absolute",display:"block",right:`${a+gs.CARDS_X_OFFSET}px`,top:`${l+c+gs.CARDS_Y_OFFSET}px`}),p.innerHTML=n})}let WA=null;function UA(){return null===WA&&(WA=Gv().config.hostingModel===b[b.Application]),WA}class $A extends iA{constructor(e){super(),this.ap=e,this.presenter=e.presenter,this.panY=e.axis.isCustomDomain}presenter;panY;snapToSupported=!1;warmUp=!0;preventDefault=!1;lastOffset;lastPanningExtremes;activated(){}deactivated(){this.cancelLongPress()}startPan(e){this.startLongPress(this.presenter,this.ap,e),this.lastOffset=e,this.lastPanningExtremes=this.ap.axis.yScale.domain();const 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();const{point:t,view:i,offset:s}=e;if(t&&t.axis!==this.ap.axis)return;const{x:n,y:r}=s,o=n-this.lastOffset.x,a=Math.abs(o),l=this.lastOffset.y,c=r-l,u=Math.abs(c);a>=1&&this.cancelLongPress();const h=UA();if(q()&&!h&&this.warmUp)return(a>7||u>7)&&(this.warmUp=!1,this.preventDefault=a>u),!1;if(this.preventDefault||!q()||h){if(i.xAxis.pan(o),this.panY&&t&&t.axis){u>=1&&this.cancelLongPress();const e=function(e,t,i,s){const n=i-t,r=n/e.viewBox.height,[o,a]=s,l=r*(a-o);return[o+l,a+l]}(t.axis,l,r,this.lastPanningExtremes);this.lastPanningExtremes=e,t.axis.yScale.domain(e)}this.lastOffset=s,i.redraw(),t&&t.presenter.view.setCursor(y.Grabbing)}return h||this.preventDefault}finished(){ZS(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:e,offset:t,originalEvent:i}){q()&&XA(e,t,i)}performLongPress(e,t,i){e.enableTooltip(!0),e.resetActiveTool(),e.activeTool.startTouchCrosshairMode(e,t,i)}}let GA=null;class zA extends vA{constructor(e,t){super(e,t)}hitTest(e){if(!this.visible)return!1;const t=this.getRect();return null!==t&&t.contains(e)}draw(e,t){return!!super.draw(e,t)&&(Fn(e,this.getRect()),!0)}}function YA(e,t){return e<t?[e,t]:[t,e]}const jA={line:{width:1,color:"rgba(127, 127, 127, 0.3)",dashStyle:"LongDash"},fill:{color:"rgba(127, 127, 127, 0.1)"}};class KA extends LA{snapToSupported=!1;preventDefault=!1;axis;presenter;constructor(){super(dA("Rectangle",zA,null,jA),!1)}activated(){}deactivated(){ie(this.axis,this.annotation)&&this.axis.deleteAnnotation(this.annotation,!1)}onMouseDown(e){const t=super.onMouseDown(e);if(!0===t){const{point:t}=e;this.axis=t.axis,this.presenter=t.presenter}return t}finish(){if(ie(this.axis,this.presenter)){ZS(this.presenter,{toolChange:E.Executed,annId:"ZoomIn"});const e=this.annotation.points,t=YA(e[0].price,e[1].price),i=YA(e[0].time,e[1].time),s=(e,t)=>Math.abs(t(e[0])-t(e[1])),n=s(i,e=>this.axis.toX(e)),r=s(t,e=>this.axis.toY(e)),o=this.presenter.view,a=gs.MINIMUM_ZOOM_DIMENSION;if(n>a&&r>a){const e=o.xAxis.xScale;this.axis.isCustomDomain=!0,this.axis.yScale.domain(t),e.wasZoomed=!0,e.scaleBarToFitRange(i,!1),e.domain(i)}o.redraw()}}}function qA(e,t){const i=uA(e);i.offset={x:t.x,y:t.y},i.canFlip=null!==e.getFlipAnchorIndices();const s=e.axis.pane.presenter;s.clearSelection(),s.notifyHost(qa.CH_ANNNEEDSCONTEXTMENU,i)}function XA(e,t,i){const s={offset:{x:t.x,y:t.y},chart:e.accessor,originalEvent:i};e.notifyHost(qa.CH_CHTNEEDSCONTEXTMENU,s)}class ZA extends EA{constructor(e,t){super(e.annName),this.factory=e,this.maxClicks=t}clicks=0;snapToSupported=!0;isDrawingAnnotation=!0;onMouseMove(e){const{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){const{point:t,view:i}=e;if(0===this.clicks){if(void 0===t)return eT(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),JS(this.annotation,!0,E.Created)):this.annotation.requestRedraw()}applyToPoints(e){this.annotation.points[this.clicks].update(e.price,e.time)}}class JA{snapToSupported=!1;constructor(e,t){setTimeout(()=>this.finalize(e,t),10)}finalize(e,t){const i=e(t);t.pane.presenter.clearSelection(),i.drawn=!1,i.requestRedraw(),JS(i,!0,E.None)}}const QA=gs.MARKER_ARROW_ANGLE*Math.PI/180/2;function eS(e,t,i=gs.MARKER_ARROW_LENGTH){return new tS(e,t,i)}class tS{constructor(e,t,i=gs.MARKER_ARROW_LENGTH){this.vertex=t,this.arrowLen=i,this.p1=e[0],this.p2=e[1]}p1;p2;hitTest(e){const{anchor:t,p1:i,p2:s}=this.getArrowPoints();return yn([t,i],e,gs.HIT_TEST_TOLERANCE)||yn([t,s],e,gs.HIT_TEST_TOLERANCE)}draw(e){const{anchor:t,p1:i,p2:s}=this.getArrowPoints();Wn(e,t,i),Wn(e,t,s)}getArrowPoints(){const e=gn(this.p1,this.p2),t="start"===this.vertex?0:Math.PI,i=e-QA+t,s=e+QA+t,n="start"===this.vertex?this.p1:this.p2;return{anchor:n,p1:{x:this.arrowLen*Math.cos(i)+n.x,y:this.arrowLen*Math.sin(i)+n.y},p2:{x:this.arrowLen*Math.cos(s)+n.x,y:this.arrowLen*Math.sin(s)+n.y}}}}class iS{hitTest(){return!1}draw(){}}class sS extends mA{constructor(e,t){super(e,t),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[gs.AT_EXTEND_PT_1]}get extend2(){return this.traits[gs.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[gs.AT_SHOW_PERCENTDIFF]}get showBarCount(){return this.traits[gs.AT_SHOW_BARCOUNT]}get showRatio(){return this.traits[gs.AT_RATIO]}getElements(){const e=this.points[0].point,t=this.points[1].point,i=new pA(e,t,this.extend1,this.extend2,this.axis),s=[];return this.extend1&&s.push(new pA(i.p1,e,!0,!1,this.axis)),s.push(new pA(e,t,!1,!1,this.axis)),this.extend2&&s.push(new pA(t,i.p2,!1,!0,this.axis)),s}formatRatio(e,t){return` (${se(e/t,3)})`}formatPercDiff(e,t){const i=(t-e)/e*100;return` (${i>0?"+":""}${se(i,2)}%)`}formatPrice(e){return nd(this.axis,this.priceMap(e))}adornElements(e,t){if(!(this.showBarCount||this.showPrices||this.showPercentDiff||this.showRatio))return;const[i,s]=this.points,n=e[this.extend1?1:0].getAdornOffset(t);if(this.showBarCount){const e=mn(dn(i.point,s.point),n);Bn(t,this.getBarCount(i.time,s.time).toFixed(0),e,g.Right)}const r=this.showRatio?this.formatRatio(i.price,s.price):"",o=`${this.showPrices?this.formatPrice(i.price):""}${r}`.trim();""!==o&&Bn(t,o,mn(i.point,n),g.Right);const a=this.showPercentDiff?this.formatPercDiff(i.price,s.price):"",l=`${this.showPrices?this.formatPrice(s.price):""}${a}`.trim();""!==l&&Bn(t,l,mn(s.point,n),g.Right)}getMarkers(){const e=this.marker;if(!e||"none"===e.vertex)return[];const{vertex:t,kind:i}=e;return("both"===t?["start","end"]:[t]).map(e=>"arrow"===i?function(e,t){return eS(e.map(e=>e.point),t)}(this.points,e):(console.warn(`There is no marker of ${i} kind`),new iS))}}class nS extends mA{constructor(e,t){super(e,t),this.addPoints(1)}get showTimestamps(){return this.traits[gs.AT_SHOW_TIMESTAMPS]}getElements(){return[new oA(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}}class rS extends mA{constructor(e,t){super(e,t),this.addPoints(1)}getElements(){return[new oA(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}}class oS extends mA{constructor(e,t,i){super(e,t),this.addPoints(2),ie(i)&&ie(i.points)&&i.points.forEach((e,t)=>this.points[t].update(e.price,e.time))}allPoints(){const[e,t]=this.points;return ie(e,e.point,t,t.point)?[e,this.axis.toAnnotationPoint(dn(e.point,t.point)),t]:gs.EMPTY_ARRAY}line2(){return this.traits[gs.AT_LINE_2]}use52WeekPrices(){return this.traits[gs.AT_USE_52WEEK_PRICES]}getElements(){const e=this.allPoints();return e===gs.EMPTY_ARRAY?gs.EMPTY_ARRAY:e.map(e=>new pA({x:-8192,y:e.point.y},{x:gs.OUT_OF_SCREEN,y:e.point.y},!1,!1,this.axis))}wasPointMovedByTool(e,t){ie(this.use52WeekPrices())&&(this.traits[gs.AT_USE_52WEEK_PRICES]=!1)}getStyleForElement(e,t){const i=this.line2();if(1!==t||!ie(i))return super.getStyleForElement(e,t);const s=ue(this.traits);return s.line=i,rr(s)}getPriceScaleAdornments(){const e=this.allPoints();if(!this.showPrices||e===gs.EMPTY_ARRAY)return super.getPriceScaleAdornments();const t=this.traits.line,i=e.map(e=>({price:e.price,color:t.color})),s=this.line2();return ie(s)&&(i[1].color=s.color),i}getFlipAnchorIndices(){return null}}class aS extends gA{helper;constructor(e,t,i){super(e,t),this.addPoints(i),this.helper=new aA(e)}get showTrendLine(){return this.traits[gs.AT_SHOW_TRENDLINE]}get hasAllPoints(){return ie(...this.points.map(e=>e.point))}get line2(){return this.traits[gs.AT_LINE_2]}get extendLeft(){return this.traits[gs.AT_EXTEND_LEFT]}get extendRight(){return this.traits[gs.AT_EXTEND_RIGHT]}get reverse(){return this.traits[gs.AT_REVERSE]}get levelsRespectLogScale(){return this.traits[gs.AT_LEVELS_RESPECT_LOG_SCALE]}getStyleForElement(e,t){if(e.isTrend){const e=ue(this.traits);return e.line=this.line2,rr(e)}return super.getStyleForElement(e,t)}getKeyPoints(){const e=e=>e.map(e=>this.points[e]);return this.isExtended?e(this.reverse?[1,0,2]:[0,1,2]):e(this.reverse?[0,1,0]:[1,0,1])}getElements(){if(!this.hasAllPoints)return[];const[e,t,i]=this.getKeyPoints(),s=t.price-e.price,n=t.price/e.price,r=this.extendLeft,o=this.extendRight,a=this.leftPoint,l=this.rightPoint,c=(e,t,i=!1)=>{const s=new pA(e,t,!i&&r,!i&&o,this.axis);return s.isTrend=i,s},u=this.levelsRespectLogScale&&this.axis.scale===p.Logarithmic,h=this.getColoredElements(({value:e})=>{const t=i.price+s*e,r=i.price*Math.pow(n,e),o=u?r:t;this.helper.update(o,i.time);const h=this.helper.point.y;return c({x:a.x,y:h},{x:l.x,y:h})});return this.showTrendLine&&(h.push(c(e.point,t.point,!0)),this.isExtended&&h.push(c((this.reverse?e:t).point,i.point,!0))),h}getAdornPointAndAlign(e,t){const i=this.labels,s=(e,t,i)=>({pt:e,align:t,offset:i}),n=this.axis.pane.getBoundsWithoutScales();switch(i){case gs.AT_LABELS_LEFT:return this.extendLeft?s({x:n.x,y:e.anchor1.y},g.Left,t):super.getAdornPointAndAlign(e,t);default:case gs.AT_LABELS_RIGHT:return this.extendRight?s({x:n.x+n.width,y:e.anchor2.y},g.Right,-t):super.getAdornPointAndAlign(e,t);case gs.AT_LABELS_CENTER:return super.getAdornPointAndAlign(e,t)}}getTextRef(){return(e,t,i)=>({ref:t,spacing:5,offsetY:-5,text:this.formatLevelPrice(i,t.anchor1.y)})}adornElements(e,t){this.adornElementsForColoredFactors(e,(e,t)=>{const i=new Path2D;return null===e||(Dn(i,e.p1),i.lineTo(t.p2.x,e.p1.y),On(i,t.p2),i.lineTo(e.p1.x,t.p2.y)),i},this.getTextRef(),t)}getPriceScaleAdornments(){if(!this.pricesOnScale)return super.getPriceScaleAdornments();const e=this.getElements();if(0===e.length)return super.getPriceScaleAdornments();const t=this.traits.line.color;return this.factors.map((i,s)=>{const n=e[s++].p1,r=this.singleStyle?t:i.line.color;return{price:this.axis.toPrice(n.y),color:r}})}}class lS extends aS{constructor(e,t){super(e,t,2)}}class cS extends aS{constructor(e,t){super(e,t,3)}}const uS=(e,t)=>{const i=new Path2D;return null===e||(Dn(i,e.p1),On(i,e.p2),On(i,t.p2)),i};class hS extends gA{constructor(e,t){super(e,t),this.addPoints(2)}get reverse(){return this.traits[gs.AT_REVERSE]}getElements(){const[e,t]=this.getScreenPoints(),i=t.y-e.y;return this.getColoredElements(({value:s})=>{const n=this.reverse?e.y+s*i:t.y-s*i;return new pA(e,{x:t.x,y:n},!1,!0,this.axis)})}getTextRef(){const[e,t]=this.getScreenPoints(),i=t.y-e.y,[s,n]=[this.leftPoint,this.rightPoint];return(r,o,a)=>{const l=this.reverse?e.y+a*i:t.y-a*i;return{ref:new pA({x:s.x,y:l},{x:n.x,y:l},!1,!1,this.axis),spacing:5,offsetY:!0,text:a.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,uS,this.getTextRef(),t)}}class dS extends hS{constructor(e,t){super(e,t)}}class pS{constructor(e,t,i,s,n,r,o){this.center=e,this.rim=t,this.radius=i,this.startAngle=s,this.endAngle=n,this.antiClockwise=r,this.axis=o,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})}left=null;right=null;scale=null;clip=null;style;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){const t=new DOMPointReadOnly(e.x,e.y),i=this.axis.pane.presenter.view.mouseContext;i.save(),i.resetTransform(),this.applyScale(i);const 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(pn(this.left,e),pn(this.right,e));else{const i=this.hasScale?this.inverseScale(e):e,{x:s,y:n}=fn(i,this.center);if(!this.hasRim){const{startAngle:e,endAngle:t,antiClockwise:i}=this,r=Math.PI/2;if(0===e&&t===r&&!i&&(s<0||n<0))return!1;if(e===r&&t===Math.PI&&!i&&(s>0||n<0))return!1;if(e===-r&&t===Math.PI&&i&&(s>0||n>0))return!1;if(0===e&&t===-r&&i&&(s<0||n>0))return!1}t=Math.abs(Math.sqrt(s*s+n*n)-this.radius)}return t<=gs.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),kn(e,this.center,this.radius,this.startAngle,this.endAngle,this.isAntiClockwise??!1),e.restore()}}const fS=(e,t)=>{const i=new Path2D,{center:s}=t;if(Dn(i,s),i.arc(s.x,s.y,t.radius,t.startAngle,t.endAngle,t.isAntiClockwise??!1),null===e)return i;const n=new Path2D,{center:r}=e;return Dn(n,r),n.arc(r.x,r.y,e.radius,e.endAngle,e.startAngle,!e.isAntiClockwise),i.addPath(n),i};class mS extends gA{constructor(e,t){super(e,t),this.addPoints(2)}getElements(){const[e,t]=this.getScreenPoints();if(!ie(e,t))return[];const i=pn(e,t),s=fn(t,e),n=s.y/i,r=s.x/i,o=this.getColoredElements(({value:t})=>{const s=i*t,o=n*s,a=r*s,l={x:e.x+a,y:e.y+o};return function(e,t,i){const s=pn(e,t);return new pS(e,t,s,0,Math.PI,null,i)}(e,l,this.axis)});if(this.showTrendLine){const i=new pA(e,t,!1,!1,this.axis);i.isTrend=!0,o.unshift(i)}return o}get showTrendLine(){return!0}getTextRef(){return(e,t,i)=>{const{center:s}=t,n=t.isAntiClockwise?-1:1;return{ref:{x:s.x,y:s.y+n*t.radius},spacing:0,offsetY:!0,text:i.toString()}}}adornElements(e,t){this.adornElementsForColoredFactors(e,fS,this.getTextRef(),t)}}class gS extends mS{constructor(e,t){super(e,t)}getStyleForElement(e,t){if(e.isTrend){let e=ue(this.traits);return e.line=this.line2,rr(e)}return super.getStyleForElement(e,t)}get showTrendLine(){return this.traits[gs.AT_SHOW_TRENDLINE]}get line2(){return this.traits[gs.AT_LINE_2]}}class yS extends gA{constructor(e,t){super(e,t),this.addPoints(2)}get factorsPropName(){return gs.AT_ANGLES}getElements(){const[e,t]=this.getScreenPoints(),{x:i,y:s}=fn(t,e);return this.getColoredElements(({value:n})=>{const r=(t,i)=>new pA(e,{x:t,y:i},!1,!0,this.axis),o="1"!==n.charAt(0),a=Number(o?n.charAt(0):n.charAt(2));return o?r(t.x,e.y+s/a):r(e.x+i/a,t.y)})}getTextRef(){return(e,t,i)=>({ref:t.anchor2,spacing:0,offsetY:!0,text:i.toString()})}adornElements(e,t){this.adornElementsForColoredFactors(e,uS,this.getTextRef(),t)}}class AS extends hS{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}getElements(){const[e,t]=this.getScreenPoints();return[new pA(e,t,!1,!1,this.axis)].concat(super.getElements())}}class SS extends mS{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}}class TS extends mA{constructor(e,t){super(e,t),this.addPoints(3)}getElements(){const e=this.points[0].point,t=this.points[1].point,i=this.points[2].point,s=(t.x+i.x)/2-e.x,n=(t.y+i.y)/2-e.y,r=[];return r.push(new pA(t,{x:t.x+s,y:t.y+n},!1,!0,this.axis)),r.push(new pA(e,{x:e.x+s,y:e.y+n},!1,!0,this.axis)),r.push(new pA(i,{x:i.x+s,y:i.y+n},!1,!0,this.axis)),r.push(new pA(t,i,!1,!1,this.axis)),r}}class vS extends vA{constructor(e,t){super(e,t)}getEllipse(){const e=this.getRect();return null===e?null:new In(e.centerX,e.centerY,e.width/2,e.height/2)}hitTest(e){if(!this.visible)return!1;const t=this.getEllipse();return null!==t&&t.contains(e)}draw(e,t){return!!super.draw(e,t)&&(i=e,s=this.getEllipse(),i.beginPath(),i.ellipse(s.cx,s.cy,s.radiusX,s.radiusY,0,0,2*Math.PI),i.stroke(),i.fill(),!0);var i,s}}class PS extends mA{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[gs.AT_EXTEND_PT_1]}get extend2(){return this.traits[gs.AT_EXTEND_PT_2]}getLastPoint(){const[e,t,i]=this.points;var s=pn(e.point,t.point),n=gn(e.point,t.point);return{x:i.point.x+s*Math.cos(n),y:i.point.y+s*Math.sin(n)}}getElements(){const[e,t,i]=this.points;var s=[];if(s.push(new pA(e.point,t.point,this.extend1,this.extend2,this.axis)),ie(i?.price)){var n=this.getLastPoint();s.push(new pA(i.point,n,this.extend1,this.extend2,this.axis))}return s}}class CS extends vA{constructor(e,t,i){super(e,t),this.kind=i,this.adjustFill=!0}hitTest(e){if(!this.visible)return!1;const t=this.getRect();return null!==t&&t.contains(e)}get dimension(){const e="fish_hook"===this.kind?2:1;return gs.DEFAULT_SYMBOL_WIDTH_HEIGHT*e}updateOtherPoints(){this.points[1].price||this.setBottomRight()}setBottomRight(){const e=this.dimension,t=this.axis.pane.presenter.timeline,{price:i,time:s}=this.points[0],n=G(t,s,Number,ud);if(-1!==n){const s=this.axis.pane.presenter.view.xAxis.xScale.bar.totalWidth;let r=1;for(;(2*r+1)*s<e;)r++;this.points[0].update(i,t.at(n-r)),this.points[1].update(i,t.at(n+r));const o=mn(this.points[0].point,{x:0,y:-e/2}),a=mn(this.points[1].point,{x:0,y:e/2});this.points[0].updateFromPoint(o),this.points[1].updateFromPoint(a)}}draw(e,t){if(!super.draw(e,t))return!1;const i=this.getRect();return 0===i.width&&(i.width=this.dimension),Gn(e,this.kind,i),!0}}class bS extends gA{helper;constructor(e,t){super(e,t),this.addPoints(2),this.helper=new aA(e)}getElements(){const e=this.axis.pane.presenter.timeline,{price:t,time:i}=this.points[0],s=G(e,i,Number,ud),n=G(e,this.points[1].time,Number,ud),r=n-s;if(-1===s||-1===n)return[];return this.getColoredElements(({value:i})=>{const n=e.at(s+i*r);return null===n?null:(this.helper.update(t,n),new oA(this.helper.point,!0,this.axis))})}getTextRef(){return(e,t,i)=>({ref:t.anchor,spacing:3,offsetY:!0,text:i.toString()})}adornElements(e,t){const i=this.axis.pane.getBoundsWithoutScales();this.adornElementsForColoredFactors(e,(e,t)=>{const s=new Path2D;if(null===e)return s;const n=t.anchor.x-e.anchor.x;return s.rect(e.anchor.x,i.y,n,i.height),s},this.getTextRef(),t)}getTimeScaleAdornments(){const e=e=>({time:this.points[e].time,color:this.traits.line.color});return[e(0),e(1)]}}class ES{snapToSupported=!0;isDrawingAnnotation=!0;constructor(){}onMouseMove(e){const{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){if(q()&&e.originalEvent instanceof TouchEvent)return;const{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(qa.CH_ANNPOINTPICKED,s),ZS(i,void 0)}}const LS="Open",MS="Closed";class _S extends mA{constructor(e,t,i){super(e,t),this.isLong=i,this.addPoints(4);const s=(e,t)=>this.points[e].moveDirection=t;s(1,T.Vertical),s(2,T.Vertical),s(3,T.Horizontal),this.twoDecMeta=new Qs(2)}twoDecMeta;_dataWindow;_metaData;isHit=!1;data(e){return this.presenter.mainPlot.timeSeries.container.getData(e)}get presenter(){return this.axis.pane.presenter}getDataWindow(e,t,i=!0,s=!0){const n=this.data(Ka.DateTime),r=G(n,+e,Number),o=G(n,+t,Number),a={refIndex:-1,highestIndex:-1,lowestIndex:-1,highest:null,lowest:null,data:[]},[l,c,u]=[Ka.High,Ka.Low,Ka.Close].map(e=>this.data(e)),h=e=>e-r;for(let d=r;d<=o;d++)i&&-1===a.refIndex&&ie(this.entryPrice)&&this.entryPrice>=c[d]&&this.entryPrice<=l[d]&&(a.refIndex=h(d)),(!i||a.refIndex>=0&&h(d)>=a.refIndex)&&((!ie(a.highest)||l[d]>a.highest)&&(a.highest=l[d]),(!ie(a.lowest)||c[d]<a.lowest)&&(a.lowest=c[d])),i&&-1!==a.refIndex&&(-1===a.highestIndex&&l[d]>this.upperPrice&&(a.highestIndex=h(d)),-1===a.lowestIndex&&c[d]<this.lowerPrice&&(a.lowestIndex=h(d))),s&&a.data.push({high:l[d],low:c[d],close:u[d],time:n[d]});if(s&&a.data&&a.data.length>0){a.state=ie(a.highest,a.lowest)&&(this.upperPrice<a.highest||this.lowerPrice>a.lowest)?MS:LS,a.special=-1===a.highestIndex&&-1===a.lowestIndex||a.highestIndex===a.lowestIndex;const e=k(a.data);if(a.toPrice=e.close,a.toTime=e.time,a.state===MS)if(a.special){if(-1!==a.refIndex){const e=a.data[a.refIndex];a.toTime=e.time;const t=this.isLong?this.lowerPrice<a.lowest:this.upperPrice<a.highest;a.toPrice=t?this.upperPrice:this.lowerPrice}}else{const e=-1!==a.highestIndex&&-1!==a.lowestIndex;e&&a.highestIndex<a.lowestIndex||-1===a.lowestIndex?(a.toPrice=this.upperPrice,a.toTime=a.data[a.highestIndex].time):(e&&a.lowestIndex<a.highestIndex||-1===a.highestIndex)&&(a.toPrice=this.lowerPrice,a.toTime=a.data[a.lowestIndex].time)}const t=this.isLong?a.toPrice-this.entryPrice:this.entryPrice-a.toPrice;a.pAndL=se(t,2)}return a}get dataWindow(){return ie(this._dataWindow)||(this._dataWindow=this.getDataWindow(this.entryAnchor.time,this.exitAnchor.time)),this._dataWindow}getVisiblePriceRange(){const e=this.axis.yScale.domain();return e[1]-e[0]}getFutureTimestamp(){const e=this.axis.pane.presenter.timeline,t=G(e,+this.points[0].time,Number,ud),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[gs.AT_ACCOUNT_SIZE]}get risk(){const e=this.traits[gs.AT_RISK_IS_PERCENT],t=this.traits[gs.AT_RISK];return se(e?t/100*this.accountSize:t,2)}get pointValue(){return this._metaData||(this._metaData=this.presenter.mainPlot.metaData),this._metaData.pointValue}formatDollarValue(e){if(!Number.isFinite(e))return gs.NOT_APPLICABLE;return`${e<0?"-":""}$${this.twoDecMeta.format(Math.abs(e))}`}get qty(){return Math.floor(this.risk/(this.isLong?this.entryPrice-this.lowerPrice:this.upperPrice-this.entryPrice))}get upperDiff(){return se(this.upperPrice-this.entryPrice,2)}get amountMultiplier(){return this.isLong?1:-1}get upperAmount(){return se(this.accountSize+this.amountMultiplier*this.qty*this.upperDiff,2)}get upperPandL(){return se(this.amountMultiplier*this.upperDiff*this.pointValue,2)}get isCompact(){return this.traits[gs.AT_COMPACT]}get upper(){const e=nd(this.axis,this.priceMap(this.upperPrice)),t=`(${se(this.upperDiff/this.entryPrice*100,2).toFixed(2)}%)`;return this.isCompact,`${e} ${t}`}get upperText(){const 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 se(this.entryPrice-this.lowerPrice,2)}get lowerAmount(){return se(this.accountSize-this.amountMultiplier*this.qty*this.lowerDiff,2)}get lowerPandL(){return se(-this.amountMultiplier*this.lowerDiff*this.pointValue,2)}get lower(){const e=nd(this.axis,this.priceMap(this.lowerPrice)),t=`(${se(this.lowerDiff/this.entryPrice*100,2).toFixed(2)}%)`;return this.isCompact,`${e} ${t}`}get lowerText(){const 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 se(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(){const 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(gs.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(gs.AT_FILL)}get textStyle(){return this.fillOnlyStyle(gs.AT_FILL_TEXT)}get secondaryLineStyle(){return rr({line:{color:this.traits.line.color,dashStyle:"ShortDash"},fill:{color:gs.COLOR_TRANSPARENT}})}wasModifiedByTool(){ie(this.points[2].price)||this.positionPoints(),this._dataWindow=void 0}wasPointMovedByTool(e,t){const i=this.getVisiblePriceRange()/5e3;if(this.points.indexOf(e)<3){const t=t=>e.update(t,e.time);this.entryAnchor.price>this.upperAnchor.price&&(e===this.entryAnchor?t(this.upperAnchor.price-i):t(this.entryAnchor.price+i)),this.entryAnchor.price<this.lowerAnchor.price&&(e===this.entryAnchor?t(this.lowerAnchor.price+i):t(this.entryAnchor.price-i))}if(e===this.entryAnchor){const 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(){const e=this.dataWindow;return this.isLong?e.pAndL>0:e.pAndL<=0}getStyleForElement(e,t){return e.style||this.defaultStyle}getElements(){const e=new pA(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}),n=new fA(s(this.upperAnchor.point,t?-i:0),i,Math.abs(this.upperAnchor.point.y-this.entryAnchor.point.y),this.axis);n.style=this.upperStyle;const r=new fA(s(this.entryAnchor.point,t?-i:0),i,Math.abs(this.entryAnchor.point.y-this.lowerAnchor.point.y),this.axis);r.style=this.lowerStyle;const o=[e,n,r],a=this.dataWindow;if(-1!==a.refIndex){const e=a.data[a.refIndex],t=new aA(this.axis,this.entryPrice,e.time),i=new aA(this.axis,a.toPrice,a.toTime),s=new pA(t.point,i.point,!1,!1,this.axis);if(s.style=this.secondaryLineStyle,o.push(s),t.time!==i.time){const e=this.entryPrice<a.toPrice,s=new fA({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,o.push(s)}}return o}hitTest(e){if(!this.visible)return!1;const 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(){const e=e=>Sn(this.traits[e].color);return[{price:this.upperPrice,color:e(gs.AT_FILL)},{price:this.entryPrice,color:e(gs.AT_LINE)},{price:this.lowerPrice,color:e(gs.AT_FILL2)}]}adornElements(e,t){const[i,s,n]=e;if(this.showTextAdornments){const[e,r]=[!0,!1].map(e=>Nn(t,e)),{x:o,y:a,width:l}=s.rect,c={x:o+l/2,y:a+e},u=this.textStyle.fillStyle;Bn(t,this.upperText,c,g.Center,u,Sn(this.upperStyle.fillStyle));const{x:h,y:d,width:p,height:f}=n.rect,m={x:h+p/2,y:d+f+Math.abs(r)};Bn(t,this.lowerText,m,g.Center,u,Sn(this.lowerStyle.fillStyle));const{p1:y,p2:A}=i,{x:S,y:T}=y,{x:v}=A,P=this.state||gs.NOT_APPLICABLE,C=this.isCompact?`${this.formatDollarValue(this.pAndLValue)}`:`${P} P&L: ${this.formatDollarValue(this.pAndLValue)}, Qty: ${this.qty}`,b=this.isCompact?`${this.riskReward.toFixed(2)}`:`Risk/Reward Ratio: ${this.riskReward.toFixed(2)}`,E=e=>t.measureText(e).width,L=Math.max(E(C),E(b)),M={x:S+(v-S)/2,y:Math.abs(v-S)<1.25*L?T+Math.abs(r)+5:T+e+10},_=Sn(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);Bn(t,[C,b],M,g.Center,u,_)}}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}}class xS extends yA{markers;display=null;constructor(e,t){super(e,t),this.points=TA(e),this.points[2].visible=!1,this.points[3].visible=!1,this.markers=[new iS]}isPointDrawn(e){return!!super.isPointDrawn(e)&&e.visible}makeLineArrow(e,t,i,s){const n=[dn(e,t),dn(i,s)];return[this.makeLine(n[0],n[1]),eS(n,"end",10)]}get rectColor(){return this.traits[gs.AT_FILL].color}get textColor(){return this.traits[gs.AT_FILL_TEXT].color}getMarkers(){return this.markers}formatDateDifference(e,t){if(this.presenter.data.aggregation.isEndOfDay)return`${pt(t,e)}d`;const i=function(e,t){var i,s,n,r,o;if(arguments.length<1)throw new TypeError("1 argument required, but only ".concat(arguments.length," present"));var a=tt(),l=null!==(i=null!==(s=null==t?void 0:t.locale)&&void 0!==s?s:a.locale)&&void 0!==i?i:pi,c=null!==(n=null==t?void 0:t.format)&&void 0!==n?n:Ti,u=null!==(r=null==t?void 0:t.zero)&&void 0!==r&&r,h=null!==(o=null==t?void 0:t.delimiter)&&void 0!==o?o:" ";return l.formatDistance?c.reduce(function(t,i){var s="x".concat(i.replace(/(^.)/,function(e){return e.toUpperCase()})),n=e[i];return"number"==typeof n&&(u||e[i])?t.concat(l.formatDistance(s,n)):t},[]).join(h):""}(Ci({start:e,end:t}),{format:["days","hours","minutes","seconds"]});return i.replaceAll(/(days?)|(hours?)|(minutes?)|(seconds?)/g,e=>e[0])}computeState(){}get text(){return null===this.display&&this.computeState(),this.display}getTextCoord(e,t){const i=this.points[0].price<this.points[1].price,s=Nn(t,i,this.text.length),{x:n,y:r,width:o,height:a}=e.rect;return{x:n+o/2,y:r+(i?0:a)+(i?s:Math.abs(s))}}adornElements(e,t){Bn(t,this.text,this.getTextCoord(e[0],t),g.Center,this.textColor,Sn(this.rectColor))}getDateDifference(){const[e,t]=this.points.slice(0,2).map(e=>e.time),i=Math.min(+e,+t),s=Math.max(+e,+t),n=this.data(Ka.DateTime),r=G(n,+i,Number),o=G(n,+s,Number),a=O(this.data(Ka.Volume).slice(r,o+1)),l=this.formatter.format(a,Ka.Volume),c=o-r,u=e<t?"":"-";return[`${u}${c} bars, ${u}${0===c?"":this.formatDateDifference(i,s)}`,`Vol ${l}`]}getPriceDifference(){const[e,t]=this.points.slice(0,2).map(e=>e.price),i=t-e,s=i/e;return[`${this.formatter.format(i,Ka.Close)} (${this.formatter.format(s,Ka.PercentChange)})`]}resetComputedState(){this.display=null}getFlipAnchorIndices(){return[0,1]}}class IS extends xS{getElements(){this.points.slice(2).forEach(e=>e.toPoint());const[e,t,i,s]=this.getScreenPoints(),n=this.makeLine(e,s),r=this.makeLine(t,i),[o,a]=this.makeLineArrow(e,s,t,i);return this.markers[0]=a,[this.rect,n,r,o]}computeState(){this.display=this.getDateDifference()}}class DS extends xS{getElements(){this.points.slice(2).forEach(e=>e.toPoint());const[e,t,i,s]=this.getScreenPoints(),n=this.makeLine(e,i),r=this.makeLine(t,s),[o,a]=this.makeLineArrow(e,i,t,s);return this.markers[0]=a,[this.rect,n,r,o]}computeState(){this.display=this.getPriceDifference()}}class OS extends xS{get drawBorder(){return this.traits[gs.AT_DRAW_BORDER]}getBorderElements(){if(!this.drawBorder)return[];const[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());const[e,t,i,s]=this.getScreenPoints(),[n,r]=this.makeLineArrow(e,s,t,i),[o,a]=this.makeLineArrow(e,i,t,s);this.markers=[r,a];const l=this.getBorderElements();return[this.rect,n,o].concat(l)}computeState(){this.display=this.getPriceDifference().concat(this.getDateDifference())}}class wS extends yA{constructor(e,t){super(e,t),this.points=TA(e)}get priceLevels(){return Jn(this.traits[gs.AT_PRICE_LEVELS])}get timeLevels(){return Jn(this.traits[gs.AT_TIME_LEVELS])}get showAngles(){return this.traits[gs.AT_SHOW_ANGLES]}get reverse(){return this.traits[gs.AT_REVERSE]}get showLeftLabels(){return this.traits[gs.AT_SHOW_LEFT_LABELS]}get showRightLabels(){return this.traits[gs.AT_SHOW_RIGHT_LABELS]}get showTopLabels(){return this.traits[gs.AT_SHOW_TOP_LABELS]}get showBottomLabels(){return this.traits[gs.AT_SHOW_BOTTOM_LABELS]}getAngles(e,t){const i=this.getScreenPoints(),s=this.lineOnlyStyle(gs.AT_LINE_2),n=[];e.concat(t).flatMap(e=>[e.p1,e.p2]).map(e=>{n.some(t=>{return s=t,(i=e).x===s.x&&i.y===s.y;var i,s})||n.push(e)});const r=i.map(e=>n.filter(t=>{return s=e,!((i=t).x===s.x||i.y===s.y);var i,s}).map(t=>this.makeLine(e,t))).flat();return r.forEach(e=>e.style=s),r}getElements(){const 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){const i=this.singleStyle,s=this.showBackground,n=t.fillStyle,r=Rn(t,1)/2,{x:o,y:a}=gs.DEFAULT_ADORN_OFFSET,l=(e,i,s,n,r)=>{const o=mn(e,i);Bn(t,Number(s.toFixed(4)).toString(),o,n,r)},c=(e,i)=>{const s=new Path2D;wn(s,e.p1,i.p2),t.fillStyle=i.style.fillStyle,t.fill(s)};let u=null;if(e.forEach(e=>{if(!e._data)return;const{level:t,isPrice:h}=e._data,d=i?n:e.style.strokeStyle,p=u&&s&&!i;h?(this.showLeftLabels&&l(e.p1,{x:o,y:r},t,g.Right,d),this.showRightLabels&&l(e.p2,{x:-o,y:r},t,g.Left,d),p&&c(u,e)):(this.showTopLabels&&l(e.p1,{x:0,y:a},t,g.Center,d),this.showBottomLabels&&l(e.p2,{x:0,y:2*-a},t,g.Center,d),p&&c(u,e)),u=e}),i&&s){const e=this.applyBackgroundOpacity(this.traits.line.color),i=new Path2D,[s,n]=this.getScreenPoints();wn(i,s,n),t.fillStyle=e,t.fill(i)}}resetComputedState(){this.lines=void 0}updateFrom(e,t,i,s,n){const r=e.reverse!==this.reverse;super.updateFrom(e,t,i,s,n),r&&this.resetComputedState()}getFlipAnchorIndices(){return[0,1]}}const RS=e=>e.map(e=>({...e,dimensions:e.value.split("x").map(Number)})),NS=(e,t)=>Math.abs(e-t)<1e-7;class VS extends yA{_parsedFans=null;_parsedArcs=null;constructor(e,t){super(e,t),this.points=TA(e),this._parsedFans=this._parsedArcs=null}get levels(){return Jn(this.traits[gs.AT_LEVELS])}setComputedAndTraits(e,t){const 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[gs.AT_SHOW_RANGES_RATIO]}get arcs(){return Jn(this.traits[gs.AT_ARCS])}get fans(){return Jn(this.traits[gs.AT_FANS])}get reverse(){return this.traits[gs.AT_REVERSE]}get parsedFans(){return null===this._parsedFans&&(this._parsedFans=RS(this.fans)),this._parsedFans}get computedFans(){const[,,e,t]=this.getReversedScreenPoints(),{dx:i,dy:s}=this.unit,{signX:n,signY:r}=this.getOrientation();return this.parsedFans.map(o=>{const[a,l]=o.dimensions;return this.setComputedAndTraits(o,a>=l?{x:e.x,y:e.y+l/a*r*5*s}:{x:t.x+a/l*5*n*i,y:t.y})})}get parsedArcs(){return null===this._parsedArcs&&(this._parsedArcs=RS(this.arcs)),this._parsedArcs}get computedArcs(){const{dx:e}=this.unit;return this.parsedArcs.map(t=>{const[i,s]=t.dimensions;return this.setComputedAndTraits(t,Math.sqrt(e**2*(i**2+s**2)))})}getReversedScreenPoints(){const[e,t,i,s]=this.getScreenPoints();return this.reverse?[t,e,s,i]:[e,t,i,s]}get unit(){const[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[gs.AT_PRICE_BAR_RATIO]}set priceBarRatio(e){this.traits[gs.AT_PRICE_BAR_RATIO]=e}makeStyledLine(e,t,i){const s=this.makeLine(e,t);return this.singleStyle||(s.style=rr(i)),s}getGridLines(e,t){const i=t.x-e.x,s=t.y-e.y;return this.computedLevels.map(({computed:n,traits:r})=>{const o=e.x+n*i,a=e.y+n*s;return[this.makeStyledLine({x:o,y:e.y},{x:o,y:t.y},r),this.makeStyledLine({x:e.x,y:a},{x:t.x,y:a},r)]}).flat()}getArcs(e){const{flipX:t,flipY:i,signY:s}=this.getOrientation(),{dx:n,dy:r}=this.unit,o=NS(n,r)?null:{x:1,y:r/n},a=this.getClipPath();return this.computedArcs.map(({computed:n,traits:r})=>{const l=function(e,t,i,s,n,r){return new pS(e,null,t,i,s,n,r)}(e,n,t?s*Math.PI/2:0,t?Math.PI:s*Math.PI/2,i,this.axis);return null!==o&&(l.scale=o),l.clip=a,this.singleStyle||(l.style=rr(r)),l})}getFans(e){return this.computedFans.map(({computed:t,traits:i})=>this.makeStyledLine(e,t,i))}getElements(){if(null===this.unit)return[];const[e,t]=this.getReversedScreenPoints();return[...this.getGridLines(e,t),...this.getArcs(e),...this.getFans(e)]}getOrientation(){const[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(){const[e,t]=this.getReversedScreenPoints(),i=new Path2D;return wn(i,e,t),i}adornElements(e,t){if(0===e.length)return;const i=(e,i,s)=>{t.fillStyle=s;const n=i.hasScale;n&&(t.save(),i.applyScale(t)),t.fill(e),n&&t.restore()};if(this.showBackground){const s=e.filter(e=>e.radius),n=this.getClipPath();if(t.save(),t.clip(n),this.singleStyle){const e=k(s),t=fS(null,e),n=this.applyBackgroundOpacity(this.traits.line.color);i(t,e,n)}else{let e=null;s.forEach(t=>{const s=fS(e,t),n=t.style.fillStyle;i(s,t,n),e=t})}t.restore()}if(this.showRangesRatio&&null!==this.unit){const e=k(this.computedLevels),i=(this.singleStyle?this:e).traits.line.color,[,s,n,r]=this.getReversedScreenPoints(),{x:o,y:a}=gs.DEFAULT_ADORN_OFFSET,{flipX:l,signX:c,signY:u}=this.getOrientation(),h=mn(n,{x:-o*c,y:a*u}),{priceDiff:d,barsDiff:p}=this.getLinesDataAtLevels(null,null),f=l?g.Right:g.Left;Bn(t,p.toFixed(0),h,f,i);const m=mn(r,{x:2*o*c,y:-a*u}),y=l?g.Left:g.Right;Bn(t,this.formatter.format(d,Ka.Close),m,y,i);const A=mn(s,{x:-o*c,y:-a*u});Bn(t,this.priceBarRatio.toFixed(6),A,f,i)}}resetComputedState(){if(this.lines=void 0,4===this.points.length&&null!==this.unit){const{priceDiff:e,barsDiff:t}=this.getLinesDataAtLevels(null,null);this.priceBarRatio=Math.abs(e/t)}}updateFrom(e,t,i,s,n){if(super.updateFrom(e,t,i,s,n),this._parsedFans=this._parsedArcs=null,!NS(e.priceBarRatio,this.priceBarRatio)){let[t,i,,]=this.points;this.reverse&&([t,i]=[i,t]);const{priceDiff:s,barsDiff:n}=this.getLinesDataAtLevels(null,null);i.update(t.price+Math.sign(s)*e.priceBarRatio*n,i.time),this.resetComputedState()}}getFlipAnchorIndices(){return[0,1]}}const HS=(e,t)=>{const i=new Path2D;return null===e||(Dn(i,e.p1),On(i,e.p2),On(i,t.p2),On(i,t.p1)),i};class BS extends gA{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[gs.AT_EXTEND_PT_1]}get extend2(){return this.traits[gs.AT_EXTEND_PT_2]}getElements(){const[e,t,i]=this.getScreenPoints(),{x:s,y:n}=fn(i,e),r=i=>{const[s,n]=[e,t].map(e=>mn(e,i));return new pA(s,n,this.extend1,this.extend2,this.axis)};return this.getColoredElements(({value:e})=>r({x:s*e,y:n*e}))}getTextRef(){return(e,t,i)=>({ref:t,spacing:5,offsetY:!0,text:this.formatLevelPrice(i,t.anchor1.y)})}adornElements(e,t){this.adornElementsForColoredFactors(e,HS,this.getTextRef(),t)}}class FS extends mA{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=Ce(1,1e3,e.LevelSize),this.alignLeft="Left"===e.Position,this.totalVolume="Total"===e.Volume,this.widthPercent=Ce(5,100,e.WidthPercent)/100,e.BarColoring){case"OpenToClose":this.useChange=!1;break;case"CloseToClose":this.useChange=!0;break;default:{const e=this.presenter.mainPlot?.mainCurve?.attributes;this.useChange=e?.includes(r.ChangeBased)??!1}}te(e.PeriodType)&&(this.periodType=e.PeriodType),this.period=e.Period,this.valueRangePercent=e.ValueRangePercent/100;const t=v[Gv()?.config.mode??"Unspecified"];this.usesFinerGrainedAgg=jr(t)}get isCountMode(){return"Count"===this.levelMode}updateLastBox(){if(this.boxes.length>0){const 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":{const e=this.studySeries.innCont(0),t=e?.getTimeData();if(!ie(t))return;const i=t[t.length-1],s=this.boxes.length>0?this.boxes[this.boxes.length-1]:null;if(te(s)&&i.valueOf()<s.lastDate.valueOf())this.updateLastBox();else{const 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":{const t=this.axis.pane.presenter.view.xAxis.xScale.bar,i=this.axis.toY(e.min),s=this.axis.toY(e.max),n=this.axis.pane.presenter.view.toX(e.firstDate)-t.width/2;let r=0;if("Days"===this.periodType){const i=e.lastDate,s=this.axis.pane.presenter.view.xAxis.xScale.timeline,o=s.at(s.lastSeriesIndex),a=o.valueOf()<i.valueOf(),l=a?o:i,c=(a?1:-2)*t.width/2;r=this.axis.pane.presenter.view.toX(l)+c-n}else r=this.period*t.width+(this.period-1)*t.spacing;return new xn(n,s,r,i-s)}default:throw new Error("Unexpected period type for Volume At Price annotation")}}getElementsForBox(e){const t=this.getBoxRect(e),i=[];if(this.isPeriodic){const e=new fA({x:t.x,y:t.y},t.width,t.height,this.axis);e.style=this.backgroundStyle,i.push(e)}const{x:s,width:n}=t,r=n*this.widthPercent,o=e.bars[e.maxVolumeIndex];return e.bars.forEach((t,a)=>{const{upVolume:l,downVolume:c,totalVolume:u,isValue:h}=t;if(0===l&&0===c)return null;const d=this.axis.toY(e.min+a*e.zone),p=this.axis.toY(e.min+(a+1)*e.zone),f=Math.abs(d-p),m=(e,t,i=0)=>{const r=this.alignLeft?s+i:s+n-e-i,o=new fA({x:r,y:p},e,f,this.axis);return o.style=t,o},g=(e,t,i)=>e/t.totalVolume*i,y=this.studyPlot.curves[2].visible,A=y&&h?this.upValueStyle:this.upStyle,S=y&&h?this.downValueStyle:this.downStyle,T=y&&h?this.totalValueStyle:this.totalStyle;if(this.totalVolume){const e=g(u,o,r);i.push(m(e,T))}else{const e=g(c,o,r),t=g(l,o,r);i.push(m(t,A),m(e,S,t))}if(this.studyPlot.curves[1].visible&&a===e.maxVolumeIndex){const e=i[i.length-1].rect,t=this.alignLeft?e.x+e.width:s,r=(p+d)/2,o=this.alignLeft?s+n:e.x;i.push(new pA({x:t,y:r},{x:o,y:r},!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)return[];if(0===this.boxes.length)return[];switch(this.periodType){case"VisibleScreen":{const e=this.boxes[0];return e&&0!==e.bars.length?this.getElementsForBox(e):[]}case"Bars":case"Days":{const[e,t]=this.presenter.view.xAxis.xScale.domain()||[];if(!ht(e)||!ht(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);const n=[];for(let r=i;r<=s;r++)n.push(...this.getElementsForBox(this.boxes[r]));return n}default:throw new 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(gs.AT_FILL)}get upStyle(){return this.fillOnlyStyle(gs.AT_FILL2)}get totalStyle(){return this.fillOnlyStyle(gs.AT_FILL3)}get downValueStyle(){return this.fillOnlyStyle(gs.AT_FILL4)}get upValueStyle(){return this.fillOnlyStyle(gs.AT_FILL5)}get totalValueStyle(){return this.fillOnlyStyle(gs.AT_FILL6)}get backgroundStyle(){return this.fillOnlyStyle(gs.AT_FILL7)}get lineStyle(){return this.lineOnlyStyle(gs.AT_LINE)}getBoxEndFromStart(e){switch(this.periodType){case"VisibleScreen":default:return null;case"Days":return _t(gu(a.Day,this.period)(e),1);case"Bars":{const t=this.axis.pane.presenter.data.aggregation;return _t(gu(t.unit,t.size*this.period)(e),1)}}}getData(){const e=this.axis.pane.presenter.data.aggregation;if(e.isTick||e.hasSpec&&!dg(e.spec))return;const[t,i]=this.presenter.view.xAxis.xScale.domain()||[];if(!ht(t)||!ht(i))return;const s=gu(e.unit,e.size);switch(this.periodType){case"VisibleScreen":{const e=this.boxes[0];if(e&&e.firstDate===t&&e.lastDate===i)this.gotData=!0;else{const e=this.getDataForRange(t,i);e&&(this.boxes[0]=e)}break}case"Bars":{const[e,t]=[0,1].map(e=>this.studySeries.innCont(e));if((e?.size??0)<1||(t?.size??0)<1)return;const i=e.getTimeData();let n=0;for(this.boxes=[];n<i.length;){const e=i[n],t=n+this.period,r=_t(t<i.length?i[t]:s(i[i.length-1]),1),o=this.getDataForRange(e,r);o&&this.boxes.push(o),n+=this.period}this.gotData=!0;break}case"Days":{if(e.isEndOfDay)return this.boxes=[],void(this.gotData=!0);const[t,i]=[0,1].map(e=>this.studySeries.innCont(e));if((t?.size??0)<1||(i?.size??0)<1)return;const n=t.getTimeData(),r=t.getData(Ka.TradingDay),o=e=>{let t=0,i=n[e],s=r[e];for(let o=e;o<n.length;o++)if(rt(n[o],i)>0&&r[o]!==s&&(t+=1,i=n[o],s=r[o],t===this.period))return o;return-1};let a=0,l=n[a],c=o(a)-1;for(;(c<0||c===a)&&a<n.length;)a+=1,c=o(a)-1;for(this.boxes=[];a<n.length&&c<n.length&&a<c;){const e=_t(s(n[c]),1),t=this.getDataForRange(l,e);t&&this.boxes.push(t),a=c+1,l=n[a],c=o(a)-1}if(c<0&&a<n.length-1){const e=_t(s(n[n.length-1]),1),t=this.getDataForRange(n[a],e);t&&this.boxes.push(t)}this.gotData=!0;break}}}getBoxAt(e){if(0===this.boxes.length)return null;switch(this.periodType){case"VisibleScreen":{const t=this.boxes[0];return t.firstDate>e||t.lastDate<e?null:t}case"Bars":case"Days":{const t=e.getTime(),i=this.boxes.find(e=>e.firstDate.getTime()<=t&&e.lastDate.getTime()>=t);return i||null}}}getValueAt(e,t,i){if(!this.isVisible)return null;const s=this.getBoxAt(t);if(!s)return null;const n=this.getBarIndex(s,i);if(n<0||n>=s.bars.length)return null;const r=s.bars[n];switch(e){case Ka.UPVOL:return this.totalVolume?null:r.upVolume;case Ka.DNVOL:return this.totalVolume?null:r.downVolume;case Ka.TOTVOL:return this.totalVolume?r.totalVolume:null;case Ka.POC:case Ka.VAREA:case Ka.BARBACK:return null;default:throw new Error("Unexpected Volume At Price field")}}getBarIndex(e,t,i=!1){if(0===e.bars.length||0===e.zone)return-1;const 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:Number.MIN_VALUE,zone:0,bars:[],maxVolumeIndex:-1,firstDate:e,lastDate:t}}findExtremes(e,t,i,s,n,r){const o=te(n)&&te(r);for(let a=t;a<=i;a++)if(o){const t=n[a];t>e.max&&(e.max=t);const i=r[a];i<e.min&&(e.min=i)}else{const t=s[a];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;const t=O(e.bars.map(e=>e.totalVolume))*this.valueRangePercent;let i=e.bars[e.maxVolumeIndex].totalVolume,s=e.maxVolumeIndex,n=e.maxVolumeIndex;for(;i<t;){const r=[{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:n+1,endIdx:n+2},{dir:"upper",count:1,startIdx:n+1,endIdx:n+1}].filter(t=>t.startIdx>=0&&t.endIdx<e.bars.length).map(t=>{const s=O(e.bars.slice(t.startIdx,t.endIdx+1).map(e=>e.totalVolume));return{...t,volume:s,newTotal:i+s}});if(0===r.length)break;const o=(e,t)=>t.newTotal<e.newTotal?t:e,a=(e,t)=>t.volume>e.volume?t:e,l=r.filter(e=>e.newTotal>=t),c=l.length>0?l.reduce(o):r.reduce(a);for(let t=c.startIdx;t<=c.endIdx;t++)e.bars[t].isValue=!0;if("lower"===c.dir?s=c.startIdx:n=c.endIdx,i=c.newTotal,i>=t)break}}tallyVolume(e,t,i,s,n,r,o){let a=Number.MIN_VALUE,l=!1;for(let c=t;c<=i;c++){const t=n[c],i=this.getBarIndex(e,t,!0);if(-1===i){l=!0;break}const u=o[c],h=this.useChange?r[c]>=0:s[c]<=n[c],d=e.bars[i];h?d.upVolume+=u:d.downVolume+=u,d.totalVolume=d.downVolume+d.upVolume,d.totalVolume>a&&(a=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){const i=this.makeBox(e,t),s=this.studySeries.innCont(1),n=s?.getTimeData();if(!ie(n))return null;const r=e=>G(n,+e,Number);let o=r(e),l=r(t);if(n[l].getTime()>t.getTime()&&(l-=1),o>l)return null;if(this.axis.pane.presenter.data.aggregation.unit===a.Day&&"Bars"===this.periodType){const e=s.getData(Ka.TradingDay);let t=e[o];for(;t===e[o]&&o>0;)o-=1;o+=1;let i=0;for(l=o;l<n.length&&i<this.period;)e[l]!==t&&(i+=1,t=e[l]),l+=1;l-=2}this.isVisibleScreen&&this.usesFinerGrainedAgg&&o<1e3&&this.studySeries.loadMoreData();const[c,u,h,d,p,f]=["Open","High","Low","Close","Change","Volume"].map(e=>{return t=Ka[e],s.getData(t);var t});this.findExtremes(i,o,l,d,u,h);const m=i.max-i.min,g=e=>({upVolume:0,downVolume:0,isValue:!1,totalVolume:0});if(this.isCountMode)i.zone=m/this.levelSize,i.bars=Y(this.levelSize,g);else{const e=(this.presenter.mainPlot?.metaData.minMovement??1)*this.levelSize,t=Math.max(1,Math.ceil(m/e));i.zone=m/t,i.bars=Y(t,g)}return this.tallyVolume(i,o,l,c,d,p,f),this.gotData=!0,i}}const kS=["None","Absolute","Percent"];class WS extends mA{studyPlotId;displayMode="None";visibleLabelSegments=[];constructor(e,t,i){super(e,t),this.studyPlotId=i}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get studySeries(){return this.studyPlot.timeSeries}setOptions(e){const t=e.ReversalChange;var i;this.displayMode="string"==typeof(i=t)&&kS.includes(i)?t:"None"}formatSegmentValue(e,t){return"Absolute"===this.displayMode?this.formatter.format(t-e,Ka.Close):"Percent"===this.displayMode?0===e?"":this.formatter.format((t-e)/e,Ka.PercentChange):""}getElements(){if(this.visibleLabelSegments=[],!this.studyPlot.visible||!this.studyPlot.mainCurve.visible)return[];const e=this.studySeries.getCurrentState();if(!e)return[];const t=e.confirmedPivots,i=Array.from(t.keys()).sort((e,t)=>e-t);if(0===i.length)return[];const s=this.presenter.mainPlot?.timeSeries?.container;if(!s||s.size<2)return[];const n=s.getTimeData();if(!n)return[];const r=this.presenter.view,[o,a]=r.xAxis.xScale.domain()||[];if(!o||!a)return[];const l=o.getTime(),c=a.getTime();let u=-1,h=-1;for(let p=0;p<i.length;p++){const e=n[i[p]].getTime();if(-1===u&&e>=l&&(u=Math.max(0,p-1)),e<=c)h=p;else if(-1!==u)break}if(-1===u){if(i.length>0&&n[i[0]].getTime()>c)return[];u=i.length-1,h=i.length-1}else-1===h&&(h=u);h=Math.min(i.length-1,h+1);const d=[];for(let p=u;p<h;p++){const e=i[p],s=i[p+1],o=t.get(e),a=t.get(s),u=r.toX(n[e]),h=this.axis.toY(o),f=r.toX(n[s]),m=this.axis.toY(a);d.push(this.makeLine({x:u,y:h},{x:f,y:m}));const g=n[s].getTime();g>=l&&g<=c&&this.visibleLabelSegments.push({fromPrice:o,toPrice:a,toPoint:{x:f,y:m}})}if(ie(e.pivotPrice)&&ie(e.candPrice)){const t=n[e.pivotIndex].getTime();if(n[e.candIndex].getTime()>=l&&t<=c){const t=r.toX(n[e.pivotIndex]),i=this.axis.toY(e.pivotPrice),s=r.toX(n[e.candIndex]),o=this.axis.toY(e.candPrice);d.push(this.makeLine({x:t,y:i},{x:s,y:o}))}}return d}adornElements(e,t){if("None"===this.displayMode||0===this.visibleLabelSegments.length)return;const i=Math.abs(Nn(t,!0));this.visibleLabelSegments.forEach(e=>{const s=this.formatSegmentValue(e.fromPrice,e.toPrice);if(""===s)return;const n=e.toPrice>=e.fromPrice,r={x:e.toPoint.x,y:e.toPoint.y+(n?-i:i)};Bn(t,s,r,g.Right,n?"#16A34A":"#DC2626")})}}const US=[gs.AT_LINE,gs.AT_LINE_2,gs.AT_LINE_3];class $S extends mA{studyPlotId;constructor(e,t,i){super(e,t),this.studyPlotId=i}get studyPlot(){return this.presenter.allPlots.find(e=>e.id===this.studyPlotId)}get studySeries(){return this.studyPlot.timeSeries}isCurveVisible(e){return this.studyPlot.curves[e]?.visible??!1}makeLines(){if(!this.studyPlot?.visible)return null;const e=this.studySeries.getCurrentState();if(!e||null===e.slope||null===e.intercept||null===e.stdDevWidth)return null;const{startIndex:t,endIndex:i,slope:s,intercept:n,stdDevWidth:r,extendLeft:o,extendRight:a}=e;if(null===t||null===i)return null;const l=this.presenter.mainPlot?.timeSeries?.container;if(!l||l.size<2)return null;const c=l.getTimeData();if(!c||c.length<=i)return null;const u=this.presenter.view,h=i-t+1,d=e=>n+s*(e+1),p=d(0),f=d(h-1),m=u.toX(c[t]),g=u.toX(c[i]),y=(e,t)=>{const i=this.axis.toY(p+e),s=this.axis.toY(f+e),n=new pA({x:m,y:i},{x:g,y:s},o,a,this.axis);return n._data={lineIndex:t},n};return[y(r,0),y(0,1),y(-r,2)]}getStyleForElement(e,t){const i=e._data?.lineIndex??t,s=US[i],n=this.traits[s];return n?rr({line:n,fill:{color:gs.COLOR_TRANSPARENT}}):super.getStyleForElement(e,t)}getElements(){const e=this.makeLines();return e?e.filter((e,t)=>this.isCurveVisible(t)):[]}adornElements(e,t){const i=this.makeLines();if(!i)return;if(!i.every(e=>ie(e.p1,e.p2)))return;const[s,n,r]=i,o=(e,i,s)=>{t.fillStyle=s,t.fill(HS(e,i))};this.isCurveVisible(3)&&o(s,n,this.traits?.[gs.AT_FILL]?.color),this.isCurveVisible(4)&&o(n,r,this.traits?.[gs.AT_FILL2]?.color)}}function GS(e){const t=e<0?-1:1,i=Math.abs(e)/Math.SQRT2,s=1/(1+.3275911*i);return.5*(1+t*(1-((((1.061405429*s-1.453152027)*s+1.421413741)*s-.284496736)*s+.254829592)*s*Math.exp(-i*i)))}class zS extends mA{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(){const e=this.lineOnlyStyle(gs.AT_LINE),t=this.lineOnlyStyle(gs.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?1:0)+(0!==this.targetPrice2?1:0),this.pricesCount>1&&this.targetPrice1<this.targetPrice2){const 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 te(this.mainCont)&&!this.mainCont.isEmpty&&this.studySeries.haveVolatility}get studySeries(){return this.studyPlot.timeSeries}getData(){const e=this.presenter.timeline;this.targetDate=e.at(e.lastSeriesIndex+this.periodTarget),this.points=[new aA(this.axis,this.targetPrice,this.targetDate)],this.pricesCount>1&&this.points.push(new aA(this.axis,this.targetPrice2,this.targetDate)),this.unitsPerYear=Ry(this.presenter.data.aggregation),this.anchorPrice=this.mainCont.getLastDataPoint(Ka.Close),this.sigmaAnnualized=this.studySeries.getVolatilityPercent()}computeProbabilities(){const e=this.sigmaAnnualized*Math.sqrt(this.periodTarget/this.unitsPerYear),t=t=>(t-this.anchorPrice)/(this.anchorPrice*e),i=GS(t(this.targetPrice));if(this.pricesCount>1){const e=GS(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[];const e=[];return e.push(new oA(this.points[0].point,!0,this.axis)),e.push(new oA(this.points[0].point,!1,this.axis)),this.pricesCount>1&&e.push(new oA(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[];const 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){const[e,i]=[!0,!1].map(e=>Math.abs(Nn(t,e))),s=this.pricesCount>1,n=this.points[0].point,r=s?this.points[1].point:n,o=this.traits.line2.color,a=Ln(o),l=Rn(t),c=["Above","Below","Between"],u=(e,t)=>`${se(100*e,2).toFixed(2)}% Probability ${c[t]}`,h=(e,i)=>Bn(t,e,i,g.Right,a,o);if(h(u(this.probabilityAbove,0),{x:n.x-10,y:n.y-e}),s){const e=n.y+(r.y-n.y+l)/2;h(u(this.probabilityBetween,2),{x:n.x-10,y:e})}h(u(this.probabilityBelow,1),{x:r.x-10,y:r.y+i})}}}const YS=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=Q(qa.CH_ZOOMCHANGED,1e3)}startTouchCrosshairMode(e,t,i){this.touchCrosshairMode=!0,this.showCrosshairAndTooltips(e.view,t,i)}activated(){}deactivated(){}findHit(e){if(!e.point)return[];if(e.axis.pane.axes.some(t=>t.plots.some(t=>t.hitTestCustomEvent(e.point))))return gs.EVENT_PIN_HIT;const t=e.presenter.selectedAnnotation;let i;void 0!==t&&(i=t.points.find(t=>t.hitTest(e.point)));let s=k(e.axis.annotations.filter(t=>t.computed?null:t.hitTest(e.point)));return void 0!==i&&null==s&&(s=t),[s,i]}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}){const n=s.xAxis.viewBox.contains(t);let r=!1;if(ie(e))this.resetVerticalAxis(e),r=!0;else if(n)this.resetHorizontalAxis(i),r=!0;else if(q()){const e=i.selectedAnnotation;null!=e?qA(e,t):XA(i,t)}r&&s.redraw()}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!q())return null;const e=/* @__PURE__ */(new Date).getTime(),t=ie(this.previousTouchTimestamp)?e-this.previousTouchTimestamp:null;return this.previousTouchTimestamp=e,t}onMouseDown(e){const{point:t,button:i,splitter:s,offset:n,priceAxis:r,presenter:o,originalEvent:a}=e,l=window.navigator.platform.toLowerCase().startsWith("mac"),c=l?S.Meta:S.Control,u=i===A.Right||l&&i===A.Left&&e.getModifier(S.Control);this.touchCrosshairMode&&ie(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);const h=this.computePreviousTouchStartDuration();if(ie(h)&&h<gs.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(e),!0;if(!u&&this.isLogoLink(n)&&o.notifyHost(qa.CH_LOGOCLICKED,{chart:o.accessor}),ie(t)&&o.allPlots.some(e=>e.tryHandleCustomEventClick(t.point)))return!0;if(ie(s))return this.resizingPanes=!0,this.lastResizingOffset=n,this.splitter=s,o.enableTooltip(!1),!0;if(ie(r)){return re(o.display.chart.zooming)[0]&&this.startAxisScaling(r,n),!0}if(null!=t){if(e.getModifier(c))return o.activeTool=new KA,o.activeTool.onMouseDown(e),!0;const[i,s]=this.findHit(t);if(o.clearSelection(),null!=i&&o.setSelection(i),null==i||i?.locked)return u?(this.hideCrosshairAndTooltips(o.view),null==i?XA(o,n,a):i?.locked&&qA(i,n),!0):!!this.touchCrosshairMode||(o.activeTool=new $A(t),o.activeTool.startPan(n),UA());const r=null!=s;if(u)return qA(i,n),q();{if(r&&!s.movable||!r&&!i.canMove(t.point))return!1;const e=r&&-1!==i.points.indexOf(s);return o.activeTool=e?new rA(i,s):new nA(i,t,n),q()}}return this.prevZoomingOffset=n,!1}onContextMenu(e){return!0}isLogoLink(e){const t=te(GA)&&GA.logoClickable?GA.rect:null;return ie(t)&&t.contains(e)}onMouseMove(e){const{point:t,splitter:i,priceAxis:s,view:n,presenter:r,offset:o}=e;if(ie(e.pinchZoom)&&e.pinchZoom&&ie(e.pinchDistance))return ie(this.prevPinchDistance)&&(e.delta=this.prevPinchDistance-e.pinchDistance,this.onWheel(e)),this.prevPinchDistance=e.pinchDistance,q();if(null!=i||this.resizingPanes)n.setCursor(y.ResizeVertical),this.resizingPanes&&this.resizePanes(n,o);else if(ie(t)){const[e,i]=this.findHit(t);ie(i)?t.presenter.view.setCursor(y.Crosshair):ie(e)?e.isSelected?t.presenter.view.setCursor(y.Move):t.presenter.view.setCursor(y.Hand):t.presenter.view.setCursor(y.Arrow)}else if(ie(s)){re(r.display.chart.zooming)[0]&&(n.setCursor(y.ResizeVertical),this.performAxisScaling(n,s,o))}else{if(this.prevZoomingOffset){const{x:e}=this.prevZoomingOffset,{x:t}=o,i=e-t;this.applyZoom(n.presenter,-i),this.prevZoomingOffset=o}n.setCursor(y.ResizeHorizontal)}return!t||this.resizingPanes?(this.hideCrosshairAndTooltips(n),q()):(this.isLogoLink(o)&&n.setCursor(y.Hand),this.showCrosshairAndTooltips(n,t,o),q())}showCrosshairAndTooltips(e,t,i){if(t.time&&(!q()||this.touchCrosshairMode)){e.drawCrosshair({ap:t,offset:i})&&e.presenter.showTooltip&&BA(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&&HA(e.presenter)}onMouseLeave(e){const{view:t,offset:i}=e,s=t.presenter.accessor.getPaneBounds(),n=s?.every(e=>{return!e.contains(i)||(t=e,(s=i).x===t.x||s.x===t.x+t.width||s.y===t.y||s.y===t.y+t.height);var t,s});n&&(this.hideCrosshairAndTooltips(t,!0),this.stopResizeZoom(t.presenter)),t.setCursor(y.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),q()){const t=function(){const e=Gv().config.touchCrosshairTimeoutMillis;return ie(e)&&Number.isFinite(e)?e:gs.LONG_PRESS_TIMEOUT_MILLIS}();this.touchCrosshairTimeout=window.setTimeout(()=>{this.hideCrosshairAndTooltips(e.view,!0),this.touchCrosshairMode=!1},t)}}applyZoom(e,t,i=!0){if(!re(e.display.chart.zooming)[1])return;const s=Math.sign(t)*(q()?2:10),n=e.view;n.xAxis.zoom(s)&&(n.setPriceAxesDomains(),n.redraw(),i&&this.fireZoomChanged(e))}onWheel({view:e,presenter:t,getModifier:i,delta:s}){const{scrollBehavior:n}=t.display;return!(!(q()?"none"!==n:"wheel"===n||"wheel+shift"===n&&i(S.Shift))||0===s)&&(e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(),this.applyZoom(t,s),!0)}get useKeyboardShortcuts(){return Gv().config.hostingModel!==b[b.Application]}onKeyDown(e){const{key:t,code:i,presenter:s}=e;if(ie(s.selectedAnnotation)&&function(e,t){return"Backspace"===e||"Delete"===e||8===t||46===t}(t,i)){const e=s.selectedAnnotation;e.axis.deleteAnnotation(e),s.onAnnotationModifiedByTool(e,E.Deleted)}if(ie(s.selectedAnnotation)&&(X(t,i)?s.clearSelection():function(e,t){return"F2"===e||113===t}(t,i)&&s.selectedAnnotation instanceof CA&&s.selectedAnnotation.textEditable&&(s.activeTool=new xA(null,s.selectedAnnotation),s.activeTool.startEditing())),Z(t,i)||function(e,t){return"ArrowRight"===e||39===t}(t,i)){const e=Z(t,i)?1:-1,n=s.view;n.xAxis.pan(e*n.xAxis.xScale.bar.totalWidth),this.hideCrosshairAndTooltips(n),n.redraw()}const n=window.navigator.platform.toLowerCase().startsWith("mac")?S.Meta:S.Control;if(e.getModifier(n)&&this.useKeyboardShortcuts){const e=function(e,t){return"z"===e||90===t}(t,i),n=function(e,t){return"y"===e||89===t}(t,i);return e&&s.undoRedoManager.undo(),n&&s.undoRedoManager.redo(),e||n}(function(e,t){return"r"===e||82===t})(t,i)&&e.getModifier(S.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){const i=t.y-this.lastResizingOffset.y;if(0===i)return;const s=e.presenter.panes,[n,r]=this.splitter,o=s.map((e,t)=>{const s=e.getBounds().height;return t===n?s+i:t===r?s-i:s});if(o.some(e=>e<gs.MINIMUM_PANE_HEIGHT))return;const a=(e,t)=>e+t,l=o.reduce(a,0),c=s.map(e=>e.height).reduce(a,0);s.forEach((e,t)=>e.height=se(o[t]/l*c,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){const s=q()?4:5,n=function(e,t,i,s=1,n=-1){const r=(i.y-t.y)/10,o=e.yScale.rangeWithPadding().reverse();return[o[0]+r*s,o[1]+r*n].map(t=>e.yScale.yToPrice(t))}(t,this.lastScaleResizingOffset,i,s,-s);this.lastScaleResizingOffset=i,t.isCustomDomain=!0,t.yScale.domain(n),e.redraw()}}},jS=e=>QS(ZA,CS,1,e),KS=e=>QS(ZA,bA,1,e),qS={Default:()=>function(){return YS},Line:()=>QS(LA,sS,!1),DateRange:()=>QS(LA,IS,!1),PriceRange:()=>QS(LA,DS,!1),DatePriceRange:()=>QS(LA,OS,!1),GannBox:()=>QS(LA,wS,!1),GannSquare:()=>QS(_A,VS),Ray:()=>QS(LA,sS,!1),GannLine:()=>QS(MA,sS,!1),VerticalLine:()=>QS(ZA,nS,1),HorizontalLine:()=>QS(ZA,rS,1),LongPosition:()=>QS(ZA,_S,1,!0),ShortPosition:()=>QS(ZA,_S,1,!1),FiftyPercentLine:function(e,t){return ie(e)?QS(JA,oS,e.axis||t.mainAxis,e):QS(ZA,oS,2)},FibonacciRetracement:()=>QS(LA,lS,!1),TrendBasedFibExtension:()=>QS(LA,cS,!0),FibonacciFan:()=>QS(LA,dS,!1),FibonacciArcs:()=>QS(LA,gS,!1),FibonacciChannel:()=>QS(LA,BS,!0),GannFan:()=>QS(LA,yS,!1),SpeedResistanceFan:()=>QS(LA,AS,!1),SpeedResistanceArcs:()=>QS(LA,SS,!1),AndrewsPitchfork:()=>QS(ZA,TS,3),Rectangle:()=>QS(LA,zA,!1),Ellipse:()=>QS(LA,vS,!1),TrendChannel:()=>QS(LA,PS,!0),SymbolArrowUp:()=>jS("arrow_up"),SymbolArrowDown:()=>jS("arrow_down"),SymbolArrowRight:()=>jS("arrow_right"),SymbolArrowLeft:()=>jS("arrow_left"),SymbolArrowHorizontal:()=>jS("arrow_horizontal"),SymbolArrowVertical:()=>jS("arrow_vertical"),SymbolArcDown:()=>jS("arc_down"),SymbolArcUp:()=>jS("arc_up"),SymbolThumbsUp:()=>jS("thumbs_up"),SymbolThumbsDown:()=>jS("thumbs_down"),SymbolZero:()=>jS("zero"),SymbolOne:()=>jS("one"),SymbolTwo:()=>jS("two"),SymbolThree:()=>jS("three"),SymbolFour:()=>jS("four"),SymbolFive:()=>jS("five"),SymbolSix:()=>jS("six"),SymbolSeven:()=>jS("seven"),SymbolEight:()=>jS("eight"),SymbolNine:()=>jS("nine"),SymbolQuestion:()=>jS("question"),SymbolFishHook:()=>jS("fish_hook"),SymbolBuy:()=>jS("buy"),SymbolSell:()=>jS("sell"),FibonacciTimeZones:()=>QS(LA,bS,!1),Text:()=>QS(xA,CA,null),PickPoint:()=>function(){return new ES},ZoomIn:()=>function(){return new KA},ProfitLoss:KS,RewardRisk:KS,VolumeAtPrice:function(e){return QS(ZA,FS,2,e)},ZigZag:function(e){return QS(JA,WS,null,e)},ProbabilityCones:function(e){return QS(ZA,zS,2,e)},LinearRegressionChannel:function(e){return QS(JA,$S,null,e)}};function XS(e,t=!1,i=null,s=null,n=null){let r=qS[e];return r=r(s,n),r(e,t,i)}function ZS(e,t={}){e.enableTooltip(!0),e.resetActiveTool();const{axis:i,annotation:s,toolChange:n,annId:r}=t;ie(i)&&e.onAnnotationsUpdated(i),ie(s)&&e.onAnnotationModifiedByTool(s,n),[E.Cancelled,E.Executed,E.TextChanged].includes(n)&&e.onAnnotationDone(r,n)}function JS(e,t=!0,i=E.None){e.wasModifiedByTool();const s=e.axis,n={axis:s,annotation:e,toolChange:i};ZS(s.pane.presenter,t?n:void 0)}function QS(e,t,i,s){return function(n,r,o){const a=dA(n,t,s,o);return a.annName=n,r?a:new e(a,i)}}function eT(e){e.button===A.Right&&ZS(e.presenter)}function tT(e,t,i){const s={};s.source=Ka[e.source],s.inputs=fe(e.inputs);const n=void 0!==e.target,r=ie(i)?i:e.curves,o=n?[Ka[e.target]]:r.map(e=>e.fields).flat();return s.outFields=function(e){const t=[];for(const i of e)t.includes(i)||t.push(i);return t}(o),s.target=n?Ka[e.target]:s.outFields[0],s.aggregation=t,s}class iT extends Qy{model;basePlot;_hasEvents;_params;_shiftFmt;_title;range;shouldMaybePriceMap;annIndex;_canPriceMap;#e(e=3){let t=this.model.inputs||[];const i=t.length;if(0===i)return"";let s="";i>e&&(t=t.slice(0,3),s=", ...");const n="AVWAP"===this.model.study;return 0===t.length?"":`(${t.map(e=>n&&"Anchor"===e.name?new Date(e.value).toLocaleString():e.value).join(", ")}${s})`}get params(){return ie(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(!ie(this._shiftFmt)){const 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(!ie(this._title)){const 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(){const e=Ur(this.model.study),t=e.meta.decimals;this.metaData=void 0!==t?new Qs(t):this.basePlot.metaData,ie(e.meta.range)&&(this.range=e.meta.range)}getDetachedScaleMargins(){const e=this.model?.study;return"VOL"===e&&this.axis?.pane.isMain?gs.VOLUME_DETACHED_SCALE_MARGINS:super.getDetachedScaleMargins()}applySpecifics(e){const t=this.model.study;!0===Ur(t).meta.shiftable&&this.curves.forEach(t=>{Number.isFinite(e.inputs.Offset)&&(t.shift=e.inputs.Offset)});const i=(e,t,i)=>this.curves[e].zones[t].value=this.model.levels[i].value;switch(t){case"ICHCLD":{const 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":{const t=Math.min(Math.max(0,e.inputs.Count),10);this.curves.forEach((e,i)=>e.visible=e.visible&&i<t);break}case"CRS":{const t="PercentChange"===e.inputs.Display;this.axis.comparison=t?d.Percent:d.None;break}case"PERF":{const t="VisibleStart"===e.inputs.Anchor;this.axis.comparison=t?d.Percent:d.None;break}case"JPI":case"CTTP":case"CTTI":{const t=Y(10,e=>.025*(e+1)),i=e=>t.map(t=>Cn(t)(e)),s=([e,t])=>[...i(e).reverse(),t,"#6a4a3a","#a000c8","#ffffff"];this.curves[0].colors=s(this.curves[0].colors),this.curves[1].colors=s(this.curves[1].colors);const n=this.curves[0].colors.length;this.curves[0].colors[n-1]=this.curves[1].colors[t.length],this.curves[1].colors[n-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,ie(this.annotations)||(this.annotations=[]);const t=this.curves[1],i=this.curves[2],s=XS("VolumeAtPrice",!0,{[gs.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[gs.AT_FILL]:{color:this.curves[0].colors[0]},[gs.AT_FILL2]:{color:this.curves[0].colors[1]},[gs.AT_FILL3]:{color:this.curves[0].colors[2]},[gs.AT_FILL4]:{color:i.colors[0]},[gs.AT_FILL5]:{color:i.colors[1]},[gs.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,ie(this.annotations)||(this.annotations=[]);const t=this.curves[1],i=this.curves[2],s=this.curves[3],n=XS("VolumeAtPrice",!0,{[gs.AT_LINE]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle},[gs.AT_FILL]:{color:this.curves[0].colors[0]},[gs.AT_FILL2]:{color:this.curves[0].colors[1]},[gs.AT_FILL3]:{color:this.curves[0].colors[2]},[gs.AT_FILL4]:{color:i.colors[0]},[gs.AT_FILL5]:{color:i.colors[1]},[gs.AT_FILL6]:{color:i.colors[2]},[gs.AT_FILL7]:{color:s.colors[0]}},this.id)(this.axis,!1);n.setOptions(e.inputs),this.annIndex=this.annotations.push(n)-1;break}case"ZIGZAG":{this.customPlotValues=!0,ie(this.annotations)||(this.annotations=[]);const t=XS("ZigZag",!0,{[gs.AT_LINE]:{color:this.curves[0].colors[0],width:this.curves[0].lineWidth,dashStyle:this.curves[0].dashStyle??"Solid"}},this.id)(this.axis,!1);t.setOptions(e.inputs),this.annIndex=this.annotations.push(t)-1;break}case"LINRCHN":{this.customPlotValues=!0,ie(this.annotations)||(this.annotations=[]);const e=this.curves[0],t=this.curves[1],i=this.curves[2],s=this.curves[3],n=this.curves[4],r=XS("LinearRegressionChannel",!0,{[gs.AT_LINE]:{color:e.colors[0],width:e.lineWidth,dashStyle:e.dashStyle??"Solid"},[gs.AT_LINE_2]:{color:t.colors[0],width:t.lineWidth,dashStyle:t.dashStyle??"Solid"},[gs.AT_LINE_3]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle??"Solid"},[gs.AT_FILL]:{color:s.colors[0]},[gs.AT_FILL2]:{color:n.colors[0]}},this.id)(this.axis,!1);this.annIndex=this.annotations.push(r)-1;break}case"IVRANK":{let t=Ka.ImplVolRank1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=Ka.ImplVolRank5D;break;case"1-Month":t=Ka.ImplVolRank1M;break;case"3-Month":t=Ka.ImplVolRank3M;break;case"6-Month":t=Ka.ImplVolRank6M;break;case"YTD":t=Ka.ImplVolRankYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"IVPCTL":{let t=Ka.ImplVolPerc1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=Ka.ImplVolPerc5D;break;case"1-Month":t=Ka.ImplVolPerc1M;break;case"3-Month":t=Ka.ImplVolPerc3M;break;case"6-Month":t=Ka.ImplVolPerc6M;break;case"YTD":t=Ka.ImplVolPercYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"OPTIV":{let t=[Ka.WeighImplVolHigh,Ka.WeighImplVol,Ka.WeighImplVolLow];switch(e.inputs.TimeFrame){case"1-Day":default:break;case"5-Day":t=[Ka.WeighImplVolHigh5D,Ka.WeighImplVol5D,Ka.WeighImplVolLow5D];break;case"1-Month":t=[Ka.WeighImplVolHigh1M,Ka.WeighImplVol1M,Ka.WeighImplVolLow1M];break;case"3-Month":t=[Ka.WeighImplVolHigh3M,Ka.WeighImplVol3M,Ka.WeighImplVolLow3M];break;case"6-Month":t=[Ka.WeighImplVolHigh6M,Ka.WeighImplVol6M,Ka.WeighImplVolLow6M];break;case"1-Year":t=[Ka.WeighImplVolHigh1Y,Ka.WeighImplVol1Y,Ka.WeighImplVolLow1Y];break;case"YTD":t=[Ka.WeighImplVolHighYTD,Ka.WeighImplVolYTD,Ka.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":{const t=e.inputs.PeriodForecast-1;this.curves.forEach(e=>e.shift=t),ie(this.annotations)||(this.annotations=[]);const i=this.curves[11],s=this.curves[12],n=XS("ProbabilityCones",!0,{[gs.AT_LINE]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle},[gs.AT_LINE_2]:{color:s.colors[0],width:s.lineWidth,dashStyle:s.dashStyle}},this.id)(this.axis,!1);n.setOptions(e.inputs),this.annIndex=this.annotations.push(n)-1;break}}}getValueAt(e,t,i){if(!this.isVolAP)return super.getValueAt(e,t,i);return this.annotations[this.annIndex].getValueAt(e,t,i)}getColorOf(e){if(!this.isVolAP&&!this.isZigZag&&!this.isLinRegChannel)return null;const t=this.curves[0].colors;if(this.isZigZag)return t[0];switch(e){case Ka.UPVOL:return t[1];case Ka.DNVOL:return t[0];case Ka.TOTVOL:return t[2];case Ka.POC:case Ka.VAREA:case Ka.BARBACK:return gs.COLOR_TRANSPARENT;case Ka.LINRUP:return t[0];case Ka.LINRMID:return this.curves[1].colors[0];case Ka.LINRLOW:return this.curves[2].colors[0];default:throw new Error("Unexpected Volume At Price field")}}isEmpty(){return!(this.isVolAP||this.isZigZag||this.isLinRegChannel)&&super.isEmpty()}setCurveAttributes(e,t){const i=t=>this.curves[e].attributes=[r[t]];switch(t){case"LikeMain":{const t=this.axis.pane.presenter.mainPlot.curves[0].attributes,s=Gv().config.defaultVolumeBarColoring;if(ie(t))this.curves[e].attributes=[t[0]];else if(ie(s)){i("OpenToClose"===s?"OpenVsClose":"ChangeBased")}else i("OpenVsClose");break}case"OpenToClose":i("OpenVsClose");break;case"CloseToClose":i("ChangeBased");break;default:throw new Error(`Unexpected bar coloring choice: ${t}`)}}get hasEvents(){return this._hasEvents}get eventsSeries(){return this.timeSeries}doesSeriesEmitEvents(){const e=this.timeSeries.helpers;return e.includes(Ka.Buy)||e.includes(Ka.Sell)}getEventFor(e){switch(e){case Ka.Buy:return{show:!0,title:"B",color:"#03c03c"};case Ka.Sell:return{show:!0,title:"S",color:"#c23b22"};default:return null}}getEventFields(){return this.hasEvents?[Ka.Buy,Ka.Sell]:[]}async initialize(){if(this.model.basis!==gs.BASIS_MAIN)throw new Error("Studies can currently only be based on the main (symbol) plot");return ps.call(this,async()=>{this.basePlot=this.axis.pane.presenter.mainPlot,await this.basePlot.initialize(),this.getMetaData();const e=this.axis.pane.presenter.data.aggregation,t=tT(this.model,e,this.curves);this.applySpecifics(t);let i=this.basePlot.timeSeries;i instanceof dp&&(i=i.actual),this.timeSeries=ny(this.model.study,t,i),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;const s=this.title,n=this.basePlot.timeSeries instanceof bh;return this.timeSeries.ready().then(e=>{e||n||this.timeSeries.computedServerSide||Hv(`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}get isZigZag(){return"ZIGZAG"===this.model.study}get isLinRegChannel(){return"LINRCHN"===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===Ka.JPIB.id||e.id===Ka.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;const s=(e,t)=>this.timeSeries.container.getData(e)[t],n=s(Ka.JPIB,t),r=s(Ka.JPIS,t);if(null===n&&i.id===Ka.JPIB.id||null===r&&i.id===Ka.JPIS.id)return null;let o=0,a=this.visFromIndex;const l=this.timeSeries.helpers[0],c=this.timeSeries.helpers[2];for(;a<=t;){o+=1===s(c,a)?0:s(l,a),a++}return o}}const sT=[Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.Volume];class nT extends Qy{_expression;exprModel=null;symbols=null;errorText;get title(){return this.expression}get expression(){return this._expression}async parseExpression(){const e=ca(this._expression);if(this.exprModel=null,this.symbols=null,la(e))this.errorText=e.error;else{const{model:t,clean:i,symbols:s}=e;this.errorText=void 0,this.symbols=s,this.exprModel=t,this._expression=i}}get isValid(){return!ie(this.errorText)}#t(e){return{mapper:e=>e.query.symbol,loadMoreData:!0,recompute:i.Minimum,missing:t.UseNext,stretch:e=>!1,fieldMap:new Map(sT.map(e=>[e,e])),noDataApproach:s.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:e}}getTimeSeries(){const e=this.getInnerSeries(),t=this.axis?.pane.presenter.data?.exprSkipLeadingEmpty??!1,i=new Vm(this.exprModel,e,this.#t(t));this.timeSeries=this.wrapIfAdvancedStyle(i);const s=this.title;this.timeSeries.ready().then(e=>{e||Hv(`Unable to calculate expression: ${s}`,"error")})}getInnerSeries(){const e=pa(this.exprModel),t=Gv().getTimeSeriesDataSource();return e.map(e=>{const i=this.makeQuery();return i.symbol=e,t.getTimeSeries(i)})}getRecord(){if(ie(this.errorText))return;const e=this.metaData.inner.map(e=>[e.symbol,e.resolved]);this.record=new hl(e,ue(this.exprModel)),this.record.ready().then(e=>e)}getMetaData(){this.isValid&&(this.metaData=new tn(this.symbols),this.metaData.ready().then(e=>{e&&(this.getRecord(),this.presenter?.notifyHost(qa.MD_CHANGED,{plot:this}))}))}fromModel(e){super.fromModel(e),this._expression=e.expression}async initialize(){return ps.call(this,async()=>(await this.parseExpression(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}class rT extends Qy{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);const t=e;this.offset=t.offset,this._forward=t.forward}async parseForward(){const e=ca(this.forward),t=la(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=` (${x(mu(this.offset),fu(gs.FMT_US_DATE_ONLY))(/* @__PURE__ */new Date)})`,this.outField=new Ga(`Close_${this.offset}`,c.Number,h.Forward,`Close (${this.offset})`),this.curves[0].fields[0]=this.outField):(this.suffix="",this.outField=Ka.Close);const t=e=>Fi(`${e}*1`),{yes:i,no:s}=V(e.symbols,t),n=(await Promise.all(i.map(e=>Xi(e)))).map(e=>e.map(e=>e.name));this.roots=i.reduce((e,t,i)=>(e[t]=n[i],e),{}),this.symbols=s}}get isValid(){return!ie(this.errorText)}getMetaData(){if(this.isValid){const e=Object.values(this.roots).flat();this.metaData=new tn(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(qa.MD_CHANGED,{plot:this})})}}getForwardPolicy(e){return{mapper:e=>e.query.root,loadMoreData:!1,recompute:i.Everything,missing:t.UseNext,stretch:e=>!1,fieldMap:/* @__PURE__ */new Map([[Ka.Close,this.outField]]),noDataApproach:s.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1,valueProvider:e}}getTimeSeries(){const e=Gv().getTimeSeriesDataSource(),t=Object.keys(this.roots),i=0===this.offset?m.Forward:m.HistoricalForward,s=t.map(t=>{const s={seriesKind:i,root:t,offset:this.offset,symbols:this.roots[t],getHashKey:()=>`${i}|${t}|${this.offset}`};return e.getTimeSeries(s)}),n=this.symbols.length>0?new Ih(this.symbols):void 0;this.timeSeries=new Vm(this.fwdModel,s,this.getForwardPolicy(n)),this.timeSeries.ready().then(e=>{if(e){const e={series:this.timeSeries,part:P.Unspecified};this.presenter?.notifyHost(qa.TS_MANYCHANGED,e)}})}async initialize(){return ps.call(this,async()=>(await this.parseForward(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}const oT=e=>e.substring(0,e.lastIndexOf("::"));class aT extends Qy{isAverage;hasComputation;offset;offsets;_seasonal;symbolToOffset;errorText;seaModel=null;isPlain=!1;isFutures=!1;suffix="";outField;symbols;coreModel;coreHasComputation;refSeasonal;get title(){if(this.isAverage){let e="YB ";return this.offset<-1&&(e=`${Math.abs(this.offset)}y `),`${e}Average`}return!this.hasComputation&&(this.symbols?.length??0)>0?this.outField.name:`${this.seasonal}${this.suffix}`}get seasonal(){return this._seasonal}fromModel(e){super.fromModel(e);const t=e;this.offset=t.offset,this.offsets=t.offsets,this.isAverage=t.offset<0,this._seasonal=this.refSeasonal=t.seasonal}constructSeasonal(e,t){return da(ma(e,e=>this.applyOffset(e,t)))}constructAverage(e,t=null){const i=null===t?null:t.map(e=>this.symbolToOffset[e]),s=null===i,n=this.offsets.filter(e=>!!s||i.includes(e)).map(t=>`(${this.constructSeasonal(e,t)})`);return`(${n.join("+")})/${n.length}`}prepareFields(){const e=this.isPlain?`${this.yearFromOffset(this.offset)}`:`${this.offset}Y`,t=this.isAverage?"Avg":e;this.suffix=0===this.offset?"":` (${t})`,this.outField=new Ga(`Close_${t}`,c.Number,h.Seasonal,`Close${this.suffix}`),this.curves[0].fields[0]=this.outField}applyOffset(e,t){return`${this.isPlain?e:es(e,-t)}::${t}`}createSymbolToOffsetMapping(e){this.symbolToOffset={},e.forEach(e=>{this.offsets.forEach(t=>{this.symbolToOffset[this.applyOffset(e,t)]=t})})}async parseSeasonal(){const e=ca(this.seasonal,!0),t=e=>(this.errorText=e,this.seaModel=null,null);if(la(e))return t(e.error);let{model:i,symbols:s}=e;this.prepareFields();const n=/* @__PURE__ */new Map;for(const h of s){const e=Yi(await Hi(h));n.set(h,e)}i=ma(i,e=>n.get(e)),s=Array.from(n.values());const r=s.every(e=>Fi(e)||Wi(e)),o=s.every(e=>$i(e)),a=s.every(e=>!Fi(e)&&!$i(e)&&!Wi(e));if(!r&&!o&&!a)return t("Mixed types of symbols aren't supported yet");this.isPlain=a,this.isFutures=r,this.createSymbolToOffsetMapping(s),this.coreModel=this.isAverage?i:null,this.coreHasComputation=fa(i);const l=this.isAverage?this.constructAverage(i):this.constructSeasonal(i,this.offset),{model:c,symbols:u}=ca(l,!0);this.seaModel=c,this.hasComputation=fa(c),this._seasonal=da(ma(c,oT)),this.symbols=u,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!ie(this.errorText)}getActualSymbols(){return[...new Set(this.symbols.map(oT))]}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){const e=oT(this.symbols[0]);if(this.isPlain)return`${e} ${/* @__PURE__ */(new Date).getFullYear()-this.offset}`;if(this.isFutures)return Yi(e,!0)}return this.title}getMetaData(){if(this.isValid){const e=this.getActualSymbols(),t=1===e.length&&!this.hasComputation&&!this.isAverage,i=Gv().getMetaDataSource();this.metaData=t?i.getMetaData(e[0]):new tn(e),this.metaData.ready().then(e=>{e&&this.presenter?.notifyHost(qa.MD_CHANGED,{plot:this})})}}getNoDataApproach(){return this.isAverage&&!this.coreHasComputation?s.ModelTransformRequired:this.hasComputation?s.NoAction:s.IgnoreTimelineOnly}get seasonalPolicy(){return{mapper:e=>e.query.surrogate||e.query.symbol,loadMoreData:!1,recompute:i.Everything,missing:this.hasComputation?t.UsePrevious:t.UseNone,stretch:e=>this.shouldStretch(e),fieldMap:/* @__PURE__ */new Map([[Ka.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(e,t)=>{if(0===t.length)return this.seaModel;return ca(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 lt(/* @__PURE__ */new Date,-e)}yearFromOffset(e){return Pi(this.shiftYears(e))}getCmdtyRange(e){const t=this.shiftYears(e);return[Mt(t),Lt(t)]}getTimeSeries(){if(!this.isValid)return;const e=Gv().getTimeSeriesDataSource(),t=Object.keys(this.symbolToOffset).map(t=>{const i=this.makeQuery();return i.surrogate=t,i.symbol=oT(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&&ie(...i.range)&&(i.range=i.range.map(e=>lt(e,-i.offset))),i.offset>0&&(i.disableStreamingUpdates=!0),e.getTimeSeries(i)});this.timeSeries=new Vm(this.seaModel,t,this.seasonalPolicy),this.timeSeries.ready().then(e=>{if(e){const e={series:this.timeSeries,part:P.Unspecified};this.presenter?.notifyHost(qa.TS_MANYCHANGED,e)}})}async initialize(){return ps.call(this,async()=>(await this.parseSeasonal(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0)))}}const lT=["bottom","right","left"],cT={bottom:"center",right:"start",left:"end"};class uT{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,n,r){const o=ie(n);if(r=r||this.fontSize+this.padding+this.padding+(o?this.padding:0),!lT.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=cT[this.position],e.strokeStyle=this.strokeColor,e.fillStyle=Sn(this.backgroundColor),e.lineWidth=this.lineWidth;const a=[s,n??""].map(t=>e.measureText(t).width),l=Math.max(...a),c="bottom"!==this.position?this.arrowLength:0,u=Math.round(l+c+this.padding+this.padding),h=Math.round(u/2),d=Math.round(r/2);e.setLineDash([]);const p=t;e.beginPath(),e.moveTo(p,i);const f=i+d,m=i+2*d,g=i-d;if("right"===this.position){e.lineTo(p,f);const t=p+u;o&&(e.lineTo(p,m),e.lineTo(t,m)),e.lineTo(t,f),e.lineTo(t,g),e.lineTo(p,g)}else if("left"===this.position){e.lineTo(p,f);const t=p-u;o&&(e.lineTo(p,m),e.lineTo(t,m)),e.lineTo(t,f),e.lineTo(t,g),e.lineTo(p,i-d)}else if("bottom"===this.position){const t=p-h,s=p+h;e.lineTo(p,i),e.lineTo(s,i),e.lineTo(s,i+r),e.lineTo(t,i+r),e.lineTo(t,i),e.lineTo(p,i)}if(e.closePath(),e.stroke(),e.fill(),e.fillStyle=this.textColor,e.textBaseline="middle","bottom"===this.position)e.fillText(s,p,i+Rn(e,1));else if("right"===this.position){const t=p+this.arrowLength+this.padding;e.fillText(s,t,i),o&&e.fillText(n,t,i+this.padding+d)}else if("left"===this.position){const t=p-this.arrowLength-this.padding;e.fillText(s,t,i),o&&e.fillText(n,t,i+this.padding+d)}}}const hT=({y:e,halfHeight:t})=>e+t;const dT=({x:e,halfWidth:t})=>e-t-4,pT=({x:e,halfWidth:t})=>e+t+4,fT=(e,t)=>e-1-t-4,mT=(e,t)=>e+1+t+4;const gT=Array.from(Array(6),(e,t)=>++t).reverse();function yT(e){const t=e.plot.timeSeries.container;return null===t||t.size<1?null:e.getColor(t.size-1)}function AT(e){return e.curves.filter(t=>e.visible&&t.visible&&(e.type!==f.Study||t.style!==o.Ribbon)).map(t=>{const i=t.pickMainField(),[s,n]=function(e,t){const i=e.timeSeries.container;if(null===i||i.size<1)return[null,-1];let s=i.getLastDataPoint(t);const n=i.getData(t);let r=n.length-1;const o=e.type===f.Study&&["JPI","CTTP","CTTI"].includes(e.model.study);return null!=s||o||(r=H(n,e=>null!==e),s=-1!==r?n[r]:null),[s,r]}(e,i);return{value:s,color:yT(t),field:i,index:n}})}class ST{constructor(e){this.pane=e,this.id=Pe(),this.ticks=null,this.lastUsedOptions=null;const{chart:{fontSize:t},yAxis:{fontSize:i}}=this.pane.presenter.display,s=i||t||12;this.config={innerTickSize:7,tickPadding:5,indicatorPadding:4,fontWeight:400,fontSize:s},this.crosshairIndicator=new uT({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}annotations=[];id;isCustomDomain=!1;primary=!1;onTheRight=!0;viewBox;plots=[];comparison;scale;yScale;label="";crosshairIndicator;ticks;lastUsedOptions;config;_fullDomain;makePlot(e){let t=null;switch(f[e.type]){case f.Symbol:t=new eA;break;case f.Expression:t=new nT;break;case f.Study:t=new iT;break;case f.IncomeStatement:t=new tA(m.IncomeStatement);break;case f.BalanceSheet:t=new tA(m.BalanceSheet);break;case f.Forward:t=new rT;break;case f.Seasonal:t=new aT;break;default:throw new Error(`${e.type} isn't supported yet`)}return t.axis=this,t.fromModel(e),t}toPrice(e){const t=this.yScale.yToPrice(e);return this.comparison!==d.None?this.pane.presenter.mainPlot.priceMap(t,void 0,Ka.Close,!0):t}toTime(e){return this.pane.presenter.view.toTime(e)}toAnnotationPoint(e){const t=this.toPrice(e.y),i=this.toTime(e.x);return new aA(this,t,i||void 0)}toX(e){return this.pane.presenter.view.toX(e)}priceMap(e){return this.comparison!==d.None?this.pane.presenter.mainPlot.priceMap(e,void 0,Ka.Close):e}toY(e){const t=this.priceMap(e);return this.yScale.priceToY(t)}get plotAnnotations(){const 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){const t={x:this.annTimeToX(e.time),y:this.toY(e.price)},i=this.pane.presenter,s=i.activeTool,n=s.annotation;return s.alignPointsMode&&n&&n.alignPointsSupported&&n.points.includes(e)?this.alignPoints(n,e,t):!s.snapToSupported||!i.display.yAxis.snapAnnotationsToPrices||e.passive||e.moveDirection!==T.Both&&e.moveDirection!==T.Vertical||this.snapToPrices(e,t),t}snapToPrices(e,t){const i=this.plots.find(e=>e.main);if(i&&i.timeSeries&&i.timeSeries.hasData){const s=i.timeSeries.container,n=G(s.getTimeData(),+e.time,Number),r=Array().concat(...i.curves.map(e=>e.fields)).filter(e=>s.hasField(e)).map(e=>{const i=s.getData(e)[n],r=this.toY(i);return{priceSnap:i,ySnap:r,dist:Math.abs(r-t.y)}}).filter(e=>e.dist<=gs.SNAP_PROXIMITY_PIXELS).reduce((e,t)=>null===e||t.dist<e.dist?t:e,null);ie(r)&&(e.price=r.priceSnap,t.y=r.ySnap,e.time=s.getTimeData()[n],t.x=this.toX(e.time))}}alignPoints(e,t,i){const s=e.points.find(e=>e!==t);if(t!==s&&s&&s.point){const e=s.point,n=(360+180*-gn(e,i)/Math.PI)%360,r=22.5,o=n>90-r&&n<90+r||n>270-r&&n<270+r;if(n>360-r||n<r||n>180-r&&n<180+r)i.y=e.y,t.price=this.toPrice(i.y);else if(o)i.x=e.x,t.time=this.toTime(i.x);else{const s=Math.abs(i.x-e.x),n=e.y>i.y?-1:1;i.y=e.y+s*n,t.price=this.toPrice(i.y)}}}toPoint(e){if(ie(this.pane.presenter.view))return this.snapTo(e)}makeAnnotation(e,t=!0){const i=XS(e.id,!0,e.traits)(this,!1);t&&e.uid&&(i.uid=e.uid);const s=i.activePoints,n=e.points.length-s.length;return n>0&&i.addPoints(n),i.activePoints.forEach((t,i)=>{const s=e.points[i];ne(s.price)&&ne(s.time)&&t.update(s.price,s.time)}),i.visible=e.visible,i.locked=e.locked,i}expand(e){const t=[];switch(e.type){case"Forward":{const i=e.curves,s=e.offsets;delete e.curves,delete e.offsets;for(let n=0;n<i.length;n++){const r=Object.assign({},e);r.curves=[i[n]],r.offset=s[n],t.push(r)}break}case"Seasonal":{const i=e.curves,s=e.offsets;delete e.curves,delete e.offsets;const n=s.filter(e=>e>=0);for(let r=0;r<i.length;r++){const o=Object.assign({},e);o.curves=[i[r]],o.offset=s[r];const a=o.offset<0;if(a){const e=-1===o.offset;o.offsets=e?n:Y(Math.abs(o.offset),e=>e+1)}else o.offsets=[o.offset];(!a||o.offsets.length>1)&&t.push(o)}break}default:t.push(e)}return t}fromModel(e){this.comparison=d[e.comparison??"None"],this.scale=p[e.scale??"Linear"],this.yScale=new Yy(this.scale,this),this.label=e.label,this.plots=Array().concat(...e.plots.map(e=>this.expand(e))).map(e=>this.makePlot(e));const t=e.annotations||[];this.annotations=t.map(e=>this.makeAnnotation(e));const{chart:{fontFamily:i,backgroundColor:s},yAxis:{textColor:n,crosshair:{color:r},primaryOnTheLeft:o}}=this.pane.presenter.display,a=o??!1;this.onTheRight=this.primary&&!a||!this.primary&&a,this.crosshairIndicator.configure({position:this.onTheRight?"right":"left",fontFamily:i,strokeColor:r,textColor:n,backgroundColor:Cn(.15)(s)})}findIndex(e){return this.annotations.findIndex(t=>t.uid===e.uid)}addAnnotation(e){const 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();const 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){const t=e.axis,i=this.makeAnnotation(e.toModel(),!1);i.drawPoints(null,!0),i.offset({x:gs.ANN_DUPLICATE_OFFSET,y:gs.ANN_DUPLICATE_OFFSET}),t.appendAnnotation(i),i.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(e,t){e.isSelected&&this.pane.presenter.clearSelection(),Co(e.name,t.traits),e.updateFrom(t.traits,t.extras,t.isUndoRedo?null:t.points,t.visible,t.locked),t.isUndoRedo&&ie(t.points)&&e.updateActivePoints(t.points),t.isUndoRedo||this.pane.presenter.undoRedoManager.done(cA(e,E.Moved)),e.requestRedraw(),this.fireAnnotationsChanged()}setViewBox(e){this.viewBox=e;const{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 ie(this._fullDomain)||(this._fullDomain=this.getDataDomain().domain),this._fullDomain}updateFullDomain(e=null){if(null===e&&this.comparison!==d.None)return;const t=this.fullDomain;this._fullDomain=this.getDataDomain([e,e],t).domain}getPlotDataDomain(e,t,i){const s=e.timeSeries;if(!s.hasData)return{domain:null};const n=s.container,r=n.getTimeData(),a=e=>G(r,+e,Number),l=ie(t),c=l?a(t):0,u=ie(i),h=u?a(i):r.length-1,d=e.curves.map(e=>e.fields).flat().filter(e=>e.id!==Ka.Change.id),p=ie(e.targetFields);p&&d.push(...e.targetFields);const f={},m=t=>{const[i,s]=(t=>{const i=p?e.curves[0]:e.curves.find(e=>e.fields.includes(t));if(!ie(i)||0===i.shift)return[c,h];if(!ie(f[i.id])){const e=i.shiftedTimeDomain;if(!ie(e))return[c,h];f[i.id]=[a(e[0]),a(e[1])]}return f[i.id]})(t),r=n.getData(t),o=Math.max(i,0),l=Math.min(r.length-1,s);return r.slice(o,l+1).map((i,s)=>e.priceMapper(i,s,t))},g=[null,null],y=e=>e.id,A=new Set(F(n.fields,d,y).map(y));e.curves.filter(e=>e.visible).map(e=>{const t=e.fields.filter(e=>A.has(e.id));if(e.isStackedColumn){j(z(t.map(e=>m(e)).reduce((e,t)=>t.map((t,i)=>(e[i]||0)+(t||0)),[])),g)}else t.map(e=>{const t=(e=>z(m(e)))(e);j(t,g)})});let S=L.None;const T=[o.Column,o.MultiColumn,o.StackedColumn];if(l&&u&&!e.main&&e.curves.some(e=>T.includes(e.style))){const e=g[0]>0,t=g[1]<0;e?(S=L.Min,g[0]=0):t&&(S=L.Max,g[1]=0)}return{domain:g,clamped:S}}getDataDomain([e,t]=[null,null],i=[null,null]){const s=ue(i);let n=!1;for(const c of this.plots.filter(e=>!e.hasDetachedScale)){const{domain:i,clamped:r}=this.getPlotDataDomain(c,e,t);ie(i)&&(j(i,s),n=n||r!==L.None)}if(!ie(s))return{domain:null};const[r,o]=s;if(!ie(r,o))return{domain:null};const a=[Number(r),Number(o)];a[0]===a[1]&&(a[0]-=1,a[1]+=1);let l=L.None;return n&&(0===a[0]?l=L.Min:0===a[1]&&(l=L.Max)),{domain:a,clamped:l}}setDomain(){const e=this.pane.presenter,t=e.view.xAxis.xScale.domain();if(!ie(t))return;for(const n of this.plots.filter(e=>e.hasDetachedScale)){const{domain:e}=this.getPlotDataDomain(n,t[0],t[1]);ie(e)&&n.yScale.domain(e)}if(this.isCustomDomain)return;const{domain:i,clamped:s}=this.getDataDomain(t);if(this===e.mainAxis&&e.mainPlot?.showPrevious){const t=e.mainPlot.getPreviousValue(),s=ce(e.display,!1,"chart","previous","forceVisible");ie(t,i)&&s&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],t))}if(this.yScale.domain(i),ie(i)){const e=this.getPadding(s);ie(e)&&this.yScale.padding(e)}}getInitialPadding(){const e=is(this.pane.presenter.hostElement);let t=rs(`#${gs.HEADER_SIZE_PLACEHOLDER_ID}`,e);if(!ie(t)){t=us(e,"div"),os(t,{display:"none"}),as(t,{id:gs.HEADER_SIZE_PLACEHOLDER_ID,class:"bcharts-card bcharts-card-first"});const{lineHeight:i}=getComputedStyle(t);isNaN(Number.parseFloat(i))&&os(t,{lineHeight:"120%"})}const{paddingTop:i,paddingBottom:s,marginTop:n,lineHeight:r}=getComputedStyle(t),o=this.pane.isMain?n:"0";if("cards"!==this.pane.presenter.display.tooltip.mode)return Number.parseFloat(o);return[i,s,o,r].map(Number.parseFloat).reduce((e,t)=>e+t,0)+gs.CARDS_Y_OFFSET}getPadding(e){const t=this.pane.presenter,i=t.display,s=ce(i,null,"yAxis","minPaddingPercent"),n=ce(i,null,"yAxis","maxPaddingPercent"),r=ie(s),o=ie(n),a=r||o?0:this.getInitialPadding(),l=r?s:gs.PANE_CAP_MIN_PADDING_PERCENT,c=o?n:gs.PANE_CAP_MAX_PADDING_PERCENT,u=l*this.viewBox.height,h=[o?c*this.viewBox.height:Math.max(u,Math.min(c*this.viewBox.height,a)),u];e===L.Max?h[0]=gs.PANE_TINY_PADDING_PIXELS:e===L.Min&&(h[1]=gs.PANE_TINY_PADDING_PIXELS);const d=t.mainPlot;return d&&d.hasEvents&&(h[0]+=3*t.view.getEventRadius()),h}clearTicks(){this.ticks=null}getTicks(e,t=0){const{height:i}=this.viewBox,s=Rn(e,1.3),n={height:i,approxLineHeight:s,domain:this.yScale.domain()};if(ie(this.ticks)&&ie(n.domain)&&ie(this.lastUsedOptions)&&ie(this.lastUsedOptions.domain)&&n.height===this.lastUsedOptions.height&&n.approxLineHeight===this.lastUsedOptions.approxLineHeight&&n.domain[0]===this.lastUsedOptions.domain[0]&&n.domain[1]===this.lastUsedOptions.domain[1])return this.ticks;this.lastUsedOptions=n;const r=Math.floor((i+40)/(s+40));let o=this.yScale.getTicks(r);const a=ce(Gv().config,null,"overrides","yAxis","tickProvider");if(ie(a)&&"function"==typeof a&&n.height>0&&ie(n.domain)){const e=ue(n);e.autoTicks=ue(o),o=a(e)}const{innerTickSize:l,tickPadding:c,fontSize:u}=this.config;let h=null;const d=this.yScale?.checkTicks(),p=d?30:40;return this.ticks=o.map(i=>{const s=Math.round(this.yScale.priceToY(i)),n=Math.abs(s-(h??s));if(d&&null!==h&&n<p)return null;h=s;const r=nd(this,i),o=e.measureText(r).width,a={x1:0,x2:0,y1:s,y2:s,dy:0,label:r,labelX:0,labelY:s+.32*u};return this.onTheRight?(a.x1=t,a.x2=a.x1+l,a.labelX=a.x2+o+c):(a.x1=t-l,a.x2=a.x1+l,a.labelX=a.x1-c),a}).filter(e=>null!==e),this.ticks}widthNeeded(e){if(!ie(this.fullDomain))return gs.DEFAULT_PRICE_AXIS_WIDTH;e.save();const{fontWeight:t,fontSize:i}=this.config,{chart:{fontFamily:s}}=this.pane.presenter.display;e.font=`${t} ${i}px ${s}`;const n=Math.max(...this.fullDomain.map(t=>e.measureText(nd(this,t,!0)).width)),{innerTickSize:r,tickPadding:o}=this.config,a=n+r+2*o+(ie(this.label)?Rn(e,1.6):0);return e.restore(),a}draw(e){const{chart:{fontFamily:t},yAxis:{gridLines:i,textColor:s,visible:n}}=this.pane.presenter.display;if(!n||!this.viewBox)return;e.save();const{x:r,y:o,width:a,height:l}=this.viewBox,{fontWeight:c,fontSize:u}=this.config;if(_n(e,this.viewBox),e.font=`${c} ${u}px ${t}`,e.lineWidth=2,e.strokeStyle=i.color,e.textAlign="end",ie(this.label)){e.save();const t=Pn(.4);e.fillStyle=t(s),e.translate(0,0);const i=this.onTheRight?1:-1;e.rotate(i*Math.PI/2),e.textAlign="center";const n=Rn(e),c=i*(o+l/2);this.onTheRight?e.fillText(this.label,c,-(r+a-n)):e.fillText(this.label,c,r+n),e.restore()}const h=this.onTheRight?r:a;e.setLineDash([]),Un(e,h,o,o+l);const d=this.getTicks(e,h);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;const i=this.onTheRight?this.viewBox.x:this.viewBox.width,s=nd(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){const t=this.pane.presenter,{chart:{fontFamily:i,previous:s},yAxis:{showLastValue:n,preventLabelOverlap:r,includePercentChangeWithLastValue:o}}=t.display,a=t.view,l=[],c=(e,t,i,s,n,r)=>{if(null!=t){const a=t;let c;t=e.priceMapper(t,r,n);const u=e.is(f.Symbol)||e.is(f.Expression);if(o&&u){const t=e.axis.comparison===d.Percent?d.None:d.Percent;c=e.priceMapper(a,r,n,t)}const h=e.hasDetachedScale?e.metaData.format(t,n):void 0,p=ie(c)?1:2;l.push({y:e.priceToY(t),formattedValue:h,value:t,auxValue:c,color:i,halfHeight:Math.round(this.indicatorHeight/p),priority:s})}};this.plots.forEach(e=>{if(e.timeSeries&&e.timeSeries.hasData){if("All"===n||"Main"===n&&e.main){const t=e.main?1:3;AT(e).filter(e=>null!=e.value&&-1!==e.index).forEach(i=>c(e,i.value,i.color,t,i.field,i.index))}e.showPrevious&&c(e,e.getPreviousValue(),s.color,2,Ka.PreviousClose,void 0)}});this.annotations.concat(this.plotAnnotations).forEach(e=>{l.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})))}),l.sort((e,t)=>e.y-t.y),r&&function(e,t){e.forEach((e,i,s)=>{if(0===i&&e.y-e.halfHeight<t.y)e.y=t.y+e.halfHeight+1;else if(i>0){const n=s[i-1],r=(({y:e,halfHeight:t})=>e-t)(e),o=hT(n);r<o&&(e.y=o+1+e.halfHeight),hT(e)>t.y+t.height&&(e.y=t.y+t.height-e.halfHeight-1)}})}(l,this.viewBox);const u=({y:t,value:s,formattedValue:n,color:r,auxValue:o})=>{const{leftOffset:l,rightOffset:c}=a,u=this.onTheRight?this.pane.viewBox.width-c:l,h=Ln(r),p=new uT({position:this.onTheRight?"right":"left",fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:i,textColor:h,strokeColor:r,backgroundColor:r}),f=n||nd(this,s);let m;const g=this.comparison===d.Percent;te(o)&&(m=g?sd(this,o):id(o)),p.draw(e,u,t,f,m)};r?l.forEach(u):gT.forEach(e=>l.filter(t=>t.priority===e).forEach(u))}}const TT=/* @__PURE__ */Symbol.for("__dloacip__");class vT{constructor(e){this.presenter=e,this.id=Pe()}id;axes=[];height=0;alignedToYear=null;viewBox;fromModel(e){this.height=e.height,!0===e.alignOnExpirations&&(this.alignedToYear=function(e){const t=e.map(e=>e.plots).flat().filter(e=>f[e.type]==f.Symbol).map(e=>e.symbol).map(e=>Ji(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)=>{const i=new ST(this);return i.primary=0===t,i.fromModel(e),i},this)}getBounds(){return this.viewBox}setViewBox(e){this.viewBox=e}drawBackground(e){ie(this.viewBox)&&(this.drawAxes(e),e.save(),this.clipToNoScales(e),this.drawGrid(e),e.restore())}draw(e){ie(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[TT]&&function(e,{x:t,y:i,height:s,width:n}){if(!te(GA))return;const{path:r,width:o,height:a,rect:l}=GA,c=n/8,u=Math.min(Math.max(50,c),o)/o;l.width=o*u,l.height=a*u,l.x=t+5,l.y=i+s-l.height-5,e.save();const 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(r),e.restore()}(e,this.getBoundsWithoutScales())}drawAxes(e){for(const t of this.axes)t.draw(e)}drawPrevious(e){const t=this.presenter.mainPlot;if(t.showPrevious&&this.isMain){let i=t.getPreviousValue();if(i=t.priceMapper(i,void 0,Ka.PreviousClose),null!=i){const{leftOffset:s,rightOffset:n}=this.presenter.view,r=s,o=this.viewBox.width-n,a=t.axis.yScale.priceToY(i),{color:l,dashStyle:c,lineWidth:u}=this.presenter.display.chart.previous,h=An(c);e.save(),e.strokeStyle=l,e.lineWidth=u,e.setLineDash(h),$n(e,a,r,o),e.restore()}}}getBoundsWithoutScales(){const e=this.viewBox.duplicate(),t=this.presenter.view;return e.x=t.leftOffset,e.width-=t.leftOffset+t.rightOffset,e}clipToNoScales(e){_n(e,this.getBoundsWithoutScales())}drawAnnotations(e){e.save();const{chart:{fontFamily:t},yAxis:{fontSize:i}}=this.presenter.display;e.font=`${i??12}px ${t}`;const s=t=>t.draw(e,!0);this.axes.forEach(e=>{e.annotations.forEach(s),e.plotAnnotations.forEach(s)}),e.restore()}drawGrid(e){const{chart:{fontFamily:t},yAxis:{gridLines:i,visible:s,minorGridLines:n}}=this.presenter.display;if(!s||!i.visible)return;const{lineWidth:r,color:o,dashStyle:a}=i;e.save();const l=0===this.axes[0].plots?.length&&this.axes.length>1,c=this.axes[l?1:0],{fontWeight:u,fontSize:h}=c.config;e.font=`${u} ${h}px ${t}`;const d=c.getTicks(e),{leftOffset:p,rightOffset:f}=this.presenter.view,m=p,g=this.viewBox.width-f,y=(t,i,s)=>{e.lineWidth=t,e.strokeStyle=i,e.setLineDash(An(s)),e.beginPath()};if(y(r,o,a),d.forEach(t=>{e.moveTo(m,t.y1),e.lineTo(g,t.y2)}),e.stroke(),n&&n.visible&&d.length>=2){const{lineWidth:t,color:i,dashStyle:s}=n,r=(d[0].y1-d[1].y1)/5;y(t,i,s),d.forEach(t=>{for(let i=1;i<5;i++){const s=Math.ceil(t.y1+i*r);e.moveTo(m,s),e.lineTo(g,s)}}),e.stroke()}e.restore()}drawYCrosshair(e,t){const{yAxis:{crosshair:{enabled:i,showValue:s,color:n,dashStyle:r}}}=this.presenter.display;if(!i)return;const o=An(r);e.strokeStyle=n,e.setLineDash(o);const a=this.presenter.view.leftOffset,l=this.viewBox.width-this.presenter.view.rightOffset,c=Kn();c.prolog(e),$n(e,c.adjust(t.y),c.adjust(a),c.adjust(l)),c.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";Bn(e,Gv().config.noDataText||gs.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},g.Center),e.restore()}get isMain(){const e=this.presenter.mainPlot;return this.axes.some(t=>t.plots.includes(e))}drawPlots(e){e.save();const t=this.presenter.mainPlot,i=this.presenter.display.chart.showNoDataText,s=!ie(i)||i,n=/* @__PURE__ */new Map;let r=!0;const o=i=>{for(const e of this.axes){for(const s of e.plots){const e=s.isEmpty();r=r&&s.main&&e,s===t||e||i(s)}e.plots.includes(t)&&!t.isEmpty()&&i(t)}s&&r&&this.drawNoData(e)};o(t=>t.draw(e)),o(t=>t.drawTopmost(e,n)),e.restore()}}function PT(e,t){return{width:e,spacing:t,get totalWidth(){return this.width+this.spacing},offset:0}}class CT extends ky{constructor(e,t){super(),this.timeline=e,this.aggregation=t;const i=e.presenter.display;this.marginBars=i.xAxis.marginBars||0,this.bar=PT(ce(i,gs.DEFAULT_BAR_WIDTH,"chart","bar","width"),ce(i,gs.DEFAULT_BAR_SPACING,"chart","bar","spacing")),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}marginBars;bar;resetBar;wasZoomed;fitAllData;extent(e){return Fy.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);const e=this.display.xAxis.visibleRange;if(ie(e))return this.scaleBarToFitRange([e.from,e.to]);const t=this.display.density;if(Number.isFinite(t))return this.scaleBarToFitDensity(t);const i=this.display.period;return Number.isFinite(i)?this.scaleBarToFitPeriod(i):void 0}deriveExtentsFromBarWidth(e){if(!ie(this._range))return null;if(0===this.timeline.length)return null;const t=this._range[1]-this._range[0],i=t/e.totalWidth,s=Math.ceil(i);e.offset=t-s*e.totalWidth;let n=this.timeline.lastSeriesIndex+this.marginBars;const r=this._domain&&this._domain[1];r&&(n=G(this.timeline,+r,Number,ud));return[n-s+1,n]}adjustDomain(){if(!ie(this._range))return;this.scaleBarToFit();const e=this.deriveExtentsFromBarWidth(this.bar);ie(e)&&(this.extent(e),this.setDomainFromExtent())}xToTime(e){if(!this.ready)return null;const t=e-this._range[0]-this.bar.offset,i=Math.floor(t/this.bar.totalWidth),s=this._extent[0]+i;return this.timeline.at(s)}timeToIndex(e){return this.ready?(e="number"==typeof e?e:+e,G(this.timeline,e,Number,ud)):null}indexToX(e){const 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;const t=this.timeToIndex(e);return this.indexToX(t)}zoom(e){const t=e,i=t*this.bar.width/100,s=this.bar.width-i,n=this.bar.spacing-t*this.bar.spacing/100;if(s>gs.MAXIMUM_BAR_WIDTH||s<gs.MINIMUM_BAR_WIDTH)return!1;const r=PT(s,n),o=this.deriveExtentsFromBarWidth(r);return!!this.isUsableExtent(o)&&(this.setBar(s,n),this.adjustDomain(),this.wasZoomed=!0,!0)}scaleBarToFitRange(e,t=!0){const i=(e,t,i,s)=>ie(e)?G(this.timeline,e,Number,ud,i,s):t,{from:s,to:n}=this.presenter.data.range||{},r=+e[0]===s&&+e[1]===n,{firstSeriesIndex:o,lastSeriesIndex:a}=this.timeline,l=r?o:void 0,c=r?a:void 0,u=[i(e[0],o,l,c),i(e[1],a,l,c)];this.timeline.at(u[1])>e[1]&&(u[1]=Math.max(0,u[1]-1)),this.extent(u),this.scaleBarToFitDensity(u[1]-u[0]+1,t)}scaleBarToFitDensity(e,t=!0){const i=Math.max(gs.MINIMUM_BARS_VISIBLE,e),s=t&&this.display.xAxis.marginBars||0,n=(this._range[1]-this._range[0])/(i+s);this.setBar(2/3*n,1/3*n,!1)}scaleBarToFitPeriod(e){const t=this.timeline.lastSeriesIndex,i=this.timeline.at(t);let s=i,n=t;const r=this.presenter.data.aggregation;if(r.isEndOfDay||r.isIntraday&&e>=gs.INTRA_THRESHOLD)for(;n>0&&ft(i,s)<e;)n--,s=this.timeline.at(n);else if(!r.isTick){let t=Math.floor(e/gs.ONE_DAY_MILLIS);const s=e=>yt(e,nt(e)),r=s(i);let o=i;for(;n>0;){const e=this.timeline.at(n),i=ut(e,o);if(0===t){if(s(e)<=r||!i)break}else i||(t--,o=e);n--}}this.scaleBarToFitDensity(t-n+1)}setBar(e,t,i=!0){const[s,n]=ve(e,t,gs.MINIMUM_BAR_WIDTH,gs.MAXIMUM_BAR_WIDTH);this.bar.width=s,this.bar.spacing=n,this.wasZoomed||(this.resetBar={width:s,spacing:n}),i&&(this.presenter.model.display.chart.bar={width:e,spacing:t})}resetZoom(){ie(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=gs.DEFAULT_BAR_WIDTH,this.bar.spacing=gs.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(e){return ie(e)&&ie(e[0],e[1])&&e[0]>=0&&e[1]<this.timeline.withPrologEpilogLength&&e[1]-e[0]>=gs.MINIMUM_BARS_VISIBLE}shiftBars(e,t=null){if(!this._extent)return;const i=this._extent.map(t=>t+e);this.isUsableExtent(i)&&(ie(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;const t=e%this.bar.totalWidth;let i=this.bar.offset+t;const s=Math.sign(e);let n=-(e<0?Math.ceil:Math.floor)(e/this.bar.totalWidth);(i>this.bar.totalWidth||i<-this.bar.totalWidth)&&(n+=i>0?-1:1,i-=s*this.bar.totalWidth),this.shiftBars(n,i)}getSeriesThatCouldLoadMoreData(){const e=this.domain();if(!ie(e)||!ie(e[0]))return[];const t=e[0].getTime();return this.timeline.presenter.allPlots.map(e=>e.timeSeries).filter(e=>!(!ie(e)||!e.hasData||0===e.container.size||!0!==e.canLoadMoreData)&&t<=e.container.getTimeData()[0].getTime())}}function bT(e){return{date:e,priority:1,text:td(e)}}class ET{constructor(e){this.view=e,this.xScale=new CT(e.presenter.timeline,e.presenter.data.aggregation),this.ticks=null,this.lastUsedOptions=null,this.wasPanned=!1,this.panningXAxisAllowed=ce(e.presenter.display,!0,"xAxis","panning"),this.updateConfigFromModel();const t=e.presenter.renderTo.id,i=ce(Gv().config,null,"overrides","xAxis","tickProvider");ie(i)&&"function"==typeof i&&(this.overrideTickGetter=M(i,t));const s=ce(Gv().config,null,"overrides","xAxis","formatter");ie(s)&&"function"==typeof s&&(this.overrideFormatter=M(s,t))}xScale;ticks;lastUsedOptions;wasPanned;panningXAxisAllowed;config;isVisible;crosshairIndicator;viewBox;overrideTickGetter;overrideFormatter;contractParityCache=null;contractParityCacheKey=null;updateConfigFromModel(){const{chart:{fontFamily:e,backgroundColor:t,fontSize:i},xAxis:{textColor:s,visible:n,fontSize:r,crosshair:{color:o}}}=this.view.presenter.display,a=r||i||12;this.config={innerTickSize:5,tickPadding:5,indicatorPadding:5,fontWeight:400,fontSize:a},this.isVisible=n,this.crosshairIndicator=new uT({position:"bottom",fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:o,textColor:s,backgroundColor:Cn(.15)(t),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();const e=this.view.presenter.display.period===gs.FIFTY_YEARS_MILLIS;ie(this.xScale.extent())&&!e&&this.checkForMoreData()}zoom(e){const t=this.xScale.zoom(e);return this.checkForMoreData(),t}checkForMoreData(){this.xScale.getSeriesThatCouldLoadMoreData().forEach(e=>e.loadMoreData())}shouldScrollIntoView(e){const t=this.xScale.extent();return!!ie(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(){const e=this.xScale.timeline.lastSeriesIndex+this.getMaxCurveOffset(),t=this.xScale.extent();return e-(t?t[1]:e)}canGoToLast(){return this.barsToLast>0}getMaxCurveOffset(){return Math.max(...this.view.presenter.allCurves.map(e=>e.shift))}goToLatest(e=!1){if(this.canGoToLast()||e){const 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;const{x:t,width:i}=this.viewBox;this.xScale.range([t,t+i])}heightNeeded(e){if(!this.isVisible)return 0;const t=this.view.presenter.display.chart.fontFamily,{fontWeight:i,fontSize:s}=this.config;e.save(),e.font=`${i} ${s}px ${t}`;const{innerTickSize:n,tickPadding:r,indicatorPadding:o}=this.config,a=Rn(e,1)+n+r+o;return e.restore(),a}getTickGetter(e){if(this.overrideTickGetter)return this.overrideTickGetter;const t=this.view.presenter.display.xAxis.isOrdinal||!1,i=function(e){switch(e.agg.unit){case a.Tick:return new qh(e);case a.Intraday:return new Xh(e,e.agg.size);case a.Day:return new Zh(e);case a.Week:return new Jh(e);case a.Month:case a.Quarter:return new Qh(e);case a.Year:return new ed(e);default:throw new Error(`Aggregation unit ${a[e.agg.unit]} not supported.`)}}(e);return t?bT:e=>i.getTick(e)}getTicks(e){if(ie(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&&ie(this.ticks))return this.ticks;var t,i;this.lastUsedOptions=e;const s=this.getTickGetter(e),n=Math.max(0,e.extent[0]),r=Math.min(this.xScale.timeline.withPrologEpilogLength-1,e.extent[1]+1);return this.ticks=this.view.presenter.timeline.slice(n,r).map((e,t)=>{if(!ie(e)||Number.isNaN(e.getTime()))return null;const i=s(e);return ie(i)&&(i.index=n+t),i}).filter(e=>ie(e)),this.ticks}normalizeDuration(e){const t=function(){const e=Object.keys(Wh);return 1===Wh.Day.Multipliers[0]&&e.forEach(e=>{const t=Wh[e],i=Te(t.Period);t.One=1*i,t.Multipliers=t.Multipliers.map(e=>e*i)}),Wh}();let i=t.Year;const s=Object.keys(t);for(let a=0;a<s.length-1;++a){const n=t[s[a]].Multipliers,r=t[s[a+1]].Multipliers,o=(k(n)+W(r))/2;if(e<=o){i=t[s[a]];break}}const n=i.Multipliers,r=n.findIndex(t=>e<t);let o=-1===r?k(n):n[r];return"P1M"===i.Period?o*=.9:"P1W"===i.Period&&(o*=.84),o}draw(e){if(!this.isVisible)return;const{xAxis:{gridLines:t,textColor:i,minTickInterval:s,tickPixelInterval:n,format:r,forceTicksVisible:o},chart:{fontFamily:a}}=this.view.presenter.display,{fontWeight:l,fontSize:c,innerTickSize:u,tickPadding:h}=this.config,{x:d,y:p,width:f}=this.viewBox,{lineWidth:m,color:g,dashStyle:y}=t,A=An(y);e.textAlign="center",e.font=`${l} ${c}px ${a}`,e.lineWidth=1,e.strokeStyle=g,e.fillStyle=i,e.setLineDash([]),$n(e,p,d,d+f);const S=this.xScale.extent(),T=e=>!ie(e)||!ie(e[0],e[1]);if(T(S))return;const v=t=>e.measureText(t).width,P=n>0?n:120,C=this.xScale.domain();if(T(C))return;const b=(C[1].getTime()-C[0].getTime())*P*.6/f,E=this.normalizeDuration(b),L=this.view.presenter.data.aggregation.isEndOfDay,M=(e,t)=>{if(e.date.valueOf()===gs.ZERO_DATE.valueOf())return!0;if(i=e.date,n=t.date,(ie(i)?ft(n,i):gs.FIFTY_YEARS_MILLIS)<s)return!1;var i,n;const r=t.x-e.x,o=t.date.getTime()-e.date.getTime()>=E,a=r>P;return!(e.x+e.textWidth/2>=t.x-t.textWidth/2)&&(a||!!L&&o)},_=d+f,x=({text:i,x:s,date:n,forced:r})=>{ie(n)&&(r||Un(e,s,p,p+u),e.fillText(i,s,p+u+h+.71*c),t.visible&&!r&&(e.save(),e.lineWidth=m,e.setLineDash(A),Un(e,s,0,p),e.restore()))},I={agg:this.view.presenter.data.aggregation,unitWidth:v("M"),barWidth:this.xScale.bar.width,extent:S,formatString:r,minTickInterval:s||0,duration:b},D=this.getTicks(I);let O={date:gs.ZERO_DATE,priority:999,x:-999,text:"",textWidth:0};D.forEach(e=>{e.x=this.xScale.indexToX(e.index),e.textWidth=v(e.text),(e=>{const{x:t,textWidth:i}=e;let s=t;if(o){const n=i/2;s=t-n<d?d+n:t,s=s+n>_?_-n:s,e.x=s,e.forced=t!==s}else e.forced=!1})(e),M(O,e)?(x(O),O=e):e.priority<O.priority&&(O=e)}),x(O),this.drawTimeTransitions(e),this.drawTimeAdornments(e)}drawTransitionsFor(e,t,i,s,n){const r=this.xScale.domain(),o=this.view.presenter?.mainPlot?.timeSeries.container;if(!te(o))return;const a=o.getTimeData(),l=null===t?a:o.getData(t);if(!ie(l))return;const c=G(a,+r[0],Number),u=G(a,+r[1],Number,$,c);if(c<u){const t=this.viewBox.y,r=this.view.leftOffset,o=this.viewBox.x+this.viewBox.width;if(s.save(),n){s.fillStyle=e.fillColor;let h=l[c],d=Math.max(r,this.xScale.timeToX(a[c]));for(let e=c+1;e<=u;++e){const r=e<l.length?l[e]:null;if(e===u||i(r,h)){const i=e<a.length?a[e]:null;let l=te(i)?this.xScale.timeToX(i):o;l=Math.min(l,o),n(h)%2==0&&s.fillRect(d,0,l-d,t),h=r,d=l}}}const h=Kn();h.prolog(s),s.strokeStyle=e.color,s.lineWidth=e.width,s.setLineDash(An(e.dashStyle));let d=null;for(let e=c;e<u;++e){const n=l[e];if(i(n,d)){const i=a[e],r=this.xScale.timeToX(i);ie(r,d)&&Un(s,r,0,t),d=n}}h.epilog(s),s.restore()}}drawTimeTransitions(e){const t=this.xScale.domain();if(!te(t)||!ie(t[0],t[1]))return;const i=this.view.presenter,{xAxis:{contractTransition:s,cycleTransition:n}}=i.display,r=(e,t)=>e!==t;if(s.enabled&&i?.data?.aggregation.isMultiContract){const t=i?.mainPlot?.timeSeries.container,n=t?.getData(Ka.Symbol);if(n&&n.length>0){const t=n[0];if(this.contractParityCacheKey!==t||!this.contractParityCache){const e=[...new Set(n)];e.sort((e,t)=>{const i=Ji(e),s=Ji(t);return(i?.getTime()??0)-(s?.getTime()??0)});let i=0;if(this.contractParityCache)for(let t=0;t<e.length;t++){const s=e[t],n=this.contractParityCache.get(s);if(void 0!==n){i=(n-t)%2==0?0:1;break}}this.contractParityCache=/* @__PURE__ */new Map,e.forEach((e,t)=>this.contractParityCache.set(e,t+i)),this.contractParityCacheKey=t}const i=e=>this.contractParityCache.get(e)??0;this.drawTransitionsFor(s,Ka.Symbol,r,e,i)}}if(n.enabled)if(i?.data?.aggregation.isIntraday)this.drawTransitionsFor(n,Ka.TradingDay,r,e,e=>e);else if(i?.data?.aggregation.unit===a.Day){const t=(e,t)=>!_i(e,t),i=e=>e.getMonth();this.drawTransitionsFor(n,null,t,e,i)}else if(i?.data?.aggregation.unit===a.Week){const t=(e,t)=>!Ii(e,t),i=e=>e.getFullYear();this.drawTransitionsFor(n,null,t,e,i)}}getAnnXScore(e,t){return[ut,Mi,_i,Ii].map((i,s)=>(4-s)*Number(i(e,t))).reduce((e,t)=>e+t,0)}annTimeToX(e){const t=this.xScale.timeToIndex(e);if(!te(t))return null;const i=this.xScale.timeline.at(t),s=this.xScale.timeToX(e);if(t>0&&i.valueOf()!==e.valueOf()){const n=t-1,r=this.xScale.timeline.at(n),o=this.xScale.indexToX(n),a=this.view.presenter.display?.xAxis?.isOrdinal;if(!a){if(r.valueOf()>e.valueOf())return s;const t=this.getAnnXScore(r,e),n=this.getAnnXScore(i,e);if(t>n)return o;if(n>t)return s;const a=this.view.presenter?.data?.aggregation?.isIntraday;return a?o:s}return o+(s-o)*((e.valueOf()-r.valueOf())/(i.valueOf()-r.valueOf()))}return s}drawTimeAdornments(e){e.save();const t=this.view.presenter,{chart:{fontFamily:i},xAxis:{preventLabelOverlap:s}}=t.display,n=[],r=t.mainPane?.getBoundsWithoutScales()??new xn(0,0,0,0);t.allAnnotations.concat(t.plotAnnotations).forEach(i=>{n.push(...i.getTimeScaleAdornments().map(i=>{const s=this.annTimeToX(i.time);if(s<r.x||s>r.x+r.width)return null;const n=!this.view.presenter?.display?.xAxis?.isOrdinal?this.xScale.xToTime(s):i.time,o=rd(t,n),a=e.measureText(o).width/2;return{x:s,value:o,color:i.color,halfWidth:a}}).filter(e=>null!=e))}),n.sort((e,t)=>e.x-t.x),s&&function(e,t){const i=e.length-1;e.forEach((e,s,n)=>{const r=0===s,o=r?null:n[s-1],a=dT(e),l=r?t.x:pT(o);if(e.x-e.halfWidth<t.x&&(e.x=mT(t.x,e.halfWidth)),a<l)e.x=mT(l,e.halfWidth+4);else{const t=pT(e),r=s<i?dT(n[s+1]):Number.MAX_SAFE_INTEGER;if(t>r){const i=fT(e.x,t-r),s=fT(e.x,e.halfWidth-2),n=mT(l,o?.halfWidth??0);e.x=Math.max(s,i,n)}}pT(e)>t.x+t.width&&(e.x=fT(t.x+t.width,e.halfWidth))})}(n,this.viewBox),n.forEach(t=>{const s=Ln(t.color);new uT({position:"bottom",fontSize:this.config.fontSize,fontFamily:i,padding:this.config.indicatorPadding,strokeColor:gs.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}){const i=this.view.presenter,s=i.display.xAxis,{enabled:n,showValue:r,color:o,dashStyle:a,format:l}=s.crosshair,c=this.xScale.xToTime(t);if(!(ie(c)&&ht(c)))return!1;if(!n)return!0;t=this.xScale.timeToX(c);const u=An(a);e.strokeStyle=o,e.setLineDash(u);const h=Kn();if(h.prolog(e),Un(e,h.adjust(t),0,h.adjust(this.viewBox.y)),h.epilog(e),!r||!s.visible)return!0;const d=ie(s.format)?l:void 0,p=rd(i,c,d);this.crosshairIndicator.draw(e,t,this.viewBox.y+1,p,void 0,this.viewBox.height-2);const{plotHover:f}=i.display.chart;return f&&i.allPlots.filter(e=>e.visible).forEach(i=>i.curves.forEach(i=>i.drawHover(e,c,t))),!0}}const LT={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",dblclick:"onMouseDblClick",contextmenu:"onContextMenu",mouseover:"onMouseEnter",mouseout:"onMouseLeave",wheel:"onWheel",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",keydown:"onKeyDown"},MT={Shift:"shiftKey",Alt:"altKey",Control:"ctrlKey",Meta:"metaKey"};class _T{constructor(e){this.view=e}subscriptions=[];init(e){const t=q();Object.keys(LT).filter(e=>!(e=>e.startsWith("touch"))(e)||t).forEach(t=>{const i=e=>{const i=LT[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){const i=this.view.presenter;if(void 0===i||null===i.activeTool)return!1;const s=this.getPayload(t,i),n=i.activeTool;let r=!1;return"function"==typeof n[e]&&(r=n[e](s)||!1),r}getPayload(e,t){const i=e instanceof MouseEvent,s=q()&&e instanceof TouchEvent;if(i||s){const n={x:0,y:0};if(s&&1===e.touches.length){const t=e.touches[0],{left:i,top:s}=e.target.getBoundingClientRect();n.x=t.clientX-i,n.y=t.clientY-s}else i&&(n.x=e.offsetX,n.y=e.offsetY);const r={button:i?e.which:A.Left,offset:n,view:t.view,presenter:t,originalEvent:e,getModifier:t=>e[MT[S[t]]]};if(e instanceof WheelEvent&&(r.delta=e.shiftKey?e.deltaX:e.deltaY),s&&2===e.touches.length){const t=e.touches[0],i=e.touches[1];r.pinchZoom=!0;const s=t.clientX-i.clientX,n=t.clientY-i.clientY;r.pinchDistance=Math.sqrt(s*s+n*n)}return this.view.splitters.forEach((e,t)=>{e.contains(n)&&(r.splitter=[t,t+1])}),t.panes.forEach(e=>{const t=e.getBounds();if(ie(t)&&t.contains(n)){const t=e.axes.find(e=>e.viewBox?.contains(n));if(t)r.priceAxis=t;else{const t=e.axes.find(e=>e.primary);r.point=t.toAnnotationPoint(n)}}}),r}if(e instanceof KeyboardEvent){return{key:e.key??e.keyIdentifier,code:e.keyCode||e.charCode,repeat:e.repeat,presenter:t,getModifier:t=>e.getModifierState(S[t])}}}}const xT=$u.concat(Ka.PercentChange);class IT{constructor(e){this.view=e,this.id=`bc-legend-${Pe()}`}id;isOptionsChart=!1;getLegendElem(){const e=this.view.el;return ls(this.id,e,"div")}update(){const e=this.getLegendElem(),t=Ed(this.presenter.mainPane);if(!ie(t))return;this.isOptionsChart=this.mainPlot.title.startsWith(gs.FAKE_SYMBOL_PREFIX);const{left:i,right:s,top:n,width:r}=t;FA(e,"row",i,s,n,r),cs(e,{"bcharts-card":!0,"bcharts-legend":!0});const o=this.mainPlot,a=o.isSeasonal||this.isOptionsChart?this.getFirstColorBadge(o):"",l=this.getPlotTitle(o),c=this.maybeGetQuote(),u=this.div(`${a} ${l} `)+this.div(`${c}`),h=this.maybeGetAdditionalPlots();e.innerHTML=`${u} ${h}`}remove(){ns(this.getLegendElem())}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"";return`${e} = "${Array.isArray(t)?t.join(" "):t}" `}).join(" ")}span(e,t={}){return`<span ${this.getAttributes(t)}>${e}</span>`}div(e){return`<div class="plot" style="flex: 0 0 auto">${e}</div>`}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){const t=xT.map(t=>e.getValue(t));if(R(t)){const e=t[4],i=`field-${e>0?"up":e<0?"down":"same"}-value`;return`${t.slice(0,-1).map((e,t)=>{const s=xT[t],n=this.format(e,s),r=xd(s);return`${this.spanAsName(r)}${this.spanAsValue(n,i)}`}).join(" ")} ${this.spanAsValue(`(${this.format(k(t),k(xT))})`,i)}`}return""}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries?.record?.isValid){const e=Gv().getRecordSource().getRecord(this.mainPlot.timeSeries.record.symbol);return this.getQuoteFromRecord(e)}if(this.mainPlot.isExpression&&this.mainPlot.record.isValid){const e=this.mainPlot.record;return e.evaluate(),this.getQuoteFromRecord(e)}return""}getTitle(e,t,i){const s=t?"value-main":null;return`${this.span(`${e.name} (${e.symbol})`,{"data-plot-id":i,class:["value-title",s]})}${t?` ${this.span(e.exchange,{class:"value-subtitle"})}`:""}`}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){const t=Gv().getMetaDataSource().getMetaData(e.getActualSymbols()[0]);return this.getTitle(t,!0,e.id)}return this.span(e.title,{"data-plot-id":e.id,class:"value-title"})}getFirstColorBadge(e){return Ad("rectangle",e.mainCurve.colors[0])}getLastValues(e){return this.isOptionsChart?"":AT(e).filter(e=>ie(e.value)).map(t=>{const 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(){const 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=>{const i=this.getFirstColorBadge(e),s=this.getPlotTitle(e),n=this.canBeDeleted(e)?Cd(e.id):"",r="All"!==t&&!e.isSeasonal?this.getLastValues(e):"";return this.div(`${n} ${i} ${s} ${r}`)}).join(" "):""}}class DT{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 IT(this),this.draw=this.draw.bind(this),this.notifyLayoutChanged=ee(qa.CH_CHTLAYOUTCHANGED,gs.LAYOUT_THROTTLE_DELAY)}get canShowLegend(){if(!this.presenter.hasLegend)return!1;const 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=>ie(e)&&e.className===t)}onNonToolHandledMouseDown(e){const t=this.presenter,i=e.target;if("string"==typeof i.className&&i.className.split(" ").includes("value-title"))t.onCardClicked(i);else{const s=this.findSvgParentWithClass(i,"move-pane");if(te(s))return void t.onMovePaneClicked(s);const n=this.findSvgParentWithClass(i,"delete-plot");if(te(n))return void t.deletePlotClicked(n);const r=this.findSvgParentWithClass(i,"show-hide-plot");if(te(r))return void t.showHidePlotClicked(r);const o=this.findSvgParentWithClass(i,"more-actions");if(te(o))return void t.plotMoreActionsClicked(o,e)}}initialize(e){this.presenter=e,this.el=this.presenter.hostElement;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:i}=t.contentRect;this.setSize(e,i),ie(this.tooltip)&&this.tooltip.repositionAuto()}});t.observe(this.el.parentElement),this.listeners.push(()=>t.unobserve(this.el.parentElement));const i=e=>this.onNonToolHandledMouseDown(e);this.el.addEventListener("mousedown",i),this.listeners.push(()=>this.el.removeEventListener("mousedown",i)),os(this.el,{flex:1,display:"flex",position:"relative","flex-direction":"column","touch-action":"pan-x pan-y"}),this.tooltip=new VA(this);const s=Gv().config.getCustomEventPopup;this.customEventPopup=s?s(this):null;const{clientHeight:n,clientWidth:r}=this.el;this.width=r,this.height=n,this.canvasContainer=us(this.el,"div"),as(this.canvasContainer,{class:"chart-canvas-container"}),os(this.canvasContainer,{flex:1,display:"flex","flex-direction":"column",position:"relative",height:"100%"}),this.mainCanvas=us(this.canvasContainer,"canvas");const o={height:`${n}px`,width:`${r}px`,"z-index":2,position:"absolute",top:0,left:0};os(this.mainCanvas,o),this.mouseCanvas=us(this.canvasContainer,"canvas"),as(this.mouseCanvas,{tabIndex:0}),o["z-index"]=3,o.outline="none",os(this.mouseCanvas,o),this.goToLatestButton=us(this.el,"button"),ds(this.goToLatestButton,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n <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>\n </svg>'),os(this.goToLatestButton,{position:"absolute",right:0,bottom:0,"z-index":3}),as(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 ET(this),this.eventCapture=new _T(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(r,n);const a=is(this.el);ie(rs(`.${gs.SVG_ICONS_DOM_NODE}`,a))||function(e){const t=us(e,"div");as(t,{class:gs.SVG_ICONS_DOM_NODE});const i=Object.keys(dd).map(e=>`<symbol id="${yd(e)}" viewBox="0 0 1024 1024">${dd[e]}</symbol>`).join("");t.innerHTML=`<svg style="display:none" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs>${i}</defs></svg>`}(a)}reinitialize(){this.el&&hs(".bcharts-card",this.el).forEach(e=>e.remove()),this.customEventPopup?.hide(),this.drawCrosshair({ap:void 0}),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.resetZoomAndVisibleRange?this.xAxis=new ET(this):this.xAxis?.updateConfigFromModel(),this.recalculateLayout(),this.redraw()}setSize(e,t,i=!1){this.setChartSize(e,t),this.redraw(i)}setChartSize(e,t){const i={width:`${e}px`,height:`${t}px`};os(this.el,i),this.width=e,this.height=t;const s=globalThis.devicePixelRatio||1,n={height:this.height*s,width:this.width*s};[this.mainCanvas,this.mouseCanvas].forEach(e=>{as(e,n),os(e,i)}),this.mainContext.scale(s,s),this.mouseContext.scale(s,s),this.recalculateLayout(),this.presenter&&HA(this.presenter)}widthNeeded(e,t){const 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;const e=this.xAxis.heightNeeded(this.mainContext),t=this.widthNeeded(this.mainContext,!0),i=this.widthNeeded(this.mainContext,!1),s=this.height-e,n=this.presenter.panes;let r=O(n.map(e=>e.height)),o=0;const a=gs.PANE_SPLITTER_PERCENT_HEIGHT/100,l=Math.floor(a*s);r*=1+(n.length-1)*a;const c=this.presenter.display?.yAxis?.primaryOnTheLeft??!1;if(this.presenter.display.yAxis.visible){n.some(e=>e.axes.length>1)?(this.leftOffset=i,this.rightOffset=t):c?this.leftOffset=i:this.rightOffset=t}n.forEach((e,i,n)=>{const a=i===n.length-1,c=Math.floor(s*e.height/r),u=new xn(0,o,this.width,c);e.setViewBox(u);const h=new xn(this.width-this.rightOffset,o,t,c),d=new xn(0,o,this.leftOffset,c),p=e=>e.setViewBox(e.onTheRight?h:d);if(p(e.axes[0]),e.axes[1]&&p(e.axes[1]),o+=c,!a){const e=new xn(this.leftOffset,o,this.width-this.rightOffset-this.leftOffset,l);this.splitters.push(e),o+=l}});const u=new xn(this.leftOffset,o,this.width-this.rightOffset-this.leftOffset,e);this.xAxis.setViewBox(u),os(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(){this.mainContext.save(),this.mainContext.miterLimit=1,this.drawBackground(this.mainContext);for(const s of this.presenter.panes)s.drawBackground(this.mainContext);this.xAxis.draw(this.mainContext);for(const s of this.presenter.panes)s.draw(this.mainContext);this.drawSplitters(this.mainContext),this.presenter.title.draw(this.mainContext);const e=Gv().config.showGoToLatest,{showGoToLatest:t}=this.presenter.display.chart,i=ie(e)?e:t;this.goToLatestButton.style.display=i&&this.xAxis.canGoToLast()?"block":"none",this.mainContext.restore()}get isHostElementVisible(){return ie(this.el)&&ie(this.el.offsetParent)}redraw(e=!1){this.isHostElementVisible&&(e?this.draw():Gv().redraw(this.presenter.hostElement))}drawBackground(e){const 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}){const i=this.mouseContext;if(i.clearRect(0,0,this.width,this.height),!e)return!1;return!!this.xAxis.drawCrosshair(i,t)&&(this.presenter.display.yAxis.visible&&e.axis.pane.drawYCrosshair(i,t),!0)}drawSplitters(e){const t=(e=>{const t=bn(e);return Mn(vn(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.strokeStyle=t,e.lineWidth=2,this.splitters.forEach(t=>{const{x:i,y:s,width:n,height:r}=t,o=s+r/2;e.beginPath(),e.moveTo(i,o),e.lineTo(i+n,o),e.stroke()})}toTime(e){return this.xAxis.xScale.xToTime(e)}toIndex(e){return this.xAxis.xScale.timeToIndex(e)}toX(e){return this.xAxis.xScale.timeToX(e)}setCursor(e){const t=function(e){switch(e){case y.Arrow:default:return"default";case y.Crosshair:return"crosshair";case y.Hand:return"pointer";case y.Move:return"move";case y.ResizeVertical:return"ns-resize";case y.Grabbing:return"grabbing";case y.ResizeHorizontal:return"ew-resize"}}(e);os(this.el,{cursor:t})}shutdown(){this.listeners.forEach(e=>e()),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&hs(".bcharts-card",this.el).forEach(e=>e.remove()),this.canvasContainer.remove()}getEventRadius(){const e=this.xAxis.xScale.bar.width/2;return Math.max(e,gs.MIN_EVENT_RADIUS)}}class OT{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=us(this.view.el,"div"),as(this.popupElement,{id:`${this.view.presenter.elementId}-custom-event-host`}),os(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"});const e=us(this.popupElement,"a");as(e,{class:"custom-event-close-button"}),os(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()),os(this.popupElement,{visibility:"visible",top:`${e.y}px`,left:`${e.x}px`,width:"310px"}),this.visible=!0}hideValue(){}hide(){this.visible&&(this.hideValue(),os(this.popupElement,{visibility:"hidden"}),this.visible=!1)}}function wT(e,t){if(!((i=e).annotations&&i.annotations.length>0))return;var i;let s=t.annotations||[];t.annotations=s.concat(e.annotations)}const RT='..axes{..plots{.type==="Study"}}';const NT={ok:!1,change:void 0,toApply:void 0};class VT{constructor(e){this.presenter=e,this.clear()}paused=null;undoStack=[];redoStack=[];initial=/* @__PURE__ */new Map;isPaused=!1;clear(e=!1){this.undoStack=[],this.redoStack=[],this.initial=/* @__PURE__ */new Map,e&&this.presenter.allAnnotations.forEach(e=>this.initial.set(e.uid,cA(e,E.Moved)))}done(e){this.isPaused?this.paused=e:(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&&te(this.paused)&&this.done(this.paused),this.paused=null}redo(){this.undoRedo(this.redoStack,this.undoStack,!1)}delete(e){const t={...e,id:"Delete"};this.presenter.handleAnnotationChange(t)}add(e){const t={annotation:e,id:"Add"};this.presenter.handleAnnotationChange(t)}apply(e,t,i){if(!ie(e))return!1;switch(t){case E.None:case E.Undo:case E.Redo:Hv(`Unexpected tool change ${E[t]} for undo/redo`,"warn");break;case E.Created:i?this.delete(e):this.add(e);break;case E.Deleted:i?this.add(e):this.delete(e);break;default:{const t={...e,id:"Update"};this.presenter.handleAnnotationChange(t);break}}const s=this.presenter.allAnnotations.find(t=>t.uid===e.uid),n=i?E.Undo:E.Redo;return ie(s)&&this.presenter.onAnnotationModifiedByTool(s,n),!0}can(e){const t=e?this.undoStack:this.redoStack;if(t.length<1)return NT;const i=k(t),s=i.toolChange;if(!(e&&s!==E.Deleted&&s!==E.Created))return{ok:!0,change:s,toApply:i};const n=U(t,e=>e.uid===i.uid,t.length-2),r=-1!==n?t[n]:null,o=null===r;return o&&!this.initial.has(i.uid)?NT:{ok:!0,change:s,toApply:o?this.initial.get(i.uid):r}}get canUndo(){return this.can(!0).ok}get canRedo(){return this.can(!1).ok}undoRedo(e,t,i){const{ok:s,change:n,toApply:r}=this.can(i);if(!s)return;const o=e.pop();this.apply(r,n,i),t.push(o)}}class HT{constructor(e){this.presenter=e}text=null;align="center";verticalAlign="top";x=0;y=0;style={color:"#333",fontSize:18};update({style:e,...t}){Object.assign(this,t),Object.assign(this.style,e)}draw(e){if(!this.text)return;const{fontFamily:t}=this.presenter.display.chart,{fontSize:i,color:s,fontWeight:n}=this.style,{x:r,y:o,width:a,height:l}=this.presenter.mainPlot.axis.pane.getBounds(),c=r+this.presenter.view.leftOffset,u=r+a-this.presenter.view.rightOffset;let h=c;h="center"===this.align?a/2:"right"===this.align?u:c;let d=o+i;"middle"===this.verticalAlign?d=o+i+l/2:"bottom"===this.verticalAlign&&(d=o+l),h+=this.x,d+=this.y,e.save();const p=n||"normal";e.font=`${p} ${i}px ${t}`,e.textAlign=this.align,e.textBaseline="bottom",e.fillStyle=s,e.fillText(this.text,h,d),e.restore()}}function BT(e={}){const t=this.allPlots;if(!t.every(e=>ie(e.timeSeries)&&e.timeSeries.hasData))return"No data to export";const i=e.excludeHeader??!1,s=e.numDecimals??null,n=e.excludeFields??[],r=e=>{const t=/* @__PURE__ */new Map;return e.main&&(t.set(Ka.DateTime,0),this.data.aggregation.isMultiContract&&!e.isExpression&&t.set(Ka.Symbol,0)),e.curves.forEach(e=>{e.fields.forEach(i=>{n.includes(i.id)||t.set(i,e.shift)})}),Array.from(t)},o=this.data.aggregation.isEndOfDay?gs.FMT_ISO_DATE_ONLY:gs.FMT_EXPORT_ALL_BUT_MILLIS,a=(e,t)=>e===Ka.DateTime?Si(t,o):(e=>ie(s,e)?se(e,s):e)(t)?.toString()??"",l={},c=this.timeline.lastSeriesIndex,u=W(this.mainPlot.timeSeries.container.getTimeData()),h=G(this.timeline,+u,Number,ud),d=(e,t)=>{const i=this.timeline.at(e),s=t.timeSeries.container,n=s.getTimeData(),c=l[t.id]||0,u=G(n,+i,Number,$,c),h=+i===+n[u];return h&&(l[t.id]=u),r(t).map(([t,r])=>{if(0===r)return h?a(t,s.getData(t)[u]):t===Ka.DateTime?Si(i,o):"";{const i=this.timeline.at(e-r),o=G(n,+i,Number,$,0);return+i===+n[o]?a(t,s.getData(t)[o]):""}})},p=e=>{const i=t.map(e).flat();return i.slice(1).every(e=>0===e.length)?null:i.join(",")},m=[];if(!i){const e=e=>{const t=new Array(r(e).length).fill("");return t[0]=(e=>`"${f[e.type]}: ${e.title}"`)(e),t};m.push(p(e)),m.push(p(e=>r(e).map(([e,t])=>`"${e.name}"`)))}const g=[0,0];this.allCurves.forEach(e=>{e.fields.every(e=>n.includes(e.id))||(e.shift<0&&(g[0]=Math.min(g[0],e.shift)),e.shift>0&&(g[1]=Math.max(g[1],e.shift)))});for(let f=h+g[0];f<=c+g[1];f++){const e=p(M(d,f));null!==e&&m.push(e)}return m.join("\n")}function FT(e={}){const t=this.view.mainCanvas,{width:i,height:s}=t,{width:n,height:r,title:o}=e,a=(e,t)=>{const i=document.createElement("canvas");return i.width=e,i.height=t,i.getContext("2d")},l=a(i,s),c=globalThis.devicePixelRatio;if(l.drawImage(t,0,0),l.scale(c,c),te(o)){const e=new HT(this);e.update(o),e.draw(l)}const u=this.mainPlot?.timeSeries.container?.getLastDataPoint(Ka.DateTime);if(te(u)){const{fontFamily:e}=this.display.chart,{fontWeight:i,fontSize:s}=this.mainAxis.config;l.font=`${i} ${1.2*s}px ${e}`,l.textBaseline="top";const n=1.5*s,r=getComputedStyle(t),o=r.getPropertyValue("--app-hc-color"),a=r.getPropertyValue("--app-color-pl"),c={x:gs.CARDS_X_OFFSET,y:gs.CARDS_Y_OFFSET},h=bd(this,u,c,0,!1,0),d=`${h.date} ${h.time??""}`.trim(),[p,m]=[1,5],g=(e,t)=>l.measureText(e).width+t,y=(e,t,i,s,n)=>(l.fillStyle=s,l.fillText(e,t,i),g(e,n)),A=(e,t)=>e.type===f[t],S=e=>{let t=e.name;return e.isMain&&A(e,"Symbol")?t=`${e.description} (${e.name}) [${e.exchange}]`:A(e,"Study")&&(t=`${e.description} ${e.name.substring(e.name.indexOf(" "))}`),t};h.panes.forEach(e=>{const{top:t,left:i,width:s,right:r}=e.bounds,l=i+s-r-m;let u=i+c.x,h=t+c.y;e.plots.some(e=>e.isMain)&&(u+=y(d,u,h,o,m)),e.plots.forEach((e,t)=>{const s=S(e),r=!A(e,"Study")&&e.values.length>1;if(!e.isMain&&t>0){let t=u+g(s,m);e.values.forEach(e=>{r&&(t+=g(e.abbreviation,p)),t+=g(e.value,m)}),t>=l&&(u=i+c.x,h+=n)}u+=y(s,u,h,o,m),e.values.forEach(e=>{r&&(u+=y(e.abbreviation,u,h,a,p)),u+=y(e.value,u,h,e.color,m)})})})}const h=e=>({width:n??i,height:r??s,data:e.toDataURL("image/png")});if(te(n)&&te(r)){const e=a(n,r);return e.drawImage(l.canvas,0,0,n,r),h(e.canvas)}return h(l.canvas)}const kT=/* @__PURE__ */Symbol.for("__ias__");class WT{constructor(e){this.accessor=e,this.defaultTool=XS("Default"),this._activeTool=this.defaultTool,this.timeline=new hd(this),this.undoRedoManager=new VT(this),this.title=new HT(this),this.notifySelectionChanged=Q(qa.CH_ANNSELECTIONCHANGED),this.notifyRecreated=Q(qa.CH_RECREATED),this.notifyDefinitionChanged=Q(qa.CH_DEFINITION_CHANGED)}view;defaultTool;_activeTool;tooltipEnabled=!0;timeline;sentInitialLoadNotification=!1;_hostElement=null;undoRedoManager;title;display;model;data;panes=[];_hasLegend;renderTo;seriesChangedToken="";metaChangedToken="";streamingSubscription=null;_previousMask=0;_ohlcMask;selectedAnnotation;forceResetVisibleRange=!1;_maxOffset=0;_isShutdown=!1;notifySelectionChanged;notifyRecreated;notifyDefinitionChanged;getModel(){return this.model}get isEmpty(){return!ie(this.model)}notifyHost(e,t){J(e,t)}async fromModel(e,t){if(this._isShutdown)return;ie(this.model)&&this.allPlots.forEach(e=>e.shutdown()),this.sentInitialLoadNotification=!1,this.clearSelection(),this.model=e;const i=ue(e);this.data=i.data,this.data.aggregation=No(i.data.aggregation),this.display=i.display,ie(this.display.period)&&(this.display.period=Te(this.display.period)),this.panes=i.panes.map(e=>{const t=new vT(this);return t.fromModel(e),t},this);const s=this.allPlots.map(e=>e.initialize());await Promise.all(s),this._isShutdown||(this.timeline.invalidate(),this.checkZoomAndVisibleRange(e,t),ie(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{const i=!t||function(e,t,i){const s={id:"Aggregation",context:{id:"Get"}},n=Ro(Pv(s,t,i)),r=Ro(Pv(s,e,i));if(GT(n,r))return!0;if(!UT(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!UT(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;const o=Sa(t),a=Sa(e);if(function(e,t){const i=e=>e.curves[0],s=i(e),n=i(t),r=$T.includes(s.style),o=$T.includes(n.style);if(r!==o)return!0;if(!o)return!1;if(s.style!==n.style)return!0;if(t.inputs){if(GT(fe(e.inputs),fe(t.inputs)))return!0}return!1}(o,a))return!0;const l=(e,t)=>e.type===t,c=e=>{const t=e.toLowerCase();return l(a,e)&&l(o,e)&&o[t]!==a[t]},u=o.type!==a.type,h=c("Forward"),d=c("Expression"),p=c("Symbol");return u||h||d||p}(e,t,this);this.view.resetZoomAndVisibleRange=i,i&&(this._maxOffset=0)}}closeView(){ie(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(ie(this.view)?this.view.reinitialize():(this.view=new DT,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){ie(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,ie(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(qa.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(){const e=[];return this.panes.forEach(t=>{t.axes.forEach(t=>{e.push(t)})}),e}get plotAnnotations(){const e=[];return this.allPlots.forEach(t=>{t.annotations?.forEach(t=>{e.push(t)})}),e}get allAnnotations(){const e=[];return this.allAxes.forEach(t=>{t.annotations.forEach(t=>{e.push(t)})}),e}get allPlots(){const 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(){const 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(){const 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;const i=t.series,s=e=>e.timeSeries===i||e.eventsSeries===i,n=this.allPlots.find(s);if(!ie(n))return;const r=ie(n)&&n.main;let o=!1,a=!1;if(e===qa.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;o=!0}const l=ie(t.index)?i.container.getTimeData()[t.index]:null,c=e===qa.TS_EVENTSCHANGED,u=this.view.xAxis,h=u.xScale;if(e===qa.TS_MANYCHANGED||c){if(r&&this.data.checkRange){if(ie(this.display.xAxis.visibleRange)){const e={id:"Period",context:{range:this.display.xAxis.visibleRange}};return e[kT]=!0,void this.accessor.change(e)}delete this.data.checkRange}n.isForward&&this.fixupDensityForForwards();const e=this.view.xAxis?.getMaxCurveOffset()??0;if(n.isStudy){e!==this._maxOffset&&(this._maxOffset=e,u.goToLatest(!0));n.invalidateAssociatedAnnotations("NewChunkArrived")}if((n.isSeasonal&&!u.wasVisibleRangeChanged||this.display?.xAxis?.isOrdinal)&&u.goToLatest(!0),t.part===P.Tail){const e=G(this.timeline,l,Number,ud);u.shouldScrollIntoView(e)&&h.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach(e=>e.invalidatePriceMappingCache()),o=!0}else if(e===qa.TS_DATAPOINTADDED){const e=this.timeline.mergeDateIntoTimeline(l);-1!=e&&u.shouldScrollIntoView(e)?(h.shiftBars(1),o=!0):a=!0,n.isStudy&&n.invalidateAssociatedAnnotations("DataPointAdded")}else e===qa.TS_DATAPOINTCHANGED&&(a=!0,n.isStudy&&n.invalidateAssociatedAnnotations("DataPointChanged"));if(!c&&s(this.mainPlot)&&i.hasData&&0===i.container.size&&this.notifyHost(qa.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),o&&this.view.recalculateLayout(),a){o&&Hv("Performance : redundant call to recompute price domains (layout recalculation took care of this)","warn");this.allAxes.filter(e=>e.plots.includes(n)).forEach(e=>{e.setDomain(),ie(l)&&e.updateFullDomain(l)})}if(!this.sentInitialLoadNotification&&e===qa.TS_MANYCHANGED){if(this.allPlots.every(e=>e.timeSeries&&e.timeSeries.hasData)){this.sentInitialLoadNotification=!0,this.notifyHost(qa.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),HA(this);const e=this.display.period===gs.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(h.fitAllData=!0,h.adjustDomain())}}this.view.redraw()}onMetaChanged(e,t){e===qa.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){const t=this.panes.indexOf(e.pane),i=e.pane.axes.indexOf(e),s={chart:this.accessor,paneIndex:t,axisIndex:i};this.notifyHost(qa.CH_AXISSCALECHANGED,s)}get previousMask(){return ie(this._previousMask)||(this._previousMask=Za(Ka.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some(e=>e.updated&&t)}get hasLegend(){return ie(this._hasLegend)||(this._hasLegend=Gv().config.mode===v[v.cmdtyView]),this._hasLegend}onStreamingUpdates(e){ie(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 ie(this._ohlcMask)||(this._ohlcMask=Za(Ka.Open,Ka.High,Ka.Low,Ka.Close,Ka.PreviousClose)),this._ohlcMask}updateMatches(e,t){if(0===(e&this.ohlcMask))return!1;const i=(e,t)=>te(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 Gv().getRecordSource().subject.pipe(uc(e=>e.filter(e=>this.updateMatches(e.updated,e.data.symbol))),pc(e=>e.length>0)).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return ie(this._hostElement)?this._hostElement.id:null}initialize(e){if(this._hostElement=e instanceof HTMLElement?e:rs(`#${e}`),!this._hostElement)throw new Error(`There is no element ${e} in the DOM`);this.renderTo=e,this.seriesChangedToken=ap.subscribe(qa.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=ap.subscribe(qa.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return ap.unsubscribe(this.seriesChangedToken),ap.unsubscribe(this.metaChangedToken),ie(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach(e=>e.shutdown()),this.model=void 0,this.closeView(),this.notifyHost(qa.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(){ie(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(y.Arrow)}print(e={}){const t=us(document.body,"iframe");t.src="",t.style.display="none",t.onload=()=>{const{title:i}=e,s=FT.call(this,{title:i}),n=new Image;n.src=s.data,n.style.width="100%";var r;t.contentDocument.body.appendChild(n),(r=n,new Promise(e=>{const t=()=>{r&&void 0!==r.naturalWidth&&0!==r.naturalWidth&&r.complete?e():setTimeout(t,150)};t()})).then(()=>{const e=t.contentWindow;t.focus(),e.print(),t.remove()})}}setTitle(e,t=!1){this.title.update(e),ie(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;const t=this.display.tooltip.mode===gs.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){const t=this.display.tooltip,i=q();!e&&t.visible&&t.mode===gs.TOOLTIP_CARDS&&hs(".bcharts-card",this.hostElement).forEach(e=>{const t=e.classList.contains("bcharts-card-move");if(i&&t)return;e.classList.contains("bcharts-legend")||(e.style.display="none")})}handleAnnotationChange(e){const 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 ro(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);const i=this.allAnnotations.find(t=>t.uid===e.uid);if(void 0!==i){const t=i.axis,s=t[`${e.id.toLowerCase()}Annotation`];if("function"==typeof s)return s.call(t,i,e),void("Delete"!==e.id||e.isUndoRedo||this.onAnnotationModifiedByTool(i,E.Deleted))}throw new Error(`Unknown sub-action ${e.id} for action ${gs.ANN_ACTION_ID}`)}getPlotInfoFromDomId(e){const t=e.attributes.getNamedItem("data-plot-id").value,i=this.allPlots,s=i.findIndex(e=>e.id===t);return{type:f[i[s].type],index:s}}getSimplePlot(e,t){return this.accessor.change({id:"Plot",context:{id:gs.ACTION_GET,type:e,index:t}})[0]}onCardClicked(e){const t=this.getPlotInfoFromDomId(e),i=this.getSimplePlot(t.type,t.index),s={chart:this.accessor,plot:i};this.notifyHost(qa.CH_CARDPLOTCLICKED,s)}deletePlotClicked(e){const 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}});const s={chart:this.accessor,plot:i};this.notifyHost(qa.CH_CARDPLOTREMOVED,s)}showHidePlotClicked(e){this.defaultTool.hideCrosshairAndTooltips(this.view,!0);const 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}});const s=this.getSimplePlot(t.type,t.index),n={chart:this.accessor,plot:s,visible:i};this.notifyHost(qa.CH_CARDPLOTVISIBILITYCHANGED,n)}plotMoreActionsClicked(e,t){const i=this.getPlotInfoFromDomId(e),s=this.getSimplePlot(i.type,i.index),n={x:t.clientX,y:t.clientY},r={chart:this.accessor,plot:s,offset:n,originalEvent:t};this.notifyHost(qa.CH_PLOTNEEDSCONTEXTMENU,r)}onMovePaneClicked(e){const t=parseInt(e.attributes.getNamedItem("data-pane").value),i="Down"===e.attributes.getNamedItem("data-dir").value,s=t+(i?1:0),n=t-(i?0:1);setTimeout(()=>{this.accessor.change({id:"MovePane",context:{from:s,to:n}}),this.notifyHost(qa.CH_PANESREORDERED,{chart:this.accessor})})}onAnnotationsUpdated(e,t=!1){const i=this.allAxes.indexOf(e),s=e.annotations.map(e=>e.toModel()),n=oo(this.model,`..axes[${(r={axisIndex:i,annotations:s}).axisIndex}]`,e=>(e.annotations=r.annotations,e));var r;try{this.model=Wa(n,gs.CHART_SCHEMA)}catch(o){Hv(`Cannot update annotation (corrupts definition), error is: ${o.message}`,"error")}t&&this.view.draw(),this.notifyHost(qa.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,i=!0){if(t!==E.None){if(i&&t!==E.Undo&&t!==E.Redo){const i=cA(e,t);this.undoRedoManager.done(i)}const s=uA(e);s.toolChange=E[t],this.notifyHost(qa.CH_ANNMODIFIEDBYTOOL,s)}}onAnnotationDone(e,t){const i={id:e,chart:this.accessor,toolChange:E[t]};this.notifyHost(qa.CH_ANNMODIFIEDBYTOOL,i)}onPaneHeightsUpdated(){const e=this.panes.map((e,t)=>({index:t,relativeHeight:e.height}));this.model=function(e,t){let i=e;return t.paneHeights.forEach(e=>{i=oo(i,`..panes[${e.index}]`,t=>(t.height=e.relativeHeight,t))}),i}(this.model,{paneHeights:e}),this.notifyHost(qa.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){const e=this.mainPlot.timeSeries.container;if(!ie(e)||0===e.size)return null;const t=e.getTimeData();return{dataRange:{from:W(t).getTime(),to:k(t).getTime()},barCount:e.size}}}function UT(e,t){return e?.from===t?.from&&e?.to===t?.to}const $T=["Renko","Range","LineBreak","Kagi","PointAndFigure"];function GT(e,t){for(const i of Object.keys(e))if(e[i]!==t[i])return!0}const zT="MARKED_FOR_DELETION";function YT(e,t){if(0===t.plots.length)return e;let i=e;return t.plots.forEach(e=>{const t=qT(e.index),s=XT(i,t);ie(s)&&s.type===e.type&&(i=oo(i,t,e=>(e[zT]=!0,e)))}),i=oo(i,`..plots{.${zT} === true}`,e=>gs.NULL_OBJECT),Ua(i)}function jT(e,{main:t,type:i,index:s},n){const r="..plots{.main === true}",o=ro(e,"..panes").map((e,t)=>{const i=1===ro(e,r).length;return ro(e,"..axes").map((e,s)=>{const o=1===ro(e,r).length;return ro(e,"..plots").map(e=>{const r=function(e,t,i,s){const n=f[e.type],r={curves:ue(e.curves),type:e.type};r.precision=e.precision,r.visible=e.visible;const o=(e,t)=>{ie(e[t])?r[t]=e[t].map(e=>ue(e)):r[t]=[]},a=(e,t,i=!1)=>{!0===t.main&&(e.main=!0,e.showPrevious=t.showPrevious,i&&null!=t.events&&(e.events=ue(t.events)))},l=(e,t=e=>!0)=>{ie(s)&&(e.subtitles=s.allPlots.filter(e=>e.type===n).filter(t).map(e=>e.title))};switch(n){case f.Symbol:{const t=e;r.title=t.symbol;const i=t=>{o(e,"inputs"),0===r.inputs.length&&(r.inputs=ue(t))};switch(r.curves[0].style){case"Renko":i(gs.DEFAULT_RENKO_INPUTS);break;case"Kagi":i(gs.DEFAULT_KAGI_INPUTS);break;case"PointAndFigure":i(gs.DEFAULT_PNF_INPUTS);break;case"LineBreak":i(gs.DEFAULT_LINEBREAK_INPUTS);break;case"Baseline":i(gs.DEFAULT_BASELINE_INPUTS)}a(r,e,!0);break}case f.Study:{o(e,"inputs");const s=Ur(e.study),n=r.inputs,a="AVWAP"===e.study,l=e=>a&&"Anchor"===e.name?new Date(e.value).toLocaleString():e.value,c=0===n.length?"":` (${n.map(l).join(", ")})`,u=r.curves.map(e=>Number(e.shift)).filter(e=>e>0),h=0===u.length?"":` [${u.join(", ")}]`;r.title=`${s.id}${c}${h}`,r.studyId=s.id,o(e,"levels"),o(e,"bands"),r.placement=t?i?"overlay":"withMain":"standalone",r.detachedScale=e.detachedScale;break}case f.BalanceSheet:case f.IncomeStatement:{const t=Ka[e.curves[0].fields[0]];r.title=`${t.name} (${e.fundamental.substring(0,1)})`,r.fundamentalId=t.id,r.frequency=e.fundamental;break}case f.Expression:r.title=e.expression,a(r,e);break;case f.Forward:r.title=e.forward,o(e,"offsets"),l(r),a(r,e);break;case f.Seasonal:r.title=e.seasonal,l(r,e=>e.refSeasonal===r.title),o(e,"offsets"),a(r,e);break;default:throw new Error("Unexpected plot type")}return r}(e,i,o,n);return r.paneIndex=t,r.axisIndex=s,r})})}).flat(2).map((e,t)=>(e.index=t,e));if(t)return o.filter(e=>e.main);if(ie(i)){const e=o.filter(e=>e.type===i);return ie(s)?e.filter(e=>e.index===s):e}return o}function KT(e,t){"Study"===e.type&&t.curves?.forEach(e=>delete e.varyColorPerBar),function(e){const t=f[e.type];return t===f.Forward||t===f.Seasonal}(e)?ie(t.curves)&&(e.curves=t.curves):function(e,t){if(i=t,void 0!==i&&t.length===e.length)for(let s=0;s<e.length;++s){const i=t[s],n=e[s];de(n,i);const r=["shift","dashStyle","lineSmoothing","lineMarker"];for(const e of r){const t=i[e];ie(t)&&(n[e]=t)}}var i}(e.curves,t.curves);const i=f[t.type],s=e;if(ie(t.precision)?s.precision=t.precision:delete s.precision,i===f.Symbol)e.symbol=t.symbol;else if(i===f.Study)!function(e,t,i){const s=fe(e),n=fe(t);de(s,n);const r=(o=n,Object.keys(o).map(e=>({name:e,value:o[e]})));var o;r.length>0&&(i.inputs=r)}(e.inputs,t.inputs,e),["bands","levels","detachedScale"].forEach(i=>function(e,t,i){t[i]&&(e[i]=t[i])}(e,t,i));else if(i!==f.BalanceSheet&&i!==f.IncomeStatement||!t.frequency){if(i===f.Expression){const i=e;ie(t.expression)&&(i.expression=t.expression)}else if(i===f.Forward){const i=e;ie(t.offsets)&&(i.offsets=t.offsets),ie(t.forward)&&(i.forward=t.forward)}else if(i===f.Seasonal){const i=e;ie(t.offsets)&&(i.offsets=t.offsets),ie(t.seasonal)&&(i.seasonal=t.seasonal),ie(t.usesInAverage)&&(s.usesInAverage=t.usesInAverage),_o(i)}}else e.fundamental=t.frequency}const qT=e=>`..plots[${e}]`;function XT(e,t){const i=ro(e,t);return 1!==i.length?null:i[0]}const ZT=["withMain","overlay","standalone","clone"];function JT(e){return{axes:[{plots:[]}],height:e.display.chart.newPaneHeight??1}}function QT(e){const t=JT(e);return e.panes.push(t),t}function ev(e,t){const i=te(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:QT(e),s=i.axes[0];return t.oppositeScale??!1?hv(i,s):s}function tv(e,t,i){let s=null;const{mainPane:n,mainAxis:r}=Ta(e);switch(t){case"withMain":s=hv(n,r);break;case"overlay":s=r;break;case"standalone":s=QT(e).axes[0];break;case"clone":if("number"==typeof i){const t={main:!1,index:i,type:f[f.Study]},n=jT(e,t).find(e=>e.index===t.index);s=ro(e,`..panes[${n.paneIndex}]..axes[${n.axisIndex}]`)[0]}}return s}const iv=[{fields:[Ka.Close.id],colors:["#888"],style:"Line",lineWidth:2,varyColorPerBar:!1,visible:!0}];function sv(e){return"Symbol"===e.type}const nv={attributes:["OpenVsClose"],colors:["#b63400","#007f3e","#1664db"],fields:["Open","High","Low","Close","Change"],style:"Candlestick",varyColorPerBar:!0,lineWidth:1};let rv=0;const ov=["#0d223a","#8abc21","#910000","#2f7ed8","#42ccdc","#bf95df","#860262","#e5daa3","#4682e8","#aaa9c1","#fcccdc","#f66b00","#d875be","#e84b46"],av="Symbol",lv="Expression";function cv(e,t){const i={curves:[{attributes:[],colors:ov.slice(rv,rv+1),fields:e?[Ka.Last.id]:[Ka.Close.id],style:"Line",dashStyle:"Solid",varyColorPerBar:!1,lineWidth:2,lineMarker:void 0,lineSmoothing:void 0}]};return delete t.oppositeScale,pe(i,t),ie(t.curves)&&de(i.curves,t.curves),rv=(rv+1)%ov.length,i}const uv='..plots{(.type === "Symbol" || .type === "Expression") && .main !== true}';function hv(e,t){let i=e.axes.find(e=>e!==t);return ie(i)||(i={plots:[]},e.axes.push(i)),i}const dv=()=>gs.NULL_OBJECT;function pv(e){return oo(e,"..axes.annotations",dv)}function fv(e){return Ua(oo(e,'..plots{.type === "Symbol" && .main !== true}',dv))}const mv=".display.chart.previous";function gv(e,t,i){const s=[],n=i.allPlots[t.index];if(n?.type!==f[t.type])return s;const r=i.panes.indexOf(n.axis.pane),o=0===r,a=r===i.panes.length-1,l=1===i.panes[r].axes.reduce((e,t)=>e+t.plots.length,0);return o||s.push("ExistingAbove"),l||s.push("NewAbove"),a||s.push("ExistingBelow"),l||s.push("NewBelow"),s}function yv(e,t,i){const s=[],n=i.allPlots[t.index];if(n?.type!==f[t.type])return s;const r=n.axis.pane,o=n.axis===r.axes[0],a=r.axes.some(e=>e.plots.some(e=>n!==e&&!e.hasDetachedScale)),l=n.hasDetachedScale;return(o||l)&&s.push("SecondaryAxis"),o&&!l||s.push("PrimaryAxis"),a&&s.push("NoAxis"),s}function Av(e,t){const i=e.panes[t],s=i.axes.map(e=>e.plots.reduce((e,t)=>e+(t.detachedScale?1:0),0)),n=i.axes.length;return i.axes.forEach((e,t)=>{const r=s[t],o=e.plots.length;if(!(0===r||r<o)&&r===o)if(n>1&&1===r){const r=(t+1)%n;if(s[r]<i.axes[r].plots.length){const t=e.plots.find(e=>e.detachedScale);t&&(i.axes[r].plots.push(t),e.plots=e.plots.filter(e=>!e.detachedScale),s[r]++)}}else{const t=e.plots.find(e=>e.detachedScale);t&&(t.detachedScale=!1)}}),e}function Sv(e,t){const i=e.allPlots[t],s=e.panes.indexOf(i.axis.pane),n=e.panes[s].axes.indexOf(i.axis);return{pane:s,axis:n,plot:e.panes[s].axes[n].plots.findIndex(e=>e===i)}}const Tv={MainPlot:Ma,Aggregation:{Update:Ia,Get:function(e,t,i){return ue(e.data.aggregation)}},Period:{Update:function(e,t,i){const s=ie(t.period),n=ie(t.range),r=ie(t.density),o=e=>e?1:0;if(o(s)+o(n)+o(r)>1)throw new Error("Cannot set more than one of: period, range, density.");if(s&&(e.display.period=t.period,$o(e),zo(e)),n)if(ie(e.display.period)&&!Da(e.display.period)||(e.display.xAxis.visibleRange=t.range),Go(e),zo(e),ie(i)){const s=function(e){const t=e.getDataStats();return null===t?null:t.dataRange}(i),n=No(e.data.aggregation),r=i.data.aggregation,o=(l=r,(a=n).unit!==l.unit||a.size!==l.size||a.spec!==l.spec||!ie(s)||e.data.checkRange);let c=o;if(!o){const{from:e,to:i}=s,{from:n,to:r}=t.range;c=n<e||n>i||r<e||r>i}c&&(e.data.range=t.range),delete e.data.checkRange}else e.data.checkRange=!0;var a,l;return r&&(e.display.density=t.density,$o(e),Go(e)),(s||n||r)&&(Uo(e),i&&(i.forceResetVisibleRange=!0)),e},Delete:function(e,t,i){return ie(t.period)&&t.period&&(delete e.display.period,_a(e),i&&(i.forceResetVisibleRange=!0)),e}},Crosshair:{Update:function(e,t){let[i,s]=re(t.crosshair);const{color:n,dashStyle:r}=t.horizontal||{},{color:o,dashStyle:a}=t.vertical||{},l=(e,t,i)=>{t&&(e.color=t),i&&(e.dashStyle=i)};let c=oo(e,".display.xAxis.crosshair",e=>(e.enabled=i,l(e,o,a),e));return c=oo(c,".display.yAxis.crosshair",e=>(e.enabled=s,l(e,n,r),e)),ie(t.haloTracking)&&"boolean"==typeof t.haloTracking&&(c=oo(c,".display.chart",e=>(e.plotHover=t.haloTracking,e))),c},Get:function(e,t,i){const s=t=>ro(e,t)[0],n=s(".display.chart"),r=s(".display.xAxis.crosshair"),o=s(".display.yAxis.crosshair");let a="none";return r.enabled&&o.enabled?a="both":r.enabled?a="vertical":o.enabled&&(a="horizontal"),{crosshair:a,horizontal:{color:o.color,dashStyle:o.dashStyle},vertical:{color:r.color,dashStyle:r.dashStyle},haloTracking:n.plotHover}}},Tooltip:{Update:function(e,t){return oo(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){const s=ro(e,".display.tooltip")[0];return{visible:s.visible,mode:s.mode,showMainTitle:s.showMainTitle,mainTitle:s.mainTitle}}},Events:function(e,t){const i=ue(t);return Object.keys(t).forEach(e=>{gs.EVENTS.includes(e)||delete i[e];let s=t[e];"boolean"==typeof s?s={show:t[e]}:Object.keys(s).forEach(e=>{gs.EVENT_PROPERTIES.includes(e)||delete s[e]}),i[e]=s}),oo(e,Aa,e=>("Symbol"===e.type&&(e.events=e.events||{},Object.keys(i).forEach(t=>{e.events[t]=e.events[t]||{},he(e.events[t],i[t],!1)})),e))},Scale:{Update:function(e,t){let i=oo(e,"..panes[0]..axes",e=>(te(t.scale)&&(e.scale=t.scale),e));return i=oo(i,".display.xAxis",e=>(te(t.marginBars)&&(e.marginBars=t.marginBars),te(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),te(t.ordinalName)&&(e.ordinalName=t.ordinalName),te(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e)),i=oo(i,".display.yAxis",e=>{(ie(t.minPadding)||ie(t.maxPadding))&&Hv("The 'minPadding' and 'maxPadding' are deprecated (ignored)","warn");const i=te(t.preventLabelOverlap)&&!te(t.preventVerticalLabelOverlap);i&&Hv("The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'","warn");const s=i?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return te(s)&&(e.preventLabelOverlap=s),ie(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),ie(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),e}),ie(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach(e=>{const{axis:t,text:s,index:n,paneIndex:r}=e;if(ie(t,s,n)&&"vertical"===t&&Number.isInteger(n)){i=oo(i,`..panes[${r??0}]..axes[${n}]`,e=>ie(e)?(e.label=s,e):gs.NULL_OBJECT)}}),te(t.contractTransition)&&(i=oo(i,".display.xAxis",e=>(de(e.contractTransition,t.contractTransition),e))),te(t.cycleTransition)&&(i=oo(i,".display.xAxis",e=>(de(e.cycleTransition,t.cycleTransition),e))),i},Get:function(e,t,i){const{mainAxis:s}=Ta(e),n=ro(e,".display.xAxis")[0],r=ro(e,".display.yAxis")[0];return{scale:s.scale,marginBars:n.marginBars??0,preventLabelOverlap:r.preventLabelOverlap,preventVerticalLabelOverlap:r.preventLabelOverlap,preventHorizontalLabelOverlap:n.preventLabelOverlap,snapAnnotationsToPrices:r.snapAnnotationsToPrices,nonEodLabelWithDate:n.nonEodLabelWithDate??!1,includePercentChangeWithLastValue:r.includePercentChangeWithLastValue??!1,ordinalName:n.ordinalName??"",contractTransition:n.contractTransition,cycleTransition:n.cycleTransition}}},Other:{Update:function(e,t,i){let s=e;if(ie(t.comparisonMode)&&"string"==typeof t.comparisonMode&&le(d,t.comparisonMode)&&(s=oo(s,`..panes{${Aa}}.axes`,e=>(e.comparison=t.comparisonMode,e))),ie(t.gridLines)){const[e,i]=re(t.gridLines);s=oo(s,".display.xAxis.gridLines",t=>(t.visible=e,t)),s=oo(s,".display.yAxis.gridLines",e=>(e.visible=i,e))}if(ie(t.minorGridLines)){const[,e]=re(t.minorGridLines);s=oo(s,".display.yAxis.minorGridLines",t=>(t.visible=e,t))}ie(t.newPaneHeight)&&"number"==typeof t.newPaneHeight&&(s=oo(s,".display.chart{.newPaneHeight > 0}",e=>(e.newPaneHeight=t.newPaneHeight,e))),ie(t.showNavigator)&&"boolean"==typeof t.showNavigator&&(s=oo(s,".display.scrollbar",e=>(e.visible=t.showNavigator,e))),ie(t.plotHover)&&"boolean"==typeof t.plotHover&&(s=oo(s,".display.chart",e=>(e.plotHover=t.plotHover,e))),ie(t.showLastValue)&&"string"==typeof t.showLastValue&&(s=oo(s,".display.yAxis",e=>(e.showLastValue=t.showLastValue,e))),ie(t.showMinMaxArc)&&"boolean"==typeof t.showMinMaxArc&&(s=oo(s,".display.chart",e=>(e.showMinMaxArc=t.showMinMaxArc,e))),ie(t.showGoToLatest)&&"boolean"==typeof t.showGoToLatest&&(s=oo(s,".display.chart",e=>(e.showGoToLatest=t.showGoToLatest,e))),ie(t.showLegend)&&"boolean"==typeof t.showLegend&&(s=oo(s,".display.chart",e=>(e.showLegend=t.showLegend,e)),t.showLegend||i.view.removeLegend()),ie(t.allAnnotationsLocked)&&"boolean"==typeof t.allAnnotationsLocked&&(s=oo(s,".display",e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e))),ie(t.exprSkipLeadingEmpty)&&"boolean"==typeof t.exprSkipLeadingEmpty&&(s=oo(s,".data",e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e)));const n=[];if(ie(t.extendedHours)&&"boolean"==typeof t.extendedHours&&(s=oo(s,".data",e=>(e.extendedHours=t.extendedHours,e))),ie(t.realTimeCboeBzx)&&"boolean"==typeof t.realTimeCboeBzx&&(s=oo(s,".data",e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&n.push("realTimeCboeBzx"),e.realTimeCboeBzx=t.realTimeCboeBzx,e))),ie(t.buildContinuation)&&"boolean"==typeof t.buildContinuation&&(s=oo(s,".data",e=>(e.buildContinuation=t.buildContinuation,e))),n.length>0){const e={chart:i.accessor,hostPropsChanged:n};i.notifyHost(qa.CH_HOST_PROPS_CHANGED,e)}return s},Get:function(e,t,i){const s=ro(e,`..panes{${Aa}}.axes.comparison`)[0],n=e.display,r=(e,t)=>ce(e,!1,t,"visible"),o=e=>function(e,t){const i=e=>ie(e)&&"boolean"==typeof e&&e,s=i(e),n=i(t);return s&&n?"both":s?"vertical":n?"horizontal":"none"}(r(n.xAxis,e),r(n.yAxis,e)),a=ce(n.chart,!0,"showLegend");return{comparison:s,gridLines:o("gridLines"),minorGridLines:o("minorGridLines"),newPaneHeight:n.chart.newPaneHeight,showLastValue:n.yAxis.showLastValue,showLegend:a,showMinMaxArc:n.chart.showMinMaxArc,allAnnotationsLocked:n.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){const i=Ur(t.studyId);if(!te(i))return Hv(`Unknown or unavailable study with the id '${t.studyId}'`,"error"),e;const s=Sa(e),n=Yr(i);if(s.type===f[f.Expression]&&n)return Hv(`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;const r=t.placement||(i.meta.overlay?"overlay":"standalone"),o={type:"Study",study:t.studyId,visible:!0};"overlay"===r&&"VOL"===t.studyId&&(o.detachedScale=!0),void 0!==t.curves&&(o.curves=i.defaults.curves),KT(o,t);const a=tv(e,r,t.cloneIndex);ie(a)&&a.plots.push(o);const l=e.data.aggregation;return xa(e,"Tick"===l.unit&&"None"===l.spec)}(e,t);case"IncomeStatement":case"BalanceSheet":return function(e,t){const i=Sa(e);if(i.type!==f[f.Symbol])throw new Error("Cannot add fundamental to the chart whose main plot is not a Symbol plot.");const s=i.symbol,n={curves:[{fields:[t.fundamentalId],lineWidth:2,style:"Line",varyColorPerBar:!1,visible:!0,colors:["#888"]}],fundamental:"Quarter",symbol:s,type:h[Ka[t.fundamentalId].category],visible:!0};return KT(n,t),function(e,t){e.panes.push({axes:[{plots:[t]}]})}(e,n),e}(e,t);case"Expression":return function(e,t){const i=Sa(e),s={curves:ue(sv(i)?i.curves:iv),expression:"",type:"Expression",visible:!0};return KT(s,t),ev(e,t).plots.push(s),e}(e,t);case"Symbol":return function(e,t){const i=Sa(e),s=Gv().getDefaultMultiFieldCurve(),n=ie(s)?s:nv,r=i.curves?.length,o={curves:r===t.curves.length&&1===r?ue(sv(i)?i.curves:[n]):t.curves,symbol:"",type:"Symbol",visible:!0};return KT(o,t),ev(e,t).plots.push(o),e}(e,t);case"Seasonal":return function(e,t){const i={curves:ue(iv),offsets:[0],seasonal:"",type:"Seasonal",visible:!0,main:!1};return KT(i,t),t.paneIndex=t.paneIndex??0,ev(e,t).plots.push(i),e}(e,t);default:throw new Error("Unexpected plot type '${type}', not supported currently")}},Get:jT,Delete:YT,Update:function(e,t,i){if(ie(t.placement)&&!ZT.includes(t.placement))throw new Error(`Unknown placement: ${t.placement}`);const s=t.main?Aa:qT(t.index),n=XT(e,s);if(!te(n)||te(t.type)&&n.type!==t.type)return e;if(te(t.visible))return n.visible=t.visible,e;if(n.main&&function(e){const t=f[e.type];return t===f.Symbol||t===f.Expression}(n)){if(t.curves){const i=e=>e.curves[0].style===o[o.Range],[s,r]=[i(n),i(t)],a=!s&&r;s&&!r?e=Ia(e,{unit:"Day",size:1,spec:"None"}):a&&(e=Ia(e,{unit:"Intraday",size:100,spec:"PerRange"}))}t.type||(t.type=n.type);const i=n;return ie(t.precision)?i.precision=t.precision:delete i.precision,ie(t.showPrevious)&&(e=oo(e,Aa,e=>(e.showPrevious=t.showPrevious,e))),t.curves?Xo(e,t):e}{let n=oo(e,s,e=>(KT(e,t),e));const r=jT(n,t,i).find(e=>e.index===t.index);if(!ie(r))return e;if(!(t.type===f[f.Study]&&ie(t.placement)&&t.placement!==r.placement))return n;const o=XT(n,s);n=YT(n,{plots:[{index:t.index,type:t.type}]});const a=tv(n,t.placement);return null!==a&&a.plots.push(o),n}}},Compare:{Update:function(e,t){const i=function(e){return ie(e.symbols)&&(Hv("Use of 'symbols' for Compare API is deprecated. Please see docs for the latest version which supports more plot types","warn"),e.plots=e.symbols.map(e=>(e.type=av,e))),e.plots?.some(e=>ie(e.leftScale))?(Hv("Use of 'leftScale' for Compare API is deprecated. Please use 'oppositeScale'","warn"),e.plots.map(e=>{const t=e.leftScale;return delete e.leftScale,{...e,oppositeScale:t}})):e.plots}(t),{yes:s,no:n}=V(i,e=>e.oppositeScale??!1),{mainPane:r,mainAxis:o}=Ta(e);r.alignOnExpirations=t.alignOnExpirations||!1;const a=hv(r,o),l=e=>![av,lv].includes(e.type);a.plots=a.plots.filter(l);const c=o.plots.filter(e=>e.main||l(e)),u="Tick"===e.data.aggregation.unit;rv=0;const h=M(cv,u);return o.plots=c.concat(n.map(h)),s.length>0&&(a.plots.push(...s.map(h)),a.comparison=o.comparison,a.scale=o.scale),Ua(e)},Get:function(e,t){const i=ro(e,uv),{mainPane:s,mainAxis:n}=Ta(e),r=[];for(const o of i){const e=n.plots.includes(o),t=o.type.toLowerCase(),i={curves:ue(o.curves),type:o.type,[t]:o[t],leftScale:!e};r.push(i)}return{plots:r,alignOnExpirations:s.alignOnExpirations}}},Annotation:{Get:function(e,t,i){const s=ro(e,"..panes").map((e,t)=>ro(e,"..axes").map((e,i)=>ro(e,".annotations").map(e=>({...e,paneIndex:t,axisIndex:i})))).flat(2).map((e,t)=>({...e,index:t}));return ie(t.index)&&Number.isFinite(t.index)?t.index<s.length?[s[t.index]]:gs.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=ue(e);if(t.strip.main){const e=Sa(i),t=e.type.toLowerCase();e[t]=gs.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(i=pv(i)),t.strip.compare&&(i=fv(i)),i=oo(i,".data",e=>(e.range&&(delete e.range,e.checkRange=!0),e)),i},Outline:function(e,t,i){const s=jT(e,{main:!0},i)[0],n=s.title===gs.PLACEHOLDER_SYMBOL_NAME,r="Symbol"===s.type,o="Expression"===s.type,a=ca(s.title);let l=[];return o&&!la(a)?l=a.symbols:n||(l=[s.title]),{isTemplate:n,isDefinition:!n,main:{isSymbol:r,isExpression:o,symbols:l,title:n?null:s.title},compare:ro(e,uv).map(e=>e.symbol),annotations:ro(e,"..annotations").map(e=>e.id),studies:jT(e,{type:"Study"},i).map(e=>e.title)}},Theme:{Update:function(e,t){let i=e;const{backgroundColor:s,axis:{gridLinesColor:n,textColor:r,crosshairColor:o,gridLinesStyle:a},fontSize:l}=t,{chart:c,xAxis:u,yAxis:h}=l||{};if((s||c)&&(i=oo(e,".display.chart",e=>(s&&(e.backgroundColor=s),c&&(e.fontSize=c),e))),n){const e=e=>(e.color=n,e);i=oo(i,".display.xAxis.gridLines",e),i=oo(i,".display.yAxis.gridLines",e),i=oo(i,".display.yAxis.minorGridLines",e)}if(a){const e=e=>(e.dashStyle=a,e);i=oo(i,".display.xAxis.gridLines",e),i=oo(i,".display.yAxis.gridLines",e),i=oo(i,".display.yAxis.minorGridLines",e)}if(r){const e=e=>(e.textColor=r,e);i=oo(i,".display.xAxis",e),i=oo(i,".display.yAxis",e)}if(o){const e=e=>(e.color=o,e);i=oo(i,".display.xAxis.crosshair",e),i=oo(i,".display.yAxis.crosshair",e)}if(u||h){const e=e=>t=>(t.fontSize=e,t);u&&(i=oo(i,".display.xAxis",e(u))),h&&(i=oo(i,".display.yAxis",e(h)))}return i},Get:function(e,t,i){const{chart:s,xAxis:n,yAxis:r}=e.display||{},{fontSize:o,backgroundColor:a}=s||{},{fontSize:l,gridLines:c,textColor:u,crosshair:h}=n||{},{color:d,dashStyle:p}=c||{},{fontSize:f}=r||{},{color:m}=h||{};return{backgroundColor:a,axis:{gridLinesColor:d,textColor:u,crosshairColor:m,gridLinesStyle:p},fontSize:{chart:o,xAxis:l,yAxis:f}}}},Clear:function(e,t,i){const{paneIndex:s,annotations:n,studies:r}=t||{},o=`..panes${Number.isInteger(s)?`[${s}]`:""}`;let a=e;const l=e=>gs.NULL_OBJECT;if(!0===n){const e=e=>i.onAnnotationModifiedByTool(e,E.Deleted,!1);i.allAnnotations.forEach(e),a=oo(a,`${o}..annotations`,l)}return!0===r&&(a=oo(a,`${o}..plots{.type=="Study"}`,l)),a=Ua(a),a},Previous:{Update:function(e,t,i){return oo(e,mv,e=>(de(e,t),e))},Get:function(e,t,i){return ro(e,mv)[0]}},MovePlot:{Update:function(e,t,i){if(!gv(0,t,i).includes(t.targetPane))return e;const s=Sv(i,t.index),n=XT(e,qT(t.index));e.panes[s.pane].axes[s.axis].plots.splice(s.plot,1);let r=s.pane,o=!0;switch(t.targetPane){case"ExistingAbove":r--;break;case"NewAbove":e.panes.splice(r,0,JT(e)),o=!1;break;case"ExistingBelow":r++;break;case"NewBelow":r++,o=!1,e.panes.splice(r,0,JT(e))}o&&i.panes[r].isMain&&"Study"===n?.type&&"VOL"===n.study&&(n.detachedScale=!0);const a=e.panes[r];a.axes.length<2&&a.axes[0].plots.length>0&&a.axes.push({plots:[]});const l=a.axes.findIndex(e=>0===e.plots.length),c=-1===l?a.axes.length-1:l;a.axes[c].plots.push(n);let u=Av(e,s.pane);return u=Av(u,r),Ua(u)},Get:gv},PinPlot:{Update:function(e,t,i){if(!yv(0,t,i).includes(t.targetAxis))return e;const s=Sv(i,t.index),n=e.panes[s.pane],r=XT(e,qT(t.index));let o=-1;switch(t.targetAxis){case"PrimaryAxis":o=0;break;case"SecondaryAxis":o=1;break;case"NoAxis":r.detachedScale=!0}if(-1!==o)if(o!==s.axis)delete r.detachedScale,n.axes.length<2&&o>0&&n.axes.push({plots:[]}),n.axes[o].plots.push(r),n.axes[0===o?1:0].plots.splice(s.plot,1);else{delete n.axes[s.axis].plots[s.plot].detachedScale}return Ua(Av(e,s.pane))},Get:yv}};function vv(e){return"function"==typeof e}function Pv(e,t,i){return function(e,t){const i=Tv[e];if(vv(i))return i;{let e=void 0!==t?i[t]:void 0;if(!vv(e)&&(e=i[gs.DEFAULT_ACCESSOR_SUBACTION],!vv(e)))throw new Error("Invalid accesor id and/or sub id");return e}}(e.id,e.context.id)(t,e.context,i)}function Cv(e){return{id:"MainPlot",context:e}}const bv={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},Ev=/* @__PURE__ */Symbol.for("__ias__");class Lv{constructor(e=!1){this.headless=e,this.presenter=e?null:new WT(this)}presenter;_model;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)console.error("You cannot initialize a headless chart.");else if(this.presenter.initialize(e),te(t)){const e="string"==typeof t;e?Hv("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);const i=e?{symbol:t}:t;this.change(Cv(i))}}shutdown(){if(!this.headless){const e=this.presenter?.shutdown();return this.presenter=null,e}return!1}annotate(e,t=null,i=null){if(!this.headless)if(ie(e)){bo(e,t),Co(e,t);const s=XS(e,!1,t,i,this.presenter);s.isDrawingAnnotation&&this.presenter.view.setCursor(y.Crosshair),this.presenter.activeTool=s,q()||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 zv()}get model(){return(this.headless?this._model:this.presenter.getModel())||zv()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:gs.ACTION_TEMPLATE,context:{strip:e}})}change(...e){const t={chart:this,actions:e.filter(e=>!e[Ev])};t.actions.length>0&&this.presenter?.notifyHost(qa.CH_API_ACTIONS_RECEIVED,t);const i=Gv().config.validateInput,s=e.map(e=>i?Wa(e,gs.ACCESSOR_SCHEMA):e);if(1===s.length){const e=s[0];if(e.id===gs.ACTION_TEMPLATE||e.context.id===gs.ACTION_GET)return Pv(e,this.model,this.presenter);if(!this.headless&&e.id===gs.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}const{yes:n,no:r}=V(s,e=>e.id===gs.ACTION_PLOT&&ie(e.context)&&e.context.id===gs.ACTION_DELETE),o=ue(this.model);let a=ue(this.model);const l=r;n.length>0&&l.push({id:gs.ACTION_PLOT,context:{id:gs.ACTION_DELETE,plots:n.map(e=>e.context)}}),l.forEach(e=>{if(a=Pv(e,a,this.presenter),!ie(a))throw new Error("Forgot to return model from accessor")}),this.fromModel(a,o)}async fromModel(e,t){const i=Wa(e,gs.CHART_SCHEMA);this.headless?this._model=i:await(this.presenter?.fromModel(i,t))}async load(e,t){const i={...bv,...t};let s=Wa(JSON.parse(e),gs.CHART_SCHEMA);const n=this.model,r=ue(n);if(ie(n)){if(s=function(e,t,i){const s=Sa(t),n=s.type.toLowerCase();if(s[n]===gs.PLACEHOLDER_SYMBOL_NAME){const s=Sa(e),{mainAxis:n}=Ta(t),r=n.annotations,o=Ma(t,s);if(i){const{mainAxis:e}=Ta(o);e.annotations=r}return o}return t}(n,s,i.keepNewAnnotations),i.keepNewAnnotations||(s=pv(s)),i.keepOldAnnotations&&(s=function(e,t){const{mainAxis:i}=Ta(e),{mainAxis:s}=Ta(t);wT(i,s);const n=e=>ro(e,'..plots{.type==="Study"}.study')[0],r=ro(e,RT).filter(e=>e!==i),o=ro(t,RT).filter(e=>e!==s);return r.forEach(e=>{const t=n(e),i=o.find(e=>t===n(e));ie(i)&&wT(e,i)}),t}(n,s)),i.keepNewCompare||(s=fv(s)),i.keepOldCompare&&(s=function(e,t){const i=ro(e,uv),s=ro(t,uv),n=Math.max(0,4-s.length);if(0===n)return t;const r=i.filter(e=>!s.find(t=>e.symbol===t.symbol)).slice(0,n);if(0===r.length)return t;const{mainPane:o,mainAxis:a}=Ta(t),{mainAxis:l}=Ta(e);return r.forEach(e=>{l.plots.includes(e)?a.plots.push(e):hv(o,a).plots.push(e)}),t}(n,s)),i.keepOldAggregation){const e={id:gs.ACTION_AGGREGATION,context:n.data.aggregation},t=s.display.density;s=Pv(e,s,this.presenter),i.keepNewBarWidth&&ie(t)&&(s.display.density=t)}await this.fromModel(s,r),this.clearUndoRedo()}}save(){return JSON.stringify(this.model)}clearUndoRedo(){this.headless||this.presenter.undoRedoManager.clear(!0)}reset(e=!0){const t=zv();if(this.headless)this._model=t;else if(this.presenter.getModel()){const i=this.presenter.mainPlot;let s=null;const n=i;if(i.isSymbol?s={symbol:n.symbol}:i.isExpression?s={expression:n.expression}:i.isForward?s={forward:n.forward}:i.isSeasonal&&(s={seasonal:n.seasonal}),ie(s)){const i=Pv({id:"Theme",context:{id:"Get"}},this.model,this.presenter);let n=Pv(Cv(s),t,this.presenter);e&&(n=Pv({id:"Theme",context:i},n,this.presenter)),this.presenter?.fromModel(n)}}this.clearUndoRedo(),this.presenter?.notifyHost(qa.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){Hv("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:BT.call(this.presenter,e)}exportImage(e={}){return this.headless?null:FT.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){const s=this.presenter;if(this.headless||t<0||i<0||t>s.panes.length)return null;const n=s.panes[t];if(i>n.axes.length)return null;return n.axes[i].toY(e)}yToPrices(e){const t=this.presenter;if(this.headless)return null;for(const[i,s]of t.panes.entries()){const t=s.getBounds();if(ie(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(qa.CH_DIDBECOMEACTIVE,{chart:this})}}function Mv(){const e=globalThis.parent?.location?.hostname||"";return["","localhost","127.0.0.1"].includes(e)||function(e){const t=e.split(".");if(!t||4!==t.length)return!1;const i=t.map(Number);if(!i.every(e=>Number.isFinite(e)&&e>=0&&e<=255))return!1;const[s,n]=i;return 10===s||172===s&&n>=16&&n<=31||192===s&&168===n}(e)}function _v(){let e=document.domain;const t=e.split("."),i="__tld"+/* @__PURE__ */(new Date).getTime();let 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}function xv(e,t){var i;i=t,Object.keys(i).forEach(e=>!ie(i[e])&&delete i[e]);return`${e}/?${new URLSearchParams(t).toString()}`}function Iv(e,t=""){return xv(atob("aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ=="),{module:atob("YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy"),secret:t,referer:e})}function Dv(e,t){return e+Math.random()*(t-e)}const Ov=new Function(atob("Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg")),wv=new Function("f",atob("Zi5yZW1vdmVBbGxDaGFydHMoKTsg")),Rv=new Function("m",atob("cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiOw=="));async function Nv(e,t){if(t&&!Rv(e.mode))return;let i=!1,s=0,n=25;for(;!i&&s<5;){const t=Mv()||"FreeWidget"===e.mode,r=t?e.apiKey:"";try{const n=Iv(t?"":_v(),r),o=await fetch(n);if(o.ok){const 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++,n*=2,await new Promise(e=>setTimeout(e,n))}i&&e.knownSite||(setTimeout(Ov,Dv(2e3,3e3)),setTimeout(()=>wv(Gv()),Dv(4e3,5e3)))}const Vv={major:2,minor:366,patch:1};function Hv(e,t="info",i=""){const s=globalThis.console;s[void 0!==s[t]?t:"log"](e,i)}const Bv={environment:"Browser",validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${gs.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){const i=this.baseUrl[e];let s=`${i}${t}`;if(Rv(this.mode)&&this.knownSite){const{username:n,password:r}=this.credentials||{},o=ie(n,r),a=("timeseries"===e||"timeseriesNew"===e)&&o&&this.allowCredentials?`&username=${n}&password=${r}`:"";s=`https://${this.dataEndpoint}${i}${t}${a}`}const n=await fetch(s);return await n.text()},getCustomEventPopup:e=>null};async function Fv(e,t){const i=Gv()?.config;if(!i||!i.fetch)throw new 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 kv=!1,Wv=null;function Uv(e){const t=e.extensions?.studyProvider;if(!ie(t))return;const i=t.getFields(),s=t.getStudies(),n=ue(Rr(gs.CHART_SCHEMA)),r=n.definitions,o=r.studyField.enum,a=r.study.enum;for(const u of i)if(o.includes(u.id))throw new Error(`Field with id ${u.id} already exists`);for(const u of s)if(a.includes(u.id))throw new Error(`Study with id ${u.id} already exists`);var l,c;o.push(...i.map(e=>e.id)),a.push(...s.map(e=>e.id)),l=gs.CHART_SCHEMA,c=n,ka.addSchema(l,c),ja(i),Fr(s)}function $v(e,t={}){if(kv)throw new Error("You should only call initFeed once during page's lifetime");kv=!0;const i=Object.assign(Bv);return de(i,t),te(i.logo)&&function(e,t){const i=(new DOMParser).parseFromString(e,"image/svg+xml"),s=i.querySelector("svg")?.getAttribute("viewBox"),n=i.querySelector("path")?.getAttribute("d");if(te(s)&&te(n)){const e=s.split(" ").map(Number);4===e.length&&e.every(Number.isFinite)&&(GA={path:new Path2D(n),width:e[2],height:e[3],rect:new xn(0,0,0,0),logoClickable:t})}}(i.logo,i.logoClickable??!1),Uv(i),Wv=new e(i),Wv.version=`${Vv.major}.${Vv.minor}.${Vv.patch}`,Hv(`%cBarchart Chart version ${Wv.version}`,"info","font-size: larger"),Wv.cachesData&&(Wv.subject?.subscribe(Wv.onPerformInternalGc.bind(Wv)),ap.subscribe(qa.CH_ALL,Wv.onChartChanged.bind(Wv))),Wv}function Gv(){return Wv}function zv(){return ue(Gv()?.template)}function Yv(){te(Wv)&&(Wv.shutdown(),kv=!1,Wv=null)}function jv(){return new Lv(!0)}function Kv(e){const t=jv();return t.load(e),t.change({id:"Outline",context:{id:"Get"}})}function qv(e,t,i,s=null){return new Proxy(e,{get:function(e,n,r){return n===t?function(t){const r=s?t[s]:t;return(i.handlesRequestsFor(r)?i:e)[n](t)}:Reflect.get(e,n,r)}})}class Xv{constructor(e){this.config=e,this.timeSeriesSource=this.metaDataSource=this.recordSource=null,this.charts=/* @__PURE__ */new Map,this.pendingRedraw=/* @__PURE__ */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=Pe()}version;cachesData;timeSeriesSource;metaDataSource;recordSource;charts;pendingRedraw;template;ongoingAnimationCallbackId;_altDataSource;_subject;knowDefaultCurve;defaultOhlcCurve;knowDefaultAggregation;defaultAggregation;knowDefaultPeriod;defaultPeriod;knowDefaultDensity;defaultDensity;id;_mainFeed=null;get subject(){return this.isAuxiliary||te(this._subject)||(this._subject=(new ql).pipe(fc(gs.INTERNAL_GC_MILLIS),pc(e=>e.length>0))),this._subject}get isAuxiliary(){return null!==window.opener}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=qv(this.timeSeriesSource,"getTimeSeries",e,"symbol"),this.metaDataSource=qv(this.metaDataSource,"getMetaData",e),this.recordSource=qv(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(!te(this.timeSeriesSource))throw new Error("No time series source defined");return this.timeSeriesSource}getMetaDataSource(){if(!te(this.metaDataSource))throw new Error("No metadata source defined");return this.metaDataSource}getRecordSource(){if(!te(this.recordSource))throw new Error("No record source defined");return this.recordSource}async ready(){return ps.call(this,async()=>{const e=this instanceof tP||this instanceof Zv||this instanceof nP;await Nv(this.config,e);let t=this.config.defaultTemplate;if(!t)throw new Error("Must provide a default template");if("string"==typeof t){const e=await fetch(t);t=await e.json()}return this.template=Wa(t,gs.CHART_SCHEMA),!0})}getHeadlessChart(){return jv()}fixupRenderTo(e){if(!te(e))return null;if(e instanceof HTMLElement)return e;const t=rs(`#${e}`);if(te(t))return t;const i=[...this.charts.keys()].find(t=>t.id===e);return te(i)?i:null}checkChart(e,t){const i=this.fixupRenderTo(e),s=te(i)&&this.charts.has(i);return te(t)&&t!==s&&Hv(`There is ${t?"no":"already a"} chart inside the element ${e}`,"error"),i}addChart(e,t=null){const i=this.checkChart(e,!1),s=new Lv;return this.charts.set(i,s),s.initialize(e,t),s}removeChart(e){const t=this.checkChart(e,!0);if(!te(t))return;this.charts.get(t).shutdown(),this.charts.delete(t)}removeAllCharts(){for(const e of this.charts.keys())this.removeChart(e)}getChart(e){const t=this.checkChart(e);return te(t)?this.charts.get(t):null}redraw(e){const t=this.checkChart(e,!0);te(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),te(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach(e=>{const t=this.getChart(e);if(!te(t?.presenter?.view))return;const i=t.presenter.view;i.isHostElementVisible&&i.draw()}),this.pendingRedraw.clear()}get emptyEntities(){return{metaData:/* @__PURE__ */new Set,records:/* @__PURE__ */new Set,timeSeries:/* @__PURE__ */new Set}}getAllCacheableEntities(e){for(const t of this.charts.values())t.presenter.getCacheableEntities(e)}getCacheableEntities(){const e=this.emptyEntities;return this.getAllCacheableEntities(e),e.timeSeries.forEach(t=>{te(t)&&(te(t.record)&&e.records.add(t.record),te(t.records)&&Object.values(t.records).forEach(t=>e.records.add(t)))}),e}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){this.getTimeSeriesDataSource().refresh(),J(qa.DF_STREAMRECONNECTED,{})}evictUnused(e){this.getMetaDataSource().evictUnused(e.metaData),this.getRecordSource().evictUnused(e.records),this.getTimeSeriesDataSource().evictUnused(e.timeSeries)}onPerformInternalGc(){const e=this.getCacheableEntities();this.evictUnused(e)}triggerGc(){this.subject?.next()}onChartChanged(e,t){e!==qa.CH_RECREATED&&e!==qa.CH_SHUTDOWN||(this.isAuxiliary?this._mainFeed?.triggerGc():this.triggerGc())}getDefaultMultiFieldCurve(){if(!te(this.template))return null;if(!this.knowDefaultCurve){const e=Sa(this.template);1===e.curves.length&&function(e){switch(o[e]){case o.OHLC:case o.HLC:case o.Candlestick:case o.HollowCandles:case o.HeikinAshi:case o.ElderImpulseSystem:case o.Range:case o.MultiColumn:return!0;default:return!1}}(e.curves[0].style)?this.defaultOhlcCurve=ue(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=ue(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 Zv extends Xv{constructor(e){super(e),this.timeSeriesSource=new Rh(!1),this.metaDataSource=new nn,this.recordSource=new iu}}class Jv extends Xv{constructor(e){super(e),this.timeSeriesSource=new Rh(!0),this.metaDataSource=new nn,this.recordSource=new su}}class Qv extends Xv{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Rh(!0),this.metaDataSource=new nn,this.recordSource=new iu}}const eP=["drazen.dotlic@barchart.com","princec","b.hebert24@barchart.com"];class tP extends Xv{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;_connection;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Rh(!0),this.metaDataSource=new rn,this.recordSource=new nu,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,te(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){te(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&&eP.includes(this.connection._username)&&Hv(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===gs.BC_EVENT_DISCONNECTED||e===gs.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):e!==gs.BC_EVENT_LOGGED_IN&&e!==gs.BC_EVENT_FEED_RESUMED||(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),te(this._connection)&&(this.connection.off("timestamp",this.onTimestamp),this.connection.off("events",this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}}function iP(e,t){return new sP(e,t)}class sP{_client;_subscriptions=/* @__PURE__ */new Map;_listeners=/* @__PURE__ */new Set;constructor(e,t){this._client=e;const i=e=>e.find(e=>this._subscriptions.has(e))??null;t.onConnected=()=>{this._listeners.forEach(e=>e?.onConnected())},t.onMessageWithMetadata=(e,t)=>{const s=e.marketSnapshot;if(te(s)){const e=i(t);null!==e&&this._listeners.forEach(t=>t.onSnapshot?.(s,e))}const n=e.marketUpdate;if(te(n)){const e=i(t);null!==e&&this._listeners.forEach(t=>t.onUpdate?.(n,e))}},t.onDisconnected=()=>{this._listeners.forEach(e=>e?.onDisconnected())},t.onHeartBeat=e=>{this._listeners.forEach(t=>t.onHeartBeat?.(e))}}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}async ready(){return te(await this._client.connection)}shutdown(){te(this._client)&&(this._client.dispose(),this._subscriptions.clear(),this._listeners.clear())}subscribeToRealTime(e){if(this._subscriptions.has(e)||!te(this._client))return;const t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribeFromRealTime(e){if(!this._subscriptions.has(e)||!te(this._client))return;const t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e)}async getInstrument(e){const t=await this._client.connection;return await(t?.getInstrument(e))??[]}}class nP extends Xv{_adapter=null;_auxFeeds=[];constructor(e){super(e),this.cachesData=!0,this.isAuxiliary||(this.timeSeriesSource=new Rh(!0),this.metaDataSource=new on,this.recordSource=new ru,ap.subscribe(qa.TS_ALL,this.onTimeSeriesMessage.bind(this)))}onTimeSeriesMessage(e,t){if(!this.isAuxiliary)for(const i of this._auxFeeds)i.notifySeriesMessage(e,t)}notifySeriesMessage(e,t){this.isAuxiliary&&J(e,t)}getAdapter(){return this.isAuxiliary?this._mainFeed?._adapter:this._adapter}setAdapter(e){if(this.isAuxiliary)throw new Error("Cannot set adapter on auxiliary feed");this._adapter=e,this._adapter.addListener(this)}async ready(){if(this.isAuxiliary){const 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.getAdapter()?.subscribeToRealTime(e)}unsubscribe(e){this.getAdapter()?.unsubscribeFromRealTime(e)}shutdown(){super.shutdown(),this.isAuxiliary?(this._mainFeed?.removeAuxFeed(this),this._mainFeed=null):this._adapter?.shutdown()}onConnected(){this.refreshCaches()}onDisconnected(){}onHeartBeat(){}onUpdate(e,t){this.ofRecordSource.onUpdate(e,t)}onSnapshot(e,t){this.ofRecordSource.onSnapshot(e,t)}get ofRecordSource(){return this.recordSource}replaceDataSources(e){super.replaceDataSources(e),this._mainFeed=e}addAuxFeed(e){e.replaceDataSources(this),this._auxFeeds.push(e),this._adapter?.addListener(e)}removeAuxFeed(e){const t=this._auxFeeds.findIndex(t=>t.id==e.id);-1!==t&&(this._auxFeeds.splice(t,1),this._adapter?.removeListener(e),this.triggerGc())}getAllCacheableEntities(e){if(super.getAllCacheableEntities(e),!this.isAuxiliary)for(const t of this._auxFeeds)t.getAllCacheableEntities(e)}}const rP=ap;export{Wo as Aggregation,l as AggregationSpec,a as AggregationUnit,Zv as BarchartSiteDataFeed,Xv as BaseDataFeed,tu as BaseRecordSource,P as ChunkPart,Eh as ContainerWrapperTimeSeries,OT as CustomEventPopup,tl as EmptyRecord,t as ExpressionMissingBar,s as ExpressionNoDataApproach,i as ExpressionRecompute,Vm as ExpressionSeries,Ga as Field,h as FieldCategory,u as FieldFormat,c as FieldValueType,Ka as Fields,tP as MarketDataFeed,Qv as MiniWidgetDataFeed,Eu as OHLCDataPointBuilder,nP as OpenFeed,rP as PubSub,m as SeriesKind,Jv as SnapshotDataFeed,up as StudySeries,Mu as TimeSeriesContainer,ip as TimeSeriesQuery,qa as Topics,iP as adaptOpenFeedClient,us as appendDOMElement,ps as asyncReady,Cy as convertSeries,fa as doesExpressionHaveComputation,zr as doesStudyExist,ua as evaluateExpression,da as formatExpression,zs as formatPriceWithDecimals,Pe as generateUid,$r as getAnnotationTraits,Kv as getChartOutline,Ys as getCombinedMetaData,pa as getExpressionSymbols,Gv as getFeed,En as getLightness,tT as getStudyOptions,Zr as getTaxonomies,Ki as hasOpenInterest,$v as initFeed,Py as linReg,Nm as makeExpression,cp as makeHelperField,ny as makeStudy,by as mapSeries,ay as movAvg,ly as movExp,hy as movHul,cy as movSmo,uy as movWei,Tu as optionValueToDate,ca as parseExpression,ma as replaceExpressionSymbols,Ay as roc,as as setAttributesDOMElement,Yv as shutdownFeed,vy as stdDev,os as styleDOMElement,my as trueRange,yy as typical};
|